More Data Structures
More Data Structures or more-ds for short, provides simple and convenient Python data structures.
Data Structures
id
- SemVer
Class for easy creation of semantic version numbers.
network
- URL
Class for easy (unvalidated) URL construction.
time
- Timer
Context manager for timing a block of code.
Getting Started
% pip install more-ds
>>> from more_ds.network import URL
>>> base_url = URL("http://example.org/")
>>> api_url = base_url / "api"
>>> url = api_url / "ip" / "address" // dict(version=4)
>>> print(url)
http://example.org/api/ip/address?version=4
Or
from time import sleep
from more_ds.time import Timer
with Timer() as t:
# sleep for half a second
sleep(.5)
print(t.elapsed) # -> 0:00:00.501864
Or
>>> from more_ds.id import SemVer
>>> old = SemVer("v3.1.4")
>>> new = SemVer("3.2")
>>> old
SemVer("3.1.4")
>>> new
SemVer("3.2.0")
>>> old == new
False
>>> old < new
True
>>> old > new
False
>>> repr(old)
'SemVer("3.1.4")'
>>> repr(new)
'SemVer("3.2.0")'
>>> isinstance(old, str)
True
Origin
The projected started with the need to extract the simplest of classes from an existing open source library, nwa-stdlib. That library primarily contained code that was rather specific to the organization that created the library. However, the URL class was a tiny convenience data structure, with broader applicability, that took the chore out of programmatically creating URLs. By extracting that class into a separate project, one that is specifically focussed on convenient data structures, it hopefully attracts a broader set of users that would otherwise don’t feel comfortable including nwa-stdlib as a whole.
The project’s name was inspired by the wonderful More Itertools library.
Release files for more-ds 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| more-ds-0.0.6.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| more_ds-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.9 kB
Release files / more-ds-0.0.6.tar.gz
| Download URL | more-ds-0.0.6.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
931d6913beebcf9c4e8155b6b58eef3fc94f000c5b6fb838261b2c0c8886b69c
|
|
BLAKE2b-256 checksum How to use checksums |
1c07188c20daff5349c65bfcebd3b972bb1def809724778f11e3744eda0933fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / more_ds-0.0.6-py3-none-any.whl
| Download URL | more_ds-0.0.6-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
777df5b01e3a492ccccd4058156e7d916013e02e85248a8b2c2ca1d1ab13789b
|
|
BLAKE2b-256 checksum How to use checksums |
b8d18054c137a20430adb73f269f120314956574f40d3317a3b0c7a19625d48e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|