File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/PKG-INFO.tar
Back
usr/lib/python3/dist-packages/packaging-21.3.egg-info/PKG-INFO 0000644 00000035400 15027666015 0017354 0 ustar 00 Metadata-Version: 2.1 Name: packaging Version: 21.3 Summary: Core utilities for Python packages Home-page: https://github.com/pypa/packaging Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: BSD-2-Clause or Apache-2.0 Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: License :: OSI Approved :: BSD License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.6 Description-Content-Type: text/x-rst License-File: LICENSE License-File: LICENSE.APACHE License-File: LICENSE.BSD packaging ========= .. start-intro Reusable core utilities for various Python Packaging `interoperability specifications <https://packaging.python.org/specifications/>`_. This library provides utilities that implement the interoperability specifications which have clearly one correct behaviour (eg: :pep:`440`) or benefit greatly from having a single shared implementation (eg: :pep:`425`). .. end-intro The ``packaging`` project includes the following: version handling, specifiers, markers, requirements, tags, utilities. Documentation ------------- The `documentation`_ provides information and the API for the following: - Version Handling - Specifiers - Markers - Requirements - Tags - Utilities Installation ------------ Use ``pip`` to install these utilities:: pip install packaging Discussion ---------- If you run into bugs, you can file them in our `issue tracker`_. You can also join ``#pypa`` on Freenode to ask questions or get involved. .. _`documentation`: https://packaging.pypa.io/ .. _`issue tracker`: https://github.com/pypa/packaging/issues Code of Conduct --------------- Everyone interacting in the packaging project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md Contributing ------------ The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as well as how to report a potential security issue. The documentation for this project also covers information about `project development`_ and `security`_. .. _`project development`: https://packaging.pypa.io/en/latest/development/ .. _`security`: https://packaging.pypa.io/en/latest/security/ Project History --------------- Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for recent changes and project history. .. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/ Changelog --------- 21.3 - 2021-11-17 ~~~~~~~~~~~~~~~~~ * Add a ``pp3-none-any`` tag (`#311 <https://github.com/pypa/packaging/issues/311>`__) * Replace the blank pyparsing 3 exclusion with a 3.0.5 exclusion (`#481 <https://github.com/pypa/packaging/issues/481>`__, `#486 <https://github.com/pypa/packaging/issues/486>`__) * Fix a spelling mistake (`#479 <https://github.com/pypa/packaging/issues/479>`__) 21.2 - 2021-10-29 ~~~~~~~~~~~~~~~~~ * Update documentation entry for 21.1. 21.1 - 2021-10-29 ~~~~~~~~~~~~~~~~~ * Update pin to pyparsing to exclude 3.0.0. 21.0 - 2021-07-03 ~~~~~~~~~~~~~~~~~ * PEP 656: musllinux support (`#411 <https://github.com/pypa/packaging/issues/411>`__) * Drop support for Python 2.7, Python 3.4 and Python 3.5. * Replace distutils usage with sysconfig (`#396 <https://github.com/pypa/packaging/issues/396>`__) * Add support for zip files in ``parse_sdist_filename`` (`#429 <https://github.com/pypa/packaging/issues/429>`__) * Use cached ``_hash`` attribute to short-circuit tag equality comparisons (`#417 <https://github.com/pypa/packaging/issues/417>`__) * Specify the default value for the ``specifier`` argument to ``SpecifierSet`` (`#437 <https://github.com/pypa/packaging/issues/437>`__) * Proper keyword-only "warn" argument in packaging.tags (`#403 <https://github.com/pypa/packaging/issues/403>`__) * Correctly remove prerelease suffixes from ~= check (`#366 <https://github.com/pypa/packaging/issues/366>`__) * Fix type hints for ``Version.post`` and ``Version.dev`` (`#393 <https://github.com/pypa/packaging/issues/393>`__) * Use typing alias ``UnparsedVersion`` (`#398 <https://github.com/pypa/packaging/issues/398>`__) * Improve type inference for ``packaging.specifiers.filter()`` (`#430 <https://github.com/pypa/packaging/issues/430>`__) * Tighten the return type of ``canonicalize_version()`` (`#402 <https://github.com/pypa/packaging/issues/402>`__) 20.9 - 2021-01-29 ~~~~~~~~~~~~~~~~~ * Run `isort <https://pypi.org/project/isort/>`_ over the code base (`#377 <https://github.com/pypa/packaging/issues/377>`__) * Add support for the ``macosx_10_*_universal2`` platform tags (`#379 <https://github.com/pypa/packaging/issues/379>`__) * Introduce ``packaging.utils.parse_wheel_filename()`` and ``parse_sdist_filename()`` (`#387 <https://github.com/pypa/packaging/issues/387>`__ and `#389 <https://github.com/pypa/packaging/issues/389>`__) 20.8 - 2020-12-11 ~~~~~~~~~~~~~~~~~ * Revert back to setuptools for compatibility purposes for some Linux distros (`#363 <https://github.com/pypa/packaging/issues/363>`__) * Do not insert an underscore in wheel tags when the interpreter version number is more than 2 digits (`#372 <https://github.com/pypa/packaging/issues/372>`__) 20.7 - 2020-11-28 ~~~~~~~~~~~~~~~~~ No unreleased changes. 20.6 - 2020-11-28 ~~~~~~~~~~~~~~~~~ .. note:: This release was subsequently yanked, and these changes were included in 20.7. * Fix flit configuration, to include LICENSE files (`#357 <https://github.com/pypa/packaging/issues/357>`__) * Make `intel` a recognized CPU architecture for the `universal` macOS platform tag (`#361 <https://github.com/pypa/packaging/issues/361>`__) * Add some missing type hints to `packaging.requirements` (issue:`350`) 20.5 - 2020-11-27 ~~~~~~~~~~~~~~~~~ * Officially support Python 3.9 (`#343 <https://github.com/pypa/packaging/issues/343>`__) * Deprecate the ``LegacyVersion`` and ``LegacySpecifier`` classes (`#321 <https://github.com/pypa/packaging/issues/321>`__) * Handle ``OSError`` on non-dynamic executables when attempting to resolve the glibc version string. 20.4 - 2020-05-19 ~~~~~~~~~~~~~~~~~ * Canonicalize version before comparing specifiers. (`#282 <https://github.com/pypa/packaging/issues/282>`__) * Change type hint for ``canonicalize_name`` to return ``packaging.utils.NormalizedName``. This enables the use of static typing tools (like mypy) to detect mixing of normalized and un-normalized names. 20.3 - 2020-03-05 ~~~~~~~~~~~~~~~~~ * Fix changelog for 20.2. 20.2 - 2020-03-05 ~~~~~~~~~~~~~~~~~ * Fix a bug that caused a 32-bit OS that runs on a 64-bit ARM CPU (e.g. ARM-v8, aarch64), to report the wrong bitness. 20.1 - 2020-01-24 ~~~~~~~~~~~~~~~~~~~ * Fix a bug caused by reuse of an exhausted iterator. (`#257 <https://github.com/pypa/packaging/issues/257>`__) 20.0 - 2020-01-06 ~~~~~~~~~~~~~~~~~ * Add type hints (`#191 <https://github.com/pypa/packaging/issues/191>`__) * Add proper trove classifiers for PyPy support (`#198 <https://github.com/pypa/packaging/issues/198>`__) * Scale back depending on ``ctypes`` for manylinux support detection (`#171 <https://github.com/pypa/packaging/issues/171>`__) * Use ``sys.implementation.name`` where appropriate for ``packaging.tags`` (`#193 <https://github.com/pypa/packaging/issues/193>`__) * Expand upon the API provided by ``packaging.tags``: ``interpreter_name()``, ``mac_platforms()``, ``compatible_tags()``, ``cpython_tags()``, ``generic_tags()`` (`#187 <https://github.com/pypa/packaging/issues/187>`__) * Officially support Python 3.8 (`#232 <https://github.com/pypa/packaging/issues/232>`__) * Add ``major``, ``minor``, and ``micro`` aliases to ``packaging.version.Version`` (`#226 <https://github.com/pypa/packaging/issues/226>`__) * Properly mark ``packaging`` has being fully typed by adding a `py.typed` file (`#226 <https://github.com/pypa/packaging/issues/226>`__) 19.2 - 2019-09-18 ~~~~~~~~~~~~~~~~~ * Remove dependency on ``attrs`` (`#178 <https://github.com/pypa/packaging/issues/178>`__, `#179 <https://github.com/pypa/packaging/issues/179>`__) * Use appropriate fallbacks for CPython ABI tag (`#181 <https://github.com/pypa/packaging/issues/181>`__, `#185 <https://github.com/pypa/packaging/issues/185>`__) * Add manylinux2014 support (`#186 <https://github.com/pypa/packaging/issues/186>`__) * Improve ABI detection (`#181 <https://github.com/pypa/packaging/issues/181>`__) * Properly handle debug wheels for Python 3.8 (`#172 <https://github.com/pypa/packaging/issues/172>`__) * Improve detection of debug builds on Windows (`#194 <https://github.com/pypa/packaging/issues/194>`__) 19.1 - 2019-07-30 ~~~~~~~~~~~~~~~~~ * Add the ``packaging.tags`` module. (`#156 <https://github.com/pypa/packaging/issues/156>`__) * Correctly handle two-digit versions in ``python_version`` (`#119 <https://github.com/pypa/packaging/issues/119>`__) 19.0 - 2019-01-20 ~~~~~~~~~~~~~~~~~ * Fix string representation of PEP 508 direct URL requirements with markers. * Better handling of file URLs This allows for using ``file:///absolute/path``, which was previously prevented due to the missing ``netloc``. This allows for all file URLs that ``urlunparse`` turns back into the original URL to be valid. 18.0 - 2018-09-26 ~~~~~~~~~~~~~~~~~ * Improve error messages when invalid requirements are given. (`#129 <https://github.com/pypa/packaging/issues/129>`__) 17.1 - 2017-02-28 ~~~~~~~~~~~~~~~~~ * Fix ``utils.canonicalize_version`` when supplying non PEP 440 versions. 17.0 - 2017-02-28 ~~~~~~~~~~~~~~~~~ * Drop support for python 2.6, 3.2, and 3.3. * Define minimal pyparsing version to 2.0.2 (`#91 <https://github.com/pypa/packaging/issues/91>`__). * Add ``epoch``, ``release``, ``pre``, ``dev``, and ``post`` attributes to ``Version`` and ``LegacyVersion`` (`#34 <https://github.com/pypa/packaging/issues/34>`__). * Add ``Version().is_devrelease`` and ``LegacyVersion().is_devrelease`` to make it easy to determine if a release is a development release. * Add ``utils.canonicalize_version`` to canonicalize version strings or ``Version`` instances (`#121 <https://github.com/pypa/packaging/issues/121>`__). 16.8 - 2016-10-29 ~~~~~~~~~~~~~~~~~ * Fix markers that utilize ``in`` so that they render correctly. * Fix an erroneous test on Python RC releases. 16.7 - 2016-04-23 ~~~~~~~~~~~~~~~~~ * Add support for the deprecated ``python_implementation`` marker which was an undocumented setuptools marker in addition to the newer markers. 16.6 - 2016-03-29 ~~~~~~~~~~~~~~~~~ * Add support for the deprecated, PEP 345 environment markers in addition to the newer markers. 16.5 - 2016-02-26 ~~~~~~~~~~~~~~~~~ * Fix a regression in parsing requirements with whitespaces between the comma separators. 16.4 - 2016-02-22 ~~~~~~~~~~~~~~~~~ * Fix a regression in parsing requirements like ``foo (==4)``. 16.3 - 2016-02-21 ~~~~~~~~~~~~~~~~~ * Fix a bug where ``packaging.requirements:Requirement`` was overly strict when matching legacy requirements. 16.2 - 2016-02-09 ~~~~~~~~~~~~~~~~~ * Add a function that implements the name canonicalization from PEP 503. 16.1 - 2016-02-07 ~~~~~~~~~~~~~~~~~ * Implement requirement specifiers from PEP 508. 16.0 - 2016-01-19 ~~~~~~~~~~~~~~~~~ * Relicense so that packaging is available under *either* the Apache License, Version 2.0 or a 2 Clause BSD license. * Support installation of packaging when only distutils is available. * Fix ``==`` comparison when there is a prefix and a local version in play. (`#41 <https://github.com/pypa/packaging/issues/41>`__). * Implement environment markers from PEP 508. 15.3 - 2015-08-01 ~~~~~~~~~~~~~~~~~ * Normalize post-release spellings for rev/r prefixes. `#35 <https://github.com/pypa/packaging/issues/35>`__ 15.2 - 2015-05-13 ~~~~~~~~~~~~~~~~~ * Fix an error where the arbitrary specifier (``===``) was not correctly allowing pre-releases when it was being used. * Expose the specifier and version parts through properties on the ``Specifier`` classes. * Allow iterating over the ``SpecifierSet`` to get access to all of the ``Specifier`` instances. * Allow testing if a version is contained within a specifier via the ``in`` operator. 15.1 - 2015-04-13 ~~~~~~~~~~~~~~~~~ * Fix a logic error that was causing inconsistent answers about whether or not a pre-release was contained within a ``SpecifierSet`` or not. 15.0 - 2015-01-02 ~~~~~~~~~~~~~~~~~ * Add ``Version().is_postrelease`` and ``LegacyVersion().is_postrelease`` to make it easy to determine if a release is a post release. * Add ``Version().base_version`` and ``LegacyVersion().base_version`` to make it easy to get the public version without any pre or post release markers. * Support the update to PEP 440 which removed the implied ``!=V.*`` when using either ``>V`` or ``<V`` and which instead special cased the handling of pre-releases, post-releases, and local versions when using ``>V`` or ``<V``. 14.5 - 2014-12-17 ~~~~~~~~~~~~~~~~~ * Normalize release candidates as ``rc`` instead of ``c``. * Expose the ``VERSION_PATTERN`` constant, a regular expression matching a valid version. 14.4 - 2014-12-15 ~~~~~~~~~~~~~~~~~ * Ensure that versions are normalized before comparison when used in a specifier with a less than (``<``) or greater than (``>``) operator. 14.3 - 2014-11-19 ~~~~~~~~~~~~~~~~~ * **BACKWARDS INCOMPATIBLE** Refactor specifier support so that it can sanely handle legacy specifiers as well as PEP 440 specifiers. * **BACKWARDS INCOMPATIBLE** Move the specifier support out of ``packaging.version`` into ``packaging.specifiers``. 14.2 - 2014-09-10 ~~~~~~~~~~~~~~~~~ * Add prerelease support to ``Specifier``. * Remove the ability to do ``item in Specifier()`` and replace it with ``Specifier().contains(item)`` in order to allow flags that signal if a prerelease should be accepted or not. * Add a method ``Specifier().filter()`` which will take an iterable and returns an iterable with items that do not match the specifier filtered out. 14.1 - 2014-09-08 ~~~~~~~~~~~~~~~~~ * Allow ``LegacyVersion`` and ``Version`` to be sorted together. * Add ``packaging.version.parse()`` to enable easily parsing a version string as either a ``Version`` or a ``LegacyVersion`` depending on it's PEP 440 validity. 14.0 - 2014-09-05 ~~~~~~~~~~~~~~~~~ * Initial release. .. _`master`: https://github.com/pypa/packaging/ usr/lib/python3/dist-packages/cloud_init-23.1.2.egg-info/PKG-INFO 0000644 00000000553 15027666225 0017725 0 ustar 00 Metadata-Version: 2.1 Name: cloud-init Version: 23.1.2 Summary: Cloud instance initialisation magic Home-page: http://launchpad.net/cloud-init/ Author: Scott Moser Author-email: scott.moser@canonical.com License: Dual-licensed under GPLv3 or Apache 2.0 Platform: UNKNOWN License-File: LICENSE License-File: LICENSE-Apache2.0 License-File: LICENSE-GPLv3 UNKNOWN usr/lib/python3/dist-packages/pyrsistent-0.18.1.egg-info/PKG-INFO 0000644 00000064476 15027666353 0020042 0 ustar 00 Metadata-Version: 2.1 Name: pyrsistent Version: 0.18.1 Summary: Persistent/Functional/Immutable data structures Home-page: http://github.com/tobgu/pyrsistent/ Author: Tobias Gustafsson Author-email: tobias.l.gustafsson@gmail.com License: MIT Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.7 Description-Content-Type: text/x-rst License-File: LICENSE.mit Pyrsistent ========== .. image:: https://github.com/tobgu/pyrsistent/actions/workflows/tests.yaml/badge.svg :target: https://github.com/tobgu/pyrsistent/actions/workflows/tests.yaml .. _Pyrthon: https://www.github.com/tobgu/pyrthon/ Pyrsistent is a number of persistent collections (by some referred to as functional data structures). Persistent in the sense that they are immutable. All methods on a data structure that would normally mutate it instead return a new copy of the structure containing the requested updates. The original structure is left untouched. This will simplify the reasoning about what a program does since no hidden side effects ever can take place to these data structures. You can rest assured that the object you hold a reference to will remain the same throughout its lifetime and need not worry that somewhere five stack levels below you in the darkest corner of your application someone has decided to remove that element that you expected to be there. Pyrsistent is influenced by persistent data structures such as those found in the standard library of Clojure. The data structures are designed to share common elements through path copying. It aims at taking these concepts and make them as pythonic as possible so that they can be easily integrated into any python program without hassle. If you want to go all in on persistent data structures and use literal syntax to define them in your code rather than function calls check out Pyrthon_. Examples -------- .. _Sequence: collections_ .. _Hashable: collections_ .. _Mapping: collections_ .. _Mappings: collections_ .. _Set: collections_ .. _collections: https://docs.python.org/3/library/collections.abc.html .. _documentation: http://pyrsistent.readthedocs.org/ The collection types and key features currently implemented are: * PVector_, similar to a python list * PMap_, similar to dict * PSet_, similar to set * PRecord_, a PMap on steroids with fixed fields, optional type and invariant checking and much more * PClass_, a Python class fixed fields, optional type and invariant checking and much more * `Checked collections`_, PVector, PMap and PSet with optional type and invariance checks and more * PBag, similar to collections.Counter * PList, a classic singly linked list * PDeque, similar to collections.deque * Immutable object type (immutable) built on the named tuple * freeze_ and thaw_ functions to convert between pythons standard collections and pyrsistent collections. * Flexible transformations_ of arbitrarily complex structures built from PMaps and PVectors. Below are examples of common usage patterns for some of the structures and features. More information and full documentation for all data structures is available in the documentation_. .. _PVector: PVector ~~~~~~~ With full support for the Sequence_ protocol PVector is meant as a drop in replacement to the built in list from a readers point of view. Write operations of course differ since no in place mutation is done but naming should be in line with corresponding operations on the built in list. Support for the Hashable_ protocol also means that it can be used as key in Mappings_. Appends are amortized O(1). Random access and insert is log32(n) where n is the size of the vector. .. code:: python >>> from pyrsistent import v, pvector # No mutation of vectors once created, instead they # are "evolved" leaving the original untouched >>> v1 = v(1, 2, 3) >>> v2 = v1.append(4) >>> v3 = v2.set(1, 5) >>> v1 pvector([1, 2, 3]) >>> v2 pvector([1, 2, 3, 4]) >>> v3 pvector([1, 5, 3, 4]) # Random access and slicing >>> v3[1] 5 >>> v3[1:3] pvector([5, 3]) # Iteration >>> list(x + 1 for x in v3) [2, 6, 4, 5] >>> pvector(2 * x for x in range(3)) pvector([0, 2, 4]) .. _PMap: PMap ~~~~ With full support for the Mapping_ protocol PMap is meant as a drop in replacement to the built in dict from a readers point of view. Support for the Hashable_ protocol also means that it can be used as key in other Mappings_. Random access and insert is log32(n) where n is the size of the map. .. code:: python >>> from pyrsistent import m, pmap, v # No mutation of maps once created, instead they are # "evolved" leaving the original untouched >>> m1 = m(a=1, b=2) >>> m2 = m1.set('c', 3) >>> m3 = m2.set('a', 5) >>> m1 pmap({'a': 1, 'b': 2}) >>> m2 pmap({'a': 1, 'c': 3, 'b': 2}) >>> m3 pmap({'a': 5, 'c': 3, 'b': 2}) >>> m3['a'] 5 # Evolution of nested persistent structures >>> m4 = m(a=5, b=6, c=v(1, 2)) >>> m4.transform(('c', 1), 17) pmap({'a': 5, 'c': pvector([1, 17]), 'b': 6}) >>> m5 = m(a=1, b=2) # Evolve by merging with other mappings >>> m5.update(m(a=2, c=3), {'a': 17, 'd': 35}) pmap({'a': 17, 'c': 3, 'b': 2, 'd': 35}) >>> pmap({'x': 1, 'y': 2}) + pmap({'y': 3, 'z': 4}) pmap({'y': 3, 'x': 1, 'z': 4}) # Dict-like methods to convert to list and iterate >>> m3.items() pvector([('a', 5), ('c', 3), ('b', 2)]) >>> list(m3) ['a', 'c', 'b'] .. _PSet: PSet ~~~~ With full support for the Set_ protocol PSet is meant as a drop in replacement to the built in set from a readers point of view. Support for the Hashable_ protocol also means that it can be used as key in Mappings_. Random access and insert is log32(n) where n is the size of the set. .. code:: python >>> from pyrsistent import s # No mutation of sets once created, you know the story... >>> s1 = s(1, 2, 3, 2) >>> s2 = s1.add(4) >>> s3 = s1.remove(1) >>> s1 pset([1, 2, 3]) >>> s2 pset([1, 2, 3, 4]) >>> s3 pset([2, 3]) # Full support for set operations >>> s1 | s(3, 4, 5) pset([1, 2, 3, 4, 5]) >>> s1 & s(3, 4, 5) pset([3]) >>> s1 < s2 True >>> s1 < s(3, 4, 5) False .. _PRecord: PRecord ~~~~~~~ A PRecord is a PMap with a fixed set of specified fields. Records are declared as python classes inheriting from PRecord. Because it is a PMap it has full support for all Mapping methods such as iteration and element access using subscript notation. .. code:: python >>> from pyrsistent import PRecord, field >>> class ARecord(PRecord): ... x = field() ... >>> r = ARecord(x=3) >>> r ARecord(x=3) >>> r.x 3 >>> r.set(x=2) ARecord(x=2) >>> r.set(y=2) Traceback (most recent call last): AttributeError: 'y' is not among the specified fields for ARecord Type information **************** It is possible to add type information to the record to enforce type checks. Multiple allowed types can be specified by providing an iterable of types. .. code:: python >>> class BRecord(PRecord): ... x = field(type=int) ... y = field(type=(int, type(None))) ... >>> BRecord(x=3, y=None) BRecord(y=None, x=3) >>> BRecord(x=3.0) Traceback (most recent call last): PTypeError: Invalid type for field BRecord.x, was float Custom types (classes) that are iterable should be wrapped in a tuple to prevent their members being added to the set of valid types. Although Enums in particular are now supported without wrapping, see #83 for more information. Mandatory fields **************** Fields are not mandatory by default but can be specified as such. If fields are missing an *InvariantException* will be thrown which contains information about the missing fields. .. code:: python >>> from pyrsistent import InvariantException >>> class CRecord(PRecord): ... x = field(mandatory=True) ... >>> r = CRecord(x=3) >>> try: ... r.discard('x') ... except InvariantException as e: ... print(e.missing_fields) ... ('CRecord.x',) Invariants ********** It is possible to add invariants that must hold when evolving the record. Invariants can be specified on both field and record level. If invariants fail an *InvariantException* will be thrown which contains information about the failing invariants. An invariant function should return a tuple consisting of a boolean that tells if the invariant holds or not and an object describing the invariant. This object can later be used to identify which invariant that failed. The global invariant function is only executed if all field invariants hold. Global invariants are inherited to subclasses. .. code:: python >>> class RestrictedVector(PRecord): ... __invariant__ = lambda r: (r.y >= r.x, 'x larger than y') ... x = field(invariant=lambda x: (x > 0, 'x negative')) ... y = field(invariant=lambda y: (y > 0, 'y negative')) ... >>> r = RestrictedVector(y=3, x=2) >>> try: ... r.set(x=-1, y=-2) ... except InvariantException as e: ... print(e.invariant_errors) ... ('y negative', 'x negative') >>> try: ... r.set(x=2, y=1) ... except InvariantException as e: ... print(e.invariant_errors) ... ('x larger than y',) Invariants may also contain multiple assertions. For those cases the invariant function should return a tuple of invariant tuples as described above. This structure is reflected in the invariant_errors attribute of the exception which will contain tuples with data from all failed invariants. Eg: .. code:: python >>> class EvenX(PRecord): ... x = field(invariant=lambda x: ((x > 0, 'x negative'), (x % 2 == 0, 'x odd'))) ... >>> try: ... EvenX(x=-1) ... except InvariantException as e: ... print(e.invariant_errors) ... (('x negative', 'x odd'),) Factories ********* It's possible to specify factory functions for fields. The factory function receives whatever is supplied as field value and the actual returned by the factory is assigned to the field given that any type and invariant checks hold. PRecords have a default factory specified as a static function on the class, create(). It takes a *Mapping* as argument and returns an instance of the specific record. If a record has fields of type PRecord the create() method of that record will be called to create the "sub record" if no factory has explicitly been specified to override this behaviour. .. code:: python >>> class DRecord(PRecord): ... x = field(factory=int) ... >>> class ERecord(PRecord): ... d = field(type=DRecord) ... >>> ERecord.create({'d': {'x': '1'}}) ERecord(d=DRecord(x=1)) Collection fields ***************** It is also possible to have fields with ``pyrsistent`` collections. .. code:: python >>> from pyrsistent import pset_field, pmap_field, pvector_field >>> class MultiRecord(PRecord): ... set_of_ints = pset_field(int) ... map_int_to_str = pmap_field(int, str) ... vector_of_strs = pvector_field(str) ... Serialization ************* PRecords support serialization back to dicts. Default serialization will take keys and values "as is" and output them into a dict. It is possible to specify custom serialization functions to take care of fields that require special treatment. .. code:: python >>> from datetime import date >>> class Person(PRecord): ... name = field(type=unicode) ... birth_date = field(type=date, ... serializer=lambda format, d: d.strftime(format['date'])) ... >>> john = Person(name=u'John', birth_date=date(1985, 10, 21)) >>> john.serialize({'date': '%Y-%m-%d'}) {'birth_date': '1985-10-21', 'name': u'John'} .. _instar: https://github.com/boxed/instar/ .. _PClass: PClass ~~~~~~ A PClass is a python class with a fixed set of specified fields. PClasses are declared as python classes inheriting from PClass. It is defined the same way that PRecords are and behaves like a PRecord in all aspects except that it is not a PMap and hence not a collection but rather a plain Python object. .. code:: python >>> from pyrsistent import PClass, field >>> class AClass(PClass): ... x = field() ... >>> a = AClass(x=3) >>> a AClass(x=3) >>> a.x 3 Checked collections ~~~~~~~~~~~~~~~~~~~ Checked collections currently come in three flavors: CheckedPVector, CheckedPMap and CheckedPSet. .. code:: python >>> from pyrsistent import CheckedPVector, CheckedPMap, CheckedPSet, thaw >>> class Positives(CheckedPSet): ... __type__ = (long, int) ... __invariant__ = lambda n: (n >= 0, 'Negative') ... >>> class Lottery(PRecord): ... name = field(type=str) ... numbers = field(type=Positives, invariant=lambda p: (len(p) > 0, 'No numbers')) ... >>> class Lotteries(CheckedPVector): ... __type__ = Lottery ... >>> class LotteriesByDate(CheckedPMap): ... __key_type__ = date ... __value_type__ = Lotteries ... >>> lotteries = LotteriesByDate.create({date(2015, 2, 15): [{'name': 'SuperLotto', 'numbers': {1, 2, 3}}, ... {'name': 'MegaLotto', 'numbers': {4, 5, 6}}], ... date(2015, 2, 16): [{'name': 'SuperLotto', 'numbers': {3, 2, 1}}, ... {'name': 'MegaLotto', 'numbers': {6, 5, 4}}]}) >>> lotteries LotteriesByDate({datetime.date(2015, 2, 15): Lotteries([Lottery(numbers=Positives([1, 2, 3]), name='SuperLotto'), Lottery(numbers=Positives([4, 5, 6]), name='MegaLotto')]), datetime.date(2015, 2, 16): Lotteries([Lottery(numbers=Positives([1, 2, 3]), name='SuperLotto'), Lottery(numbers=Positives([4, 5, 6]), name='MegaLotto')])}) # The checked versions support all operations that the corresponding # unchecked types do >>> lottery_0215 = lotteries[date(2015, 2, 15)] >>> lottery_0215.transform([0, 'name'], 'SuperDuperLotto') Lotteries([Lottery(numbers=Positives([1, 2, 3]), name='SuperDuperLotto'), Lottery(numbers=Positives([4, 5, 6]), name='MegaLotto')]) # But also makes asserts that types and invariants hold >>> lottery_0215.transform([0, 'name'], 999) Traceback (most recent call last): PTypeError: Invalid type for field Lottery.name, was int >>> lottery_0215.transform([0, 'numbers'], set()) Traceback (most recent call last): InvariantException: Field invariant failed # They can be converted back to python built ins with either thaw() # or serialize() (which provides possibilities to customize serialization) >>> thaw(lottery_0215) [{'numbers': set([1, 2, 3]), 'name': 'SuperLotto'}, {'numbers': set([4, 5, 6]), 'name': 'MegaLotto'}] >>> lottery_0215.serialize() [{'numbers': set([1, 2, 3]), 'name': 'SuperLotto'}, {'numbers': set([4, 5, 6]), 'name': 'MegaLotto'}] .. _transformations: Transformations ~~~~~~~~~~~~~~~ Transformations are inspired by the cool library instar_ for Clojure. They let you evolve PMaps and PVectors with arbitrarily deep/complex nesting using simple syntax and flexible matching syntax. The first argument to transformation is the path that points out the value to transform. The second is the transformation to perform. If the transformation is callable it will be applied to the value(s) matching the path. The path may also contain callables. In that case they are treated as matchers. If the matcher returns True for a specific key it is considered for transformation. .. code:: python # Basic examples >>> from pyrsistent import inc, freeze, thaw, rex, ny, discard >>> v1 = freeze([1, 2, 3, 4, 5]) >>> v1.transform([2], inc) pvector([1, 2, 4, 4, 5]) >>> v1.transform([lambda ix: 0 < ix < 4], 8) pvector([1, 8, 8, 8, 5]) >>> v1.transform([lambda ix, v: ix == 0 or v == 5], 0) pvector([0, 2, 3, 4, 0]) # The (a)ny matcher can be used to match anything >>> v1.transform([ny], 8) pvector([8, 8, 8, 8, 8]) # Regular expressions can be used for matching >>> scores = freeze({'John': 12, 'Joseph': 34, 'Sara': 23}) >>> scores.transform([rex('^Jo')], 0) pmap({'Joseph': 0, 'Sara': 23, 'John': 0}) # Transformations can be done on arbitrarily deep structures >>> news_paper = freeze({'articles': [{'author': 'Sara', 'content': 'A short article'}, ... {'author': 'Steve', 'content': 'A slightly longer article'}], ... 'weather': {'temperature': '11C', 'wind': '5m/s'}}) >>> short_news = news_paper.transform(['articles', ny, 'content'], lambda c: c[:25] + '...' if len(c) > 25 else c) >>> very_short_news = news_paper.transform(['articles', ny, 'content'], lambda c: c[:15] + '...' if len(c) > 15 else c) >>> very_short_news.articles[0].content 'A short article' >>> very_short_news.articles[1].content 'A slightly long...' # When nothing has been transformed the original data structure is kept >>> short_news is news_paper True >>> very_short_news is news_paper False >>> very_short_news.articles[0] is news_paper.articles[0] True # There is a special transformation that can be used to discard elements. Also # multiple transformations can be applied in one call >>> thaw(news_paper.transform(['weather'], discard, ['articles', ny, 'content'], discard)) {'articles': [{'author': 'Sara'}, {'author': 'Steve'}]} Evolvers ~~~~~~~~ PVector, PMap and PSet all have support for a concept dubbed *evolvers*. An evolver acts like a mutable view of the underlying persistent data structure with "transaction like" semantics. No updates of the original data structure is ever performed, it is still fully immutable. The evolvers have a very limited API by design to discourage excessive, and inappropriate, usage as that would take us down the mutable road. In principle only basic mutation and element access functions are supported. Check out the documentation_ of each data structure for specific examples. Examples of when you may want to use an evolver instead of working directly with the data structure include: * Multiple updates are done to the same data structure and the intermediate results are of no interest. In this case using an evolver may be a more efficient and easier to work with. * You need to pass a vector into a legacy function or a function that you have no control over which performs in place mutations. In this case pass an evolver instance instead and then create a new pvector from the evolver once the function returns. .. code:: python >>> from pyrsistent import v # In place mutation as when working with the built in counterpart >>> v1 = v(1, 2, 3) >>> e = v1.evolver() >>> e[1] = 22 >>> e = e.append(4) >>> e = e.extend([5, 6]) >>> e[5] += 1 >>> len(e) 6 # The evolver is considered *dirty* when it contains changes compared to the underlying vector >>> e.is_dirty() True # But the underlying pvector still remains untouched >>> v1 pvector([1, 2, 3]) # Once satisfied with the updates you can produce a new pvector containing the updates. # The new pvector will share data with the original pvector in the same way that would have # been done if only using operations on the pvector. >>> v2 = e.persistent() >>> v2 pvector([1, 22, 3, 4, 5, 7]) # The evolver is now no longer considered *dirty* as it contains no differences compared to the # pvector just produced. >>> e.is_dirty() False # You may continue to work with the same evolver without affecting the content of v2 >>> e[0] = 11 # Or create a new evolver from v2. The two evolvers can be updated independently but will both # share data with v2 where possible. >>> e2 = v2.evolver() >>> e2[0] = 1111 >>> e.persistent() pvector([11, 22, 3, 4, 5, 7]) >>> e2.persistent() pvector([1111, 22, 3, 4, 5, 7]) .. _freeze: .. _thaw: freeze and thaw ~~~~~~~~~~~~~~~ These functions are great when your cozy immutable world has to interact with the evil mutable world outside. .. code:: python >>> from pyrsistent import freeze, thaw, v, m >>> freeze([1, {'a': 3}]) pvector([1, pmap({'a': 3})]) >>> thaw(v(1, m(a=3))) [1, {'a': 3}] By default, freeze will also recursively convert values inside PVectors and PMaps. This behaviour can be changed by providing freeze with the flag strict=False. .. code:: python >>> from pyrsistent import freeze, v, m >>> freeze(v(1, v(2, [3]))) pvector([1, pvector([2, pvector([3])])]) >>> freeze(v(1, v(2, [3])), strict=False) pvector([1, pvector([2, [3]])]) >>> freeze(m(a=m(b={'c': 1}))) pmap({'a': pmap({'b': pmap({'c': 1})})}) >>> freeze(m(a=m(b={'c': 1})), strict=False) pmap({'a': pmap({'b': {'c': 1}})}) In this regard, thaw operates as the inverse of freeze so will thaw values inside native data structures unless passed the strict=False flag. Compatibility ------------- Pyrsistent is developed and tested on Python 3.7+ and PyPy3. Performance ----------- Pyrsistent is developed with performance in mind. Still, while some operations are nearly on par with their built in, mutable, counterparts in terms of speed, other operations are slower. In the cases where attempts at optimizations have been done, speed has generally been valued over space. Pyrsistent comes with two API compatible flavors of PVector (on which PMap and PSet are based), one pure Python implementation and one implemented as a C extension. The latter generally being 2 - 20 times faster than the former. The C extension will be used automatically when possible. The pure python implementation is fully PyPy compatible. Running it under PyPy speeds operations up considerably if the structures are used heavily (if JITed), for some cases the performance is almost on par with the built in counterparts. Type hints ---------- PEP 561 style type hints for use with mypy and various editors are available for most types and functions in pyrsistent. Type classes for annotating your own code with pyrsistent types are also available under pyrsistent.typing. Installation ------------ pip install pyrsistent Documentation ------------- Available at http://pyrsistent.readthedocs.org/ Brief presentation available at http://slides.com/tobiasgustafsson/immutability-and-python/ Contributors ------------ Tobias Gustafsson https://github.com/tobgu Christopher Armstrong https://github.com/radix Anders Hovmöller https://github.com/boxed Itamar Turner-Trauring https://github.com/itamarst Jonathan Lange https://github.com/jml Richard Futrell https://github.com/Futrell Jakob Hollenstein https://github.com/jkbjh David Honour https://github.com/foolswood David R. MacIver https://github.com/DRMacIver Marcus Ewert https://github.com/sarum90 Jean-Paul Calderone https://github.com/exarkun Douglas Treadwell https://github.com/douglas-treadwell Travis Parker https://github.com/teepark Julian Berman https://github.com/Julian Dennis Tomas https://github.com/dtomas Neil Vyas https://github.com/neilvyas doozr https://github.com/doozr Kamil Galuszka https://github.com/galuszkak Tsuyoshi Hombashi https://github.com/thombashi nattofriends https://github.com/nattofriends agberk https://github.com/agberk Waleed Khan https://github.com/arxanas Jean-Louis Fuchs https://github.com/ganwell Carlos Corbacho https://github.com/ccorbacho Felix Yan https://github.com/felixonmars benrg https://github.com/benrg Jere Lahelma https://github.com/je-l Max Taggart https://github.com/MaxTaggart Vincent Philippon https://github.com/vphilippon Semen Zhydenko https://github.com/ss18 Till Varoquaux https://github.com/till-varoquaux Michal Kowalik https://github.com/michalvi ossdev07 https://github.com/ossdev07 Kerry Olesen https://github.com/qhesz johnthagen https://github.com/johnthagen Bastien Vallet https://github.com/djailla Ram Rachum https://github.com/cool-RR Vincent Philippon https://github.com/vphilippon Andrey Bienkowski https://github.com/hexagonrecursion Ethan McCue https://github.com/bowbahdoe Jason R. Coombs https://github.com/jaraco Nathan https://github.com/ndowens Geert Barentsen https://github.com/barentsen phil-arh https://github.com/phil-arh Tamás Nepusz https://github.com/ntamas Hugo van Kemenade https://github.com/hugovk Ben Beasley https://github.com/musicinmybrain Contributing ------------ Want to contribute? That's great! If you experience problems please log them on GitHub. If you want to contribute code, please fork the repository and submit a pull request. Run tests ~~~~~~~~~ .. _tox: https://tox.readthedocs.io/en/latest/ Tests can be executed using tox_. Install tox: ``pip install tox`` Run test for Python 3.8: ``tox -e py38`` Release ~~~~~~~ * `pip install -r requirements.txt` * Update CHANGES.txt * Update README.rst with any new contributors and potential info needed. * Update _pyrsistent_version.py * Commit and tag with new version: `git add -u . && git commit -m 'Prepare version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'` * Push commit and tags: `git push && git push --tags` * Build new release using Github actions Project status -------------- Pyrsistent can be considered stable and mature (who knows, there may even be a 1.0 some day :-)). The project is maintained, bugs fixed, PRs reviewed and merged and new releases made. I currently do not have time for development of new features or functionality which I don't have use for myself. I'm more than happy to take PRs for new functionality though! There are a bunch of issues marked with ``enhancement`` and ``help wanted`` that contain requests for new functionality that would be nice to include. The level of difficulty and extend of the issues varies, please reach out to me if you're interested in working on any of them. If you feel that you have a grand master plan for where you would like Pyrsistent to go and have the time to put into it please don't hesitate to discuss this with me and submit PRs for it. If all goes well I'd be more than happy to add additional maintainers to the project! usr/lib/python3/dist-packages/distlib-0.3.4.egg-info/PKG-INFO 0000644 00000002231 15027666705 0017143 0 ustar 00 Metadata-Version: 2.1 Name: distlib Version: 0.3.4 Summary: Distribution utilities Home-page: https://bitbucket.org/pypa/distlib Author: Vinay Sajip Author-email: vinay_sajip@red-dove.com License: Python license Download-URL: https://bitbucket.org/pypa/distlib/downloads/distlib-0.3.4.zip Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development License-File: LICENSE.txt Low-level components of distutils2/packaging, augmented with higher-level APIs for making packaging easier. usr/lib/python3/dist-packages/click-8.0.3.egg-info/PKG-INFO 0000644 00000006075 15027667653 0016617 0 ustar 00 Metadata-Version: 2.1 Name: click Version: 8.0.3 Summary: Composable command line interface toolkit Home-page: https://palletsprojects.com/p/click/ Author: Armin Ronacher Author-email: armin.ronacher@active-4.com Maintainer: Pallets Maintainer-email: contact@palletsprojects.com License: BSD-3-Clause Project-URL: Donate, https://palletsprojects.com/donate Project-URL: Documentation, https://click.palletsprojects.com/ Project-URL: Changes, https://click.palletsprojects.com/changes/ Project-URL: Source Code, https://github.com/pallets/click/ Project-URL: Issue Tracker, https://github.com/pallets/click/issues/ Project-URL: Twitter, https://twitter.com/PalletsTeam Project-URL: Chat, https://discord.gg/pallets Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Requires-Python: >=3.6 Description-Content-Type: text/x-rst License-File: LICENSE.rst \$ click\_ ========== Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with sensible defaults out of the box. It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API. Click in three points: - Arbitrary nesting of commands - Automatic help page generation - Supports lazy loading of subcommands at runtime Installing ---------- Install and update using `pip`_: .. code-block:: text $ pip install -U click .. _pip: https://pip.pypa.io/en/stable/getting-started/ A Simple Example ---------------- .. code-block:: python import click @click.command() @click.option("--count", default=1, help="Number of greetings.") @click.option("--name", prompt="Your name", help="The person to greet.") def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for _ in range(count): click.echo(f"Hello, {name}!") if __name__ == '__main__': hello() .. code-block:: text $ python hello.py --count=3 Your name: Click Hello, Click! Hello, Click! Hello, Click! Donate ------ The Pallets organization develops and supports Click and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, `please donate today`_. .. _please donate today: https://palletsprojects.com/donate Links ----- - Documentation: https://click.palletsprojects.com/ - Changes: https://click.palletsprojects.com/changes/ - PyPI Releases: https://pypi.org/project/click/ - Source Code: https://github.com/pallets/click - Issue Tracker: https://github.com/pallets/click/issues - Website: https://palletsprojects.com/p/click - Twitter: https://twitter.com/PalletsTeam - Chat: https://discord.gg/pallets
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings