lib/schema/request.py
def to_json(self):
        '''
        Generates and returns a `dict` representing all stored parameters, for
        use in sending the request.
        This will additionally validate all parameters, and generate defaults
        for any missing ones.
        '''
        file_path = self.file_path
        file_contents = self.file_contents
        file_types = self.file_types
        line_num = self.line_num
        column_num = self.column_num
        extra_params = self._extra_params
        force_semantic = self._force_semantic

        # validate
        if not file_path:
            raise ValueError('no file path specified')
        if not isinstance(file_path, str):
            raise TypeError('file path must be a str: %r' % (file_path))

        if not file_contents:
            file_contents = ''
        if not isinstance(file_contents, str):
            raise TypeError(
                'file contents must be a str: %r' % (file_contents)
            )

        if file_types is None:
            file_types = []
        if not isinstance(file_types, (tuple, list)):
            raise TypeError('file types must be a list: %r' % (file_types))

        if line_num is None:
            line_num = 1
        if not isinstance(line_num, int):
            raise TypeError('line num must be an int: %r' % (line_num))

        if column_num is None:
            column_num = 1
        if not isinstance(column_num, int):
            raise TypeError('column num must be an int: %r' % (column_num))

        optional_params = {}
        if force_semantic is not None:
            if not isinstance(force_semantic, bool):
                raise TypeError(
                    'force-semantic must be a bool: %r' % (force_semantic)
                )

            optional_params['force_semantic'] = force_semantic

        if extra_params is None:
            extra_params = {}
        if not isinstance(extra_params, dict):
            raise TypeError(
                'extra parameters must be a dict: %r' % (extra_params)
            )

        json_params = {
            'filepath': file_path,
            'file_data': {
                file_path: {
                    'filetypes': file_types,
                    'contents': file_contents,
                },
            },

            'line_num': line_num,
            'column_num': column_num,
        }
        json_params.update(optional_params)
        json_params.update(extra_params)

        return json_params

        Generates and returns a `dict` representing all stored parameters, for
        use in sending the request.
        This will additionally validate all parameters, and generate defaults
        for any missing ones.
        
Generates and returns a `dict` representing all stored parameters, for
use in sending the request.
This will additionally validate all parameters, and generate defaults
for any missing ones.
Generates and returns a ` dict ` representing all stored parameters for use in sending the request . This will additionally validate all parameters and generate defaults for any missing ones .
def to_json(self):
        file_path = self.file_path
        file_contents = self.file_contents
        file_types = self.file_types
        line_num = self.line_num
        column_num = self.column_num
        extra_params = self._extra_params
        force_semantic = self._force_semantic
        if not file_path:
            raise ValueError('no file path specified')
        if not isinstance(file_path, str):
            raise TypeError('file path must be a str: %r' % (file_path))
        if not file_contents:
            file_contents = ''
        if not isinstance(file_contents, str):
            raise TypeError(
                'file contents must be a str: %r' % (file_contents)
            )
        if file_types is None:
            file_types = []
        if not isinstance(file_types, (tuple, list)):
            raise TypeError('file types must be a list: %r' % (file_types))
        if line_num is None:
            line_num = 1
        if not isinstance(line_num, int):
            raise TypeError('line num must be an int: %r' % (line_num))
        if column_num is None:
            column_num = 1
        if not isinstance(column_num, int):
            raise TypeError('column num must be an int: %r' % (column_num))
        optional_params = {}
        if force_semantic is not None:
            if not isinstance(force_semantic, bool):
                raise TypeError(
                    'force-semantic must be a bool: %r' % (force_semantic)
                )
            optional_params['force_semantic'] = force_semantic
        if extra_params is None:
            extra_params = {}
        if not isinstance(extra_params, dict):
            raise TypeError(
                'extra parameters must be a dict: %r' % (extra_params)
            )
        json_params = {
            'filepath': file_path,
            'file_data': {
                file_path: {
                    'filetypes': file_types,
                    'contents': file_contents,
                },
            },
            'line_num': line_num,
            'column_num': column_num,
        }
        json_params.update(optional_params)
        json_params.update(extra_params)
        return json_params
def to_json ( self ) : file_path = self . file_path file_contents = self . file_contents file_types = self . file_types line_num = self . line_num column_num = self . column_num extra_params = self . _extra_params force_semantic = self . _force_semantic if not file_path : raise ValueError ( 'no file path specified' ) if not isinstance ( file_path , str ) : raise TypeError ( 'file path must be a str: %r' % ( file_path ) ) if not file_contents : file_contents = '' if not isinstance ( file_contents , str ) : raise TypeError ( 'file contents must be a str: %r' % ( file_contents ) ) if file_types is None : file_types = [ ] if not isinstance ( file_types , ( tuple , list ) ) : raise TypeError ( 'file types must be a list: %r' % ( file_types ) ) if line_num is None : line_num = 1 if not isinstance ( line_num , int ) : raise TypeError ( 'line num must be an int: %r' % ( line_num ) ) if column_num is None : column_num = 1 if not isinstance ( column_num , int ) : raise TypeError ( 'column num must be an int: %r' % ( column_num ) ) optional_params = { } if force_semantic is not None : if not isinstance ( force_semantic , bool ) : raise TypeError ( 'force-semantic must be a bool: %r' % ( force_semantic ) ) optional_params [ 'force_semantic' ] = force_semantic if extra_params is None : extra_params = { } if not isinstance ( extra_params , dict ) : raise TypeError ( 'extra parameters must be a dict: %r' % ( extra_params ) ) json_params = { 'filepath' : file_path , 'file_data' : { file_path : { 'filetypes' : file_types , 'contents' : file_contents , } , } , 'line_num' : line_num , 'column_num' : column_num , } json_params . update ( optional_params ) json_params . update ( extra_params ) return json_params
Generates and returns a `dict` representing all stored parameters, for
use in sending the request.
Generates and returns a ` dict ` representing all stored parameters for use in sending the request .
'''
        Generates and returns a `dict` representing all stored parameters, for
        use in sending the request.
        This will additionally validate all parameters, and generate defaults
        for any missing ones.
        ''' # validate
self