abupy.ExtBu package

Submodules

abupy.ExtBu.funcsigs module

Function signature objects for callables

Back port of Python 3.3’s function signature tools from the inspect module, modified to be compatible with Python 2.6, 2.7 and 3.2+.

class abupy.ExtBu.funcsigs.BoundArguments(signature, arguments)[源代码]

Bases: object

Result of Signature.bind call. Holds the mapping of arguments to the function’s parameters.

Has the following public attributes:

  • arguments : OrderedDict
    An ordered mutable mapping of parameters’ names to arguments’ values. Does not contain arguments’ default values.
  • signature : Signature
    The Signature object that created this instance.
  • args : tuple
    Tuple of positional arguments values.
  • kwargs : dict
    Dict of keyword arguments values.
args
kwargs
signature
class abupy.ExtBu.funcsigs.Parameter(name, kind, default=<class 'abupy.ExtBu.funcsigs._empty'>, annotation=<class 'abupy.ExtBu.funcsigs._empty'>, _partial_kwarg=False)[源代码]

Bases: object

Represents a parameter in a function signature.

Has the following public attributes:

  • name : str
    The name of the parameter as a string.
  • default : object
    The default value for the parameter if specified. If the parameter has no default value, this attribute is not set.
  • annotation
    The annotation for the parameter if specified. If the parameter has no annotation, this attribute is not set.
  • kind : str
    Describes how argument values are bound to the parameter. Possible values: Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD, Parameter.VAR_POSITIONAL, Parameter.KEYWORD_ONLY, Parameter.VAR_KEYWORD.
KEYWORD_ONLY = <_ParameterKind: 'KEYWORD_ONLY'>
POSITIONAL_ONLY = <_ParameterKind: 'POSITIONAL_ONLY'>
POSITIONAL_OR_KEYWORD = <_ParameterKind: 'POSITIONAL_OR_KEYWORD'>
VAR_KEYWORD = <_ParameterKind: 'VAR_KEYWORD'>
VAR_POSITIONAL = <_ParameterKind: 'VAR_POSITIONAL'>
annotation
default
empty

_empty 的别名

kind
name
replace(name=<class 'abupy.ExtBu.funcsigs._void'>, kind=<class 'abupy.ExtBu.funcsigs._void'>, annotation=<class 'abupy.ExtBu.funcsigs._void'>, default=<class 'abupy.ExtBu.funcsigs._void'>, _partial_kwarg=<class 'abupy.ExtBu.funcsigs._void'>)[源代码]

Creates a customized copy of the Parameter.

class abupy.ExtBu.funcsigs.Signature(parameters=None, return_annotation=<class 'abupy.ExtBu.funcsigs._empty'>, __validate_parameters__=True)[源代码]

Bases: object

A Signature object represents the overall signature of a function. It stores a Parameter object for each parameter accepted by the function, as well as information specific to the function itself.

A Signature object has the following public attributes and methods:

  • parameters : OrderedDict
    An ordered mapping of parameters’ names to the corresponding Parameter objects (keyword-only arguments are in the same order as listed in code.co_varnames).
  • return_annotation : object
    The annotation for the return type of the function if specified. If the function has no annotation for its return type, this attribute is not set.
  • bind(*args, **kwargs) -> BoundArguments
    Creates a mapping from positional and keyword arguments to parameters.
  • bind_partial(*args, **kwargs) -> BoundArguments
    Creates a partial mapping from positional and keyword arguments to parameters (simulating ‘functools.partial’ behavior.)
bind(*args, **kwargs)[源代码]

Get a BoundArguments object, that maps the passed args and kwargs to the function’s signature. Raises TypeError if the passed arguments can not be bound.

bind_partial(*args, **kwargs)[源代码]

Get a BoundArguments object, that partially maps the passed args and kwargs to the function’s signature. Raises TypeError if the passed arguments can not be bound.

empty

_empty 的别名

classmethod from_function(func)[源代码]

Constructs Signature for the given python function

parameters
replace(parameters=<class 'abupy.ExtBu.funcsigs._void'>, return_annotation=<class 'abupy.ExtBu.funcsigs._void'>)[源代码]

Creates a customized copy of the Signature. Pass ‘parameters’ and/or ‘return_annotation’ arguments to override them in the new copy.

return_annotation
abupy.ExtBu.funcsigs.signature(obj)[源代码]

Get a signature object for the passed callable.

abupy.ExtBu.odict module

Ordered dictionary

class abupy.ExtBu.odict.OrderedDict(*args, **kwds)[源代码]

Bases: dict

Dictionary that remembers insertion order

clear() → None. Remove all items from od.[源代码]
copy() → a shallow copy of od[源代码]
classmethod fromkeys(S[, v]) → New ordered dictionary with keys from S[源代码]

and values equal to v (which defaults to None).

items() → list of (key, value) pairs in od[源代码]
iteritems()[源代码]

od.iteritems -> an iterator over the (key, value) items in od

iterkeys() → an iterator over the keys in od[源代码]
itervalues()[源代码]

od.itervalues -> an iterator over the values in od

keys() → list of keys in od[源代码]
pop(k[, d]) → v, remove specified key and return the corresponding value.[源代码]

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), return and remove a (key, value) pair.[源代码]

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(k[, d]) → od.get(k,d), also set od[k]=d if k not in od[源代码]
update(E, **F) → None. Update od from dict/iterable E and F.[源代码]

If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v

values() → list of values in od[源代码]
viewitems() → a set-like object providing a view on od's items[源代码]
viewkeys() → a set-like object providing a view on od's keys[源代码]
viewvalues() → an object providing a view on od's values[源代码]

abupy.ExtBu.six module

Utilities for writing code that runs on Python 2 and 3

class abupy.ExtBu.six.Module_six_moves_urllib[源代码]

Bases: module

Create a six.moves.urllib namespace that resembles the Python 3 namespace

error = <module 'abupy.ExtBu.six.moves.urllib_error'>
parse = <module 'abupy.ExtBu.six.moves.urllib_parse'>
request = <module 'abupy.ExtBu.six.moves.urllib_request'>
response = <module 'abupy.ExtBu.six.moves.urllib_response'>
robotparser = <module 'abupy.ExtBu.six.moves.urllib_robotparser'>
class abupy.ExtBu.six.Module_six_moves_urllib_error[源代码]

Bases: module

Lazy loading of moved objects in six.moves.urllib_error

ContentTooShortError
HTTPError
URLError
class abupy.ExtBu.six.Module_six_moves_urllib_parse[源代码]

Bases: module

Lazy loading of moved objects in six.moves.urllib_parse

ParseResult
parse_qs
parse_qsl
quote
quote_plus
unquote
unquote_plus
urldefrag
urlencode
urljoin
urlparse
urlsplit
urlunparse
urlunsplit
class abupy.ExtBu.six.Module_six_moves_urllib_request[源代码]

Bases: module

Lazy loading of moved objects in six.moves.urllib_request

AbstractBasicAuthHandler
AbstractDigestAuthHandler
BaseHandler
CacheFTPHandler
FTPHandler
FancyURLopener
FileHandler
HTTPBasicAuthHandler
HTTPCookieProcessor
HTTPDefaultErrorHandler
HTTPDigestAuthHandler
HTTPErrorProcessor
HTTPHandler
HTTPPasswordMgr
HTTPPasswordMgrWithDefaultRealm
HTTPRedirectHandler
HTTPSHandler
OpenerDirector
ProxyBasicAuthHandler
ProxyDigestAuthHandler
ProxyHandler
Request
URLopener
UnknownHandler
build_opener
getproxies
install_opener
pathname2url
url2pathname
urlcleanup
urlopen
urlretrieve
class abupy.ExtBu.six.Module_six_moves_urllib_response[源代码]

Bases: module

Lazy loading of moved objects in six.moves.urllib_response

addbase
addclosehook
addinfo
addinfourl
class abupy.ExtBu.six.Module_six_moves_urllib_robotparser[源代码]

Bases: module

Lazy loading of moved objects in six.moves.urllib_robotparser

RobotFileParser
class abupy.ExtBu.six.MovedAttribute(name, old_mod, new_mod, old_attr=None, new_attr=None)[源代码]

Bases: abupy.ExtBu.six._LazyDescr

class abupy.ExtBu.six.MovedModule(name, old, new=None)[源代码]

Bases: abupy.ExtBu.six._LazyDescr

abupy.ExtBu.six.add_metaclass(metaclass)[源代码]

Class decorator for creating a class with a metaclass.

abupy.ExtBu.six.add_move(move)[源代码]

Add an item to six.moves.

abupy.ExtBu.six.b(s)[源代码]

Byte literal

abupy.ExtBu.six.get_unbound_function(unbound)[源代码]

Get the function out of a possibly unbound function

abupy.ExtBu.six.iteritems(d, **kw)[源代码]

Return an iterator over the (key, value) pairs of a dictionary.

abupy.ExtBu.six.iterkeys(d, **kw)[源代码]

Return an iterator over the keys of a dictionary.

abupy.ExtBu.six.iterlists(d, **kw)[源代码]

Return an iterator over the (key, [values]) pairs of a dictionary.

abupy.ExtBu.six.itervalues(d, **kw)[源代码]

Return an iterator over the values of a dictionary.

abupy.ExtBu.six.remove_move(name)[源代码]

Remove item from six.moves.

abupy.ExtBu.six.reraise(tp, value, tb=None)[源代码]

Reraise an exception.

abupy.ExtBu.six.u(s)[源代码]

Text literal

abupy.ExtBu.six.with_metaclass(meta, *bases)[源代码]

Create a base class with a metaclass.

Module contents

External, bundled dependencies.