File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 11
22from pathlib import Path
3- from typing import Union , Dict
3+ from typing import Union , Dict , List
44import pandas as pd
55
6- from pysus .ftp import CACHEPATH
6+ from pysus .ftp import CACHEPATH , File , Directory
77from pysus .ftp .databases .territory import Territory
88
99ter = Territory ().load ()
1010
11- def list_tables ()-> Dict :
12- files = ter . get_files ( )
13- tabelas = [f for f in files if 'territor' in f .name ]
11+ def list_tables ()-> List [ File ] :
12+ d = Directory ( '/territorio/tabelas' )
13+ tabelas = [f for f in d . content if 'territor' in f .name ]
1414 return tabelas
1515
16- def list_maps ():
17- files = ter . get_files ( )
18- mapas = [f for f in files if 'mapas' in f .name ]
16+ def list_maps ()-> List [ File ] :
17+ d = Directory ( '/territorio/mapas' )
18+ mapas = [f for f in d . content if 'mapas' in f .name ]
1919 return mapas
2020
2121def download (fname : Union [str ,list ], data_path : str = CACHEPATH ):
22- files = ter .get_files ()
23-
24- dfiles = ter .download (list (fname ), data_path )
22+ files = Directory ('/territorio/tabelas' ).content + Directory ('/territorio/mapas' ).content
23+ for file in files :
24+ if fname in [str (file ), file .name ]: # handles suffixed and no suffixed `fname`s
25+ return file .download ()
2526
2627
You can’t perform that action at this time.
0 commit comments