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
check_package_data
(dist, attr, value)
Verify that value is a dictionary of package names to glob lists
Verify that value is a dictionary of package names to glob lists
def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" if not isinstance(value, dict): raise DistutilsSetupError( "{!r} must be a dictionary mapping package names to lists of " "string wildcard patterns".format(attr)) ...
[ "def", "check_package_data", "(", "dist", ",", "attr", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "DistutilsSetupError", "(", "\"{!r} must be a dictionary mapping package names to lists of \"", "\"string wildcard pat...
[ 308, 0 ]
[ 320, 71 ]
python
en
['en', 'en', 'en']
True
Distribution._finalize_requires
(self)
Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`.
Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`.
def _finalize_requires(self): """ Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. """ if getattr(self, 'python_requires', None): self.metadata.python_requires = self.python_requires if getattr(self, 'extr...
[ "def", "_finalize_requires", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "'python_requires'", ",", "None", ")", ":", "self", ".", "metadata", ".", "python_requires", "=", "self", ".", "python_requires", "if", "getattr", "(", "self", ",", "'ex...
[ 474, 4 ]
[ 492, 49 ]
python
en
['en', 'error', 'th']
False
Distribution._convert_extras_requirements
(self)
Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`.
Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`.
def _convert_extras_requirements(self): """ Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. """ spec_ext_reqs = getattr(self, 'extras_require', None) or {} self._tmp_extras_require = d...
[ "def", "_convert_extras_requirements", "(", "self", ")", ":", "spec_ext_reqs", "=", "getattr", "(", "self", ",", "'extras_require'", ",", "None", ")", "or", "{", "}", "self", ".", "_tmp_extras_require", "=", "defaultdict", "(", "list", ")", "for", "section", ...
[ 494, 4 ]
[ 507, 68 ]
python
en
['en', 'error', 'th']
False
Distribution._suffix_for
(req)
For a requirement, return the 'extras_require' suffix for that requirement.
For a requirement, return the 'extras_require' suffix for that requirement.
def _suffix_for(req): """ For a requirement, return the 'extras_require' suffix for that requirement. """ return ':' + str(req.marker) if req.marker else ''
[ "def", "_suffix_for", "(", "req", ")", ":", "return", "':'", "+", "str", "(", "req", ".", "marker", ")", "if", "req", ".", "marker", "else", "''" ]
[ 510, 4 ]
[ 515, 58 ]
python
en
['en', 'error', 'th']
False
Distribution._move_install_requirements_markers
(self)
Move requirements in `install_requires` that are using environment markers `extras_require`.
Move requirements in `install_requires` that are using environment markers `extras_require`.
def _move_install_requirements_markers(self): """ Move requirements in `install_requires` that are using environment markers `extras_require`. """ # divide the install_requires into two sets, simple ones still # handled by install_requires and more complex ones handled ...
[ "def", "_move_install_requirements_markers", "(", "self", ")", ":", "# divide the install_requires into two sets, simple ones still", "# handled by install_requires and more complex ones handled", "# by extras_require.", "def", "is_simple_req", "(", "req", ")", ":", "return", "not", ...
[ 517, 4 ]
[ 541, 9 ]
python
en
['en', 'error', 'th']
False
Distribution._clean_req
(self, req)
Given a Requirement, remove environment markers and return it.
Given a Requirement, remove environment markers and return it.
def _clean_req(self, req): """ Given a Requirement, remove environment markers and return it. """ req.marker = None return req
[ "def", "_clean_req", "(", "self", ",", "req", ")", ":", "req", ".", "marker", "=", "None", "return", "req" ]
[ 543, 4 ]
[ 548, 18 ]
python
en
['en', 'error', 'th']
False
Distribution._parse_config_files
(self, filenames=None)
Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways.
Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways.
def _parse_config_files(self, filenames=None): """ Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways. """ from configparser import ConfigParser # Ignore install directory options if we...
[ "def", "_parse_config_files", "(", "self", ",", "filenames", "=", "None", ")", ":", "from", "configparser", "import", "ConfigParser", "# Ignore install directory options if we have a venv", "if", "sys", ".", "prefix", "!=", "sys", ".", "base_prefix", ":", "ignore_opti...
[ 550, 4 ]
[ 610, 56 ]
python
en
['en', 'error', 'th']
False
Distribution._set_command_options
(self, command_obj, option_dict=None)
Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionar...
Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
def _set_command_options(self, command_obj, option_dict=None): """ Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If...
[ "def", "_set_command_options", "(", "self", ",", "command_obj", ",", "option_dict", "=", "None", ")", ":", "command_name", "=", "command_obj", ".", "get_command_name", "(", ")", "if", "option_dict", "is", "None", ":", "option_dict", "=", "self", ".", "get_opti...
[ 612, 4 ]
[ 657, 52 ]
python
en
['en', 'error', 'th']
False
Distribution.parse_config_files
(self, filenames=None, ignore_option_errors=False)
Parses configuration files from various levels and loads configuration.
Parses configuration files from various levels and loads configuration.
def parse_config_files(self, filenames=None, ignore_option_errors=False): """Parses configuration files from various levels and loads configuration. """ self._parse_config_files(filenames=filenames) parse_configuration(self, self.command_options, ign...
[ "def", "parse_config_files", "(", "self", ",", "filenames", "=", "None", ",", "ignore_option_errors", "=", "False", ")", ":", "self", ".", "_parse_config_files", "(", "filenames", "=", "filenames", ")", "parse_configuration", "(", "self", ",", "self", ".", "co...
[ 659, 4 ]
[ 668, 33 ]
python
en
['en', 'en', 'en']
True
Distribution.fetch_build_eggs
(self, requires)
Resolve pre-setup requirements
Resolve pre-setup requirements
def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" resolved_dists = pkg_resources.working_set.resolve( pkg_resources.parse_requirements(requires), installer=self.fetch_build_egg, replace_conflicting=True, ) for dist in resolved_...
[ "def", "fetch_build_eggs", "(", "self", ",", "requires", ")", ":", "resolved_dists", "=", "pkg_resources", ".", "working_set", ".", "resolve", "(", "pkg_resources", ".", "parse_requirements", "(", "requires", ")", ",", "installer", "=", "self", ".", "fetch_build...
[ 670, 4 ]
[ 679, 29 ]
python
en
['en', 'en', 'en']
True
Distribution.finalize_options
(self)
Allow plugins to apply arbitrary operations to the distribution. Each hook may optionally define a 'order' to influence the order of execution. Smaller numbers go first and the default is 0.
Allow plugins to apply arbitrary operations to the distribution. Each hook may optionally define a 'order' to influence the order of execution. Smaller numbers go first and the default is 0.
def finalize_options(self): """ Allow plugins to apply arbitrary operations to the distribution. Each hook may optionally define a 'order' to influence the order of execution. Smaller numbers go first and the default is 0. """ group = 'setuptools.finalize_distribu...
[ "def", "finalize_options", "(", "self", ")", ":", "group", "=", "'setuptools.finalize_distribution_options'", "def", "by_order", "(", "hook", ")", ":", "return", "getattr", "(", "hook", ",", "'order'", ",", "0", ")", "eps", "=", "map", "(", "lambda", "e", ...
[ 681, 4 ]
[ 694, 20 ]
python
en
['en', 'error', 'th']
False
Distribution.fetch_build_egg
(self, req)
Fetch an egg needed for building
Fetch an egg needed for building
def fetch_build_egg(self, req): """Fetch an egg needed for building""" from setuptools.installer import fetch_build_egg return fetch_build_egg(self, req)
[ "def", "fetch_build_egg", "(", "self", ",", "req", ")", ":", "from", "setuptools", ".", "installer", "import", "fetch_build_egg", "return", "fetch_build_egg", "(", "self", ",", "req", ")" ]
[ 728, 4 ]
[ 731, 41 ]
python
en
['en', 'en', 'en']
True
Distribution.get_command_class
(self, command)
Pluggable version of get_command_class()
Pluggable version of get_command_class()
def get_command_class(self, command): """Pluggable version of get_command_class()""" if command in self.cmdclass: return self.cmdclass[command] eps = pkg_resources.iter_entry_points('distutils.commands', command) for ep in eps: ep.require(installer=self.fetch_bui...
[ "def", "get_command_class", "(", "self", ",", "command", ")", ":", "if", "command", "in", "self", ".", "cmdclass", ":", "return", "self", ".", "cmdclass", "[", "command", "]", "eps", "=", "pkg_resources", ".", "iter_entry_points", "(", "'distutils.commands'", ...
[ 733, 4 ]
[ 744, 65 ]
python
en
['en', 'en', 'en']
True
Distribution.include
(self, **attrs)
Add items to distribution that are named in keyword arguments For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for attributes that are lists or t...
Add items to distribution that are named in keyword arguments
def include(self, **attrs): """Add items to distribution that are named in keyword arguments For example, 'dist.include(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for...
[ "def", "include", "(", "self", ",", "*", "*", "attrs", ")", ":", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":", "include", "=", "getattr", "(", "self", ",", "'_include_'", "+", "k", ",", "None", ")", "if", "include", ":", "in...
[ 762, 4 ]
[ 782, 40 ]
python
en
['en', 'en', 'en']
True
Distribution.exclude_package
(self, package)
Remove packages, modules, and extensions in named package
Remove packages, modules, and extensions in named package
def exclude_package(self, package): """Remove packages, modules, and extensions in named package""" pfx = package + '.' if self.packages: self.packages = [ p for p in self.packages if p != package and not p.startswith(pfx) ] if se...
[ "def", "exclude_package", "(", "self", ",", "package", ")", ":", "pfx", "=", "package", "+", "'.'", "if", "self", ".", "packages", ":", "self", ".", "packages", "=", "[", "p", "for", "p", "in", "self", ".", "packages", "if", "p", "!=", "package", "...
[ 784, 4 ]
[ 804, 13 ]
python
en
['en', 'en', 'en']
True
Distribution.has_contents_for
(self, package)
Return true if 'exclude_package(package)' would do something
Return true if 'exclude_package(package)' would do something
def has_contents_for(self, package): """Return true if 'exclude_package(package)' would do something""" pfx = package + '.' for p in self.iter_distribution_names(): if p == package or p.startswith(pfx): return True
[ "def", "has_contents_for", "(", "self", ",", "package", ")", ":", "pfx", "=", "package", "+", "'.'", "for", "p", "in", "self", ".", "iter_distribution_names", "(", ")", ":", "if", "p", "==", "package", "or", "p", ".", "startswith", "(", "pfx", ")", "...
[ 806, 4 ]
[ 813, 27 ]
python
en
['en', 'en', 'en']
True
Distribution._exclude_misc
(self, name, value)
Handle 'exclude()' for list/tuple attrs without a special handler
Handle 'exclude()' for list/tuple attrs without a special handler
def _exclude_misc(self, name, value): """Handle 'exclude()' for list/tuple attrs without a special handler""" if not isinstance(value, sequence): raise DistutilsSetupError( "%s: setting must be a list or tuple (%r)" % (name, value) ) try: old =...
[ "def", "_exclude_misc", "(", "self", ",", "name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "sequence", ")", ":", "raise", "DistutilsSetupError", "(", "\"%s: setting must be a list or tuple (%r)\"", "%", "(", "name", ",", "value", "...
[ 815, 4 ]
[ 832, 76 ]
python
en
['en', 'en', 'en']
True
Distribution._include_misc
(self, name, value)
Handle 'include()' for list/tuple attrs without a special handler
Handle 'include()' for list/tuple attrs without a special handler
def _include_misc(self, name, value): """Handle 'include()' for list/tuple attrs without a special handler""" if not isinstance(value, sequence): raise DistutilsSetupError( "%s: setting must be a list (%r)" % (name, value) ) try: old = getattr...
[ "def", "_include_misc", "(", "self", ",", "name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "sequence", ")", ":", "raise", "DistutilsSetupError", "(", "\"%s: setting must be a list (%r)\"", "%", "(", "name", ",", "value", ")", ")"...
[ 834, 4 ]
[ 855, 42 ]
python
en
['en', 'en', 'en']
True
Distribution.exclude
(self, **attrs)
Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package's contained packages, modules,...
Remove items from distribution that are named in keyword arguments
def exclude(self, **attrs): """Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package...
[ "def", "exclude", "(", "self", ",", "*", "*", "attrs", ")", ":", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":", "exclude", "=", "getattr", "(", "self", ",", "'_exclude_'", "+", "k", ",", "None", ")", "if", "exclude", ":", "ex...
[ 857, 4 ]
[ 878, 40 ]
python
en
['en', 'en', 'en']
True
Distribution.get_cmdline_options
(self)
Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. Note that options provided by config fi...
Return a '{cmd: {opt:val}}' map of all command-line options
def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. ...
[ "def", "get_cmdline_options", "(", "self", ")", ":", "d", "=", "{", "}", "for", "cmd", ",", "opts", "in", "self", ".", "command_options", ".", "items", "(", ")", ":", "for", "opt", ",", "(", "src", ",", "val", ")", "in", "opts", ".", "items", "("...
[ 913, 4 ]
[ 951, 16 ]
python
en
['en', 'en', 'en']
True
Distribution.iter_distribution_names
(self)
Yield all packages, modules, and extension names in distribution
Yield all packages, modules, and extension names in distribution
def iter_distribution_names(self): """Yield all packages, modules, and extension names in distribution""" for pkg in self.packages or (): yield pkg for module in self.py_modules or (): yield module for ext in self.ext_modules or (): if isinstance(ex...
[ "def", "iter_distribution_names", "(", "self", ")", ":", "for", "pkg", "in", "self", ".", "packages", "or", "(", ")", ":", "yield", "pkg", "for", "module", "in", "self", ".", "py_modules", "or", "(", ")", ":", "yield", "module", "for", "ext", "in", "...
[ 953, 4 ]
[ 969, 22 ]
python
en
['en', 'en', 'en']
True
Distribution.handle_display_options
(self, option_order)
If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
def handle_display_options(self, option_order): """If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. """ import sys if self.hel...
[ "def", "handle_display_options", "(", "self", ",", "option_order", ")", ":", "import", "sys", "if", "self", ".", "help_commands", ":", "return", "_Distribution", ".", "handle_display_options", "(", "self", ",", "option_order", ")", "# Stdout may be StringIO (e.g. in t...
[ 971, 4 ]
[ 1003, 79 ]
python
en
['en', 'en', 'en']
True
bootstrap_translatable_model
(model, locale)
This function populates the "translation_key", and "locale" fields on model instances that were created before wagtail-localize was added to the site. This can be called from a data migration, or instead you could use the "boostrap_translatable_models" management command.
This function populates the "translation_key", and "locale" fields on model instances that were created before wagtail-localize was added to the site.
def bootstrap_translatable_model(model, locale): """ This function populates the "translation_key", and "locale" fields on model instances that were created before wagtail-localize was added to the site. This can be called from a data migration, or instead you could use the "boostrap_translatable_model...
[ "def", "bootstrap_translatable_model", "(", "model", ",", "locale", ")", ":", "for", "instance", "in", "(", "model", ".", "objects", ".", "filter", "(", "translation_key__isnull", "=", "True", ")", ".", "defer", "(", ")", ".", "iterator", "(", ")", ")", ...
[ 227, 0 ]
[ 240, 66 ]
python
en
['en', 'error', 'th']
False
get_translatable_models
(include_subclasses=False)
Returns a list of all concrete models that inherit from TranslatableMixin. By default, this only includes models that are direct children of TranslatableMixin, to get all models, set the include_subclasses attribute to True.
Returns a list of all concrete models that inherit from TranslatableMixin. By default, this only includes models that are direct children of TranslatableMixin, to get all models, set the include_subclasses attribute to True.
def get_translatable_models(include_subclasses=False): """ Returns a list of all concrete models that inherit from TranslatableMixin. By default, this only includes models that are direct children of TranslatableMixin, to get all models, set the include_subclasses attribute to True. """ translat...
[ "def", "get_translatable_models", "(", "include_subclasses", "=", "False", ")", ":", "translatable_models", "=", "[", "model", "for", "model", "in", "apps", ".", "get_models", "(", ")", "if", "issubclass", "(", "model", ",", "TranslatableMixin", ")", "and", "n...
[ 290, 0 ]
[ 313, 30 ]
python
en
['en', 'error', 'th']
False
LocaleManager.get_for_language
(self, language_code)
Gets a Locale from a language code.
Gets a Locale from a language code.
def get_for_language(self, language_code): """ Gets a Locale from a language code. """ return self.get(language_code=get_supported_content_language_variant(language_code))
[ "def", "get_for_language", "(", "self", ",", "language_code", ")", ":", "return", "self", ".", "get", "(", "language_code", "=", "get_supported_content_language_variant", "(", "language_code", ")", ")" ]
[ 26, 4 ]
[ 30, 92 ]
python
en
['en', 'error', 'th']
False
Locale.get_default
(cls)
Returns the default Locale based on the site's LANGUAGE_CODE setting
Returns the default Locale based on the site's LANGUAGE_CODE setting
def get_default(cls): """ Returns the default Locale based on the site's LANGUAGE_CODE setting """ return cls.objects.get_for_language(settings.LANGUAGE_CODE)
[ "def", "get_default", "(", "cls", ")", ":", "return", "cls", ".", "objects", ".", "get_for_language", "(", "settings", ".", "LANGUAGE_CODE", ")" ]
[ 51, 4 ]
[ 55, 67 ]
python
en
['en', 'error', 'th']
False
Locale.get_active
(cls)
Returns the Locale that corresponds to the currently activated language in Django.
Returns the Locale that corresponds to the currently activated language in Django.
def get_active(cls): """ Returns the Locale that corresponds to the currently activated language in Django. """ try: return cls.objects.get_for_language(translation.get_language()) except (cls.DoesNotExist, LookupError): return cls.get_default()
[ "def", "get_active", "(", "cls", ")", ":", "try", ":", "return", "cls", ".", "objects", ".", "get_for_language", "(", "translation", ".", "get_language", "(", ")", ")", "except", "(", "cls", ".", "DoesNotExist", ",", "LookupError", ")", ":", "return", "c...
[ 58, 4 ]
[ 65, 36 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.localized
(self)
Finds the translation in the current active language. If there is no translation in the active language, self is returned.
Finds the translation in the current active language.
def localized(self): """ Finds the translation in the current active language. If there is no translation in the active language, self is returned. """ try: locale = Locale.get_active() except (LookupError, Locale.DoesNotExist): return self ...
[ "def", "localized", "(", "self", ")", ":", "try", ":", "locale", "=", "Locale", ".", "get_active", "(", ")", "except", "(", "LookupError", ",", "Locale", ".", "DoesNotExist", ")", ":", "return", "self", "if", "locale", ".", "id", "==", "self", ".", "...
[ 116, 4 ]
[ 130, 59 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.get_translations
(self, inclusive=False)
Returns a queryset containing the translations of this instance.
Returns a queryset containing the translations of this instance.
def get_translations(self, inclusive=False): """ Returns a queryset containing the translations of this instance. """ translations = self.__class__.objects.filter( translation_key=self.translation_key ) if inclusive is False: translations = transl...
[ "def", "get_translations", "(", "self", ",", "inclusive", "=", "False", ")", ":", "translations", "=", "self", ".", "__class__", ".", "objects", ".", "filter", "(", "translation_key", "=", "self", ".", "translation_key", ")", "if", "inclusive", "is", "False"...
[ 132, 4 ]
[ 143, 27 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.get_translation
(self, locale)
Finds the translation in the specified locale. If there is no translation in that locale, this raises a ``model.DoesNotExist`` exception.
Finds the translation in the specified locale.
def get_translation(self, locale): """ Finds the translation in the specified locale. If there is no translation in that locale, this raises a ``model.DoesNotExist`` exception. """ return self.get_translations(inclusive=True).get(locale_id=pk(locale))
[ "def", "get_translation", "(", "self", ",", "locale", ")", ":", "return", "self", ".", "get_translations", "(", "inclusive", "=", "True", ")", ".", "get", "(", "locale_id", "=", "pk", "(", "locale", ")", ")" ]
[ 145, 4 ]
[ 151, 78 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.get_translation_or_none
(self, locale)
Finds the translation in the specified locale. If there is no translation in that locale, this returns None.
Finds the translation in the specified locale.
def get_translation_or_none(self, locale): """ Finds the translation in the specified locale. If there is no translation in that locale, this returns None. """ try: return self.get_translation(locale) except self.__class__.DoesNotExist: return Non...
[ "def", "get_translation_or_none", "(", "self", ",", "locale", ")", ":", "try", ":", "return", "self", ".", "get_translation", "(", "locale", ")", "except", "self", ".", "__class__", ".", "DoesNotExist", ":", "return", "None" ]
[ 153, 4 ]
[ 162, 23 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.has_translation
(self, locale)
Returns True if a translation exists in the specified locale.
Returns True if a translation exists in the specified locale.
def has_translation(self, locale): """ Returns True if a translation exists in the specified locale. """ return self.get_translations(inclusive=True).filter(locale_id=pk(locale)).exists()
[ "def", "has_translation", "(", "self", ",", "locale", ")", ":", "return", "self", ".", "get_translations", "(", "inclusive", "=", "True", ")", ".", "filter", "(", "locale_id", "=", "pk", "(", "locale", ")", ")", ".", "exists", "(", ")" ]
[ 164, 4 ]
[ 168, 90 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.copy_for_translation
(self, locale)
Creates a copy of this instance with the specified locale. Note that the copy is initially unsaved.
Creates a copy of this instance with the specified locale.
def copy_for_translation(self, locale): """ Creates a copy of this instance with the specified locale. Note that the copy is initially unsaved. """ translated, child_object_map = _copy(self) translated.locale = locale # Update locale on any translatable child ob...
[ "def", "copy_for_translation", "(", "self", ",", "locale", ")", ":", "translated", ",", "child_object_map", "=", "_copy", "(", "self", ")", "translated", ".", "locale", "=", "locale", "# Update locale on any translatable child objects as well", "# Note: If this is not a s...
[ 170, 4 ]
[ 185, 25 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.get_default_locale
(self)
Finds the default locale to use for this object. This will be called just before the initial save.
Finds the default locale to use for this object.
def get_default_locale(self): """ Finds the default locale to use for this object. This will be called just before the initial save. """ # Check if the object has any parental keys to another translatable model # If so, take the locale from the object referenced in that ...
[ "def", "get_default_locale", "(", "self", ")", ":", "# Check if the object has any parental keys to another translatable model", "# If so, take the locale from the object referenced in that parental key", "parental_keys", "=", "[", "field", "for", "field", "in", "self", ".", "_meta...
[ 187, 4 ]
[ 211, 35 ]
python
en
['en', 'error', 'th']
False
TranslatableMixin.get_translation_model
(cls)
Returns this model's "Translation model". The "Translation model" is the model that has the ``locale`` and ``translation_key`` fields. Typically this would be the current model, but it may be a super-class if multi-table inheritance is in use (as is the case for ``wagta...
Returns this model's "Translation model".
def get_translation_model(cls): """ Returns this model's "Translation model". The "Translation model" is the model that has the ``locale`` and ``translation_key`` fields. Typically this would be the current model, but it may be a super-class if multi-table inheritance is...
[ "def", "get_translation_model", "(", "cls", ")", ":", "return", "cls", ".", "_meta", ".", "get_field", "(", "\"locale\"", ")", ".", "model" ]
[ 214, 4 ]
[ 224, 50 ]
python
en
['en', 'error', 'th']
False
store_fits
(db_images, fits_datas, fits_headers)
bulk store fits data in database args: db_images (tuple): list of ``tkp.db.model.Image``s fits_datas (tuple): list of serialised numpy arrays fits_headers (tuple): list of serialised fits headers (string)
bulk store fits data in database
def store_fits(db_images, fits_datas, fits_headers): """ bulk store fits data in database args: db_images (tuple): list of ``tkp.db.model.Image``s fits_datas (tuple): list of serialised numpy arrays fits_headers (tuple): list of serialised fits headers (string) """ values = ...
[ "def", "store_fits", "(", "db_images", ",", "fits_datas", ",", "fits_headers", ")", ":", "values", "=", "[", "{", "'image'", ":", "i", ".", "id", ",", "'fits_data'", ":", "d", ",", "'fits_header'", ":", "h", "}", "for", "i", ",", "d", ",", "h", "in...
[ 13, 0 ]
[ 34, 23 ]
python
en
['en', 'error', 'th']
False
get_upgrades
()
Returns nested list of available upgrade paths
Returns nested list of available upgrade paths
def get_upgrades(): """ Returns nested list of available upgrade paths""" files = [x for x in os.listdir(sql_folder) if x.endswith('.sql')] versions = [(x[:-4].split('_to_')) for x in files] return [tuple(int(j) for j in i) for i in versions]
[ "def", "get_upgrades", "(", ")", ":", "files", "=", "[", "x", "for", "x", "in", "os", ".", "listdir", "(", "sql_folder", ")", "if", "x", ".", "endswith", "(", "'.sql'", ")", "]", "versions", "=", "[", "(", "x", "[", ":", "-", "4", "]", ".", "...
[ 20, 0 ]
[ 24, 55 ]
python
en
['en', 'en', 'en']
True
get_version
(cursor)
returns version of current database schema
returns version of current database schema
def get_version(cursor): """ returns version of current database schema""" cursor.execute("SELECT value FROM version WHERE name='revision'") return cursor.fetchall()[0][0]
[ "def", "get_version", "(", "cursor", ")", ":", "cursor", ".", "execute", "(", "\"SELECT value FROM version WHERE name='revision'\"", ")", "return", "cursor", ".", "fetchall", "(", ")", "[", "0", "]", "[", "0", "]" ]
[ 26, 0 ]
[ 29, 34 ]
python
en
['en', 'de', 'en']
True
get_latest
(current, upgrades)
return latest version reachable from current version
return latest version reachable from current version
def get_latest(current, upgrades): """return latest version reachable from current version""" latest = current while True: options = [to for from_,to in upgrades if from_ == latest and to > latest] if options: choice = max(options) latest = choice else: ...
[ "def", "get_latest", "(", "current", ",", "upgrades", ")", ":", "latest", "=", "current", "while", "True", ":", "options", "=", "[", "to", "for", "from_", ",", "to", "in", "upgrades", "if", "from_", "==", "latest", "and", "to", ">", "latest", "]", "i...
[ 31, 0 ]
[ 41, 17 ]
python
en
['en', 'en', 'en']
True
get_path
(current, target, upgrades)
returns list of tuples which represents the upgrade path from 'current' to 'target
returns list of tuples which represents the upgrade path from 'current' to 'target
def get_path(current, target, upgrades): """returns list of tuples which represents the upgrade path from 'current' to 'target'""" cursor = current steps = [] if current < target: head = max cmp = lambda a,b: a<b elif current > target: head = min cmp = lambda a,b: a>b...
[ "def", "get_path", "(", "current", ",", "target", ",", "upgrades", ")", ":", "cursor", "=", "current", "steps", "=", "[", "]", "if", "current", "<", "target", ":", "head", "=", "max", "cmp", "=", "lambda", "a", ",", "b", ":", "a", "<", "b", "elif...
[ 43, 0 ]
[ 63, 16 ]
python
en
['en', 'en', 'en']
True
construct_sql
(steps)
returns a string which is a list of concatenated SQL statements
returns a string which is a list of concatenated SQL statements
def construct_sql(steps): """returns a string which is a list of concatenated SQL statements""" strings = [] for step in steps: with open(os.path.join(sql_folder, '%s_to_%s.sql' % step), 'r') as f: for line in f.readlines(): strings.append(line) return "".join(strings...
[ "def", "construct_sql", "(", "steps", ")", ":", "strings", "=", "[", "]", "for", "step", "in", "steps", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "sql_folder", ",", "'%s_to_%s.sql'", "%", "step", ")", ",", "'r'", ")", "as", "f"...
[ 65, 0 ]
[ 72, 27 ]
python
en
['en', 'en', 'en']
True
ask_version
(version)
interact with user to determine what to do
interact with user to determine what to do
def ask_version(version): """ interact with user to determine what to do""" upgrades = get_upgrades() latest = get_latest(version, upgrades) answer = False if latest > version: msg = "a new version (%s) is available. You have %s. Upgrade?" % (latest, version) answer = True if raw_inp...
[ "def", "ask_version", "(", "version", ")", ":", "upgrades", "=", "get_upgrades", "(", ")", "latest", "=", "get_latest", "(", "version", ",", "upgrades", ")", "answer", "=", "False", "if", "latest", ">", "version", ":", "msg", "=", "\"a new version (%s) is av...
[ 74, 0 ]
[ 97, 15 ]
python
en
['en', 'en', 'en']
True
UnifiedJobTemplate.accessible_pk_qs
(cls, accessor, role_field)
A re-implementation of accessible pk queryset for the "normal" unified JTs. Does not return inventory sources or system JTs, these should be handled inside of get_queryset where it is utilized.
A re-implementation of accessible pk queryset for the "normal" unified JTs. Does not return inventory sources or system JTs, these should be handled inside of get_queryset where it is utilized.
def accessible_pk_qs(cls, accessor, role_field): """ A re-implementation of accessible pk queryset for the "normal" unified JTs. Does not return inventory sources or system JTs, these should be handled inside of get_queryset where it is utilized. """ # do not use this if ...
[ "def", "accessible_pk_qs", "(", "cls", ",", "accessor", ",", "role_field", ")", ":", "# do not use this if in a subclass", "if", "cls", "!=", "UnifiedJobTemplate", ":", "return", "super", "(", "UnifiedJobTemplate", ",", "cls", ")", ".", "accessible_pk_qs", "(", "a...
[ 201, 4 ]
[ 210, 116 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate._get_unified_job_class
(cls)
Return subclass of UnifiedJob that is created from this template.
Return subclass of UnifiedJob that is created from this template.
def _get_unified_job_class(cls): """ Return subclass of UnifiedJob that is created from this template. """ raise NotImplementedError
[ "def", "_get_unified_job_class", "(", "cls", ")", ":", "raise", "NotImplementedError" ]
[ 317, 4 ]
[ 321, 33 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate.notification_templates
(self)
Return notification_templates relevant to this Unified Job Template
Return notification_templates relevant to this Unified Job Template
def notification_templates(self): """ Return notification_templates relevant to this Unified Job Template """ # NOTE: Derived classes should implement from awx.main.models.notifications import NotificationTemplate return NotificationTemplate.objects.none()
[ "def", "notification_templates", "(", "self", ")", ":", "# NOTE: Derived classes should implement", "from", "awx", ".", "main", ".", "models", ".", "notifications", "import", "NotificationTemplate", "return", "NotificationTemplate", ".", "objects", ".", "none", "(", "...
[ 324, 4 ]
[ 331, 50 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate.create_unified_job
(self, **kwargs)
Create a new unified job based on this unified job template.
Create a new unified job based on this unified job template.
def create_unified_job(self, **kwargs): """ Create a new unified job based on this unified job template. """ new_job_passwords = kwargs.pop('survey_passwords', {}) eager_fields = kwargs.pop('_eager_fields', None) # automatically encrypt survey fields if hasattr(s...
[ "def", "create_unified_job", "(", "self", ",", "*", "*", "kwargs", ")", ":", "new_job_passwords", "=", "kwargs", ".", "pop", "(", "'survey_passwords'", ",", "{", "}", ")", "eager_fields", "=", "kwargs", ".", "pop", "(", "'_eager_fields'", ",", "None", ")",...
[ 333, 4 ]
[ 415, 26 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate.get_ask_mapping
(cls)
Creates dictionary that maps the unified job field (keys) to the field that enables prompting for the field (values)
Creates dictionary that maps the unified job field (keys) to the field that enables prompting for the field (values)
def get_ask_mapping(cls): """ Creates dictionary that maps the unified job field (keys) to the field that enables prompting for the field (values) """ mapping = {} for field in cls._meta.fields: if isinstance(field, AskForField): mapping[field....
[ "def", "get_ask_mapping", "(", "cls", ")", ":", "mapping", "=", "{", "}", "for", "field", "in", "cls", ".", "_meta", ".", "fields", ":", "if", "isinstance", "(", "field", ",", "AskForField", ")", ":", "mapping", "[", "field", ".", "allows_field", "]", ...
[ 418, 4 ]
[ 427, 22 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate.copy_unified_jt
(self)
Returns saved object, including related fields. Create a copy of this unified job template.
Returns saved object, including related fields. Create a copy of this unified job template.
def copy_unified_jt(self): """ Returns saved object, including related fields. Create a copy of this unified job template. """ unified_jt_class = self.__class__ fields = self._get_unified_jt_copy_names() unified_jt = copy_model_by_class(self, unified_jt_class, fie...
[ "def", "copy_unified_jt", "(", "self", ")", ":", "unified_jt_class", "=", "self", ".", "__class__", "fields", "=", "self", ".", "_get_unified_jt_copy_names", "(", ")", "unified_jt", "=", "copy_model_by_class", "(", "self", ",", "unified_jt_class", ",", "fields", ...
[ 433, 4 ]
[ 447, 25 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate._accept_or_ignore_job_kwargs
(self, _exclude_errors=(), **kwargs)
Override in subclass if template accepts _any_ prompted params
Override in subclass if template accepts _any_ prompted params
def _accept_or_ignore_job_kwargs(self, _exclude_errors=(), **kwargs): """ Override in subclass if template accepts _any_ prompted params """ errors = {} if kwargs: for field_name in kwargs.keys(): errors[field_name] = [_("Field is not allowed on launch...
[ "def", "_accept_or_ignore_job_kwargs", "(", "self", ",", "_exclude_errors", "=", "(", ")", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "{", "}", "if", "kwargs", ":", "for", "field_name", "in", "kwargs", ".", "keys", "(", ")", ":", "errors", "[", ...
[ 449, 4 ]
[ 457, 35 ]
python
en
['en', 'error', 'th']
False
UnifiedJobTemplate.accept_or_ignore_variables
(self, data, errors=None, _exclude_errors=(), extra_passwords=None)
If subclasses accept any `variables` or `extra_vars`, they should define _accept_or_ignore_variables to place those variables in the accepted dict, according to the acceptance rules of the template.
If subclasses accept any `variables` or `extra_vars`, they should define _accept_or_ignore_variables to place those variables in the accepted dict, according to the acceptance rules of the template.
def accept_or_ignore_variables(self, data, errors=None, _exclude_errors=(), extra_passwords=None): """ If subclasses accept any `variables` or `extra_vars`, they should define _accept_or_ignore_variables to place those variables in the accepted dict, according to the acceptance rules of ...
[ "def", "accept_or_ignore_variables", "(", "self", ",", "data", ",", "errors", "=", "None", ",", "_exclude_errors", "=", "(", ")", ",", "extra_passwords", "=", "None", ")", ":", "if", "errors", "is", "None", ":", "errors", "=", "{", "}", "if", "not", "i...
[ 459, 4 ]
[ 485, 33 ]
python
en
['en', 'error', 'th']
False
UnifiedJob._get_unified_job_template_class
(cls)
Return subclass of UnifiedJobTemplate that applies to this unified job.
Return subclass of UnifiedJobTemplate that applies to this unified job.
def _get_unified_job_template_class(cls): """ Return subclass of UnifiedJobTemplate that applies to this unified job. """ raise NotImplementedError
[ "def", "_get_unified_job_template_class", "(", "cls", ")", ":", "raise", "NotImplementedError" ]
[ 749, 4 ]
[ 753, 33 ]
python
en
['en', 'error', 'th']
False
UnifiedJob._global_timeout_setting
(self)
Override in child classes, None value indicates this is not configurable
Override in child classes, None value indicates this is not configurable
def _global_timeout_setting(self): "Override in child classes, None value indicates this is not configurable" return None
[ "def", "_global_timeout_setting", "(", "self", ")", ":", "return", "None" ]
[ 755, 4 ]
[ 757, 19 ]
python
en
['en', 'en', 'en']
True
UnifiedJob.save
(self, *args, **kwargs)
Save the job, with current status, to the database. Ensure that all data is consistent before doing so.
Save the job, with current status, to the database. Ensure that all data is consistent before doing so.
def save(self, *args, **kwargs): """Save the job, with current status, to the database. Ensure that all data is consistent before doing so. """ # If update_fields has been specified, add our field names to it, # if it hasn't been specified, then we're just doing a normal save. ...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# If update_fields has been specified, add our field names to it,", "# if it hasn't been specified, then we're just doing a normal save.", "update_fields", "=", "kwargs", ".", "get", "(", "'up...
[ 802, 4 ]
[ 881, 21 ]
python
en
['en', 'en', 'en']
True
UnifiedJob.copy_unified_job
(self, _eager_fields=None, **new_prompts)
Returns saved object, including related fields. Create a copy of this unified job for the purpose of relaunch
Returns saved object, including related fields. Create a copy of this unified job for the purpose of relaunch
def copy_unified_job(self, _eager_fields=None, **new_prompts): """ Returns saved object, including related fields. Create a copy of this unified job for the purpose of relaunch """ unified_job_class = self.__class__ unified_jt_class = self._get_unified_job_template_class(...
[ "def", "copy_unified_job", "(", "self", ",", "_eager_fields", "=", "None", ",", "*", "*", "new_prompts", ")", ":", "unified_job_class", "=", "self", ".", "__class__", "unified_jt_class", "=", "self", ".", "_get_unified_job_template_class", "(", ")", "parent_field_...
[ 883, 4 ]
[ 915, 26 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.launch_prompts
(self)
Return dictionary of prompts job was launched with returns None if unknown
Return dictionary of prompts job was launched with returns None if unknown
def launch_prompts(self): """ Return dictionary of prompts job was launched with returns None if unknown """ JobLaunchConfig = self._meta.get_field('launch_config').related_model try: config = self.launch_config return config.prompts_dict() ...
[ "def", "launch_prompts", "(", "self", ")", ":", "JobLaunchConfig", "=", "self", ".", "_meta", ".", "get_field", "(", "'launch_config'", ")", ".", "related_model", "try", ":", "config", "=", "self", ".", "launch_config", "return", "config", ".", "prompts_dict",...
[ 917, 4 ]
[ 927, 23 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.create_config_from_prompts
(self, kwargs, parent=None)
Create a launch configuration entry for this job, given prompts returns None if it can not be created
Create a launch configuration entry for this job, given prompts returns None if it can not be created
def create_config_from_prompts(self, kwargs, parent=None): """ Create a launch configuration entry for this job, given prompts returns None if it can not be created """ JobLaunchConfig = self._meta.get_field('launch_config').related_model config = JobLaunchConfig(job=self...
[ "def", "create_config_from_prompts", "(", "self", ",", "kwargs", ",", "parent", "=", "None", ")", ":", "JobLaunchConfig", "=", "self", ".", "_meta", ".", "get_field", "(", "'launch_config'", ")", ".", "related_model", "config", "=", "JobLaunchConfig", "(", "jo...
[ 929, 4 ]
[ 962, 21 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.event_processing_finished
(self)
Returns True / False, whether all events from job have been saved
Returns True / False, whether all events from job have been saved
def event_processing_finished(self): """ Returns True / False, whether all events from job have been saved """ if self.status in ACTIVE_STATES: return False # tally of events is only available at end of run try: event_qs = self.get_event_queryset() ...
[ "def", "event_processing_finished", "(", "self", ")", ":", "if", "self", ".", "status", "in", "ACTIVE_STATES", ":", "return", "False", "# tally of events is only available at end of run", "try", ":", "event_qs", "=", "self", ".", "get_event_queryset", "(", ")", "exc...
[ 1010, 4 ]
[ 1021, 54 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.result_stdout_raw_handle
(self, enforce_max_bytes=True)
This method returns a file-like object ready to be read which contains all stdout for the UnifiedJob. If the size of the file is greater than `settings.STDOUT_MAX_BYTES_DISPLAY`, a StdoutMaxBytesExceeded exception will be raised.
This method returns a file-like object ready to be read which contains all stdout for the UnifiedJob.
def result_stdout_raw_handle(self, enforce_max_bytes=True): """ This method returns a file-like object ready to be read which contains all stdout for the UnifiedJob. If the size of the file is greater than `settings.STDOUT_MAX_BYTES_DISPLAY`, a StdoutMaxBytesExceeded exception ...
[ "def", "result_stdout_raw_handle", "(", "self", ",", "enforce_max_bytes", "=", "True", ")", ":", "max_supported", "=", "settings", ".", "STDOUT_MAX_BYTES_DISPLAY", "if", "enforce_max_bytes", ":", "# If enforce_max_bytes is True, we're not grabbing the whole file,", "# just the ...
[ 1023, 4 ]
[ 1113, 29 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.websocket_emit_data
(self)
Return extra data that should be included when submitting data to the browser over the websocket connection
Return extra data that should be included when submitting data to the browser over the websocket connection
def websocket_emit_data(self): '''Return extra data that should be included when submitting data to the browser over the websocket connection''' websocket_data = dict(type=self.job_type_name) if self.spawned_by_workflow: websocket_data.update(dict(workflow_job_id=self.workflow_job_id...
[ "def", "websocket_emit_data", "(", "self", ")", ":", "websocket_data", "=", "dict", "(", "type", "=", "self", ".", "job_type_name", ")", "if", "self", ".", "spawned_by_workflow", ":", "websocket_data", ".", "update", "(", "dict", "(", "workflow_job_id", "=", ...
[ 1235, 4 ]
[ 1240, 29 ]
python
en
['en', 'en', 'en']
True
UnifiedJob.signal_start
(self, **kwargs)
Notify the task runner system to begin work on this task.
Notify the task runner system to begin work on this task.
def signal_start(self, **kwargs): """Notify the task runner system to begin work on this task.""" # Sanity check: Are we able to start the job? If not, do not attempt # to do so. if not self.can_start: return False # Get any passwords or other data that are prerequi...
[ "def", "signal_start", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Sanity check: Are we able to start the job? If not, do not attempt", "# to do so.", "if", "not", "self", ".", "can_start", ":", "return", "False", "# Get any passwords or other data that are prerequisit...
[ 1329, 4 ]
[ 1361, 19 ]
python
en
['en', 'en', 'en']
True
UnifiedJob.preferred_instance_groups
(self)
Return Instance/Rampart Groups preferred by this unified job template
Return Instance/Rampart Groups preferred by this unified job template
def preferred_instance_groups(self): """ Return Instance/Rampart Groups preferred by this unified job template """ if not self.unified_job_template: return [] return list(self.unified_job_template.instance_groups.all())
[ "def", "preferred_instance_groups", "(", "self", ")", ":", "if", "not", "self", ".", "unified_job_template", ":", "return", "[", "]", "return", "list", "(", "self", ".", "unified_job_template", ".", "instance_groups", ".", "all", "(", ")", ")" ]
[ 1412, 4 ]
[ 1418, 68 ]
python
en
['en', 'error', 'th']
False
UnifiedJob.awx_meta_vars
(self)
The result of this method is used as extra_vars of a job launched by AWX, for purposes of client playbook hooks
The result of this method is used as extra_vars of a job launched by AWX, for purposes of client playbook hooks
def awx_meta_vars(self): """ The result of this method is used as extra_vars of a job launched by AWX, for purposes of client playbook hooks """ r = {} for name in ('awx', 'tower'): r['{}_job_id'.format(name)] = self.pk r['{}_job_launch_type'.forma...
[ "def", "awx_meta_vars", "(", "self", ")", ":", "r", "=", "{", "}", "for", "name", "in", "(", "'awx'", ",", "'tower'", ")", ":", "r", "[", "'{}_job_id'", ".", "format", "(", "name", ")", "]", "=", "self", ".", "pk", "r", "[", "'{}_job_launch_type'",...
[ 1445, 4 ]
[ 1489, 16 ]
python
en
['en', 'error', 'th']
False
TestJobNotificationMixin.test_context
(self, JobClass, sqlite_copy_expert, project, inventory_source)
The Jinja context defines all of the fields that can be used by a template. Ensure that the context generated for each job type has the expected structure.
The Jinja context defines all of the fields that can be used by a template. Ensure that the context generated for each job type has the expected structure.
def test_context(self, JobClass, sqlite_copy_expert, project, inventory_source): """The Jinja context defines all of the fields that can be used by a template. Ensure that the context generated for each job type has the expected structure.""" kwargs = {} if JobClass is InventoryUpdate: ...
[ "def", "test_context", "(", "self", ",", "JobClass", ",", "sqlite_copy_expert", ",", "project", ",", "inventory_source", ")", ":", "kwargs", "=", "{", "}", "if", "JobClass", "is", "InventoryUpdate", ":", "kwargs", "[", "'inventory_source'", "]", "=", "inventor...
[ 100, 4 ]
[ 114, 81 ]
python
en
['en', 'en', 'en']
True
TestJobNotificationMixin.test_context_stub
(self)
The context stub is a fake context used to validate custom notification messages. Ensure that this also has the expected structure. Furthermore, ensure that the stub context contains *all* fields that could possibly be included in a context.
The context stub is a fake context used to validate custom notification messages. Ensure that this also has the expected structure. Furthermore, ensure that the stub context contains *all* fields that could possibly be included in a context.
def test_context_stub(self): """The context stub is a fake context used to validate custom notification messages. Ensure that this also has the expected structure. Furthermore, ensure that the stub context contains *all* fields that could possibly be included in a context.""" def check_...
[ "def", "test_context_stub", "(", "self", ")", ":", "def", "check_structure_and_completeness", "(", "expected_structure", ",", "obj", ")", ":", "expected_structure", "=", "deepcopy", "(", "expected_structure", ")", "if", "isinstance", "(", "expected_structure", ",", ...
[ 133, 4 ]
[ 157, 98 ]
python
en
['en', 'en', 'en']
True
OpenLayersWidget.map_options
(self)
Builds the map options hash for the OpenLayers template.
Builds the map options hash for the OpenLayers template.
def map_options(self): "Builds the map options hash for the OpenLayers template." # JavaScript construction utilities for the Bounds and Projection. def ol_bounds(extent): return 'new OpenLayers.Bounds(%s)' % str(extent) def ol_projection(srid): return 'new Open...
[ "def", "map_options", "(", "self", ")", ":", "# JavaScript construction utilities for the Bounds and Projection.", "def", "ol_bounds", "(", "extent", ")", ":", "return", "'new OpenLayers.Bounds(%s)'", "%", "str", "(", "extent", ")", "def", "ol_projection", "(", "srid", ...
[ 80, 4 ]
[ 117, 26 ]
python
en
['en', 'en', 'en']
True
JobOptions.passwords_needed_to_start
(self)
Return list of password field names needed to start the job.
Return list of password field names needed to start the job.
def passwords_needed_to_start(self): '''Return list of password field names needed to start the job.''' needed = [] # Unsaved credential objects can not require passwords if not self.pk: return needed for cred in self.credentials.all(): needed.extend(cred....
[ "def", "passwords_needed_to_start", "(", "self", ")", ":", "needed", "=", "[", "]", "# Unsaved credential objects can not require passwords", "if", "not", "self", ".", "pk", ":", "return", "needed", "for", "cred", "in", "self", ".", "credentials", ".", "all", "(...
[ 188, 4 ]
[ 196, 21 ]
python
en
['en', 'en', 'en']
True
JobTemplate.validation_errors
(self)
Fields needed to start, which cannot be given on launch, invalid state.
Fields needed to start, which cannot be given on launch, invalid state.
def validation_errors(self): """ Fields needed to start, which cannot be given on launch, invalid state. """ validation_errors = {} if self.inventory is None and not self.ask_inventory_on_launch: validation_errors['inventory'] = [ _("Job Template must ...
[ "def", "validation_errors", "(", "self", ")", ":", "validation_errors", "=", "{", "}", "if", "self", ".", "inventory", "is", "None", "and", "not", "self", ".", "ask_inventory_on_launch", ":", "validation_errors", "[", "'inventory'", "]", "=", "[", "_", "(", ...
[ 282, 4 ]
[ 295, 32 ]
python
en
['en', 'error', 'th']
False
JobTemplate.create_job
(self, **kwargs)
Create a new job based on this template.
Create a new job based on this template.
def create_job(self, **kwargs): """ Create a new job based on this template. """ return self.create_unified_job(**kwargs)
[ "def", "create_job", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "create_unified_job", "(", "*", "*", "kwargs", ")" ]
[ 306, 4 ]
[ 310, 48 ]
python
en
['en', 'error', 'th']
False
JobTemplate.validate_unique
(self, exclude=None)
Custom over-ride for JT specifically because organization is inferred from project after full_clean is finished thus the organization field is not yet set when validation happens
Custom over-ride for JT specifically because organization is inferred from project after full_clean is finished thus the organization field is not yet set when validation happens
def validate_unique(self, exclude=None): """Custom over-ride for JT specifically because organization is inferred from project after full_clean is finished thus the organization field is not yet set when validation happens """ errors = [] for ut in JobTemplate.SOFT_UNIQUE...
[ "def", "validate_unique", "(", "self", ",", "exclude", "=", "None", ")", ":", "errors", "=", "[", "]", "for", "ut", "in", "JobTemplate", ".", "SOFT_UNIQUE_TOGETHER", ":", "kwargs", "=", "{", "'name'", ":", "self", ".", "name", "}", "if", "self", ".", ...
[ 331, 4 ]
[ 349, 41 ]
python
en
['en', 'en', 'en']
True
JobTemplate.can_start_without_user_input
(self, callback_extra_vars=None)
Return whether job template can be used to start a new job without requiring any user input.
Return whether job template can be used to start a new job without requiring any user input.
def can_start_without_user_input(self, callback_extra_vars=None): """ Return whether job template can be used to start a new job without requiring any user input. """ variables_needed = False if callback_extra_vars: extra_vars_dict = parse_yaml_or_json(callbac...
[ "def", "can_start_without_user_input", "(", "self", ",", "callback_extra_vars", "=", "None", ")", ":", "variables_needed", "=", "False", "if", "callback_extra_vars", ":", "extra_vars_dict", "=", "parse_yaml_or_json", "(", "callback_extra_vars", ")", "for", "var", "in"...
[ 380, 4 ]
[ 403, 99 ]
python
en
['en', 'error', 'th']
False
Job.retry_qs
(self, status)
Returns Host queryset that will be used to produce the `limit` field in a retry on a subset of hosts
Returns Host queryset that will be used to produce the `limit` field in a retry on a subset of hosts
def retry_qs(self, status): """ Returns Host queryset that will be used to produce the `limit` field in a retry on a subset of hosts """ kwargs = {} if status == 'all': pass elif status == 'failed': # Special case for parity with Ansible .r...
[ "def", "retry_qs", "(", "self", ",", "status", ")", ":", "kwargs", "=", "{", "}", "if", "status", "==", "'all'", ":", "pass", "elif", "status", "==", "'failed'", ":", "# Special case for parity with Ansible .retry files", "kwargs", "[", "'job_host_summaries__faile...
[ 625, 4 ]
[ 644, 40 ]
python
en
['en', 'error', 'th']
False
Job.display_artifacts
(self)
Hides artifacts if they are marked as no_log type artifacts.
Hides artifacts if they are marked as no_log type artifacts.
def display_artifacts(self): """ Hides artifacts if they are marked as no_log type artifacts. """ artifacts = self.artifacts if artifacts.get('_ansible_no_log', False): return "$hidden due to Ansible no_log flag$" return artifacts
[ "def", "display_artifacts", "(", "self", ")", ":", "artifacts", "=", "self", ".", "artifacts", "if", "artifacts", ".", "get", "(", "'_ansible_no_log'", ",", "False", ")", ":", "return", "\"$hidden due to Ansible no_log flag$\"", "return", "artifacts" ]
[ 736, 4 ]
[ 743, 24 ]
python
en
['en', 'error', 'th']
False
LaunchTimeConfig.display_extra_vars
(self)
Hides fields marked as passwords in survey.
Hides fields marked as passwords in survey.
def display_extra_vars(self): """ Hides fields marked as passwords in survey. """ if hasattr(self, 'survey_passwords') and self.survey_passwords: extra_vars = parse_yaml_or_json(self.extra_vars).copy() for key, value in self.survey_passwords.items(): ...
[ "def", "display_extra_vars", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'survey_passwords'", ")", "and", "self", ".", "survey_passwords", ":", "extra_vars", "=", "parse_yaml_or_json", "(", "self", ".", "extra_vars", ")", ".", "copy", "(", ")"...
[ 959, 4 ]
[ 970, 34 ]
python
en
['en', 'error', 'th']
False
JobLaunchConfig.has_user_prompts
(self, template)
Returns True if any fields exist in the launch config that are not permissions exclusions (has to exist because of callback relaunch exception)
Returns True if any fields exist in the launch config that are not permissions exclusions (has to exist because of callback relaunch exception)
def has_user_prompts(self, template): """ Returns True if any fields exist in the launch config that are not permissions exclusions (has to exist because of callback relaunch exception) """ return self._has_user_prompts(template, only_unprompted=False)
[ "def", "has_user_prompts", "(", "self", ",", "template", ")", ":", "return", "self", ".", "_has_user_prompts", "(", "template", ",", "only_unprompted", "=", "False", ")" ]
[ 993, 4 ]
[ 999, 70 ]
python
en
['en', 'error', 'th']
False
JobLaunchConfig.has_unprompted
(self, template)
returns True if the template has set ask_ fields to False after launching with those prompts
returns True if the template has set ask_ fields to False after launching with those prompts
def has_unprompted(self, template): """ returns True if the template has set ask_ fields to False after launching with those prompts """ return self._has_user_prompts(template, only_unprompted=True)
[ "def", "has_unprompted", "(", "self", ",", "template", ")", ":", "return", "self", ".", "_has_user_prompts", "(", "template", ",", "only_unprompted", "=", "True", ")" ]
[ 1001, 4 ]
[ 1006, 69 ]
python
en
['en', 'error', 'th']
False
SystemJobTemplate._accept_or_ignore_variables
(self, data, errors, _exclude_errors=())
Unlike other templates, like project updates and inventory sources, system job templates can accept a limited number of fields used as options for the management commands.
Unlike other templates, like project updates and inventory sources, system job templates can accept a limited number of fields used as options for the management commands.
def _accept_or_ignore_variables(self, data, errors, _exclude_errors=()): """ Unlike other templates, like project updates and inventory sources, system job templates can accept a limited number of fields used as options for the management commands. """ rejected = {} ...
[ "def", "_accept_or_ignore_variables", "(", "self", ",", "data", ",", "errors", ",", "_exclude_errors", "=", "(", ")", ")", ":", "rejected", "=", "{", "}", "allowed_vars", "=", "set", "(", "[", "'days'", ",", "'older_than'", ",", "'granularity'", "]", ")", ...
[ 1151, 4 ]
[ 1183, 39 ]
python
en
['en', 'error', 'th']
False
Inventory.get_group_hosts_map
(self)
Return dictionary mapping group_id to set of child host_id's.
Return dictionary mapping group_id to set of child host_id's.
def get_group_hosts_map(self): """ Return dictionary mapping group_id to set of child host_id's. """ # FIXME: Cache this mapping? group_hosts_kw = dict(group__inventory_id=self.pk, host__inventory_id=self.pk) group_hosts_qs = Group.hosts.through.objects.filter(**group_hos...
[ "def", "get_group_hosts_map", "(", "self", ")", ":", "# FIXME: Cache this mapping?", "group_hosts_kw", "=", "dict", "(", "group__inventory_id", "=", "self", ".", "pk", ",", "host__inventory_id", "=", "self", ".", "pk", ")", "group_hosts_qs", "=", "Group", ".", "...
[ 178, 4 ]
[ 190, 30 ]
python
en
['en', 'error', 'th']
False
Inventory.get_group_parents_map
(self)
Return dictionary mapping group_id to set of parent group_id's.
Return dictionary mapping group_id to set of parent group_id's.
def get_group_parents_map(self): """ Return dictionary mapping group_id to set of parent group_id's. """ # FIXME: Cache this mapping? group_parents_kw = dict(from_group__inventory_id=self.pk, to_group__inventory_id=self.pk) group_parents_qs = Group.parents.through.objects...
[ "def", "get_group_parents_map", "(", "self", ")", ":", "# FIXME: Cache this mapping?", "group_parents_kw", "=", "dict", "(", "from_group__inventory_id", "=", "self", ".", "pk", ",", "to_group__inventory_id", "=", "self", ".", "pk", ")", "group_parents_qs", "=", "Gro...
[ 192, 4 ]
[ 204, 32 ]
python
en
['en', 'error', 'th']
False
Inventory.get_group_children_map
(self)
Return dictionary mapping group_id to set of child group_id's.
Return dictionary mapping group_id to set of child group_id's.
def get_group_children_map(self): """ Return dictionary mapping group_id to set of child group_id's. """ # FIXME: Cache this mapping? group_parents_kw = dict(from_group__inventory_id=self.pk, to_group__inventory_id=self.pk) group_parents_qs = Group.parents.through.objects...
[ "def", "get_group_children_map", "(", "self", ")", ":", "# FIXME: Cache this mapping?", "group_parents_kw", "=", "dict", "(", "from_group__inventory_id", "=", "self", ".", "pk", ",", "to_group__inventory_id", "=", "self", ".", "pk", ")", "group_parents_qs", "=", "Gr...
[ 206, 4 ]
[ 218, 33 ]
python
en
['en', 'error', 'th']
False
Inventory.update_computed_fields
(self)
Update model fields that are computed from database relationships.
Update model fields that are computed from database relationships.
def update_computed_fields(self): """ Update model fields that are computed from database relationships. """ logger.debug("Going to update inventory computed fields, pk={0}".format(self.pk)) start_time = time.time() active_hosts = self.hosts failed_hosts = active_...
[ "def", "update_computed_fields", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Going to update inventory computed fields, pk={0}\"", ".", "format", "(", "self", ".", "pk", ")", ")", "start_time", "=", "time", ".", "time", "(", ")", "active_hosts", "=", ...
[ 318, 4 ]
[ 354, 140 ]
python
en
['en', 'error', 'th']
False
Host.all_groups
(self)
Return all groups of which this host is a member, avoiding infinite recursion in the case of cyclical group relations.
Return all groups of which this host is a member, avoiding infinite recursion in the case of cyclical group relations.
def all_groups(self): """ Return all groups of which this host is a member, avoiding infinite recursion in the case of cyclical group relations. """ group_parents_map = self.inventory.get_group_parents_map() group_pks = set(self.groups.values_list('pk', flat=True)) ...
[ "def", "all_groups", "(", "self", ")", ":", "group_parents_map", "=", "self", ".", "inventory", ".", "get_group_parents_map", "(", ")", "group_pks", "=", "set", "(", "self", ".", "groups", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", "...
[ 504, 4 ]
[ 521, 64 ]
python
en
['en', 'error', 'th']
False
Host.get_effective_host_name
(self)
Return the name of the host that will be used in actual ansible command run.
Return the name of the host that will be used in actual ansible command run.
def get_effective_host_name(self): """ Return the name of the host that will be used in actual ansible command run. """ host_name = self.name if 'ansible_ssh_host' in self.variables_dict: host_name = self.variables_dict['ansible_ssh_host'] if 'ansible_...
[ "def", "get_effective_host_name", "(", "self", ")", ":", "host_name", "=", "self", ".", "name", "if", "'ansible_ssh_host'", "in", "self", ".", "variables_dict", ":", "host_name", "=", "self", ".", "variables_dict", "[", "'ansible_ssh_host'", "]", "if", "'ansible...
[ 537, 4 ]
[ 547, 24 ]
python
en
['en', 'error', 'th']
False
Group.get_all_parents
(self, except_pks=None)
Return all parents of this group recursively. The group itself will be excluded unless there is a cycle leading back to it.
Return all parents of this group recursively. The group itself will be excluded unless there is a cycle leading back to it.
def get_all_parents(self, except_pks=None): """ Return all parents of this group recursively. The group itself will be excluded unless there is a cycle leading back to it. """ group_parents_map = self.inventory.get_group_parents_map() child_pks_to_check = set([self.pk]) ...
[ "def", "get_all_parents", "(", "self", ",", "except_pks", "=", "None", ")", ":", "group_parents_map", "=", "self", ".", "inventory", ".", "get_group_parents_map", "(", ")", "child_pks_to_check", "=", "set", "(", "[", "self", ".", "pk", "]", ")", "child_pks_c...
[ 696, 4 ]
[ 712, 65 ]
python
en
['en', 'error', 'th']
False
Group.get_all_children
(self, except_pks=None)
Return all children of this group recursively. The group itself will be excluded unless there is a cycle leading back to it.
Return all children of this group recursively. The group itself will be excluded unless there is a cycle leading back to it.
def get_all_children(self, except_pks=None): """ Return all children of this group recursively. The group itself will be excluded unless there is a cycle leading back to it. """ group_children_map = self.inventory.get_group_children_map() parent_pks_to_check = set([self....
[ "def", "get_all_children", "(", "self", ",", "except_pks", "=", "None", ")", ":", "group_children_map", "=", "self", ".", "inventory", ".", "get_group_children_map", "(", ")", "parent_pks_to_check", "=", "set", "(", "[", "self", ".", "pk", "]", ")", "parent_...
[ 718, 4 ]
[ 734, 64 ]
python
en
['en', 'error', 'th']
False
Group.get_all_hosts
(self, except_group_pks=None)
Return all hosts associated with this group or any of its children.
Return all hosts associated with this group or any of its children.
def get_all_hosts(self, except_group_pks=None): """ Return all hosts associated with this group or any of its children. """ group_children_map = self.inventory.get_group_children_map() group_hosts_map = self.inventory.get_group_hosts_map() parent_pks_to_check = set([self....
[ "def", "get_all_hosts", "(", "self", ",", "except_group_pks", "=", "None", ")", ":", "group_children_map", "=", "self", ".", "inventory", ".", "get_group_children_map", "(", ")", "group_hosts_map", "=", "self", ".", "inventory", ".", "get_group_hosts_map", "(", ...
[ 740, 4 ]
[ 757, 62 ]
python
en
['en', 'error', 'th']
False
InventorySourceOptions.get_cloud_credential
(self)
Return the credential which is directly tied to the inventory source type.
Return the credential which is directly tied to the inventory source type.
def get_cloud_credential(self): """Return the credential which is directly tied to the inventory source type.""" credential = None for cred in self.credentials.all(): if self.source in CLOUD_PROVIDERS: if cred.kind == self.source.replace('ec2', 'aws'): ...
[ "def", "get_cloud_credential", "(", "self", ")", ":", "credential", "=", "None", "for", "cred", "in", "self", ".", "credentials", ".", "all", "(", ")", ":", "if", "self", ".", "source", "in", "CLOUD_PROVIDERS", ":", "if", "cred", ".", "kind", "==", "se...
[ 919, 4 ]
[ 932, 25 ]
python
en
['en', 'en', 'en']
True
InventorySourceOptions.get_extra_credentials
(self)
Return all credentials that are not used by the inventory source injector. These are all credentials that should run their own inject_credential logic.
Return all credentials that are not used by the inventory source injector. These are all credentials that should run their own inject_credential logic.
def get_extra_credentials(self): """Return all credentials that are not used by the inventory source injector. These are all credentials that should run their own inject_credential logic. """ special_cred = None if self.source in CLOUD_PROVIDERS: # these have special ...
[ "def", "get_extra_credentials", "(", "self", ")", ":", "special_cred", "=", "None", "if", "self", ".", "source", "in", "CLOUD_PROVIDERS", ":", "# these have special injection logic associated with them", "special_cred", "=", "self", ".", "get_cloud_credential", "(", ")"...
[ 934, 4 ]
[ 946, 26 ]
python
en
['en', 'en', 'en']
True
InventoryUpdate.get_actual_source_path
(self)
Alias to source_path that combines with project path for for SCM file based sources
Alias to source_path that combines with project path for for SCM file based sources
def get_actual_source_path(self): '''Alias to source_path that combines with project path for for SCM file based sources''' if self.inventory_source_id is None or self.inventory_source.source_project_id is None: return self.source_path return os.path.join(self.inventory_source.source...
[ "def", "get_actual_source_path", "(", "self", ")", ":", "if", "self", ".", "inventory_source_id", "is", "None", "or", "self", ".", "inventory_source", ".", "source_project_id", "is", "None", ":", "return", "self", ".", "source_path", "return", "os", ".", "path...
[ 1243, 4 ]
[ 1247, 123 ]
python
en
['en', 'en', 'en']
True
PluginFileInjector.filename
(self)
Inventory filename for using the inventory plugin This is created dynamically, but the auto plugin requires this exact naming
Inventory filename for using the inventory plugin This is created dynamically, but the auto plugin requires this exact naming
def filename(self): """Inventory filename for using the inventory plugin This is created dynamically, but the auto plugin requires this exact naming """ return '{0}.yml'.format(self.plugin_name)
[ "def", "filename", "(", "self", ")", ":", "return", "'{0}.yml'", ".", "format", "(", "self", ".", "plugin_name", ")" ]
[ 1338, 4 ]
[ 1342, 49 ]
python
en
['en', 'en', 'en']
True
PluginFileInjector.inventory_contents
(self, inventory_update, private_data_dir)
Returns a string that is the content for the inventory file for the inventory plugin
Returns a string that is the content for the inventory file for the inventory plugin
def inventory_contents(self, inventory_update, private_data_dir): """Returns a string that is the content for the inventory file for the inventory plugin""" return yaml.safe_dump(self.inventory_as_dict(inventory_update, private_data_dir), default_flow_style=False, width=1000)
[ "def", "inventory_contents", "(", "self", ",", "inventory_update", ",", "private_data_dir", ")", ":", "return", "yaml", ".", "safe_dump", "(", "self", ".", "inventory_as_dict", "(", "inventory_update", ",", "private_data_dir", ")", ",", "default_flow_style", "=", ...
[ 1344, 4 ]
[ 1346, 127 ]
python
en
['en', 'en', 'en']
True
PluginFileInjector.inventory_as_dict
(self, inventory_update, private_data_dir)
None conveys that we should use the user-provided plugin. Note that a plugin value of '' should still be overridden.
None conveys that we should use the user-provided plugin. Note that a plugin value of '' should still be overridden.
def inventory_as_dict(self, inventory_update, private_data_dir): source_vars = dict(inventory_update.source_vars_dict) # make a copy ''' None conveys that we should use the user-provided plugin. Note that a plugin value of '' should still be overridden. ''' if self.plugi...
[ "def", "inventory_as_dict", "(", "self", ",", "inventory_update", ",", "private_data_dir", ")", ":", "source_vars", "=", "dict", "(", "inventory_update", ".", "source_vars_dict", ")", "# make a copy", "if", "self", ".", "plugin_name", "is", "not", "None", ":", "...
[ 1348, 4 ]
[ 1361, 26 ]
python
en
['en', 'error', 'th']
False
PluginFileInjector._get_shared_env
(self, inventory_update, private_data_dir, private_data_files)
By default, we will apply the standard managed injectors
By default, we will apply the standard managed injectors
def _get_shared_env(self, inventory_update, private_data_dir, private_data_files): """By default, we will apply the standard managed injectors""" injected_env = {} credential = inventory_update.get_cloud_credential() # some sources may have no credential, specifically ec2 if cred...
[ "def", "_get_shared_env", "(", "self", ",", "inventory_update", ",", "private_data_dir", ",", "private_data_files", ")", ":", "injected_env", "=", "{", "}", "credential", "=", "inventory_update", ".", "get_cloud_credential", "(", ")", "# some sources may have no credent...
[ 1370, 4 ]
[ 1392, 27 ]
python
en
['en', 'en', 'en']
True
RAdam.step
(self, closure: OptLossClosure = None)
r"""Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss.
r"""Performs a single optimization step.
def step(self, closure: OptLossClosure = None) -> OptFloat: r"""Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss. """ loss = None if closure is not None: loss = closure() for grou...
[ "def", "step", "(", "self", ",", "closure", ":", "OptLossClosure", "=", "None", ")", "->", "OptFloat", ":", "loss", "=", "None", "if", "closure", "is", "not", "None", ":", "loss", "=", "closure", "(", ")", "for", "group", "in", "self", ".", "param_gr...
[ 88, 4 ]
[ 179, 19 ]
python
en
['en', 'en', 'en']
True
iDRACSecurity.export_ssl_certificate
(self, ssl_cert_type=SSLCertTypeEnum.CA_Cert, export_file=None)
Export SSL Certificate :param ssl_cert_type: SSL Certificate Type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custom_Signing_Cert, 4 - Client_Trust_Cert :param export_file: Path to output file. :type ssl_cert_type: enum <SSLCertTypeEnum> :type export_file: ...
Export SSL Certificate :param ssl_cert_type: SSL Certificate Type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custom_Signing_Cert, 4 - Client_Trust_Cert :param export_file: Path to output file. :type ssl_cert_type: enum <SSLCertTypeEnum> :type export_file: ...
def export_ssl_certificate(self, ssl_cert_type=SSLCertTypeEnum.CA_Cert, export_file=None): """ Export SSL Certificate :param ssl_cert_type: SSL Certificate Type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custom_Signing_Cert, 4 - Client_Trust_Cert :param export_file: Path to...
[ "def", "export_ssl_certificate", "(", "self", ",", "ssl_cert_type", "=", "SSLCertTypeEnum", ".", "CA_Cert", ",", "export_file", "=", "None", ")", ":", "ssl_cert_data", "=", "self", ".", "entity", ".", "_export_ssl_certificate", "(", "ssl_cert_type", "=", "ssl_cert...
[ 71, 4 ]
[ 109, 28 ]
python
en
['en', 'ja', 'th']
False
iDRACSecurity.import_ssl_certificate
(self, ssl_cert_file=None, ssl_cert_type=SSLCertTypeEnum.CA_Cert, passphrase="")
Import SSL Certificate :param ssl_cert_file: Path to Certificate File. :param ssl_cert_type: SSL Certificate type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custom_Signing_Cert, 4 - Client_Trust_Cert :param passphrase: Passphrase. :type ssl_cert_file: str ...
Import SSL Certificate :param ssl_cert_file: Path to Certificate File. :param ssl_cert_type: SSL Certificate type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custom_Signing_Cert, 4 - Client_Trust_Cert :param passphrase: Passphrase. :type ssl_cert_file: str ...
def import_ssl_certificate(self, ssl_cert_file=None, ssl_cert_type=SSLCertTypeEnum.CA_Cert, passphrase=""): """ Import SSL Certificate :param ssl_cert_file: Path to Certificate File. :param ssl_cert_type: SSL Certificate type. 1 - Web_Server_Cert, 2 - CA_Cert, 3 - Custo...
[ "def", "import_ssl_certificate", "(", "self", ",", "ssl_cert_file", "=", "None", ",", "ssl_cert_type", "=", "SSLCertTypeEnum", ".", "CA_Cert", ",", "passphrase", "=", "\"\"", ")", ":", "if", "ssl_cert_file", "is", "not", "None", ":", "try", ":", "# Reading SSL...
[ 111, 4 ]
[ 164, 28 ]
python
en
['en', 'ja', 'th']
False
sourcefinder_image_from_accessor
(image, **args)
Create a source finder ImageData object from an image 'accessor' Args: - image (DataAccessor): FITS/AIPS/HDF5 image available through an accessor. Returns: (:class:`tkp.sourcefinder.image.ImageData`): a source finder image.
Create a source finder ImageData object from an image 'accessor'
def sourcefinder_image_from_accessor(image, **args): """Create a source finder ImageData object from an image 'accessor' Args: - image (DataAccessor): FITS/AIPS/HDF5 image available through an accessor. Returns: (:class:`tkp.sourcefinder.image.ImageData`): a source finder image....
[ "def", "sourcefinder_image_from_accessor", "(", "image", ",", "*", "*", "args", ")", ":", "image", "=", "ImageData", "(", "image", ".", "data", ",", "image", ".", "beam", ",", "image", ".", "wcs", ",", "*", "*", "args", ")", "return", "image" ]
[ 21, 0 ]
[ 33, 16 ]
python
en
['en', 'en', 'en']
True
writefits
(data, filename, header = {})
Dump a NumPy array to a FITS file. Key/value pairs for the FITS header can be supplied in the optional header argument as a dictionary.
Dump a NumPy array to a FITS file.
def writefits(data, filename, header = {}): """ Dump a NumPy array to a FITS file. Key/value pairs for the FITS header can be supplied in the optional header argument as a dictionary. """ if header.__class__.__name__ == 'Header': pyfits.writeto(filename, data.transpose(), header) el...
[ "def", "writefits", "(", "data", ",", "filename", ",", "header", "=", "{", "}", ")", ":", "if", "header", ".", "__class__", ".", "__name__", "==", "'Header'", ":", "pyfits", ".", "writeto", "(", "filename", ",", "data", ".", "transpose", "(", ")", ",...
[ 36, 0 ]
[ 49, 29 ]
python
en
['en', 'error', 'th']
False
open
(path, *args, **kwargs)
Returns an accessor object (if available) for the file or directory 'path'. We try all the possible accessors in order from most specific to least specific. That is, if possible, we prefer an accessor providing LofarAccessor to one providing DataAccessor, but we accept the latter if that's the onl...
Returns an accessor object (if available) for the file or directory 'path'.
def open(path, *args, **kwargs): """ Returns an accessor object (if available) for the file or directory 'path'. We try all the possible accessors in order from most specific to least specific. That is, if possible, we prefer an accessor providing LofarAccessor to one providing DataAccessor, but we...
[ "def", "open", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "type", "(", "path", ")", "==", "HDUList", ":", "return", "FitsImageBlob", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", "elif", "type", "(", ...
[ 52, 0 ]
[ 76, 76 ]
python
en
['en', 'error', 'th']
False
session_commit
(sess_maker: sessionmaker)
Yield a session created with the given sessionmaker. The yeld session is set with autocommit=False, no matter what is the sessiomaker's setting. When exiting from the cm, try to commit the transaction. If it fails, rollback the transaction. Finally, the session is closed.
Yield a session created with the given sessionmaker. The yeld session is set with autocommit=False, no matter what is the sessiomaker's setting. When exiting from the cm, try to commit the transaction. If it fails, rollback the transaction. Finally, the session is closed.
def session_commit(sess_maker: sessionmaker) -> Session: """ Yield a session created with the given sessionmaker. The yeld session is set with autocommit=False, no matter what is the sessiomaker's setting. When exiting from the cm, try to commit the transaction. If it fails, rollback the transaction. ...
[ "def", "session_commit", "(", "sess_maker", ":", "sessionmaker", ")", "->", "Session", ":", "session", "=", "sess_maker", "(", "autocommit", "=", "False", ")", "assert", "not", "session", ".", "autocommit", "try", ":", "yield", "session", "session", ".", "co...
[ 7, 0 ]
[ 23, 23 ]
python
en
['en', 'error', 'th']
False
TestClientModel.test_client_stringification
(self)
This test is designed to cover __str__ method for Client.
This test is designed to cover __str__ method for Client.
def test_client_stringification(self) -> None: """ This test is designed to cover __str__ method for Client. """ client = make_client("some_client") self.assertEqual(str(client), "<Client: some_client>")
[ "def", "test_client_stringification", "(", "self", ")", "->", "None", ":", "client", "=", "make_client", "(", "\"some_client\"", ")", "self", ".", "assertEqual", "(", "str", "(", "client", ")", ",", "\"<Client: some_client>\"", ")" ]
[ 23, 4 ]
[ 28, 62 ]
python
en
['en', 'error', 'th']
False