Exemple #1
0
#
# Created on Apr 3, 2012

'''Provides Python 3k forward-compatible (:pep:`3107`) annotations.'''

from __future__ import (division as _py3_division,
                        print_function as _py3_print,
                        unicode_literals as _py3_unicode,
                        absolute_import)

from re import compile as _regex_compile
from ast import parse as _ast_parse

from six import string_types as _str_base
from xoutil.functools import partial
_ast_parse = partial(_ast_parse, filename="<annotations>", mode="eval")

from xoutil.decorator.meta import decorator

from xoutil.names import strlist as strs
__all__ = strs('annotate')
del strs


_SIGNATURE = _regex_compile(r'''(?ixm)
                            \(              # Required opening for the argumens
                            (?P<args>(.)*)
                            \)\s*           # Required close
                            (?:->\s*(?P<return>.+))?$
                            ''')
Exemple #2
0
 def ditmoi(target, *args, **kwargs):
     return partial(target, *args, **kwargs)