replacements
There is a single class of interest in this project: Replacer.
It is an object for replacing strings with other strings in json-like objects.
The initializer takes a list of assignments, each of which is a dictionary containing a name, a type, and optionally args and kwargs.
There are currently 6 implemented types:
identity: returns the argument passed to it.localfile: passes theargsandkwargstoopenand then reads the file object. The mode is always 'r'.fsspec: passes theargsandkwargstofsspec.open, opens that, and reads. The mode is always 'r'. Requires fsspec to be installed. fsspec has multiple protocols installed, e.g. http(s), (s)ftp and zip. This can also be used for data on S3, if s3fs is installed.awssecret: takes two arguments:region_nameandsecret_id. Uses boto to call secretsmanager, and returns the returnedSecretString.env: takes two arguments:name, and optionally adefaultvalue. If the environment variable doesn't exist and no default value was passed, an AssertionError will be raised.base64uuid4: the base64 (the url safe "-_" variant) of auuid.uuid4call. Use this to create a unique id that can be used in multiple derived replacements.
Example:
Replacer([{
"name": "name",
"type": "identity",
"args": ["World"]
}])("Hello, ${name}!")
returns "Hello, World!"
There can be dependencies between the assignments. They are resolved linearly using the list order:
Replacer([
{
"name": "name",
"type": "identity",
"args": ["World"]
},
{
"name": "greeting",
"type": "identity",
"args": ["Hello, ${name}!"]
}
])("${greeting}")
also returns "Hello, World!"
Metadata
Release files for replacements 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 |
|---|---|---|---|---|
| replacements-1.0.tar.gz | 4.5 kB | Without provenance | Details for replacements-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| replacements-1.0-py3-none-any.whl | Python 3 | none | any | Details for replacements-1.0-py3-none-any.whl |
Total release size: 9.8 kB
Release files / replacements-1.0.tar.gz
| Download URL | replacements-1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cdb83bae88fac09565b93598735abd0cba6a2d91822d8a69f42edfeed2ba569
|
|
BLAKE2b-256 checksum How to use checksums |
0241f29e3a46bb164c5bcb6095d7b625ed42ff14dca28b87e7ed4be21b134a24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.10
|
Release files / replacements-1.0-py3-none-any.whl
| Download URL | replacements-1.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f0d75e563bba22ca7cb375de1b51adb16f27219153595fe51f2bb5c196d6d77
|
|
BLAKE2b-256 checksum How to use checksums |
ac0a7eb0f72e9d850c4d32cfeb95a805037a58f171f85b2693a8a22d39fc1523
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.10
|
Security for replacements 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.