labpack/platforms/localhost.py
def metadata(self, file_path):

        ''' a method to retrieve the metadata of a file on the localhost

        :param file_path: string with path to file
        :return: dictionary with file properties
        '''

        __name__ = '%s.metadata(...)' % self.__class__.__name__

    # validate input
        self.fields.validate(file_path, '.file_path')
        file_exists = False
        if os.path.exists(file_path):
            if os.path.isfile(file_path):
                file_exists = True
        if not file_exists:
            err_msg = __name__.replace('...', 'file_path=%s' % file_path)
            raise ValueError('%s must be a valid file.' % err_msg)

    # construct metadata dictionary
        abs_path = os.path.abspath(file_path)
        file_stats = os.stat(file_path)
        file_metadata = {
            'path_segments': abs_path.split(os.sep),
            'file_name': os.path.split(abs_path)[1],
            'file_path': abs_path,
            'file_size': file_stats.st_size,
            'create_date': file_stats.st_ctime,
            'update_date': file_stats.st_mtime,
            'access_date': file_stats.st_atime
        }

        return file_metadata
 a method to retrieve the metadata of a file on the localhost

        :param file_path: string with path to file
        :return: dictionary with file properties
        
a method to retrieve the metadata of a file on the localhost
a method to retrieve the metadata of a file on the localhost
def metadata(self, file_path):
        __name__ = '%s.metadata(...)' % self.__class__.__name__
        self.fields.validate(file_path, '.file_path')
        file_exists = False
        if os.path.exists(file_path):
            if os.path.isfile(file_path):
                file_exists = True
        if not file_exists:
            err_msg = __name__.replace('...', 'file_path=%s' % file_path)
            raise ValueError('%s must be a valid file.' % err_msg)
        abs_path = os.path.abspath(file_path)
        file_stats = os.stat(file_path)
        file_metadata = {
            'path_segments': abs_path.split(os.sep),
            'file_name': os.path.split(abs_path)[1],
            'file_path': abs_path,
            'file_size': file_stats.st_size,
            'create_date': file_stats.st_ctime,
            'update_date': file_stats.st_mtime,
            'access_date': file_stats.st_atime
        }
        return file_metadata
def metadata ( self , file_path ) : __name__ = '%s.metadata(...)' % self . __class__ . __name__ self . fields . validate ( file_path , '.file_path' ) file_exists = False if os . path . exists ( file_path ) : if os . path . isfile ( file_path ) : file_exists = True if not file_exists : err_msg = __name__ . replace ( '...' , 'file_path=%s' % file_path ) raise ValueError ( '%s must be a valid file.' % err_msg ) abs_path = os . path . abspath ( file_path ) file_stats = os . stat ( file_path ) file_metadata = { 'path_segments' : abs_path . split ( os . sep ) , 'file_name' : os . path . split ( abs_path ) [ 1 ] , 'file_path' : abs_path , 'file_size' : file_stats . st_size , 'create_date' : file_stats . st_ctime , 'update_date' : file_stats . st_mtime , 'access_date' : file_stats . st_atime } return file_metadata
a method to retrieve the metadata of a file on the localhost
a method to retrieve the metadata of a file on the localhost
''' a method to retrieve the metadata of a file on the localhost

        :param file_path: string with path to file
        :return: dictionary with file properties
        ''' # validate input # construct metadata dictionary
dictionary with file properties
dictionary with file properties
self
file_path
string with path to file
string with path to file