{"id":18085073,"url":"https://github.com/jwodder/linesep","last_synced_at":"2025-07-16T04:41:43.765Z","repository":{"id":43357069,"uuid":"58645336","full_name":"jwodder/linesep","owner":"jwodder","description":"Handling lines with arbitrary separators","archived":false,"fork":false,"pushed_at":"2025-03-31T13:42:50.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T08:03:22.712Z","etag":null,"topics":["available-on-pypi","delimiters","line-break","line-ending","linebreak","newline","paragraphs","python","separator"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwodder.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-12T13:44:52.000Z","updated_at":"2025-01-23T14:39:29.000Z","dependencies_parsed_at":"2023-09-25T23:58:29.781Z","dependency_job_id":"fd96aa0f-e74b-4fcf-bae1-7af35ae08bc5","html_url":"https://github.com/jwodder/linesep","commit_stats":{"total_commits":179,"total_committers":2,"mean_commits":89.5,"dds":0.005586592178770999,"last_synced_commit":"b0d86dad5d6fd8cb2b1ab700e2095a21697442b2"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jwodder/linesep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Flinesep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Flinesep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Flinesep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Flinesep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwodder","download_url":"https://codeload.github.com/jwodder/linesep/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Flinesep/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265482185,"owners_count":23774015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["available-on-pypi","delimiters","line-break","line-ending","linebreak","newline","paragraphs","python","separator"],"created_at":"2024-10-31T15:09:17.617Z","updated_at":"2025-07-16T04:41:43.712Z","avatar_url":"https://github.com/jwodder.png","language":"Python","readme":"|repostatus| |ci-status| |coverage| |pyversions| |license|\n\n.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg\n    :target: https://www.repostatus.org/#active\n    :alt: Project Status: Active — The project has reached a stable, usable\n          state and is being actively developed.\n\n.. |ci-status| image:: https://github.com/jwodder/linesep/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/jwodder/linesep/actions/workflows/test.yml\n    :alt: CI Status\n\n.. |coverage| image:: https://codecov.io/gh/jwodder/linesep/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jwodder/linesep\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/linesep.svg\n    :target: https://pypi.org/project/linesep\n\n.. |license| image:: https://img.shields.io/github/license/jwodder/linesep.svg\n    :target: https://opensource.org/licenses/MIT\n    :alt: MIT License\n\n`GitHub \u003chttps://github.com/jwodder/linesep\u003e`_\n| `PyPI \u003chttps://pypi.org/project/linesep\u003e`_\n| `Documentation \u003chttps://linesep.readthedocs.io\u003e`_\n| `Issues \u003chttps://github.com/jwodder/linesep/issues\u003e`_\n| `Changelog \u003chttps://github.com/jwodder/linesep/blob/master/CHANGELOG.md\u003e`_\n\n``linesep`` provides basic functions \u0026 classes for reading, writing, splitting,\n\u0026 joining text with custom separators that can occur either before, between, or\nafter the segments they separate.\n\nInstallation\n============\n``linesep`` requires Python 3.8 or higher.  Just use `pip\n\u003chttps://pip.pypa.io\u003e`_ for Python 3 (You have pip, right?) to install::\n\n    python3 -m pip install linesep\n\n\nExamples\n========\n\nReading sections separated by a \"``---``\" line:\n\n.. code:: python\n\n    with open('text.txt') as fp:\n        for entry in linesep.read_separated(fp, '\\n---\\n'):\n            ...\n\nParsing output from ``find -print0``:\n\n.. code:: python\n\n    find = subprocess.Popen(\n        ['find', '/', '-some', '-complicated', '-condition', '-print0'],\n        stdout=subprocess.PIPE,\n    )\n    for filepath in linesep.read_terminated(find.stdout, '\\0'):\n        ...\n\nA poor man's `JSON Text Sequence \u003chttps://tools.ietf.org/html/rfc7464\u003e`_ parser:\n\n.. code:: python\n\n    for entry in linesep.read_preceded(fp, '\\x1E'):\n        try:\n            obj = json.loads(entry)\n        except ValueError:\n            pass\n        else:\n            yield obj\n\nRead from a text file one paragraph at a time:\n\n.. code:: python\n\n    with open(\"my-novel.txt\") as fp:\n        for paragraph in linesep.read_paragraphs(fp):\n            ...\n\nSplit input from an ``anyio.TextReceiveStream`` on newlines:\n\n.. code:: python\n\n    async with anyio.TextReceiveStream( ... ) as stream:\n        splitter = linesep.UnicodeNewlineSplitter()\n        async for line in splitter.aitersplit(stream):\n            print(line)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Flinesep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwodder%2Flinesep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Flinesep/lists"}