gbdx_task_template/port.py
def list_files(self, extensions=None):
        """
        List the ports contents by file type or all.
        :param extensions: string extensions, single string or list of extensions.
        :return: A list of full path names of each file.
        """
        if self.type.lower() != 'directory':
            raise ValueError("Port type is not == directory")

        filesystem_location = self.path

        for root, dirs, files in os.walk(filesystem_location):
            if extensions is None:
                return [os.path.join(root, f) for f in files]
            elif not isinstance(extensions, list):
                extensions = [extensions]

            subset_files = []

            for f in files:
                for extension in extensions:
                    if f.lower().endswith(extension.lower()):
                        subset_files.append(os.path.join(root, f))
                        break
            return subset_files
def list_files(self, extensions=None):
        """
        List the ports contents by file type or all.
        :param extensions: string extensions, single string or list of extensions.
        :return: A list of full path names of each file.
        """
        if self.type.lower() != 'directory':
            raise ValueError("Port type is not == directory")

        filesystem_location = self.path

        for root, dirs, files in os.walk(filesystem_location):
            if extensions is None:
                return [os.path.join(root, f) for f in files]
            elif not isinstance(extensions, list):
                extensions = [extensions]

            subset_files = []

            for f in files:
                for extension in extensions:
                    if f.lower().endswith(extension.lower()):
                        subset_files.append(os.path.join(root, f))
                        break
            return subset_files
def list_files ( self , extensions = None ) : if self . type . lower ( ) != 'directory' : raise ValueError ( "Port type is not == directory" ) filesystem_location = self . path for root , dirs , files in os . walk ( filesystem_location ) : if extensions is None : return [ os . path . join ( root , f ) for f in files ] elif not isinstance ( extensions , list ) : extensions = [ extensions ] subset_files = [ ] for f in files : for extension in extensions : if f . lower ( ) . endswith ( extension . lower ( ) ) : subset_files . append ( os . path . join ( root , f ) ) break return subset_files
List the ports contents by file type or all.
        :param extensions: string extensions, single string or list of extensions.
        :return: A list of full path names of each file.
List the ports contents by file type or all . : param extensions : string extensions single string or list of extensions . : return : A list of full path names of each file .