@@ -42,18 +42,15 @@ def version():
42
42
print ('MNE-CPP Project python module. - Version: 0.1.9' )
43
43
print ('Copyright (C) 2021, Juan Garcia-Prieto. All rights reserved.' )
44
44
45
- def __currentPath ():
45
+ def __pathToThisFile ():
46
46
return path .abspath (path .dirname (sys .argv [0 ]))
47
47
48
48
def baseFolder ():
49
- this_script_path = __currentPath ().split (path .sep )
49
+ this_script_path = __pathToThisFile ().split (path .sep )
50
50
project_path = ''
51
51
for f in this_script_path [:- 2 ]:
52
52
project_path += f + '/'
53
53
return project_path
54
- class File_ext_separator (Enum ):
55
- FIRST = 1
56
- LAST = 2
57
54
58
55
def extractFilePaths (text : str , ** inputArgs ):
59
56
@@ -90,10 +87,10 @@ def extractFilePaths(text: str, **inputArgs):
90
87
pattern = re .compile (expression )
91
88
fileMatches = pattern .finditer (text )
92
89
for f in fileMatches :
93
- deviceLabel = none_if_empty (f .group ('deviceLabel' )) #f.string[f.start('deviceLabel'):f.end('deviceLabel')]
94
- filePath = none_if_empty (f .group ('filePath' )) #f.string[f.start('filePath'):f.end('filePath')-1]
95
- fileName = none_if_empty (f .group ('fileName' )) #f.string[f.start('fileName'):f.end('fileName')]
96
- fileExt = none_if_empty (f .group ('fileExtension' )) #f.string[f.start('fileExtension'):f.end('fileExtension')]
90
+ deviceLabel = noneIfEmpty (f .group ('deviceLabel' )) #f.string[f.start('deviceLabel'):f.end('deviceLabel')]
91
+ filePath = noneIfEmpty (f .group ('filePath' )) #f.string[f.start('filePath'):f.end('filePath')-1]
92
+ fileName = noneIfEmpty (f .group ('fileName' )) #f.string[f.start('fileName'):f.end('fileName')]
93
+ fileExt = noneIfEmpty (f .group ('fileExtension' )) #f.string[f.start('fileExtension'):f.end('fileExtension')]
97
94
absFilePath = deviceLabel + filePath + fileName + '.' + fileExt
98
95
print (absFilePath )
99
96
return (deviceLabel , filePath , fileName , fileExt , absFilePath )
@@ -105,7 +102,7 @@ def recursiveFolderProcess(folderPath, func):
105
102
if file .is_file ():
106
103
func (file )
107
104
108
- def none_if_empty (s ):
105
+ def noneIfEmpty (s ):
109
106
return '' if s is None else s
110
107
111
108
def parseFilePathNameExt (inText ):
@@ -124,11 +121,11 @@ def parseFilePathNameExt(inText):
124
121
fileName = ''
125
122
fileExt = ''
126
123
if match :
127
- deviceLabel = none_if_empty (match .group ('deviceLabel' ))
128
- filePath = none_if_empty (match .group ('filePath' ))
129
- lastFolder = none_if_empty (match .group ('lastFolder' ))
130
- fileName = none_if_empty (match .group ('fileName' ))
131
- fileExt = none_if_empty (match .group ('fileExt' ))
124
+ deviceLabel = noneIfEmpty (match .group ('deviceLabel' ))
125
+ filePath = noneIfEmpty (match .group ('filePath' ))
126
+ lastFolder = noneIfEmpty (match .group ('lastFolder' ))
127
+ fileName = noneIfEmpty (match .group ('fileName' ))
128
+ fileExt = noneIfEmpty (match .group ('fileExt' ))
132
129
return (deviceLabel , filePath , lastFolder , fileName , fileExt )
133
130
134
131
def parseInputArguments (argsToParse , ** opts ):
@@ -162,7 +159,7 @@ def parseInputArguments(argsToParse, **opts):
162
159
return (v for k , v in options .items ())
163
160
164
161
_suffixes = ['bytes' , 'KiB' , 'MiB' , 'GiB' , 'TiB' , 'PiB' , 'EiB' , 'ZiB' , 'YiB' ]
165
- def size_human_readable (size ):
162
+ def sizeHumanReadable (size ):
166
163
# determine binary order in steps of size 10
167
164
# (coerce to int, // still returns a float)
168
165
order = int (log2 (size ) / 10 ) if size else 0
@@ -171,7 +168,7 @@ def size_human_readable(size):
171
168
# should never resort to exponent values)
172
169
return '{:.4g} {}' .format (size / (1 << (order * 10 )), _suffixes [order ])
173
170
174
- def get_list_of_files (folder ):
171
+ def getListOfFiles (folder ):
175
172
"""Retrieve a list of files inside (recursive) a folder.
176
173
177
174
Args:
0 commit comments