Skip to main content

Oakley's Common Toolkit

Project description

octk

Utilities

uniquify

Given a file path, uniquify will return a unique file path by appending a number to the file name if necessary.

example_dir
├── foo.txt
└── bar
    └── baz.txt
from octk import uniquify

uniquify('example_dir/foo.txt')
# 'example_dir/foo(1).txt'

uniquify('example_dir/bar')
# 'example_dir/bar(1)'

uniquify('example_dir/bar.txt')
# 'example_dir/bar.txt'

pytree.FileTree

Created to work around the fact that Windows' tree does not allow you to exclude folders or filter files by extension.

from octk import FileTree

tree = FileTree('example_dir')
tree.print_tree()
example_dir
├── foo.txt
└── bar
    └── baz.txt

make_draft_email()

Given the basic information of an email (i.e. subject, content, & recipients), make_draft_email() will create a valid .eml file that can be opened and sent by an email client.

from octk import make_draft_email

make_draft_email(
    out_path='out/folder/example.eml',
    subject='Hello, World!',
    content='This is a test email.',
    recipients=['example@hello.com']
)

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

octk-0.1.0.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

octk-0.1.0-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

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