Import python venv for stability
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
pip
|
||||
+496
@@ -0,0 +1,496 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: frozendict
|
||||
Version: 2.4.7
|
||||
Summary: A simple immutable dictionary
|
||||
Home-page: https://github.com/Marco-Sulla/python-frozendict
|
||||
Author: Marco Sulla
|
||||
Author-email: marcosullaroma@gmail.com
|
||||
License: LGPL v3
|
||||
Project-URL: Bug Reports, https://github.com/Marco-Sulla/python-frozendict/issues
|
||||
Project-URL: Source, https://github.com/Marco-Sulla/python-frozendict
|
||||
Keywords: immutable hashable picklable frozendict dict dictionary map Mapping MappingProxyType developers stable utility
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Natural Language :: English
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Topic :: Software Development :: Libraries
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: Utilities
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE.txt
|
||||
Dynamic: author
|
||||
Dynamic: author-email
|
||||
Dynamic: classifier
|
||||
Dynamic: description
|
||||
Dynamic: description-content-type
|
||||
Dynamic: home-page
|
||||
Dynamic: keywords
|
||||
Dynamic: license
|
||||
Dynamic: license-file
|
||||
Dynamic: project-url
|
||||
Dynamic: requires-python
|
||||
Dynamic: summary
|
||||
|
||||
# frozendict
|
||||
### Table of Contents
|
||||
* [Introduction](#introduction)
|
||||
* [Install](#install)
|
||||
* [API](#api)
|
||||
* [frozendict API](#frozendict-api)
|
||||
* [deepfreeze API](#deepfreeze-api)
|
||||
* [Examples](#examples)
|
||||
* [frozendict examples](#frozendict-examples)
|
||||
* [deepfreeze examples](#deepfreeze-examples)
|
||||
* [Building](#building)
|
||||
* [Benchmarks](#benchmarks)
|
||||
|
||||
# Introduction
|
||||
Welcome, fellow programmer, to the house of `frozendict` and
|
||||
[deepfreeze](#deepfreeze-api)!
|
||||
|
||||
`frozendict` is a simple immutable dictionary. It's fast as `dict`, and
|
||||
[sometimes faster](https://github.com/Marco-Sulla/python-frozendict#benchmarks)!
|
||||
|
||||
Unlike other similar implementations, immutability is guaranteed: you can't
|
||||
change the internal variables of the class, and they are all immutable
|
||||
objects. Reinvoking `__init__` does not alter the object.
|
||||
|
||||
The API is the same as `dict`, without methods that can change the
|
||||
immutability. So it supports also `fromkeys`, unlike other implementations.
|
||||
Furthermore, it can be `pickle`d, un`pickle`d and have a hash, if all values
|
||||
are hashable.
|
||||
|
||||
You can also add any `dict` to a `frozendict` using the `|` operator. The result is a new `frozendict`.
|
||||
|
||||
# Install
|
||||
|
||||
You can install `frozendict` by simply typing in a command line:
|
||||
|
||||
```bash
|
||||
pip install frozendict
|
||||
```
|
||||
|
||||
The C Extension is optional by default from version 2.3.5. You can make it mandatory using:
|
||||
|
||||
```bash
|
||||
CIBUILDWHEEL=1 pip install frozendict
|
||||
```
|
||||
|
||||
On the contrary, if you want the pure py implementation:
|
||||
|
||||
```bash
|
||||
FROZENDICT_PURE_PY=1 pip install frozendict
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
## frozendict API
|
||||
The API is the same of `dict` of Python 3.10, without the methods and operands which alter the map. Additionally, `frozendict` supports these methods:
|
||||
|
||||
### `__hash__()`
|
||||
|
||||
If all the values of the `frozendict` are hashable, returns a hash, otherwise raises a TypeError.
|
||||
|
||||
### `set(key, value)`
|
||||
|
||||
It returns a new `frozendict`. If key is already in the original `frozendict`, the new one will have it with the new value associated. Otherwise, the new `frozendict` will contain the new (key, value) item.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
It returns a new `frozendict` without the item corresponding to the key. If the key is not present, a KeyError is raised.
|
||||
|
||||
### `setdefault(key[, default])`
|
||||
|
||||
If key is already in `frozendict`, the object itself is returned unchanged. Otherwise, the new `frozendict` will contain the new (key, default) item. The parameter default defaults to None.
|
||||
|
||||
### `key([index])`
|
||||
|
||||
It returns the key at the specified index (determined by the insertion order). If index is not passed, it defaults to 0. If the index is negative, the position will be the size of the `frozendict` + index
|
||||
|
||||
### `value([index])`
|
||||
Same as `key(index)`, but it returns the value at the given index.
|
||||
|
||||
### `item([index])`
|
||||
Same as `key(index)`, but it returns a tuple with (key, value) at the given index.
|
||||
|
||||
## deepfreeze API
|
||||
|
||||
The `frozendict` _module_ has also these static methods:
|
||||
|
||||
### `frozendict.deepfreeze(o, custom_converters = None, custom_inverse_converters = None)`
|
||||
Converts the object and all the objects nested in it, into their immutable
|
||||
counterparts.
|
||||
|
||||
The conversion map is in `getFreezeConversionMap()`.
|
||||
|
||||
You can register a new conversion using `register()` You can also
|
||||
pass a map of custom converters with `custom_converters` and a map
|
||||
of custom inverse converters with `custom_inverse_converters`,
|
||||
without using `register()`.
|
||||
|
||||
By default, if the type is not registered and has a `__dict__`
|
||||
attribute, it's converted to the `frozendict` of that `__dict__`.
|
||||
|
||||
This function assumes that hashable == immutable (that is not
|
||||
always true).
|
||||
|
||||
This function uses recursion, with all the limits of recursions in
|
||||
Python.
|
||||
|
||||
Where is a good old tail call when you need it?
|
||||
|
||||
### `frozendict.register(to_convert, converter, *, inverse = False)`
|
||||
|
||||
Adds a `converter` for a type `to_convert`. `converter`
|
||||
must be callable. The new converter will be used by `deepfreeze()`
|
||||
and has precedence over any previous converter.
|
||||
|
||||
If `to_covert` has already a converter, a FreezeWarning is raised.
|
||||
|
||||
If `inverse` is True, the conversion is considered from an immutable
|
||||
type to a mutable one. This make it possible to convert mutable
|
||||
objects nested in the registered immutable one.
|
||||
|
||||
### `frozendict.unregister(type, inverse = False)`
|
||||
Unregister a type from custom conversion. If `inverse` is `True`,
|
||||
the unregistered conversion is an inverse conversion
|
||||
(see `register()`).
|
||||
|
||||
# Examples
|
||||
|
||||
## frozendict examples
|
||||
```python
|
||||
from frozendict import frozendict
|
||||
|
||||
fd = frozendict(Guzzanti = "Corrado", Hicks = "Bill")
|
||||
|
||||
print(fd)
|
||||
# frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill'})
|
||||
|
||||
frozendict({"Guzzanti": "Corrado", "Hicks": "Bill"})
|
||||
# frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill'})
|
||||
|
||||
hash(fd)
|
||||
# 5833699487320513741
|
||||
|
||||
fd_unhashable = frozendict({1: []})
|
||||
hash(fd_unhashable)
|
||||
# TypeError: Not all values are hashable.
|
||||
|
||||
frozendict({frozendict(nested = 4, key = 2): 42})
|
||||
# frozendict({frozendict({'nested': 4, 'key': 2}): 42})
|
||||
|
||||
fd | {1: 2}
|
||||
# frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill', 1: 2})
|
||||
|
||||
fd.set(1, 2)
|
||||
# frozendict.frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill', 1: 2})
|
||||
|
||||
fd.set("Guzzanti", "Sabina")
|
||||
# frozendict.frozendict({'Guzzanti': 'Sabina', 'Hicks': 'Bill'})
|
||||
|
||||
fd.delete("Guzzanti")
|
||||
# frozendict.frozendict({'Hicks': 'Bill'})
|
||||
|
||||
fd.setdefault("Guzzanti", "Sabina")
|
||||
# frozendict.frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill'})
|
||||
|
||||
fd.setdefault(1, 2)
|
||||
# frozendict.frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill', 1: 2})
|
||||
|
||||
fd.key()
|
||||
# 'Guzzanti'
|
||||
|
||||
fd.value(1)
|
||||
# 'Bill'
|
||||
|
||||
fd.item(-1)
|
||||
# (1, 2)
|
||||
|
||||
print(fd["Guzzanti"])
|
||||
# Corrado
|
||||
|
||||
fd["Brignano"]
|
||||
# KeyError: 'Brignano'
|
||||
|
||||
len(fd)
|
||||
# 2
|
||||
|
||||
"Guzzanti" in fd
|
||||
# True
|
||||
|
||||
"Guzzanti" not in fd
|
||||
# False
|
||||
|
||||
"Brignano" in fd
|
||||
# False
|
||||
|
||||
fd5 = frozendict(fd)
|
||||
id_fd5 = id(fd5)
|
||||
fd5 |= {1: 2}
|
||||
fd5
|
||||
# frozendict.frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill', 1: 2})
|
||||
id(fd5) != id_fd5
|
||||
# True
|
||||
|
||||
fd2 = fd.copy()
|
||||
fd2 == fd
|
||||
# True
|
||||
|
||||
fd3 = frozendict(fd)
|
||||
fd3 == fd
|
||||
# True
|
||||
|
||||
fd4 = frozendict({"Hicks": "Bill", "Guzzanti": "Corrado"})
|
||||
|
||||
print(fd4)
|
||||
# frozendict({'Hicks': 'Bill', 'Guzzanti': 'Corrado'})
|
||||
|
||||
fd4 == fd
|
||||
# True
|
||||
|
||||
import pickle
|
||||
fd_unpickled = pickle.loads(pickle.dumps(fd))
|
||||
print(fd_unpickled)
|
||||
# frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill'})
|
||||
fd_unpickled == fd
|
||||
# True
|
||||
|
||||
frozendict(Guzzanti="Corrado", Hicks="Bill")
|
||||
# frozendict({'Guzzanti': 'Corrado', 'Hicks': 'Bill'}
|
||||
|
||||
fd.get("Guzzanti")
|
||||
# 'Corrado'
|
||||
|
||||
print(fd.get("Brignano"))
|
||||
# None
|
||||
|
||||
tuple(fd.keys())
|
||||
# ('Guzzanti', 'Hicks')
|
||||
|
||||
tuple(fd.values())
|
||||
# ('Corrado', 'Bill')
|
||||
|
||||
tuple(fd.items())
|
||||
# (('Guzzanti', 'Corrado'), ('Hicks', 'Bill'))
|
||||
|
||||
frozendict.fromkeys(["Corrado", "Sabina"], "Guzzanti")
|
||||
# frozendict({'Corrado': 'Guzzanti', 'Sabina': 'Guzzanti'})
|
||||
|
||||
iter(fd)
|
||||
# <dict_keyiterator object at 0x7feb75c49188>
|
||||
|
||||
fd["Guzzanti"] = "Caterina"
|
||||
# TypeError: 'frozendict' object doesn't support item assignment
|
||||
```
|
||||
|
||||
## deepfreeze examples
|
||||
```python
|
||||
import frozendict as cool
|
||||
|
||||
from frozendict import frozendict
|
||||
from array import array
|
||||
from collections import OrderedDict
|
||||
from types import MappingProxyType
|
||||
|
||||
class A:
|
||||
def __init__(self, x):
|
||||
self.x = x
|
||||
|
||||
a = A(3)
|
||||
|
||||
o = {"x": [
|
||||
5,
|
||||
frozendict(y = {5, "b", memoryview(b"b")}),
|
||||
array("B", (0, 1, 2)),
|
||||
OrderedDict(a=bytearray(b"a")),
|
||||
MappingProxyType({2: []}),
|
||||
a
|
||||
]}
|
||||
|
||||
cool.deepfreeze(o)
|
||||
# frozendict(x = (
|
||||
# 5,
|
||||
# frozendict(y = frozenset({5, "b", memoryview(b"b")})),
|
||||
# (0, 1, 2),
|
||||
# frozendict(a = b'a'),
|
||||
# MappingProxyType({2: ()}),
|
||||
# frozendict(x = 3),
|
||||
# ))
|
||||
|
||||
```
|
||||
|
||||
# Building
|
||||
You can build `frozendict` directly from the code, using
|
||||
|
||||
```
|
||||
python3 setup.py bdist_wheel
|
||||
```
|
||||
|
||||
The C Extension is optional by default from version 2.3.5. You can make it mandatory by passing the environment variable `CIBUILDWHEEL` with value `1`
|
||||
|
||||
On the contrary, if you want the pure py implementation, you can pass the env var `FROZENDICT_PURE_PY` with value `1`
|
||||
|
||||
# Benchmarks
|
||||
|
||||
Some benchmarks between `dict` and `frozendict`[1]:
|
||||
|
||||
```
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(d)`; Size: 5; Keys: str; Type: dict; Time: 8.02e-08; Sigma: 4e-09
|
||||
Name: `constructor(d)`; Size: 5; Keys: str; Type: frozendict; Time: 8.81e-08; Sigma: 3e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(d)`; Size: 5; Keys: int; Type: dict; Time: 7.96e-08; Sigma: 5e-09
|
||||
Name: `constructor(d)`; Size: 5; Keys: int; Type: frozendict; Time: 8.97e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(d)`; Size: 1000; Keys: str; Type: dict; Time: 6.38e-06; Sigma: 9e-08
|
||||
Name: `constructor(d)`; Size: 1000; Keys: str; Type: frozendict; Time: 6.21e-06; Sigma: 2e-07
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(d)`; Size: 1000; Keys: int; Type: dict; Time: 3.49e-06; Sigma: 3e-07
|
||||
Name: `constructor(d)`; Size: 1000; Keys: int; Type: frozendict; Time: 3.48e-06; Sigma: 2e-07
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(kwargs)`; Size: 5; Keys: str; Type: dict; Time: 2.40e-07; Sigma: 1e-09
|
||||
Name: `constructor(kwargs)`; Size: 5; Keys: str; Type: frozendict; Time: 2.48e-07; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(kwargs)`; Size: 1000; Keys: str; Type: dict; Time: 4.80e-05; Sigma: 1e-06
|
||||
Name: `constructor(kwargs)`; Size: 1000; Keys: str; Type: frozendict; Time: 2.90e-05; Sigma: 7e-07
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(seq2)`; Size: 5; Keys: str; Type: dict; Time: 2.01e-07; Sigma: 9e-10
|
||||
Name: `constructor(seq2)`; Size: 5; Keys: str; Type: frozendict; Time: 2.50e-07; Sigma: 1e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(seq2)`; Size: 5; Keys: int; Type: dict; Time: 2.18e-07; Sigma: 2e-09
|
||||
Name: `constructor(seq2)`; Size: 5; Keys: int; Type: frozendict; Time: 2.73e-07; Sigma: 1e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(seq2)`; Size: 1000; Keys: str; Type: dict; Time: 4.29e-05; Sigma: 6e-07
|
||||
Name: `constructor(seq2)`; Size: 1000; Keys: str; Type: frozendict; Time: 4.33e-05; Sigma: 6e-07
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(seq2)`; Size: 1000; Keys: int; Type: dict; Time: 3.04e-05; Sigma: 4e-07
|
||||
Name: `constructor(seq2)`; Size: 1000; Keys: int; Type: frozendict; Time: 3.45e-05; Sigma: 4e-07
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(o)`; Size: 5; Keys: str; Type: dict; Time: 7.93e-08; Sigma: 3e-09
|
||||
Name: `constructor(o)`; Size: 5; Keys: str; Type: frozendict; Time: 2.41e-08; Sigma: 6e-10
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(o)`; Size: 5; Keys: int; Type: dict; Time: 7.94e-08; Sigma: 5e-09
|
||||
Name: `constructor(o)`; Size: 5; Keys: int; Type: frozendict; Time: 2.41e-08; Sigma: 6e-10
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(o)`; Size: 1000; Keys: str; Type: dict; Time: 6.18e-06; Sigma: 3e-07
|
||||
Name: `constructor(o)`; Size: 1000; Keys: str; Type: frozendict; Time: 2.41e-08; Sigma: 6e-10
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `constructor(o)`; Size: 1000; Keys: int; Type: dict; Time: 3.47e-06; Sigma: 2e-07
|
||||
Name: `constructor(o)`; Size: 1000; Keys: int; Type: frozendict; Time: 2.41e-08; Sigma: 6e-10
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o.copy()`; Size: 5; Keys: str; Type: dict; Time: 7.28e-08; Sigma: 2e-09
|
||||
Name: `o.copy()`; Size: 5; Keys: str; Type: frozendict; Time: 3.18e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o.copy()`; Size: 5; Keys: int; Type: dict; Time: 7.21e-08; Sigma: 4e-09
|
||||
Name: `o.copy()`; Size: 5; Keys: int; Type: frozendict; Time: 3.32e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o.copy()`; Size: 1000; Keys: str; Type: dict; Time: 6.16e-06; Sigma: 3e-07
|
||||
Name: `o.copy()`; Size: 1000; Keys: str; Type: frozendict; Time: 3.18e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o.copy()`; Size: 1000; Keys: int; Type: dict; Time: 3.46e-06; Sigma: 1e-07
|
||||
Name: `o.copy()`; Size: 1000; Keys: int; Type: frozendict; Time: 3.18e-08; Sigma: 2e-09
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o == o`; Size: 5; Keys: str; Type: dict; Time: 7.23e-08; Sigma: 8e-10
|
||||
Name: `o == o`; Size: 5; Keys: str; Type: frozendict; Time: 2.44e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o == o`; Size: 5; Keys: int; Type: dict; Time: 7.30e-08; Sigma: 1e-09
|
||||
Name: `o == o`; Size: 5; Keys: int; Type: frozendict; Time: 2.44e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o == o`; Size: 1000; Keys: str; Type: dict; Time: 1.38e-05; Sigma: 1e-07
|
||||
Name: `o == o`; Size: 1000; Keys: str; Type: frozendict; Time: 2.44e-08; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `o == o`; Size: 1000; Keys: int; Type: dict; Time: 1.05e-05; Sigma: 7e-08
|
||||
Name: `o == o`; Size: 1000; Keys: int; Type: frozendict; Time: 2.44e-08; Sigma: 2e-09
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o`; Size: 5; Keys: str; Type: dict; Time: 7.33e-08; Sigma: 2e-09
|
||||
Name: `for x in o`; Size: 5; Keys: str; Type: frozendict; Time: 6.70e-08; Sigma: 1e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o`; Size: 5; Keys: int; Type: dict; Time: 7.33e-08; Sigma: 2e-09
|
||||
Name: `for x in o`; Size: 5; Keys: int; Type: frozendict; Time: 6.70e-08; Sigma: 1e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o`; Size: 1000; Keys: str; Type: dict; Time: 8.84e-06; Sigma: 5e-08
|
||||
Name: `for x in o`; Size: 1000; Keys: str; Type: frozendict; Time: 7.06e-06; Sigma: 6e-08
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o`; Size: 1000; Keys: int; Type: dict; Time: 8.67e-06; Sigma: 7e-08
|
||||
Name: `for x in o`; Size: 1000; Keys: int; Type: frozendict; Time: 6.94e-06; Sigma: 3e-08
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.values()`; Size: 5; Keys: str; Type: dict; Time: 7.28e-08; Sigma: 9e-10
|
||||
Name: `for x in o.values()`; Size: 5; Keys: str; Type: frozendict; Time: 6.48e-08; Sigma: 8e-10
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.values()`; Size: 5; Keys: int; Type: dict; Time: 7.25e-08; Sigma: 1e-09
|
||||
Name: `for x in o.values()`; Size: 5; Keys: int; Type: frozendict; Time: 6.45e-08; Sigma: 1e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.values()`; Size: 1000; Keys: str; Type: dict; Time: 9.06e-06; Sigma: 5e-07
|
||||
Name: `for x in o.values()`; Size: 1000; Keys: str; Type: frozendict; Time: 7.04e-06; Sigma: 4e-08
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.values()`; Size: 1000; Keys: int; Type: dict; Time: 9.53e-06; Sigma: 3e-08
|
||||
Name: `for x in o.values()`; Size: 1000; Keys: int; Type: frozendict; Time: 6.97e-06; Sigma: 3e-08
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.items()`; Size: 5; Keys: str; Type: dict; Time: 1.13e-07; Sigma: 3e-09
|
||||
Name: `for x in o.items()`; Size: 5; Keys: str; Type: frozendict; Time: 1.16e-07; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.items()`; Size: 5; Keys: int; Type: dict; Time: 1.14e-07; Sigma: 3e-09
|
||||
Name: `for x in o.items()`; Size: 5; Keys: int; Type: frozendict; Time: 1.17e-07; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.items()`; Size: 1000; Keys: str; Type: dict; Time: 1.53e-05; Sigma: 3e-07
|
||||
Name: `for x in o.items()`; Size: 1000; Keys: str; Type: frozendict; Time: 1.53e-05; Sigma: 4e-07
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `for x in o.items()`; Size: 1000; Keys: int; Type: dict; Time: 1.53e-05; Sigma: 3e-07
|
||||
Name: `for x in o.items()`; Size: 1000; Keys: int; Type: frozendict; Time: 1.55e-05; Sigma: 4e-07
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.dumps(o)`; Size: 5; Keys: str; Type: dict; Time: 6.82e-07; Sigma: 2e-08
|
||||
Name: `pickle.dumps(o)`; Size: 5; Keys: str; Type: frozendict; Time: 2.86e-06; Sigma: 1e-07
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.dumps(o)`; Size: 5; Keys: int; Type: dict; Time: 4.77e-07; Sigma: 2e-08
|
||||
Name: `pickle.dumps(o)`; Size: 5; Keys: int; Type: frozendict; Time: 2.72e-06; Sigma: 8e-08
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.dumps(o)`; Size: 1000; Keys: str; Type: dict; Time: 1.24e-04; Sigma: 4e-06
|
||||
Name: `pickle.dumps(o)`; Size: 1000; Keys: str; Type: frozendict; Time: 1.92e-04; Sigma: 5e-06
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.dumps(o)`; Size: 1000; Keys: int; Type: dict; Time: 2.81e-05; Sigma: 6e-07
|
||||
Name: `pickle.dumps(o)`; Size: 1000; Keys: int; Type: frozendict; Time: 7.37e-05; Sigma: 1e-06
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.loads(dump)`; Size: 5; Keys: str; Type: dict; Time: 9.08e-07; Sigma: 6e-09
|
||||
Name: `pickle.loads(dump)`; Size: 5; Keys: str; Type: frozendict; Time: 1.79e-06; Sigma: 9e-08
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.loads(dump)`; Size: 5; Keys: int; Type: dict; Time: 4.46e-07; Sigma: 6e-09
|
||||
Name: `pickle.loads(dump)`; Size: 5; Keys: int; Type: frozendict; Time: 1.32e-06; Sigma: 7e-08
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.loads(dump)`; Size: 1000; Keys: str; Type: dict; Time: 1.57e-04; Sigma: 8e-06
|
||||
Name: `pickle.loads(dump)`; Size: 1000; Keys: str; Type: frozendict; Time: 1.69e-04; Sigma: 7e-06
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `pickle.loads(dump)`; Size: 1000; Keys: int; Type: dict; Time: 5.97e-05; Sigma: 5e-06
|
||||
Name: `pickle.loads(dump)`; Size: 1000; Keys: int; Type: frozendict; Time: 6.68e-05; Sigma: 2e-06
|
||||
################################################################################
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `class.fromkeys()`; Size: 5; Keys: str; Type: dict; Time: 1.88e-07; Sigma: 1e-09
|
||||
Name: `class.fromkeys()`; Size: 5; Keys: str; Type: frozendict; Time: 2.22e-07; Sigma: 7e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `class.fromkeys()`; Size: 5; Keys: int; Type: dict; Time: 2.08e-07; Sigma: 6e-09
|
||||
Name: `class.fromkeys()`; Size: 5; Keys: int; Type: frozendict; Time: 2.44e-07; Sigma: 2e-09
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `class.fromkeys()`; Size: 1000; Keys: str; Type: dict; Time: 4.05e-05; Sigma: 4e-06
|
||||
Name: `class.fromkeys()`; Size: 1000; Keys: str; Type: frozendict; Time: 3.84e-05; Sigma: 5e-07
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Name: `class.fromkeys()`; Size: 1000; Keys: int; Type: dict; Time: 2.93e-05; Sigma: 7e-07
|
||||
Name: `class.fromkeys()`; Size: 1000; Keys: int; Type: frozendict; Time: 3.08e-05; Sigma: 2e-06
|
||||
################################################################################
|
||||
```
|
||||
|
||||
[1] Benchmarks done under Linux 64 bit, Python 3.10.2, using the C Extension.
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
frozendict-2.4.7.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
frozendict-2.4.7.dist-info/METADATA,sha256=D95cS34PIQofCL9byKAkcGLrfd9cPWA03xdMW4NzqFU,23571
|
||||
frozendict-2.4.7.dist-info/RECORD,,
|
||||
frozendict-2.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
||||
frozendict-2.4.7.dist-info/licenses/LICENSE.txt,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
||||
frozendict-2.4.7.dist-info/top_level.txt,sha256=H0x_yOfp00xK1WR_JMHct-wr-7Ht9uC9iQR2aHNL_uw,11
|
||||
frozendict/__init__.py,sha256=N464Qu1PA-bafz8DetBx4sSsayDQuytu3_emp_Q2q-w,1533
|
||||
frozendict/__init__.pyi,sha256=yjX57g8jPjs-sNYf1ipFeEQ1GW8VYy1fgQXRWFeCa_w,3748
|
||||
frozendict/__pycache__/__init__.cpython-311.pyc,,
|
||||
frozendict/__pycache__/_frozendict_py.cpython-311.pyc,,
|
||||
frozendict/__pycache__/cool.cpython-311.pyc,,
|
||||
frozendict/__pycache__/core.cpython-311.pyc,,
|
||||
frozendict/__pycache__/monkeypatch.cpython-311.pyc,,
|
||||
frozendict/__pycache__/version.cpython-311.pyc,,
|
||||
frozendict/_frozendict_py.py,sha256=0VtTC37NPZS5LmGeyPvYNCXBGAhVyNQjuv70xDIdsyc,6518
|
||||
frozendict/cool.py,sha256=z0IA4nzRYrVVFjCeXO53BBTn9CgU0vVKEzKcj4nVi20,8602
|
||||
frozendict/core.py,sha256=ZHj6y3awRhHRJpgD7qCFjhY7U_jjvjUdOUVWn1kpZ5Y,218
|
||||
frozendict/monkeypatch.py,sha256=T0pM5-dAasRrzCDL_mgtMkksXtW2Awlw4_3xgWO_VH0,6021
|
||||
frozendict/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
frozendict/version.py,sha256=ogkQ0N4sJsJf51jXeMctGisJvzlbX_NP7bsIFPjRajs,18
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (80.9.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
+1
@@ -0,0 +1 @@
|
||||
frozendict
|
||||
Reference in New Issue
Block a user