Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

treestamps

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treestamps

Create timestamp records for recursive operations on directory trees.

  • 1.0.2
  • Source
  • PyPI
  • Socket score

Maintainers
1

Treestamps

A library to set and retrieve timestamps to speed up operations run recursively on directory trees.

Documentation is pretty poor. Read the code for now.

Usage

Used in picopt and nudebomb. You can see how it's used in those projects.

    from pathlib import Path
    from treestamps import Grovestamps, GrovestampsConfig

    config = GrovestampsConfig(
        "MyProgramName",
        paths=("/foo", "/bar"),
        program_config={ "option_a": True, "option_b": False}
    )
    gs = Grovestamps(config)

    timestamp = gs[Path("/foo")].get()
    assert None == timestamp.get("file_relative_to_foo.txt")
    mtime = timestamp.set("file_relative_to_foo.txt")
    # mtime ~= now()
    # Also writes to `/foo/.MyProgramName_treestamps.wal.yaml`

    gs.dump()

Dumping removes /foo/.MyProgramName_treestamps.wal.yaml and writes to /foo/.MyProgramName_treestamps.yaml and /bar/.MyProgramName_treestamps.yaml

    # With similar config to above
    gs = Grovestamps(config)
    # Auto loads timestamps relevant to paths in config.

    timestamp_foo = gs[Path("/foo")].get()
    mtime_b = timestamp_foo.get("file_relative_to_foo.txt")
    mtime_a = timestamp_foo.get("another_file_relative_to_foo.txt")
    # mtime will be the time gs.dump() you called above.
    assert mtime_a == mtime_b

    timestamp_bar = gs[Path("/bar")].get()
    mtime_c = timestamp_foo.get("file_relative_to_bar.txt")
    assert mtime_c == mtime_a

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc