Metadata-Version: 2.4
Name: pymultimap
Version: 0.0.9
Summary: Dictionary-like container with support for duplicate keys and optional key sorting.
Project-URL: Documentation, https://github.com/sachinsachdeva/pymultimap#readme
Project-URL: Issues, https://github.com/sachinsachdeva/pymultimap/issues
Project-URL: Source, https://github.com/sachinsachdeva/pymultimap
Author-email: sachinsachdeva <7625278+sachinsachdeva@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.10
Requires-Dist: pytest>=8.3.5
Requires-Dist: sortedcontainers
Description-Content-Type: text/markdown

# pymultimap

[![PyPI - Version](https://img.shields.io/pypi/v/pymultimap.svg)](https://pypi.org/project/pymultimap)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pymultimap.svg)](https://pypi.org/project/pymultimap)

-----

**Table of Contents**
- [MultiMap](#multimap)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## MultiMap

Python dictionary-like container with support for duplicate keys and optional key sorting.

## Installation

```console
pip install pymultimap
```

## Usage

```python
from pymultimap import MultiMap

mm = MultiMap()
mm["a"] = 1
mm["a"] = 2
mm["b"] = 3

print(mm)
```

Output:

```python
{a: [1, 2], b: [3]}
```

```python
from pymultimap import MultiMap

sorted_multimap = MultiMap(sorted=True, reverse=True)
sorted_multimap["a"] = 1
sorted_multimap["c"] = 3
sorted_multimap["b"] = 2

print(sorted_multimap)
```

Output:

```python
{c: [3], b: [2], a: [1]}
```

`mm[key]` always returns the list of values associated with that key. When `sorted=True`,
keys are ordered by key value, and `reverse=True` is available only with sorted maps.

## License

`pymultimap` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
