Skip to content

Commit

Permalink
fix(SIA): handle file_N.dbf files on SIA database
Browse files Browse the repository at this point in the history
  • Loading branch information
luabida committed Jul 15, 2024
1 parent 1a4dcd8 commit 12c8c78
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pysus/ftp/databases/sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ def describe(self, file: File) -> dict:
def format(self, file: File) -> tuple:
if file.extension.upper() in [".DBC", ".DBF"]:
digits = ''.join([d for d in file.name if d.isdigit()])
if "_" in file.name:
name, _ = file.name.split("_")
digits = ''.join([d for d in name if d.isdigit()])
chars, _ = file.name.split(digits)
year, month = digits[:2], digits[2:]
group, _uf = chars[:-2].upper(), chars[-2:].upper()
return group, _uf, zfill_year(year), month
group, uf = chars[:-2].upper(), chars[-2:].upper()
return group, uf, zfill_year(year), month
return ()

def get_files(
Expand Down

0 comments on commit 12c8c78

Please sign in to comment.