Skip to content

Commit

Permalink
ufpy 0.1.1 (new function - number_of_files_with_extensions)
Browse files Browse the repository at this point in the history
  • Loading branch information
bleudev committed Jun 9, 2024
1 parent d2fa0af commit 29285d9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ufpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
__version__ = '0.1'
__version__ = '0.1.1'

from .cmp import *
from .math_op import *
from .path_tools import *
from .udict import *
from .ustack import *
from .utils import *
14 changes: 14 additions & 0 deletions ufpy/path_tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__all__ = (
'number_of_files_with_extensions',
)

import os

def number_of_files_with_extensions(path, extension) -> int:
r = 0
for p in os.listdir(path):
if os.path.isdir(f'{path}/{p}'):
r += number_of_files_with_extensions(f'{path}/{p}', extension)
elif p.endswith(f'.{extension}'):
r += 1
return r
2 changes: 0 additions & 2 deletions upload.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ py -3.12 -m twine upload dist\*
rd /s /q ufpy.egg-info
rd /s /q dist
rd /s /q build

pause

0 comments on commit 29285d9

Please sign in to comment.