Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# Linux
.*.swp

poetry.lock

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
15 changes: 4 additions & 11 deletions pynfe/utils/descompactar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@

"""

from io import BytesIO
import base64
import gzip
from lxml import etree


class DescompactaGzip(object):
@staticmethod
def descompacta(stringZipada):
def descompacta(stringZipada: str):
"""
:paramn stringZipada: String

:return : Etree
"""
arq = BytesIO()
arq.write(base64.b64decode(stringZipada))
arq.seek(0)
zip = gzip.GzipFile(fileobj=arq)
texto = zip.read()
arq.close()
zip.close()
descompactado = texto.decode("utf-8").encode()
return etree.fromstring(descompactado)
decoded = base64.b64decode(stringZipada)
decompress_nfe = gzip.decompress(decoded).decode("utf8")
return etree.fromstring(decompress_nfe)
40 changes: 39 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
[project]
name = "PyNFe"
version = "0.4.4"
description = "Interface library with the Brazilian Electronic Invoice web services"
authors = [
{name = "TadaSoftware",email = " tadasoftware@gmail.com"}
]
readme = "README.md"
requires-python = ">=3.9, <4"


[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"

[tool.ruff]
exclude = [
'pynfe/entidades/__init__.py'
]
line-length = 100
line-length = 100

[tool.poetry.dependencies]
requests = "^2.32.4"
signxml = "^4.1.0"
cryptography = "43.0.3"
lxml = "5.4.0"
pyopenssl = "^25.1.0"

[tool.poetry.group.dev.dependencies]
ruff = "^0.12.5"
pytest = "^8.4.1"
taskipy = "^1.14.1"
pytest-cov = "^6.2.1"

[tool.pytest.ini_options]
pythonpath = "."
addopts = '-p no:warnings'

[tool.taskipy.tasks]
lint = 'ruff check'
pre_format = 'ruff check --fix'
format = 'ruff format'
pre_lint = 'task format'
pre_test = 'task lint'
test = 'pytest -s -x --cov=app -vv'
post_test = 'coverage html'