dict-reorder
dict-reorder is a Python package designed to reorder dictionaries.
Usage
Swapping keys:
import dict_reorder
example = {
"chemical_formula": "NaCl",
"compound_name": "Sodium Chloride",
"molar_mass": 58.443,
"state_at_room_temp": "solid",
"melting_point": 800.7,
"boiling_point": 1465,
"solubility_in_water": "high",
"hazard_classification": None
}
example = dict_reorder.swapKeys(example, "compound_name", "chemical_formula")
# New value:
#{
# 'compound_name': 'Sodium Chloride',
# 'chemical_formula': 'NaCl',
# 'molar_mass': 58.443,
# 'state_at_room_temp': 'solid',
# 'melting_point': 800.7,
# 'boiling_point': 1465,
# 'solubility_in_water': 'high',
# 'hazard_classification': None
#}
This can also be done with indexes:
dict_reorder.changeKeyIndex(example, "compound_name", 0)
Creating your own dictionary and assigning to indexes can also be done:
from dict_reorder import DictReorder
planet = DictReorder()
planet.addKey(name="name", value="earth", index=0)
planet.addKey("gravity", 9.80665, index=2)
planet.addKey("mass", 5.97219e24, 1)
planetInfo = planet.getDictionary()
# `planetInfo`
#{
# 'name': 'earth',
# 'mass': 5.9722e+24,
# 'gravity': 9.80665
#}
Metadata
Release files for dict-reorder 0.1
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 | |
|---|---|---|---|---|
| dict_reorder-0.1.tar.gz | 3.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dict_reorder-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / dict_reorder-0.1.tar.gz
| Download URL | dict_reorder-0.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42ed139884175cdba794f3d82d5d5d82f64e43b7070393b1aca67ea17fb9b66b
|
|
BLAKE2b-256 checksum How to use checksums |
d638ee02dce25e20b347dcecbb77ca576f01eb182ecbfe466009e5af7903e607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Release files / dict_reorder-0.1-py3-none-any.whl
| Download URL | dict_reorder-0.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0e6873283b909befc2030236fa9543521f937ac3cc6cc811ec35d724c25635c
|
|
BLAKE2b-256 checksum How to use checksums |
9b1a1a3d376a83468af92165b3ef238d1efd3d79d1a67fa3aead21056986eadc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Security for dict-reorder 0.1
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.