semvec/pypi-packages huggingface dataset:
permutation 0.5.0
Permutations of finitely many positive integers
License: MIT
Requires Python: >=3.8
Keywords: group theory, math, mathematics, maths, permutation, symmetric group

|repostatus| |ci-status| |coverage| |pyversions| |license|

.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg
    :target: https://www.repostatus.org/#active
    :alt: Project Status: Active — The project has reached a stable, usable
          state and is being actively developed.

.. |ci-status| image:: https://github.com/jwodder/permutation/actions/workflows/test.yml/badge.svg
    :target: https://github.com/jwodder/permutation/actions/workflows/test.yml
    :alt: CI Status

.. |coverage| image:: https://codecov.io/gh/jwodder/permutation/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/jwodder/permutation

.. |pyversions| image:: https://img.shields.io/pypi/pyversions/permutation.svg
    :target: https://pypi.org/project/permutation

.. |license| image:: https://img.shields.io/github/license/jwodder/permutation.svg
    :target: https://opensource.org/licenses/MIT
    :alt: MIT License

`GitHub <https://github.com/jwodder/permutation>`_
| `PyPI <https://pypi.org/project/permutation>`_
| `Documentation <https://permutation.readthedocs.io>`_
| `Issues <https://github.com/jwodder/permutation/issues>`_
| `Changelog <https://github.com/jwodder/permutation/blob/master/CHANGELOG.md>`_

``permutation`` provides a ``Permutation`` class for representing `permutations
<https://en.wikipedia.org/wiki/Permutation>`_ of finitely many positive
integers in Python.  Supported operations & properties include inverses, (group
theoretic) order, parity, composition/multiplication, cycle decomposition,
cycle notation, word representation, Lehmer codes, and, of course, use as a
callable on integers.


Installation
============
``permutation`` requires Python 3.8 or higher.  Just use `pip
<https://pip.pypa.io>`_ for Python 3 (You have pip, right?) to install::

    python3 -m pip install permutation


Examples
========

>>> from permutation import Permutation
>>> p = Permutation(2, 1, 4, 5, 3)
>>> p(1)
2
>>> p(3)
4
>>> p(42)
42
>>> p.to_cycles()
[(1, 2), (3, 4, 5)]
>>> print(p)
(1 2)(3 4 5)
>>> print(p.inverse())
(1 2)(3 5 4)
>>> p.degree
5
>>> p.order
6
>>> p.is_even
False
>>> p.lehmer(5)
27
>>> q = Permutation.cycle(1,2,3)
>>> print(p * q)
(2 4 5 3)
>>> print(q * p)
(1 3 4 5)
>>> for p in Permutation.group(3):
...     print(p)
...
1
(1 2)
(2 3)
(1 3 2)
(1 2 3)
(1 3)
linesep 0.5.1
Handling lines with arbitrary separators
License: MIT
Requires Python: >=3.8
Keywords: delimiters, line break, line-ending, linebreak, newline, paragraphs, separator

|repostatus| |ci-status| |coverage| |pyversions| |license|

.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg
    :target: https://www.repostatus.org/#active
    :alt: Project Status: Active — The project has reached a stable, usable
          state and is being actively developed.

.. |ci-status| image:: https://github.com/jwodder/linesep/actions/workflows/test.yml/badge.svg
    :target: https://github.com/jwodder/linesep/actions/workflows/test.yml
    :alt: CI Status

.. |coverage| image:: https://codecov.io/gh/jwodder/linesep/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/jwodder/linesep

.. |pyversions| image:: https://img.shields.io/pypi/pyversions/linesep.svg
    :target: https://pypi.org/project/linesep

.. |license| image:: https://img.shields.io/github/license/jwodder/linesep.svg
    :target: https://opensource.org/licenses/MIT
    :alt: MIT License

`GitHub <https://github.com/jwodder/linesep>`_
| `PyPI <https://pypi.org/project/linesep>`_
| `Documentation <https://linesep.readthedocs.io>`_
| `Issues <https://github.com/jwodder/linesep/issues>`_
| `Changelog <https://github.com/jwodder/linesep/blob/master/CHANGELOG.md>`_

``linesep`` provides basic functions & classes for reading, writing, splitting,
& joining text with custom separators that can occur either before, between, or
after the segments they separate.

Installation
============
``linesep`` requires Python 3.8 or higher.  Just use `pip
<https://pip.pypa.io>`_ for Python 3 (You have pip, right?) to install::

    python3 -m pip install linesep


Examples
========

Reading sections separated by a "``---``" line:

.. code:: python

    with open('text.txt') as fp:
        for entry in linesep.read_separated(fp, '\n---\n'):
            ...

Parsing output from ``find -print0``:

.. code:: python

    find = subprocess.Popen(
        ['find', '/', '-some', '-complicated', '-condition', '-print0'],
        stdout=subprocess.PIPE,
    )
    for filepath in linesep.read_terminated(find.stdout, '\0'):
        ...

A poor man's `JSON Text Sequence <https://tools.ietf.org/html/rfc7464>`_ parser:

.. code:: python

    for entry in linesep.read_preceded(fp, '\x1E'):
        try:
            obj = json.loads(entry)
        except ValueError:
            pass
        else:
            yield obj

Read from a text file one paragraph at a time:

.. code:: python

    with open("my-novel.txt") as fp:
        for paragraph in linesep.read_paragraphs(fp):
            ...

Split input from an ``anyio.TextReceiveStream`` on newlines:

.. code:: python

    async with anyio.TextReceiveStream( ... ) as stream:
        splitter = linesep.UnicodeNewlineSplitter()
        async for line in splitter.aitersplit(stream):
            print(line)