An ordered, one-to-many mapping.
Project description
An ordered, one-to-many mapping.
Install
$ pip install -U magicdict
Thread Safety
FrozenMagicDict
and its subclasses should be thread safe without additional
locking. If any data races occurred, then that’s a bug. Please file an issue
with reproducing procedure.
Usage
MagicDict
should function like collections.OrderedDict
except
move_to_end
is not defined and d[key]
always returns the first
item.
FrozenMagicDict
is an immutable version of MagicDict
.
FrozenTolerantMagicDict
and TolerantMagicDict
are
case-insensitive versions of FrozenMagicDict
and MagicDict
respectively.
get_first
, get_last
, get_iter
, and get_list
:
These methods are available in FrozenMagicDict and its subclasses.
For more details, please read the comments of each method.
add
:
Method add
is available in MagicDict
and
TolerantMagicDict
. This method is used as an substitution of
dic[key] = value
as it can append a value to the
dictionary without removing the existing one. Setting values like normal
OrderedDict
will clear the stored value(s) if any.
Contributing
The repository is hosted on GitHub.
License
Copyright 2020 Kaede Hoshikawa
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file magicdict-1.0.6.tar.gz
.
File metadata
- Download URL: magicdict-1.0.6.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75a9e47056a11a3fb6c13e352267a0dfa0707da7089a93af44e10e467a0a0ae6 |
|
MD5 | 77154316ee3f4f7c8e95480bee3828ee |
|
BLAKE2b-256 | 2a3a6e135eb40fe2ecc277d4533b78e3a5d5a8859a8be495c1dfbb98bba5c0e2 |
File details
Details for the file magicdict-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: magicdict-1.0.6-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59705375e5485fc203dc1b79713ca5692088802ff61d9e1879dae75effc2457d |
|
MD5 | 4b374fc6a660ef2668b0b3791e843780 |
|
BLAKE2b-256 | 53a0ebf9995f1d74c3698b256fd13516844ed537f86513aecad490d6a791a5ab |