Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
unpackb
(packed, **kwargs)
Unpack an object from `packed`. Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``ValueError`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during ...
Unpack an object from `packed`.
def unpackb(packed, **kwargs): """ Unpack an object from `packed`. Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``ValueError`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. ...
[ "def", "unpackb", "(", "packed", ",", "*", "*", "kwargs", ")", ":", "unpacker", "=", "Unpacker", "(", "None", ",", "max_buffer_size", "=", "len", "(", "packed", ")", ",", "*", "*", "kwargs", ")", "unpacker", ".", "feed", "(", "packed", ")", "try", ...
[ 113, 0 ]
[ 137, 14 ]
python
en
['en', 'error', 'th']
False
Unpacker._consume
(self)
Gets rid of the used parts of the buffer.
Gets rid of the used parts of the buffer.
def _consume(self): """ Gets rid of the used parts of the buffer. """ self._stream_offset += self._buff_i - self._buf_checkpoint self._buf_checkpoint = self._buff_i
[ "def", "_consume", "(", "self", ")", ":", "self", ".", "_stream_offset", "+=", "self", ".", "_buff_i", "-", "self", ".", "_buf_checkpoint", "self", ".", "_buf_checkpoint", "=", "self", ".", "_buff_i" ]
[ 355, 4 ]
[ 358, 43 ]
python
en
['en', 'en', 'en']
True
Packer.bytes
(self)
Return internal buffer contents as bytes object
Return internal buffer contents as bytes object
def bytes(self): """Return internal buffer contents as bytes object""" return self._buffer.getvalue()
[ "def", "bytes", "(", "self", ")", ":", "return", "self", ".", "_buffer", ".", "getvalue", "(", ")" ]
[ 1046, 4 ]
[ 1048, 38 ]
python
en
['en', 'lb', 'en']
True
Packer.reset
(self)
Reset internal buffer. This method is useful only when autoreset=False.
Reset internal buffer.
def reset(self): """Reset internal buffer. This method is useful only when autoreset=False. """ self._buffer = StringIO()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_buffer", "=", "StringIO", "(", ")" ]
[ 1050, 4 ]
[ 1055, 33 ]
python
en
['en', 'lb', 'en']
True
Packer.getbuffer
(self)
Return view of internal buffer.
Return view of internal buffer.
def getbuffer(self): """Return view of internal buffer.""" if USING_STRINGBUILDER or PY2: return memoryview(self.bytes()) else: return self._buffer.getbuffer()
[ "def", "getbuffer", "(", "self", ")", ":", "if", "USING_STRINGBUILDER", "or", "PY2", ":", "return", "memoryview", "(", "self", ".", "bytes", "(", ")", ")", "else", ":", "return", "self", ".", "_buffer", ".", "getbuffer", "(", ")" ]
[ 1057, 4 ]
[ 1062, 43 ]
python
en
['en', 'lb', 'en']
True
main
(args=None)
This is an internal API only meant for use by pip's own console scripts. For additional details, see https://github.com/pypa/pip/issues/7498.
This is an internal API only meant for use by pip's own console scripts.
def main(args=None): # type: (Optional[List[str]]) -> int """This is an internal API only meant for use by pip's own console scripts. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args)
[ "def", "main", "(", "args", "=", "None", ")", ":", "# type: (Optional[List[str]]) -> int", "from", "pip", ".", "_internal", ".", "utils", ".", "entrypoints", "import", "_wrapper", "return", "_wrapper", "(", "args", ")" ]
[ 9, 0 ]
[ 17, 25 ]
python
en
['en', 'en', 'en']
True
Client.items
(cls, sobject)
Extract the I{items} from a suds object much like the items() method works on I{dict}. @param sobject: A suds object @type sobject: L{Object} @return: A list of items contained in I{sobject}. @rtype: [(key, value),...]
Extract the I{items} from a suds object much like the items() method works on I{dict}.
def items(cls, sobject): """ Extract the I{items} from a suds object much like the items() method works on I{dict}. @param sobject: A suds object @type sobject: L{Object} @return: A list of items contained in I{sobject}. @rtype: [(key, value),...] """ ...
[ "def", "items", "(", "cls", ",", "sobject", ")", ":", "return", "sudsobject", ".", "items", "(", "sobject", ")" ]
[ 64, 4 ]
[ 73, 40 ]
python
en
['en', 'error', 'th']
False
Client.dict
(cls, sobject)
Convert a sudsobject into a dictionary. @param sobject: A suds object @type sobject: L{Object} @return: A python dictionary containing the items contained in I{sobject}. @rtype: dict
Convert a sudsobject into a dictionary.
def dict(cls, sobject): """ Convert a sudsobject into a dictionary. @param sobject: A suds object @type sobject: L{Object} @return: A python dictionary containing the items contained in I{sobject}. @rtype: dict """ return sudsobject.asdict(sobj...
[ "def", "dict", "(", "cls", ",", "sobject", ")", ":", "return", "sudsobject", ".", "asdict", "(", "sobject", ")" ]
[ 76, 4 ]
[ 85, 41 ]
python
en
['en', 'error', 'th']
False
Client.metadata
(cls, sobject)
Extract the metadata from a suds object. @param sobject: A suds object @type sobject: L{Object} @return: The object's metadata @rtype: L{sudsobject.Metadata}
Extract the metadata from a suds object.
def metadata(cls, sobject): """ Extract the metadata from a suds object. @param sobject: A suds object @type sobject: L{Object} @return: The object's metadata @rtype: L{sudsobject.Metadata} """ return sobject.__metadata__
[ "def", "metadata", "(", "cls", ",", "sobject", ")", ":", "return", "sobject", ".", "__metadata__" ]
[ 88, 4 ]
[ 96, 35 ]
python
en
['en', 'error', 'th']
False
Client.__init__
(self, url, **kwargs)
@param url: The URL for the WSDL. @type url: str @param kwargs: keyword arguments. @see: L{Options}
def __init__(self, url, **kwargs): """ @param url: The URL for the WSDL. @type url: str @param kwargs: keyword arguments. @see: L{Options} """ options = Options() options.transport = HttpAuthenticated() self.options = options #options.cache...
[ "def", "__init__", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "options", "=", "Options", "(", ")", "options", ".", "transport", "=", "HttpAuthenticated", "(", ")", "self", ".", "options", "=", "options", "#options.cache = ObjectCache(days=1)...
[ 98, 4 ]
[ 120, 46 ]
python
en
['en', 'error', 'th']
False
Client.set_options
(self, **kwargs)
Set options. @param kwargs: keyword arguments. @see: L{Options}
Set options.
def set_options(self, **kwargs): """ Set options. @param kwargs: keyword arguments. @see: L{Options} """ p = Unskin(self.options) p.update(kwargs)
[ "def", "set_options", "(", "self", ",", "*", "*", "kwargs", ")", ":", "p", "=", "Unskin", "(", "self", ".", "options", ")", "p", ".", "update", "(", "kwargs", ")" ]
[ 122, 4 ]
[ 129, 24 ]
python
en
['en', 'error', 'th']
False
Client.add_prefix
(self, prefix, uri)
Add I{static} mapping of an XML namespace prefix to a namespace. This is useful for cases when a wsdl and referenced schemas make heavy use of namespaces and those namespaces are subject to changed. @param prefix: An XML namespace prefix. @type prefix: str @param uri: An...
Add I{static} mapping of an XML namespace prefix to a namespace. This is useful for cases when a wsdl and referenced schemas make heavy use of namespaces and those namespaces are subject to changed.
def add_prefix(self, prefix, uri): """ Add I{static} mapping of an XML namespace prefix to a namespace. This is useful for cases when a wsdl and referenced schemas make heavy use of namespaces and those namespaces are subject to changed. @param prefix: An XML namespace prefix. ...
[ "def", "add_prefix", "(", "self", ",", "prefix", ",", "uri", ")", ":", "root", "=", "self", ".", "wsdl", ".", "root", "mapped", "=", "root", ".", "resolvePrefix", "(", "prefix", ",", "None", ")", "if", "mapped", "is", "None", ":", "root", ".", "add...
[ 131, 4 ]
[ 148, 77 ]
python
en
['en', 'error', 'th']
False
Client.last_sent
(self)
Get last sent I{soap} message. @return: The last sent I{soap} message. @rtype: L{Document}
Get last sent I{soap} message.
def last_sent(self): """ Get last sent I{soap} message. @return: The last sent I{soap} message. @rtype: L{Document} """ return self.messages.get('tx')
[ "def", "last_sent", "(", "self", ")", ":", "return", "self", ".", "messages", ".", "get", "(", "'tx'", ")" ]
[ 150, 4 ]
[ 156, 38 ]
python
en
['en', 'error', 'th']
False
Client.last_received
(self)
Get last received I{soap} message. @return: The last received I{soap} message. @rtype: L{Document}
Get last received I{soap} message.
def last_received(self): """ Get last received I{soap} message. @return: The last received I{soap} message. @rtype: L{Document} """ return self.messages.get('rx')
[ "def", "last_received", "(", "self", ")", ":", "return", "self", ".", "messages", ".", "get", "(", "'rx'", ")" ]
[ 158, 4 ]
[ 164, 38 ]
python
en
['en', 'error', 'th']
False
Client.clone
(self)
Get a shallow clone of this object. The clone only shares the WSDL. All other attributes are unique to the cloned object including options. @return: A shallow clone. @rtype: L{Client}
Get a shallow clone of this object. The clone only shares the WSDL. All other attributes are unique to the cloned object including options.
def clone(self): """ Get a shallow clone of this object. The clone only shares the WSDL. All other attributes are unique to the cloned object including options. @return: A shallow clone. @rtype: L{Client} """ class Uninitialized(Client): def _...
[ "def", "clone", "(", "self", ")", ":", "class", "Uninitialized", "(", "Client", ")", ":", "def", "__init__", "(", "self", ")", ":", "pass", "clone", "=", "Uninitialized", "(", ")", "clone", ".", "options", "=", "Options", "(", ")", "cp", "=", "Unskin...
[ 166, 4 ]
[ 187, 20 ]
python
en
['en', 'error', 'th']
False
Factory.__init__
(self, wsdl)
@param wsdl: A schema object. @type wsdl: L{wsdl.Definitions}
def __init__(self, wsdl): """ @param wsdl: A schema object. @type wsdl: L{wsdl.Definitions} """ self.wsdl = wsdl self.resolver = PathResolver(wsdl) self.builder = Builder(self.resolver)
[ "def", "__init__", "(", "self", ",", "wsdl", ")", ":", "self", ".", "wsdl", "=", "wsdl", "self", ".", "resolver", "=", "PathResolver", "(", "wsdl", ")", "self", ".", "builder", "=", "Builder", "(", "self", ".", "resolver", ")" ]
[ 212, 4 ]
[ 219, 45 ]
python
en
['en', 'error', 'th']
False
Factory.create
(self, name)
create a WSDL type by name @param name: The name of a type defined in the WSDL. @type name: str @return: The requested object. @rtype: L{Object}
create a WSDL type by name
def create(self, name): """ create a WSDL type by name @param name: The name of a type defined in the WSDL. @type name: str @return: The requested object. @rtype: L{Object} """ timer = metrics.Timer() timer.start() type = self.resolver.find...
[ "def", "create", "(", "self", ",", "name", ")", ":", "timer", "=", "metrics", ".", "Timer", "(", ")", "timer", ".", "start", "(", ")", "type", "=", "self", ".", "resolver", ".", "find", "(", "name", ")", "if", "type", "is", "None", ":", "raise", ...
[ 221, 4 ]
[ 246, 21 ]
python
en
['en', 'error', 'th']
False
Factory.separator
(self, ps)
Set the path separator. @param ps: The new path separator. @type ps: char
Set the path separator.
def separator(self, ps): """ Set the path separator. @param ps: The new path separator. @type ps: char """ self.resolver = PathResolver(self.wsdl, ps)
[ "def", "separator", "(", "self", ",", "ps", ")", ":", "self", ".", "resolver", "=", "PathResolver", "(", "self", ".", "wsdl", ",", "ps", ")" ]
[ 248, 4 ]
[ 254, 51 ]
python
en
['en', 'error', 'th']
False
ServiceSelector.__init__
(self, client, services)
@param client: A suds client. @type client: L{Client} @param services: A list of I{wsdl} services. @type services: list
def __init__(self, client, services): """ @param client: A suds client. @type client: L{Client} @param services: A list of I{wsdl} services. @type services: list """ self.__client = client self.__services = services
[ "def", "__init__", "(", "self", ",", "client", ",", "services", ")", ":", "self", ".", "__client", "=", "client", "self", ".", "__services", "=", "services" ]
[ 273, 4 ]
[ 281, 34 ]
python
en
['en', 'error', 'th']
False
ServiceSelector.__getattr__
(self, name)
Request to access an attribute is forwarded to the L{PortSelector} for either the I{first} service or the I{default} service (when specified). @param name: The name of a method. @type name: str @return: A L{PortSelector}. @rtype: L{PortSelector}.
Request to access an attribute is forwarded to the L{PortSelector} for either the I{first} service or the I{default} service (when specified).
def __getattr__(self, name): """ Request to access an attribute is forwarded to the L{PortSelector} for either the I{first} service or the I{default} service (when specified). @param name: The name of a method. @type name: str @return: A L{PortSelector}. @...
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "default", "=", "self", ".", "__ds", "(", ")", "if", "default", "is", "None", ":", "port", "=", "self", ".", "__find", "(", "0", ")", "else", ":", "port", "=", "default", "return", "getattr"...
[ 283, 4 ]
[ 298, 34 ]
python
en
['en', 'error', 'th']
False
ServiceSelector.__getitem__
(self, name)
Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}. @param name: The name (or index) of a service. @type name: (int|str...
Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}.
def __getitem__(self, name): """ Provides selection of the I{service} by name (string) or index (integer). In cases where only (1) service is defined or a I{default} has been specified, the request is forwarded to the L{PortSelector}. @param name: The name (or index) of...
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "if", "len", "(", "self", ".", "__services", ")", "==", "1", ":", "port", "=", "self", ".", "__find", "(", "0", ")", "return", "port", "[", "name", "]", "default", "=", "self", ".", "__ds"...
[ 300, 4 ]
[ 318, 32 ]
python
en
['en', 'error', 'th']
False
ServiceSelector.__find
(self, name)
Find a I{service} by name (string) or index (integer). @param name: The name (or index) of a service. @type name: (int|str) @return: A L{PortSelector} for the found service. @rtype: L{PortSelector}.
Find a I{service} by name (string) or index (integer).
def __find(self, name): """ Find a I{service} by name (string) or index (integer). @param name: The name (or index) of a service. @type name: (int|str) @return: A L{PortSelector} for the found service. @rtype: L{PortSelector}. """ service = None i...
[ "def", "__find", "(", "self", ",", "name", ")", ":", "service", "=", "None", "if", "not", "len", "(", "self", ".", "__services", ")", ":", "raise", "Exception", ",", "'No services defined'", "if", "isinstance", "(", "name", ",", "int", ")", ":", "try",...
[ 320, 4 ]
[ 344, 63 ]
python
en
['en', 'error', 'th']
False
ServiceSelector.__ds
(self)
Get the I{default} service if defined in the I{options}. @return: A L{PortSelector} for the I{default} service. @rtype: L{PortSelector}.
Get the I{default} service if defined in the I{options}.
def __ds(self): """ Get the I{default} service if defined in the I{options}. @return: A L{PortSelector} for the I{default} service. @rtype: L{PortSelector}. """ ds = self.__client.options.service if ds is None: return None else: re...
[ "def", "__ds", "(", "self", ")", ":", "ds", "=", "self", ".", "__client", ".", "options", ".", "service", "if", "ds", "is", "None", ":", "return", "None", "else", ":", "return", "self", ".", "__find", "(", "ds", ")" ]
[ 346, 4 ]
[ 356, 34 ]
python
en
['en', 'error', 'th']
False
PortSelector.__init__
(self, client, ports, qn)
@param client: A suds client. @type client: L{Client} @param ports: A list of I{service} ports. @type ports: list @param qn: The name of the service. @type qn: str
def __init__(self, client, ports, qn): """ @param client: A suds client. @type client: L{Client} @param ports: A list of I{service} ports. @type ports: list @param qn: The name of the service. @type qn: str """ self.__client = client self._...
[ "def", "__init__", "(", "self", ",", "client", ",", "ports", ",", "qn", ")", ":", "self", ".", "__client", "=", "client", "self", ".", "__ports", "=", "ports", "self", ".", "__qn", "=", "qn" ]
[ 374, 4 ]
[ 385, 22 ]
python
en
['en', 'error', 'th']
False
PortSelector.__getattr__
(self, name)
Request to access an attribute is forwarded to the L{MethodSelector} for either the I{first} port or the I{default} port (when specified). @param name: The name of a method. @type name: str @return: A L{MethodSelector}. @rtype: L{MethodSelector}.
Request to access an attribute is forwarded to the L{MethodSelector} for either the I{first} port or the I{default} port (when specified).
def __getattr__(self, name): """ Request to access an attribute is forwarded to the L{MethodSelector} for either the I{first} port or the I{default} port (when specified). @param name: The name of a method. @type name: str @return: A L{MethodSelector}. @rt...
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "default", "=", "self", ".", "__dp", "(", ")", "if", "default", "is", "None", ":", "m", "=", "self", ".", "__find", "(", "0", ")", "else", ":", "m", "=", "default", "return", "getattr", "(...
[ 387, 4 ]
[ 402, 31 ]
python
en
['en', 'error', 'th']
False
PortSelector.__getitem__
(self, name)
Provides selection of the I{port} by name (string) or index (integer). In cases where only (1) port is defined or a I{default} has been specified, the request is forwarded to the L{MethodSelector}. @param name: The name (or index) of a port. @type name: (int|str) ...
Provides selection of the I{port} by name (string) or index (integer). In cases where only (1) port is defined or a I{default} has been specified, the request is forwarded to the L{MethodSelector}.
def __getitem__(self, name): """ Provides selection of the I{port} by name (string) or index (integer). In cases where only (1) port is defined or a I{default} has been specified, the request is forwarded to the L{MethodSelector}. @param name: The name (or index) of a p...
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "default", "=", "self", ".", "__dp", "(", ")", "if", "default", "is", "None", ":", "return", "self", ".", "__find", "(", "name", ")", "else", ":", "return", "default" ]
[ 404, 4 ]
[ 419, 26 ]
python
en
['en', 'error', 'th']
False
PortSelector.__find
(self, name)
Find a I{port} by name (string) or index (integer). @param name: The name (or index) of a port. @type name: (int|str) @return: A L{MethodSelector} for the found port. @rtype: L{MethodSelector}.
Find a I{port} by name (string) or index (integer).
def __find(self, name): """ Find a I{port} by name (string) or index (integer). @param name: The name (or index) of a port. @type name: (int|str) @return: A L{MethodSelector} for the found port. @rtype: L{MethodSelector}. """ port = None if not le...
[ "def", "__find", "(", "self", ",", "name", ")", ":", "port", "=", "None", "if", "not", "len", "(", "self", ".", "__ports", ")", ":", "raise", "Exception", ",", "'No ports defined: %s'", "%", "self", ".", "__qn", "if", "isinstance", "(", "name", ",", ...
[ 421, 4 ]
[ 447, 62 ]
python
en
['en', 'error', 'th']
False
PortSelector.__dp
(self)
Get the I{default} port if defined in the I{options}. @return: A L{MethodSelector} for the I{default} port. @rtype: L{MethodSelector}.
Get the I{default} port if defined in the I{options}.
def __dp(self): """ Get the I{default} port if defined in the I{options}. @return: A L{MethodSelector} for the I{default} port. @rtype: L{MethodSelector}. """ dp = self.__client.options.port if dp is None: return None else: return ...
[ "def", "__dp", "(", "self", ")", ":", "dp", "=", "self", ".", "__client", ".", "options", ".", "port", "if", "dp", "is", "None", ":", "return", "None", "else", ":", "return", "self", ".", "__find", "(", "dp", ")" ]
[ 449, 4 ]
[ 459, 34 ]
python
en
['en', 'error', 'th']
False
MethodSelector.__init__
(self, client, methods, qn)
@param client: A suds client. @type client: L{Client} @param methods: A dictionary of methods. @type methods: dict @param qn: The I{qualified} name of the port. @type qn: str
def __init__(self, client, methods, qn): """ @param client: A suds client. @type client: L{Client} @param methods: A dictionary of methods. @type methods: dict @param qn: The I{qualified} name of the port. @type qn: str """ self.__client = client ...
[ "def", "__init__", "(", "self", ",", "client", ",", "methods", ",", "qn", ")", ":", "self", ".", "__client", "=", "client", "self", ".", "__methods", "=", "methods", "self", ".", "__qn", "=", "qn" ]
[ 472, 4 ]
[ 483, 22 ]
python
en
['en', 'error', 'th']
False
MethodSelector.__getattr__
(self, name)
Get a method by name and return it in an I{execution wrapper}. @param name: The name of a method. @type name: str @return: An I{execution wrapper} for the specified method name. @rtype: L{Method}
Get a method by name and return it in an I{execution wrapper}.
def __getattr__(self, name): """ Get a method by name and return it in an I{execution wrapper}. @param name: The name of a method. @type name: str @return: An I{execution wrapper} for the specified method name. @rtype: L{Method} """ return self[name]
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "return", "self", "[", "name", "]" ]
[ 485, 4 ]
[ 493, 25 ]
python
en
['en', 'error', 'th']
False
MethodSelector.__getitem__
(self, name)
Get a method by name and return it in an I{execution wrapper}. @param name: The name of a method. @type name: str @return: An I{execution wrapper} for the specified method name. @rtype: L{Method}
Get a method by name and return it in an I{execution wrapper}.
def __getitem__(self, name): """ Get a method by name and return it in an I{execution wrapper}. @param name: The name of a method. @type name: str @return: An I{execution wrapper} for the specified method name. @rtype: L{Method} """ m = self.__methods.get(...
[ "def", "__getitem__", "(", "self", ",", "name", ")", ":", "m", "=", "self", ".", "__methods", ".", "get", "(", "name", ")", "if", "m", "is", "None", ":", "qn", "=", "'.'", ".", "join", "(", "(", "self", ".", "__qn", ",", "name", ")", ")", "ra...
[ 495, 4 ]
[ 507, 39 ]
python
en
['en', 'error', 'th']
False
Method.__init__
(self, client, method)
@param client: A client object. @type client: L{Client} @param method: A I{raw} method. @type I{raw} Method.
def __init__(self, client, method): """ @param client: A client object. @type client: L{Client} @param method: A I{raw} method. @type I{raw} Method. """ self.client = client self.method = method
[ "def", "__init__", "(", "self", ",", "client", ",", "method", ")", ":", "self", ".", "client", "=", "client", "self", ".", "method", "=", "method" ]
[ 519, 4 ]
[ 527, 28 ]
python
en
['en', 'error', 'th']
False
Method.__call__
(self, *args, **kwargs)
Invoke the method.
Invoke the method.
def __call__(self, *args, **kwargs): """ Invoke the method. """ clientclass = self.clientclass(kwargs) client = clientclass(self.client, self.method) if not self.faults(): try: return client.invoke(args, kwargs) except WebFault, e: ...
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "clientclass", "=", "self", ".", "clientclass", "(", "kwargs", ")", "client", "=", "clientclass", "(", "self", ".", "client", ",", "self", ".", "method", ")", "if", ...
[ 529, 4 ]
[ 541, 46 ]
python
en
['en', 'error', 'th']
False
Method.faults
(self)
get faults option
get faults option
def faults(self): """ get faults option """ return self.client.options.faults
[ "def", "faults", "(", "self", ")", ":", "return", "self", ".", "client", ".", "options", ".", "faults" ]
[ 543, 4 ]
[ 545, 41 ]
python
en
['en', 'fr', 'en']
True
Method.clientclass
(self, kwargs)
get soap client class
get soap client class
def clientclass(self, kwargs): """ get soap client class """ if SimClient.simulation(kwargs): return SimClient else: return SoapClient
[ "def", "clientclass", "(", "self", ",", "kwargs", ")", ":", "if", "SimClient", ".", "simulation", "(", "kwargs", ")", ":", "return", "SimClient", "else", ":", "return", "SoapClient" ]
[ 547, 4 ]
[ 552, 29 ]
python
de
['de', 'fr', 'en']
False
SoapClient.__init__
(self, client, method)
@param client: A suds client. @type client: L{Client} @param method: A target method. @type method: L{Method}
def __init__(self, client, method): """ @param client: A suds client. @type client: L{Client} @param method: A target method. @type method: L{Method} """ self.client = client self.method = method self.options = client.options self.cookiejar...
[ "def", "__init__", "(", "self", ",", "client", ",", "method", ")", ":", "self", ".", "client", "=", "client", "self", ".", "method", "=", "method", "self", ".", "options", "=", "client", ".", "options", "self", ".", "cookiejar", "=", "CookieJar", "(", ...
[ 568, 4 ]
[ 578, 36 ]
python
en
['en', 'error', 'th']
False
SoapClient.invoke
(self, args, kwargs)
Send the required soap message to invoke the specified method @param args: A list of args for the method invoked. @type args: list @param kwargs: Named (keyword) args for the method invoked. @type kwargs: dict @return: The result of the method invocation. @rtype:...
Send the required soap message to invoke the specified method
def invoke(self, args, kwargs): """ Send the required soap message to invoke the specified method @param args: A list of args for the method invoked. @type args: list @param kwargs: Named (keyword) args for the method invoked. @type kwargs: dict @return: The resul...
[ "def", "invoke", "(", "self", ",", "args", ",", "kwargs", ")", ":", "timer", "=", "metrics", ".", "Timer", "(", ")", "timer", ".", "start", "(", ")", "result", "=", "None", "binding", "=", "self", ".", "method", ".", "binding", ".", "input", "soape...
[ 580, 4 ]
[ 607, 21 ]
python
en
['en', 'error', 'th']
False
SoapClient.send
(self, soapenv)
Send soap message. @param soapenv: A soap envelope to send. @type soapenv: L{Document} @return: The reply to the sent message. @rtype: I{builtin} or I{subclass of} L{Object}
Send soap message.
def send(self, soapenv): """ Send soap message. @param soapenv: A soap envelope to send. @type soapenv: L{Document} @return: The reply to the sent message. @rtype: I{builtin} or I{subclass of} L{Object} """ result = None location = self.location() ...
[ "def", "send", "(", "self", ",", "soapenv", ")", ":", "result", "=", "None", "location", "=", "self", ".", "location", "(", ")", "binding", "=", "self", ".", "method", ".", "binding", ".", "input", "transport", "=", "self", ".", "options", ".", "tran...
[ 609, 4 ]
[ 649, 21 ]
python
en
['en', 'error', 'th']
False
SoapClient.headers
(self)
Get http headers or the http/https request. @return: A dictionary of header/values. @rtype: dict
Get http headers or the http/https request.
def headers(self): """ Get http headers or the http/https request. @return: A dictionary of header/values. @rtype: dict """ action = self.method.soap.action stock = { 'Content-Type' : 'text/xml; charset=utf-8', 'SOAPAction': action } result = dict(stock, *...
[ "def", "headers", "(", "self", ")", ":", "action", "=", "self", ".", "method", ".", "soap", ".", "action", "stock", "=", "{", "'Content-Type'", ":", "'text/xml; charset=utf-8'", ",", "'SOAPAction'", ":", "action", "}", "result", "=", "dict", "(", "stock", ...
[ 651, 4 ]
[ 661, 21 ]
python
en
['en', 'error', 'th']
False
SoapClient.succeeded
(self, binding, reply)
Request succeeded, process the reply @param binding: The binding to be used to process the reply. @type binding: L{bindings.binding.Binding} @param reply: The raw reply text. @type reply: str @return: The method result. @rtype: I{builtin}, L{Object} @rais...
Request succeeded, process the reply
def succeeded(self, binding, reply): """ Request succeeded, process the reply @param binding: The binding to be used to process the reply. @type binding: L{bindings.binding.Binding} @param reply: The raw reply text. @type reply: str @return: The method result. ...
[ "def", "succeeded", "(", "self", ",", "binding", ",", "reply", ")", ":", "log", ".", "debug", "(", "'http succeeded:\\n%s'", ",", "reply", ")", "plugins", "=", "PluginContainer", "(", "self", ".", "options", ".", "plugins", ")", "if", "len", "(", "reply"...
[ 663, 4 ]
[ 686, 32 ]
python
en
['en', 'error', 'th']
False
SoapClient.failed
(self, binding, error)
Request failed, process reply based on reason @param binding: The binding to be used to process the reply. @type binding: L{suds.bindings.binding.Binding} @param error: The http error message @type error: L{transport.TransportError}
Request failed, process reply based on reason
def failed(self, binding, error): """ Request failed, process reply based on reason @param binding: The binding to be used to process the reply. @type binding: L{suds.bindings.binding.Binding} @param error: The http error message @type error: L{transport.TransportError} ...
[ "def", "failed", "(", "self", ",", "binding", ",", "error", ")", ":", "status", ",", "reason", "=", "(", "error", ".", "httpcode", ",", "tostr", "(", "error", ")", ")", "reply", "=", "error", ".", "fp", ".", "read", "(", ")", "log", ".", "debug",...
[ 688, 4 ]
[ 709, 33 ]
python
en
['en', 'error', 'th']
False
SimClient.simulation
(cls, kwargs)
get whether loopback has been specified in the I{kwargs}.
get whether loopback has been specified in the I{kwargs}.
def simulation(cls, kwargs): """ get whether loopback has been specified in the I{kwargs}. """ return kwargs.has_key(SimClient.injkey)
[ "def", "simulation", "(", "cls", ",", "kwargs", ")", ":", "return", "kwargs", ".", "has_key", "(", "SimClient", ".", "injkey", ")" ]
[ 740, 4 ]
[ 742, 47 ]
python
en
['en', 'en', 'en']
True
SimClient.invoke
(self, args, kwargs)
Send the required soap message to invoke the specified method @param args: A list of args for the method invoked. @type args: list @param kwargs: Named (keyword) args for the method invoked. @type kwargs: dict @return: The result of the method invocation. @rtype:...
Send the required soap message to invoke the specified method
def invoke(self, args, kwargs): """ Send the required soap message to invoke the specified method @param args: A list of args for the method invoked. @type args: list @param kwargs: Named (keyword) args for the method invoked. @type kwargs: dict @return: The resul...
[ "def", "invoke", "(", "self", ",", "args", ",", "kwargs", ")", ":", "simulation", "=", "kwargs", "[", "self", ".", "injkey", "]", "msg", "=", "simulation", ".", "get", "(", "'msg'", ")", "reply", "=", "simulation", ".", "get", "(", "'reply'", ")", ...
[ 744, 4 ]
[ 766, 29 ]
python
en
['en', 'error', 'th']
False
SimClient.__reply
(self, reply, args, kwargs)
simulate the reply
simulate the reply
def __reply(self, reply, args, kwargs): """ simulate the reply """ binding = self.method.binding.input msg = binding.get_message(self.method, args, kwargs) log.debug('inject (simulated) send message:\n%s', msg) binding = self.method.binding.output return self.succeeded(bi...
[ "def", "__reply", "(", "self", ",", "reply", ",", "args", ",", "kwargs", ")", ":", "binding", "=", "self", ".", "method", ".", "binding", ".", "input", "msg", "=", "binding", ".", "get_message", "(", "self", ".", "method", ",", "args", ",", "kwargs",...
[ 768, 4 ]
[ 774, 45 ]
python
en
['en', 'en', 'en']
True
SimClient.__fault
(self, reply)
simulate the (fault) reply
simulate the (fault) reply
def __fault(self, reply): """ simulate the (fault) reply """ binding = self.method.binding.output if self.options.faults: r, p = binding.get_fault(reply) self.last_received(r) return (500, p) else: return (500, None)
[ "def", "__fault", "(", "self", ",", "reply", ")", ":", "binding", "=", "self", ".", "method", ".", "binding", ".", "output", "if", "self", ".", "options", ".", "faults", ":", "r", ",", "p", "=", "binding", ".", "get_fault", "(", "reply", ")", "self...
[ 776, 4 ]
[ 784, 30 ]
python
en
['en', 'en', 'en']
True
closing
(pool)
Return a context manager making sure the pool closes properly.
Return a context manager making sure the pool closes properly.
def closing(pool): # type: (Pool) -> Iterator[Pool] """Return a context manager making sure the pool closes properly.""" try: yield pool finally: # For Pool.imap*, close and join are needed # for the returned iterator to begin yielding. pool.close() pool.join() ...
[ "def", "closing", "(", "pool", ")", ":", "# type: (Pool) -> Iterator[Pool]", "try", ":", "yield", "pool", "finally", ":", "# For Pool.imap*, close and join are needed", "# for the returned iterator to begin yielding.", "pool", ".", "close", "(", ")", "pool", ".", "join", ...
[ 52, 0 ]
[ 62, 24 ]
python
en
['en', 'en', 'en']
True
_map_fallback
(func, iterable, chunksize=1)
Make an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable.
Make an iterator applying func to each element in iterable.
def _map_fallback(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Make an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open...
[ "def", "_map_fallback", "(", "func", ",", "iterable", ",", "chunksize", "=", "1", ")", ":", "# type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]", "return", "map", "(", "func", ",", "iterable", ")" ]
[ 65, 0 ]
[ 73, 30 ]
python
en
['en', 'en', 'en']
True
_map_multiprocess
(func, iterable, chunksize=1)
Chop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results.
Chop iterable into chunks and submit them to a process pool.
def _map_multiprocess(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Chop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of...
[ "def", "_map_multiprocess", "(", "func", ",", "iterable", ",", "chunksize", "=", "1", ")", ":", "# type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]", "with", "closing", "(", "ProcessPool", "(", ")", ")", "as", "pool", ":", "return", "pool", ".", "imap_uno...
[ 76, 0 ]
[ 86, 61 ]
python
en
['en', 'en', 'en']
True
_map_multithread
(func, iterable, chunksize=1)
Chop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results.
Chop iterable into chunks and submit them to a thread pool.
def _map_multithread(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Chop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1...
[ "def", "_map_multithread", "(", "func", ",", "iterable", ",", "chunksize", "=", "1", ")", ":", "# type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]", "with", "closing", "(", "ThreadPool", "(", "DEFAULT_POOLSIZE", ")", ")", "as", "pool", ":", "return", "pool"...
[ 89, 0 ]
[ 99, 61 ]
python
en
['en', 'en', 'en']
True
_w_long
(x)
Convert a 32-bit integer to little-endian.
Convert a 32-bit integer to little-endian.
def _w_long(x): """Convert a 32-bit integer to little-endian.""" return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')
[ "def", "_w_long", "(", "x", ")", ":", "return", "(", "int", "(", "x", ")", "&", "0xFFFFFFFF", ")", ".", "to_bytes", "(", "4", ",", "'little'", ")" ]
[ 46, 0 ]
[ 48, 54 ]
python
en
['en', 'lb', 'en']
True
_r_long
(int_bytes)
Convert 4 bytes in little-endian to an integer.
Convert 4 bytes in little-endian to an integer.
def _r_long(int_bytes): """Convert 4 bytes in little-endian to an integer.""" return int.from_bytes(int_bytes, 'little')
[ "def", "_r_long", "(", "int_bytes", ")", ":", "return", "int", ".", "from_bytes", "(", "int_bytes", ",", "'little'", ")" ]
[ 51, 0 ]
[ 53, 46 ]
python
en
['en', 'lb', 'en']
True
_path_join
(*path_parts)
Replacement for os.path.join().
Replacement for os.path.join().
def _path_join(*path_parts): """Replacement for os.path.join().""" return path_sep.join([part.rstrip(path_separators) for part in path_parts if part])
[ "def", "_path_join", "(", "*", "path_parts", ")", ":", "return", "path_sep", ".", "join", "(", "[", "part", ".", "rstrip", "(", "path_separators", ")", "for", "part", "in", "path_parts", "if", "part", "]", ")" ]
[ 56, 0 ]
[ 59, 58 ]
python
en
['en', 'en', 'en']
True
_path_split
(path)
Replacement for os.path.split().
Replacement for os.path.split().
def _path_split(path): """Replacement for os.path.split().""" if len(path_separators) == 1: front, _, tail = path.rpartition(path_sep) return front, tail for x in reversed(path): if x in path_separators: front, tail = path.rsplit(x, maxsplit=1) return front, t...
[ "def", "_path_split", "(", "path", ")", ":", "if", "len", "(", "path_separators", ")", "==", "1", ":", "front", ",", "_", ",", "tail", "=", "path", ".", "rpartition", "(", "path_sep", ")", "return", "front", ",", "tail", "for", "x", "in", "reversed",...
[ 62, 0 ]
[ 71, 19 ]
python
en
['en', 'en', 'en']
True
_path_stat
(path)
Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results).
Stat the path.
def _path_stat(path): """Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). """ return _os.stat(path)
[ "def", "_path_stat", "(", "path", ")", ":", "return", "_os", ".", "stat", "(", "path", ")" ]
[ 74, 0 ]
[ 81, 25 ]
python
en
['en', 'en', 'en']
True
_path_is_mode_type
(path, mode)
Test whether the path is the specified mode type.
Test whether the path is the specified mode type.
def _path_is_mode_type(path, mode): """Test whether the path is the specified mode type.""" try: stat_info = _path_stat(path) except OSError: return False return (stat_info.st_mode & 0o170000) == mode
[ "def", "_path_is_mode_type", "(", "path", ",", "mode", ")", ":", "try", ":", "stat_info", "=", "_path_stat", "(", "path", ")", "except", "OSError", ":", "return", "False", "return", "(", "stat_info", ".", "st_mode", "&", "0o170000", ")", "==", "mode" ]
[ 84, 0 ]
[ 90, 49 ]
python
en
['en', 'en', 'en']
True
_path_isfile
(path)
Replacement for os.path.isfile.
Replacement for os.path.isfile.
def _path_isfile(path): """Replacement for os.path.isfile.""" return _path_is_mode_type(path, 0o100000)
[ "def", "_path_isfile", "(", "path", ")", ":", "return", "_path_is_mode_type", "(", "path", ",", "0o100000", ")" ]
[ 93, 0 ]
[ 95, 45 ]
python
en
['en', 'en', 'en']
True
_path_isdir
(path)
Replacement for os.path.isdir.
Replacement for os.path.isdir.
def _path_isdir(path): """Replacement for os.path.isdir.""" if not path: path = _os.getcwd() return _path_is_mode_type(path, 0o040000)
[ "def", "_path_isdir", "(", "path", ")", ":", "if", "not", "path", ":", "path", "=", "_os", ".", "getcwd", "(", ")", "return", "_path_is_mode_type", "(", "path", ",", "0o040000", ")" ]
[ 98, 0 ]
[ 102, 45 ]
python
en
['en', 'en', 'en']
True
_write_atomic
(path, data, mode=0o666)
Best-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.
Best-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.
def _write_atomic(path, data, mode=0o666): """Best-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.""" # id() is used to generate a pseudo-random filename. path_tmp = '{}.{}'.format(path, id(path)) ...
[ "def", "_write_atomic", "(", "path", ",", "data", ",", "mode", "=", "0o666", ")", ":", "# id() is used to generate a pseudo-random filename.", "path_tmp", "=", "'{}.{}'", ".", "format", "(", "path", ",", "id", "(", "path", ")", ")", "fd", "=", "_os", ".", ...
[ 105, 0 ]
[ 124, 13 ]
python
en
['en', 'en', 'en']
True
cache_from_source
(path, debug_override=None, *, optimization=None)
Given the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' ...
Given the path to a .py file, return the path to its .pyc file.
def cache_from_source(path, debug_override=None, *, optimization=None): """Given the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter contro...
[ "def", "cache_from_source", "(", "path", ",", "debug_override", "=", "None", ",", "*", ",", "optimization", "=", "None", ")", ":", "if", "debug_override", "is", "not", "None", ":", "_warnings", ".", "warn", "(", "'the debug_override parameter is deprecated; use '"...
[ 262, 0 ]
[ 304, 77 ]
python
en
['en', 'en', 'en']
True
source_from_cache
(path)
Given the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is ...
Given the path to a .pyc. file, return the path to its .py file.
def source_from_cache(path): """Given the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If ...
[ "def", "source_from_cache", "(", "path", ")", ":", "if", "sys", ".", "implementation", ".", "cache_tag", "is", "None", ":", "raise", "NotImplementedError", "(", "'sys.implementation.cache_tag is None'", ")", "path", "=", "_os", ".", "fspath", "(", "path", ")", ...
[ 307, 0 ]
[ 338, 63 ]
python
en
['en', 'en', 'en']
True
_get_sourcefile
(bytecode_path)
Convert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API.
Convert a bytecode file path to a source path (if possible).
def _get_sourcefile(bytecode_path): """Convert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. """ if len(bytecode_path) == 0: return None rest, _, extension = bytecode...
[ "def", "_get_sourcefile", "(", "bytecode_path", ")", ":", "if", "len", "(", "bytecode_path", ")", "==", "0", ":", "return", "None", "rest", ",", "_", ",", "extension", "=", "bytecode_path", ".", "rpartition", "(", "'.'", ")", "if", "not", "rest", "or", ...
[ 341, 0 ]
[ 357, 70 ]
python
en
['en', 'en', 'en']
True
_calc_mode
(path)
Calculate the mode permissions for a bytecode file.
Calculate the mode permissions for a bytecode file.
def _calc_mode(path): """Calculate the mode permissions for a bytecode file.""" try: mode = _path_stat(path).st_mode except OSError: mode = 0o666 # We always ensure write access so we can update cached files # later even when the source files are read-only on Windows (#6074) mode...
[ "def", "_calc_mode", "(", "path", ")", ":", "try", ":", "mode", "=", "_path_stat", "(", "path", ")", ".", "st_mode", "except", "OSError", ":", "mode", "=", "0o666", "# We always ensure write access so we can update cached files", "# later even when the source files are ...
[ 372, 0 ]
[ 381, 15 ]
python
en
['en', 'en', 'en']
True
_check_name
(method)
Decorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised.
Decorator to verify that the module being requested matches the one the loader can handle.
def _check_name(method): """Decorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. """ def _check_name_wrapper(self...
[ "def", "_check_name", "(", "method", ")", ":", "def", "_check_name_wrapper", "(", "self", ",", "name", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "name", "elif", "sel...
[ 384, 0 ]
[ 409, 30 ]
python
en
['en', 'en', 'en']
True
_find_module_shim
(self, fullname)
Try to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec().
Try to find a loader for the specified module by delegating to self.find_loader().
def _find_module_shim(self, fullname): """Try to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). """ # Call find_loader(). If it returns a string (indicating this # is a namespace package portion), generate a...
[ "def", "_find_module_shim", "(", "self", ",", "fullname", ")", ":", "# Call find_loader(). If it returns a string (indicating this", "# is a namespace package portion), generate a warning and", "# return None.", "loader", ",", "portions", "=", "self", ".", "find_loader", "(", "...
[ 412, 0 ]
[ 426, 17 ]
python
en
['en', 'en', 'en']
True
_validate_bytecode_header
(data, source_stats=None, name=None, path=None)
Validate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile(). All other arguments are used to enhance error reporting. ImportError is raised when the magic number is incorrect or the bytecode is found to be stale. EOFError i...
Validate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile().
def _validate_bytecode_header(data, source_stats=None, name=None, path=None): """Validate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile(). All other arguments are used to enhance error reporting. ImportError is raised wh...
[ "def", "_validate_bytecode_header", "(", "data", ",", "source_stats", "=", "None", ",", "name", "=", "None", ",", "path", "=", "None", ")", ":", "exc_details", "=", "{", "}", "if", "name", "is", "not", "None", ":", "exc_details", "[", "'name'", "]", "=...
[ 429, 0 ]
[ 481, 20 ]
python
en
['en', 'en', 'en']
True
_compile_bytecode
(data, name=None, bytecode_path=None, source_path=None)
Compile bytecode as returned by _validate_bytecode_header().
Compile bytecode as returned by _validate_bytecode_header().
def _compile_bytecode(data, name=None, bytecode_path=None, source_path=None): """Compile bytecode as returned by _validate_bytecode_header().""" code = marshal.loads(data) if isinstance(code, _code_type): _bootstrap._verbose_message('code object from {!r}', bytecode_path) if source_path is n...
[ "def", "_compile_bytecode", "(", "data", ",", "name", "=", "None", ",", "bytecode_path", "=", "None", ",", "source_path", "=", "None", ")", ":", "code", "=", "marshal", ".", "loads", "(", "data", ")", "if", "isinstance", "(", "code", ",", "_code_type", ...
[ 484, 0 ]
[ 494, 56 ]
python
en
['en', 'en', 'en']
True
_code_to_bytecode
(code, mtime=0, source_size=0)
Compile a code object into bytecode for writing out to a byte-compiled file.
Compile a code object into bytecode for writing out to a byte-compiled file.
def _code_to_bytecode(code, mtime=0, source_size=0): """Compile a code object into bytecode for writing out to a byte-compiled file.""" data = bytearray(MAGIC_NUMBER) data.extend(_w_long(mtime)) data.extend(_w_long(source_size)) data.extend(marshal.dumps(code)) return data
[ "def", "_code_to_bytecode", "(", "code", ",", "mtime", "=", "0", ",", "source_size", "=", "0", ")", ":", "data", "=", "bytearray", "(", "MAGIC_NUMBER", ")", "data", ".", "extend", "(", "_w_long", "(", "mtime", ")", ")", "data", ".", "extend", "(", "_...
[ 496, 0 ]
[ 503, 15 ]
python
en
['en', 'en', 'en']
True
decode_source
(source_bytes)
Decode bytes representing source code and return the string. Universal newline support is used in the decoding.
Decode bytes representing source code and return the string.
def decode_source(source_bytes): """Decode bytes representing source code and return the string. Universal newline support is used in the decoding. """ import tokenize # To avoid bootstrap issues. source_bytes_readline = _io.BytesIO(source_bytes).readline encoding = tokenize.detect_encoding(so...
[ "def", "decode_source", "(", "source_bytes", ")", ":", "import", "tokenize", "# To avoid bootstrap issues.", "source_bytes_readline", "=", "_io", ".", "BytesIO", "(", "source_bytes", ")", ".", "readline", "encoding", "=", "tokenize", ".", "detect_encoding", "(", "so...
[ 506, 0 ]
[ 515, 67 ]
python
en
['en', 'en', 'en']
True
spec_from_file_location
(name, location=None, *, loader=None, submodule_search_locations=_POPULATE)
Return a module spec based on a file location. To indicate that the module is a package, set submodule_search_locations to a list of directory paths. An empty list is sufficient, though its not otherwise useful to the import system. The loader must take a spec as its only __init__() arg.
Return a module spec based on a file location.
def spec_from_file_location(name, location=None, *, loader=None, submodule_search_locations=_POPULATE): """Return a module spec based on a file location. To indicate that the module is a package, set submodule_search_locations to a list of directory paths. An empty list is ...
[ "def", "spec_from_file_location", "(", "name", ",", "location", "=", "None", ",", "*", ",", "loader", "=", "None", ",", "submodule_search_locations", "=", "_POPULATE", ")", ":", "if", "location", "is", "None", ":", "# The caller may simply want a partially populated...
[ 523, 0 ]
[ 586, 15 ]
python
en
['en', 'en', 'en']
True
_get_supported_file_loaders
()
Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes).
Returns a list of file-based module loaders.
def _get_supported_file_loaders(): """Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). """ extensions = ExtensionFileLoader, _imp.extension_suffixes() source = SourceFileLoader, SOURCE_SUFFIXES bytecode = SourcelessFileLoader, BYTECODE_SUFFIXES return [e...
[ "def", "_get_supported_file_loaders", "(", ")", ":", "extensions", "=", "ExtensionFileLoader", ",", "_imp", ".", "extension_suffixes", "(", ")", "source", "=", "SourceFileLoader", ",", "SOURCE_SUFFIXES", "bytecode", "=", "SourcelessFileLoader", ",", "BYTECODE_SUFFIXES",...
[ 1358, 0 ]
[ 1366, 41 ]
python
en
['en', 'et', 'en']
True
_setup
(_bootstrap_module)
Setup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module.
Setup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace.
def _setup(_bootstrap_module): """Setup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. """ global sys, _imp, _bootstrap _bootstrap = _bootstrap_module s...
[ "def", "_setup", "(", "_bootstrap_module", ")", ":", "global", "sys", ",", "_imp", ",", "_bootstrap", "_bootstrap", "=", "_bootstrap_module", "sys", "=", "_bootstrap", ".", "sys", "_imp", "=", "_bootstrap", ".", "_imp", "# Directly load built-in modules needed durin...
[ 1369, 0 ]
[ 1434, 52 ]
python
en
['en', 'en', 'en']
True
_install
(_bootstrap_module)
Install the path-based import components.
Install the path-based import components.
def _install(_bootstrap_module): """Install the path-based import components.""" _setup(_bootstrap_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) sys.meta_path.append(PathFinder)
[ "def", "_install", "(", "_bootstrap_module", ")", ":", "_setup", "(", "_bootstrap_module", ")", "supported_loaders", "=", "_get_supported_file_loaders", "(", ")", "sys", ".", "path_hooks", ".", "extend", "(", "[", "FileFinder", ".", "path_hook", "(", "*", "suppo...
[ 1437, 0 ]
[ 1442, 36 ]
python
en
['en', 'en', 'en']
True
WindowsRegistryFinder.find_module
(cls, fullname, path=None)
Find module named in the registry. This method is deprecated. Use exec_module() instead.
Find module named in the registry.
def find_module(cls, fullname, path=None): """Find module named in the registry. This method is deprecated. Use exec_module() instead. """ spec = cls.find_spec(fullname, path) if spec is not None: return spec.loader else: return None
[ "def", "find_module", "(", "cls", ",", "fullname", ",", "path", "=", "None", ")", ":", "spec", "=", "cls", ".", "find_spec", "(", "fullname", ",", "path", ")", "if", "spec", "is", "not", "None", ":", "return", "spec", ".", "loader", "else", ":", "r...
[ 642, 4 ]
[ 652, 23 ]
python
en
['en', 'en', 'en']
True
_LoaderBasics.is_package
(self, fullname)
Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.
Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.
def is_package(self, fullname): """Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.""" filename = _path_split(self.get_filename(fullname))[1] filename_base = filename.rsplit('.', 1)[0] tail_name ...
[ "def", "is_package", "(", "self", ",", "fullname", ")", ":", "filename", "=", "_path_split", "(", "self", ".", "get_filename", "(", "fullname", ")", ")", "[", "1", "]", "filename_base", "=", "filename", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", ...
[ 660, 4 ]
[ 666, 70 ]
python
en
['en', 'en', 'en']
True
_LoaderBasics.create_module
(self, spec)
Use default semantics for module creation.
Use default semantics for module creation.
def create_module(self, spec): """Use default semantics for module creation."""
[ "def", "create_module", "(", "self", ",", "spec", ")", ":" ]
[ 668, 4 ]
[ 669, 56 ]
python
fr
['fr', 'fr', 'en']
True
_LoaderBasics.exec_module
(self, module)
Execute the module.
Execute the module.
def exec_module(self, module): """Execute the module.""" code = self.get_code(module.__name__) if code is None: raise ImportError('cannot load module {!r} when get_code() ' 'returns None'.format(module.__name__)) _bootstrap._call_with_frames_remo...
[ "def", "exec_module", "(", "self", ",", "module", ")", ":", "code", "=", "self", ".", "get_code", "(", "module", ".", "__name__", ")", "if", "code", "is", "None", ":", "raise", "ImportError", "(", "'cannot load module {!r} when get_code() '", "'returns None'", ...
[ 671, 4 ]
[ 677, 73 ]
python
en
['en', 'gl', 'en']
True
_LoaderBasics.load_module
(self, fullname)
This module is deprecated.
This module is deprecated.
def load_module(self, fullname): """This module is deprecated.""" return _bootstrap._load_module_shim(self, fullname)
[ "def", "load_module", "(", "self", ",", "fullname", ")", ":", "return", "_bootstrap", ".", "_load_module_shim", "(", "self", ",", "fullname", ")" ]
[ 679, 4 ]
[ 681, 59 ]
python
en
['en', 'en', 'en']
True
SourceLoader.path_mtime
(self, path)
Optional method that returns the modification time (an int) for the specified path, where path is a str. Raises IOError when the path cannot be handled.
Optional method that returns the modification time (an int) for the specified path, where path is a str.
def path_mtime(self, path): """Optional method that returns the modification time (an int) for the specified path, where path is a str. Raises IOError when the path cannot be handled. """ raise IOError
[ "def", "path_mtime", "(", "self", ",", "path", ")", ":", "raise", "IOError" ]
[ 686, 4 ]
[ 692, 21 ]
python
en
['en', 'en', 'en']
True
SourceLoader.path_stats
(self, path)
Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method ...
Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code.
def path_stats(self, path): """Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source c...
[ "def", "path_stats", "(", "self", ",", "path", ")", ":", "return", "{", "'mtime'", ":", "self", ".", "path_mtime", "(", "path", ")", "}" ]
[ 694, 4 ]
[ 705, 47 ]
python
en
['en', 'en', 'en']
True
SourceLoader._cache_bytecode
(self, source_path, cache_path, data)
Optional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions
Optional method which writes data (bytes) to a file path (a str).
def _cache_bytecode(self, source_path, cache_path, data): """Optional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions """ # For backw...
[ "def", "_cache_bytecode", "(", "self", ",", "source_path", ",", "cache_path", ",", "data", ")", ":", "# For backwards compatibility, we delegate to set_data()", "return", "self", ".", "set_data", "(", "cache_path", ",", "data", ")" ]
[ 707, 4 ]
[ 715, 46 ]
python
en
['en', 'en', 'en']
True
SourceLoader.set_data
(self, path, data)
Optional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files.
Optional method which writes data (bytes) to a file path (a str).
def set_data(self, path, data): """Optional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. """
[ "def", "set_data", "(", "self", ",", "path", ",", "data", ")", ":" ]
[ 717, 4 ]
[ 721, 11 ]
python
en
['en', 'en', 'en']
True
SourceLoader.get_source
(self, fullname)
Concrete implementation of InspectLoader.get_source.
Concrete implementation of InspectLoader.get_source.
def get_source(self, fullname): """Concrete implementation of InspectLoader.get_source.""" path = self.get_filename(fullname) try: source_bytes = self.get_data(path) except OSError as exc: raise ImportError('source not available through get_data()', ...
[ "def", "get_source", "(", "self", ",", "fullname", ")", ":", "path", "=", "self", ".", "get_filename", "(", "fullname", ")", "try", ":", "source_bytes", "=", "self", ".", "get_data", "(", "path", ")", "except", "OSError", "as", "exc", ":", "raise", "Im...
[ 724, 4 ]
[ 732, 42 ]
python
en
['en', 'da', 'en']
True
SourceLoader.source_to_code
(self, data, path, *, _optimize=-1)
Return the code object compiled from source. The 'data' argument can be any object type that compile() supports.
Return the code object compiled from source.
def source_to_code(self, data, path, *, _optimize=-1): """Return the code object compiled from source. The 'data' argument can be any object type that compile() supports. """ return _bootstrap._call_with_frames_removed(compile, data, path, 'exec', ...
[ "def", "source_to_code", "(", "self", ",", "data", ",", "path", ",", "*", ",", "_optimize", "=", "-", "1", ")", ":", "return", "_bootstrap", ".", "_call_with_frames_removed", "(", "compile", ",", "data", ",", "path", ",", "'exec'", ",", "dont_inherit", "...
[ 734, 4 ]
[ 740, 78 ]
python
en
['en', 'en', 'en']
True
SourceLoader.get_code
(self, fullname)
Concrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented.
Concrete implementation of InspectLoader.get_code.
def get_code(self, fullname): """Concrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. """ source_path = self.get_filename(fullname) source_mtime = None ...
[ "def", "get_code", "(", "self", ",", "fullname", ")", ":", "source_path", "=", "self", ".", "get_filename", "(", "fullname", ")", "source_mtime", "=", "None", "try", ":", "bytecode_path", "=", "cache_from_source", "(", "source_path", ")", "except", "NotImpleme...
[ 742, 4 ]
[ 791, 26 ]
python
en
['en', 'da', 'en']
True
FileLoader.__init__
(self, fullname, path)
Cache the module name and the path to the file found by the finder.
Cache the module name and the path to the file found by the finder.
def __init__(self, fullname, path): """Cache the module name and the path to the file found by the finder.""" self.name = fullname self.path = path
[ "def", "__init__", "(", "self", ",", "fullname", ",", "path", ")", ":", "self", ".", "name", "=", "fullname", "self", ".", "path", "=", "path" ]
[ 799, 4 ]
[ 803, 24 ]
python
en
['en', 'en', 'en']
True
FileLoader.load_module
(self, fullname)
Load a module from a file. This method is deprecated. Use exec_module() instead.
Load a module from a file.
def load_module(self, fullname): """Load a module from a file. This method is deprecated. Use exec_module() instead. """ # The only reason for this method is for the name check. # Issue #14857: Avoid the zero-argument form of super so the implementation # of that form ...
[ "def", "load_module", "(", "self", ",", "fullname", ")", ":", "# The only reason for this method is for the name check.", "# Issue #14857: Avoid the zero-argument form of super so the implementation", "# of that form can be updated without breaking the frozen module", "return", "super", "(...
[ 813, 4 ]
[ 822, 60 ]
python
en
['en', 'en', 'en']
True
FileLoader.get_filename
(self, fullname)
Return the path to the source file as found by the finder.
Return the path to the source file as found by the finder.
def get_filename(self, fullname): """Return the path to the source file as found by the finder.""" return self.path
[ "def", "get_filename", "(", "self", ",", "fullname", ")", ":", "return", "self", ".", "path" ]
[ 825, 4 ]
[ 827, 24 ]
python
en
['en', 'en', 'en']
True
FileLoader.get_data
(self, path)
Return the data from path as raw bytes.
Return the data from path as raw bytes.
def get_data(self, path): """Return the data from path as raw bytes.""" with _io.FileIO(path, 'r') as file: return file.read()
[ "def", "get_data", "(", "self", ",", "path", ")", ":", "with", "_io", ".", "FileIO", "(", "path", ",", "'r'", ")", "as", "file", ":", "return", "file", ".", "read", "(", ")" ]
[ 829, 4 ]
[ 832, 30 ]
python
en
['en', 'en', 'en']
True
SourceFileLoader.path_stats
(self, path)
Return the metadata for the path.
Return the metadata for the path.
def path_stats(self, path): """Return the metadata for the path.""" st = _path_stat(path) return {'mtime': st.st_mtime, 'size': st.st_size}
[ "def", "path_stats", "(", "self", ",", "path", ")", ":", "st", "=", "_path_stat", "(", "path", ")", "return", "{", "'mtime'", ":", "st", ".", "st_mtime", ",", "'size'", ":", "st", ".", "st_size", "}" ]
[ 839, 4 ]
[ 842, 57 ]
python
en
['en', 'en', 'en']
True
SourceFileLoader.set_data
(self, path, data, *, _mode=0o666)
Write bytes data to a file.
Write bytes data to a file.
def set_data(self, path, data, *, _mode=0o666): """Write bytes data to a file.""" parent, filename = _path_split(path) path_parts = [] # Figure out what directories are missing. while parent and not _path_isdir(parent): parent, part = _path_split(parent) p...
[ "def", "set_data", "(", "self", ",", "path", ",", "data", ",", "*", ",", "_mode", "=", "0o666", ")", ":", "parent", ",", "filename", "=", "_path_split", "(", "path", ")", "path_parts", "=", "[", "]", "# Figure out what directories are missing.", "while", "...
[ 849, 4 ]
[ 877, 44 ]
python
en
['pt', 'en', 'en']
True
SourcelessFileLoader.get_source
(self, fullname)
Return None as there is no source code.
Return None as there is no source code.
def get_source(self, fullname): """Return None as there is no source code.""" return None
[ "def", "get_source", "(", "self", ",", "fullname", ")", ":", "return", "None" ]
[ 890, 4 ]
[ 892, 19 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.create_module
(self, spec)
Create an unitialized extension module
Create an unitialized extension module
def create_module(self, spec): """Create an unitialized extension module""" module = _bootstrap._call_with_frames_removed( _imp.create_dynamic, spec) _bootstrap._verbose_message('extension module {!r} loaded from {!r}', spec.name, self.path) return mo...
[ "def", "create_module", "(", "self", ",", "spec", ")", ":", "module", "=", "_bootstrap", ".", "_call_with_frames_removed", "(", "_imp", ".", "create_dynamic", ",", "spec", ")", "_bootstrap", ".", "_verbose_message", "(", "'extension module {!r} loaded from {!r}'", "...
[ 918, 4 ]
[ 924, 21 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.exec_module
(self, module)
Initialize an extension module
Initialize an extension module
def exec_module(self, module): """Initialize an extension module""" _bootstrap._call_with_frames_removed(_imp.exec_dynamic, module) _bootstrap._verbose_message('extension module {!r} executed from {!r}', self.name, self.path)
[ "def", "exec_module", "(", "self", ",", "module", ")", ":", "_bootstrap", ".", "_call_with_frames_removed", "(", "_imp", ".", "exec_dynamic", ",", "module", ")", "_bootstrap", ".", "_verbose_message", "(", "'extension module {!r} executed from {!r}'", ",", "self", "...
[ 926, 4 ]
[ 930, 46 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.is_package
(self, fullname)
Return True if the extension module is a package.
Return True if the extension module is a package.
def is_package(self, fullname): """Return True if the extension module is a package.""" file_name = _path_split(self.path)[1] return any(file_name == '__init__' + suffix for suffix in EXTENSION_SUFFIXES)
[ "def", "is_package", "(", "self", ",", "fullname", ")", ":", "file_name", "=", "_path_split", "(", "self", ".", "path", ")", "[", "1", "]", "return", "any", "(", "file_name", "==", "'__init__'", "+", "suffix", "for", "suffix", "in", "EXTENSION_SUFFIXES", ...
[ 932, 4 ]
[ 936, 52 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.get_code
(self, fullname)
Return None as an extension module cannot create a code object.
Return None as an extension module cannot create a code object.
def get_code(self, fullname): """Return None as an extension module cannot create a code object.""" return None
[ "def", "get_code", "(", "self", ",", "fullname", ")", ":", "return", "None" ]
[ 938, 4 ]
[ 940, 19 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.get_source
(self, fullname)
Return None as extension modules have no source code.
Return None as extension modules have no source code.
def get_source(self, fullname): """Return None as extension modules have no source code.""" return None
[ "def", "get_source", "(", "self", ",", "fullname", ")", ":", "return", "None" ]
[ 942, 4 ]
[ 944, 19 ]
python
en
['en', 'en', 'en']
True
ExtensionFileLoader.get_filename
(self, fullname)
Return the path to the source file as found by the finder.
Return the path to the source file as found by the finder.
def get_filename(self, fullname): """Return the path to the source file as found by the finder.""" return self.path
[ "def", "get_filename", "(", "self", ",", "fullname", ")", ":", "return", "self", ".", "path" ]
[ 947, 4 ]
[ 949, 24 ]
python
en
['en', 'en', 'en']
True
_NamespacePath._find_parent_path_names
(self)
Returns a tuple of (parent-module-name, parent-path-attr-name)
Returns a tuple of (parent-module-name, parent-path-attr-name)
def _find_parent_path_names(self): """Returns a tuple of (parent-module-name, parent-path-attr-name)""" parent, dot, me = self._name.rpartition('.') if dot == '': # This is a top-level module. sys.path contains the parent path. return 'sys', 'path' # Not a top-lev...
[ "def", "_find_parent_path_names", "(", "self", ")", ":", "parent", ",", "dot", ",", "me", "=", "self", ".", "_name", ".", "rpartition", "(", "'.'", ")", "if", "dot", "==", "''", ":", "# This is a top-level module. sys.path contains the parent path.", "return", "...
[ 965, 4 ]
[ 973, 33 ]
python
en
['en', 'fr', 'en']
True
_NamespaceLoader.module_repr
(cls, module)
Return repr for the module. The method is deprecated. The import machinery does the job itself.
Return repr for the module.
def module_repr(cls, module): """Return repr for the module. The method is deprecated. The import machinery does the job itself. """ return '<module {!r} (namespace)>'.format(module.__name__)
[ "def", "module_repr", "(", "cls", ",", "module", ")", ":", "return", "'<module {!r} (namespace)>'", ".", "format", "(", "module", ".", "__name__", ")" ]
[ 1017, 4 ]
[ 1023, 66 ]
python
en
['en', 'it', 'en']
True
_NamespaceLoader.create_module
(self, spec)
Use default semantics for module creation.
Use default semantics for module creation.
def create_module(self, spec): """Use default semantics for module creation."""
[ "def", "create_module", "(", "self", ",", "spec", ")", ":" ]
[ 1034, 4 ]
[ 1035, 56 ]
python
fr
['fr', 'fr', 'en']
True