Changeset 6f951ca in flex_extract.git for source/python/classes/UioFiles.py


Ignore:
Timestamp:
Jan 15, 2019, 1:05:10 AM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
d4696e0
Parents:
2625ca8
Message:

new style of docstring params and updates in docstrings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/classes/UioFiles.py

    r5cb0eaa r6f951ca  
    1212#        - added pattern search in method list_files
    1313#
    14 #    February 2018 - Anne Philipp (University of Vienna):
     14#    February - December 2018 - Anne Philipp (University of Vienna):
    1515#        - applied PEP8 style guide
    1616#        - added documentation
     
    2020#        - modified the class so that it is initiated with a pattern instead
    2121#          of suffixes. Gives more precision in selection of files.
     22#        - added delete method
    2223#
    2324# @License:
    24 #    (C) Copyright 2014-2018.
     25#    (C) Copyright 2014-2019.
     26#    Anne Philipp, Leopold Haimberger
    2527#
    26 #    This software is licensed under the terms of the Apache Licence Version 2.0
    27 #    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
    28 #
    29 # @Class Decription:
    30 #    The class is for file manipulation. It is initiated with a regular
    31 #    expression pattern for this instance and can produce a list of Files
    32 #    from the given file pattern. These files can be deleted.
    33 #
    34 # @Class Content:
    35 #    - __init__
    36 #    - __str__
    37 #    - __list_files__
    38 #    - delete_files
    39 #
    40 # @Class Attributes:
    41 #    - pattern
    42 #    - files
    43 #
     28#    This work is licensed under the Creative Commons Attribution 4.0
     29#    International License. To view a copy of this license, visit
     30#    http://creativecommons.org/licenses/by/4.0/ or send a letter to
     31#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
    4432#*******************************************************************************
    4533
     
    5139import fnmatch
    5240
    53 # software specific module from flex_extract
     41# software specific modules from flex_extract
    5442sys.path.append('../')
    55 #import profiling
    5643from mods.tools import silent_remove, get_list_as_string
    5744
     
    6148
    6249class UioFiles(object):
    63     '''Class to manipulate files. At initialisation it has the pattern
    64     which stores a regular expression pattern for the files, the path
    65     to the files and the files already.
     50    '''Collection of files matching a specific pattern.
     51
     52    The pattern can contain regular expressions for the files.
     53    The files are listed and can be transformed to a single string or
     54    they can be deleted.
     55
     56    Attributes
     57    ----------
     58    path : str
     59        Directory where to list the files.
     60
     61    pattern : str
     62        Regular expression pattern. For example: '\*.grb'
     63
     64    files : list of str
     65        List of files matching the pattern in the path.
    6666    '''
    6767    # --------------------------------------------------------------------------
    68     # CLASS FUNCTIONS
     68    # CLASS METHODS
    6969    # --------------------------------------------------------------------------
    7070    def __init__(self, path, pattern):
     
    7373        Parameters
    7474        ----------
    75         path : :obj:`string`
     75        path : str
    7676            Directory where to list the files.
    7777
    78         pattern : :obj:`string`
     78        pattern : str
    7979            Regular expression pattern. For example: '\*.grb'
    8080
     
    9292        return
    9393
    94     #@profiling.timefn
     94
    9595    def _list_files(self, path):
    9696        '''Lists all files in the directory with the matching
     
    9999        Parameters
    100100        ----------
    101         path : :obj:`string`
     101        path : str
    102102            Path to the files.
    103103
     
    116116        return
    117117
     118
    118119    def __str__(self):
    119120        '''Converts the list of files into a single string.
     
    125126        Return
    126127        ------
    127         files_string : :obj:`string`
     128        files_string : str
    128129            The content of the list as a single string.
    129130        '''
     
    133134
    134135        return files_string
     136
    135137
    136138    def delete_files(self):
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG