# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-itypes VERSION= 1.2.0 KEYWORDS= python VARIANTS= v12 v13 SDESC[v12]= Simple immutable types for python (3.12) SDESC[v13]= Simple immutable types for python (3.13) HOMEPAGE= https://github.com/PavanTatikonda/itypes CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/3f/bb/3bd99c7cd34d4a123b2903e16da364f6d2078b1c3a3530a8ad105c668104 DISTFILE[1]= itypes-1.2.0-py2.py3-none-any.whl:main DF_INDEX= 1 SPKGS[v12]= single SPKGS[v13]= single OPTIONS_AVAILABLE= PY312 PY313 OPTIONS_STANDARD= none VOPTS[v12]= PY312=ON PY313=OFF VOPTS[v13]= PY312=OFF PY313=ON DISTNAME= itypes-1.2.0.dist-info GENERATED= yes [PY312].USES_ON= python:v12,wheel [PY313].USES_ON= python:v13,wheel [FILE:2339:descriptions/desc.single] # itypes [Build Status] Basic immutable container types for Python. A simple implementation that's designed for simplicity over performance. Use these in circumstances where it may result in more comprehensible code, or when you want to create custom types with restricted, immutable interfaces. For an alternative implementation designed for performance, please see [pyrsistent]. ### Installation Install using `pip`: pip install itypes ### Instantiating dictionaries and lists. >>> import itypes >>> d = itypes.Dict({'a': 1, 'b': 2, 'c': 3}) >>> l = itypes.List(['a', 'b', 'c']) ### On instantiation, nested types are coerced to immutables. >>> d = itypes.Dict({'a': 123, 'b': ['a', 'b', 'c']}) >>> d['b'] List(['a', 'b', 'c']) ### Assignments and deletions return new copies. Methods: `set(key, value)`, `delete(key)` >>> d2 = d.set('c', 456) >>> d2 Dict({'a': 123, 'b': ['a', 'b', 'c'], 'c': 456}) >>> d3 = d2.delete('a') >>> d3 Dict({'b': ['a', 'b', 'c'], 'c': 456}) ### Standard assignments and deletions fail. >>> d['z'] = 123 TypeError: 'Dict' object doesn't support item assignment >>> del(d['c']) TypeError: 'Dict' object doesn't support item deletion ### Nested lookups. Method: `get_in(keys, default=None)` >>> d['b'][-1] 'c' >>> d['b'][5] IndexError: list index out of range >>> d.get_in(['b', -1]) 'c' >>> d.get_in(['b', 5]) None ### Nested assignments and deletions. Methods: `set_in(keys, value)`, `delete_in(keys)` >>> d2 = d.set_in(['b', 1], 'xxx') >>> d2 Dict({'a': 123, 'b': ['a', 'xxx', 'c']}) >>> d3 = d2.delete_in(['b', 0]) >>> d3 Dict({'a': 123, 'b': ['xxx', 'c']}) ### Equality works against standard types. >>> d = itypes.Dict({'a': 1, 'b': 2, 'c': 3}) >>> d == {'a': 1, 'b': 2, 'c': 3} True ### Objects are hashable. >>> hash(d) 277752239 ### Shortcuts for switching between mutable and immutable types. Functions: `to_mutable(instance)`, `to_immutable(value)` >>> value = itypes.to_mutable(d) >>> value {'a': 123, 'b': ['a', 'b', 'c']} >>> itypes.to_immutable(value) Dict({'a': 123, 'b': ['a', 'b', 'c']}) ### Subclassing. Only private attribute names may be set on instances. Use `@property` for attribute access. [FILE:112:distinfo] 03da6872ca89d29aef62773672b2d408f490f80db48b23079a4b194c86dd04c6 4756 itypes-1.2.0-py2.py3-none-any.whl