Changeset ff99eae in flex_extract.git for python/UioFiles.py


Ignore:
Timestamp:
Jun 1, 2018, 8:34:59 PM (3 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev, feature/makefiles, origin/task/language-editing, task/language-editing
Children:
e1228f3
Parents:
ccab809
Message:

completed application of pep8 style guide and pylint investigations. added documentation almost everywhere

File:
1 moved

Legend:

Unmodified
Added
Removed
  • python/UioFiles.py

    r991df6a rff99eae  
    11#!/usr/bin/env python
    22# -*- coding: utf-8 -*-
    3 #************************************************************************
    4 # TODO AP
    5 # - checken welche regelmässigen methoden auf diese Files noch angewendet werden
    6 # und dann hier implementieren
    7 # cleanup hier rein
    8 #************************************************************************
    93#*******************************************************************************
    104# @Author: Anne Fouilloux (University of Oslo)
     
    159#
    1610#    November 2015 - Leopold Haimberger (University of Vienna):
    17 #        - modified method listFiles to work with glob instead of listdir
    18 #        - added pattern search in method listFiles
     11#        - modified method list_files to work with glob instead of listdir
     12#        - added pattern search in method list_files
    1913#
    2014#    February 2018 - Anne Philipp (University of Vienna):
    2115#        - applied PEP8 style guide
    2216#        - added documentation
    23 #        - optimisation of method listFiles since it didn't work correctly
     17#        - optimisation of method list_files since it didn't work correctly
    2418#          for sub directories
    25 #        - additional speed up of method listFiles
     19#        - additional speed up of method list_files
    2620#        - modified the class so that it is initiated with a pattern instead
    2721#          of suffixes. Gives more precision in selection of files.
     
    4034# @Class Content:
    4135#    - __init__
    42 #    - listFiles
    43 #    - deleteFiles
     36#    - list_files
     37#    - delete_files
     38#
     39# @Class Attributes:
     40#    - pattern
     41#    - files
    4442#
    4543#*******************************************************************************
     
    4947# ------------------------------------------------------------------------------
    5048import os
    51 import glob
    5249import fnmatch
    53 import time
    5450
    5551# software specific module from flex_extract
    56 import profiling
    57 from Tools import silentremove
     52#import profiling
     53from tools import silent_remove
    5854
    5955# ------------------------------------------------------------------------------
     
    6157# ------------------------------------------------------------------------------
    6258
    63 class UIOFiles:
     59class UioFiles(object):
    6460    '''
    6561    Class to manipulate files. At initialisation it has the attribute
     
    7672
    7773        @Input:
    78             self: instance of UIOFiles
     74            self: instance of UioFiles
    7975                Description see class documentation.
    8076
     
    8783
    8884        self.pattern = pattern
     85        self.files = None
    8986
    9087        return
    9188
    9289    #@profiling.timefn
    93     def listFiles(self, path, callid=0):
     90    def list_files(self, path, callid=0):
    9491        '''
    9592        @Description:
     
    9895
    9996        @Input:
    100             self: instance of UIOFiles
     97            self: instance of UioFiles
    10198                Description see class documentation.
    10299
     
    132129        if subdirs:
    133130            for subdir in subdirs:
    134                 self.listFiles(os.path.join(path, subdir), callid=1)
     131                self.list_files(os.path.join(path, subdir), callid=1)
    135132
    136133        return
    137134
    138     def deleteFiles(self):
     135    def delete_files(self):
    139136        '''
    140137        @Description:
     
    142139
    143140        @Input:
    144             self: instance of UIOFiles
     141            self: instance of UioFiles
    145142                Description see class documentation.
    146143
     
    149146        '''
    150147
    151         for f in self.files:
    152             silentremove(f)
     148        for old_file in self.files:
     149            silent_remove(old_file)
    153150
    154151        return
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG