Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 1, 2023
1 parent 276262e commit 2974184
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
5 changes: 1 addition & 4 deletions django_afip/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,7 @@ def generate_csr(self, request, queryset):
taxpayer.generate_key()

csr = taxpayer.generate_csr()
filename = "cuit-{}-{}.csr".format(
taxpayer.cuit,
int(datetime.now().timestamp()),
)
filename = f"cuit-{taxpayer.cuit}-{int(datetime.now().timestamp())}.csr"

response = HttpResponse(content_type="application/pkcs10")
response["Content-Disposition"] = f"attachment; filename={filename}"
Expand Down
20 changes: 4 additions & 16 deletions django_afip/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ def logo_as_data_uri(self) -> str:
with self.logo.open() as f:
data = base64.b64encode(f.read())

return "data:image/{};base64,{}".format(
ext[1:], data.decode() # Remove the leading dot.
)
return f"data:image/{ext[1:]};base64,{data.decode()}"

@property
def certificate_object(self) -> X509 | None:
Expand Down Expand Up @@ -572,11 +570,7 @@ def fetch_points_of_sales(
return results

def __repr__(self) -> str:
return "<TaxPayer {}: {}, CUIT {}>".format(
self.pk,
self.name,
self.cuit,
)
return f"<TaxPayer {self.pk}: {self.name}, CUIT {self.cuit}>"

def __str__(self) -> str:
return str(self.name)
Expand Down Expand Up @@ -977,10 +971,7 @@ def _validate(self, ticket=None) -> list[str]:
elif cae_data.Observaciones:
for obs in cae_data.Observaciones.Obs:
errs.append(
"Error {}: {}".format(
obs.Code,
parsers.parse_string(obs.Msg),
)
f"Error {obs.Code}: {parsers.parse_string(obs.Msg)}"
)

# Remove the number from ones that failed to validate:
Expand Down Expand Up @@ -1227,10 +1218,7 @@ def total_tax(self) -> int:
def formatted_number(self) -> str | None:
"""This receipt's number in the usual format: ``0001-00003087``."""
if self.receipt_number:
return "{:04d}-{:08d}".format(
self.point_of_sales.number,
self.receipt_number,
)
return f"{self.point_of_sales.number:04d}-{self.receipt_number:08d}"
return None

@property
Expand Down

0 comments on commit 2974184

Please sign in to comment.