�
&�`5
� �T � d Z ddlmZ ddlmZmZ dZd� Zd� Z d� Z
d� Zd � Zd
� Z
d� ZdS )zn
oauthlib.utils
~~~~~~~~~~~~~~
This module contains utility methods used by various parts of the OAuth
spec.
� N)�quote�unquote�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c �* � � � fd�}� j |_ |S )z�Decorator which filters params to remove non-oauth_* parameters
Assumes the decorated method takes a params dict or list of tuples as its
first argument.
c �: �� t | � � } �| g|�R i |��S )N)�filter_oauth_params)�params�args�kwargs�targets ��?/usr/lib/python3/dist-packages/oauthlib/oauth1/rfc5849/utils.py�wrapperzfilter_params.<locals>.wrapper s0 �� �$�V�,�,���v�f�.�t�.�.�.�v�.�.�.� )�__doc__)r r s ` r
�
filter_paramsr s, �� �/� /� /� /� /� �n�G�O��Nr c �� � d� }t | t � � r<t t |t | � � � � � � � � � S t t || � � � � S )zARemoves all non oauth parameters from a dict or a list of params.c �8 � | d � d� � S )Nr �oauth_)�
startswith)�kvs r
�<lambda>z%filter_oauth_params.<locals>.<lambda>! s � �"�Q�%�*�*�8�4�4� r )�
isinstance�dict�list�filter�items)r �is_oauths r
r r s\ � �4�4�H��&�$��� .��F�8�T�&�,�,�.�.�%9�%9�:�:�;�;�;��F�8�V�,�,�-�-�-r c � � t | t � � s3t dd� | t | � � � � z � � �t | d�� � S )z�Escape 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)r �str�
ValueError�format�typer ��us r
�escaper' |