Skip to content
Snippets Groups Projects
Commit 507d47f2 authored by Anne Philipp's avatar Anne Philipp
Browse files

pep8 changes + docs added + todo on UIOTools.py

parent a4b6cef4
No related branches found
No related tags found
No related merge requests found
......@@ -8,17 +8,67 @@
# Creation: October 2014 - Anne Fouilloux - University of Oslo
#
#************************************************************************
# TODO AP
#
# - File name und Klassenname gleichsetzen?
# - checken welche regelmässigen methoden auf diese Files noch angewendet werden
# und dann hier implementieren
# - löschen?
#************************************************************************
import os
import glob
class UIOFiles:
'class to manipulate files'
'''
Class to manipulate files. At initialisation it has the attribute
suffix which stores a list of suffixes of the files associated
with the instance of the class.
'''
def __init__(self, suffix):
# type of files to manipulate such as ['.grib', 'grb', 'grib1', 'grib2', 'grb1','grb2']
'''
@Description:
Assignes the suffixes of the files which should be
associated with the instance of the class.
@Input:
self: instance of UIOFiles
Description see class documentation.
suffix: list of strings
Types of files to manipulate such as
['.grib', 'grb', 'grib1', 'grib2', 'grb1','grb2']
@Return:
<nothing>
'''
self.suffix = suffix
return
def listFiles(self, pathname, pattern):
''' list files (suffix previously given) within this directory. '''
'''
@Description:
Lists all files in the directory with the matching
regular expression pattern. The suffixes are already stored
in a list attribute "suffix".
@Input:
self: instance of UIOFiles
Description see class documentation.
pathname: string
Directory where to list the files.
pattern: string
Regular expression pattern. For example:
'*OG_acc_SL*.'+c.ppid+'.*'
@Return:
<nothing>
'''
# Get the absolute path of the pathname parameter
pathname = os.path.abspath(pathname)
......@@ -43,7 +93,6 @@ class UIOFiles:
self.counter += 1
# add this filename in the list
self.files.append(curFile)
else:
# We got a directory, enter into it for further processing
self.listFiles(curFile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment