{"id":21453440,"url":"https://github.com/lapets/reiter","last_synced_at":"2025-08-25T01:08:26.617Z","repository":{"id":68339670,"uuid":"326876163","full_name":"lapets/reiter","owner":"lapets","description":"Wrapper for Python iterators/iterables that implements a list-like random-access interface by caching retrieved items for later reuse.","archived":false,"fork":false,"pushed_at":"2023-05-27T03:47:29.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T14:26:01.114Z","etag":null,"topics":["python-cache","python-caching","python-data-structures","python-iterable","python-iterables","python-iterator","python-iterators","python-library","python-wrapper"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/reiter","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/lapets.png","metadata":{"files":{"readme":"README.rst","changelog":null,"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}},"created_at":"2021-01-05T03:33:55.000Z","updated_at":"2022-06-19T03:54:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"afc3fdc2-d5fb-4023-8498-68b4797bcf3e","html_url":"https://github.com/lapets/reiter","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.2222222222222222,"last_synced_commit":"4e79b9da187c187c6231c6cca49cdd532ae80e91"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/lapets/reiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Freiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Freiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Freiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Freiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lapets","download_url":"https://codeload.github.com/lapets/reiter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Freiter/sbom","scorecard":{"id":578866,"data":{"date":"2025-08-11","repo":{"name":"github.com/lapets/reiter","commit":"4e79b9da187c187c6231c6cca49cdd532ae80e91"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint-test-cover-docs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-test-cover-docs.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/lapets/reiter/lint-test-cover-docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-test-cover-docs.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lapets/reiter/lint-test-cover-docs.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:25","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:33","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T18:36:52.915Z","repository_id":68339670,"created_at":"2025-08-20T18:36:52.915Z","updated_at":"2025-08-20T18:36:52.915Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271501358,"owners_count":24770615,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["python-cache","python-caching","python-data-structures","python-iterable","python-iterables","python-iterator","python-iterators","python-library","python-wrapper"],"created_at":"2024-11-23T04:39:38.644Z","updated_at":"2025-08-25T01:08:26.570Z","avatar_url":"https://github.com/lapets.png","language":"Python","readme":"======\nreiter\n======\n\nWrapper for Python iterators and iterables that implements a list-like random-access interface by caching retrieved items for later reuse.\n\n|pypi| |readthedocs| |actions| |coveralls|\n\n.. |pypi| image:: https://badge.fury.io/py/reiter.svg\n   :target: https://badge.fury.io/py/reiter\n   :alt: PyPI version and link.\n\n.. |readthedocs| image:: https://readthedocs.org/projects/reiter/badge/?version=latest\n   :target: https://reiter.readthedocs.io/en/latest/?badge=latest\n   :alt: Read the Docs documentation status.\n\n.. |actions| image:: https://github.com/lapets/reiter/workflows/lint-test-cover-docs/badge.svg\n   :target: https://github.com/lapets/reiter/actions/workflows/lint-test-cover-docs.yml\n   :alt: GitHub Actions status.\n\n.. |coveralls| image:: https://coveralls.io/repos/github/lapets/reiter/badge.svg?branch=main\n   :target: https://coveralls.io/github/lapets/reiter?branch=main\n   :alt: Coveralls test coverage summary.\n\nInstallation and Usage\n----------------------\nThis library is available as a `package on PyPI \u003chttps://pypi.org/project/reiter\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install reiter\n\nThe library can be imported in the usual way:\n\n.. code-block:: python\n\n    import reiter\n    from reiter import reiter\n\nExamples\n^^^^^^^^\n\n.. |reiter| replace:: ``reiter``\n.. _reiter: https://reiter.readthedocs.io/en/0.8.0/_source/reiter.html#reiter.reiter.reiter\n\nThis library makes it possible to wrap any `iterator \u003chttps://docs.python.org/3/glossary.html#term-iterator\u003e`__ or `iterable \u003chttps://docs.python.org/3/glossary.html#term-iterable\u003e`__ object within an interface that enables repeated iteration over -- and random access by index of -- the items contained within that object. A |reiter|_ instance yields the same sequence of items as the wrapped iterator or iterable:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from reiter import reiter\n    \u003e\u003e\u003e xs = iter([1, 2, 3])\n    \u003e\u003e\u003e ys = reiter(xs)\n    \u003e\u003e\u003e list(ys)\n    [1, 2, 3]\n\n.. |iter| replace:: ``iter``\n.. _iter: https://docs.python.org/3/library/functions.html#iter\n\nUnlike iterators and some iterable objects (including those that are built-in and those that are user-defined), an instance of the |reiter|_ class *always* allows iteration over its items any number of times. More specifically, every invocation of |iter|_ (explicit or implicit) returns an iterator that begins iteration from the first item found in the originally wrapped iterator or iterable:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e list(iter(ys)), list(iter(ys))\n    ([1, 2, 3], [1, 2, 3])\n    \u003e\u003e\u003e list(ys), list(ys)\n    ([1, 2, 3], [1, 2, 3])\n\nFurthermore, it is also possible to access elements by their index:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e xs = iter([1, 2, 3])\n    \u003e\u003e\u003e ys = reiter(xs)\n    \u003e\u003e\u003e ys[0], ys[1], ys[2]\n    (1, 2, 3)\n\n.. |next| replace:: ``next``\n.. _next: https://docs.python.org/3/library/functions.html#next\n\n.. |StopIteration| replace:: ``StopIteration``\n.. _StopIteration: https://docs.python.org/3/library/exceptions.html#StopIteration\n\nThe built-in Python |next|_ function is also supported, and any attempt to retrieve an item once the sequence of items is exhausted raises the |StopIteration|_ exception in the usual manner:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e xs = reiter(iter([1, 2, 3]))\n    \u003e\u003e\u003e next(xs), next(xs), next(xs)\n    (1, 2, 3)\n    \u003e\u003e\u003e next(xs)\n    Traceback (most recent call last):\n      ...\n    StopIteration\n\nHowever, all items yielded during iteration can be accessed by their index, and it is also possible to iterate over those items again:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e xs[0], xs[1], xs[2]\n    (1, 2, 3)\n    \u003e\u003e\u003e [x for x in xs]\n    [1, 2, 3]\n\n.. |reiter___getitem__| replace:: ``__getitem__``\n.. _reiter___getitem__: https://reiter.readthedocs.io/en/0.8.0/_source/reiter.html#reiter.reiter.reiter.__getitem__\n\nRetrieval of yielded items using slice notation is also supported via the |reiter___getitem__|_ method:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e xs = reiter(iter([1, 2, 3]))\n    \u003e\u003e\u003e xs[0:2]\n    [1, 2]\n\n.. |reiter_has| replace:: ``has``\n.. _reiter_has: https://reiter.readthedocs.io/en/0.8.0/_source/reiter.html#reiter.reiter.reiter.has\n\n.. |reiter_length| replace:: ``length``\n.. _reiter_length: https://reiter.readthedocs.io/en/0.8.0/_source/reiter.html#reiter.reiter.reiter.length\n\nInstances of |reiter|_ support additional inspection methods, as well. For example, the |reiter_has|_ method returns a boolean value indicating whether a next item is available and the |reiter_length|_ method returns the length of the sequence of items emitted by the instance (once no more items can be emitted):\n\n.. code-block:: python\n\n    \u003e\u003e\u003e xs = reiter(iter([1, 2, 3]))\n    \u003e\u003e\u003e xs.has(), xs.has(), xs.has(), xs.has()\n    (True, True, True, False)\n    \u003e\u003e\u003e xs.length()\n    3\n\nDevelopment\n-----------\nAll installation and development dependencies are fully specified in ``pyproject.toml``. The ``project.optional-dependencies`` object is used to `specify optional requirements \u003chttps://peps.python.org/pep-0621\u003e`__ for various development tasks. This makes it possible to specify additional options (such as ``docs``, ``lint``, and so on) when performing installation using `pip \u003chttps://pypi.org/project/pip\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[docs,lint]\n\nDocumentation\n^^^^^^^^^^^^^\nThe documentation can be generated automatically from the source files using `Sphinx \u003chttps://www.sphinx-doc.org\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[docs]\n    cd docs\n    sphinx-apidoc -f -E --templatedir=_templates -o _source .. \u0026\u0026 make html\n\nTesting and Conventions\n^^^^^^^^^^^^^^^^^^^^^^^\nAll unit tests are executed and their coverage is measured when using `pytest \u003chttps://docs.pytest.org\u003e`__ (see the ``pyproject.toml`` file for configuration details):\n\n.. code-block:: bash\n\n    python -m pip install .[test]\n    python -m pytest\n\nAlternatively, all unit tests are included in the module itself and can be executed using `doctest \u003chttps://docs.python.org/3/library/doctest.html\u003e`__:\n\n.. code-block:: bash\n\n    python src/reiter/reiter.py -v\n\nStyle conventions are enforced using `Pylint \u003chttps://pylint.readthedocs.io\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install .[lint]\n    python -m pylint src/reiter\n\nContributions\n^^^^^^^^^^^^^\nIn order to contribute to the source code, open an issue or submit a pull request on the `GitHub page \u003chttps://github.com/lapets/reiter\u003e`__ for this library.\n\nVersioning\n^^^^^^^^^^\nThe version number format for this library and the changes to the library associated with version number increments conform with `Semantic Versioning 2.0.0 \u003chttps://semver.org/#semantic-versioning-200\u003e`__.\n\nPublishing\n^^^^^^^^^^\nThis library can be published as a `package on PyPI \u003chttps://pypi.org/project/reiter\u003e`__ by a package maintainer. First, install the dependencies required for packaging and publishing:\n\n.. code-block:: bash\n\n    python -m pip install .[publish]\n\nEnsure that the correct version number appears in ``pyproject.toml``, and that any links in this README document to the Read the Docs documentation of this package (or its dependencies) have appropriate version numbers. Also ensure that the Read the Docs project for this library has an `automation rule \u003chttps://docs.readthedocs.io/en/stable/automation-rules.html\u003e`__ that activates and sets as the default all tagged versions. Create and push a tag for this version (replacing ``?.?.?`` with the version number):\n\n.. code-block:: bash\n\n    git tag ?.?.?\n    git push origin ?.?.?\n\nRemove any old build/distribution files. Then, package the source into a distribution archive:\n\n.. code-block:: bash\n\n    rm -rf build dist src/*.egg-info\n    python -m build --sdist --wheel .\n\nFinally, upload the package distribution archive to `PyPI \u003chttps://pypi.org\u003e`__:\n\n.. code-block:: bash\n\n    python -m twine upload dist/*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Freiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flapets%2Freiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Freiter/lists"}