{"id":34091692,"url":"https://github.com/swapp-ai/extents","last_synced_at":"2026-04-08T17:32:10.289Z","repository":{"id":224515533,"uuid":"761204228","full_name":"swapp-ai/extents","owner":"swapp-ai","description":"An Intervals Library Implemented in Pure Python","archived":false,"fork":false,"pushed_at":"2026-02-10T11:19:57.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-10T16:11:42.415Z","etag":null,"topics":["interval","interval-algebra","interval-arithmetic","intervals"],"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/swapp-ai.png","metadata":{"files":{"readme":"README.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-21T12:43:11.000Z","updated_at":"2026-02-10T11:20:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ef89da4-d4b3-49c4-b88f-27464237f814","html_url":"https://github.com/swapp-ai/extents","commit_stats":null,"previous_names":["swapp-ai/extents"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/swapp-ai/extents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapp-ai%2Fextents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapp-ai%2Fextents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapp-ai%2Fextents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapp-ai%2Fextents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swapp-ai","download_url":"https://codeload.github.com/swapp-ai/extents/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapp-ai%2Fextents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31566810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["interval","interval-algebra","interval-arithmetic","intervals"],"created_at":"2025-12-14T14:48:34.134Z","updated_at":"2026-04-08T17:32:10.280Z","avatar_url":"https://github.com/swapp-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extents - An Intervals Library in Pure Python\n\n`extents` is an intervals library implemented in pure python. \nIt draws its inspiration from the [`PyInterval`](https://pyinterval.readthedocs.io/en/latest/) \nlibrary ([github](https://github.com/taschini/pyinterval)).\n\nThis library is capable of representing open, closed and semi-open/closed intervals.\nIt also supports set operations on intervals (i.e., union, intersection and complement).\n\n\n## Examples:\n\n### Basic use cases:\n\nBasic use of this library includes creating simple intervals, and manipulating them \nthrough set operations\n\n\n```python\nfrom extents import interval        # the interval class represents a collection of intervals\n\nival1 = interval([0, 1])            # the singleton interval set containing the closed interval [0, 1]\nprint(ival1)                        # Interval([0, 1])\nprint(~ival1)                       # Interval((-inf, 0), (1, inf)) -- the interval set of (-inf, 0) and (1, inf) -- \n                                    # which compose the complement of [0, 1]\n\nival2 = interval((4, 5))            # the singleton interval set containing the open interval (4, 5)\nprint(ival2)                        # Interval((4, 5))\nprint(~ival2)                       # Interval((-inf, 4], [5, inf)) -- the interval set of (-inf, 4] and [5, inf) --\n                                    # which are the complement of (4, 5)]\n\nival3 = interval([0, 1], [5, 6])    # the interval set [0, 1] and [5, 6]\nival4 = interval([0, 3], [4, 5.5])  # the interval set [0, 3] and [4, 5.5]\nprint(ival3 | ival4)                # the interval set [0, 3] and [4, 6], which is the union of ival3 and ival4\nprint(ival3 \u0026 ival4)                # the interval set [0, 1] and [5, 5.5], which is the intersection of ival3 and ival4\n\nival5 = interval([0, 1], [0.5, 3])  # intervals are automatically union-ed during construction.\nprint(ival5)                        # resulting in the interval [0, 3]\n```\n\nThe output of the commands above would be:\n\n```\nInterval([0, 1])\nInterval((-inf, 0), (1, inf))\nInterval((4, 5))\nInterval((-inf, 4], [5, inf))\nInterval([0, 3], [4, 6])\nInterval([0, 1], [5, 5.5])\nInterval([0, 3])\n```\n\n### Advanced use cases:\n\nIn order to construct a semi-open interval, you can import the `Component` and `ComponentType`,\nand construct the internal interval components.\n\nFor example,\n```python\nfrom extents import interval, Component, ComponentType\n\nival = interval(Component(0, 1, ComponentType.HALF_CLOSED_LEFT),\n                Component(5, 6, ComponentType.HALF_CLOSED_RIGHT)\n                )\nprint(ival)  # construct the interval set: [0, 1), (5, 6]\n```\n\n### Additional Examples:\n\nSee the `tests/extents_test.py` file. \n\n## Installation:\n\nFrom `github`:\n```shell\n$ pip install git+https://github.com/swapp-ai/extents\n```\n\nFrom source:\n```shell\n$ git clone https://github.com/swapp-ai/extents\n$ cd extents\n$ pip install .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapp-ai%2Fextents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswapp-ai%2Fextents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapp-ai%2Fextents/lists"}