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:
ó
Z¢`c@sÚdZdZeeeejdƒƒƒZdZddlTde	fd„ƒYZ
d	„Zd
„ZyFyddl
Z
Wnek
r”ddlZ
nXd
„Zee
_Wnek
r»nXyáddlZddlmZddlmZd„Zd„Zd„Zejedƒeƒejedƒeƒeje
eƒeje
eƒeje
eƒeje
eƒd„Zd„Zee
_eeƒe
_Wnek
r°nXedkrÖddl Z e j!ƒndS(s&Init function for bunch python module.s1.0.1t.tBunchtbunchifyt
unbunchifyi(t*cBsSeZdZd„Zd„Zd„Zd„Zd„Zd„Ze	d„ƒZ
RS(s A dictionary that provides attribute-style access.

        >>> b = Bunch()
        >>> b.hello = 'world'
        >>> b.hello
        'world'
        >>> b['hello'] += "!"
        >>> b.hello
        'world!'
        >>> b.foo = Bunch(lol=True)
        >>> b.foo.lol
        True
        >>> b.foo is b['foo']
        True

        A Bunch is a subclass of dict; it supports all the methods a dict does...

        >>> sorted(b.keys())
        ['foo', 'hello']

        Including update()...

        >>> b.update({ 'ponies': 'are pretty!' }, hello=42)
        >>> print (repr(b))
        Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')

        As well as iteration...

        >>> [ (k,b[k]) for k in b ]
        [('ponies', 'are pretty!'), ('foo', Bunch(lol=True)), ('hello', 42)]

        And "splats".

        >>> "The {knights} who say {ni}!".format(**Bunch(knights='lolcats', ni='can haz'))
        'The lolcats who say can haz!'

        See unbunchify/Bunch.toDict, bunchify/Bunch.fromDict for notes about conversion.
    cCs2y#tj||ƒp!t||ƒSWntSXdS(sµ >>> b = Bunch(ponies='are pretty!')
            >>> 'ponies' in b
            True
            >>> 'foo' in b
            False
            >>> b['foo'] = 42
            >>> 'foo' in b
            True
            >>> b.hello = 'hai'
            >>> 'hello' in b
            True
            >>> b[None] = 123
            >>> None in b
            True
            >>> b[False] = 456
            >>> False in b
            True
        N(tdictt__contains__thasattrtFalse(tselftk((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyRLs#cCsXytj||ƒSWn=tk
rSy||SWqTtk
rOt|ƒ‚qTXnXdS(s2 Gets key if it exists, otherwise throws AttributeError.

            nb. __getattr__ is only called if key is not found in normal places.

            >>> b = Bunch(bar='baz', lol={})
            >>> b.foo
            Traceback (most recent call last):
                ...
            AttributeError: foo

            >>> b.bar
            'baz'
            >>> getattr(b, 'bar')
            'baz'
            >>> b['bar']
            'baz'

            >>> b.lol is b['lol']
            True
            >>> b.lol is getattr(b, 'lol')
            True
        N(tobjectt__getattribute__tAttributeErrortKeyError(R	R
((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyt__getattr__es

cCscytj||ƒWn5tk
rKy|||<Wq_t|ƒ‚q_XnXtj|||ƒdS(sb Sets attribute k if it exists, otherwise sets key k. A KeyError
            raised by set-item (only likely if you subclass Bunch) will
            propagate as an AttributeError instead.

            >>> b = Bunch(foo='bar', this_is='useful when subclassing')
            >>> b.values                            #doctest: +ELLIPSIS
            <built-in method values of Bunch object at 0x...>
            >>> b.values = 'uh oh'
            >>> b.values
            'uh oh'
            >>> b['values']
            Traceback (most recent call last):
                ...
            KeyError: 'values'
        N(RRR
t__setattr__(R	R
tv((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyR…s
cCsgytj||ƒWn<tk
rRy||=Wqctk
rNt|ƒ‚qcXnXtj||ƒdS(s2 Deletes attribute k if it exists, otherwise deletes key k. A KeyError
            raised by deleting the key--such as when the key is missing--will
            propagate as an AttributeError instead.

            >>> b = Bunch(lol=42)
            >>> del b.values
            Traceback (most recent call last):
                ...
            AttributeError: 'Bunch' object attribute 'values' is read-only
            >>> del b.lol
            >>> b.lol
            Traceback (most recent call last):
                ...
            AttributeError: lol
        N(RRR
Rt__delattr__(R	R
((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyR s

cCs
t|ƒS(s Recursively converts a bunch back into a dictionary.

            >>> b = Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
            >>> b.toDict()
            {'ponies': 'are pretty!', 'foo': {'lol': True}, 'hello': 42}

            See unbunchify for more info.
        (R(R	((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyttoDict»s	cCs`tt|ƒƒ}|jƒdjg|D]}d|||f^q)ƒ}d|jj|fS(sž Invertible* string-form of a Bunch.

            >>> b = Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
            >>> print (repr(b))
            Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
            >>> eval(repr(b))
            Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')

            (*) Invertible so long as collection contents are each repr-invertible.
        s, s%s=%rs%s(%s)(tlisttiterkeystsorttjoint	__class__t__name__(R	tkeystkeytargs((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyt__repr__Æs
0cCs
t|ƒS(së Recursively transforms a dictionary into a Bunch via copy.

            >>> b = Bunch.fromDict({'urmom': {'sez': {'what': 'what'}}})
            >>> b.urmom.sez.what
            'what'

            See bunchify for more info.
        (R(td((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pytfromDictÖs
(Rt
__module__t__doc__RRRRRRtstaticmethodR(((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyR$s&		 				cCs`t|tƒr)td„t|ƒDƒƒSt|ttfƒrXt|ƒd„|DƒƒS|SdS(s`Recursively transforms a dictionary into a Bunch via copy.

       >>> b = bunchify({'urmom': {'sez': {'what': 'what'}}})
       >>> b.urmom.sez.what
       'what'

       bunchify can handle intermediary dicts, lists and tuples (as well as
       their subclasses), but ymmv on custom datatypes.

       >>> b = bunchify({ 'lol': ('cats', {'hah':'i win again'}),
       ...         'hello': [{'french':'salut', 'german':'hallo'}] })
       >>> b.hello[0].french
       'salut'
       >>> b.lol[1].hah
       'i win again'

       nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
    css'|]\}}|t|ƒfVqdS(N(R(t.0R
R((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pys	<genexpr>þscss|]}t|ƒVqdS(N(R(R#R((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pys	<genexpr>sN(t
isinstanceRRt	iteritemsRttuplettype(tx((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyRês
cCs`t|tƒr)td„t|ƒDƒƒSt|ttfƒrXt|ƒd„|DƒƒS|SdS(säRecursively converts a Bunch into a dictionary.

       >>> b = Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
       >>> unbunchify(b)
       {'ponies': 'are pretty!', 'foo': {'lol': True}, 'hello': 42}

       unbunchify will handle intermediary dicts, lists and tuples (as well as
       their subclasses), but ymmv on custom datatypes.

       >>> b = Bunch(foo=['bar', Bunch(lol=True)], hello=42,
       ...         ponies=('are pretty!', Bunch(lies='are trouble!')))
       >>> unbunchify(b) #doctest: +NORMALIZE_WHITESPACE
       {'ponies': ('are pretty!', {'lies': 'are trouble!'}),
        'foo': ['bar', {'lol': True}], 'hello': 42}

       nb. As dicts are not hashable, they cannot be nested in sets/frozensets.
    css'|]\}}|t|ƒfVqdS(N(R(R#R
R((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pys	<genexpr>scss|]}t|ƒVqdS(N(R(R#R((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pys	<genexpr>sN(R$RR%RR&R'(R(((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyRs
iÿÿÿÿNcKstj||S(s€Serializes this Bunch to JSON. Accepts the same
           keyword options as `json.dumps()`.

           >>> b = Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
           >>> json.dumps(b)
           '{"ponies": "are pretty!", "foo": {"lol": true}, "hello": 42}'
           >>> b.toJSON()
           '{"ponies": "are pretty!", "foo": {"lol": true}, "hello": 42}'
        (tjsontdumps(R	toptions((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyttoJSON&s
(tRepresenter(tSafeRepresenterccs.tƒ}|V|j|ƒ}|j|ƒdS(sPyYAML support for Bunches using the tag `!bunch`
           and `!bunch.Bunch`.

           >>> import yaml
           >>> yaml.load('''
           ... Flow style: !bunch.Bunch { Clark: Evans,
                                          Brian: Ingerson,
                                          Oren: Ben-Kiki }
           ... Block style: !bunch
           ...   Clark : Evans
           ...   Brian : Ingerson
           ...   Oren  : Ben-Kiki
           ... ''') #doctest: +NORMALIZE_WHITESPACE
           {'Flow style': Bunch(Brian='Ingerson',
                                Clark='Evans',
                                Oren='Ben-Kiki'),
            'Block style': Bunch(Brian='Ingerson',
                                 Clark='Evans',
                                 Oren='Ben-Kiki')}

           This module registers itself automatically to cover both
           Bunch and any subclasses. Should you want to customize the
           representation of a subclass, simply register it with
           PyYAML yourself.
        N(Rtconstruct_mappingtupdate(tloadertnodetdatatvalue((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyt	from_yaml@s	cCs
|j|ƒS(s6Converts Bunch to a normal mapping node, making it appear as a
           dict in the YAML output.

           >>> b = Bunch(foo=['bar', Bunch(lol=True)], hello=42)
           >>> import yaml
           >>> yaml.safe_dump(b, default_flow_style=True)
           '{foo: [bar, {lol: true}], hello: 42}\n'
        (trepresent_dict(tdumperR3((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pytto_yaml_safe_s	cCs|jtdƒ|ƒS(sConverts Bunch to a representation node.

           >>> b = Bunch(foo=['bar', Bunch(lol=True)], hello=42)
           >>> import yaml
           >>> yaml.dump(b, default_flow_style=True)
           '!bunch.Bunch {foo: [bar, !bunch.Bunch {lol: true}], hello: 42}\n'
        s!bunch.Bunch(trepresent_mappingtu(R7R3((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pytto_yamljss!bunchs!bunch.BunchcKsRtdddtƒ}|j|ƒd|kr>tj||Stj||SdS(sãSerialize this Bunch to YAML, using `yaml.safe_dump()` if
           no `Dumper` is provided. See the PyYAML documentation
           for more info.

           >>> b = Bunch(foo=['bar', Bunch(lol=True)], hello=42)
           >>> import yaml
           >>> yaml.safe_dump(b, default_flow_style=True)
           '{foo: [bar, {lol: true}], hello: 42}\n'
           >>> b.toYAML(default_flow_style=True)
           '{foo: [bar, {lol: true}], hello: 42}\n'
           >>> yaml.dump(b, default_flow_style=True)
           '!bunch.Bunch {foo: [bar, !bunch.Bunch {lol: true}], hello: 42}\n'
           >>> b.toYAML(Dumper=yaml.Dumper, default_flow_style=True)
           '!bunch.Bunch {foo: [bar, !bunch.Bunch {lol: true}], hello: 42}\n'
        tindentitdefault_flow_styletDumperN(RRR0tyamlt	safe_dumptdump(R	R+topts((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyttoYAML~s

cOsttj||ŽƒS(sbunchify yaml.(RR?t	safe_load(Rtkwargs((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pytfromYAML•st__main__(sBunchsbunchifys
unbunchify("R!t__version__R&tmaptinttsplittVERSIONt__all__tpython3_compatRRRRR)tImportErrort
simplejsonR,R?tyaml.representerR-R.R5R8R;tadd_constructorR:tadd_representertadd_multi_representerRCRFR"Rtdoctestttestmod(((s</usr/lib/python2.7/dist-packages/s3fuse/bunch_p3/__init__.pyt<module>sL
Æ