/usr/lib/python2.6/site-packages/positional
Edit: /usr/lib/python2.6/site-packages/positional/__init__.pyc (4213B)
Ñò
ãyWc @ sb d d k Z d d k Z d d k Z d d k Z e i i d ƒ i ƒ Z d e f d „ ƒ YZ
d S( iÿÿÿÿNt
positionalc B sV e Z d Z d Z d Z d e d „ Z e d e d „ ƒ Z e d „ ƒ Z d „ Z RS( sr A decorator to enforce passing arguments as keywords.
When you have a function that takes a lot of arguments you expect people to
pass those arguments as keyword arguments. Python however does not enforce
this. In future then if you decide that you want to insert a new argument
or rearrange the arguments or transition to using **kwargs you break
compatibility with users of your code who (wrongly) gave you 20 positional
arguments.
In python 3 there is syntax to prevent this however we are not all in the
position where we can write python 3 exclusive code. Positional solves the
problem in the mean time across both pythons by enforcing that certain
arguments must be past as keyword arguments.
:param max_positional_args: the maixmum number of arguments that can be
passed to this function without keyword parameters. Defaults to
enforcing that every parameter with a default value must be passed as a
keyword argument.
:type max_positional_args int
:param enforcement: defines the way incorrect usage is reported. Currenlty
accepts :py:attr:`positional.EXCEPT` to raise a TypeError or
:py:attr:`positional.WARN` to show a warning. A warning can be useful
for applying to functions that are already public as a deprecation
notice. Defaults to :py:attr:`positional.EXCEPT`.
t exceptt warnc C s | | _ | | _ d S( N( t _max_positional_argst _enforcement( t selft max_positional_argst enforcement( ( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt __init__5 s c s4 ˆ d j o ˆ d 7‰ n ‡ ‡ ‡ f d † } | S( Ni c s ˆ ˆ ˆ ƒ | ƒ S( N( ( t func( R R t cls( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt f> s ( t None( R
R R R ( ( R R R
s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt method9 s
c s ‡ ‡ ‡ f d † } | S( Nc s t ˆ i ˆ ˆ Ž | ƒ ƒ S( N( t classmethodR
( R ( t kwargst argsR
( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyR D s ( ( R
R R R ( ( R R R
s7 /usr/lib/python2.6/site-packages/positional/__init__.pyR B s c s„ ˆ i d j o2 t i | ƒ } t | i ƒ t | i ƒ ˆ _ n ˆ i d j o d n d ‰ t i ‡ ‡ f d † ƒ } | | ƒ S( Ni t t sc s¾ t | ƒ } | o | d 7} n | ˆ i j o€ d h | i d 6ˆ i d 6| d 6ˆ d 6} ˆ i ˆ i j o t | ƒ ‚ q± ˆ i ˆ i j o t i | t d d ƒq± n | | | Ž S( Ni sN %(name)s takes at most %(max)d positional argument%(plural)s (%(given)d given)t namet maxt givent pluralt
stackleveli (
t lenR t __name__R t EXCEPTt TypeErrort WARNt warningsR t DeprecationWarning( t wrappedt instanceR R t args_lent message( R R ( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt innerO s
( R R t inspectt
getargspecR R t defaultst wraptt decorator( R R t specR# ( ( R R s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt __call__H s #N(
R t
__module__t __doc__R R R R R R
R* ( ( ( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyR s ( R$ R t pbr.versiont pbrR' t versiont VersionInfot version_stringt __version__t objectR ( ( ( s7 /usr/lib/python2.6/site-packages/positional/__init__.pyt
s