{"id":25706376,"url":"https://github.com/insyncwithfoo/a-n-plus-b","last_synced_at":"2025-04-30T11:22:28.488Z","repository":{"id":220806645,"uuid":"752659544","full_name":"InSyncWithFoo/a-n-plus-b","owner":"InSyncWithFoo","description":"A toy parser for the An+B CSS microsyntax","archived":false,"fork":false,"pushed_at":"2025-04-10T09:46:55.000Z","size":113,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T00:37:50.320Z","etag":null,"topics":["css","css-syntax"],"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/InSyncWithFoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2024-02-04T13:04:06.000Z","updated_at":"2025-04-10T09:46:55.000Z","dependencies_parsed_at":"2024-05-02T05:45:52.198Z","dependency_job_id":"d171f782-8170-4f51-a233-53f0c6dcd742","html_url":"https://github.com/InSyncWithFoo/a-n-plus-b","commit_stats":null,"previous_names":["insyncwithfoo/a-n-plus-b"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InSyncWithFoo%2Fa-n-plus-b","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InSyncWithFoo%2Fa-n-plus-b/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InSyncWithFoo%2Fa-n-plus-b/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InSyncWithFoo%2Fa-n-plus-b/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InSyncWithFoo","download_url":"https://codeload.github.com/InSyncWithFoo/a-n-plus-b/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251689011,"owners_count":21627817,"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":["css","css-syntax"],"created_at":"2025-02-25T07:18:18.397Z","updated_at":"2025-04-30T11:22:28.458Z","avatar_url":"https://github.com/InSyncWithFoo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANPlusB\n\nThis tiny package provides a toolkit for\nworking with the `\u003cAn+B\u003e` CSS microsyntax.\n\n\n## Installation\n\nThis package is available [on PyPI][1]:\n\n```shell\n$ pip install a-n-plus-b\n```\n\n\n## Usage\n\nThis package only ever parses [the `\u003cAn+B\u003e` microsyntax][2].\nIt does not support [the `of \u003cselector\u003e` syntax][3].\n\n### Examples\n\n```pycon\n\u003e\u003e\u003e from a_n_plus_b import ANPlusB\n\u003e\u003e\u003e ANPlusB(2, 1)\nANPlusB(2n+1)\n\u003e\u003e\u003e str(_)\n'2n+1'\n\u003e\u003e\u003e ANPlusB(4)\nANPlusB(4)\n\u003e\u003e\u003e ANPlusB(4, 0)\nANPlusB(4n)\n\u003e\u003e\u003e {ANPlusB(1, 0), ANPlusB(True, False)}\n{ANPlusB(n)}\n```\n\n```pycon\n\u003e\u003e\u003e from itertools import islice\n\u003e\u003e\u003e ANPlusB(3, 2)\nANPlusB(3n+2)\n\u003e\u003e\u003e values = _.values()\n\u003e\u003e\u003e values\n_InfiniteRange(start = 2, step = 3)\n\u003e\u003e\u003e list(islice(values, 10))\n[2, 5, 8, 11, 14, 17, 20, 23, 26, 29]\n\u003e\u003e\u003e 6405429723686292014 in values\nTrue\n```\n\n```pycon\n\u003e\u003e\u003e instance = ANPlusB(4, -7)\n\u003e\u003e\u003e list(instance.indices(40))\n[1, 5, 9, 13, 17, 21, 25, 29, 33, 37]\n\u003e\u003e\u003e list(instance.indices(40, from_last = True))\n[40, 36, 32, 28, 24, 20, 16, 12, 8, 4]\n\u003e\u003e\u003e list(instance.indices(40, order = 'descending'))\n[37, 33, 29, 25, 21, 17, 13, 9, 5, 1]\n\u003e\u003e\u003e list(instance.indices(40, from_last = True, order = 'ascending'))\n[4, 8, 12, 16, 20, 24, 28, 32, 36, 40]\n```\n\n```pycon\n\u003e\u003e\u003e ANPlusB.parse('odd')\nANPlusB(2n+1)\n\u003e\u003e\u003e ANPlusB.parse('even')\nANPlusB(2n)\n\u003e\u003e\u003e ANPlusB.parse('4')\nANPlusB(4)\n\u003e\u003e\u003e ANPlusB.parse('-1n')\nANPlusB(-n)\n\u003e\u003e\u003e ANPlusB.parse('+0n-8')\nANPlusB(-8)\n\u003e\u003e\u003e ANPlusB.parse('0n+0124')\nANPlusB(124)\n```\n\n```pycon\n\u003e\u003e\u003e ANPlusB.from_complex(5j - 2)\nANPlusB(5n-2)\n```\n\n```pycon\n\u003e\u003e\u003e from a_n_plus_b import n\n\u003e\u003e\u003e 2 * n\nANPlusB(2n)\n\u003e\u003e\u003e n * -3 - 1\nANPlusB(-3n-1)\n\u003e\u003e\u003e 4 - n * 9\nANPlusB(-9n+4)\n```\n\n\n## Contributing\n\nPlease see _[Contributing][4]_ for more information.\n\n\n  [1]: https://pypi.org/project/a-n-plus-b\n  [2]: https://drafts.csswg.org/css-syntax-3/#anb-microsyntax\n  [3]: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#the_of_selector_syntax\n  [4]: ./CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsyncwithfoo%2Fa-n-plus-b","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsyncwithfoo%2Fa-n-plus-b","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsyncwithfoo%2Fa-n-plus-b/lists"}