Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPD+FIX] Atualizando as bibliotecas do Pre-commit e corrigido conflito entre validações #46

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
16 changes: 11 additions & 5 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def exec_in_env():
check_call([bin_path / "pip", "install", "jinja2", "tox"])
python_executable = bin_path / "python"
if not python_executable.exists():
python_executable = python_executable.with_suffix('.exe')
python_executable = python_executable.with_suffix(".exe")

print("Re-executing with: {0}".format(python_executable))
print("+ exec", python_executable, __file__, "--no-env")
Expand All @@ -61,16 +61,22 @@ def main():
# This uses sys.executable the same way that the call in
# cookiecutter-pylibrary/hooks/post_gen_project.py
# invokes this bootstrap.py itself.
for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines()
for line in subprocess.check_output(
[sys.executable, "-m", "tox", "--listenvs"], universal_newlines=True
).splitlines()
]
tox_environments = [line for line in tox_environments if line.startswith('py')]
tox_environments = [line for line in tox_environments if line.startswith("py")]

for template in templates_path.rglob('*'):
for template in templates_path.rglob("*"):
if template.is_file():
template_path = str(template.relative_to(templates_path))
destination = base_path / template_path
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(jinja.get_template(template_path).render(tox_environments=tox_environments))
destination.write_text(
jinja.get_template(template_path).render(
tox_environments=tox_environments
)
)
print("Wrote {}".format(template_path))
print("DONE.")

Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ universal = 1
[flake8]
max-line-length = 140
exclude = */migrations/*
# Conflito entre o Black e Flake8
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#slices
# This behaviour may raise E203 whitespace before ':' warnings in style guide enforcement tools like Flake8. Since E203 is not PEP 8 compliant, you should tell Flake8 to ignore these warnings.
extend-ignore = E203

[tool:pytest]
testpaths = tests
Expand Down
2 changes: 1 addition & 1 deletion src/erpbrasil/base/fiscal/edoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def partes(self, num_partes=11):
).format(num_partes)

salto = 44 // num_partes
return [self._campos[n: (n + salto)] for n in range(0, 44, salto)]
return [self._campos[n : (n + salto)] for n in range(0, 44, salto)]


class ChaveCFeSAT(ChaveEdoc):
Expand Down
2 changes: 1 addition & 1 deletion src/erpbrasil/base/gs1/gtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def calcula_dv(gs1_code, code_length):
prod = [3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]

# get the product with some gs1_code length
gs1_prod = prod[len(prod) - len(gs1_code):]
gs1_prod = prod[len(prod) - len(gs1_code) :]

while len(gs1_code) < code_length:
r = sum([x * y for (x, y) in zip(gs1_code, gs1_prod)]) % 10
Expand Down
Loading