From 7fbe822633a9d56628e2725529712628b322f92d Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Mon, 11 Aug 2025 14:26:40 -0300 Subject: [PATCH 1/6] =?UTF-8?q?Atualiza=20depend=C3=AAncias=20de=20dev/tes?= =?UTF-8?q?t=20que=20estavam=20com=20o=20build=20falhando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements/dev.in | 2 +- requirements/dev.txt | 127 +++++++++++++++++++---------- requirements/test.in | 6 +- requirements/test.txt | 181 ++++++++++++++++++++++++++++++++---------- 4 files changed, 231 insertions(+), 85 deletions(-) diff --git a/requirements/dev.in b/requirements/dev.in index 0998f2d..2e0e6ac 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,4 +1,4 @@ -pip-tools==5.2.1 +pip-tools ipython black pre-commit diff --git a/requirements/dev.txt b/requirements/dev.txt index a8fa123..d83dc87 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,41 +1,86 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile requirements/dev.in -# -appdirs==1.4.4 # via black, virtualenv -attrs==19.3.0 # via black -backcall==0.2.0 # via ipython -black==19.10b0 # via -r requirements/dev.in -cfgv==3.1.0 # via pre-commit -click==7.1.2 # via black, pip-tools -decorator==4.4.2 # via ipython, traitlets -distlib==0.3.1 # via virtualenv -filelock==3.0.12 # via virtualenv -identify==1.4.23 # via pre-commit -ipython-genutils==0.2.0 # via traitlets -ipython==7.16.1 # via -r requirements/dev.in -jedi==0.17.1 # via ipython -nodeenv==1.4.0 # via pre-commit -parso==0.7.0 # via jedi -pathspec==0.8.0 # via black -pexpect==4.8.0 # via ipython -pickleshare==0.7.5 # via ipython -pip-tools==5.2.1 # via -r requirements/dev.in -pre-commit==2.6.0 # via -r requirements/dev.in -prompt-toolkit==3.0.5 # via ipython -ptyprocess==0.6.0 # via pexpect -pygments==2.6.1 # via ipython -pyyaml==5.3.1 # via pre-commit -regex==2020.6.8 # via black -six==1.15.0 # via pip-tools, traitlets, virtualenv -toml==0.10.1 # via black, pre-commit -traitlets==4.3.3 # via ipython -typed-ast==1.4.1 # via black -virtualenv==20.0.26 # via pre-commit -wcwidth==0.2.5 # via prompt-toolkit - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools +# This file was autogenerated by uv via the following command: +# uv pip compile dev.in +asttokens==3.0.0 + # via stack-data +black==25.1.0 + # via -r dev.in +build==1.3.0 + # via pip-tools +cfgv==3.4.0 + # via pre-commit +click==8.2.1 + # via + # black + # pip-tools +decorator==5.2.1 + # via ipython +distlib==0.4.0 + # via virtualenv +executing==2.2.0 + # via stack-data +filelock==3.18.0 + # via virtualenv +identify==2.6.12 + # via pre-commit +ipython==9.4.0 + # via -r dev.in +ipython-pygments-lexers==1.1.1 + # via ipython +jedi==0.19.2 + # via ipython +matplotlib-inline==0.1.7 + # via ipython +mypy-extensions==1.1.0 + # via black +nodeenv==1.9.1 + # via pre-commit +packaging==25.0 + # via + # black + # build +parso==0.8.4 + # via jedi +pathspec==0.12.1 + # via black +pexpect==4.9.0 + # via ipython +pip==25.2 + # via pip-tools +pip-tools==7.5.0 + # via -r dev.in +platformdirs==4.3.8 + # via + # black + # virtualenv +pre-commit==4.2.0 + # via -r dev.in +prompt-toolkit==3.0.51 + # via ipython +ptyprocess==0.7.0 + # via pexpect +pure-eval==0.2.3 + # via stack-data +pygments==2.19.2 + # via + # ipython + # ipython-pygments-lexers +pyproject-hooks==1.2.0 + # via + # build + # pip-tools +pyyaml==6.0.2 + # via pre-commit +setuptools==80.9.0 + # via pip-tools +stack-data==0.6.3 + # via ipython +traitlets==5.14.3 + # via + # ipython + # matplotlib-inline +virtualenv==20.33.1 + # via pre-commit +wcwidth==0.2.13 + # via prompt-toolkit +wheel==0.45.1 + # via pip-tools diff --git a/requirements/test.in b/requirements/test.in index 3cde4ae..237ab3f 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -1,5 +1,5 @@ -flake8==3.8.3 +flake8 pytest-cov pytest-flake8 -pytest==5.4.3 -safety==1.9.0 +pytest +safety diff --git a/requirements/test.txt b/requirements/test.txt index 9ea67de..2d25d95 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,40 +1,141 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile requirements/test.in -# -attrs==19.3.0 # via pytest -certifi==2020.6.20 # via requests -chardet==3.0.4 # via requests -click==7.1.2 # via safety -coverage==5.2 # via pytest-cov -dparse==0.5.1 # via safety -flake8==3.8.3 # via -r requirements/test.in, pytest-flake8 -idna==2.10 # via requests, yarl -mccabe==0.6.1 # via flake8 -more-itertools==8.4.0 # via pytest -multidict==4.7.6 # via yarl -packaging==20.4 # via dparse, pytest, safety -pluggy==0.13.1 # via pytest -py==1.9.0 # via pytest -pycodestyle==2.6.0 # via flake8 -pyflakes==2.2.0 # via flake8 -pyparsing==2.4.7 # via packaging -pytest-cov==2.10.0 # via -r requirements/test.in -pytest-flake8==1.0.6 # via -r requirements/test.in -pytest-vcr==1.0.2 # via -r requirements/test.in -pytest==5.4.3 # via -r requirements/test.in, pytest-cov, pytest-flake8, pytest-vcr -pyyaml==5.3.1 # via dparse, vcrpy -requests==2.24.0 # via safety -safety==1.9.0 # via -r requirements/test.in -six==1.15.0 # via packaging, vcrpy -toml==0.10.1 # via dparse -urllib3==1.25.9 # via requests -vcrpy==4.0.2 # via pytest-vcr -wcwidth==0.2.5 # via pytest -wrapt==1.12.1 # via vcrpy -yarl==1.4.2 # via vcrpy - -# The following packages are considered to be unsafe in a requirements file: -# setuptools +# This file was autogenerated by uv via the following command: +# uv pip compile test.in +annotated-types==0.7.0 + # via pydantic +anyio==4.10.0 + # via httpx +authlib==1.6.1 + # via safety +certifi==2025.8.3 + # via + # httpcore + # httpx + # requests +cffi==1.17.1 + # via cryptography +charset-normalizer==3.4.2 + # via requests +click==8.2.1 + # via + # nltk + # safety + # typer +coverage==7.10.2 + # via pytest-cov +cryptography==45.0.6 + # via authlib +dparse==0.6.4 + # via + # safety + # safety-schemas +filelock==3.16.1 + # via safety +flake8==7.3.0 + # via + # -r test.in + # pytest-flake8 +h11==0.16.0 + # via httpcore +httpcore==1.0.9 + # via httpx +httpx==0.28.1 + # via safety +idna==3.10 + # via + # anyio + # httpx + # requests +iniconfig==2.1.0 + # via pytest +jinja2==3.1.6 + # via safety +joblib==1.5.1 + # via nltk +markdown-it-py==3.0.0 + # via rich +markupsafe==3.0.2 + # via jinja2 +marshmallow==4.0.0 + # via safety +mccabe==0.7.0 + # via flake8 +mdurl==0.1.2 + # via markdown-it-py +nltk==3.9.1 + # via safety +packaging==25.0 + # via + # dparse + # pytest + # safety + # safety-schemas +pluggy==1.6.0 + # via + # pytest + # pytest-cov +psutil==6.1.1 + # via safety +pycodestyle==2.14.0 + # via flake8 +pycparser==2.22 + # via cffi +pydantic==2.9.2 + # via + # safety + # safety-schemas +pydantic-core==2.23.4 + # via pydantic +pyflakes==3.4.0 + # via flake8 +pygments==2.19.2 + # via + # pytest + # rich +pytest==8.4.1 + # via + # -r test.in + # pytest-cov + # pytest-flake8 +pytest-cov==6.2.1 + # via -r test.in +pytest-flake8==1.3.0 + # via -r test.in +regex==2025.7.34 + # via nltk +requests==2.32.4 + # via safety +rich==14.1.0 + # via typer +ruamel-yaml==0.18.14 + # via + # safety + # safety-schemas +ruamel-yaml-clib==0.2.12 + # via ruamel-yaml +safety==3.6.0 + # via -r test.in +safety-schemas==0.0.14 + # via safety +setuptools==80.9.0 + # via safety +shellingham==1.5.4 + # via typer +sniffio==1.3.1 + # via anyio +tenacity==9.1.2 + # via safety +tomlkit==0.13.3 + # via safety +tqdm==4.67.1 + # via nltk +typer==0.16.0 + # via safety +typing-extensions==4.14.1 + # via + # pydantic + # pydantic-core + # safety + # safety-schemas + # typer +urllib3==2.5.0 + # via requests From f18824b31f8b0eb458280359b2240dadc93b7d49 Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Mon, 11 Aug 2025 14:46:55 -0300 Subject: [PATCH 2/6] Adiciona suporte a regexps da bandeira 'maestro', associando como 'master' --- creditcard/card.py | 52 ++++++++++++++++++++++++++++++++++++++--- tests/unit/test_card.py | 6 +++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/creditcard/card.py b/creditcard/card.py index cdf2a1a..d402b14 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -11,11 +11,57 @@ "softnex": r"^610800", "diners": r"^3(?:0[0-5]|[68][0-9])[0-9]{11}$", "discover": r"^6(?:011|5[0-9]{2}|4[4-9][0-9]{1}|(22(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[01][0-9]|92[0-5]$)[0-9]{10}$))[0-9]{12}$", # noqa: E501 - "hipercard": r"^(38[0-9]{17}|60[0-9]{14})$", + "hipercard": r"^(606282|3841[046]0)[0-9]{10}$", "amex": r"^3[47][0-9]{13}$", - "aura": r"^50[0-9]{14,17}$", + "aura": r"^5078[0-9]{12,15}$", "codensa": r"^(870055|590712|529448)[0-9]{10}$", - "master": r"^(5[1-5][0-9]{14}|2221[0-9]{12}|222[2-9][0-9]{12}|22[3-9][0-9]{13}|2[3-6][0-9]{14}|27[01][0-9]{13}|2720[0-9]{12})$", # noqa: E501 + "master": ( + r"^" + r"(5[1-5][0-9]{14}" + r"|2221[0-9]{12}" + r"|222[2-9][0-9]{12}" + r"|22[3-9][0-9]{13}" + r"|2[3-6][0-9]{14}" + r"|27[01][0-9]{13}" + r"|2720[0-9]{12}" + # Maestro + r"|5[06789][0-9]{14}" + r"|600[689][0-9]{12}" + r"|602[468][0-9]{12}" + r"|603[0-9]{13}" + r"|604[69][0-9]{12}" + r"|605[045][0-9]{12}" + r"|606[234][0-9]{12}" + r"|6095[0-9]{12}" + r"|6220[0-9]{12}" + r"|627[389][0-9]{12}" + r"|628[01][0-9]{12}" + r"|6305[0-9]{12}" + r"|631[06][0-9]{12}" + r"|636[13678][0-9]{12}" + r"|637[1256][0-9]{12}" + r"|6381[0-9]{12}" + r"|639[2-7][0-9]{12}" + r"|6602[0-9]{12}" + r"|662[269][0-9]{12}" + r"|6640[0-9]{12}" + r"|665[49][0-9]{12}" + r"|666[2478][0-9]{12}" + r"|667[79][0-9]{12}" + r"|668[03569][0-9]{12}" + r"|6690[0-9]{12}" + r"|671[45][0-9]{12}" + r"|6748[0-9]{12}" + r"|6777[0-9]{12}" + r"|678[37][0-9]{12}" + r"|679[29][0-9]{12}" + r"|681[056][0-9]{12}" + r"|684[37][0-9]{12}" + r"|6874[0-9]{12}" + r"|6890[0-9]{12}" + r"|68[58]0[0-9]{12}" + r")$" + ), "visa": r"^4[0-9]{12}(?:[0-9]{3})?$", } diff --git a/tests/unit/test_card.py b/tests/unit/test_card.py index 5f58877..ff40baa 100644 --- a/tests/unit/test_card.py +++ b/tests/unit/test_card.py @@ -38,6 +38,12 @@ def test_is_valid(self): ("cabal", "6043240000000000"), ("master", "5369835519963014"), ("master", "5269116044687225"), + ("master", "5899162511244726"), + ("master", "5021316371000112"), + ("master", "5930422341037703"), + ("master", "6039137880232543"), + ("master", "6063216106123345"), + ("master", "6392403325708112"), ("codensa", "8700551111111111"), ("codensa", "5907121111111111"), ("codensa", "5294481111111111"), From 265b55725c2f218b645726bc23b732053fc5ce9b Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Thu, 14 Aug 2025 09:48:45 -0300 Subject: [PATCH 3/6] Junta regexps equivalentes na mesma regexp --- creditcard/card.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/creditcard/card.py b/creditcard/card.py index d402b14..0112818 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -58,8 +58,7 @@ r"|681[056][0-9]{12}" r"|684[37][0-9]{12}" r"|6874[0-9]{12}" - r"|6890[0-9]{12}" - r"|68[58]0[0-9]{12}" + r"|68[589]0[0-9]{12}" r")$" ), "visa": r"^4[0-9]{12}(?:[0-9]{3})?$", From d1aae16fd5e2f2b7fb0a4fee45bbabdc459f1f21 Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Thu, 14 Aug 2025 09:51:36 -0300 Subject: [PATCH 4/6] =?UTF-8?q?Adiciona=20coment=C3=A1rios=20explicativos?= =?UTF-8?q?=20para=20testes=20de=20cart=C3=B5es=20maestro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_card.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_card.py b/tests/unit/test_card.py index ff40baa..ba04155 100644 --- a/tests/unit/test_card.py +++ b/tests/unit/test_card.py @@ -38,12 +38,12 @@ def test_is_valid(self): ("cabal", "6043240000000000"), ("master", "5369835519963014"), ("master", "5269116044687225"), - ("master", "5899162511244726"), - ("master", "5021316371000112"), - ("master", "5930422341037703"), - ("master", "6039137880232543"), - ("master", "6063216106123345"), - ("master", "6392403325708112"), + ("master", "5899162511244726"), # antigo maestro + ("master", "5021316371000112"), # antigo maestro + ("master", "5930422341037703"), # antigo maestro + ("master", "6039137880232543"), # antigo maestro + ("master", "6063216106123345"), # antigo maestro + ("master", "6392403325708112"), # antigo maestro ("codensa", "8700551111111111"), ("codensa", "5907121111111111"), ("codensa", "5294481111111111"), From 74547875d9178d6120675deaebddeb829fe58eca Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Thu, 14 Aug 2025 11:47:02 -0300 Subject: [PATCH 5/6] =?UTF-8?q?Adiciona=20bin=20637095=20ao=20padr=C3=A3o?= =?UTF-8?q?=20da=20bandeira=20hipercard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- creditcard/card.py | 2 +- tests/unit/test_card.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/creditcard/card.py b/creditcard/card.py index 0112818..c354913 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -11,7 +11,7 @@ "softnex": r"^610800", "diners": r"^3(?:0[0-5]|[68][0-9])[0-9]{11}$", "discover": r"^6(?:011|5[0-9]{2}|4[4-9][0-9]{1}|(22(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[01][0-9]|92[0-5]$)[0-9]{10}$))[0-9]{12}$", # noqa: E501 - "hipercard": r"^(606282|3841[046]0)[0-9]{10}$", + "hipercard": r"^(606282|637095|3841[046]0)[0-9]{10}$", "amex": r"^3[47][0-9]{13}$", "aura": r"^5078[0-9]{12,15}$", "codensa": r"^(870055|590712|529448)[0-9]{10}$", diff --git a/tests/unit/test_card.py b/tests/unit/test_card.py index ba04155..a5d2347 100644 --- a/tests/unit/test_card.py +++ b/tests/unit/test_card.py @@ -34,6 +34,7 @@ def test_is_valid(self): ("diners", "30346836403940"), ("elo", "5041756758046020"), ("hipercard", "6062825303833679"), + ("hipercard", "6370955873875722"), ("softnex", "6108000000000000"), ("cabal", "6043240000000000"), ("master", "5369835519963014"), From 5b1567a799ff2c0b2bdf17ea4ee6e94c04b567ff Mon Sep 17 00:00:00 2001 From: Felipe Trzaskowski Date: Thu, 14 Aug 2025 12:14:37 -0300 Subject: [PATCH 6/6] =?UTF-8?q?Atualiza=20coment=C3=A1rio=20sobre=20cart?= =?UTF-8?q?=C3=B5es=20Maestro=20para=20MasterCard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- creditcard/card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creditcard/card.py b/creditcard/card.py index c354913..668ff74 100644 --- a/creditcard/card.py +++ b/creditcard/card.py @@ -24,7 +24,7 @@ r"|2[3-6][0-9]{14}" r"|27[01][0-9]{13}" r"|2720[0-9]{12}" - # Maestro + # Suporte aos antigos cartões Maestro que agora são MasterCard r"|5[06789][0-9]{14}" r"|600[689][0-9]{12}" r"|602[468][0-9]{12}"