Skip to main content

An ordered, one-to-many mapping.

Project description

https://codecov.io/gl/futursolo/magicdict/branch/master/graph/badge.svg https://gitlab.com/futursolo/magicdict/badges/master/build.svg

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 GitLab.

License

Copyright 2018 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

http://www.apache.org/licenses/LICENSE-2.0

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.

Filename, size & hash SHA256 hash help File type Python version Upload date
magicdict-1.0.3-py3-none-any.whl (15.1 kB) Copy SHA256 hash SHA256 Wheel py3
magicdict-1.0.3.tar.gz (13.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page