Remove keyword arguments not used by `requests`
775623
def _sanitize_request_params(self, request_params):
        """"""
        if 'verify_ssl' in request_params:
            request_params['verify'] = request_params.pop('verify_ssl')
        return dict((key, val) for key, val in request_params.items()
                    if key in self._VALID_REQUEST_ARGS)
1206690
def cleanup_request(request):
        
        for method_type in ('GET', 'PUT', 'POST', 'DELETE'):
            block = getattr(request, method_type, { })

            if True in [ k.startswith("oauth_") for k in block.keys() ]:
                sanitized = block.copy()

                for k in sanitized.keys():
                    if k.startswith("oauth_"):
                        sanitized.pop(k)

                setattr(request, method_type, sanitized)

        return request
1027937
def _clean_params(self, params):
        
        clean_params = {}
        for key, value in params.iteritems():
            if value is not None:
                clean_params[key] = value

        return clean_params
315827
def RemoveClientKeyword(self, client_id, keyword):
    """"""
    if keyword in self.keywords and client_id in self.keywords[keyword]:
      del self.keywords[keyword][client_id]
483801
def _strip_empty_keys(self, params):
        
        keys = [k for k, v in params.items() if v == '']
        for key in keys:
            del params[key]
632300
def remove_excluded(self):
        
        # import yaml
        # print yaml.dump({k:v.__json__() for k,v in self.sources.items()}, default_flow_style=False)
        sources = list(self.sources.values())
        for src in sources:
            if src.excluded:
                del self.sources[src.name]
            src.imports = [m for m in src.imports if not self._exclude(m)]
            src.imported_by = [m for m in src.imported_by if not self._exclude(m)]
1004936
def _strip_undefok_args(undefok, args):
  """"""
  if undefok:
    undefok_names = set(name.strip() for name in undefok.split(','))
    undefok_names |= set('no' + name for name in undefok_names)
    # Remove undefok flags.
    args = [arg for arg in args if not _is_undefok(arg, undefok_names)]
  return args
442650
def _extract_extra_keywords(self,params):
        
        extra_keywords = {}
        overridden_object_params = list(self._overridden.param)
        for name, val in params.items():
            if name not in overridden_object_params:
                extra_keywords[name]=val
                # CEBALERT: should we remove name from params
                # (i.e. del params[name]) so that it's only available
                # via extra_keywords()?
        return extra_keywords
789597
def exclude(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=True, *args, **kwargs)
824309
def remove_request(self, uuid):
        
        for key in list(self._request):
            if self._request[key] == uuid:
                del self._request[key]
24765
def cleanup(self):
        ''' '''
        allList = []
        allList.extend(self.cur.execute("SELECT keywordid FROM keyword;"))
        usedList = []
        usedList.extend(self.cur.execute("SELECT keywordid FROM notekeyword;"))
        unusedList = [val for val in allList if val not in usedList]
        for key in unusedList:
            if self.debug:
                print("About to delete keyword with ID %s" % key)
            try:
                self.cur.execute("DELETE FROM keyword WHERE keywordId = ?;", key)
            except:
                self.error("There was a problem deleting keyword %s" % key)
        self.con.commit()
1310338
def pop_kwargs_with_prefix(prefix: str, kwargs: dict) -> dict:
    
    keys = [key for key in kwargs if key.startswith(prefix)]
    return {key[len(prefix):]: kwargs.pop(key) for key in keys}
445717
def clean_locals(data):
    
    if data.get('params') is not None:
        return data.get('params')
    else:
        return {
            to_camel_case(k): v for k, v in data.items() if v is not None and k not in
            ['self', 'session', 'params', 'lightweight']
        }
1366280
def delete_favorite_query(arg, **_):
    
    usage = 'Syntax: \\fd name.\n\n' + favoritequeries.usage
    if not arg:
        return [(None, None, None, usage)]

    status = favoritequeries.delete(arg)

    return [(None, None, None, status)]
1233748
def remove_post_data_parameters(request, post_data_parameters_to_remove):
    
    replacements = [(k, None) for k in post_data_parameters_to_remove]
    return replace_post_data_parameters(request, replacements)
570562
def _clean_kwargs(self, kwargs, fn):
        '''
        
        '''
        # Do not do the cleaning if server config
        # doesnt ask to ignore
        if not self.server.IGNORE_UNEXPECTED_KWARGS:
            return kwargs

        expected_kwargs = set(inspect.getargspec(fn).args)
        got_kwargs = set(kwargs.keys())
        unexpected_kwargs = got_kwargs - expected_kwargs
        for k in unexpected_kwargs:
            del kwargs[k]

        return kwargs
686358
def parse_filters_kwargs(request, client_keywords=None):
    
    filters = {}
    kwargs = {}
    client_keywords = client_keywords or {}
    for param in request.GET:
        param_value = PARAM_MAPPING.get(request.GET[param], request.GET[param])
        if param in client_keywords:
            kwargs[param] = param_value
        else:
            filters[param] = param_value
    return filters, kwargs