This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refatoração das configurações de invoice (#16)
* refatoração do novo padrão de verificações e novo formato * refatora Configuration * adiciona safetynet no _run_validators * adiciona validador de regex * refatoração de Configurations * refatoração na base! * refatoração em transaction * fmt * adiciona bdd's * fmt * complementa testes * valida datas * altera testes * fmt * altera todo's * string regex * altera nomenclatura * adiciona validação de datas * completa bdd * altera validações de data * altera validações * testa validators da situação especial * docstrings * Update imopay_wrapper/validators.py Co-authored-by: PedroRegisPOAR <[email protected]> Co-authored-by: PedroRegisPOAR <[email protected]>
- Loading branch information
1 parent
8635adc
commit 6e31c5e
Showing
20 changed files
with
1,381 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from dataclasses import Field, MISSING | ||
|
||
|
||
class ImopayField(Field): | ||
def __init__( | ||
self, opitional, default, default_factory, init, repr, hash, compare, metadata | ||
): | ||
|
||
self.optional = opitional | ||
|
||
super().__init__(default, default_factory, init, repr, hash, compare, metadata) | ||
|
||
|
||
# This function is used instead of exposing Field creation directly, | ||
# so that a type checker can be told (via overloads) that this is a | ||
# function whose type depends on its parameters. | ||
def field( | ||
*, | ||
optional=False, | ||
default=MISSING, | ||
default_factory=MISSING, | ||
init=True, | ||
repr=True, | ||
hash=None, | ||
compare=True, | ||
metadata=None, | ||
): | ||
"""Return an object to identify dataclass fields. | ||
default is the default value of the field. default_factory is a | ||
0-argument function called to initialize a field's value. If init | ||
is True, the field will be a parameter to the class's __init__() | ||
function. If repr is True, the field will be included in the | ||
object's repr(). If hash is True, the field will be included in | ||
the object's hash(). If compare is True, the field will be used | ||
in comparison functions. metadata, if specified, must be a | ||
mapping which is stored but not otherwise examined by dataclass. | ||
It is an error to specify both default and default_factory. | ||
""" | ||
|
||
if default is not MISSING and default_factory is not MISSING: | ||
raise ValueError("cannot specify both default and default_factory") | ||
return ImopayField( | ||
optional, default, default_factory, init, repr, hash, compare, metadata | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
date_regex = r"^\d{4}-\d{2}-\d{2}$" |
Oops, something went wrong.