From e77d5712a10e31036f8a5275832c4283accc466b Mon Sep 17 00:00:00 2001 From: Jovial Joe Jayarson Date: Tue, 19 Mar 2024 18:58:59 +0530 Subject: [PATCH] maint: rectifies changelog; misc. fixes --- .github/workflows/docs.yaml.bkp | 4 +- .github/workflows/pycqa.yaml | 2 +- .gitignore | 3 +- CHANGES.md | 194 ++++++++++++++++++++------------ README.md | 4 +- docs/index.md | 4 +- pyproject.toml | 6 +- src/validators/_extremes.py | 4 - src/validators/btc_address.py | 2 - src/validators/card.py | 16 --- src/validators/domain.py | 6 - src/validators/email.py | 2 - src/validators/hashes.py | 10 -- src/validators/hostname.py | 2 - src/validators/i18n/es.py | 8 -- src/validators/i18n/fi.py | 8 -- src/validators/i18n/fr.py | 4 - src/validators/iban.py | 2 - src/validators/ip_address.py | 12 -- src/validators/mac_address.py | 2 - src/validators/slug.py | 2 - src/validators/url.py | 17 +-- src/validators/utils.py | 2 - src/validators/uuid.py | 2 - 24 files changed, 136 insertions(+), 182 deletions(-) diff --git a/.github/workflows/docs.yaml.bkp b/.github/workflows/docs.yaml.bkp index ac5211ea..3e3d49fc 100644 --- a/.github/workflows/docs.yaml.bkp +++ b/.github/workflows/docs.yaml.bkp @@ -17,10 +17,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 # set up specific python version - - name: Set up Python v3.11 + - name: Set up Python v3.12 uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" # building - name: Install 'documentation' dependencies run: | diff --git a/.github/workflows/pycqa.yaml b/.github/workflows/pycqa.yaml index 606c5fe0..028966b1 100644 --- a/.github/workflows/pycqa.yaml +++ b/.github/workflows/pycqa.yaml @@ -35,7 +35,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: # checkout repository again! diff --git a/.gitignore b/.gitignore index 5823915d..0438693c 100644 --- a/.gitignore +++ b/.gitignore @@ -173,8 +173,9 @@ cython_debug/ # asdf .tool-versions -# rtx +# rtx/mise .rtx.toml +.mise.toml # ruff .ruff_cache diff --git a/CHANGES.md b/CHANGES.md index 4991c8d6..237e6bc1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,9 +9,26 @@ Note to self: Breaking changes must increment either --> +## 0.23.1 (2024-03-19) + +_**Breaking**_ ⚠️ + +> No breaking changes were introduced in this version. + +_**Features**_ + +> No features were introduced in this version. + +_**Maintenance**_ + +- maint: fix `between` & `length` validators by @yozachar in [#334](https://github.com/python-validators/validators/pull/334) +- fix: manual nav reference for mkdocs; bumps version by @yozachar in [#335](https://github.com/python-validators/validators/pull/335) + +**Full Changelog**: [`0.23.0...0.23.1`](https://github.com/python-validators/validators/compare/0.23.0...0.23.1) + ## 0.23.0 (2024-03-19) -_**Breaking**_ +_**Breaking**_ ⚠️ > No breaking changes were introduced in this version. @@ -37,109 +54,142 @@ _**Maintenance**_ - build(deps): bump jinja2 from 3.1.2 to 3.1.3 in /package by @dependabot in [#332](https://github.com/python-validators/validators/pull/332) - build(deps): bump urllib3 from 2.0.6 to 2.0.7 in /package by @dependabot in [#319](https://github.com/python-validators/validators/pull/319) -_**New Contributors**_ - -- @danherbriley made their first contribution in [#297](https://github.com/python-validators/validators/pull/297) -- @darkdragon-001 made their first contribution in [#305](https://github.com/python-validators/validators/pull/305) -- @conitrade-as made their first contribution in [#317](https://github.com/python-validators/validators/pull/317) -- @imperosol made their first contribution in [#308](https://github.com/python-validators/validators/pull/308) - -**Full Changelog**: [0.22.0...0.23.0](https://github.com/python-validators/validators/compare/0.22.0...0.23.0) +**Full Changelog**: [`0.22.0...0.23.0`](https://github.com/python-validators/validators/compare/0.22.0...0.23.0) --- ## 0.22.0 (2023-09-02) -_**What's Changed**_ +_**Breaking**_ ⚠️ -> - _Breaking_: -> - API changes in `validators.ipv4` and `validators.ipv6` functions -> - `strict` parameter now correctly validates IP addresses strictly in CIDR notation -> - `host_bit` parameter distinguishes between network and host IP address +- A new keyword parameter `host_bit = True`, is added to `validators.ipv4` and `validators.ipv6`. -- fix: url validator considers urls with /#/ as valid by @adrienthiery in [#289](https://github.com/python-validators/validators/pull/289) -- Add note about ValidationFailure to ValidationError in changes.md by @tswfi in [#291](https://github.com/python-validators/validators/pull/291) -- fix: simple hostname validation regex by @joe733 in [#294](https://github.com/python-validators/validators/pull/294) -- fix: strict CIDR IP validation; bump version by @joe733 in [#295](https://github.com/python-validators/validators/pull/295) +_**Features**_ -_**New Contributors**_ +> No features were introduced in this version. -- @adrienthiery made their first contribution in [#289](https://github.com/python-validators/validators/pull/289) -- @tswfi made their first contribution in [#291](https://github.com/python-validators/validators/pull/291) +_**Maintenance**_ + +- fix: url validator considers urls with /#/ as valid by @adrienthiery in [#289](https://github.com/python-validators/validators/pull/289) +- Add note about ValidationFailure to ValidationError in changes.md by @tswfi in [#291](https://github.com/python-validators/validators/pull/291) +- fix: simple hostname validation regex by @yozachar in [#294](https://github.com/python-validators/validators/pull/294) +- fix: strict CIDR IP validation; bump version by @yozachar in [#295](https://github.com/python-validators/validators/pull/295) **Full Changelog**: [`0.21.2...0.22.0`](https://github.com/python-validators/validators/compare/0.21.2...0.22.0) +--- + ## 0.21.2 (2023-08-07) -_**What's Changed**_ +_**Breaking**_ ⚠️ -> - _Breaking_: -> - `ValidationFailure` renamed to `ValidationError` in [`joe733@12ae1f5`](https://github.com/joe733/pyvalidators/commit/12ae1f5850555d11e1f1a2c03f597fd10610215a) +- `ValidationFailure` is renamed to `ValidationError` in [`yozachar@12ae1f5`](https://github.com/yozachar/pyvalidators/commit/12ae1f5850555d11e1f1a2c03f597fd10610215a) + +_**Features**_ -- feat: refactoring; updates; fixes; bump version by @joe733 in [#283](https://github.com/python-validators/validators/pull/283)() -- build(deps): bump pymdown-extensions from 9.11 to 10.0 by @dependabot in [#273](https://github.com/python-validators/validators/pull/273) -- build(deps): bump requests from 2.28.2 to 2.31.0 by @dependabot in [#275](https://github.com/python-validators/validators/pull/275) -- add validator ETH addresses (ERC20) by @msamsami in [#276](https://github.com/python-validators/validators/pull/276) - Added Country Code Validation by @aviiciii in [#280](https://github.com/python-validators/validators/pull/280) -- build(deps-dev): bump certifi from 2022.12.7 to 2023.7.22 by @dependabot in [#281](https://github.com/python-validators/validators/pull/281) +- add validator ETH addresses (ERC20) by @msamsami in [#276](https://github.com/python-validators/validators/pull/276) -_**New Contributors**_ +_**Maintenance**_ -- @dependabot made their first contribution in [#273](https://github.com/python-validators/validators/pull/273) -- @msamsami made their first contribution in [#276](https://github.com/python-validators/validators/pull/276) -- @aviiciii made their first contribution in [#280](https://github.com/python-validators/validators/pull/280) +- feat: refactoring; updates; fixes; bump version by @yozachar in [#283](https://github.com/python-validators/validators/pull/283)(ref: ) +- build(deps): bump pymdown-extensions from 9.11 to 10.0 by @dependabot in [#273](https://github.com/python-validators/validators/pull/273) +- build(deps): bump requests from 2.28.2 to 2.31.0 by @dependabot in [#275](https://github.com/python-validators/validators/pull/275) +- build(deps-dev): bump certifi from 2022.12.7 to 2023.7.22 by @dependabot in [#281](https://github.com/python-validators/validators/pull/281) **Full Changelog**: [`0.21.1...0.21.2`](https://github.com/python-validators/validators/compare/0.21.1...0.21.2) ## 0.21.1 (2023-04-10) -- fix: `source .venv/bin/activate` before build by @joe733 in [#260](https://github.com/python-validators/validators/pull/260) -- fix: id-token write permission at job level by @joe733 in [#261](https://github.com/python-validators/validators/pull/261) -- feat: docs can be built with both sphinx & mkdocs by @joe733 in [#262](https://github.com/python-validators/validators/pull/262) -- fix: improves build process by @joe733 in [#263](https://github.com/python-validators/validators/pull/263) -- fix: removes 64-char limit for url path & query by @joe733 in [#264](https://github.com/python-validators/validators/pull/264) +_**Breaking**_ ⚠️ + +> No breaking changes were introduced in this version. + +_**Features**_ + +> No features were introduced in this version. + +_**Maintenance**_ + +- fix: `source .venv/bin/activate` before build by @yozachar in [#260](https://github.com/python-validators/validators/pull/260) +- fix: id-token write permission at job level by @yozachar in [#261](https://github.com/python-validators/validators/pull/261) +- feat: docs can be built with both sphinx & mkdocs by @yozachar in [#262](https://github.com/python-validators/validators/pull/262) +- fix: improves build process by @yozachar in [#263](https://github.com/python-validators/validators/pull/263) +- fix: removes 64-char limit for url path & query by @yozachar in [#264](https://github.com/python-validators/validators/pull/264) **Full Changelog**: [`0.21.0...0.21.1`](https://github.com/python-validators/validators/compare/0.21.0...0.21.1) ## 0.21.0 (2023-03-25) -> - _Breaking_: -> - Couple of API changes, refer [documentation](https://python-validators.github.io/validators/) - -- feat: add build for pypi workflow by @joe733 in [#255](https://github.com/python-validators/validators/pull/255) -- feat: @validator now catches `Exception` by @joe733 in [#254](https://github.com/python-validators/validators/pull/254) -- maint: improves `i18n` package by @joe733 in [#252](https://github.com/python-validators/validators/pull/252) -- maint: misc changes to dev and ci by @joe733 in [#251](https://github.com/python-validators/validators/pull/251) -- maint: misc fixes and improvements by @joe733 in [#249](https://github.com/python-validators/validators/pull/249) -- maint: improves state of package development by @joe733 in [#248](https://github.com/python-validators/validators/pull/248) -- fix: generate dynamic reference docs by @joe733 in [#247](https://github.com/python-validators/validators/pull/247) -- maint: moving docs from `.rst` to `.md` by @joe733 in [#246](https://github.com/python-validators/validators/pull/246) -- maint: improves `url` module by @joe733 in [#245](https://github.com/python-validators/validators/pull/245) -- maint: improve `domain`, `email` & `hostname` by @joe733 in [#244](https://github.com/python-validators/validators/pull/244) -- maint: simplified `hostname` module by @joe733 in [#242](https://github.com/python-validators/validators/pull/242) -- maint: update `email` module by @joe733 in [#241](https://github.com/python-validators/validators/pull/241) -- feat: adds `hostname` validator by @joe733 in [#240](https://github.com/python-validators/validators/pull/240) -- maint: improves `ip_address` module by @joe733 in [#239](https://github.com/python-validators/validators/pull/239) -- fix: misc fixes, use bandit by @joe733 in [#238](https://github.com/python-validators/validators/pull/238) -- Create SECURITY.md by @joe733 in [#237](https://github.com/python-validators/validators/pull/237) -- maint: improves `mac_address`, `slug` and `uuid` by @joe733 in [#236](https://github.com/python-validators/validators/pull/236) -- maint: improve `hashes` and `iban` modules by @joe733 in [#235](https://github.com/python-validators/validators/pull/235) -- feat: auto docs using mkdocstrings by @joe733 in [#234](https://github.com/python-validators/validators/pull/234) -- maint: improves `email` module by @joe733 in [#233](https://github.com/python-validators/validators/pull/233) -- maint: minor improvements by @joe733 in [#232](https://github.com/python-validators/validators/pull/232) -- maint: improves `domain` module by @joe733 in [#231](https://github.com/python-validators/validators/pull/231) -- maint: reformats `card` module, fix typo by @joe733 in [#230](https://github.com/python-validators/validators/pull/230) -- feat: formats google pydoc style for mkdocstring by @joe733 in [#229](https://github.com/python-validators/validators/pull/229) -- maint: refresh `btc_address` module by @joe733 in [#228](https://github.com/python-validators/validators/pull/228) -- maint: improve type annotations by @joe733 in [#227](https://github.com/python-validators/validators/pull/227) -- maint: improves `between` and `length` modules by @joe733 in [#225](https://github.com/python-validators/validators/pull/225) -- maint: follows google's python style guide for docstrings by @joe733 in [#224](https://github.com/python-validators/validators/pull/224) -- feat: type hints in utils.py, gh-actions by @joe733 in [#223](https://github.com/python-validators/validators/pull/223) -- feat: add pyproject.toml, README.md, upd gitignore by @joe733 in [#221](https://github.com/python-validators/validators/pull/221) +_**Breaking**_ ⚠️ + +- Drops support for all Python versions below `v3.8`. +- Makes API's primary parameter, `positional`, and the remaining, `keyword-only`. +- Keyword-only parameters like `max` and `min`, has been renamed to `max_val` and `min_val` respectively. +- `domain` API now accepts two new keyword-only arguments: `rfc_1034: bool = False` and `rfc_2782: bool = False`. +- `extremes.py` renamed to `_extremes.py` and is no longer exposed. +- `truthy` was discarded in favour of simple `bool()` function. +- `ipv4_cidr()` and `ipv6_cidr()` has been dropped in favour of `cidr: bool = True` and `cidr: bool = True` keyword-only parameters. +- `email` API now accepts the following keyword-only arguments: + - `simple_host: bool = False`, + - `ipv6_address: bool = False`, + - `ipv4_address: bool = False`, + - `rfc_1034: bool = False` and + - `rfc_2782: bool = False`. +- `url` has been refactored, it accepts the following keyword-only arguments: + - `skip_ipv6_addr: bool = False`, + - `skip_ipv4_addr: bool = False`, + - `may_have_port: bool = True`, + - `simple_host: bool = False`, + - `rfc_1034: bool = False` and + - `rfc_2782: bool = False`. +- Exposes `i18n` functions directly via `__init__.py`. +- `@validator` decorator catches `Exception`. + + + +_**Features**_ + +- Adds `hostname` validator. + +_**Maintenance**_ + +- feat: add build for pypi workflow by @yozachar in [#255](https://github.com/python-validators/validators/pull/255) +- feat: @validator now catches `Exception` by @yozachar in [#254](https://github.com/python-validators/validators/pull/254) +- maint: improves `i18n` package by @yozachar in [#252](https://github.com/python-validators/validators/pull/252) +- maint: misc changes to dev and ci by @yozachar in [#251](https://github.com/python-validators/validators/pull/251) +- maint: misc fixes and improvements by @yozachar in [#249](https://github.com/python-validators/validators/pull/249) +- maint: improves state of package development by @yozachar in [#248](https://github.com/python-validators/validators/pull/248) +- fix: generate dynamic reference docs by @yozachar in [#247](https://github.com/python-validators/validators/pull/247) +- maint: moving docs from `.rst` to `.md` by @yozachar in [#246](https://github.com/python-validators/validators/pull/246) +- maint: improves `url` module by @yozachar in [#245](https://github.com/python-validators/validators/pull/245) +- maint: improve `domain`, `email` & `hostname` by @yozachar in [#244](https://github.com/python-validators/validators/pull/244) +- maint: simplified `hostname` module by @yozachar in [#242](https://github.com/python-validators/validators/pull/242) +- maint: update `email` module by @yozachar in [#241](https://github.com/python-validators/validators/pull/241) +- feat: adds `hostname` validator by @yozachar in [#240](https://github.com/python-validators/validators/pull/240) +- maint: improves `ip_address` module by @yozachar in [#239](https://github.com/python-validators/validators/pull/239) +- fix: misc fixes, use bandit by @yozachar in [#238](https://github.com/python-validators/validators/pull/238) +- Create SECURITY.md by @yozachar in [#237](https://github.com/python-validators/validators/pull/237) +- maint: improves `mac_address`, `slug` and `uuid` by @yozachar in [#236](https://github.com/python-validators/validators/pull/236) +- maint: improve `hashes` and `iban` modules by @yozachar in [#235](https://github.com/python-validators/validators/pull/235) +- feat: auto docs using mkdocstrings by @yozachar in [#234](https://github.com/python-validators/validators/pull/234) +- maint: improves `email` module by @yozachar in [#233](https://github.com/python-validators/validators/pull/233) +- maint: minor improvements by @yozachar in [#232](https://github.com/python-validators/validators/pull/232) +- maint: improves `domain` module by @yozachar in [#231](https://github.com/python-validators/validators/pull/231) +- maint: reformats `card` module, fix typo by @yozachar in [#230](https://github.com/python-validators/validators/pull/230) +- feat: formats google pydoc style for mkdocstring by @yozachar in [#229](https://github.com/python-validators/validators/pull/229) +- maint: refresh `btc_address` module by @yozachar in [#228](https://github.com/python-validators/validators/pull/228) +- maint: improve type annotations by @yozachar in [#227](https://github.com/python-validators/validators/pull/227) +- maint: improves `between` and `length` modules by @yozachar in [#225](https://github.com/python-validators/validators/pull/225) +- maint: follows google's python style guide for docstrings by @yozachar in [#224](https://github.com/python-validators/validators/pull/224) +- feat: type hints in utils.py, gh-actions by @yozachar in [#223](https://github.com/python-validators/validators/pull/223) +- feat: add pyproject.toml, README.md, upd gitignore by @yozachar in [#221](https://github.com/python-validators/validators/pull/221) - remove Travis CI settings by @ktdreyer in [#196](https://github.com/python-validators/validators/pull/196) **Full Changelog**: [`0.20.0...0.21.0`](https://github.com/python-validators/validators/compare/0.20.0...0.21.0) +--- + ## 0.20.0 (2022-06-05) - Added ipv4 digit lenghts validation (#191, pull request courtesy of Norbiox) @@ -270,7 +320,7 @@ _**New Contributors**_ ## 0.10.0 (2016-01-09) -- Added support for internationalized domain names in `domain` validator +- Added support for internationalized domain names (IDN) in `domain` validator ## 0.9.0 (2015-10-10) diff --git a/README.md b/README.md index 04dad454..dc550efb 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ True [sast-link]: https://github.com/python-validators/validators/actions/workflows/sast.yaml [pycqa-badge]: https://github.com/python-validators/validators/actions/workflows/pycqa.yaml/badge.svg [pycqa-link]: https://github.com/python-validators/validators/actions/workflows/pycqa.yaml -[docs-badge]: https://github.com/python-validators/validators/actions/workflows/docs.yaml/badge.svg -[docs-link]: https://github.com/python-validators/validators/actions/workflows/docs.yaml +[docs-badge]: https://github.com/yozachar/pyvalidators/actions/workflows/pages/pages-build-deployment/badge.svg +[docs-link]: https://github.com/yozachar/pyvalidators/actions/workflows/pages/pages-build-deployment [vs-badge]: https://img.shields.io/pypi/v/validators?logo=pypi&logoColor=white&label=version&color=blue [vs-link]: https://pypi.python.org/pypi/validators/ [dw-badge]: https://img.shields.io/pypi/dm/validators?logo=pypi&logoColor=white&color=blue diff --git a/docs/index.md b/docs/index.md index 04dad454..dc550efb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,8 +33,8 @@ True [sast-link]: https://github.com/python-validators/validators/actions/workflows/sast.yaml [pycqa-badge]: https://github.com/python-validators/validators/actions/workflows/pycqa.yaml/badge.svg [pycqa-link]: https://github.com/python-validators/validators/actions/workflows/pycqa.yaml -[docs-badge]: https://github.com/python-validators/validators/actions/workflows/docs.yaml/badge.svg -[docs-link]: https://github.com/python-validators/validators/actions/workflows/docs.yaml +[docs-badge]: https://github.com/yozachar/pyvalidators/actions/workflows/pages/pages-build-deployment/badge.svg +[docs-link]: https://github.com/yozachar/pyvalidators/actions/workflows/pages/pages-build-deployment [vs-badge]: https://img.shields.io/pypi/v/validators?logo=pypi&logoColor=white&label=version&color=blue [vs-link]: https://pypi.python.org/pypi/validators/ [dw-badge]: https://img.shields.io/pypi/dm/validators?logo=pypi&logoColor=white&color=blue diff --git a/pyproject.toml b/pyproject.toml index 82a6ac52..f7da2a58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,7 +120,7 @@ typeCheckingMode = "strict" pythonpath = ["src"] [tool.ruff] -select = [ +lint.select = [ # Pyflakes "F", # pycodestyle @@ -139,7 +139,7 @@ line-length = 100 target-version = "py38" extend-exclude = ["**/__pycache__", ".pytest_cache", "site"] -[tool.ruff.isort] +[tool.ruff.lint.isort] # case-sensitive = true combine-as-imports = true force-sort-within-sections = true @@ -147,7 +147,7 @@ force-wrap-aliases = true known-local-folder = ["src"] relative-imports-order = "closest-to-furthest" -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" [tool.tox] diff --git a/src/validators/_extremes.py b/src/validators/_extremes.py index 717189e9..a7ff806d 100644 --- a/src/validators/_extremes.py +++ b/src/validators/_extremes.py @@ -19,8 +19,6 @@ class AbsMax: # Output: True >>> AbsMax > 99999999999999999 # Output: True - - > *New in version 0.2.0*. """ def __ge__(self, other: Any): @@ -42,8 +40,6 @@ class AbsMin: # Output: True >>> AbsMin < '' # Output: True - - > *New in version 0.2.0*. """ def __le__(self, other: Any): diff --git a/src/validators/btc_address.py b/src/validators/btc_address.py index 204ab194..73b5d95c 100644 --- a/src/validators/btc_address.py +++ b/src/validators/btc_address.py @@ -46,8 +46,6 @@ def btc_address(value: str, /): If `value` is a valid bitcoin address. (ValidationError): If `value` is an invalid bitcoin address. - - > *New in version 0.18.0*. """ if not value: return False diff --git a/src/validators/card.py b/src/validators/card.py index d8aa0f1b..dbfc85d1 100644 --- a/src/validators/card.py +++ b/src/validators/card.py @@ -30,8 +30,6 @@ def card_number(value: str, /): If `value` is a valid generic card number. (ValidationError): If `value` is an invalid generic card number. - - > *New in version 0.15.0*. """ if not value: return False @@ -63,8 +61,6 @@ def visa(value: str, /): If `value` is a valid Visa card number. (ValidationError): If `value` is an invalid Visa card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^4") return card_number(value) and len(value) == 16 and pattern.match(value) @@ -89,8 +85,6 @@ def mastercard(value: str, /): If `value` is a valid Mastercard card number. (ValidationError): If `value` is an invalid Mastercard card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^(51|52|53|54|55|22|23|24|25|26|27)") return card_number(value) and len(value) == 16 and pattern.match(value) @@ -115,8 +109,6 @@ def amex(value: str, /): If `value` is a valid American Express card number. (ValidationError): If `value` is an invalid American Express card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^(34|37)") return card_number(value) and len(value) == 15 and pattern.match(value) @@ -141,8 +133,6 @@ def unionpay(value: str, /): If `value` is a valid UnionPay card number. (ValidationError): If `value` is an invalid UnionPay card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^62") return card_number(value) and len(value) == 16 and pattern.match(value) @@ -167,8 +157,6 @@ def diners(value: str, /): If `value` is a valid Diners Club card number. (ValidationError): If `value` is an invalid Diners Club card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^(30|36|38|39)") return card_number(value) and len(value) in {14, 16} and pattern.match(value) @@ -193,8 +181,6 @@ def jcb(value: str, /): If `value` is a valid JCB card number. (ValidationError): If `value` is an invalid JCB card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^35") return card_number(value) and len(value) == 16 and pattern.match(value) @@ -219,8 +205,6 @@ def discover(value: str, /): If `value` is a valid Discover card number. (ValidationError): If `value` is an invalid Discover card number. - - > *New in version 0.15.0*. """ pattern = re.compile(r"^(60|64|65)") return card_number(value) and len(value) == 16 and pattern.match(value) diff --git a/src/validators/domain.py b/src/validators/domain.py index bdc5b769..c17f7677 100644 --- a/src/validators/domain.py +++ b/src/validators/domain.py @@ -36,12 +36,6 @@ def domain(value: str, /, *, rfc_1034: bool = False, rfc_2782: bool = False): If `value` is a valid domain name. (ValidationError): If `value` is an invalid domain name. - - Note: - - *In version 0.10.0*: - - Added support for internationalized domain name (IDN) validation. - - > *New in version 0.9.0*. """ if not value: return False diff --git a/src/validators/email.py b/src/validators/email.py index 760dbd3a..faf45e5f 100644 --- a/src/validators/email.py +++ b/src/validators/email.py @@ -56,8 +56,6 @@ def email( If `value` is a valid eMail. (ValidationError): If `value` is an invalid eMail. - - > *New in version 0.1.0*. """ if not value or value.count("@") != 1: return False diff --git a/src/validators/hashes.py b/src/validators/hashes.py index 69f8f96c..3129ad65 100644 --- a/src/validators/hashes.py +++ b/src/validators/hashes.py @@ -26,8 +26,6 @@ def md5(value: str, /): If `value` is a valid MD5 hash. (ValidationError): If `value` is an invalid MD5 hash. - - > *New in version 0.12.1* """ return re.match(r"^[0-9a-f]{32}$", value, re.IGNORECASE) if value else False @@ -51,8 +49,6 @@ def sha1(value: str, /): If `value` is a valid SHA1 hash. (ValidationError): If `value` is an invalid SHA1 hash. - - > *New in version 0.12.1* """ return re.match(r"^[0-9a-f]{40}$", value, re.IGNORECASE) if value else False @@ -76,8 +72,6 @@ def sha224(value: str, /): If `value` is a valid SHA224 hash. (ValidationError): If `value` is an invalid SHA224 hash. - - > *New in version 0.12.1* """ return re.match(r"^[0-9a-f]{56}$", value, re.IGNORECASE) if value else False @@ -104,8 +98,6 @@ def sha256(value: str, /): If `value` is a valid SHA256 hash. (ValidationError): If `value` is an invalid SHA256 hash. - - > *New in version 0.12.1* """ return re.match(r"^[0-9a-f]{64}$", value, re.IGNORECASE) if value else False @@ -133,7 +125,5 @@ def sha512(value: str, /): If `value` is a valid SHA512 hash. (ValidationError): If `value` is an invalid SHA512 hash. - - > *New in version 0.12.1* """ return re.match(r"^[0-9a-f]{128}$", value, re.IGNORECASE) if value else False diff --git a/src/validators/hostname.py b/src/validators/hostname.py index 04d06e7f..de273df3 100644 --- a/src/validators/hostname.py +++ b/src/validators/hostname.py @@ -104,8 +104,6 @@ def hostname( If `value` is a valid hostname. (ValidationError): If `value` is an invalid hostname. - - > *New in version 0.21.0*. """ if not value: return False diff --git a/src/validators/i18n/es.py b/src/validators/i18n/es.py index 2c396b09..3b4bf56d 100644 --- a/src/validators/i18n/es.py +++ b/src/validators/i18n/es.py @@ -52,8 +52,6 @@ def es_cif(value: str, /): If `value` is a valid DOI string. (ValidationError): If `value` is an invalid DOI string. - - > *New in version 0.13.0*. """ if not value or len(value) != 9: return False @@ -108,8 +106,6 @@ def es_nif(value: str, /): If `value` is a valid DOI string. (ValidationError): If `value` is an invalid DOI string. - - > *New in version 0.13.0*. """ number_by_letter = {"L": "0", "M": "0", "K": "0"} special_cases = {"X0000000T", "00000000T", "00000001R"} @@ -143,8 +139,6 @@ def es_nie(value: str, /): If `value` is a valid DOI string. (ValidationError): If `value` is an invalid DOI string. - - > *New in version 0.13.0*. """ number_by_letter = {"X": "0", "Y": "1", "Z": "2"} # NIE must must start with X Y or Z @@ -179,7 +173,5 @@ def es_doi(value: str, /): If `value` is a valid DOI string. (ValidationError): If `value` is an invalid DOI string. - - > *New in version 0.13.0*. """ return es_nie(value) or es_nif(value) or es_cif(value) diff --git a/src/validators/i18n/fi.py b/src/validators/i18n/fi.py index 68579362..773da6b4 100644 --- a/src/validators/i18n/fi.py +++ b/src/validators/i18n/fi.py @@ -55,12 +55,6 @@ def fi_business_id(value: str, /): If `value` is a valid finnish business id. (ValidationError): If `value` is an invalid finnish business id. - - Note: - - *In version 0.5.0*: - - Function renamed from `finnish_business_id` to `fi_business_id` - - > *New in version 0.4.0*. """ if not value: return False @@ -100,8 +94,6 @@ def fi_ssn(value: str, /, *, allow_temporal_ssn: bool = True): If `value` is a valid finnish SSN. (ValidationError): If `value` is an invalid finnish SSN. - - > *New in version 0.5.0*. """ if not value: return False diff --git a/src/validators/i18n/fr.py b/src/validators/i18n/fr.py index 60c20f33..ad28e54c 100644 --- a/src/validators/i18n/fr.py +++ b/src/validators/i18n/fr.py @@ -53,8 +53,6 @@ def fr_department(value: typing.Union[str, int]): If `value` is a valid french department number. (ValidationError): If `value` is an invalid french department number. - - > *New in version 0.23.0*. """ if not value: return False @@ -96,8 +94,6 @@ def fr_ssn(value: str): If `value` is a valid french Social Security Number. (ValidationError): If `value` is an invalid french Social Security Number. - - > *New in version 0.23.0*. """ if not value: return False diff --git a/src/validators/iban.py b/src/validators/iban.py index ca75d0c3..b323e012 100644 --- a/src/validators/iban.py +++ b/src/validators/iban.py @@ -38,8 +38,6 @@ def iban(value: str, /): If `value` is a valid IBAN code. (ValidationError): If `value` is an invalid IBAN code. - - > *New in version 0.8.0* """ return ( (re.match(r"^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$", value) and _mod_check(value)) diff --git a/src/validators/ip_address.py b/src/validators/ip_address.py index e6d01f65..b7a341f4 100644 --- a/src/validators/ip_address.py +++ b/src/validators/ip_address.py @@ -49,12 +49,6 @@ def ipv4(value: str, /, *, cidr: bool = True, strict: bool = False, host_bit: bo If `value` is a valid IPv4 address. (ValidationError): If `value` is an invalid IPv4 address. - - Note: - - *In version 0.14.0*: - - Add supports for CIDR notation - - > *New in version 0.2.0* """ if not value: return False @@ -102,12 +96,6 @@ def ipv6(value: str, /, *, cidr: bool = True, strict: bool = False, host_bit: bo If `value` is a valid IPv6 address. (ValidationError): If `value` is an invalid IPv6 address. - - Note: - - *In version 0.14.0*: - - Add supports for CIDR notation - - > *New in version 0.2.0* """ if not value: return False diff --git a/src/validators/mac_address.py b/src/validators/mac_address.py index e58d13c9..a0a28a2c 100644 --- a/src/validators/mac_address.py +++ b/src/validators/mac_address.py @@ -30,7 +30,5 @@ def mac_address(value: str, /): If `value` is a valid MAC address. (ValidationError): If `value` is an invalid MAC address. - - > *New in version 0.2.0*. """ return re.match(r"^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", value) if value else False diff --git a/src/validators/slug.py b/src/validators/slug.py index 4373dbd7..9442997d 100644 --- a/src/validators/slug.py +++ b/src/validators/slug.py @@ -29,7 +29,5 @@ def slug(value: str, /): If `value` is a valid slug. (ValidationError): If `value` is an invalid slug. - - > *New in version 0.6.0*. """ return re.match(r"^[a-z0-9]+(?:-[a-z0-9]+)*$", value) if value else False diff --git a/src/validators/url.py b/src/validators/url.py index 9beab71d..7f22cde5 100644 --- a/src/validators/url.py +++ b/src/validators/url.py @@ -178,22 +178,9 @@ def url( Returns: (Literal[True]): - If `value` is a valid slug. + If `value` is a valid url. (ValidationError): - If `value` is an invalid slug. - - Note: - - *In version 0.11.3*: - - Added support for URLs containing localhost. - - *In version 0.11.0*: - - Made the regular expression case insensitive. - - *In version 0.10.3*: - - Added a `public` parameter. - - *In version 0.10.2*: - - Added support for various exotic URLs. - - Fixed various false positives. - - > *New in version 0.2.0*. + If `value` is an invalid url. """ if not value or re.search(r"\s", value): # url must not contain any white diff --git a/src/validators/utils.py b/src/validators/utils.py index 3ecaac5f..82bb14ba 100644 --- a/src/validators/utils.py +++ b/src/validators/utils.py @@ -64,8 +64,6 @@ def validator(func: Callable[..., Any]): (Callable[..., ValidationError | Literal[True]]): A decorator which returns either `ValidationError` or `Literal[True]`. - - > *New in version 2013.10.21*. """ @wraps(func) diff --git a/src/validators/uuid.py b/src/validators/uuid.py index dd981363..2e4c6e95 100644 --- a/src/validators/uuid.py +++ b/src/validators/uuid.py @@ -32,8 +32,6 @@ def uuid(value: Union[str, UUID], /): If `value` is a valid UUID. (ValidationError): If `value` is an invalid UUID. - - > *New in version 0.2.0*. """ if not value: return False