Clark
pip install clark
Testing
Run tests by executing python setup.py test.
Classes
Super ArgParser
A nicer way to deal with config files and argparser:
config_file.cnf:
test = 1
debug
Your app:
from clark import SuperArgParser, ConfigFileAction
parser = SuperArgParser()
parser.add_argument('-c', action=ConfigFileAction)
parser.add_argument('--debug', action='store_true')
parser.add_argument('--test', type=int)
parser.add_argument('--engage')
options = parser.parse_args([
'--engage', 'foo',
'-c', 'config_file.cnf'
])
assert options.test == 1
assert options.engage == 'foo'
assert options.debug is True
Super Enum
A simple Enum class with lots of nice properties.
from clark import SuperEnum
class Colors(SuperEnum):
red = SuperEnum.E
blue = SuperEnum.E
green = SuperEnum.E
class OtherColors(SuperEnum):
yellow = SuperEnum.E
red = SuperEnum.E
red = Colors['red']
red = Colors.red
assert red in Colors
assert str(red) == 'red'
assert red == Colors.red
assert Colors.red != OtherColors.red
class Foo(object):
class Colors(SuperEnum):
blue = SuperEnum.Element
assert Foo.Colors.blue != Colors.blue
Super JSON
Make simplejson slightly better (don’t crash on datetime objects)
from clark import super_json
now = datetime.datetime.now()
x = super_json.loads(super_json.dumps({ 'a': now }))
assert x['a'] == now.isoformat()
Super PidFile
A simple PidFile class. Instantiate when you boot up, and close it when you exit.
from clark import SuperPidFile
pidfile = SuperPidFile()
try:
... run your app ...
finally:
pidfile.close()
Super Thread
Threads that terminate nicely and are awesome.
from clark import SuperThread
class T(SuperThread):
def bootstrap(self):
self.i = 0
def sleep(self):
time.sleep(0.01)
def work(self):
self.i += 1
def cleanup(self):
assert self.i > 0
t = T()
t.start()
time.sleep(1)
t.terminate()
t.join()
assert not t.is_alive()
Metadata
Release files for clark 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clark-0.1.0.tar.gz | 5.4 kB | Without provenance | Details for clark-0.1.0.tar.gz |
Release files / clark-0.1.0.tar.gz
| Download URL | clark-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
537fb4b8bc0f97158331835502fbadd23d980fd1e4076bf74546d58a7e6e28ce
|
|
BLAKE2b-256 checksum How to use checksums |
1a42fbb8ef57e7fe67e68884ba4a1ccb5af7bf4bee962573cd860ef00733725d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for clark 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.