labpack/messaging/telegram.py
def _validate_type(self, file_name, extension_map, method_title, argument_title):

        ''' a helper method to validate extension type of file

        :param file_name: string with file name to test
        :param extension_map: dictionary with extensions names and regex patterns
        :param method_title: string with title of feeder method
        :param argument_title: string with title of argument key from feeder method
        :return: string with file extension
        '''

    # validate file extension
        from labpack.parsing.regex import labRegex
        file_extension = ''
        ext_types = labRegex(extension_map)
        file_mapping = ext_types.map(file_name)[0]
        extension_list = []
        for key, value in file_mapping.items():
            if isinstance(value, bool):
                extension_list.append('.%s' % key)
            if value and isinstance(value, bool):
                file_extension = '.%s' + key
        if not file_extension:
            raise ValueError('%s(%s=%s) must be one of %s file types.' % (method_title, argument_title, file_name, extension_list))

        return file_extension
 a helper method to validate extension type of file

        :param file_name: string with file name to test
        :param extension_map: dictionary with extensions names and regex patterns
        :param method_title: string with title of feeder method
        :param argument_title: string with title of argument key from feeder method
        :return: string with file extension
        
a helper method to validate extension type of file
a helper method to validate extension type of file
def _validate_type(self, file_name, extension_map, method_title, argument_title):
        from labpack.parsing.regex import labRegex
        file_extension = ''
        ext_types = labRegex(extension_map)
        file_mapping = ext_types.map(file_name)[0]
        extension_list = []
        for key, value in file_mapping.items():
            if isinstance(value, bool):
                extension_list.append('.%s' % key)
            if value and isinstance(value, bool):
                file_extension = '.%s' + key
        if not file_extension:
            raise ValueError('%s(%s=%s) must be one of %s file types.' % (method_title, argument_title, file_name, extension_list))
        return file_extension
def _validate_type ( self , file_name , extension_map , method_title , argument_title ) : from labpack . parsing . regex import labRegex file_extension = '' ext_types = labRegex ( extension_map ) file_mapping = ext_types . map ( file_name ) [ 0 ] extension_list = [ ] for key , value in file_mapping . items ( ) : if isinstance ( value , bool ) : extension_list . append ( '.%s' % key ) if value and isinstance ( value , bool ) : file_extension = '.%s' + key if not file_extension : raise ValueError ( '%s(%s=%s) must be one of %s file types.' % ( method_title , argument_title , file_name , extension_list ) ) return file_extension
a helper method to validate extension type of file
a helper method to validate extension type of file
''' a helper method to validate extension type of file

        :param file_name: string with file name to test
        :param extension_map: dictionary with extensions names and regex patterns
        :param method_title: string with title of feeder method
        :param argument_title: string with title of argument key from feeder method
        :return: string with file extension
        ''' # validate file extension

string with file extension
string with file extension
self
file_name
string with file name to test
string with file name to test
extension_map
dictionary with extensions names and regex patterns
dictionary with extensions names and regex patterns
method_title
string with title of feeder method
string with title of feeder method
argument_title
string with title of argument key from feeder method
string with title of argument key from feeder method