Changeset 0f89116 in flex_extract.git for Source/Python/Classes/UioFiles.py


Ignore:
Timestamp:
Dec 19, 2019, 8:07:12 PM (4 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
a73c0f6
Parents:
0d99607
Message:

diverse changes due to PEP8 style guide and eliminating grib2flexpart; removed unused parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Source/Python/Classes/UioFiles.py

    r44174de r0f89116  
    4242
    4343# software specific modules from flex_extract
     44#pylint: disable=wrong-import-position
    4445sys.path.append('../')
    4546from Mods.tools import silent_remove, get_list_as_string
     47#pylint: enable=wrong-import-position
    4648
    4749# ------------------------------------------------------------------------------
     
    5052
    5153class UioFiles(object):
    52     '''Collection of files matching a specific pattern.
     54    """Collection of files matching a specific pattern.
    5355
    5456    The pattern can contain regular expressions for the files.
     
    6264
    6365    pattern : str
    64         Regular expression pattern. For example: '\*.grb'
     66        Regular expression pattern. For example: '*.grb'
    6567
    6668    files : list of str
    6769        List of files matching the pattern in the path.
    68     '''
     70    """
    6971    # --------------------------------------------------------------------------
    7072    # CLASS METHODS
    7173    # --------------------------------------------------------------------------
    7274    def __init__(self, path, pattern):
    73         '''Assignes a specific pattern for these files.
     75        """Assignes a specific pattern for these files.
    7476
    7577        Parameters
     
    7981
    8082        pattern : str
    81             Regular expression pattern. For example: '\*.grb'
     83            Regular expression pattern. For example: '*.grb'
    8284
    8385        Return
    8486        ------
    8587
    86         '''
     88        """
    8789
    8890        self.path = path
     
    9698
    9799    def _list_files(self, path):
    98         '''Lists all files in the directory with the matching
     100        """Lists all files in the directory with the matching
    99101        regular expression pattern.
    100102
     
    107109        ------
    108110
    109         '''
     111        """
    110112        # Get the absolute path
    111113        path = os.path.abspath(path)
    112114
    113115        # get all files in the dir and subdir as absolut path
     116            # pylint: disable=W0612
    114117        for root, dirnames, filenames in os.walk(path):
    115118            for filename in fnmatch.filter(filenames, self.pattern):
     
    120123
    121124    def __str__(self):
    122         '''Converts the list of files into a single string.
     125        """Converts the list of files into a single string.
    123126        The entries are sepereated by "," sign.
    124127
     
    130133        files_string : str
    131134            The content of the list as a single string.
    132         '''
     135        """
    133136
    134137        filenames = [os.path.basename(f) for f in self.files]
     
    139142
    140143    def delete_files(self):
    141         '''Deletes the files.
     144        """Deletes the files.
    142145
    143146        Parameters
     
    147150        ------
    148151
    149         '''
     152        """
    150153
    151154        for old_file in self.files:
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG