Skip to main content

Pistachio aims to simplify reoccurring tasks when working with the file system.

Project description

pistachio

Pistachio aims to simplify reoccurring tasks when working with the file system.

Developing

To install pistachio, along with the tools you need to develop and run tests, run the following in your virtualenv:

$ pip install -e .[dev]

Install

You can install pistachio by running the following command.

$ pip install pistachio

Usage

To use pistachio you can inport the module by running the following commands.

>>> import pistachio

Describe

Method to return a description for the resource.

>>> print(json.dumps(pistachio.describe("README.md"), sort_keys=2, indent=2))
{
  "exists": true,
  "is_directory": false,
  "is_file": true,
  "is_symlink": false,
  "name": "README.md",
  "path": "README.md",
  "stem": "README",
  "suffix": ".md"
}

print(json.dumps(pistachio.tree("src"), sort_keys=2, indent=2))

Exists

You can confirm if a directory, file or symbolic link exists using the following method.

>>> pistachio.exists("README.md")
True

Get MD5 Hash

This method will return the MD5 hash string for a specific file.

>>> pistachio.get_md5_hash("README.md")
"2f853812babf98322618edeb24359591"

Is Directory

Is the resource a directory? True or False.

>>> pistachio.is_directory("README.md")
False

Is File

Is the resource a file? True or False.

>>> pistachio.is_file("README.md")
True

Is Symlink

Is the resource a symbolic link? True or False.

>>> pistachio.is_symlink("README.md")
False

Make Directory

Make a new directory or directory tree.

>>> pistachio.make_directory("src")
>>> pistachio.exists("src")
True

Touch

This method will create an empty file with a given filename and directory path.

>>> pistachio.touch("foo.bar")
True

Tree

This method will return a list of directories, files and symlinks below a specific directory.

>>> print(json.dumps(pistachio.tree("src"), sort_keys=2, indent=2))
{
  "path": "src",
  "results": [
    {
      "exists": true,
      "is_directory": false,
      "is_file": true,
      "is_symlink": false,
      "name": "__init__.py",
      "path": "./__init__.py",
      "stem": "__init__",
      "suffix": ".py"
    },
    {
      "exists": true,
      "is_directory": false,
      "is_file": true,
      "is_symlink": false,
      "name": "pistachio.py",
      "path": "./pistachio.py",
      "stem": "pistachio",
      "suffix": ".py"
    }
  ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pistachio-0.3.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pistachio-0.3.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pistachio-0.3.0.tar.gz.

File metadata

  • Download URL: pistachio-0.3.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for pistachio-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f9b18dc5f9c254d02620be110ebb02c7a39828ba93b424d193fbe5fdde1a5b50
MD5 58953c5fccba2a606cb7e586d7310bf4
BLAKE2b-256 cebd5c5a3f8ddae9d4220c7331e36a30560ea4f32e3c95439736828a49141569

See more details on using hashes here.

File details

Details for the file pistachio-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pistachio-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for pistachio-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e27c82d5bdf0a6ead2ff5d75dfb5485f6723224e884ac4796e21b6cb0ec17111
MD5 e2c092e6b48086b69dd24634262e5fce
BLAKE2b-256 57181b6e798a478b53bf2fbb5940140c5fe7f79757664d208994d620fcdf3d3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page