soup-files 1.2.1__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {soup_files-1.2.1 → soup_files-1.2.2}/PKG-INFO +1 -1
- {soup_files-1.2.1 → soup_files-1.2.2}/pyproject.toml +1 -1
- soup_files-1.2.2/soup_files/__main__.py +14 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files/files.py +30 -43
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files/version.py +1 -1
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files.egg-info/PKG-INFO +1 -1
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files.egg-info/SOURCES.txt +1 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/README.md +0 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/setup.cfg +0 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files/__init__.py +0 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files/progress.py +0 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files.egg-info/dependency_links.txt +0 -0
- {soup_files-1.2.1 → soup_files-1.2.2}/soup_files.egg-info/top_level.txt +0 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
from soup_files import __version__
|
3
|
+
|
4
|
+
def test():
|
5
|
+
from soup_files import File, Directory, UserFileSystem, LibraryDocs, InputFiles
|
6
|
+
pass
|
7
|
+
|
8
|
+
|
9
|
+
def main():
|
10
|
+
print(f' soup_files - versão: {__version__}')
|
11
|
+
test()
|
12
|
+
|
13
|
+
if __name__ == '__main__':
|
14
|
+
main()
|
@@ -190,12 +190,13 @@ class Directory(object):
|
|
190
190
|
return values
|
191
191
|
|
192
192
|
def __content_no_recursive(self) -> List[File]:
|
193
|
-
|
193
|
+
content_files: List[str] = os.listdir(self.absolute())
|
194
194
|
values: List[File] = []
|
195
|
-
for
|
196
|
-
|
195
|
+
for file in content_files:
|
196
|
+
fp: str = os.path.join(self.absolute(), file)
|
197
|
+
if os.path.isfile(fp):
|
197
198
|
values.append(
|
198
|
-
File(os.path.abspath(
|
199
|
+
File(os.path.abspath(fp))
|
199
200
|
)
|
200
201
|
return values
|
201
202
|
|
@@ -216,9 +217,10 @@ class Directory(object):
|
|
216
217
|
else:
|
217
218
|
_paths = os.listdir(self.absolute())
|
218
219
|
for d in _paths:
|
219
|
-
|
220
|
+
_dirpath = os.path.join(self.absolute(), d)
|
221
|
+
if os.path.isdir(_dirpath):
|
220
222
|
values.append(
|
221
|
-
Directory(os.path.abspath(
|
223
|
+
Directory(os.path.abspath(_dirpath))
|
222
224
|
)
|
223
225
|
return values
|
224
226
|
|
@@ -285,7 +287,6 @@ class InputFiles(object):
|
|
285
287
|
return content_files
|
286
288
|
|
287
289
|
def __get_files_recursive(self, *, file_type: LibraryDocs, sort: bool) -> List[File]:
|
288
|
-
#
|
289
290
|
#
|
290
291
|
_paths: List[Path] = self.input_dir.iterpaths()
|
291
292
|
_all_files = []
|
@@ -319,33 +320,25 @@ class InputFiles(object):
|
|
319
320
|
_all_files.sort(key=File.absolute)
|
320
321
|
return _all_files
|
321
322
|
|
322
|
-
def __get_files_no_recursive(self, *, file_type: LibraryDocs, sort: bool):
|
323
|
-
|
324
|
-
|
323
|
+
def __get_files_no_recursive(self, *, file_type: LibraryDocs, sort: bool) -> List[File]:
|
324
|
+
_content_files: List[File] = self.input_dir.content_files(recursive=False)
|
325
|
+
|
326
|
+
_all_files: List[File] = []
|
325
327
|
count: int = 0
|
326
328
|
if file_type == LibraryDocs.ALL:
|
327
329
|
# Todos os tipos de arquivos
|
328
|
-
for
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
count += 1
|
334
|
-
if count >= self.maxFiles:
|
335
|
-
break
|
330
|
+
for file in _content_files:
|
331
|
+
_all_files.append(file)
|
332
|
+
count += 1
|
333
|
+
if count == self.maxFiles:
|
334
|
+
break
|
336
335
|
else:
|
337
336
|
# Arquivos especificados em LibraryDocs
|
338
|
-
for
|
339
|
-
if
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
if _path_file.suffix in file_type.value:
|
344
|
-
_all_files.append(
|
345
|
-
File(os.path.abspath(_path_file.absolute()))
|
346
|
-
)
|
347
|
-
count += 1
|
348
|
-
if count >= self.maxFiles:
|
337
|
+
for file in _content_files:
|
338
|
+
if file.extension() in file_type.value:
|
339
|
+
_all_files.append(file)
|
340
|
+
count += 1
|
341
|
+
if count == self.maxFiles:
|
349
342
|
break
|
350
343
|
if sort:
|
351
344
|
_all_files.sort(key=File.absolute)
|
@@ -366,9 +359,8 @@ class InputFiles(object):
|
|
366
359
|
|
367
360
|
"""
|
368
361
|
if recursive:
|
369
|
-
return self.__get_files_recursive(file_type=file_type, sort=sort)
|
370
|
-
|
371
|
-
return self.__get_files_no_recursive(file_type=file_type, sort=sort)
|
362
|
+
return self.__get_files_recursive(file_type=file_type, sort=sort)
|
363
|
+
return self.__get_files_no_recursive(file_type=file_type, sort=sort)
|
372
364
|
|
373
365
|
|
374
366
|
class JsonData(object):
|
@@ -451,13 +443,8 @@ class UserFileSystem(object):
|
|
451
443
|
"""
|
452
444
|
Diretórios comuns para cache e configurações de usuário.
|
453
445
|
"""
|
454
|
-
def __init__(self, base_home:Directory=
|
455
|
-
|
456
|
-
self.baseHome:Directory = Directory(os.path.abspath(Path().home()))
|
457
|
-
elif isinstance(base_home, Directory):
|
458
|
-
self.baseHome:Directory = base_home
|
459
|
-
else:
|
460
|
-
raise ValueError(f'{__class__.__name__}\nUse:Directory(), não {type(base_home)}')
|
446
|
+
def __init__(self, base_home: Directory = Directory(os.path.abspath(Path().home()))):
|
447
|
+
self.baseHome:Directory = base_home
|
461
448
|
self.userDownloads:Directory = self.baseHome.concat('Downloads', create=True)
|
462
449
|
self.userVarDir:Directory = self.baseHome.concat('var', create=True)
|
463
450
|
|
@@ -472,11 +459,11 @@ class UserAppDir(object):
|
|
472
459
|
"""
|
473
460
|
Diretório comun para cache e configurações do aplicativo.
|
474
461
|
"""
|
475
|
-
def __init__(self, appname:str, *, user_file_system:UserFileSystem=UserFileSystem()):
|
462
|
+
def __init__(self, appname:str, *, user_file_system: UserFileSystem = UserFileSystem()):
|
476
463
|
self.appname = appname
|
477
|
-
self.userFileSystem:UserFileSystem = user_file_system
|
478
|
-
self.workspaceDirApp:Directory = self.userFileSystem.userDownloads.concat(self.appname, create=True)
|
479
|
-
self.installDir:Directory = self.userFileSystem.userVarDir.concat('opt').concat(self.appname, create=True)
|
464
|
+
self.userFileSystem: UserFileSystem = user_file_system
|
465
|
+
self.workspaceDirApp: Directory = self.userFileSystem.userDownloads.concat(self.appname, create=True)
|
466
|
+
self.installDir: Directory = self.userFileSystem.userVarDir.concat('opt').concat(self.appname, create=True)
|
480
467
|
|
481
468
|
def cache_dir_app(self) -> Directory:
|
482
469
|
return self.userFileSystem.cache_dir().concat(self.appname, create=True)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|