/usr/local/lib/python3.6/site-packages/attr/__pycache__
NameSizeModeActions
converters.cpython-36.pyc34730644editdlrm
exceptions.cpython-36.pyc31680644editdlrm
filters.cpython-36.pyc15840644editdlrm
setters.cpython-36.pyc14700644editdlrm
validators.cpython-36.pyc207030644editdlrm
_cmp.cpython-36.pyc36910644editdlrm
_compat.cpython-36.pyc40570644editdlrm
_config.cpython-36.pyc9500644editdlrm
_funcs.cpython-36.pyc102130644editdlrm
_make.cpython-36.pyc731880644editdlrm
_next_gen.cpython-36.pyc51430644editdlrm
_version_info.cpython-36.pyc22750644editdlrm
__init__.cpython-36.pyc21120644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/attr/__pycache__/converters.cpython-36.pyc (3473B)
3 8%Eg@sZdZddlZddlmZddlmZmZmZdddd gZd dZ edfd dZ d d Z dS) z Commonly useful converters. N)_AnnotationExtractor)NOTHINGFactorypipedefault_if_noneoptionalrto_boolcsPfdd}t}|j}|r0tj||jd<|j}|rLtj||jd<|S)aO A converter that allows an attribute to be optional. An optional attribute is one which can be set to ``None``. Type annotations will be inferred from the wrapped converter's, if it has any. :param callable converter: the converter that is used for non-``None`` values. .. versionadded:: 17.1.0 cs|dkr dS|S)N)val) converterr 9/usr/local/lib/python3.6/site-packages/attr/converters.pyoptional_converter$sz$optional..optional_converterr return)rZget_first_param_typetypingOptional__annotations__Zget_return_type)r rZxtrtrtr )r r rs csvtkr|dkrtdtk r0|dk r0td|dk r@t|ttrfjrXtdfdd}n fdd}|S)a A converter that allows to replace ``None`` values by *default* or the result of *factory*. :param default: Value to be used if ``None`` is passed. Passing an instance of `attrs.Factory` is supported, however the ``takes_self`` option is *not*. :param callable factory: A callable that takes no parameters whose result is used if ``None`` is passed. :raises TypeError: If **neither** *default* or *factory* is passed. :raises TypeError: If **both** *default* and *factory* are passed. :raises ValueError: If an instance of `attrs.Factory` is passed with ``takes_self=True``. .. versionadded:: 18.2.0 Nz(Must pass either `default` or `factory`.z5Must pass either `default` or `factory` but not both.z1`takes_self` is not supported by default_if_none.cs|dk r |SjS)N)factory)r )defaultr r default_if_none_converterYsz2default_if_none..default_if_none_convertercs|dk r |SS)Nr )r )rr r ras)r TypeErrorr isinstanceZ takes_self ValueError)rrrr )rr r6s  c Cs~t|tr|j}ddddddddh}d d d d d dddh}y||krHdS||krTd SWntk rjYnXtd|dS)a Convert "boolean" strings (e.g., from env. vars.) to real booleans. Values mapping to :code:`True`: - :code:`True` - :code:`"true"` / :code:`"t"` - :code:`"yes"` / :code:`"y"` - :code:`"on"` - :code:`"1"` - :code:`1` Values mapping to :code:`False`: - :code:`False` - :code:`"false"` / :code:`"f"` - :code:`"no"` / :code:`"n"` - :code:`"off"` - :code:`"0"` - :code:`0` :raises ValueError: for any other value. .. versionadded:: 21.3.0 Ttrueryesyon1rFfalsefnonoff0rzCannot convert value to bool: N)rstrlowerrr)r ZtruthyZfalsyr r r r js ) __doc__rZ_compatr_makerrr__all__rrr r r r r s  4