&`5 RdZddlmZddlmZmZdZdZdZ dZ dZ d Z d Z d Zy) zn oauthlib.utils ~~~~~~~~~~~~~~ This module contains utility methods used by various parts of the OAuth spec. N)quoteunquote>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c4fd}j|_|S)zDecorator which filters params to remove non-oauth_* parameters Assumes the decorated method takes a params dict or list of tuples as its first argument. c2t|}|g|i|S)N)filter_oauth_params)paramsargskwargstargets ?/usr/lib/python3/dist-packages/oauthlib/oauth1/rfc5849/utils.pywrapperzfilter_params..wrappers"$V,f.t.v..)__doc__)r rs` r filter_paramsrs /nnGO Nrc d}t|tr,tt|t|j Stt||S)zARemoves all non oauth parameters from a dict or a list of params.c*|djdS)Nroauth_) startswith)kvs r z%filter_oauth_params..!s"Q%**84r) isinstancedictlistfilteritems)r is_oauths r rrs@4H&$F8T&,,.%9:;;F8V,--rc t|ts'tddj|t |zt |dS)zEscape a unicode string in an OAuth-compatible fashion. Per `section 3.6`_ of the spec. .. _`section 3.6`: https://tools.ietf.org/html/rfc5849#section-3.6 z$Only unicode objects are escapable. zGot {!r} of type {}.~)safe)rstr ValueErrorformattyperus r escaper'(sI a ?/66q$q'BCD D  rcNt|ts tdt|S)Nz%Only unicode objects are unescapable.)rr!r"rr%s r unescaper)8s" a @AA 1:rc,tj|S)z1A unicode-safe version of urllib2.parse_keqv_list)urllib2parse_keqv_list)ls r r,r,>  " "1 %%rc,tj|S)z1A unicode-safe version of urllib2.parse_http_list)r+parse_http_listr%s r r0r0Dr.rc@dj}|dt|jj|r:t|t|d} t t |j Std#ttf$r YtdwxYw)z;Parse an OAuth authorization header into a list of 2-tupleszOAuth NzMalformed authorization header) lowerlenrr0rr,r IndexErrorr")authorization_header auth_schemers r parse_authorization_headerr7Js.."K-S-.446AA+N 4S5E5F GH .4467 7 5 66J'   5 66 s!BBB)rurllib.requestrequestr+oauthlib.commonrrUNICODE_ASCII_CHARACTER_SETrrr'r)r,r0r7rr r=s=!* , .   & & 7r