Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
MEYc@s¼dZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
i	dd6dd6dd	6d
d6d
d6d
d6d
d6dd6dd6Zidejdƒfd6dejdƒfd6ZdMZdNZejd%ƒZejd&ƒZd'd(d)d*d+d,d-d.d/d0d1d2d3d4gZiZiZd5gZd6d7d8d9d:d;d<d=gZx¦eD]žZgee<gee<x?eD]7Zejeied>6ejƒZeejeƒqªWx?eD]7Zejeied>6ejƒZeejeƒqìWq‰Wd?„Ze e d@„Z!dA„Z"de dB„Z#ddCdD„Z%dEdF„Z&dEdG„Z'dH„Z(ddIddJ„Z)dde dK„Z*dL„Z+dS(Os.
System-level utilities and helper functions.
iÿÿÿÿN(turllib(t_(tencodeutilsitktKtKiitMtMiitGtGiitTtTiis&(^[-+]?\d*\.?\d+)([KMGT]i?)?(b|bit|B)$tIECiès$(^[-+]?\d*\.?\d+)([kMGT])?(b|bit|B)$tSIt1ttttruetontytyest0tftfalsetofftntnos[^\w\s-]s[-\s]+t	adminPasst
admin_passtpasswordtadmin_passwordt
auth_tokentnew_passt
auth_passwordtsecret_uuidtsecrettsys_pswdttokentconfigdrivetCHAPPASSWORDt
encrypted_keys(%(key)s\s*[=]\s*)[^\s^\'^\"]+s((%(key)s\s*[=]\s*[\"\'])[^\"\']*([\"\'])s"(%(key)s\s+[\"\'])[^\"\']*([\"\'])s'([-]{2}%(key)s\s+)[^\'^\"^=^\s]+([\s]*)s(<%(key)s>)[^<]*(</%(key)s>)s2([\"\']%(key)s[\"\']\s*:\s*[\"\'])[^\"\']*([\"\'])s6([\'"][^"\']*%(key)s[\'"]\s*:\s*u?[\'"])[^\"\']*(['"])sG([\'"][^\'"]*%(key)s[\'"]\s*,\s*\'--?[A-z]+\'\s*,\s*u?['"])[^"']*(['"])s (%(key)s\s*--?[A-z]+\s*)\S+(\s*)tkeycCstt|ƒƒS(såInterpret a string as a boolean and return either 1 or 0.

    Any string value in:

        ('True', 'true', 'On', 'on', '1')

    is interpreted as a boolean True.

    Useful for JSON-decoded stuff and config file parsing
    (tinttbool_from_string(tsubject((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytint_from_bool_as_stringcscCsÇt|tƒr|St|tjƒs7tj|ƒ}n|jƒjƒ}|tkrYtS|t	krit
S|r¿djd„ttt	ƒDƒƒ}t
dƒi|d6|d6}t|ƒ‚n|SdS(s½Interpret a subject as a boolean.

    A subject can be a boolean, a string or an integer. Boolean type value
    will be returned directly, otherwise the subject will be converted to
    a string. A case-insensitive match is performed such that strings
    matching 't','true', 'on', 'y', 'yes', or '1' are considered True and,
    when `strict=False`, anything else returns the value specified by
    'default'.

    Useful for JSON-decoded stuff and config file parsing.

    If `strict=True`, unrecognized values, including None, will raise a
    ValueError which is useful when parsing values passed in from an API call.
    Strings yielding False are 'f', 'false', 'off', 'n', 'no', or '0'.
    s, css|]}d|VqdS(s'%s'N((t.0ts((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pys	<genexpr>ŽssCUnrecognized value '%(val)s', acceptable values are: %(acceptable)stvalt
acceptableN(t
isinstancetbooltsixtstring_typest	text_typetstriptlowertTRUE_STRINGStTruet
FALSE_STRINGStFalsetjointsortedRt
ValueError(R+tstricttdefaulttloweredR0tmsg((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pyR*qs"	
cCs tt}t|ƒjƒ|kS(sÖCheck if the provided string is a valid bool string or not.

    :param value: value to verify
    :type value: string
    :returns: true if value is boolean string, false otherwise

    .. versionadded:: 3.17
    (R8R:tstrR7(tvaluetboolstrs((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytis_valid_boolstr—s	
c
Csyt|\}}Wn-tk
rCtdƒ|}t|ƒ‚nX|j|ƒ}|r¢t|jdƒƒ}|jdƒ}|jdƒd	kr¾|d:}q¾ntdƒ|}t|ƒ‚|sÍ|}	n|t|t|ƒ}	|rýt	t
j|	ƒƒS|	S(
sãConverts a string into an float representation of bytes.

    The units supported for IEC ::

        Kb(it), Kib(it), Mb(it), Mib(it), Gb(it), Gib(it), Tb(it), Tib(it)
        KB, KiB, MB, MiB, GB, GiB, TB, TiB

    The units supported for SI ::

        kb(it), Mb(it), Gb(it), Tb(it)
        kB, MB, GB, TB

    Note that the SI unit system does not support capital letter 'K'

    :param text: String input for bytes size conversion.
    :param unit_system: Unit system for byte size conversion.
    :param return_int: If True, returns integer representation of text
                       in bytes. (default: decimal)
    :returns: Numerical representation of text in bytes.
    :raises ValueError: If text has an invalid value.

    sInvalid unit system: "%s"iiitbtbitisInvalid string format: %s(RGsbit(tUNIT_SYSTEM_INFOtKeyErrorRR>tmatchtfloattgrouptpowtUNIT_PREFIX_EXPONENTR)tmathtceil(
ttexttunit_systemt
return_inttbasetreg_exRBRKt	magnitudetunit_prefixtres((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytstring_to_bytes¤s&
	R?cCsjtj|||ƒ}tjd|ƒjddƒjdƒ}tjd|ƒjƒj	ƒ}t
jd|ƒS(sÙNormalize string.

    Convert to lowercase, remove non-word characters, and convert spaces
    to hyphens.

    Inspired by Django's `slugify` filter.

    :param value: Text to slugify
    :param incoming: Text's current encoding
    :param errors: Errors handling policy. See here for valid
        values http://docs.python.org/2/library/codecs.html
    :returns: slugified unicode representation of `value`
    :raises TypeError: If text is not an instance of str
    tNFKDtasciitignorett-(Rtsafe_decodetunicodedatat	normalizetencodetdecodetSLUGIFY_STRIP_REtsubR6R7tSLUGIFY_HYPHENATE_RE(RDtincomingterrors((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytto_slugÒs
s***cCs·ytj|ƒ}Wntk
r&nXd|}d|d}xqtD]i}||krFx't|D]}tj|||ƒ}qcWx*t|D]}tj|||ƒ}qWqFqFW|S(sÙReplace password with *secret* in message.

    :param message: The string which includes security information.
    :param secret: value with which to replace passwords.
    :returns: The unicode value of message with the password fields masked.

    For example:

    >>> mask_password("'adminPass' : 'aaaaa'")
    "'adminPass' : '***'"
    >>> mask_password("'admin_pass' : 'aaaaa'")
    "'admin_pass' : '***'"
    >>> mask_password('"password" : "aaaaa"')
    '"password" : "***"'
    >>> mask_password("'original_password' : 'aaaaa'")
    "'original_password' : '***'"
    >>> mask_password("u'original_password' :   u'aaaaa'")
    "u'original_password' :   u'***'"

    .. versionadded:: 0.2

    .. versionchanged:: 1.1
       Replace also ``'auth_token'``, ``'new_pass'`` and ``'auth_password'``
       keys.

    .. versionchanged:: 1.1.1
       Replace also ``'secret_uuid'`` key.

    .. versionchanged:: 1.5
       Replace also ``'sys_pswd'`` key.

    .. versionchanged:: 2.6
       Replace also ``'token'`` key.

    .. versionchanged:: 2.7
       Replace also ``'secret'`` key.

    .. versionchanged:: 3.4
       Replace also ``'configdrive'`` key.

    .. versionchanged:: 3.8
       Replace also ``'CHAPPASSWORD'`` key.
    s\g<1>s\g<2>(R3R5tUnicodeDecodeErrort_SANITIZE_KEYSt_SANITIZE_PATTERNS_2treRft_SANITIZE_PATTERNS_1(tmessageR"tsubstitute1tsubstitute2R(tpattern((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pyt
mask_passwordøs-


 cCsÙt|tƒs(tdt|ƒƒ‚ntj|ƒ}x›|jƒD]\}}t|tƒr{t|d|ƒ||<qDnxStD] }||kr‚|||<Pq‚q‚Wt|t	j
ƒrDt|d|ƒ||<qDqDW|S(s›Replace password with *secret* in a dictionary recursively.

    :param dictionary: The dictionary which includes secret information.
    :param secret: value with which to replace secret information.
    :returns: The dictionary with string substitutions.

    A dictionary (which may contain nested dictionaries) contains
    information (such as passwords) which should not be revealed, and
    this function helps detect and replace those with the 'secret'
    provided (or `***` if none is provided).

    Substitution is performed in one of three situations:

    If the key is something that is considered to be indicative of a
    secret, then the corresponding value is replaced with the secret
    provided (or `***` if none is provided).

    If a value in the dictionary is a string, then it is masked
    using the ``mask_password()`` function.

    Finally, if a value is a dictionary, this function will
    recursively mask that dictionary as well.

    For example:

    >>> mask_dict_password({'password': 'd81juxmEW_',
    >>>                     'user': 'admin',
    >>>                     'home-dir': '/home/admin'},
    >>>                     '???')
    {'password': '???', 'user': 'admin', 'home-dir': '/home/admin'}

    For example (the value is masked using mask_password())

    >>> mask_dict_password({'password': '--password d81juxmEW_',
    >>>                     'user': 'admin',
    >>>                     'home-dir': '/home/admin'},
    >>>                     '???')
    {'password': '--password ???', 'user': 'admin',
     'home-dir': '/home/admin'}


    For example (a nested dictionary is masked):

    >>> mask_dict_password({"nested": {'password': 'd81juxmEW_',
    >>>                     'user': 'admin',
    >>>                     'home': '/home/admin'}},
    >>>                     '???')
    {"nested": {'password': '???', 'user': 'admin', 'home': '/home/admin'}}

    .. versionadded:: 3.4

    s&Expected a dictionary, got %s instead.R"(R1tdictt	TypeErrorttypetcopytdeepcopytitemstmask_dict_passwordRlR3R4Rt(t
dictionaryR"toutRtvtsani_key((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pyR{<s6

cCsEy&tjt|ƒƒtj|ƒkSWnttfk
r@tSXdS(sžCheck if a value looks like an integer with base 10.

    :param val: Value to verify
    :type val: string
    :returns: bool

    .. versionadded:: 1.1
    N(R3R5R)RvR>R;(R/((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytis_int_likeŠs	&icCsÜ|dkr|}nt|tjƒsFtdƒ|}t|ƒ‚nt|ƒ}||kr’tdƒi|d6|d6|d6}t|ƒ‚n|rØ||krØtdƒi|d6|d6|d6}t|ƒ‚ndS(	s:Check the length of specified string.

    :param value: the value of the string
    :param name: the name of the string
    :param min_length: the min_length of the string
    :param max_length: the max_length of the string
    :raises TypeError, ValueError: For any invalid input.

    .. versionadded:: 3.7
    s%s is not a string or unicodes=%(name)s has %(length)s characters, less than %(min_length)s.tnametlengtht
min_lengths=%(name)s has %(length)s characters, more than %(max_length)s.t
max_lengthN(tNoneR1R3R4RRvtlenR>(RDRRƒR„RBR‚((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytcheck_string_length™s 			c
Cs´|s|}n||krBttdƒi|d6|d6ƒ‚n|r×|jd|ƒ}|d7}|d7}t|ƒ}|ds¯||ks¯||ks¯d|d|!krttdƒtjj|ƒƒ‚qnª|d7}|d7}|jd|ƒ}t|ƒ}|ds\||ks\||dks\d|d|!ks\||dkr||rttdƒtjj|ƒƒ‚n|d|!}|jd	g|dt|ƒƒ|S(
sAValidate and split the given HTTP request path.

    **Examples**::

        ['a'] = _split_path('/a')
        ['a', None] = _split_path('/a', 1, 2)
        ['a', 'c'] = _split_path('/a/c', 1, 2)
        ['a', 'c', 'o/r'] = _split_path('/a/c/o/r', 1, 3, True)

    :param path: HTTP Request path to be split
    :param minsegs: Minimum number of segments to be extracted
    :param maxsegs: Maximum number of segments to be extracted
    :param rest_with_last: If True, trailing data will be returned as part
                           of last segment.  If False, and there is
                           trailing data, raises ValueError.
    :returns: list of segments with a length of maxsegs (non-existent
              segments will return as None)
    :raises: ValueError if given an invalid path

    .. versionadded:: 3.11
    s%minsegs > maxsegs: %(min)d > %(max)d)tmintmaxt/iiR^sInvalid path: %sN(	R>RtsplitR†RtparsetquotetextendR…(tpathtminsegstmaxsegstrest_with_lasttsegstcount((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pyt
split_path¹s0	

"(

&%
"cCstjddddƒtjtjddƒB}tjtj|ƒtj}yt|j|ƒƒSWn$tj	k
rˆt
d|ƒ‚nXdS(	s{Split values by commas and quotes according to api-wg

    :param value: value to be split

    .. versionadded:: 3.17
    t	quoteChart"tescChars\texcludeCharss",sInvalid value: %sN(tpptQuotedStringtWordt
printableststringStartt
delimitedListt	stringEndtlisttparseStringtParseExceptionR>(RDtwordtgrammar((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pytsplit_by_commasês(RRstruesonRsyes(RRsfalsesoffRsno(,t__doc__RxRPRnRat	pyparsingRšR3t	six.movesRtoslo_utils._i18nRt
oslo_utilsRROtcompileRIR8R:ReRgRlRmRot_FORMAT_PATTERNS_1t_FORMAT_PATTERNS_2R(RstDOTALLRVtappendR,R;R*RFRZR…RjRtR{R€R‡R•R¦(((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/strutils.pyt<module>sz
		



 
 	&	
.&DN	 1