Metadata-Version: 2.1
Name: micropy
Version: 0.5.5
Summary: Some Python nicieties
Home-page: https://www.414soft.com/micropy
Author: Jacob Oscarson
Author-email: jacob@414soft.com
License: MIT
Description: micropy
        =======
        
        My little lib of Python goodies
        
        Micropy is auto-formatted using
        `yapf <https://github.com/google/yapf>`__.
        
        Nice things
        -----------
        
        dig()
        ~~~~~
        
        CSS selector like deep value grabbing from almost any object.
        
        .. code:: python
        
            >>> from micropy import dig
            >>> dig.xget((1, 2, 3), 1)
            2
            >>> dig.xget({'foo': 'bar'}, 'foo')
            'bar'
            >>> dig.dig({'foo': 1, 'bar': [1,2,3]}, 'bar.1')
            2
            >>> dig.dig({'foo': 1, 'bar': [1,{'baz':'jox'},3]}, 'bar.1.baz')
            'jox'
            >>>
        
        The difference between ``dig.dig()`` and ``funcy.get_in()`` is that you
        can use shell-like blob patterns to get several values keyed by similar
        names:
        
        .. code:: python
        
            >>> from micropy import dig
            >>> res = dig.dig({'foo': 1, 'foop': 2}, 'f*')
            >>> res
            [foo=1:int, foop=2:int]
            >>> # (textual representation of an indexable object)
            >>> res[0]
            foo=1:int
            >>> res[1]
            foop=2:int
            >>>
        
        Programmatic class creation
        ---------------------------
        
        Programmatic creation of arbitrary named classes in module definition,
        add methods using a decorator notation:
        
        .. code:: python
        
            >>> from micropy import lang
            >>> mystuff = (('Foo', 1), ('Bar', 2))
            >>> for name, num in mystuff: locals()[name] = lang.mkclass(name, **{'num': num})
            >>> Foo
            <class 'micropy.lang.Foo'>
            >>> Foo.num
            1
            >>> \
            ... @Foo.classmethod
            ... def myclassmethod(cls, x):
            ...     return x + 1
            >>> Foo.myclassmethod(1)
            2
            >>>
            >>> \
            ... @Foo.staticmethod
            ... def mystaticmethod(x, y):
            ...     return x + y
            >>> Foo.mystaticmethod(1, 2)
            3
            >>> \
            ... @Foo.method
            ... def mymethod(self, x):
            ...     self.y = self.num + x
            ...     return self.y
            >>> foo = Foo()
            >>> foo.mymethod(1)
            2
            >>> foo.y
            2
            >>>
        
        A simple way of creating small DSL's using Python operator overloading.
        -----------------------------------------------------------------------
        
        .. code:: python
        
            >>> from micropy import lang
            >>> \
            ... class PipingExample(lang.Piping):
            ...     def __add__(self, value) -> lang.Piping:
            ...         self.queue(lambda a, b: a + b, value)
            ...         return self
            ...
            >>> simplest_pipe = PipingExample(10)
            >>> res = simplest_pipe + 10 + 20
            >>> res()
            40
            >>>
        
        Mostly, you'll want to use the pipe operator to define simple
        composition:
        
        .. code:: python
        
            >>> from micropy import lang
            >>> incr = lambda x: x + 1
            >>> showr = "It is {}!".format
            >>> (lang.ComposePiping(5) >> incr >> incr >> showr)()
            'It is 7!'
            >>>
        
        'Call by type' convenience objects
        ----------------------------------
        
        .. code:: python
        
            >>> from micropy import lang
            >>> foo = lang.callbytype({int: lambda x: x*100, str: lambda x: f'Hello {x}'})
            >>> foo(10)
            1000
            >>> foo('bar')
            'Hello bar'
            >>>
        
        
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Provides-Extra: test
