diff --git a/pysus/ftp/__init__.py b/pysus/ftp/__init__.py index 36e617a..c124711 100644 --- a/pysus/ftp/__init__.py +++ b/pysus/ftp/__init__.py @@ -22,11 +22,10 @@ import humanize from aioftp import Client from loguru import logger +from pysus.data.local import Data from tqdm import tqdm from typing_extensions import Self -from pysus.data.local import Data - # Type aliases PathLike = Union[str, pathlib.Path] FileContent = Dict[str, Union["Directory", "File"]] @@ -403,7 +402,9 @@ def load_directory_content(path: str) -> FileContent: def line_parser(line: str): if "" in line: date, time, _, name = line.strip().split(maxsplit=3) - modify = datetime.strptime(f"{date} {time}", "%m-%d-%y %I:%M%p") + modify = datetime.strptime( + f"{date} {time}", "%m-%d-%y %I:%M%p" + ) info = {"size": 0, "type": "dir", "modify": modify} xpath = f"{path}/{name}" content[name] = Directory(xpath) @@ -481,7 +482,9 @@ def content(self) -> List[Union[Directory, File]]: inside content, `load()` the directory and call `content` again. """ if not self.__content__: - logger.info("content is not loaded, use `load()` to load default paths") + logger.info( + "content is not loaded, use `load()` to load default paths" + ) return [] return sorted(list(self.__content__.values()), key=str) @@ -546,7 +549,9 @@ def get_files(self, *args, **kwargs) -> list[File]: """ ... - def download(self, files: List[File], local_dir: str = CACHEPATH) -> List[str]: + def download( + self, files: List[File], local_dir: str = CACHEPATH + ) -> List[str]: """ Downloads a list of Files. """ @@ -561,7 +566,9 @@ def download(self, files: List[File], local_dir: str = CACHEPATH) -> List[str]: return dfiles[0] return dfiles - async def async_download(self, files: List[File], local_dir: str = CACHEPATH): + async def async_download( + self, files: List[File], local_dir: str = CACHEPATH + ): """ Asynchronously downloads a list of files """ diff --git a/pysus/tests/test_ftp.py b/pysus/tests/test_ftp.py index 9717a08..9d939a9 100644 --- a/pysus/tests/test_ftp.py +++ b/pysus/tests/test_ftp.py @@ -3,7 +3,11 @@ import pandas as pd from pysus.data.local import ParquetSet +<<<<<<< HEAD from pysus.ftp import DIRECTORY_CACHE, Database, Directory, File +======= +from pysus.ftp import CACHE, Database, Directory, File +>>>>>>> 0a98978 (chore(CI): fix CI workflows (#214)) from pysus.ftp.databases import ( ciha, cnes, @@ -64,7 +68,11 @@ def test_root_directory(self): self.assertTrue(self.root.parent == self.root) # outermost parent def test_directory_cache(self): +<<<<<<< HEAD self.assertTrue(DIRECTORY_CACHE["/"] == self.root) +======= + self.assertTrue(CACHE["/"] == self.root) +>>>>>>> 0a98978 (chore(CI): fix CI workflows (#214)) def test_sinan_file(self): file = Directory("/dissemin/publicos/SINAN/DADOS/FINAIS").content[0]