pax_global_header00006660000000000000000000000064146743444130014524gustar00rootroot0000000000000052 comment=dd84b2545ceb5e66209f673c059290d89b49d71f cached-ipaddress-0.6.0/000077500000000000000000000000001467434441300147125ustar00rootroot00000000000000cached-ipaddress-0.6.0/.all-contributorsrc000066400000000000000000000004541467434441300205460ustar00rootroot00000000000000{ "projectName": "cached-ipaddress", "projectOwner": "bdraco", "repoType": "github", "repoHost": "https://github.com", "files": [ "README.md" ], "imageSize": 80, "commit": true, "commitConvention": "angular", "contributors": [], "contributorsPerLine": 7, "skipCi": true } cached-ipaddress-0.6.0/.copier-answers.yml000066400000000000000000000010371467434441300204550ustar00rootroot00000000000000# Changes here will be overwritten by Copier _commit: a2d5d1c _src_path: gh:browniebroke/pypackage-template add_me_as_contributor: false copyright_year: '2023' documentation: false email: nick@koston.org full_name: J. Nick Koston github_username: bdraco has_cli: false initial_commit: true open_source_license: MIT package_name: cached_ipaddress project_name: cached-ipaddress project_short_description: Cache construction of ipaddress objects project_slug: cached-ipaddress run_poetry_install: true setup_github: true setup_pre_commit: true cached-ipaddress-0.6.0/.editorconfig000066400000000000000000000004441467434441300173710ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true charset = utf-8 end_of_line = lf [*.bat] indent_style = tab end_of_line = crlf [LICENSE] insert_final_newline = false [Makefile] indent_style = tab cached-ipaddress-0.6.0/.github/000077500000000000000000000000001467434441300162525ustar00rootroot00000000000000cached-ipaddress-0.6.0/.github/FUNDING.yml000066400000000000000000000000231467434441300200620ustar00rootroot00000000000000github: ["bdraco"] cached-ipaddress-0.6.0/.github/ISSUE_TEMPLATE/000077500000000000000000000000001467434441300204355ustar00rootroot00000000000000cached-ipaddress-0.6.0/.github/ISSUE_TEMPLATE/1-bug_report.md000066400000000000000000000004221467434441300232630ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve labels: bug --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: **Additional context** Add any other context about the problem here. cached-ipaddress-0.6.0/.github/ISSUE_TEMPLATE/2-feature-request.md000066400000000000000000000006721467434441300242440ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea for this project labels: enhancement --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Additional context** Add any other context or screenshots about the feature request here. cached-ipaddress-0.6.0/.github/labels.toml000066400000000000000000000035151467434441300204150ustar00rootroot00000000000000[breaking] color = "ffcc00" name = "breaking" description = "Breaking change." [bug] color = "d73a4a" name = "bug" description = "Something isn't working" [dependencies] color = "0366d6" name = "dependencies" description = "Pull requests that update a dependency file" [github_actions] color = "000000" name = "github_actions" description = "Update of github actions" [documentation] color = "1bc4a5" name = "documentation" description = "Improvements or additions to documentation" [duplicate] color = "cfd3d7" name = "duplicate" description = "This issue or pull request already exists" [enhancement] color = "a2eeef" name = "enhancement" description = "New feature or request" ["good first issue"] color = "7057ff" name = "good first issue" description = "Good for newcomers" ["help wanted"] color = "008672" name = "help wanted" description = "Extra attention is needed" [invalid] color = "e4e669" name = "invalid" description = "This doesn't seem right" [nochangelog] color = "555555" name = "nochangelog" description = "Exclude pull requests from changelog" [question] color = "d876e3" name = "question" description = "Further information is requested" [removed] color = "e99695" name = "removed" description = "Removed piece of functionalities." [tests] color = "bfd4f2" name = "tests" description = "CI, CD and testing related changes" [wontfix] color = "ffffff" name = "wontfix" description = "This will not be worked on" [discussion] color = "c2e0c6" name = "discussion" description = "Some discussion around the project" [hacktoberfest] color = "ffa663" name = "hacktoberfest" description = "Good issues for Hacktoberfest" [answered] color = "0ee2b6" name = "answered" description = "Automatically closes as answered after a delay" [waiting] color = "5f7972" name = "waiting" description = "Automatically closes if no answer after a delay" cached-ipaddress-0.6.0/.github/workflows/000077500000000000000000000000001467434441300203075ustar00rootroot00000000000000cached-ipaddress-0.6.0/.github/workflows/ci.yml000066400000000000000000000062471467434441300214360ustar00rootroot00000000000000name: CI on: push: branches: - main pull_request: concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.x - uses: pre-commit/action@v3.0.0 # Make sure commit messages follow the conventional commits convention: # https://www.conventionalcommits.org commitlint: name: Lint Commit Messages runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: wagoid/commitlint-github-action@v5.4.4 test: strategy: fail-fast: false matrix: python-version: - "3.8" - "3.9" - "3.10" - "3.11" - "3.12" - "3.13" os: - ubuntu-latest extension: - "skip_cython" - "use_cython" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Install poetry run: pipx install poetry - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "poetry" allow-prereleases: true - name: Install Dependencies no cython if: ${{ matrix.extension == 'skip_cython' }} env: SKIP_CYTHON: 1 run: poetry install --only=main,dev - name: Install Dependencies with cython if: ${{ matrix.extension != 'skip_cython' }} env: REQUIRE_CYTHON: 1 run: poetry install --only=main,dev - name: Test with Pytest run: poetry run pytest --durations=20 -v --cov=src --cov-branch --cov-report xml --cov-report html --cov-report term-missing tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} release: needs: - test - lint - commitlint runs-on: ubuntu-latest environment: release concurrency: release permissions: id-token: write contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.head_ref || github.ref_name }} # Do a dry run of PSR - name: Test release uses: python-semantic-release/python-semantic-release@v8.5.1 if: github.ref_name != 'main' with: root_options: --noop # On main branch: actual PSR + upload to PyPI & GitHub - name: Release uses: python-semantic-release/python-semantic-release@v8.5.1 id: release if: github.ref_name == 'main' with: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 if: steps.release.outputs.released == 'true' - name: Publish package distributions to GitHub Releases uses: python-semantic-release/upload-to-gh-release@main if: steps.release.outputs.released == 'true' with: github_token: ${{ secrets.GITHUB_TOKEN }} cached-ipaddress-0.6.0/.github/workflows/hacktoberfest.yml000066400000000000000000000005341467434441300236600ustar00rootroot00000000000000name: Hacktoberfest on: schedule: # Run every day in October - cron: "0 0 * 10 *" # Run on the 1st of November to revert - cron: "0 13 1 11 *" jobs: hacktoberfest: runs-on: ubuntu-latest steps: - uses: browniebroke/hacktoberfest-labeler-action@v2.3.0 with: github_token: ${{ secrets.GH_PAT }} cached-ipaddress-0.6.0/.github/workflows/issue-manager.yml000066400000000000000000000013401467434441300235700ustar00rootroot00000000000000name: Issue Manager on: schedule: - cron: "0 0 * * *" issue_comment: types: - created issues: types: - labeled pull_request_target: types: - labeled workflow_dispatch: jobs: issue-manager: runs-on: ubuntu-latest steps: - uses: tiangolo/issue-manager@0.4.0 with: token: ${{ secrets.GITHUB_TOKEN }} config: > { "answered": { "message": "Assuming the original issue was solved, it will be automatically closed now." }, "waiting": { "message": "Automatically closing. To re-open, please provide the additional information requested." } } cached-ipaddress-0.6.0/.github/workflows/labels.yml000066400000000000000000000007661467434441300223050ustar00rootroot00000000000000name: Sync Github labels on: push: branches: - main paths: - ".github/**" jobs: labels: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.x - name: Install labels run: pip install labels - name: Sync config with Github run: labels -u ${{ github.repository_owner }} -t ${{ secrets.GH_PAT }} sync -f .github/labels.toml cached-ipaddress-0.6.0/.github/workflows/poetry-upgrade.yml000066400000000000000000000003411467434441300237770ustar00rootroot00000000000000name: Upgrader on: workflow_dispatch: schedule: - cron: "32 10 24 * *" jobs: upgrade: uses: browniebroke/github-actions/.github/workflows/poetry-upgrade.yml@v1 secrets: gh_pat: ${{ secrets.GH_PAT }} cached-ipaddress-0.6.0/.gitignore000066400000000000000000000041101467434441300166760ustar00rootroot00000000000000# Created by .ignore support plugin (hsz.mobi) ### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder {{package_name}} settings .spyderproject .spyproject # Rope {{package_name}} settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ cached-ipaddress-0.6.0/.gitpod.yml000066400000000000000000000003061467434441300170000ustar00rootroot00000000000000tasks: - command: | pip install poetry PIP_USER=false poetry install - command: | pip install pre-commit pre-commit install PIP_USER=false pre-commit install-hooks cached-ipaddress-0.6.0/.idea/000077500000000000000000000000001467434441300156725ustar00rootroot00000000000000cached-ipaddress-0.6.0/.idea/cached-ipaddress.iml000066400000000000000000000005151467434441300215610ustar00rootroot00000000000000 cached-ipaddress-0.6.0/.idea/watcherTasks.xml000066400000000000000000000052531467434441300210640ustar00rootroot00000000000000 cached-ipaddress-0.6.0/.idea/workspace.xml000066400000000000000000000027361467434441300204220ustar00rootroot00000000000000 cached-ipaddress-0.6.0/.pre-commit-config.yaml000066400000000000000000000030641467434441300211760ustar00rootroot00000000000000# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks exclude: "CHANGELOG.md|.copier-answers.yml|.all-contributorsrc" default_stages: [commit] ci: autofix_commit_msg: "chore(pre-commit.ci): auto fixes" autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate" repos: - repo: https://github.com/commitizen-tools/commitizen rev: v3.29.0 hooks: - id: commitizen stages: [commit-msg] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - id: debug-statements - id: check-builtin-literals - id: check-case-conflict - id: check-docstring-first - id: check-json - id: check-toml - id: check-xml - id: check-yaml - id: detect-private-key - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-poetry/poetry rev: 1.8.0 hooks: - id: poetry-check - repo: https://github.com/pre-commit/mirrors-prettier rev: v4.0.0-alpha.8 hooks: - id: prettier args: ["--tab-width", "2"] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.5 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black rev: 24.8.0 hooks: - id: black - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - id: codespell - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.11.2 hooks: - id: mypy additional_dependencies: [] cached-ipaddress-0.6.0/CHANGELOG.md000066400000000000000000000026131467434441300165250ustar00rootroot00000000000000# Changelog ## v0.6.0 (2024-09-23) ### Feature - Add cache for compressed (#22) ([`4afea62`](https://github.com/bdraco/cached-ipaddress/commit/4afea62ac571fb79859cbe174dccf250d704fc04)) ## v0.5.0 (2024-08-26) ### Feature - Add python version classifiers (#17) ([`c87a639`](https://github.com/bdraco/cached-ipaddress/commit/c87a639f7d5d7f14ab62a8c7f072bd48440acf27)) ## v0.4.0 (2024-08-26) ### Feature - Python 3.13 support (#16) ([`75a01d4`](https://github.com/bdraco/cached-ipaddress/commit/75a01d4c5b6e3ee336a3f0e101a5df71510ffb9c)) - Cache hash as well (#15) ([`282a8ad`](https://github.com/bdraco/cached-ipaddress/commit/282a8ad722d8ee09cc3961f85f989e90a93093ee)) ## v0.3.0 (2023-12-17) ### Feature - Add reverse_pointer to the cache (#4) ([`98f7ae3`](https://github.com/bdraco/cached-ipaddress/commit/98f7ae3d1e5b3c03f34392093257594915e55d2a)) ## v0.2.0 (2023-12-16) ### Feature - Add is_multicast to the list of cached properties (#3) ([`b5f4941`](https://github.com/bdraco/cached-ipaddress/commit/b5f4941b83dc983bab88bf04a0bcf8a5bc7c60af)) ## v0.1.0 (2023-12-16) ### Feature - First version (#2) ([`44bf9b7`](https://github.com/bdraco/cached-ipaddress/commit/44bf9b78f2740f5114bf89a664f5bb42c20c8502)) ## v0.0.1 (2023-12-16) ### Fix - Reserve name on pypi (#1) ([`c979f69`](https://github.com/bdraco/cached-ipaddress/commit/c979f69f82763d4231ea9662d320ef552f35c601)) ## v0.0.0 (2023-12-16) cached-ipaddress-0.6.0/CONTRIBUTING.md000066400000000000000000000074431467434441300171530ustar00rootroot00000000000000# Contributing Contributions are welcome, and they are greatly appreciated! Every little helps, and credit will always be given. You can contribute in many ways: ## Types of Contributions ### Report Bugs Report bugs to [our issue page][gh-issues]. If you are reporting a bug, please include: - Your operating system name and version. - Any details about your local setup that might be helpful in troubleshooting. - Detailed steps to reproduce the bug. ### Fix Bugs Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it. ### Implement Features Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. ### Write Documentation cached-ipaddress could always use more documentation, whether as part of the official cached-ipaddress docs, in docstrings, or even on the web in blog posts, articles, and such. ### Submit Feedback The best way to send feedback [our issue page][gh-issues] on GitHub. If you are proposing a feature: - Explain in detail how it would work. - Keep the scope as narrow as possible, to make it easier to implement. - Remember that this is a volunteer-driven project, and that contributions are welcome 😊 ## Get Started! Ready to contribute? Here's how to set yourself up for local development. 1. Fork the repo on GitHub. 2. Clone your fork locally: ```shell $ git clone git@github.com:your_name_here/cached-ipaddress.git ``` 3. Install the project dependencies with [Poetry](https://python-poetry.org): ```shell $ poetry install ``` 4. Create a branch for local development: ```shell $ git checkout -b name-of-your-bugfix-or-feature ``` Now you can make your changes locally. 5. When you're done making changes, check that your changes pass our tests: ```shell $ poetry run pytest ``` 6. Linting is done through [pre-commit](https://pre-commit.com). Provided you have the tool installed globally, you can run them all as one-off: ```shell $ pre-commit run -a ``` Or better, install the hooks once and have them run automatically each time you commit: ```shell $ pre-commit install ``` 7. Commit your changes and push your branch to GitHub: ```shell $ git add . $ git commit -m "feat(something): your detailed description of your changes" $ git push origin name-of-your-bugfix-or-feature ``` Note: the commit message should follow [the conventional commits](https://www.conventionalcommits.org). We run [`commitlint` on CI](https://github.com/marketplace/actions/commit-linter) to validate it, and if you've installed pre-commit hooks at the previous step, the message will be checked at commit time. 8. Submit a pull request through the GitHub website or using the GitHub CLI (if you have it installed): ```shell $ gh pr create --fill ``` ## Pull Request Guidelines We like to have the pull request open as soon as possible, that's a great place to discuss any piece of work, even unfinished. You can use draft pull request if it's still a work in progress. Here are a few guidelines to follow: 1. Include tests for feature or bug fixes. 2. Update the documentation for significant features. 3. Ensure tests are passing on CI. ## Tips To run a subset of tests: ```shell $ pytest tests ``` ## Making a new release The deployment should be automated and can be triggered from the Semantic Release workflow in GitHub. The next version will be based on [the commit logs](https://python-semantic-release.readthedocs.io/en/latest/commit-log-parsing.html#commit-log-parsing). This is done by [python-semantic-release](https://python-semantic-release.readthedocs.io/en/latest/index.html) via a GitHub action. [gh-issues]: https://github.com/bdraco/cached-ipaddress/issues cached-ipaddress-0.6.0/LICENSE000066400000000000000000000020601467434441300157150ustar00rootroot00000000000000 MIT License Copyright (c) 2023 J. Nick Koston Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cached-ipaddress-0.6.0/README.md000066400000000000000000000076151467434441300162020ustar00rootroot00000000000000# cached-ipaddress

CI Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License

--- **Source Code**: https://github.com/bdraco/cached-ipaddress --- Cache construction of ipaddress objects ## Design This module keeps a cache of IPAddress objects and caches the properties on them. It it useful when you frequently see the same ip addresses over and over and do not want to pay the overhead of constructing IPAddress objects over and over or checking their properties. ## Installation Install this via pip (or your favourite package manager): `pip install cached-ipaddress` ## Usage ```python from cached_ipaddress import cached_ip_addresses ip = cached_ip_addresses("127.0.0.1") assert ip.is_loopback is False invalid = cached_ip_addresses("invalid") assert invalid is None ``` ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! ## Credits This package was created with [Copier](https://copier.readthedocs.io/) and the [browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template) project template. cached-ipaddress-0.6.0/build_ext.py000066400000000000000000000023271467434441300172470ustar00rootroot00000000000000"""Build optional cython modules.""" import logging import os from distutils.command.build_ext import build_ext from typing import Any _LOGGER = logging.getLogger(__name__) class BuildExt(build_ext): """BuildExt.""" def build_extensions(self) -> None: """Build extensions.""" try: super().build_extensions() except Exception: _LOGGER.debug("Failed to build extensions", exc_info=True) pass def build(setup_kwargs: Any) -> None: """Build optional cython modules.""" if os.environ.get("SKIP_CYTHON", False): return try: from Cython.Build import cythonize setup_kwargs.update( { "ext_modules": cythonize( [ "src/cached_ipaddress/ipaddress.py", ], compiler_directives={"language_level": "3"}, # Python 3 ), "cmdclass": {"build_ext": BuildExt}, } ) setup_kwargs["exclude_package_data"] = { pkg: ["*.c"] for pkg in setup_kwargs["packages"] } except Exception: if os.environ.get("REQUIRE_CYTHON"): raise pass cached-ipaddress-0.6.0/commitlint.config.js000066400000000000000000000003641467434441300206760ustar00rootroot00000000000000module.exports = { extends: ["@commitlint/config-conventional"], rules: { "header-max-length": [0, "always", Infinity], "body-max-line-length": [0, "always", Infinity], "footer-max-line-length": [0, "always", Infinity], }, }; cached-ipaddress-0.6.0/poetry.lock000066400000000000000000000374151467434441300171200ustar00rootroot00000000000000# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] [[package]] name = "coverage" version = "7.6.1" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.8" files = [ {file = "coverage-7.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b06079abebbc0e89e6163b8e8f0e16270124c154dc6e4a47b413dd538859af16"}, {file = "coverage-7.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cf4b19715bccd7ee27b6b120e7e9dd56037b9c0681dcc1adc9ba9db3d417fa36"}, {file = "coverage-7.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61c0abb4c85b095a784ef23fdd4aede7a2628478e7baba7c5e3deba61070a02"}, {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc"}, {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f59d57baca39b32db42b83b2a7ba6f47ad9c394ec2076b084c3f029b7afca23"}, {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a1ac0ae2b8bd743b88ed0502544847c3053d7171a3cff9228af618a068ed9c34"}, {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e6a08c0be454c3b3beb105c0596ebdc2371fab6bb90c0c0297f4e58fd7e1012c"}, {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959"}, {file = "coverage-7.6.1-cp310-cp310-win32.whl", hash = "sha256:7bb65125fcbef8d989fa1dd0e8a060999497629ca5b0efbca209588a73356232"}, {file = "coverage-7.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:3115a95daa9bdba70aea750db7b96b37259a81a709223c8448fa97727d546fe0"}, {file = "coverage-7.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7dea0889685db8550f839fa202744652e87c60015029ce3f60e006f8c4462c93"}, {file = "coverage-7.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed37bd3c3b063412f7620464a9ac1314d33100329f39799255fb8d3027da50d3"}, {file = "coverage-7.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85f5e9a5f8b73e2350097c3756ef7e785f55bd71205defa0bfdaf96c31616ff"}, {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bc572be474cafb617672c43fe989d6e48d3c83af02ce8de73fff1c6bb3c198d"}, {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6"}, {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f4aa8219db826ce6be7099d559f8ec311549bfc4046f7f9fe9b5cea5c581c56"}, {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234"}, {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b48f312cca9621272ae49008c7f613337c53fadca647d6384cc129d2996d1133"}, {file = "coverage-7.6.1-cp311-cp311-win32.whl", hash = "sha256:1125ca0e5fd475cbbba3bb67ae20bd2c23a98fac4e32412883f9bcbaa81c314c"}, {file = "coverage-7.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:8ae539519c4c040c5ffd0632784e21b2f03fc1340752af711f33e5be83a9d6c6"}, {file = "coverage-7.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:95cae0efeb032af8458fc27d191f85d1717b1d4e49f7cb226cf526ff28179778"}, {file = "coverage-7.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5621a9175cf9d0b0c84c2ef2b12e9f5f5071357c4d2ea6ca1cf01814f45d2391"}, {file = "coverage-7.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:260933720fdcd75340e7dbe9060655aff3af1f0c5d20f46b57f262ab6c86a5e8"}, {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d"}, {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c44fee9975f04b33331cb8eb272827111efc8930cfd582e0320613263ca849ca"}, {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877abb17e6339d96bf08e7a622d05095e72b71f8afd8a9fefc82cf30ed944163"}, {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3e0cadcf6733c09154b461f1ca72d5416635e5e4ec4e536192180d34ec160f8a"}, {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c3c02d12f837d9683e5ab2f3d9844dc57655b92c74e286c262e0fc54213c216d"}, {file = "coverage-7.6.1-cp312-cp312-win32.whl", hash = "sha256:e05882b70b87a18d937ca6768ff33cc3f72847cbc4de4491c8e73880766718e5"}, {file = "coverage-7.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:b5d7b556859dd85f3a541db6a4e0167b86e7273e1cdc973e5b175166bb634fdb"}, {file = "coverage-7.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a4acd025ecc06185ba2b801f2de85546e0b8ac787cf9d3b06e7e2a69f925b106"}, {file = "coverage-7.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a6d3adcf24b624a7b778533480e32434a39ad8fa30c315208f6d3e5542aeb6e9"}, {file = "coverage-7.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0c212c49b6c10e6951362f7c6df3329f04c2b1c28499563d4035d964ab8e08c"}, {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e81d7a3e58882450ec4186ca59a3f20a5d4440f25b1cff6f0902ad890e6748a"}, {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b260de9790fd81e69401c2dc8b17da47c8038176a79092a89cb2b7d945d060"}, {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a78d169acd38300060b28d600344a803628c3fd585c912cacc9ea8790fe96862"}, {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2c09f4ce52cb99dd7505cd0fc8e0e37c77b87f46bc9c1eb03fe3bc9991085388"}, {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6878ef48d4227aace338d88c48738a4258213cd7b74fd9a3d4d7582bb1d8a155"}, {file = "coverage-7.6.1-cp313-cp313-win32.whl", hash = "sha256:44df346d5215a8c0e360307d46ffaabe0f5d3502c8a1cefd700b34baf31d411a"}, {file = "coverage-7.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:8284cf8c0dd272a247bc154eb6c95548722dce90d098c17a883ed36e67cdb129"}, {file = "coverage-7.6.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d3296782ca4eab572a1a4eca686d8bfb00226300dcefdf43faa25b5242ab8a3e"}, {file = "coverage-7.6.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:502753043567491d3ff6d08629270127e0c31d4184c4c8d98f92c26f65019962"}, {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a89ecca80709d4076b95f89f308544ec8f7b4727e8a547913a35f16717856cb"}, {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a318d68e92e80af8b00fa99609796fdbcdfef3629c77c6283566c6f02c6d6704"}, {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13b0a73a0896988f053e4fbb7de6d93388e6dd292b0d87ee51d106f2c11b465b"}, {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4421712dbfc5562150f7554f13dde997a2e932a6b5f352edcce948a815efee6f"}, {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:166811d20dfea725e2e4baa71fffd6c968a958577848d2131f39b60043400223"}, {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:225667980479a17db1048cb2bf8bfb39b8e5be8f164b8f6628b64f78a72cf9d3"}, {file = "coverage-7.6.1-cp313-cp313t-win32.whl", hash = "sha256:170d444ab405852903b7d04ea9ae9b98f98ab6d7e63e1115e82620807519797f"}, {file = "coverage-7.6.1-cp313-cp313t-win_amd64.whl", hash = "sha256:b9f222de8cded79c49bf184bdbc06630d4c58eec9459b939b4a690c82ed05657"}, {file = "coverage-7.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6db04803b6c7291985a761004e9060b2bca08da6d04f26a7f2294b8623a0c1a0"}, {file = "coverage-7.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f1adfc8ac319e1a348af294106bc6a8458a0f1633cc62a1446aebc30c5fa186a"}, {file = "coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a95324a9de9650a729239daea117df21f4b9868ce32e63f8b650ebe6cef5595b"}, {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b43c03669dc4618ec25270b06ecd3ee4fa94c7f9b3c14bae6571ca00ef98b0d3"}, {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8929543a7192c13d177b770008bc4e8119f2e1f881d563fc6b6305d2d0ebe9de"}, {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:a09ece4a69cf399510c8ab25e0950d9cf2b42f7b3cb0374f95d2e2ff594478a6"}, {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9054a0754de38d9dbd01a46621636689124d666bad1936d76c0341f7d71bf569"}, {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0dbde0f4aa9a16fa4d754356a8f2e36296ff4d83994b2c9d8398aa32f222f989"}, {file = "coverage-7.6.1-cp38-cp38-win32.whl", hash = "sha256:da511e6ad4f7323ee5702e6633085fb76c2f893aaf8ce4c51a0ba4fc07580ea7"}, {file = "coverage-7.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:3f1156e3e8f2872197af3840d8ad307a9dd18e615dc64d9ee41696f287c57ad8"}, {file = "coverage-7.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abd5fd0db5f4dc9289408aaf34908072f805ff7792632250dcb36dc591d24255"}, {file = "coverage-7.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:547f45fa1a93154bd82050a7f3cddbc1a7a4dd2a9bf5cb7d06f4ae29fe94eaf8"}, {file = "coverage-7.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645786266c8f18a931b65bfcefdbf6952dd0dea98feee39bd188607a9d307ed2"}, {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9e0b2df163b8ed01d515807af24f63de04bebcecbd6c3bfeff88385789fdf75a"}, {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:609b06f178fe8e9f89ef676532760ec0b4deea15e9969bf754b37f7c40326dbc"}, {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:702855feff378050ae4f741045e19a32d57d19f3e0676d589df0575008ea5004"}, {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2bdb062ea438f22d99cba0d7829c2ef0af1d768d1e4a4f528087224c90b132cb"}, {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9c56863d44bd1c4fe2abb8a4d6f5371d197f1ac0ebdee542f07f35895fc07f36"}, {file = "coverage-7.6.1-cp39-cp39-win32.whl", hash = "sha256:6e2cd258d7d927d09493c8df1ce9174ad01b381d4729a9d8d4e38670ca24774c"}, {file = "coverage-7.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:06a737c882bd26d0d6ee7269b20b12f14a8704807a01056c80bb881a4b2ce6ca"}, {file = "coverage-7.6.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:e9a6e0eb86070e8ccaedfbd9d38fec54864f3125ab95419970575b42af7541df"}, {file = "coverage-7.6.1.tar.gz", hash = "sha256:953510dfb7b12ab69d20135a0662397f077c59b1e6379a768e97c59d852ee51d"}, ] [package.dependencies] tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} [package.extras] toml = ["tomli"] [[package]] name = "exceptiongroup" version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] test = ["pytest (>=6)"] [[package]] name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.7" files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] [[package]] name = "packaging" version = "24.1" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, ] [[package]] name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] name = "pytest" version = "7.4.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" files = [ {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-cov" version = "3.0.0" description = "Pytest plugin for measuring coverage." optional = false python-versions = ">=3.6" files = [ {file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"}, {file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"}, ] [package.dependencies] coverage = {version = ">=5.2.1", extras = ["toml"]} pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] [[package]] name = "tomli" version = "2.0.1" description = "A lil' TOML parser" optional = false python-versions = ">=3.7" files = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] [metadata] lock-version = "2.0" python-versions = "^3.8" content-hash = "ce39f1419f42f4b94a5d1936239dda15495ae7ade16df3d0c053c978cae42fb3" cached-ipaddress-0.6.0/pyproject.toml000066400000000000000000000067121467434441300176340ustar00rootroot00000000000000[tool.poetry] name = "cached-ipaddress" version = "0.6.0" description = "Cache construction of ipaddress objects" authors = ["J. Nick Koston "] license = "MIT" readme = "README.md" repository = "https://github.com/bdraco/cached-ipaddress" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] packages = [ { include = "cached_ipaddress", from = "src" }, ] [tool.poetry.urls] "Bug Tracker" = "https://github.com/bdraco/cached-ipaddress/issues" "Changelog" = "https://github.com/bdraco/cached-ipaddress/blob/main/CHANGELOG.md" [tool.poetry.build] generate-setup-file = true script = "build_ext.py" [tool.poetry.dependencies] python = "^3.8" [tool.poetry.group.dev.dependencies] pytest = "^7.0" pytest-cov = "^3.0" [tool.semantic_release] version_toml = ["pyproject.toml:tool.poetry.version"] version_variables = [ "src/cached_ipaddress/__init__.py:__version__", ] build_command = "pip install poetry && poetry build" [tool.semantic_release.changelog] exclude_commit_patterns = [ "chore*", "ci*", ] [tool.semantic_release.changelog.environment] keep_trailing_newline = true [tool.semantic_release.branches.main] match = "main" [tool.semantic_release.branches.noop] match = "(?!main$)" prerelease = true [tool.pytest.ini_options] addopts = "-v -Wdefault --cov=cached_ipaddress --cov-report=term-missing:skip-covered" pythonpath = ["src"] [tool.coverage.run] branch = true [tool.coverage.report] exclude_lines = [ "pragma: no cover", "@overload", "if TYPE_CHECKING", "raise NotImplementedError", 'if __name__ == "__main__":', ] [tool.ruff] target-version = "py38" line-length = 88 ignore = [ "D203", # 1 blank line required before class docstring "D212", # Multi-line docstring summary should start at the first line "D100", # Missing docstring in public module "D104", # Missing docstring in public package "D107", # Missing docstring in `__init__` "D401", # First line of docstring should be in imperative mood ] select = [ "B", # flake8-bugbear "D", # flake8-docstrings "C4", # flake8-comprehensions "S", # flake8-bandit "F", # pyflake "E", # pycodestyle "W", # pycodestyle "UP", # pyupgrade "I", # isort "RUF", # ruff specific ] [tool.ruff.per-file-ignores] "tests/**/*" = [ "D100", "D101", "D102", "D103", "D104", "S101", ] "setup.py" = ["D100"] "conftest.py" = ["D100"] [tool.ruff.isort] known-first-party = ["cached_ipaddress", "tests"] [tool.mypy] check_untyped_defs = true disallow_any_generics = true disallow_incomplete_defs = true disallow_untyped_defs = true mypy_path = "src/" no_implicit_optional = true show_error_codes = true warn_unreachable = true warn_unused_ignores = true exclude = [ 'setup.py', ] [[tool.mypy.overrides]] module = "tests.*" allow_untyped_defs = true [build-system] # 1.5.2 required for https://github.com/python-poetry/poetry/issues/7505 requires = ['setuptools>=65.4.1', 'wheel', 'Cython>=3.0.5', "poetry-core>=1.5.2"] build-backend = "poetry.core.masonry.api" cached-ipaddress-0.6.0/renovate.json000066400000000000000000000001011467434441300174200ustar00rootroot00000000000000{ "extends": ["github>browniebroke/renovate-configs:python"] } cached-ipaddress-0.6.0/src/000077500000000000000000000000001467434441300155015ustar00rootroot00000000000000cached-ipaddress-0.6.0/src/cached_ipaddress/000077500000000000000000000000001467434441300207465ustar00rootroot00000000000000cached-ipaddress-0.6.0/src/cached_ipaddress/__init__.py000066400000000000000000000001451467434441300230570ustar00rootroot00000000000000__version__ = "0.6.0" from .ipaddress import cached_ip_addresses __all__ = ["cached_ip_addresses"] cached-ipaddress-0.6.0/src/cached_ipaddress/backports/000077500000000000000000000000001467434441300227365ustar00rootroot00000000000000cached-ipaddress-0.6.0/src/cached_ipaddress/backports/__init__.py000066400000000000000000000000001467434441300250350ustar00rootroot00000000000000cached-ipaddress-0.6.0/src/cached_ipaddress/backports/functools.py000066400000000000000000000050631467434441300253300ustar00rootroot00000000000000"""Functools backports from standard lib.""" from __future__ import annotations import sys import types from collections.abc import Callable from typing import Any, Generic, TypeVar, overload _T = TypeVar("_T") class cached_property(Generic[_T]): # pylint: disable=invalid-name """ Backport of Python 3.12's cached_property. Includes https://github.com/python/cpython/pull/101890/files """ def __init__(self, func: Callable[[Any], _T]) -> None: """Initialize.""" self.func: Callable[[Any], _T] = func self.attrname: str | None = None self.__doc__ = func.__doc__ def __set_name__(self, owner: type[Any], name: str) -> None: """Set name.""" if self.attrname is None: self.attrname = name elif name != self.attrname: raise TypeError( "Cannot assign the same cached_property to two different names " f"({self.attrname!r} and {name!r})." ) @overload def __get__(self, instance: None, owner: type[Any] | None = None) -> Any: ... @overload def __get__(self, instance: Any, owner: type[Any] | None = None) -> _T: ... def __get__(self, instance: Any | None, owner: type[Any] | None = None) -> _T | Any: """Get.""" if instance is None: return self if self.attrname is None: raise TypeError( "Cannot use cached_property instance without " "calling __set_name__ on it." ) try: cache = instance.__dict__ # not all objects have __dict__ (e.g. class defines slots) except AttributeError: msg = ( f"No '__dict__' attribute on {type(instance).__name__!r} " f"instance to cache {self.attrname!r} property." ) raise TypeError(msg) from None val = self.func(instance) try: cache[self.attrname] = val except TypeError: msg = ( f"The '__dict__' attribute on {type(instance).__name__!r} instance " f"does not support item assignment " f"for caching {self.attrname!r} property." ) raise TypeError(msg) from None return val if sys.version_info >= (3, 9): __class_getitem__ = classmethod(types.GenericAlias) # type: ignore else: def __class_getitem__( cls: type[cached_property], cls_item: Any, ) -> type[cached_property]: """Get item.""" return cls cached-ipaddress-0.6.0/src/cached_ipaddress/ipaddress.pxd000066400000000000000000000001631467434441300234410ustar00rootroot00000000000000import cython cdef object cached_ip_addresses_wrapper cdef object AddressValueError cdef object NetmaskValueError cached-ipaddress-0.6.0/src/cached_ipaddress/ipaddress.py000066400000000000000000000102221467434441300232730ustar00rootroot00000000000000"""Base implementation.""" import sys from functools import lru_cache from ipaddress import AddressValueError, IPv4Address, IPv6Address, NetmaskValueError from typing import Any, Optional, Union from .backports.functools import cached_property if sys.version_info < (3, 9): cache = lru_cache(maxsize=None) else: from functools import cache class CachedIPv4Address(IPv4Address): def __init__(self, address: Any) -> None: super().__init__(address) self.__hash__ = cache(lambda: IPv4Address.__hash__(self)) # type: ignore[method-assign] self.__int__ = cache(lambda: IPv4Address.__int__(self)) # type: ignore[method-assign] def __str__(self) -> str: """Return the string representation of the IPv4 address.""" return self._str @cached_property def _str(self) -> str: """Return the string representation of the IPv4 address.""" return super().__str__() @cached_property def is_link_local(self) -> bool: # type: ignore[override] """Return True if this is a link-local address.""" return super().is_link_local @cached_property def is_unspecified(self) -> bool: # type: ignore[override] """Return True if this is an unspecified address.""" return super().is_unspecified @cached_property def is_loopback(self) -> bool: # type: ignore[override] """Return True if this is a loopback address.""" return super().is_loopback @cached_property def is_multicast(self) -> bool: # type: ignore[override] """Return True if this is a multicast address.""" return super().is_multicast @cached_property def reverse_pointer(self) -> str: # type: ignore[override] """Return the reverse DNS pointer name for the IPv4 address.""" return super().reverse_pointer @cached_property def compressed(self) -> str: # type: ignore[override] """Return the compressed value IPv4 address.""" return super().compressed class CachedIPv6Address(IPv6Address): def __init__(self, address: Any) -> None: super().__init__(address) self.__hash__ = cache(lambda: IPv6Address.__hash__(self)) # type: ignore[method-assign] self.__int__ = cache(lambda: IPv6Address.__int__(self)) # type: ignore[method-assign] def __str__(self) -> str: """Return the string representation of the IPv6 address.""" return self._str @cached_property def _str(self) -> str: """Return the string representation of the IPv6 address.""" return super().__str__() @cached_property def is_link_local(self) -> bool: # type: ignore[override] """Return True if this is a link-local address.""" return super().is_link_local @cached_property def is_unspecified(self) -> bool: # type: ignore[override] """Return True if this is an unspecified address.""" return super().is_unspecified @cached_property def is_loopback(self) -> bool: # type: ignore[override] """Return True if this is a loopback address.""" return super().is_loopback @cached_property def is_multicast(self) -> bool: # type: ignore[override] """Return True if this is a multicast address.""" return super().is_multicast @cached_property def reverse_pointer(self) -> str: # type: ignore[override] """Return the reverse DNS pointer name for the IPv6 address.""" return super().reverse_pointer @cached_property def compressed(self) -> str: # type: ignore[override] """Return the compressed value IPv6 address.""" return super().compressed @lru_cache(maxsize=535) def _cached_ip_addresses( address: Union[str, bytes, int] ) -> Optional[Union[IPv4Address, IPv6Address]]: """Cache IP addresses.""" try: return CachedIPv4Address(address) except (AddressValueError, NetmaskValueError): pass try: return CachedIPv6Address(address) except (AddressValueError, NetmaskValueError): return None cached_ip_addresses_wrapper = _cached_ip_addresses cached_ip_addresses = cached_ip_addresses_wrapper __all__ = ("cached_ip_addresses",) cached-ipaddress-0.6.0/src/cached_ipaddress/py.typed000066400000000000000000000000001467434441300224330ustar00rootroot00000000000000cached-ipaddress-0.6.0/templates/000077500000000000000000000000001467434441300167105ustar00rootroot00000000000000cached-ipaddress-0.6.0/templates/CHANGELOG.md.j2000066400000000000000000000011221467434441300210270ustar00rootroot00000000000000# Changelog {%- for version, release in context.history.released.items() %} ## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }}) {%- for category, commits in release["elements"].items() %} {# Category title: Breaking, Fix, Documentation #} ### {{ category | capitalize }} {# List actual changes in the category #} {%- for commit in commits %} - {{ commit.descriptions[0] | capitalize }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }})) {%- endfor %}{# for commit #} {%- endfor %}{# for category, commits #} {%- endfor %}{# for version, release #} cached-ipaddress-0.6.0/tests/000077500000000000000000000000001467434441300160545ustar00rootroot00000000000000cached-ipaddress-0.6.0/tests/__init__.py000066400000000000000000000000001467434441300201530ustar00rootroot00000000000000cached-ipaddress-0.6.0/tests/test_ipaddress.py000066400000000000000000000041551467434441300214500ustar00rootroot00000000000000"""Unit tests for cached_ipaddress.ipaddress.""" from ipaddress import IPv4Address, IPv6Address from cached_ipaddress import ipaddress def test_cached_ip_addresses_wrapper(): """Test the cached_ip_addresses_wrapper.""" assert ipaddress.cached_ip_addresses("") is None assert ipaddress.cached_ip_addresses("foo") is None assert ( str( ipaddress.cached_ip_addresses( b"&\x06(\x00\x02 \x00\x01\x02H\x18\x93%\xc8\x19F" ) ) == "2606:2800:220:1:248:1893:25c8:1946" ) assert ipaddress.cached_ip_addresses("::1") == ipaddress.IPv6Address("::1") ipv4 = ipaddress.cached_ip_addresses("169.254.0.0") assert ipv4 is not None assert ipv4.is_link_local is True assert ipv4.is_unspecified is False assert ipv4.is_loopback is False assert str(ipv4) == "169.254.0.0" assert str(ipv4) == "169.254.0.0" assert ipv4.reverse_pointer == "0.0.254.169.in-addr.arpa" ipv4 = ipaddress.cached_ip_addresses("0.0.0.0") # noqa: S104 assert ipv4 is not None assert ipv4.is_link_local is False assert ipv4.is_unspecified is True assert ipv4.is_loopback is False assert ipv4.is_multicast is False assert ipv4.compressed == IPv4Address(str(ipv4)).compressed ipv6 = ipaddress.cached_ip_addresses("fe80::1") assert ipv6 is not None assert ipv6.is_link_local is True assert ipv6.is_unspecified is False assert ipv6.is_loopback is False assert ipv6.is_multicast is False assert ( ipv6.reverse_pointer == "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa" ) ipv6 = ipaddress.cached_ip_addresses("0:0:0:0:0:0:0:0") assert ipv6 is not None assert ipv6.is_link_local is False assert ipv6.is_unspecified is True assert ipv6.is_loopback is False assert str(ipv6) == "::" assert hash(ipv4) == hash(IPv4Address(str(ipv4))) assert hash(ipv6) == hash(IPv6Address(str(ipv6))) assert int(ipv4) == int(IPv4Address(str(ipv4))) assert int(ipv6) == int(IPv6Address(str(ipv6))) assert ipv6.compressed == IPv6Address(str(ipv6)).compressed