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
is_appengine_sandbox
()
Reports if the app is running in the first generation sandbox. The second generation runtimes are technically still in a sandbox, but it is much less restrictive, so generally you shouldn't need to check for it. see https://cloud.google.com/appengine/docs/standard/runtimes
Reports if the app is running in the first generation sandbox.
def is_appengine_sandbox(): """Reports if the app is running in the first generation sandbox. The second generation runtimes are technically still in a sandbox, but it is much less restrictive, so generally you shouldn't need to check for it. see https://cloud.google.com/appengine/docs/standard/runtime...
[ "def", "is_appengine_sandbox", "(", ")", ":", "return", "is_appengine", "(", ")", "and", "os", ".", "environ", "[", "\"APPENGINE_RUNTIME\"", "]", "==", "\"python27\"" ]
[ 11, 0 ]
[ 18, 75 ]
python
en
['en', 'en', 'en']
True
is_prod_appengine_mvms
()
Deprecated.
Deprecated.
def is_prod_appengine_mvms(): """Deprecated.""" return False
[ "def", "is_prod_appengine_mvms", "(", ")", ":", "return", "False" ]
[ 33, 0 ]
[ 35, 16 ]
python
en
['en', 'la', 'it']
False
get_python_version
()
Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'.
Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'.
def get_python_version(): """Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """ return '%d.%d' % sys.version_info[:2]
[ "def", "get_python_version", "(", ")", ":", "return", "'%d.%d'", "%", "sys", ".", "version_info", "[", ":", "2", "]" ]
[ 80, 0 ]
[ 85, 41 ]
python
en
['en', 'en', 'en']
True
get_python_inc
(plat_specific=0, prefix=None)
Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pyconfig.h). If 'prefix' is supplied,...
Return the directory containing installed Python header files.
def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header fil...
[ "def", "get_python_inc", "(", "plat_specific", "=", "0", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "prefix", "=", "plat_specific", "and", "BASE_EXEC_PREFIX", "or", "BASE_PREFIX", "if", "IS_PYPY", ":", "return", "os", ".", "pa...
[ 88, 0 ]
[ 127, 41 ]
python
en
['en', 'en', 'en']
True
get_python_lib
(plat_specific=0, standard_lib=0, prefix=None)
Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_...
Return the directory containing the Python library (standard or site additions).
def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; ot...
[ "def", "get_python_lib", "(", "plat_specific", "=", "0", ",", "standard_lib", "=", "0", ",", "prefix", "=", "None", ")", ":", "if", "IS_PYPY", ":", "# PyPy-specific schema", "if", "prefix", "is", "None", ":", "prefix", "=", "PREFIX", "if", "standard_lib", ...
[ 130, 0 ]
[ 180, 41 ]
python
en
['en', 'en', 'en']
True
customize_compiler
(compiler)
Do any platform-specific customization of a CCompiler instance. Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile.
Do any platform-specific customization of a CCompiler instance.
def customize_compiler(compiler): """Do any platform-specific customization of a CCompiler instance. Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile. """ if compiler.compiler_type == "unix": if sys.platform == "darwin": ...
[ "def", "customize_compiler", "(", "compiler", ")", ":", "if", "compiler", ".", "compiler_type", "==", "\"unix\"", ":", "if", "sys", ".", "platform", "==", "\"darwin\"", ":", "# Perform first-time customization of compiler-related", "# config vars on OS X now that we know we...
[ 184, 0 ]
[ 254, 52 ]
python
en
['en', 'en', 'en']
True
get_config_h_filename
()
Return full pathname of installed pyconfig.h file.
Return full pathname of installed pyconfig.h file.
def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" if python_build: if os.name == "nt": inc_dir = os.path.join(_sys_home or project_base, "PC") else: inc_dir = _sys_home or project_base else: inc_dir = get_python_inc(plat_spe...
[ "def", "get_config_h_filename", "(", ")", ":", "if", "python_build", ":", "if", "os", ".", "name", "==", "\"nt\"", ":", "inc_dir", "=", "os", ".", "path", ".", "join", "(", "_sys_home", "or", "project_base", ",", "\"PC\"", ")", "else", ":", "inc_dir", ...
[ 257, 0 ]
[ 267, 46 ]
python
en
['en', 'en', 'en']
True
get_makefile_filename
()
Return full pathname of installed Makefile from the Python build.
Return full pathname of installed Makefile from the Python build.
def get_makefile_filename(): """Return full pathname of installed Makefile from the Python build.""" if python_build: return os.path.join(_sys_home or project_base, "Makefile") lib_dir = get_python_lib(plat_specific=0, standard_lib=1) config_file = 'config-{}{}'.format(get_python_version(), buil...
[ "def", "get_makefile_filename", "(", ")", ":", "if", "python_build", ":", "return", "os", ".", "path", ".", "join", "(", "_sys_home", "or", "project_base", ",", "\"Makefile\"", ")", "lib_dir", "=", "get_python_lib", "(", "plat_specific", "=", "0", ",", "stan...
[ 270, 0 ]
[ 278, 57 ]
python
en
['en', 'en', 'en']
True
parse_config_h
(fp, g=None)
Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
Parse a config.h-style file.
def parse_config_h(fp, g=None): """Parse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ if g is None: g = {} define_rx = re.compile("#define ([A-...
[ "def", "parse_config_h", "(", "fp", ",", "g", "=", "None", ")", ":", "if", "g", "is", "None", ":", "g", "=", "{", "}", "define_rx", "=", "re", ".", "compile", "(", "\"#define ([A-Z][A-Za-z0-9_]+) (.*)\\n\"", ")", "undef_rx", "=", "re", ".", "compile", ...
[ 281, 0 ]
[ 307, 12 ]
python
en
['es', 'en', 'en']
True
parse_makefile
(fn, g=None)
Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary.
Parse a Makefile-style file.
def parse_makefile(fn, g=None): """Parse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. """ from distutils.text_file import TextFile fp = TextFile(fn, strip_...
[ "def", "parse_makefile", "(", "fn", ",", "g", "=", "None", ")", ":", "from", "distutils", ".", "text_file", "import", "TextFile", "fp", "=", "TextFile", "(", "fn", ",", "strip_comments", "=", "1", ",", "skip_blanks", "=", "1", ",", "join_lines", "=", "...
[ 316, 0 ]
[ 419, 12 ]
python
en
['en', 'en', 'en']
True
expand_makefile_vars
(s, vars)
Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars'...
Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars'...
def expand_makefile_vars(s, vars): """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain ...
[ "def", "expand_makefile_vars", "(", "s", ",", "vars", ")", ":", "# This algorithm does multiple expansion, so if vars['foo'] contains", "# \"${bar}\", it will expand ${foo} to ${bar}, and then expand", "# ${bar}... and so forth. This is fine as long as 'vars' comes from", "# 'parse_makefile()...
[ 422, 0 ]
[ 444, 12 ]
python
en
['en', 'en', 'en']
True
_init_posix
()
Initialize the module as appropriate for POSIX systems.
Initialize the module as appropriate for POSIX systems.
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" # _sysconfigdata is generated at build time, see the sysconfig module name = os.environ.get('_PYTHON_SYSCONFIGDATA_NAME', '_sysconfigdata_{abi}_{platform}_{multiarch}'.format( abi=sys.abiflags, platform=...
[ "def", "_init_posix", "(", ")", ":", "# _sysconfigdata is generated at build time, see the sysconfig module", "name", "=", "os", ".", "environ", ".", "get", "(", "'_PYTHON_SYSCONFIGDATA_NAME'", ",", "'_sysconfigdata_{abi}_{platform}_{multiarch}'", ".", "format", "(", "abi", ...
[ 449, 0 ]
[ 467, 40 ]
python
en
['en', 'en', 'en']
True
_init_nt
()
Initialize the module as appropriate for NT
Initialize the module as appropriate for NT
def _init_nt(): """Initialize the module as appropriate for NT""" g = {} # set basic install directories g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1) g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1) # XXX hmmm.. a normal install puts include files here g['...
[ "def", "_init_nt", "(", ")", ":", "g", "=", "{", "}", "# set basic install directories", "g", "[", "'LIBDEST'", "]", "=", "get_python_lib", "(", "plat_specific", "=", "0", ",", "standard_lib", "=", "1", ")", "g", "[", "'BINLIBDEST'", "]", "=", "get_python_...
[ 470, 0 ]
[ 486, 20 ]
python
en
['en', 'en', 'en']
True
get_config_vars
(*args)
With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows it'...
With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows it'...
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's ...
[ "def", "get_config_vars", "(", "*", "args", ")", ":", "global", "_config_vars", "if", "_config_vars", "is", "None", ":", "func", "=", "globals", "(", ")", ".", "get", "(", "\"_init_\"", "+", "os", ".", "name", ")", "if", "func", ":", "func", "(", ")"...
[ 489, 0 ]
[ 562, 27 ]
python
en
['en', 'en', 'en']
True
get_config_var
(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ if name == 'SO': import warnings warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2) return...
[ "def", "get_config_var", "(", "name", ")", ":", "if", "name", "==", "'SO'", ":", "import", "warnings", "warnings", ".", "warn", "(", "'SO is deprecated, use EXT_SUFFIX'", ",", "DeprecationWarning", ",", "2", ")", "return", "get_config_vars", "(", ")", ".", "ge...
[ 564, 0 ]
[ 572, 38 ]
python
en
['en', 'en', 'en']
True
_get
(d, expected_type, key, default=None)
Get value from dictionary and verify expected type.
Get value from dictionary and verify expected type.
def _get(d, expected_type, key, default=None): # type: (Dict[str, Any], Type[T], str, Optional[T]) -> Optional[T] """Get value from dictionary and verify expected type.""" if key not in d: return default value = d[key] if six.PY2 and expected_type is str: expected_type = six.string_t...
[ "def", "_get", "(", "d", ",", "expected_type", ",", "key", ",", "default", "=", "None", ")", ":", "# type: (Dict[str, Any], Type[T], str, Optional[T]) -> Optional[T]", "if", "key", "not", "in", "d", ":", "return", "default", "value", "=", "d", "[", "key", "]",...
[ 33, 0 ]
[ 47, 16 ]
python
en
['en', 'en', 'en']
True
_filter_none
(**kwargs)
Make dict excluding None values.
Make dict excluding None values.
def _filter_none(**kwargs): # type: (Any) -> Dict[str, Any] """Make dict excluding None values.""" return {k: v for k, v in kwargs.items() if v is not None}
[ "def", "_filter_none", "(", "*", "*", "kwargs", ")", ":", "# type: (Any) -> Dict[str, Any]", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", "if", "v", "is", "not", "None", "}" ]
[ 73, 0 ]
[ 76, 61 ]
python
en
['en', 'en', 'en']
True
DirectUrl.redacted_url
(self)
url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL.
url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL.
def redacted_url(self): # type: () -> str """url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. """ purl = urllib_parse.urlsplit(self.url) netloc = self._remove_aut...
[ "def", "redacted_url", "(", "self", ")", ":", "# type: () -> str", "purl", "=", "urllib_parse", ".", "urlsplit", "(", "self", ".", "url", ")", "netloc", "=", "self", ".", "_remove_auth_from_netloc", "(", "purl", ".", "netloc", ")", "surl", "=", "urllib_parse...
[ 196, 4 ]
[ 207, 19 ]
python
en
['en', 'en', 'en']
True
register_indexes
()
Grabs all required indexes from filters and registers them.
Grabs all required indexes from filters and registers them.
def register_indexes(): """ Grabs all required indexes from filters and registers them. """ index_logger = logging.getLogger('sentry.setup') for filter_ in get_filters(): if filter_.column.startswith('data__'): MessageIndex.objects.register_index(filter_.column, index_to='group')...
[ "def", "register_indexes", "(", ")", ":", "index_logger", "=", "logging", ".", "getLogger", "(", "'sentry.setup'", ")", "for", "filter_", "in", "get_filters", "(", ")", ":", "if", "filter_", ".", "column", ".", "startswith", "(", "'data__'", ")", ":", "Mes...
[ 392, 0 ]
[ 400, 78 ]
python
en
['en', 'error', 'th']
False
register_doom_envs_rllib
(**kwargs)
Register env factories in RLLib system.
Register env factories in RLLib system.
def register_doom_envs_rllib(**kwargs): """Register env factories in RLLib system.""" for spec in DOOM_ENVS: def make_env_func(env_config): print('Creating env!!!') cfg = default_cfg(env=spec.name) cfg.pixel_format = 'HWC' # tensorflow models expect HWC by default ...
[ "def", "register_doom_envs_rllib", "(", "*", "*", "kwargs", ")", ":", "for", "spec", "in", "DOOM_ENVS", ":", "def", "make_env_func", "(", "env_config", ")", ":", "print", "(", "'Creating env!!!'", ")", "cfg", "=", "default_cfg", "(", "env", "=", "spec", "....
[ 10, 0 ]
[ 45, 46 ]
python
en
['en', 'sv', 'en']
True
env
(name, default=NoDefaultValue, type_=str)
Get a configuration value from the environment. Arguments --------- name : str The name of the environment variable to pull from for this setting. default : any A default value of the return type in case the intended environment variable is not set. If this argument...
Get a configuration value from the environment.
def env(name, default=NoDefaultValue, type_=str): """ Get a configuration value from the environment. Arguments --------- name : str The name of the environment variable to pull from for this setting. default : any A default value of the return type in case the intended ...
[ "def", "env", "(", "name", ",", "default", "=", "NoDefaultValue", ",", "type_", "=", "str", ")", ":", "try", ":", "val", "=", "environ", "[", "name", "]", "except", "KeyError", ":", "if", "default", "==", "NoDefaultValue", ":", "raise", "ImproperlyConfig...
[ 39, 0 ]
[ 76, 14 ]
python
en
['en', 'error', 'th']
False
walk_revctrl
(dirname='')
Find all files under revision control
Find all files under revision control
def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): for item in ep.load()(dirname): yield item
[ "def", "walk_revctrl", "(", "dirname", "=", "''", ")", ":", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "'setuptools.file_finders'", ")", ":", "for", "item", "in", "ep", ".", "load", "(", ")", "(", "dirname", ")", ":", "yield", "it...
[ 16, 0 ]
[ 20, 22 ]
python
en
['en', 'en', 'en']
True
sdist.make_distribution
(self)
Workaround for #516
Workaround for #516
def make_distribution(self): """ Workaround for #516 """ with self._remove_os_link(): orig.sdist.make_distribution(self)
[ "def", "make_distribution", "(", "self", ")", ":", "with", "self", ".", "_remove_os_link", "(", ")", ":", "orig", ".", "sdist", ".", "make_distribution", "(", "self", ")" ]
[ 72, 4 ]
[ 77, 46 ]
python
en
['en', 'error', 'th']
False
sdist._remove_os_link
()
In a context, remove and restore os.link if it exists
In a context, remove and restore os.link if it exists
def _remove_os_link(): """ In a context, remove and restore os.link if it exists """ class NoValue: pass orig_val = getattr(os, 'link', NoValue) try: del os.link except Exception: pass try: yield fi...
[ "def", "_remove_os_link", "(", ")", ":", "class", "NoValue", ":", "pass", "orig_val", "=", "getattr", "(", "os", ",", "'link'", ",", "NoValue", ")", "try", ":", "del", "os", ".", "link", "except", "Exception", ":", "pass", "try", ":", "yield", "finally...
[ 81, 4 ]
[ 98, 45 ]
python
en
['en', 'error', 'th']
False
sdist._add_defaults_python
(self)
getting python files
getting python files
def _add_defaults_python(self): """getting python files""" if self.distribution.has_pure_modules(): build_py = self.get_finalized_command('build_py') self.filelist.extend(build_py.get_source_files()) self._add_data_files(self._safe_data_files(build_py))
[ "def", "_add_defaults_python", "(", "self", ")", ":", "if", "self", ".", "distribution", ".", "has_pure_modules", "(", ")", ":", "build_py", "=", "self", ".", "get_finalized_command", "(", "'build_py'", ")", "self", ".", "filelist", ".", "extend", "(", "buil...
[ 105, 4 ]
[ 110, 65 ]
python
en
['en', 'en', 'en']
True
sdist._safe_data_files
(self, build_py)
Extracting data_files from build_py is known to cause infinite recursion errors when `include_package_data` is enabled, so suppress it in that case.
Extracting data_files from build_py is known to cause infinite recursion errors when `include_package_data` is enabled, so suppress it in that case.
def _safe_data_files(self, build_py): """ Extracting data_files from build_py is known to cause infinite recursion errors when `include_package_data` is enabled, so suppress it in that case. """ if self.distribution.include_package_data: return () retu...
[ "def", "_safe_data_files", "(", "self", ",", "build_py", ")", ":", "if", "self", ".", "distribution", ".", "include_package_data", ":", "return", "(", ")", "return", "build_py", ".", "data_files" ]
[ 112, 4 ]
[ 120, 34 ]
python
en
['en', 'error', 'th']
False
sdist._add_data_files
(self, data_files)
Add data files as found in build_py.data_files.
Add data files as found in build_py.data_files.
def _add_data_files(self, data_files): """ Add data files as found in build_py.data_files. """ self.filelist.extend( os.path.join(src_dir, name) for _, src_dir, _, filenames in data_files for name in filenames )
[ "def", "_add_data_files", "(", "self", ",", "data_files", ")", ":", "self", ".", "filelist", ".", "extend", "(", "os", ".", "path", ".", "join", "(", "src_dir", ",", "name", ")", "for", "_", ",", "src_dir", ",", "_", ",", "filenames", "in", "data_fil...
[ 122, 4 ]
[ 130, 9 ]
python
en
['en', 'error', 'th']
False
sdist.read_manifest
(self)
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution.
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest, 'rb') ...
[ "def", "read_manifest", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest file '%s'\"", ",", "self", ".", "manifest", ")", "manifest", "=", "open", "(", "self", ".", "manifest", ",", "'rb'", ")", "for", "line", "in", "manifest", ":", "#...
[ 171, 4 ]
[ 190, 24 ]
python
en
['en', 'en', 'en']
True
sdist.check_license
(self)
Checks if license_file' or 'license_files' is configured and adds any valid paths to 'self.filelist'.
Checks if license_file' or 'license_files' is configured and adds any valid paths to 'self.filelist'.
def check_license(self): """Checks if license_file' or 'license_files' is configured and adds any valid paths to 'self.filelist'. """ files = ordered_set.OrderedSet() opts = self.distribution.get_option_dict('metadata') # ignore the source of the value _, licen...
[ "def", "check_license", "(", "self", ")", ":", "files", "=", "ordered_set", ".", "OrderedSet", "(", ")", "opts", "=", "self", ".", "distribution", ".", "get_option_dict", "(", "'metadata'", ")", "# ignore the source of the value", "_", ",", "license_file", "=", ...
[ 192, 4 ]
[ 221, 35 ]
python
en
['en', 'en', 'en']
True
Dataspace.push
(self)
Store all current data to a storage strategy
Store all current data to a storage strategy
def push(self): """ Store all current data to a storage strategy """ self._context.write(self._databases)
[ "def", "push", "(", "self", ")", ":", "self", ".", "_context", ".", "write", "(", "self", ".", "_databases", ")" ]
[ 24, 4 ]
[ 28, 44 ]
python
en
['en', 'error', 'th']
False
Dataspace.pull
(self)
Retrieve data from a storage strategy
Retrieve data from a storage strategy
def pull(self): """ Retrieve data from a storage strategy """ self._databases = {} self._context.read(self._databases)
[ "def", "pull", "(", "self", ")", ":", "self", ".", "_databases", "=", "{", "}", "self", ".", "_context", ".", "read", "(", "self", ".", "_databases", ")" ]
[ 30, 4 ]
[ 35, 43 ]
python
en
['en', 'error', 'th']
False
str_to_display
(data, desc=None)
For display or logging purposes, convert a bytes object (or text) to text (e.g. unicode in Python 2) safe for output. :param desc: An optional phrase describing the input data, for use in the log message if a warning is logged. Defaults to "Bytes object". This function should never error out ...
For display or logging purposes, convert a bytes object (or text) to text (e.g. unicode in Python 2) safe for output.
def str_to_display(data, desc=None): # type: (Union[bytes, Text], Optional[str]) -> Text """ For display or logging purposes, convert a bytes object (or text) to text (e.g. unicode in Python 2) safe for output. :param desc: An optional phrase describing the input data, for use in the log me...
[ "def", "str_to_display", "(", "data", ",", "desc", "=", "None", ")", ":", "# type: (Union[bytes, Text], Optional[str]) -> Text", "if", "isinstance", "(", "data", ",", "text_type", ")", ":", "return", "data", "# Otherwise, data is a bytes object (str in Python 2).", "# Fir...
[ 88, 0 ]
[ 152, 23 ]
python
en
['en', 'error', 'th']
False
console_to_str
(data)
Return a string, safe for output, of subprocess output.
Return a string, safe for output, of subprocess output.
def console_to_str(data): # type: (bytes) -> Text """Return a string, safe for output, of subprocess output. """ return str_to_display(data, desc='Subprocess output')
[ "def", "console_to_str", "(", "data", ")", ":", "# type: (bytes) -> Text", "return", "str_to_display", "(", "data", ",", "desc", "=", "'Subprocess output'", ")" ]
[ 155, 0 ]
[ 159, 57 ]
python
en
['en', 'en', 'en']
True
get_path_uid
(path)
Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read.
Return path's uid.
def get_path_uid(path): # type: (str) -> int """ Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is...
[ "def", "get_path_uid", "(", "path", ")", ":", "# type: (str) -> int", "if", "hasattr", "(", "os", ",", "'O_NOFOLLOW'", ")", ":", "fd", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_RDONLY", "|", "os", ".", "O_NOFOLLOW", ")", "file_uid", "=", ...
[ 162, 0 ]
[ 190, 19 ]
python
en
['en', 'error', 'th']
False
expanduser
(path)
Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768
Expand ~ and ~user constructions.
def expanduser(path): # type: (str) -> str """ Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768 """ expanded = os.path.expanduser(path) if path.startswith('~/') and expanded.startswith('//'): expanded = expanded[1:] return expanded
[ "def", "expanduser", "(", "path", ")", ":", "# type: (str) -> str", "expanded", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "path", ".", "startswith", "(", "'~/'", ")", "and", "expanded", ".", "startswith", "(", "'//'", ")", ":", ...
[ 193, 0 ]
[ 203, 19 ]
python
en
['en', 'error', 'th']
False
samefile
(file1, file2)
Provide an alternative for os.path.samefile on Windows/Python2
Provide an alternative for os.path.samefile on Windows/Python2
def samefile(file1, file2): # type: (str, str) -> bool """Provide an alternative for os.path.samefile on Windows/Python2""" if hasattr(os.path, 'samefile'): return os.path.samefile(file1, file2) else: path1 = os.path.normcase(os.path.abspath(file1)) path2 = os.path.normcase(os.pa...
[ "def", "samefile", "(", "file1", ",", "file2", ")", ":", "# type: (str, str) -> bool", "if", "hasattr", "(", "os", ".", "path", ",", "'samefile'", ")", ":", "return", "os", ".", "path", ".", "samefile", "(", "file1", ",", "file2", ")", "else", ":", "pa...
[ 219, 0 ]
[ 227, 29 ]
python
en
['en', 'ga', 'en']
True
update_wrapper
(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES)
Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS)...
Update a wrapper function to look like the wrapped function
def update_wrapper(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assign...
[ "def", "update_wrapper", "(", "wrapper", ",", "wrapped", ",", "assigned", "=", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "WRAPPER_UPDATES", ")", ":", "for", "attr", "in", "assigned", ":", "try", ":", "value", "=", "getattr", "(", "wrapped", ",", "attr", ...
[ 43, 0 ]
[ 71, 18 ]
python
en
['en', 'en', 'en']
True
wraps
(wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES)
Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as the remaining arguments. Default arguments are as for update_wrapper(). This is a convenien...
Decorator factory to apply update_wrapper() to a wrapper function
def wraps(wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as...
[ "def", "wraps", "(", "wrapped", ",", "assigned", "=", "WRAPPER_ASSIGNMENTS", ",", "updated", "=", "WRAPPER_UPDATES", ")", ":", "return", "partial", "(", "update_wrapper", ",", "wrapped", "=", "wrapped", ",", "assigned", "=", "assigned", ",", "updated", "=", ...
[ 73, 0 ]
[ 85, 54 ]
python
en
['en', 'en', 'en']
True
_gt_from_lt
(self, other, NotImplemented=NotImplemented)
Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
Return a > b. Computed by
def _gt_from_lt(self, other, NotImplemented=NotImplemented): 'Return a > b. Computed by @total_ordering from (not a < b) and (a != b).' op_result = self.__lt__(other) if op_result is NotImplemented: return op_result return not op_result and self != other
[ "def", "_gt_from_lt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 97, 0 ]
[ 102, 42 ]
python
en
['en', 'en', 'en']
True
_le_from_lt
(self, other, NotImplemented=NotImplemented)
Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
Return a <= b. Computed by
def _le_from_lt(self, other, NotImplemented=NotImplemented): 'Return a <= b. Computed by @total_ordering from (a < b) or (a == b).' op_result = self.__lt__(other) return op_result or self == other
[ "def", "_le_from_lt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "return", "op_result", "or", "self", "==", "other" ]
[ 104, 0 ]
[ 107, 37 ]
python
en
['en', 'en', 'en']
True
_ge_from_lt
(self, other, NotImplemented=NotImplemented)
Return a >= b. Computed by @total_ordering from (not a < b).
Return a >= b. Computed by
def _ge_from_lt(self, other, NotImplemented=NotImplemented): 'Return a >= b. Computed by @total_ordering from (not a < b).' op_result = self.__lt__(other) if op_result is NotImplemented: return op_result return not op_result
[ "def", "_ge_from_lt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__lt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 109, 0 ]
[ 114, 24 ]
python
en
['en', 'en', 'en']
True
_ge_from_le
(self, other, NotImplemented=NotImplemented)
Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).
Return a >= b. Computed by
def _ge_from_le(self, other, NotImplemented=NotImplemented): 'Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).' op_result = self.__le__(other) if op_result is NotImplemented: return op_result return not op_result or self == other
[ "def", "_ge_from_le", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 116, 0 ]
[ 121, 41 ]
python
en
['en', 'en', 'en']
True
_lt_from_le
(self, other, NotImplemented=NotImplemented)
Return a < b. Computed by @total_ordering from (a <= b) and (a != b).
Return a < b. Computed by
def _lt_from_le(self, other, NotImplemented=NotImplemented): 'Return a < b. Computed by @total_ordering from (a <= b) and (a != b).' op_result = self.__le__(other) if op_result is NotImplemented: return op_result return op_result and self != other
[ "def", "_lt_from_le", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "op_result", ...
[ 123, 0 ]
[ 128, 38 ]
python
en
['en', 'en', 'en']
True
_gt_from_le
(self, other, NotImplemented=NotImplemented)
Return a > b. Computed by @total_ordering from (not a <= b).
Return a > b. Computed by
def _gt_from_le(self, other, NotImplemented=NotImplemented): 'Return a > b. Computed by @total_ordering from (not a <= b).' op_result = self.__le__(other) if op_result is NotImplemented: return op_result return not op_result
[ "def", "_gt_from_le", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__le__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 130, 0 ]
[ 135, 24 ]
python
en
['en', 'en', 'en']
True
_lt_from_gt
(self, other, NotImplemented=NotImplemented)
Return a < b. Computed by @total_ordering from (not a > b) and (a != b).
Return a < b. Computed by
def _lt_from_gt(self, other, NotImplemented=NotImplemented): 'Return a < b. Computed by @total_ordering from (not a > b) and (a != b).' op_result = self.__gt__(other) if op_result is NotImplemented: return op_result return not op_result and self != other
[ "def", "_lt_from_gt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 137, 0 ]
[ 142, 42 ]
python
en
['en', 'en', 'en']
True
_ge_from_gt
(self, other, NotImplemented=NotImplemented)
Return a >= b. Computed by @total_ordering from (a > b) or (a == b).
Return a >= b. Computed by
def _ge_from_gt(self, other, NotImplemented=NotImplemented): 'Return a >= b. Computed by @total_ordering from (a > b) or (a == b).' op_result = self.__gt__(other) return op_result or self == other
[ "def", "_ge_from_gt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "return", "op_result", "or", "self", "==", "other" ]
[ 144, 0 ]
[ 147, 37 ]
python
en
['en', 'en', 'en']
True
_le_from_gt
(self, other, NotImplemented=NotImplemented)
Return a <= b. Computed by @total_ordering from (not a > b).
Return a <= b. Computed by
def _le_from_gt(self, other, NotImplemented=NotImplemented): 'Return a <= b. Computed by @total_ordering from (not a > b).' op_result = self.__gt__(other) if op_result is NotImplemented: return op_result return not op_result
[ "def", "_le_from_gt", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 149, 0 ]
[ 154, 24 ]
python
en
['en', 'en', 'en']
True
_le_from_ge
(self, other, NotImplemented=NotImplemented)
Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).
Return a <= b. Computed by
def _le_from_ge(self, other, NotImplemented=NotImplemented): 'Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).' op_result = self.__ge__(other) if op_result is NotImplemented: return op_result return not op_result or self == other
[ "def", "_le_from_ge", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 156, 0 ]
[ 161, 41 ]
python
en
['en', 'en', 'en']
True
_gt_from_ge
(self, other, NotImplemented=NotImplemented)
Return a > b. Computed by @total_ordering from (a >= b) and (a != b).
Return a > b. Computed by
def _gt_from_ge(self, other, NotImplemented=NotImplemented): 'Return a > b. Computed by @total_ordering from (a >= b) and (a != b).' op_result = self.__ge__(other) if op_result is NotImplemented: return op_result return op_result and self != other
[ "def", "_gt_from_ge", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "op_result", ...
[ 163, 0 ]
[ 168, 38 ]
python
en
['en', 'en', 'en']
True
_lt_from_ge
(self, other, NotImplemented=NotImplemented)
Return a < b. Computed by @total_ordering from (not a >= b).
Return a < b. Computed by
def _lt_from_ge(self, other, NotImplemented=NotImplemented): 'Return a < b. Computed by @total_ordering from (not a >= b).' op_result = self.__ge__(other) if op_result is NotImplemented: return op_result return not op_result
[ "def", "_lt_from_ge", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "self", ".", "__ge__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "op_result", "return", "not", "op_r...
[ 170, 0 ]
[ 175, 24 ]
python
en
['en', 'en', 'en']
True
total_ordering
(cls)
Class decorator that fills in missing ordering methods
Class decorator that fills in missing ordering methods
def total_ordering(cls): """Class decorator that fills in missing ordering methods""" # Find user-defined comparisons (not those inherited from object). roots = [op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)] if not roots: raise ValueError('must define at least...
[ "def", "total_ordering", "(", "cls", ")", ":", "# Find user-defined comparisons (not those inherited from object).", "roots", "=", "[", "op", "for", "op", "in", "_convert", "if", "getattr", "(", "cls", ",", "op", ",", "None", ")", "is", "not", "getattr", "(", ...
[ 192, 0 ]
[ 203, 14 ]
python
en
['en', 'en', 'en']
True
cmp_to_key
(mycmp)
Convert a cmp= function into a key= function
Convert a cmp= function into a key= function
def cmp_to_key(mycmp): """Convert a cmp= function into a key= function""" class K(object): __slots__ = ['obj'] def __init__(self, obj): self.obj = obj def __lt__(self, other): return mycmp(self.obj, other.obj) < 0 def __gt__(self, other): retur...
[ "def", "cmp_to_key", "(", "mycmp", ")", ":", "class", "K", "(", "object", ")", ":", "__slots__", "=", "[", "'obj'", "]", "def", "__init__", "(", "self", ",", "obj", ")", ":", "self", ".", "obj", "=", "obj", "def", "__lt__", "(", "self", ",", "oth...
[ 210, 0 ]
[ 227, 12 ]
python
en
['en', 'en', 'en']
True
_make_key
(args, kwds, typed, kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, tuple=tuple, type=type, len=len)
Make a cache key from optionally typed positional and keyword arguments The key is constructed in a way that is flat as possible rather than as a nested structure that would take more memory. If there is only a single argument and its data type is known to cache its hash value, then that argument is r...
Make a cache key from optionally typed positional and keyword arguments
def _make_key(args, kwds, typed, kwd_mark = (object(),), fasttypes = {int, str, frozenset, type(None)}, tuple=tuple, type=type, len=len): """Make a cache key from optionally typed positional and keyword arguments The key is constructed in a way that is flat as possible ra...
[ "def", "_make_key", "(", "args", ",", "kwds", ",", "typed", ",", "kwd_mark", "=", "(", "object", "(", ")", ",", ")", ",", "fasttypes", "=", "{", "int", ",", "str", ",", "frozenset", ",", "type", "(", "None", ")", "}", ",", "tuple", "=", "tuple", ...
[ 420, 0 ]
[ 445, 26 ]
python
en
['en', 'en', 'en']
True
lru_cache
(maxsize=128, typed=False)
Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. If *typed* is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated as distinct calls with distinct results. ...
Least-recently-used cache decorator.
def lru_cache(maxsize=128, typed=False): """Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. If *typed* is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated...
[ "def", "lru_cache", "(", "maxsize", "=", "128", ",", "typed", "=", "False", ")", ":", "# Users should only access the lru_cache through its public API:", "# cache_info, cache_clear, and f.__wrapped__", "# The internals of the lru_cache are encapsulated for thread safety and", "# ...
[ 447, 0 ]
[ 482, 30 ]
python
en
['en', 'en', 'en']
True
_c3_merge
(sequences)
Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/.
Merges MROs in *sequences* to a single MRO using the C3 algorithm.
def _c3_merge(sequences): """Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. """ result = [] while True: sequences = [s for s in sequences if s] # purge empty sequences if not sequences: ...
[ "def", "_c3_merge", "(", "sequences", ")", ":", "result", "=", "[", "]", "while", "True", ":", "sequences", "=", "[", "s", "for", "s", "in", "sequences", "if", "s", "]", "# purge empty sequences", "if", "not", "sequences", ":", "return", "result", "for",...
[ 610, 0 ]
[ 635, 26 ]
python
en
['en', 'en', 'en']
True
_c3_mro
(cls, abcs=None)
Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into the resulting MRO. Unrelated ABCs ar...
Computes the method resolution order using extended C3 linearization.
def _c3_mro(cls, abcs=None): """Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into ...
[ "def", "_c3_mro", "(", "cls", ",", "abcs", "=", "None", ")", ":", "for", "i", ",", "base", "in", "enumerate", "(", "reversed", "(", "cls", ".", "__bases__", ")", ")", ":", "if", "hasattr", "(", "base", ",", "'__abstractmethods__'", ")", ":", "boundar...
[ 637, 0 ]
[ 680, 5 ]
python
en
['en', 'en', 'en']
True
_compose_mro
(cls, types)
Calculates the method resolution order for a given class *cls*. Includes relevant abstract base classes (with their respective bases) from the *types* iterable. Uses a modified C3 linearization algorithm.
Calculates the method resolution order for a given class *cls*.
def _compose_mro(cls, types): """Calculates the method resolution order for a given class *cls*. Includes relevant abstract base classes (with their respective bases) from the *types* iterable. Uses a modified C3 linearization algorithm. """ bases = set(cls.__mro__) # Remove entries which are ...
[ "def", "_compose_mro", "(", "cls", ",", "types", ")", ":", "bases", "=", "set", "(", "cls", ".", "__mro__", ")", "# Remove entries which are already present in the __mro__ or unrelated.", "def", "is_related", "(", "typ", ")", ":", "return", "(", "typ", "not", "i...
[ 682, 0 ]
[ 721, 33 ]
python
en
['en', 'en', 'en']
True
_find_impl
(cls, registry)
Returns the best matching implementation from *registry* for type *cls*. Where there is no registered implementation for a specific type, its method resolution order is used to find a more generic implementation. Note: if *registry* does not contain an implementation for the base *object* type, this f...
Returns the best matching implementation from *registry* for type *cls*.
def _find_impl(cls, registry): """Returns the best matching implementation from *registry* for type *cls*. Where there is no registered implementation for a specific type, its method resolution order is used to find a more generic implementation. Note: if *registry* does not contain an implementation ...
[ "def", "_find_impl", "(", "cls", ",", "registry", ")", ":", "mro", "=", "_compose_mro", "(", "cls", ",", "registry", ".", "keys", "(", ")", ")", "match", "=", "None", "for", "t", "in", "mro", ":", "if", "match", "is", "not", "None", ":", "# If *mat...
[ 723, 0 ]
[ 747, 30 ]
python
en
['en', 'en', 'en']
True
singledispatch
(func)
Single-dispatch generic function decorator. Transforms a function into a generic function, which can have different behaviours depending upon the type of its first argument. The decorated function acts as the default implementation, and additional implementations can be registered using the register() ...
Single-dispatch generic function decorator.
def singledispatch(func): """Single-dispatch generic function decorator. Transforms a function into a generic function, which can have different behaviours depending upon the type of its first argument. The decorated function acts as the default implementation, and additional implementations can be...
[ "def", "singledispatch", "(", "func", ")", ":", "registry", "=", "{", "}", "dispatch_cache", "=", "WeakKeyDictionary", "(", ")", "cache_token", "=", "None", "def", "dispatch", "(", "cls", ")", ":", "\"\"\"generic_func.dispatch(cls) -> <function implementation>\n\n ...
[ 749, 0 ]
[ 810, 18 ]
python
de
['de', 'ro', 'en']
False
further_validated_draft_dict
( draft_dict: Dict[str, Any], user_profile: UserProfile )
Take a draft_dict that was already validated by draft_dict_validator then further sanitize, validate, and transform it. Ultimately return this "further validated" draft dict. It will have a slightly different set of keys the values for which can be used to directly create a Draft object.
Take a draft_dict that was already validated by draft_dict_validator then further sanitize, validate, and transform it. Ultimately return this "further validated" draft dict. It will have a slightly different set of keys the values for which can be used to directly create a Draft object.
def further_validated_draft_dict( draft_dict: Dict[str, Any], user_profile: UserProfile ) -> Dict[str, Any]: """Take a draft_dict that was already validated by draft_dict_validator then further sanitize, validate, and transform it. Ultimately return this "further validated" draft dict. It will have a sl...
[ "def", "further_validated_draft_dict", "(", "draft_dict", ":", "Dict", "[", "str", ",", "Any", "]", ",", "user_profile", ":", "UserProfile", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "content", "=", "normalize_body", "(", "draft_dict", "[", "\"c...
[ 44, 0 ]
[ 85, 5 ]
python
en
['en', 'en', 'en']
True
invalidate_caches
()
Call the invalidate_caches() method on all meta path finders stored in sys.meta_path (where implemented).
Call the invalidate_caches() method on all meta path finders stored in sys.meta_path (where implemented).
def invalidate_caches(): """Call the invalidate_caches() method on all meta path finders stored in sys.meta_path (where implemented).""" for finder in sys.meta_path: if hasattr(finder, 'invalidate_caches'): finder.invalidate_caches()
[ "def", "invalidate_caches", "(", ")", ":", "for", "finder", "in", "sys", ".", "meta_path", ":", "if", "hasattr", "(", "finder", ",", "'invalidate_caches'", ")", ":", "finder", ".", "invalidate_caches", "(", ")" ]
[ 65, 0 ]
[ 70, 38 ]
python
en
['en', 'en', 'en']
True
find_loader
(name, path=None)
Return the loader for the specified module. This is a backward-compatible wrapper around find_spec(). This function is deprecated in favor of importlib.util.find_spec().
Return the loader for the specified module.
def find_loader(name, path=None): """Return the loader for the specified module. This is a backward-compatible wrapper around find_spec(). This function is deprecated in favor of importlib.util.find_spec(). """ warnings.warn('Use importlib.util.find_spec() instead.', Deprecation...
[ "def", "find_loader", "(", "name", ",", "path", "=", "None", ")", ":", "warnings", ".", "warn", "(", "'Use importlib.util.find_spec() instead.'", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "try", ":", "loader", "=", "sys", ".", "modules", "...
[ 73, 0 ]
[ 104, 22 ]
python
en
['en', 'en', 'en']
True
import_module
(name, package=None)
Import a module. The 'package' argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import.
Import a module.
def import_module(name, package=None): """Import a module. The 'package' argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import. """ level = 0 if name.startswith('.'): ...
[ "def", "import_module", "(", "name", ",", "package", "=", "None", ")", ":", "level", "=", "0", "if", "name", ".", "startswith", "(", "'.'", ")", ":", "if", "not", "package", ":", "msg", "=", "(", "\"the 'package' argument is required to perform a relative \"",...
[ 107, 0 ]
[ 125, 63 ]
python
en
['en', 'ro', 'en']
True
reload
(module)
Reload the module and return it. The module must have been successfully imported before.
Reload the module and return it.
def reload(module): """Reload the module and return it. The module must have been successfully imported before. """ if not module or not isinstance(module, types.ModuleType): raise TypeError("reload() argument must be a module") try: name = module.__spec__.name except Attribute...
[ "def", "reload", "(", "module", ")", ":", "if", "not", "module", "or", "not", "isinstance", "(", "module", ",", "types", ".", "ModuleType", ")", ":", "raise", "TypeError", "(", "\"reload() argument must be a module\"", ")", "try", ":", "name", "=", "module",...
[ 131, 0 ]
[ 172, 16 ]
python
en
['en', 'en', 'en']
True
register
(view)
Register API views to respond to a regex pattern. ``url_regex`` on a wrapped view class is used as the regex pattern. The view should be a standard Django class-based view implementing an as_view() method. The url_regex attribute of the view should be a standard Django URL regex pattern.
Register API views to respond to a regex pattern.
def register(view): """Register API views to respond to a regex pattern. ``url_regex`` on a wrapped view class is used as the regex pattern. The view should be a standard Django class-based view implementing an as_view() method. The url_regex attribute of the view should be a standard Django URL re...
[ "def", "register", "(", "view", ")", ":", "p", "=", "urls", ".", "url", "(", "view", ".", "url_regex", ",", "view", ".", "as_view", "(", ")", ")", "urlpatterns", ".", "append", "(", "p", ")", "return", "view" ]
[ 21, 0 ]
[ 31, 15 ]
python
en
['en', 'pt', 'en']
True
one_time
(method: Callable[[], ReturnT])
Use this decorator with extreme caution. The function you wrap should have no dependency on any arguments (no args, no kwargs) nor should it depend on any global state.
Use this decorator with extreme caution. The function you wrap should have no dependency on any arguments (no args, no kwargs) nor should it depend on any global state.
def one_time(method: Callable[[], ReturnT]) -> Callable[[], ReturnT]: """ Use this decorator with extreme caution. The function you wrap should have no dependency on any arguments (no args, no kwargs) nor should it depend on any global state. """ val = None def cache_wrapper() -> Return...
[ "def", "one_time", "(", "method", ":", "Callable", "[", "[", "]", ",", "ReturnT", "]", ")", "->", "Callable", "[", "[", "]", ",", "ReturnT", "]", ":", "val", "=", "None", "def", "cache_wrapper", "(", ")", "->", "ReturnT", ":", "nonlocal", "val", "i...
[ 82, 0 ]
[ 97, 24 ]
python
en
['en', 'error', 'th']
False
rewrite_local_links_to_relative
(db_data: Optional[DbData], link: str)
If the link points to a local destination (e.g. #narrow/...), generate a relative link that will open it in the current window.
If the link points to a local destination (e.g. #narrow/...), generate a relative link that will open it in the current window.
def rewrite_local_links_to_relative(db_data: Optional[DbData], link: str) -> str: """If the link points to a local destination (e.g. #narrow/...), generate a relative link that will open it in the current window. """ if db_data: realm_uri_prefix = db_data["realm_uri"] + "/" if ( ...
[ "def", "rewrite_local_links_to_relative", "(", "db_data", ":", "Optional", "[", "DbData", "]", ",", "link", ":", "str", ")", "->", "str", ":", "if", "db_data", ":", "realm_uri_prefix", "=", "db_data", "[", "\"realm_uri\"", "]", "+", "\"/\"", "if", "(", "li...
[ 257, 0 ]
[ 270, 15 ]
python
en
['en', 'en', 'en']
True
sanitize_url
(url: str)
Sanitize a URL against XSS attacks. See the docstring on markdown.inlinepatterns.LinkPattern.sanitize_url.
Sanitize a URL against XSS attacks. See the docstring on markdown.inlinepatterns.LinkPattern.sanitize_url.
def sanitize_url(url: str) -> Optional[str]: """ Sanitize a URL against XSS attacks. See the docstring on markdown.inlinepatterns.LinkPattern.sanitize_url. """ try: parts = urllib.parse.urlparse(url.replace(" ", "%20")) scheme, netloc, path, params, query, fragment = parts except...
[ "def", "sanitize_url", "(", "url", ":", "str", ")", "->", "Optional", "[", "str", "]", ":", "try", ":", "parts", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ".", "replace", "(", "\" \"", ",", "\"%20\"", ")", ")", "scheme", ",", "netlo...
[ 1544, 0 ]
[ 1596, 83 ]
python
en
['en', 'error', 'th']
False
prepare_linkifier_pattern
(source: str)
Augment a linkifier so it only matches after start-of-string, whitespace, or opening delimiters, won't match if there are word characters directly after, and saves what was matched as OUTER_CAPTURE_GROUP.
Augment a linkifier so it only matches after start-of-string, whitespace, or opening delimiters, won't match if there are word characters directly after, and saves what was matched as OUTER_CAPTURE_GROUP.
def prepare_linkifier_pattern(source: str) -> str: """Augment a linkifier so it only matches after start-of-string, whitespace, or opening delimiters, won't match if there are word characters directly after, and saves what was matched as OUTER_CAPTURE_GROUP.""" return fr"""(?<![^\s'"\(,:<])(?P<{OUTE...
[ "def", "prepare_linkifier_pattern", "(", "source", ":", "str", ")", "->", "str", ":", "return", "fr\"\"\"(?<![^\\s'\"\\(,:<])(?P<{OUTER_CAPTURE_GROUP}>{source})(?!\\w)\"\"\"" ]
[ 1783, 0 ]
[ 1788, 77 ]
python
en
['en', 'en', 'en']
True
do_convert
( content: str, realm_alert_words_automaton: Optional[ahocorasick.Automaton] = None, message: Optional[Message] = None, message_realm: Optional[Realm] = None, sent_by_bot: bool = False, translate_emoticons: bool = False, mention_data: Optional[MentionData] = None, email_gateway: bool = F...
Convert Markdown to HTML, with Zulip-specific settings and hacks.
Convert Markdown to HTML, with Zulip-specific settings and hacks.
def do_convert( content: str, realm_alert_words_automaton: Optional[ahocorasick.Automaton] = None, message: Optional[Message] = None, message_realm: Optional[Realm] = None, sent_by_bot: bool = False, translate_emoticons: bool = False, mention_data: Optional[MentionData] = None, email_gat...
[ "def", "do_convert", "(", "content", ":", "str", ",", "realm_alert_words_automaton", ":", "Optional", "[", "ahocorasick", ".", "Automaton", "]", "=", "None", ",", "message", ":", "Optional", "[", "Message", "]", "=", "None", ",", "message_realm", ":", "Optio...
[ 2535, 0 ]
[ 2546, 75 ]
python
en
['en', 'en', 'en']
True
InlineInterestingLinkProcessor.twitter_text
( self, text: str, urls: List[Dict[str, str]], user_mentions: List[Dict[str, Any]], media: List[Dict[str, Any]], )
Use data from the Twitter API to turn links, mentions and media into A tags. Also convert Unicode emojis to images. This works by using the URLs, user_mentions and media data from the twitter API and searching for Unicode emojis in the text using `unicode_emoji_regex`. ...
Use data from the Twitter API to turn links, mentions and media into A tags. Also convert Unicode emojis to images.
def twitter_text( self, text: str, urls: List[Dict[str, str]], user_mentions: List[Dict[str, Any]], media: List[Dict[str, Any]], ) -> Element: """ Use data from the Twitter API to turn links, mentions and media into A tags. Also convert Unicode emojis ...
[ "def", "twitter_text", "(", "self", ",", "text", ":", "str", ",", "urls", ":", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ",", "user_mentions", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ",", "media", ":", "List", "...
[ 903, 4 ]
[ 1022, 16 ]
python
en
['en', 'error', 'th']
False
MarkdownListPreprocessor.run
(self, lines: List[str])
Insert a newline between a paragraph and ulist if missing
Insert a newline between a paragraph and ulist if missing
def run(self, lines: List[str]) -> List[str]: """Insert a newline between a paragraph and ulist if missing""" inserts = 0 in_code_fence: bool = False open_fences: List[Fence] = [] copy = lines[:] for i in range(len(lines) - 1): # Ignore anything that is inside...
[ "def", "run", "(", "self", ",", "lines", ":", "List", "[", "str", "]", ")", "->", "List", "[", "str", "]", ":", "inserts", "=", "0", "in_code_fence", ":", "bool", "=", "False", "open_fences", ":", "List", "[", "Fence", "]", "=", "[", "]", "copy",...
[ 1737, 4 ]
[ 1774, 19 ]
python
en
['en', 'en', 'en']
True
MentionData.get_user_ids
(self)
Returns the user IDs that might have been mentioned by this content. Note that because this data structure has not parsed the message and does not know about escaping/code blocks, this will overestimate the list of user ids.
Returns the user IDs that might have been mentioned by this content. Note that because this data structure has not parsed the message and does not know about escaping/code blocks, this will overestimate the list of user ids.
def get_user_ids(self) -> Set[int]: """ Returns the user IDs that might have been mentioned by this content. Note that because this data structure has not parsed the message and does not know about escaping/code blocks, this will overestimate the list of user ids. """ ...
[ "def", "get_user_ids", "(", "self", ")", "->", "Set", "[", "int", "]", ":", "return", "set", "(", "self", ".", "user_id_info", ".", "keys", "(", ")", ")" ]
[ 2487, 4 ]
[ 2494, 44 ]
python
en
['en', 'error', 'th']
False
seed_everything
(seed=12)
seed randoms for all libraries
seed randoms for all libraries
def seed_everything(seed=12): ''' seed randoms for all libraries ''' random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) os.environ['PYTHONHASHSEED'] = str(seed) torch.backends.cudnn.benchmark = False torch.backends.cudnn.deterministic ...
[ "def", "seed_everything", "(", "seed", "=", "12", ")", ":", "random", ".", "seed", "(", "seed", ")", "np", ".", "random", ".", "seed", "(", "seed", ")", "torch", ".", "manual_seed", "(", "seed", ")", "torch", ".", "cuda", ".", "manual_seed_all", "(",...
[ 37, 0 ]
[ 47, 45 ]
python
en
['en', 'error', 'th']
False
train_linear
(args, period, model, net, net_old, train_loader, loss_criterion, loss_activation, optimizer, class_old, class_novel, finetune)
arguments: period, net, net_old, train_loader, loss_activation, optimizer, clss_old, clasS_novel, finetune returns: tcost, loss_avg, acc_avg
arguments: period, net, net_old, train_loader, loss_activation, optimizer, clss_old, clasS_novel, finetune returns: tcost, loss_avg, acc_avg
def train_linear(args, period, model, net, net_old, train_loader, loss_criterion, loss_activation, optimizer, class_old, class_novel, finetune): ''' arguments: period, net, net_old, train_loader, loss_activation, optimizer, clss_old, clasS_novel, finetune returns: tcost, loss_avg, acc_avg ''' acc_...
[ "def", "train_linear", "(", "args", ",", "period", ",", "model", ",", "net", ",", "net_old", ",", "train_loader", ",", "loss_criterion", ",", "loss_activation", ",", "optimizer", ",", "class_old", ",", "class_novel", ",", "finetune", ")", ":", "acc_avg", "="...
[ 49, 0 ]
[ 162, 36 ]
python
en
['en', 'error', 'th']
False
test
(args, model, net, test_loader, loss_activation, class_old, class_novel)
arguments: net, test_loader, loss_activation, class_old, class_novel return: tcost, acc_avg
arguments: net, test_loader, loss_activation, class_old, class_novel return: tcost, acc_avg
def test(args, model, net, test_loader, loss_activation, class_old, class_novel): ''' arguments: net, test_loader, loss_activation, class_old, class_novel return: tcost, acc_avg ''' acc_avg = 0 num_exp = 0 tstart = time.clock() # set net to eval model.eval() net.eval() # ne...
[ "def", "test", "(", "args", ",", "model", ",", "net", ",", "test_loader", ",", "loss_activation", ",", "class_old", ",", "class_novel", ")", ":", "acc_avg", "=", "0", "num_exp", "=", "0", "tstart", "=", "time", ".", "clock", "(", ")", "# set net to eval"...
[ 165, 0 ]
[ 221, 26 ]
python
en
['en', 'error', 'th']
False
WObject.__init__
(self, root, definitions=None)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions=None): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ Object.__init__(self) self.root = root pmd = Metadata() ...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", "=", "None", ")", ":", "Object", ".", "__init__", "(", "self", ")", "self", ".", "root", "=", "root", "pmd", "=", "Metadata", "(", ")", "pmd", ".", "excludes", "=", "[", "'root'", "]"...
[ 50, 4 ]
[ 62, 41 ]
python
en
['en', 'error', 'th']
False
WObject.resolve
(self, definitions)
Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions}
Resolve named references to other WSDL objects.
def resolve(self, definitions): """ Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions} """ pass
[ "def", "resolve", "(", "self", ",", "definitions", ")", ":", "pass" ]
[ 64, 4 ]
[ 70, 12 ]
python
en
['en', 'error', 'th']
False
NamedObject.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.name = root.get('name') ...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "WObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "name", "=", "root", ".", "get", "(", "'name'", ")", "self", ".", "qname", "=", "...
[ 82, 4 ]
[ 93, 36 ]
python
en
['en', 'error', 'th']
False
Definitions.__init__
(self, url, options)
@param url: A URL to the WSDL. @type url: str @param options: An options dictionary. @type options: L{options.Options}
def __init__(self, url, options): """ @param url: A URL to the WSDL. @type url: str @param options: An options dictionary. @type options: L{options.Options} """ log.debug('reading wsdl at: %s ...', url) reader = DocumentReader(options) d = reader.o...
[ "def", "__init__", "(", "self", ",", "url", ",", "options", ")", ":", "log", ".", "debug", "(", "'reading wsdl at: %s ...'", ",", "url", ")", "reader", "=", "DocumentReader", "(", "options", ")", "d", "=", "reader", ".", "open", "(", "url", ")", "root"...
[ 126, 4 ]
[ 162, 56 ]
python
en
['en', 'error', 'th']
False
Definitions.mktns
(self, root)
Get/create the target namespace
Get/create the target namespace
def mktns(self, root): """ Get/create the target namespace """ tns = root.get('targetNamespace') prefix = root.findPrefix(tns) if prefix is None: log.debug('warning: tns (%s), not mapped to prefix', tns) prefix = 'tns' return (prefix, tns)
[ "def", "mktns", "(", "self", ",", "root", ")", ":", "tns", "=", "root", ".", "get", "(", "'targetNamespace'", ")", "prefix", "=", "root", ".", "findPrefix", "(", "tns", ")", "if", "prefix", "is", "None", ":", "log", ".", "debug", "(", "'warning: tns ...
[ 164, 4 ]
[ 171, 28 ]
python
en
['en', 'en', 'en']
True
Definitions.add_children
(self, root)
Add child objects using the factory
Add child objects using the factory
def add_children(self, root): """ Add child objects using the factory """ for c in root.getChildren(ns=wsdlns): child = Factory.create(c, self) if child is None: continue self.children.append(child) if isinstance(child, Import): self.import...
[ "def", "add_children", "(", "self", ",", "root", ")", ":", "for", "c", "in", "root", ".", "getChildren", "(", "ns", "=", "wsdlns", ")", ":", "child", "=", "Factory", ".", "create", "(", "c", ",", "self", ")", "if", "child", "is", "None", ":", "co...
[ 173, 4 ]
[ 196, 24 ]
python
en
['en', 'en', 'en']
True
Definitions.open_imports
(self)
Import the I{imported} WSDLs.
Import the I{imported} WSDLs.
def open_imports(self): """ Import the I{imported} WSDLs. """ for imp in self.imports: imp.load(self)
[ "def", "open_imports", "(", "self", ")", ":", "for", "imp", "in", "self", ".", "imports", ":", "imp", ".", "load", "(", "self", ")" ]
[ 198, 4 ]
[ 201, 26 ]
python
en
['en', 'en', 'en']
True
Definitions.resolve
(self)
Tell all children to resolve themselves
Tell all children to resolve themselves
def resolve(self): """ Tell all children to resolve themselves """ for c in self.children: c.resolve(self)
[ "def", "resolve", "(", "self", ")", ":", "for", "c", "in", "self", ".", "children", ":", "c", ".", "resolve", "(", "self", ")" ]
[ 203, 4 ]
[ 206, 27 ]
python
en
['en', 'en', 'en']
True
Definitions.build_schema
(self)
Process L{Types} objects and create the schema collection
Process L{Types} objects and create the schema collection
def build_schema(self): """ Process L{Types} objects and create the schema collection """ container = SchemaCollection(self) for t in [t for t in self.types if t.local()]: for root in t.contents(): schema = Schema(root, self.url, self.options, container) ...
[ "def", "build_schema", "(", "self", ")", ":", "container", "=", "SchemaCollection", "(", "self", ")", "for", "t", "in", "[", "t", "for", "t", "in", "self", ".", "types", "if", "t", ".", "local", "(", ")", "]", ":", "for", "root", "in", "t", ".", ...
[ 208, 4 ]
[ 222, 26 ]
python
en
['en', 'en', 'en']
True
Definitions.add_methods
(self, service)
Build method view for service
Build method view for service
def add_methods(self, service): """ Build method view for service """ bindings = { 'document/literal' : Document(self), 'rpc/literal' : RPC(self), 'rpc/encoded' : Encoded(self) } for p in service.ports: binding = p.binding ptype...
[ "def", "add_methods", "(", "self", ",", "service", ")", ":", "bindings", "=", "{", "'document/literal'", ":", "Document", "(", "self", ")", ",", "'rpc/literal'", ":", "RPC", "(", "self", ")", ",", "'rpc/encoded'", ":", "Encoded", "(", "self", ")", "}", ...
[ 224, 4 ]
[ 247, 35 ]
python
en
['en', 'en', 'en']
True
Definitions.set_wrapped
(self)
set (wrapped|bare) flag on messages
set (wrapped|bare) flag on messages
def set_wrapped(self): """ set (wrapped|bare) flag on messages """ for b in self.bindings.values(): for op in b.operations.values(): for body in (op.soap.input.body, op.soap.output.body): body.wrapped = False if len(body.parts) != 1: ...
[ "def", "set_wrapped", "(", "self", ")", ":", "for", "b", "in", "self", ".", "bindings", ".", "values", "(", ")", ":", "for", "op", "in", "b", ".", "operations", ".", "values", "(", ")", ":", "for", "body", "in", "(", "op", ".", "soap", ".", "in...
[ 249, 4 ]
[ 267, 43 ]
python
en
['en', 'en', 'en']
True
Import.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.location = root.get('location...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "WObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "location", "=", "root", ".", "get", "(", "'location'", ")", "self", ".", "ns", "="...
[ 292, 4 ]
[ 304, 39 ]
python
en
['en', 'error', 'th']
False
Import.load
(self, definitions)
Load the object by opening the URL
Load the object by opening the URL
def load(self, definitions): """ Load the object by opening the URL """ url = self.location log.debug('importing (%s)', url) if '://' not in url: url = urljoin(definitions.url, url) options = definitions.options d = Definitions(url, options) if d.root....
[ "def", "load", "(", "self", ",", "definitions", ")", ":", "url", "=", "self", ".", "location", "log", ".", "debug", "(", "'importing (%s)'", ",", "url", ")", "if", "'://'", "not", "in", "url", ":", "url", "=", "urljoin", "(", "definitions", ".", "url...
[ 306, 4 ]
[ 320, 60 ]
python
en
['en', 'en', 'en']
True
Import.import_definitions
(self, definitions, d)
import/merge wsdl definitions
import/merge wsdl definitions
def import_definitions(self, definitions, d): """ import/merge wsdl definitions """ definitions.types += d.types definitions.messages.update(d.messages) definitions.port_types.update(d.port_types) definitions.bindings.update(d.bindings) self.imported = d log.debug...
[ "def", "import_definitions", "(", "self", ",", "definitions", ",", "d", ")", ":", "definitions", ".", "types", "+=", "d", ".", "types", "definitions", ".", "messages", ".", "update", "(", "d", ".", "messages", ")", "definitions", ".", "port_types", ".", ...
[ 322, 4 ]
[ 329, 44 ]
python
en
['fr', 'en', 'pl']
False
Import.import_schema
(self, definitions, d)
import schema as <types/> content
import schema as <types/> content
def import_schema(self, definitions, d): """ import schema as <types/> content """ if not len(definitions.types): types = Types.create(definitions) definitions.types.append(types) else: types = definitions.types[-1] types.root.append(d.root) lo...
[ "def", "import_schema", "(", "self", ",", "definitions", ",", "d", ")", ":", "if", "not", "len", "(", "definitions", ".", "types", ")", ":", "types", "=", "Types", ".", "create", "(", "definitions", ")", "definitions", ".", "types", ".", "append", "(",...
[ 331, 4 ]
[ 339, 48 ]
python
en
['en', 'en', 'en']
True
Types.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ WObject.__init__(self, root, definitions) self.definitions = definitions
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "WObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "definitions", "=", "definitions" ]
[ 356, 4 ]
[ 364, 38 ]
python
en
['en', 'error', 'th']
False
Part.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) pmd = Metadata() pmd.w...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "NamedObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "pmd", "=", "Metadata", "(", ")", "pmd", ".", "wrappers", "=", "dict", "(", "element", "=", ...
[ 393, 4 ]
[ 406, 46 ]
python
en
['en', 'error', 'th']
False
Part.__getref
(self, a, tns)
Get the qualified value of attribute named 'a'.
Get the qualified value of attribute named 'a'.
def __getref(self, a, tns): """ Get the qualified value of attribute named 'a'.""" s = self.root.get(a) if s is None: return s else: return qualify(s, self.root, tns)
[ "def", "__getref", "(", "self", ",", "a", ",", "tns", ")", ":", "s", "=", "self", ".", "root", ".", "get", "(", "a", ")", "if", "s", "is", "None", ":", "return", "s", "else", ":", "return", "qualify", "(", "s", ",", "self", ".", "root", ",", ...
[ 408, 4 ]
[ 414, 45 ]
python
en
['en', 'en', 'en']
True
Message.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.parts = [] for p ...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "NamedObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "parts", "=", "[", "]", "for", "p", "in", "root", ".", "getChildren", "(", "'pa...
[ 424, 4 ]
[ 435, 35 ]
python
en
['en', 'error', 'th']
False
PortType.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.operations = {} f...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "NamedObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "operations", "=", "{", "}", "for", "c", "in", "root", ".", "getChildren", "(", ...
[ 448, 4 ]
[ 478, 41 ]
python
en
['en', 'error', 'th']
False
PortType.resolve
(self, definitions)
Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions}
Resolve named references to other WSDL objects.
def resolve(self, definitions): """ Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions} """ for op in self.operations.values(): if op.input is None: op.input = Message(Elem...
[ "def", "resolve", "(", "self", ",", "definitions", ")", ":", "for", "op", "in", "self", ".", "operations", ".", "values", "(", ")", ":", "if", "op", ".", "input", "is", "None", ":", "op", ".", "input", "=", "Message", "(", "Element", "(", "'no-inpu...
[ 480, 4 ]
[ 510, 31 ]
python
en
['en', 'error', 'th']
False
PortType.operation
(self, name)
Shortcut used to get a contained operation by name. @param name: An operation name. @type name: str @return: The named operation. @rtype: Operation @raise L{MethodNotFound}: When not found.
Shortcut used to get a contained operation by name.
def operation(self, name): """ Shortcut used to get a contained operation by name. @param name: An operation name. @type name: str @return: The named operation. @rtype: Operation @raise L{MethodNotFound}: When not found. """ try: return...
[ "def", "operation", "(", "self", ",", "name", ")", ":", "try", ":", "return", "self", ".", "operations", "[", "name", "]", "except", "Exception", ",", "e", ":", "raise", "MethodNotFound", "(", "name", ")" ]
[ 512, 4 ]
[ 524, 38 ]
python
en
['en', 'error', 'th']
False
Binding.__init__
(self, root, definitions)
@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}
def __init__(self, root, definitions): """ @param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions} """ NamedObject.__init__(self, root, definitions) self.operations = {} s...
[ "def", "__init__", "(", "self", ",", "root", ",", "definitions", ")", ":", "NamedObject", ".", "__init__", "(", "self", ",", "root", ",", "definitions", ")", "self", ".", "operations", "=", "{", "}", "self", ".", "type", "=", "root", ".", "get", "(",...
[ 537, 4 ]
[ 555, 51 ]
python
en
['en', 'error', 'th']
False
Binding.soaproot
(self)
get the soap:binding
get the soap:binding
def soaproot(self): """ get the soap:binding """ for ns in (soapns, soap12ns): sr = self.root.getChild('binding', ns=ns) if sr is not None: return sr return None
[ "def", "soaproot", "(", "self", ")", ":", "for", "ns", "in", "(", "soapns", ",", "soap12ns", ")", ":", "sr", "=", "self", ".", "root", ".", "getChild", "(", "'binding'", ",", "ns", "=", "ns", ")", "if", "sr", "is", "not", "None", ":", "return", ...
[ 557, 4 ]
[ 563, 19 ]
python
en
['en', 'en', 'en']
True