Object-oriented names for the digital era.
Project description
naming
Object-oriented names for the digital era.
naming
provides an interface for dealing with naming conventions; from
defining them, to identifying names and creating new ones.
Installation
naming
is available for Python 3.8+ via PyPI.
$ pip install naming
Example
Please refer to the documentation walkthrough for details on contents and usage.
>>> import naming
>>> class NameFileConvention(naming.Name, naming.File):
... config = dict(first=r'\w+', last=r'\w+', number=r'\d+')
...
>>> name = NameFileConvention('john doe 07.jpg')
>>> name.last
'doe'
>>> name.number
'07'
>>> name.get(first='jane', number=99) # returns new name string
'jane doe 99.jpg'
>>> name.last = 'connor' # mutates current name
>>> name
NameFileConvention("john connor 07.jpg")
>>> name.number = 'not_a_number'
...
ValueError: Can't set field 'number' with invalid value 'not a number' on 'NameFileConvention("john doe 07.jpg")'. A valid field value should match pattern: '\d+'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
naming-0.7.1.tar.gz
(14.7 kB
view details)
Built Distribution
File details
Details for the file naming-0.7.1.tar.gz
.
File metadata
- Download URL: naming-0.7.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 847dbe7391a7c065bd31352b6a5f7a84b9bf743478049f16c1c1a30f065873d1 |
|
MD5 | 11f7d8b8f8823955054ac44d3d1634d6 |
|
BLAKE2b-256 | ad86324f424668cecddece79df4d9d67798dee4779ff2f9185c1f07b34717e6f |
File details
Details for the file naming-0.7.1-py3-none-any.whl
.
File metadata
- Download URL: naming-0.7.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 914b52e9804432bd7f585f3b57ab719bb065a28c3bc6e1fb88c06da5250a0ff5 |
|
MD5 | c9a78c4b46d21debb87eee99fca7dd0c |
|
BLAKE2b-256 | 251bc6fff92c6e5bf2b553c3600febb305592938e4ab444a8c142ced563a4e12 |