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
TestAdict.test_pickle
(self)
check if we can pickle and unpickle the adict
check if we can pickle and unpickle the adict
def test_pickle(self): """ check if we can pickle and unpickle the adict """ cucumis_sativus = adict(data) pickled = pickle.dumps(cucumis_sativus) unpickled = pickle.loads(pickled) self.assertEqual(cucumis_sativus, unpickled)
[ "def", "test_pickle", "(", "self", ")", ":", "cucumis_sativus", "=", "adict", "(", "data", ")", "pickled", "=", "pickle", ".", "dumps", "(", "cucumis_sativus", ")", "unpickled", "=", "pickle", ".", "loads", "(", "pickled", ")", "self", ".", "assertEqual", ...
[ 8, 4 ]
[ 15, 52 ]
python
en
['en', 'error', 'th']
False
LoadSettingsProcessor._detect_thread_group
(self, executor)
Detect preferred thread group :param executor: :return:
Detect preferred thread group :param executor: :return:
def _detect_thread_group(self, executor): """ Detect preferred thread group :param executor: :return: """ tg = self.TG if not self.force_ctg: return tg msg = 'Thread group detection: %s, regular ThreadGroup will be used' if not self.l...
[ "def", "_detect_thread_group", "(", "self", ",", "executor", ")", ":", "tg", "=", "self", ".", "TG", "if", "not", "self", ".", "force_ctg", ":", "return", "tg", "msg", "=", "'Thread group detection: %s, regular ThreadGroup will be used'", "if", "not", "self", "....
[ 89, 4 ]
[ 113, 17 ]
python
en
['en', 'error', 'th']
False
LoadSettingsProcessor._divide_concurrency
(self, concurrency_list)
calculate target concurrency for every thread group
calculate target concurrency for every thread group
def _divide_concurrency(self, concurrency_list): """ calculate target concurrency for every thread group """ total_old_concurrency = sum(concurrency_list) for idx, concurrency in enumerate(concurrency_list): if total_old_concurrency and concurrency_list[idx] != 0: ...
[ "def", "_divide_concurrency", "(", "self", ",", "concurrency_list", ")", ":", "total_old_concurrency", "=", "sum", "(", "concurrency_list", ")", "for", "idx", ",", "concurrency", "in", "enumerate", "(", "concurrency_list", ")", ":", "if", "total_old_concurrency", ...
[ 154, 4 ]
[ 176, 43 ]
python
en
['en', 'error', 'th']
False
LoadSettingsProcessor._add_shaper
(self, jmx)
Add shaper :param jmx: JMX :return:
Add shaper :param jmx: JMX :return:
def _add_shaper(self, jmx): """ Add shaper :param jmx: JMX :return: """ if not self.load.duration: self.log.warning("You must set 'ramp-up' and/or 'hold-for' when using 'throughput' option") return etree_shaper = jmx.get_rps_shaper() ...
[ "def", "_add_shaper", "(", "self", ",", "jmx", ")", ":", "if", "not", "self", ".", "load", ".", "duration", ":", "self", ".", "log", ".", "warning", "(", "\"You must set 'ramp-up' and/or 'hold-for' when using 'throughput' option\"", ")", "return", "etree_shaper", ...
[ 178, 4 ]
[ 212, 82 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.__init__
(self, executor, original=None)
:type executor: ScenarioExecutor :type original: JMX
:type executor: ScenarioExecutor :type original: JMX
def __init__(self, executor, original=None): """ :type executor: ScenarioExecutor :type original: JMX """ super(JMeterScenarioBuilder, self).__init__(original) self.executor = executor self.scenario = executor.get_scenario() self.engine = executor.engine ...
[ "def", "__init__", "(", "self", ",", "executor", ",", "original", "=", "None", ")", ":", "super", "(", "JMeterScenarioBuilder", ",", "self", ")", ".", "__init__", "(", "original", ")", "self", ".", "executor", "=", "executor", "self", ".", "scenario", "=...
[ 245, 4 ]
[ 262, 54 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.__add_jsr_elements
(children, req, get_from_config=True)
:type children: etree.Element :type req: Request
:type children: etree.Element :type req: Request
def __add_jsr_elements(children, req, get_from_config=True): """ :type children: etree.Element :type req: Request """ jsrs = [] if get_from_config: jsrs = req.config.get("jsr223", []) else: jsrs = req.get("jsr223", []) if not isins...
[ "def", "__add_jsr_elements", "(", "children", ",", "req", ",", "get_from_config", "=", "True", ")", ":", "jsrs", "=", "[", "]", "if", "get_from_config", ":", "jsrs", "=", "req", ".", "config", ".", "get", "(", "\"jsr223\"", ",", "[", "]", ")", "else", ...
[ 411, 4 ]
[ 437, 54 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.compile_request
(self, request)
:type request: HierarchicHTTPRequest :return:
def compile_request(self, request): """ :type request: HierarchicHTTPRequest :return: """ sampler = children = None protocol_name = request.priority_option('protocol', default=self.default_protocol) if protocol_name in self.protocol_handlers: protocol...
[ "def", "compile_request", "(", "self", ",", "request", ")", ":", "sampler", "=", "children", "=", "None", "protocol_name", "=", "request", ".", "priority_option", "(", "'protocol'", ",", "default", "=", "self", ".", "default_protocol", ")", "if", "protocol_nam...
[ 459, 4 ]
[ 488, 34 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.compile_foreach_block
(self, block)
:type block: ForEachBlock
:type block: ForEachBlock
def compile_foreach_block(self, block): """ :type block: ForEachBlock """ elements = [] controller = JMX._get_foreach_controller(block.input_var, block.loop_var) children = etree.Element("hashTree") for compiled in self.compile_requests(block.requests): ...
[ "def", "compile_foreach_block", "(", "self", ",", "block", ")", ":", "elements", "=", "[", "]", "controller", "=", "JMX", ".", "_get_foreach_controller", "(", "block", ".", "input_var", ",", "block", ".", "loop_var", ")", "children", "=", "etree", ".", "El...
[ 548, 4 ]
[ 562, 23 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.compile_action_block
(self, block)
:type block: ActionBlock :return:
:type block: ActionBlock :return:
def compile_action_block(self, block): """ :type block: ActionBlock :return: """ actions = { 'stop': 0, 'pause': 1, 'stop-now': 2, 'continue': 3, } targets = {'current-thread': 0, 'all-threads': 2} action = a...
[ "def", "compile_action_block", "(", "self", ",", "block", ")", ":", "actions", "=", "{", "'stop'", ":", "0", ",", "'pause'", ":", "1", ",", "'stop-now'", ":", "2", ",", "'continue'", ":", "3", ",", "}", "targets", "=", "{", "'current-thread'", ":", "...
[ 586, 4 ]
[ 606, 38 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.__generate
(self)
Generate the test plan
Generate the test plan
def __generate(self): """ Generate the test plan """ thread_group = JMX.get_thread_group(testname=self.executor.label) thread_group_ht = etree.Element("hashTree", type="tg") # NOTE: set realistic dns-cache and JVM prop by default? self.request_compiler = Request...
[ "def", "__generate", "(", "self", ")", ":", "thread_group", "=", "JMX", ".", "get_thread_group", "(", "testname", "=", "self", ".", "executor", ".", "label", ")", "thread_group_ht", "=", "etree", ".", "Element", "(", "\"hashTree\"", ",", "type", "=", "\"tg...
[ 623, 4 ]
[ 642, 56 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.save
(self, filename)
Generate test plan and save :type filename: str
Generate test plan and save
def save(self, filename): """ Generate test plan and save :type filename: str """ # NOTE: bad design, as repetitive save will duplicate stuff self.__generate() super(JMeterScenarioBuilder, self).save(filename)
[ "def", "save", "(", "self", ",", "filename", ")", ":", "# NOTE: bad design, as repetitive save will duplicate stuff", "self", ".", "__generate", "(", ")", "super", "(", "JMeterScenarioBuilder", ",", "self", ")", ".", "save", "(", "filename", ")" ]
[ 644, 4 ]
[ 652, 57 ]
python
en
['en', 'error', 'th']
False
JMeterScenarioBuilder.__gen_authorization
(scenario)
Generates HTTP Authorization Manager
Generates HTTP Authorization Manager
def __gen_authorization(scenario): """ Generates HTTP Authorization Manager """ elements = [] authorizations = scenario.get("authorization") if authorizations: clear_flag = False if isinstance(authorizations, dict): if "clear" in ...
[ "def", "__gen_authorization", "(", "scenario", ")", ":", "elements", "=", "[", "]", "authorizations", "=", "scenario", ".", "get", "(", "\"authorization\"", ")", "if", "authorizations", ":", "clear_flag", "=", "False", "if", "isinstance", "(", "authorizations", ...
[ 655, 4 ]
[ 679, 23 ]
python
en
['en', 'error', 'th']
False
perform_forced_fits
(fit_posns, fit_ids, accessor, extraction_params)
Perform forced source measurements on an image based on a list of positions. Args: fit_posns (tuple): List of (RA, Dec) tuples: Positions to be fit. fit_ids: List of identifiers for each requested fit position. image_path (str): path to image for measurements. extraction_pa...
Perform forced source measurements on an image based on a list of positions.
def perform_forced_fits(fit_posns, fit_ids, accessor, extraction_params): """ Perform forced source measurements on an image based on a list of positions. Args: fit_posns (tuple): List of (RA, Dec) tuples: Positions to be fit. fit_ids: List of identifiers for each requested fit position...
[ "def", "perform_forced_fits", "(", "fit_posns", ",", "fit_ids", ",", "accessor", ",", "extraction_params", ")", ":", "logger", ".", "debug", "(", "\"Forced fitting in image: %s\"", "%", "(", "accessor", ".", "url", ")", ")", "if", "not", "len", "(", "fit_ids",...
[ 63, 0 ]
[ 107, 21 ]
python
en
['en', 'error', 'th']
False
text_value
(value)
Force a value to text, render None as an empty string.
Force a value to text, render None as an empty string.
def text_value(value): """Force a value to text, render None as an empty string.""" return "" if value is None else force_str(value)
[ "def", "text_value", "(", "value", ")", ":", "return", "\"\"", "if", "value", "is", "None", "else", "force_str", "(", "value", ")" ]
[ 3, 0 ]
[ 5, 52 ]
python
en
['en', 'en', 'en']
True
text_concat
(*args, **kwargs)
Concatenate several values as a text string with an optional separator.
Concatenate several values as a text string with an optional separator.
def text_concat(*args, **kwargs): """Concatenate several values as a text string with an optional separator.""" separator = text_value(kwargs.get("separator", "")) values = filter(None, [text_value(v) for v in args]) return separator.join(values)
[ "def", "text_concat", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "separator", "=", "text_value", "(", "kwargs", ".", "get", "(", "\"separator\"", ",", "\"\"", ")", ")", "values", "=", "filter", "(", "None", ",", "[", "text_value", "(", "v",...
[ 8, 0 ]
[ 12, 33 ]
python
en
['en', 'en', 'en']
True
plots_cmd
(ctx: click.Context)
Create, add, remove and check your plots
Create, add, remove and check your plots
def plots_cmd(ctx: click.Context): """Create, add, remove and check your plots""" from kale.util.kale_logging import initialize_logging root_path: Path = ctx.obj["root_path"] if not root_path.is_dir(): raise RuntimeError("Please initialize (or migrate) your config directory with 'kale init'") ...
[ "def", "plots_cmd", "(", "ctx", ":", "click", ".", "Context", ")", ":", "from", "kale", ".", "util", ".", "kale_logging", "import", "initialize_logging", "root_path", ":", "Path", "=", "ctx", ".", "obj", "[", "\"root_path\"", "]", "if", "not", "root_path",...
[ 27, 0 ]
[ 34, 59 ]
python
en
['en', 'en', 'en']
True
_pythonlib_compat
()
On Python 3.7 and earlier, distutils would include the Python library. See pypa/distutils#9.
On Python 3.7 and earlier, distutils would include the Python library. See pypa/distutils#9.
def _pythonlib_compat(): """ On Python 3.7 and earlier, distutils would include the Python library. See pypa/distutils#9. """ from distutils import sysconfig if not sysconfig.get_config_var('Py_ENABLED_SHARED'): return yield 'python{}.{}{}'.format( sys.hexversion >> 24, ...
[ "def", "_pythonlib_compat", "(", ")", ":", "from", "distutils", "import", "sysconfig", "if", "not", "sysconfig", ".", "get_config_var", "(", "'Py_ENABLED_SHARED'", ")", ":", "return", "yield", "'python{}.{}{}'", ".", "format", "(", "sys", ".", "hexversion", ">>"...
[ 3, 0 ]
[ 16, 5 ]
python
en
['en', 'error', 'th']
False
make_wcs
(crval=None, cdelt=None, crpix=None )
Make a WCS object for insertion into a synthetic image. Args: crval (tuple): Tuple of (RA, Dec) in decimal degrees at the reference position. crpix (tuple): Tuple of (x,y) co-ordinates describing the reference pixel location corresponding to the crval sky-position. ...
Make a WCS object for insertion into a synthetic image.
def make_wcs(crval=None, cdelt=None, crpix=None ): """ Make a WCS object for insertion into a synthetic image. Args: crval (tuple): Tuple of (RA, Dec) in decimal degrees at the reference position. crpix (tuple): Tuple of (x,y) co-ordinates ...
[ "def", "make_wcs", "(", "crval", "=", "None", ",", "cdelt", "=", "None", ",", "crpix", "=", "None", ")", ":", "# For any arguments not set we simply assign an arbitrary valid value:", "if", "crval", "is", "None", ":", "crval", "=", "100.", ",", "45.", "if", "c...
[ 20, 0 ]
[ 55, 14 ]
python
en
['en', 'error', 'th']
False
SyntheticImage.__init__
(self, wcs=None, data=None, beam=(1.5,1.5,0), freq_eff=150e6, freq_bw=2e6, tau_time=1800, taustart_ts=datetime.datetime(2015,1,1) )
Generate a synthetic image for use in tests Args: wcs (tkp.utility.coordinates.WCS): WCS for the image. data (array_like): Data for the image. Default is a 512x512 array of zeroes. beam (tuple): Beamsemi-major axis (in pixels), semi-minor axis (pixel...
Generate a synthetic image for use in tests
def __init__(self, wcs=None, data=None, beam=(1.5,1.5,0), freq_eff=150e6, freq_bw=2e6, tau_time=1800, taustart_ts=datetime.datetime(2015,1,1) ): """ Generate a syntheti...
[ "def", "__init__", "(", "self", ",", "wcs", "=", "None", ",", "data", "=", "None", ",", "beam", "=", "(", "1.5", ",", "1.5", ",", "0", ")", ",", "freq_eff", "=", "150e6", ",", "freq_bw", "=", "2e6", ",", "tau_time", "=", "1800", ",", "taustart_ts...
[ 58, 4 ]
[ 98, 72 ]
python
en
['en', 'error', 'th']
False
WinTool._UseSeparateMspdbsrv
(self, env, args)
Allows to use a unique instance of mspdbsrv.exe per linker instead of a shared one.
Allows to use a unique instance of mspdbsrv.exe per linker instead of a shared one.
def _UseSeparateMspdbsrv(self, env, args): """Allows to use a unique instance of mspdbsrv.exe per linker instead of a shared one.""" if len(args) < 1: raise Exception("Not enough arguments") if args[0] != "link.exe": return # Use the output filename passed t...
[ "def", "_UseSeparateMspdbsrv", "(", "self", ",", "env", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "1", ":", "raise", "Exception", "(", "\"Not enough arguments\"", ")", "if", "args", "[", "0", "]", "!=", "\"link.exe\"", ":", "return", "...
[ 40, 4 ]
[ 66, 50 ]
python
en
['en', 'en', 'en']
True
WinTool.Dispatch
(self, args)
Dispatches a string command to a method.
Dispatches a string command to a method.
def Dispatch(self, args): """Dispatches a string command to a method.""" if len(args) < 1: raise Exception("Not enough arguments") method = "Exec%s" % self._CommandifyName(args[0]) return getattr(self, method)(*args[1:])
[ "def", "Dispatch", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "1", ":", "raise", "Exception", "(", "\"Not enough arguments\"", ")", "method", "=", "\"Exec%s\"", "%", "self", ".", "_CommandifyName", "(", "args", "[", "0", "]...
[ 68, 4 ]
[ 74, 47 ]
python
en
['en', 'en', 'en']
True
WinTool._CommandifyName
(self, name_string)
Transforms a tool name like recursive-mirror to RecursiveMirror.
Transforms a tool name like recursive-mirror to RecursiveMirror.
def _CommandifyName(self, name_string): """Transforms a tool name like recursive-mirror to RecursiveMirror.""" return name_string.title().replace("-", "")
[ "def", "_CommandifyName", "(", "self", ",", "name_string", ")", ":", "return", "name_string", ".", "title", "(", ")", ".", "replace", "(", "\"-\"", ",", "\"\"", ")" ]
[ 76, 4 ]
[ 78, 51 ]
python
en
['en', 'el-Latn', 'en']
True
WinTool._GetEnv
(self, arch)
Gets the saved environment from a file for a given architecture.
Gets the saved environment from a file for a given architecture.
def _GetEnv(self, arch): """Gets the saved environment from a file for a given architecture.""" # The environment is saved as an "environment block" (see CreateProcess # and msvs_emulation for details). We convert to a dict here. # Drop last 2 NULs, one for list terminator, one for trail...
[ "def", "_GetEnv", "(", "self", ",", "arch", ")", ":", "# The environment is saved as an \"environment block\" (see CreateProcess", "# and msvs_emulation for details). We convert to a dict here.", "# Drop last 2 NULs, one for list terminator, one for trailing vs. separator.", "pairs", "=", ...
[ 80, 4 ]
[ 87, 24 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecStamp
(self, path)
Simple stamp command.
Simple stamp command.
def ExecStamp(self, path): """Simple stamp command.""" open(path, "w").close()
[ "def", "ExecStamp", "(", "self", ",", "path", ")", ":", "open", "(", "path", ",", "\"w\"", ")", ".", "close", "(", ")" ]
[ 89, 4 ]
[ 91, 31 ]
python
en
['et', 'en', 'en']
True
WinTool.ExecRecursiveMirror
(self, source, dest)
Emulation of rm -rf out && cp -af in out.
Emulation of rm -rf out && cp -af in out.
def ExecRecursiveMirror(self, source, dest): """Emulation of rm -rf out && cp -af in out.""" if os.path.exists(dest): if os.path.isdir(dest): def _on_error(fn, path, excinfo): # The operation failed, possibly because the file is set to ...
[ "def", "ExecRecursiveMirror", "(", "self", ",", "source", ",", "dest", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "dest", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "dest", ")", ":", "def", "_on_error", "(", "fn", ",", "pat...
[ 93, 4 ]
[ 115, 38 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecLinkWrapper
(self, arch, use_separate_mspdbsrv, *args)
Filter diagnostic output from link that looks like: ' Creating library ui.dll.lib and object ui.dll.exp' This happens when there are exports from the dll or exe.
Filter diagnostic output from link that looks like: ' Creating library ui.dll.lib and object ui.dll.exp' This happens when there are exports from the dll or exe.
def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args): """Filter diagnostic output from link that looks like: ' Creating library ui.dll.lib and object ui.dll.exp' This happens when there are exports from the dll or exe. """ env = self._GetEnv(arch) if use_separate_mspdbsrv ...
[ "def", "ExecLinkWrapper", "(", "self", ",", "arch", ",", "use_separate_mspdbsrv", ",", "*", "args", ")", ":", "env", "=", "self", ".", "_GetEnv", "(", "arch", ")", "if", "use_separate_mspdbsrv", "==", "\"True\"", ":", "self", ".", "_UseSeparateMspdbsrv", "("...
[ 117, 4 ]
[ 153, 30 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecLinkWithManifests
( self, arch, embed_manifest, out, ldcmd, resname, mt, rc, intermediate_manifest, *manifests )
A wrapper for handling creating a manifest resource and then executing a link command.
A wrapper for handling creating a manifest resource and then executing a link command.
def ExecLinkWithManifests( self, arch, embed_manifest, out, ldcmd, resname, mt, rc, intermediate_manifest, *manifests ): """A wrapper for handling creating a manifest resource and then executing a link command.""" # ...
[ "def", "ExecLinkWithManifests", "(", "self", ",", "arch", ",", "embed_manifest", ",", "out", ",", "ldcmd", ",", "resname", ",", "mt", ",", "rc", ",", "intermediate_manifest", ",", "*", "manifests", ")", ":", "# The 'normal' way to do manifests is to have link genera...
[ 155, 4 ]
[ 248, 24 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecManifestWrapper
(self, arch, *args)
Run manifest tool with environment set. Strip out undesirable warning (some XML blocks are recognized by the OS loader, but not the manifest tool).
Run manifest tool with environment set. Strip out undesirable warning (some XML blocks are recognized by the OS loader, but not the manifest tool).
def ExecManifestWrapper(self, arch, *args): """Run manifest tool with environment set. Strip out undesirable warning (some XML blocks are recognized by the OS loader, but not the manifest tool).""" env = self._GetEnv(arch) popen = subprocess.Popen( args, shell=True, env=env, ...
[ "def", "ExecManifestWrapper", "(", "self", ",", "arch", ",", "*", "args", ")", ":", "env", "=", "self", ".", "_GetEnv", "(", "arch", ")", "popen", "=", "subprocess", ".", "Popen", "(", "args", ",", "shell", "=", "True", ",", "env", "=", "env", ",",...
[ 250, 4 ]
[ 264, 31 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecManifestToRc
(self, arch, *args)
Creates a resource file pointing a SxS assembly manifest. |args| is tuple containing path to resource file, path to manifest file and resource name which can be "1" (for executables) or "2" (for DLLs).
Creates a resource file pointing a SxS assembly manifest. |args| is tuple containing path to resource file, path to manifest file and resource name which can be "1" (for executables) or "2" (for DLLs).
def ExecManifestToRc(self, arch, *args): """Creates a resource file pointing a SxS assembly manifest. |args| is tuple containing path to resource file, path to manifest file and resource name which can be "1" (for executables) or "2" (for DLLs).""" manifest_path, resource_path, resource_name = a...
[ "def", "ExecManifestToRc", "(", "self", ",", "arch", ",", "*", "args", ")", ":", "manifest_path", ",", "resource_path", ",", "resource_name", "=", "args", "with", "open", "(", "resource_path", ",", "\"w\"", ")", "as", "output", ":", "output", ".", "write",...
[ 266, 4 ]
[ 275, 13 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecMidlWrapper
(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags)
Filter noisy filenames output from MIDL compile step that isn't quietable via command line flags.
Filter noisy filenames output from MIDL compile step that isn't quietable via command line flags.
def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): """Filter noisy filenames output from MIDL compile step that isn't quietable via command line flags. """ args = ( ["midl", "/nologo"] + list(flags) + [ "/out", ...
[ "def", "ExecMidlWrapper", "(", "self", ",", "arch", ",", "outdir", ",", "tlb", ",", "h", ",", "dlldata", ",", "iid", ",", "proxy", ",", "idl", ",", "*", "flags", ")", ":", "args", "=", "(", "[", "\"midl\"", ",", "\"/nologo\"", "]", "+", "list", "...
[ 277, 4 ]
[ 317, 31 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecAsmWrapper
(self, arch, *args)
Filter logo banner from invocations of asm.exe.
Filter logo banner from invocations of asm.exe.
def ExecAsmWrapper(self, arch, *args): """Filter logo banner from invocations of asm.exe.""" env = self._GetEnv(arch) popen = subprocess.Popen( args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) out, _ = popen.communicate() if PY3: ...
[ "def", "ExecAsmWrapper", "(", "self", ",", "arch", ",", "*", "args", ")", ":", "env", "=", "self", ".", "_GetEnv", "(", "arch", ")", "popen", "=", "subprocess", ".", "Popen", "(", "args", ",", "shell", "=", "True", ",", "env", "=", "env", ",", "s...
[ 319, 4 ]
[ 336, 31 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecRcWrapper
(self, arch, *args)
Filter logo banner from invocations of rc.exe. Older versions of RC don't support the /nologo flag.
Filter logo banner from invocations of rc.exe. Older versions of RC don't support the /nologo flag.
def ExecRcWrapper(self, arch, *args): """Filter logo banner from invocations of rc.exe. Older versions of RC don't support the /nologo flag.""" env = self._GetEnv(arch) popen = subprocess.Popen( args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )...
[ "def", "ExecRcWrapper", "(", "self", ",", "arch", ",", "*", "args", ")", ":", "env", "=", "self", ".", "_GetEnv", "(", "arch", ")", "popen", "=", "subprocess", ".", "Popen", "(", "args", ",", "shell", "=", "True", ",", "env", "=", "env", ",", "st...
[ 338, 4 ]
[ 355, 31 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecActionWrapper
(self, arch, rspfile, *dir)
Runs an action command line from a response file using the environment for |arch|. If |dir| is supplied, use that as the working directory.
Runs an action command line from a response file using the environment for |arch|. If |dir| is supplied, use that as the working directory.
def ExecActionWrapper(self, arch, rspfile, *dir): """Runs an action command line from a response file using the environment for |arch|. If |dir| is supplied, use that as the working directory.""" env = self._GetEnv(arch) # TODO(scottmg): This is a temporary hack to get some specific variable...
[ "def", "ExecActionWrapper", "(", "self", ",", "arch", ",", "rspfile", ",", "*", "dir", ")", ":", "env", "=", "self", ".", "_GetEnv", "(", "arch", ")", "# TODO(scottmg): This is a temporary hack to get some specific variables", "# through to actions that are set after gyp-...
[ 357, 4 ]
[ 368, 66 ]
python
en
['en', 'en', 'en']
True
WinTool.ExecClCompile
(self, project_dir, selected_files)
Executed by msvs-ninja projects when the 'ClCompile' target is used to build selected C/C++ files.
Executed by msvs-ninja projects when the 'ClCompile' target is used to build selected C/C++ files.
def ExecClCompile(self, project_dir, selected_files): """Executed by msvs-ninja projects when the 'ClCompile' target is used to build selected C/C++ files.""" project_dir = os.path.relpath(project_dir, BASE_DIR) selected_files = selected_files.split(";") ninja_targets = [ ...
[ "def", "ExecClCompile", "(", "self", ",", "project_dir", ",", "selected_files", ")", ":", "project_dir", "=", "os", ".", "path", ".", "relpath", "(", "project_dir", ",", "BASE_DIR", ")", "selected_files", "=", "selected_files", ".", "split", "(", "\";\"", ")...
[ 370, 4 ]
[ 380, 61 ]
python
en
['en', 'en', 'en']
True
to_native_string
(string, encoding='ascii')
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
def to_native_string(string, encoding='ascii'): """Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ if isinstance(string, builtin_str): out = stri...
[ "def", "to_native_string", "(", "string", ",", "encoding", "=", "'ascii'", ")", ":", "if", "isinstance", "(", "string", ",", "builtin_str", ")", ":", "out", "=", "string", "else", ":", "if", "is_py2", ":", "out", "=", "string", ".", "encode", "(", "enc...
[ 13, 0 ]
[ 26, 14 ]
python
en
['en', 'en', 'en']
True
unicode_is_ascii
(u_string)
Determine if unicode string only contains ASCII characters. :param str u_string: unicode string to check. Must be unicode and not Python 2 `str`. :rtype: bool
Determine if unicode string only contains ASCII characters.
def unicode_is_ascii(u_string): """Determine if unicode string only contains ASCII characters. :param str u_string: unicode string to check. Must be unicode and not Python 2 `str`. :rtype: bool """ assert isinstance(u_string, str) try: u_string.encode('ascii') return Tru...
[ "def", "unicode_is_ascii", "(", "u_string", ")", ":", "assert", "isinstance", "(", "u_string", ",", "str", ")", "try", ":", "u_string", ".", "encode", "(", "'ascii'", ")", "return", "True", "except", "UnicodeEncodeError", ":", "return", "False" ]
[ 29, 0 ]
[ 41, 20 ]
python
en
['en', 'en', 'en']
True
openfile
(fname, openMode="r", compress=False, readfile=True, skipComments=False, commentChar="#", debugLineLimit=0)
open and optionally read a gzipped or uncompressed file If the file is read, return the read data. If the file is just opened, return the filehandle.
open and optionally read a gzipped or uncompressed file If the file is read, return the read data. If the file is just opened, return the filehandle.
def openfile(fname, openMode="r", compress=False, readfile=True, skipComments=False, commentChar="#", debugLineLimit=0): """ open and optionally read a gzipped or uncompressed file If the file is read, return the read data. If the file is just opened, return the filehandle.""" ...
[ "def", "openfile", "(", "fname", ",", "openMode", "=", "\"r\"", ",", "compress", "=", "False", ",", "readfile", "=", "True", ",", "skipComments", "=", "False", ",", "commentChar", "=", "\"#\"", ",", "debugLineLimit", "=", "0", ")", ":", "import", "gzip",...
[ 27, 0 ]
[ 89, 26 ]
python
en
['en', 'en', 'en']
True
generic_set_region
(region_rep, start=None, stop=None, strand=None, generated_by=None)
Returns the input region, or builds one from the input details This is used in several of the parsers including the annotation, and wigData classes
Returns the input region, or builds one from the input details This is used in several of the parsers including the annotation, and wigData classes
def generic_set_region(region_rep, start=None, stop=None, strand=None, generated_by=None): ''' Returns the input region, or builds one from the input details This is used in several of the parsers including the annotation, and wigData classes ''' general_msg = "Inva...
[ "def", "generic_set_region", "(", "region_rep", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "strand", "=", "None", ",", "generated_by", "=", "None", ")", ":", "general_msg", "=", "\"Invalid region specification. Regions should be either a \"", "\"valid...
[ 406, 0 ]
[ 485, 40 ]
python
en
['en', 'en', 'en']
True
makeStructuredArray
(data, dtype, delimiter="\t")
makes a structured array from delimited data with a column mapping
makes a structured array from delimited data with a column mapping
def makeStructuredArray(data, dtype, delimiter="\t"): ''' makes a structured array from delimited data with a column mapping ''' this_array = numpy.zeros(len(data), dtype=dtype) rec_count=0 i=0 while i<len(data): line = data[i] linedata = line.strip().split(delimiter) if...
[ "def", "makeStructuredArray", "(", "data", ",", "dtype", ",", "delimiter", "=", "\"\\t\"", ")", ":", "this_array", "=", "numpy", ".", "zeros", "(", "len", "(", "data", ")", ",", "dtype", "=", "dtype", ")", "rec_count", "=", "0", "i", "=", "0", "while...
[ 487, 0 ]
[ 505, 22 ]
python
en
['en', 'en', 'en']
True
getDataFromFormat
(filename, dataformat, available_formats, skip_comments=True, logger=None, verbose=False, slen=100)
reads a file in a particular format and gets the file data
reads a file in a particular format and gets the file data
def getDataFromFormat(filename, dataformat, available_formats, skip_comments=True, logger=None, verbose=False, slen=100): """reads a file in a particular format and gets the file data """ # type checks if type(filename) is not str: raise TypeError("The specified...
[ "def", "getDataFromFormat", "(", "filename", ",", "dataformat", ",", "available_formats", ",", "skip_comments", "=", "True", ",", "logger", "=", "None", ",", "verbose", "=", "False", ",", "slen", "=", "100", ")", ":", "# type checks", "if", "type", "(", "f...
[ 507, 0 ]
[ 643, 28 ]
python
en
['en', 'en', 'en']
True
addStructuredArrayfield
(a, descr, logger=None, verbose=False)
Return a new array that is like "a", but has additional fields. Arguments: a -- a structured numpy array descr -- a numpy type description of the new fields The contents of "a" are copied over to the appropriate fields in the new array, whereas the new fields are uninitialized. The ar...
Return a new array that is like "a", but has additional fields.
def addStructuredArrayfield(a, descr, logger=None, verbose=False): """Return a new array that is like "a", but has additional fields. Arguments: a -- a structured numpy array descr -- a numpy type description of the new fields The contents of "a" are copied over to the appropriate fie...
[ "def", "addStructuredArrayfield", "(", "a", ",", "descr", ",", "logger", "=", "None", ",", "verbose", "=", "False", ")", ":", "if", "a", ".", "dtype", ".", "fields", "is", "None", ":", "raise", "ValueError", ",", "\"`A' must be a structured numpy array\"", "...
[ 645, 0 ]
[ 691, 12 ]
python
en
['en', 'en', 'en']
True
computeIntrons
(exon_regions, logger=None, generated_by=None, verbose=False)
takes an set of exon regions and computes the corresponding introns Basically, place each exon in order and create the intron spaces, labelling the appropriately. All generic labels common to the exon set will be applied to the introns. In addition, the feature type will be intron and the introns ...
takes an set of exon regions and computes the corresponding introns Basically, place each exon in order and create the intron spaces, labelling the appropriately. All generic labels common to the exon set will be applied to the introns. In addition, the feature type will be intron and the introns ...
def computeIntrons(exon_regions, logger=None, generated_by=None, verbose=False): """ takes an set of exon regions and computes the corresponding introns Basically, place each exon in order and create the intron spaces, labelling the appropriately. All generic labels common to the exon set will be ...
[ "def", "computeIntrons", "(", "exon_regions", ",", "logger", "=", "None", ",", "generated_by", "=", "None", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "logger", ".", "info", "(", "\"Identifying exon common description items...\"", ")", "exon_c...
[ 693, 0 ]
[ 734, 19 ]
python
en
['en', 'en', 'en']
True
region.__init__
(self, region_name, chrid, start, stop, strand=None, seq=None, seqtype=None, desc=None, generated_by=None)
class contrustor: this requires name and chromosome id as strings, start and stop and ints, and optionally strand, sequence and description as strings
class contrustor: this requires name and chromosome id as strings, start and stop and ints, and optionally strand, sequence and description as strings
def __init__(self, region_name, chrid, start, stop, strand=None, seq=None, seqtype=None, desc=None, generated_by=None): """ class contrustor: this requires name and chromosome id as strings, start and stop and ints, and optionally strand, sequence and descrip...
[ "def", "__init__", "(", "self", ",", "region_name", ",", "chrid", ",", "start", ",", "stop", ",", "strand", "=", "None", ",", "seq", "=", "None", ",", "seqtype", "=", "None", ",", "desc", "=", "None", ",", "generated_by", "=", "None", ")", ":", "se...
[ 95, 4 ]
[ 178, 50 ]
python
en
['en', 'en', 'en']
True
region.get_length
(self)
get the length (start-stop) of the feature
get the length (start-stop) of the feature
def get_length(self): """ get the length (start-stop) of the feature """ return(1+(self.stop-self.start))
[ "def", "get_length", "(", "self", ")", ":", "return", "(", "1", "+", "(", "self", ".", "stop", "-", "self", ".", "start", ")", ")" ]
[ 180, 4 ]
[ 184, 40 ]
python
en
['en', 'en', 'en']
True
region.get_positions_str
(self)
get the chr:start-stop of the feature
get the chr:start-stop of the feature
def get_positions_str(self): """ get the chr:start-stop of the feature """ pos_str = "%s:%s-%s" % (str(self.chrid), str(self.start), str(self.stop)) return(pos_str)
[ "def", "get_positions_str", "(", "self", ")", ":", "pos_str", "=", "\"%s:%s-%s\"", "%", "(", "str", "(", "self", ".", "chrid", ")", ",", "str", "(", "self", ".", "start", ")", ",", "str", "(", "self", ".", "stop", ")", ")", "return", "(", "pos_str"...
[ 186, 4 ]
[ 192, 23 ]
python
en
['en', 'en', 'en']
True
region.get_desc_str
(self)
get the desc of the feature as a csv string
get the desc of the feature as a csv string
def get_desc_str(self): """ get the desc of the feature as a csv string""" desc_str_list=[] for key in self.desc.keys(): desc_str = u"%s:%s" % (key, self.desc[key]) try: desc_str_list.append(desc_str.encode('ascii', 'ignore')) ...
[ "def", "get_desc_str", "(", "self", ")", ":", "desc_str_list", "=", "[", "]", "for", "key", "in", "self", ".", "desc", ".", "keys", "(", ")", ":", "desc_str", "=", "u\"%s:%s\"", "%", "(", "key", ",", "self", ".", "desc", "[", "key", "]", ")", "tr...
[ 194, 4 ]
[ 210, 30 ]
python
en
['en', 'en', 'en']
True
region.get_gff3line
(self)
gets the current region as a gff3 format line. The format is specified here http://www.sequenceontology.org/gff3.shtml
gets the current region as a gff3 format line. The format is specified here http://www.sequenceontology.org/gff3.shtml
def get_gff3line(self): """ gets the current region as a gff3 format line. The format is specified here http://www.sequenceontology.org/gff3.shtml """ redundant_keys = ["score", "phase", "type"] replace_keys = [("source", "original_source"), ("i...
[ "def", "get_gff3line", "(", "self", ")", ":", "redundant_keys", "=", "[", "\"score\"", ",", "\"phase\"", ",", "\"type\"", "]", "replace_keys", "=", "[", "(", "\"source\"", ",", "\"original_source\"", ")", ",", "(", "\"id\"", ",", "\"ID\"", ")", "]", "this_...
[ 212, 4 ]
[ 269, 24 ]
python
en
['en', 'en', 'en']
True
region.get_gtfline
(self, gene_id=None, transcript_id=None, verbose=False)
gets the current region as a gtf2 format line. http://www.ensembl.org/info/website/upload/gff.html
gets the current region as a gtf2 format line. http://www.ensembl.org/info/website/upload/gff.html
def get_gtfline(self, gene_id=None, transcript_id=None, verbose=False): """ gets the current region as a gtf2 format line. http://www.ensembl.org/info/website/upload/gff.html """ redundant_keys = ["score", "phase", "type"] replace_keys = [("source", "or...
[ "def", "get_gtfline", "(", "self", ",", "gene_id", "=", "None", ",", "transcript_id", "=", "None", ",", "verbose", "=", "False", ")", ":", "redundant_keys", "=", "[", "\"score\"", ",", "\"phase\"", ",", "\"type\"", "]", "replace_keys", "=", "[", "(", "\"...
[ 271, 4 ]
[ 360, 23 ]
python
en
['en', 'en', 'en']
True
region.get_bed6line
(self)
gets the current region as a bed6 format line. The format is specified here http://https://genome.ucsc.edu/FAQ/FAQformat.html
gets the current region as a bed6 format line. The format is specified here http://https://genome.ucsc.edu/FAQ/FAQformat.html
def get_bed6line(self): """ gets the current region as a bed6 format line. The format is specified here http://https://genome.ucsc.edu/FAQ/FAQformat.html """ this_attributes={} if self.desc is not None: this_attributes = copy.deepcop...
[ "def", "get_bed6line", "(", "self", ")", ":", "this_attributes", "=", "{", "}", "if", "self", ".", "desc", "is", "not", "None", ":", "this_attributes", "=", "copy", ".", "deepcopy", "(", "self", ".", "desc", ")", "this_score", "=", "\".\"", "if", "\"sc...
[ 362, 4 ]
[ 398, 24 ]
python
en
['en', 'en', 'en']
True
render_modal_workflow
(request, html_template, js_template=None, template_vars=None, json_data=None)
Render a response consisting of an HTML chunk and a JS onload chunk in the format required by the modal-workflow framework.
Render a response consisting of an HTML chunk and a JS onload chunk in the format required by the modal-workflow framework.
def render_modal_workflow(request, html_template, js_template=None, template_vars=None, json_data=None): """" Render a response consisting of an HTML chunk and a JS onload chunk in the format required by the modal-workflow framework. """ if js_template: raise TypeError("Passing a js_template...
[ "def", "render_modal_workflow", "(", "request", ",", "html_template", ",", "js_template", "=", "None", ",", "template_vars", "=", "None", ",", "json_data", "=", "None", ")", ":", "if", "js_template", ":", "raise", "TypeError", "(", "\"Passing a js_template argumen...
[ 4, 0 ]
[ 21, 33 ]
python
en
['en', 'error', 'th']
False
mark_safe
(s)
Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string or unicode object is appropriate. If used on a method as a decorator, mark the returned data as safe. Can be called multiple times on a single string.
Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string or unicode object is appropriate.
def mark_safe(s): """ Explicitly mark a string as safe for (HTML) output purposes. The returned object can be used everywhere a string or unicode object is appropriate. If used on a method as a decorator, mark the returned data as safe. Can be called multiple times on a single string. """ ...
[ "def", "mark_safe", "(", "s", ")", ":", "if", "hasattr", "(", "s", ",", "'__html__'", ")", ":", "return", "s", "if", "isinstance", "(", "s", ",", "bytes", ")", "or", "(", "isinstance", "(", "s", ",", "Promise", ")", "and", "s", ".", "_delegate_byte...
[ 128, 0 ]
[ 145, 29 ]
python
en
['en', 'error', 'th']
False
mark_for_escaping
(s)
Explicitly mark a string as requiring HTML escaping upon output. Has no effect on SafeData subclasses. Can be called multiple times on a single string (the resulting escaping is only applied once).
Explicitly mark a string as requiring HTML escaping upon output. Has no effect on SafeData subclasses.
def mark_for_escaping(s): """ Explicitly mark a string as requiring HTML escaping upon output. Has no effect on SafeData subclasses. Can be called multiple times on a single string (the resulting escaping is only applied once). """ warnings.warn('mark_for_escaping() is deprecated.', Removed...
[ "def", "mark_for_escaping", "(", "s", ")", ":", "warnings", ".", "warn", "(", "'mark_for_escaping() is deprecated.'", ",", "RemovedInDjango20Warning", ")", "if", "hasattr", "(", "s", ",", "'__html__'", ")", "or", "isinstance", "(", "s", ",", "EscapeData", ")", ...
[ 148, 0 ]
[ 163, 31 ]
python
en
['en', 'error', 'th']
False
SafeData.__html__
(self)
Returns the html representation of a string for interoperability. This allows other template engines to understand Django's SafeData.
Returns the html representation of a string for interoperability.
def __html__(self): """ Returns the html representation of a string for interoperability. This allows other template engines to understand Django's SafeData. """ return self
[ "def", "__html__", "(", "self", ")", ":", "return", "self" ]
[ 40, 4 ]
[ 46, 19 ]
python
en
['en', 'error', 'th']
False
SafeBytes.__add__
(self, rhs)
Concatenating a safe byte string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe.
Concatenating a safe byte string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe.
def __add__(self, rhs): """ Concatenating a safe byte string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe. """ t = super(SafeBytes, self).__add__(rhs) if isinstance(rhs, SafeText): return SafeText(t) ...
[ "def", "__add__", "(", "self", ",", "rhs", ")", ":", "t", "=", "super", "(", "SafeBytes", ",", "self", ")", ".", "__add__", "(", "rhs", ")", "if", "isinstance", "(", "rhs", ",", "SafeText", ")", ":", "return", "SafeText", "(", "t", ")", "elif", "...
[ 54, 4 ]
[ 64, 16 ]
python
en
['en', 'error', 'th']
False
SafeBytes._proxy_method
(self, *args, **kwargs)
Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument.
Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument.
def _proxy_method(self, *args, **kwargs): """ Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument. """ method = kwargs.pop('method') data = method(self, *args, **kwargs) ...
[ "def", "_proxy_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "method", "=", "kwargs", ".", "pop", "(", "'method'", ")", "data", "=", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "isinst...
[ 66, 4 ]
[ 77, 33 ]
python
en
['en', 'error', 'th']
False
SafeText.__add__
(self, rhs)
Concatenating a safe unicode string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe.
Concatenating a safe unicode string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe.
def __add__(self, rhs): """ Concatenating a safe unicode string with another safe byte string or safe unicode string is safe. Otherwise, the result is no longer safe. """ t = super(SafeText, self).__add__(rhs) if isinstance(rhs, SafeData): return SafeText(t) ...
[ "def", "__add__", "(", "self", ",", "rhs", ")", ":", "t", "=", "super", "(", "SafeText", ",", "self", ")", ".", "__add__", "(", "rhs", ")", "if", "isinstance", "(", "rhs", ",", "SafeData", ")", ":", "return", "SafeText", "(", "t", ")", "return", ...
[ 87, 4 ]
[ 95, 16 ]
python
en
['en', 'error', 'th']
False
SafeText._proxy_method
(self, *args, **kwargs)
Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument.
Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument.
def _proxy_method(self, *args, **kwargs): """ Wrap a call to a normal unicode method up so that we return safe results. The method that is being wrapped is passed in the 'method' argument. """ method = kwargs.pop('method') data = method(self, *args, **kwargs) ...
[ "def", "_proxy_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "method", "=", "kwargs", ".", "pop", "(", "'method'", ")", "data", "=", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "isinst...
[ 97, 4 ]
[ 108, 33 ]
python
en
['en', 'error', 'th']
False
iDRACLogs.lclog_export
(self, share_path, job_wait=True)
Exports the log from the Lifecycle Controller to a file on local/remote share :param share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. False will return the Job ID :type share_path: obj <FileOnShare (NFS and CIFS) or L...
Exports the log from the Lifecycle Controller to a file on local/remote share :param share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. False will return the Job ID :type share_path: obj <FileOnShare (NFS and CIFS) or L...
def lclog_export(self, share_path, job_wait=True): """ Exports the log from the Lifecycle Controller to a file on local/remote share :param share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. False will return the Job ID ...
[ "def", "lclog_export", "(", "self", ",", "share_path", ",", "job_wait", "=", "True", ")", ":", "share", "=", "share_path", ".", "format", "(", "ip", "=", "self", ".", "entity", ".", "ipaddr", ")", "if", "isinstance", "(", "share", ",", "LocalFile", ")"...
[ 79, 4 ]
[ 133, 20 ]
python
en
['en', 'ja', 'th']
False
iDRACLogs.complete_lclog_export
(self, share_path, job_wait=True)
Exports the full log from the Lifecycle Controller to a file on local/remote share :param share_path: share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. False will return the Job ID :type share_path: obj <FileOnShare (N...
Exports the full log from the Lifecycle Controller to a file on local/remote share :param share_path: share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. False will return the Job ID :type share_path: obj <FileOnShare (N...
def complete_lclog_export(self, share_path, job_wait=True): """ Exports the full log from the Lifecycle Controller to a file on local/remote share :param share_path: share_path: the share path where file needs to be exported :param job_wait: the flag to wait for job completion. Fal...
[ "def", "complete_lclog_export", "(", "self", ",", "share_path", ",", "job_wait", "=", "True", ")", ":", "share", "=", "share_path", ".", "format", "(", "ip", "=", "self", ".", "entity", ".", "ipaddr", ")", "if", "isinstance", "(", "share_path", ",", "Loc...
[ 165, 4 ]
[ 214, 20 ]
python
en
['en', 'ja', 'th']
False
TestSeleniumApiritifRunner.test_selenium_prepare_python_single
(self)
Check if script exists in working dir :return:
Check if script exists in working dir :return:
def test_selenium_prepare_python_single(self): """ Check if script exists in working dir :return: """ self.obj.execution.merge({"scenario": { "script": RESOURCES_DIR + "selenium/python/test_blazemeter_fail.py" }}) self.obj.prepare()
[ "def", "test_selenium_prepare_python_single", "(", "self", ")", ":", "self", ".", "obj", ".", "execution", ".", "merge", "(", "{", "\"scenario\"", ":", "{", "\"script\"", ":", "RESOURCES_DIR", "+", "\"selenium/python/test_blazemeter_fail.py\"", "}", "}", ")", "sel...
[ 86, 4 ]
[ 94, 26 ]
python
en
['en', 'error', 'th']
False
TestSeleniumApiritifRunner.test_selenium_prepare_python_folder
(self)
Check if scripts exist in working dir :return:
Check if scripts exist in working dir :return:
def test_selenium_prepare_python_folder(self): """ Check if scripts exist in working dir :return: """ self.obj.execution.merge({"scenario": {"script": RESOURCES_DIR + "selenium/python/"}}) self.obj.prepare()
[ "def", "test_selenium_prepare_python_folder", "(", "self", ")", ":", "self", ".", "obj", ".", "execution", ".", "merge", "(", "{", "\"scenario\"", ":", "{", "\"script\"", ":", "RESOURCES_DIR", "+", "\"selenium/python/\"", "}", "}", ")", "self", ".", "obj", "...
[ 96, 4 ]
[ 102, 26 ]
python
en
['en', 'error', 'th']
False
TestSeleniumApiritifRunner.test_selenium_startup_shutdown_python_single
(self)
run tests from .py file :return:
run tests from .py file :return:
def test_selenium_startup_shutdown_python_single(self): """ run tests from .py file :return: """ self.configure({ 'execution': { "iterations": 1, 'scenario': {'script': RESOURCES_DIR + 'selenium/python/'}, 'executor': 's...
[ "def", "test_selenium_startup_shutdown_python_single", "(", "self", ")", ":", "self", ".", "configure", "(", "{", "'execution'", ":", "{", "\"iterations\"", ":", "1", ",", "'scenario'", ":", "{", "'script'", ":", "RESOURCES_DIR", "+", "'selenium/python/'", "}", ...
[ 104, 4 ]
[ 125, 102 ]
python
en
['en', 'error', 'th']
False
TestSeleniumApiritifRunner.test_selenium_startup_shutdown_python_folder
(self)
run tests from .py files :return:
run tests from .py files :return:
def test_selenium_startup_shutdown_python_folder(self): """ run tests from .py files :return: """ self.configure({ 'execution': { 'iterations': 1, 'scenario': {'script': RESOURCES_DIR + 'selenium/python/'}, 'executor': '...
[ "def", "test_selenium_startup_shutdown_python_folder", "(", "self", ")", ":", "self", ".", "configure", "(", "{", "'execution'", ":", "{", "'iterations'", ":", "1", ",", "'scenario'", ":", "{", "'script'", ":", "RESOURCES_DIR", "+", "'selenium/python/'", "}", ",...
[ 128, 4 ]
[ 152, 57 ]
python
en
['en', 'error', 'th']
False
TestSeleniumApiritifRunner.test_runner_fail_no_test_found
(self)
Check that Python Apiritif runner fails if no tests were found :return:
Check that Python Apiritif runner fails if no tests were found :return:
def test_runner_fail_no_test_found(self): """ Check that Python Apiritif runner fails if no tests were found :return: """ self.configure({ EXEC: { "iterations": 1, "executor": "selenium", "scenario": {"script": RESOURCES...
[ "def", "test_runner_fail_no_test_found", "(", "self", ")", ":", "self", ".", "configure", "(", "{", "EXEC", ":", "{", "\"iterations\"", ":", "1", ",", "\"executor\"", ":", "\"selenium\"", ",", "\"scenario\"", ":", "{", "\"script\"", ":", "RESOURCES_DIR", "+", ...
[ 154, 4 ]
[ 173, 54 ]
python
en
['en', 'error', 'th']
False
TestSeleniumApiritifRunner.test_setup_exception
(self)
Do not crash when test's setUp/setUpClass fails :return:
Do not crash when test's setUp/setUpClass fails :return:
def test_setup_exception(self): """ Do not crash when test's setUp/setUpClass fails :return: """ self.obj.execution.merge({"scenario": { "script": RESOURCES_DIR + "selenium/python/test_setup_exception.py" }}) self.obj.engine.aggregator = FunctionalAggr...
[ "def", "test_setup_exception", "(", "self", ")", ":", "self", ".", "obj", ".", "execution", ".", "merge", "(", "{", "\"scenario\"", ":", "{", "\"script\"", ":", "RESOURCES_DIR", "+", "\"selenium/python/test_setup_exception.py\"", "}", "}", ")", "self", ".", "o...
[ 179, 4 ]
[ 193, 53 ]
python
en
['en', 'error', 'th']
False
HTMLRuleset.match
(self, name, attrs)
Look for a rule matching an HTML element with the given name and attribute dict, and return the corresponding result object. If no rule matches, return None. If multiple rules match, the one chosen is undetermined.
Look for a rule matching an HTML element with the given name and attribute dict, and return the corresponding result object. If no rule matches, return None. If multiple rules match, the one chosen is undetermined.
def match(self, name, attrs): """ Look for a rule matching an HTML element with the given name and attribute dict, and return the corresponding result object. If no rule matches, return None. If multiple rules match, the one chosen is undetermined. """ try: ru...
[ "def", "match", "(", "self", ",", "name", ",", "attrs", ")", ":", "try", ":", "rules_to_test", "=", "self", ".", "element_rules", "[", "name", "]", "except", "KeyError", ":", "return", "None", "for", "precedence", ",", "attr_check", ",", "result", "in", ...
[ 87, 4 ]
[ 100, 29 ]
python
en
['en', 'error', 'th']
False
_const_compare_digest_backport
(a, b)
Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise.
Compare two digests of equal length in constant time.
def _const_compare_digest_backport(a, b): """ Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise. """ result = abs(len(a) - len(b)) for left, right in zip(bytearray(a), bytearray(b)): re...
[ "def", "_const_compare_digest_backport", "(", "a", ",", "b", ")", ":", "result", "=", "abs", "(", "len", "(", "a", ")", "-", "len", "(", "b", ")", ")", "for", "left", ",", "right", "in", "zip", "(", "bytearray", "(", "a", ")", ",", "bytearray", "...
[ 29, 0 ]
[ 39, 22 ]
python
en
['en', 'error', 'th']
False
assert_fingerprint
(cert, fingerprint)
Checks if given fingerprint matches the supplied certificate. :param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons.
Checks if given fingerprint matches the supplied certificate.
def assert_fingerprint(cert, fingerprint): """ Checks if given fingerprint matches the supplied certificate. :param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons. """ fingerprint = fingerprint.replace(":...
[ "def", "assert_fingerprint", "(", "cert", ",", "fingerprint", ")", ":", "fingerprint", "=", "fingerprint", ".", "replace", "(", "\":\"", ",", "\"\"", ")", ".", "lower", "(", ")", "digest_length", "=", "len", "(", "fingerprint", ")", "hashfunc", "=", "HASHF...
[ 176, 0 ]
[ 202, 9 ]
python
en
['en', 'error', 'th']
False
resolve_cert_reqs
(candidate)
Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_REQUIRED`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abbreviation. (So you can specify `REQUI...
Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_REQUIRED`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abbreviation. (So you can specify `REQUI...
def resolve_cert_reqs(candidate): """ Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_REQUIRED`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abb...
[ "def", "resolve_cert_reqs", "(", "candidate", ")", ":", "if", "candidate", "is", "None", ":", "return", "CERT_REQUIRED", "if", "isinstance", "(", "candidate", ",", "str", ")", ":", "res", "=", "getattr", "(", "ssl", ",", "candidate", ",", "None", ")", "i...
[ 205, 0 ]
[ 225, 20 ]
python
en
['en', 'error', 'th']
False
resolve_ssl_version
(candidate)
like resolve_cert_reqs
like resolve_cert_reqs
def resolve_ssl_version(candidate): """ like resolve_cert_reqs """ if candidate is None: return PROTOCOL_TLS if isinstance(candidate, str): res = getattr(ssl, candidate, None) if res is None: res = getattr(ssl, "PROTOCOL_" + candidate) return res ret...
[ "def", "resolve_ssl_version", "(", "candidate", ")", ":", "if", "candidate", "is", "None", ":", "return", "PROTOCOL_TLS", "if", "isinstance", "(", "candidate", ",", "str", ")", ":", "res", "=", "getattr", "(", "ssl", ",", "candidate", ",", "None", ")", "...
[ 228, 0 ]
[ 241, 20 ]
python
en
['en', 'error', 'th']
False
create_urllib3_context
( ssl_version=None, cert_reqs=None, options=None, ciphers=None )
All arguments have the same meaning as ``ssl_wrap_socket``. By default, this function does a lot of the same work that ``ssl.create_default_context`` does on Python 3.4+. It: - Disables SSLv2, SSLv3, and compression - Sets a restricted set of server ciphers If you wish to enable SSLv3, you can do...
All arguments have the same meaning as ``ssl_wrap_socket``.
def create_urllib3_context( ssl_version=None, cert_reqs=None, options=None, ciphers=None ): """All arguments have the same meaning as ``ssl_wrap_socket``. By default, this function does a lot of the same work that ``ssl.create_default_context`` does on Python 3.4+. It: - Disables SSLv2, SSLv3, and...
[ "def", "create_urllib3_context", "(", "ssl_version", "=", "None", ",", "cert_reqs", "=", "None", ",", "options", "=", "None", ",", "ciphers", "=", "None", ")", ":", "context", "=", "SSLContext", "(", "ssl_version", "or", "PROTOCOL_TLS", ")", "context", ".", ...
[ 244, 0 ]
[ 330, 18 ]
python
en
['en', 'en', 'en']
True
ssl_wrap_socket
( sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None, key_password=None, ca_cert_data=None, tls_in_tls=False, )
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`. :param server_hostname: When SNI is supported, the expected hostname of the certificate :param ssl_context: A pre-made :class:`SSLContext` object....
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`.
def ssl_wrap_socket( sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None, key_password=None, ca_cert_data=None, tls_in_tls=False, ): """ All arguments except...
[ "def", "ssl_wrap_socket", "(", "sock", ",", "keyfile", "=", "None", ",", "certfile", "=", "None", ",", "cert_reqs", "=", "None", ",", "ca_certs", "=", "None", ",", "server_hostname", "=", "None", ",", "ssl_version", "=", "None", ",", "ciphers", "=", "Non...
[ 333, 0 ]
[ 432, 19 ]
python
en
['en', 'error', 'th']
False
is_ipaddress
(hostname)
Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise.
Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs.
def is_ipaddress(hostname): """Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise. """ if not six.PY2 and isinstance(hostname, bytes):...
[ "def", "is_ipaddress", "(", "hostname", ")", ":", "if", "not", "six", ".", "PY2", "and", "isinstance", "(", "hostname", ",", "bytes", ")", ":", "# IDN A-label bytes are ASCII compatible.", "hostname", "=", "hostname", ".", "decode", "(", "\"ascii\"", ")", "ret...
[ 435, 0 ]
[ 445, 83 ]
python
en
['en', 'en', 'en']
True
_is_key_file_encrypted
(key_file)
Detects if a key file is encrypted or not.
Detects if a key file is encrypted or not.
def _is_key_file_encrypted(key_file): """Detects if a key file is encrypted or not.""" with open(key_file, "r") as f: for line in f: # Look for Proc-Type: 4,ENCRYPTED if "ENCRYPTED" in line: return True return False
[ "def", "_is_key_file_encrypted", "(", "key_file", ")", ":", "with", "open", "(", "key_file", ",", "\"r\"", ")", "as", "f", ":", "for", "line", "in", "f", ":", "# Look for Proc-Type: 4,ENCRYPTED", "if", "\"ENCRYPTED\"", "in", "line", ":", "return", "True", "r...
[ 448, 0 ]
[ 456, 16 ]
python
en
['en', 'en', 'en']
True
caps_batch_dot
(x, y, axes=None)
TODO: Write Comment
TODO: Write Comment
def caps_batch_dot(x, y, axes=None): """ TODO: Write Comment """ if isinstance(axes, int): axes = (axes, axes) x_ndim = K.ndim(x) y_ndim = K.ndim(y) if axes is None: # behaves like tf.batch_matmul as default axes = [x_ndim - 1, y_ndim - 2] if any([isinstance(a, (...
[ "def", "caps_batch_dot", "(", "x", ",", "y", ",", "axes", "=", "None", ")", ":", "if", "isinstance", "(", "axes", ",", "int", ")", ":", "axes", "=", "(", "axes", ",", "axes", ")", "x_ndim", "=", "K", ".", "ndim", "(", "x", ")", "y_ndim", "=", ...
[ 145, 0 ]
[ 191, 14 ]
python
en
['en', 'error', 'th']
False
margin_loss
(y_true, y_pred)
TODO: Write Comment
TODO: Write Comment
def margin_loss(y_true, y_pred): """ TODO: Write Comment """ # L = y_true * K.square(K.relu(0.9 - y_pred)) + 0.5 * (1 - y_true) * K.square(K.relu( y_pred - 0.1)) L = y_true * tf.square(tf.maximum(0., 0.9 - y_pred)) + 0.5 * (1 - y_true) * tf.square(tf.maximum(0., y_pred - 0.1)) return tf....
[ "def", "margin_loss", "(", "y_true", ",", "y_pred", ")", ":", "# L = y_true * K.square(K.relu(0.9 - y_pred)) + 0.5 * (1 - y_true) * K.square(K.relu( y_pred - 0.1))", "L", "=", "y_true", "*", "tf", ".", "square", "(", "tf", ".", "maximum", "(", "0.", ",", "0.9", ...
[ 194, 0 ]
[ 200, 52 ]
python
en
['en', 'error', 'th']
False
squash
(vectors, axis=-1)
TODO: Write Comment
TODO: Write Comment
def squash(vectors, axis=-1): """ TODO: Write Comment """ s_squared_norm = tf.reduce_sum(tf.square(vectors), axis=axis, keepdims=True) scale = s_squared_norm / (1 + s_squared_norm) / tf.sqrt(s_squared_norm + K.epsilon()) return scale * vectors
[ "def", "squash", "(", "vectors", ",", "axis", "=", "-", "1", ")", ":", "s_squared_norm", "=", "tf", ".", "reduce_sum", "(", "tf", ".", "square", "(", "vectors", ")", ",", "axis", "=", "axis", ",", "keepdims", "=", "True", ")", "scale", "=", "s_squa...
[ 256, 0 ]
[ 263, 26 ]
python
en
['en', 'error', 'th']
False
CapsNet.__init__
(self, args)
TODO: Write Comment
TODO: Write Comment
def __init__(self, args): """ TODO: Write Comment """ from tensorflow.keras import optimizers self.name = 'CapsNet' self.num_routes = 3 CifarModel.__init__(self, args) self.optimizer = optimizers.Adam(lr=0.001)
[ "def", "__init__", "(", "self", ",", "args", ")", ":", "from", "tensorflow", ".", "keras", "import", "optimizers", "self", ".", "name", "=", "'CapsNet'", "self", ".", "num_routes", "=", "3", "CifarModel", ".", "__init__", "(", "self", ",", "args", ")", ...
[ 12, 4 ]
[ 24, 50 ]
python
en
['en', 'error', 'th']
False
CapsNet.network
(self, img_input)
TODO: Write Comment
TODO: Write Comment
def network(self, img_input): """ TODO: Write Comment """ dim_capsule = 8 x = layers.Conv2D(filters=256, kernel_size=8, strides=1, padding='valid', name='conv2d')(img_input) # x = layers.BatchNormalization()(x) x = layers.Activation('relu')(x) ...
[ "def", "network", "(", "self", ",", "img_input", ")", ":", "dim_capsule", "=", "8", "x", "=", "layers", ".", "Conv2D", "(", "filters", "=", "256", ",", "kernel_size", "=", "8", ",", "strides", "=", "1", ",", "padding", "=", "'valid'", ",", "name", ...
[ 27, 4 ]
[ 48, 16 ]
python
en
['en', 'error', 'th']
False
CapsNet.load
(self)
TODO: Write Comment
TODO: Write Comment
def load(self): """ TODO: Write Comment """ if self.args.verbose: print(f"Loading Model...") self._model = self.build_model() try: self._model.load_weights(f"{self.log_filepath}model_weights.h5") except: self.train()
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "args", ".", "verbose", ":", "print", "(", "f\"Loading Model...\"", ")", "self", ".", "_model", "=", "self", ".", "build_model", "(", ")", "try", ":", "self", ".", "_model", ".", "load_weights", ...
[ 50, 4 ]
[ 62, 24 ]
python
en
['en', 'error', 'th']
False
CapsNet.train
(self)
TODO: Write Comment
TODO: Write Comment
def train(self): """ TODO: Write Comment """ self.train_model = self.build_train_model() self.train_model.compile(optimizer= self.optimizer, loss=[margin_loss, 'mse'], loss_weights=[1., 0.1], metrics={'out_recon':'accuracy', 'output':'accuracy'}) history = self....
[ "def", "train", "(", "self", ")", ":", "self", ".", "train_model", "=", "self", ".", "build_train_model", "(", ")", "self", ".", "train_model", ".", "compile", "(", "optimizer", "=", "self", ".", "optimizer", ",", "loss", "=", "[", "margin_loss", ",", ...
[ 67, 4 ]
[ 77, 26 ]
python
en
['en', 'error', 'th']
False
CapsNet.build_train_model
(self)
TODO: Write Comment
TODO: Write Comment
def build_train_model(self): """ TODO: Write Comment """ from tensorflow.keras import models y = layers.Input(shape=(self.num_classes,)) masked = Mask()([self.digitcaps, y]) x_recon = layers.Dense(512)(masked) x_recon = layers.Activation('relu...
[ "def", "build_train_model", "(", "self", ")", ":", "from", "tensorflow", ".", "keras", "import", "models", "y", "=", "layers", ".", "Input", "(", "shape", "=", "(", "self", ".", "num_classes", ",", ")", ")", "masked", "=", "Mask", "(", ")", "(", "[",...
[ 79, 4 ]
[ 96, 82 ]
python
en
['en', 'error', 'th']
False
CapsNet.fit_model
(self, x_train, y_train, x_test, y_test, batch_size, epochs, iterations, cbks, verbose)
TODO: Write Comment
TODO: Write Comment
def fit_model(self, x_train, y_train, x_test, y_test, batch_size, epochs, iterations, cbks, verbose): """ TODO: Write Comment """ from tensorflow.keras.preprocessing.image import ImageDataGenerator epochs = 50 if self.augmentation: datagen = ImageD...
[ "def", "fit_model", "(", "self", ",", "x_train", ",", "y_train", ",", "x_test", ",", "y_test", ",", "batch_size", ",", "epochs", ",", "iterations", ",", "cbks", ",", "verbose", ")", ":", "from", "tensorflow", ".", "keras", ".", "preprocessing", ".", "ima...
[ 98, 4 ]
[ 134, 30 ]
python
en
['en', 'error', 'th']
False
CapsNet.scheduler
(self, epoch)
TODO: Write Comment
TODO: Write Comment
def scheduler(self, epoch): """ TODO: Write Comment """ return 0.001 * np.exp(-epoch / 10.)
[ "def", "scheduler", "(", "self", ",", "epoch", ")", ":", "return", "0.001", "*", "np", ".", "exp", "(", "-", "epoch", "/", "10.", ")" ]
[ 137, 4 ]
[ 142, 43 ]
python
en
['en', 'error', 'th']
False
Length.call
(self, inputs, **kwargs)
TODO: Write Comment
TODO: Write Comment
def call(self, inputs, **kwargs): """ TODO: Write Comment """ # return tf.sqrt(tf.reduce_sum(tf.square(inputs), -1)) return K.sqrt(tf.reduce_sum(K.square(inputs), -1) + K.epsilon())
[ "def", "call", "(", "self", ",", "inputs", ",", "*", "*", "kwargs", ")", ":", "# return tf.sqrt(tf.reduce_sum(tf.square(inputs), -1)) ", "return", "K", ".", "sqrt", "(", "tf", ".", "reduce_sum", "(", "K", ".", "square", "(", "inputs", ")", ",", "-", ...
[ 208, 4 ]
[ 213, 72 ]
python
en
['en', 'error', 'th']
False
Mask.call
(self, inputs, **kwargs)
TODO: Write Comment
TODO: Write Comment
def call(self, inputs, **kwargs): """ TODO: Write Comment """ if type(inputs) is list: assert len(inputs) == 2 inputs, mask = inputs else: # mask = K.one_hot(indices=K.sqrt(tf.reduce_sum(K.square(inputs), -1)), num_classes=self.num_clas...
[ "def", "call", "(", "self", ",", "inputs", ",", "*", "*", "kwargs", ")", ":", "if", "type", "(", "inputs", ")", "is", "list", ":", "assert", "len", "(", "inputs", ")", "==", "2", "inputs", ",", "mask", "=", "inputs", "else", ":", "# mask = K.one_h...
[ 227, 4 ]
[ 244, 21 ]
python
en
['en', 'error', 'th']
False
sanitize_content_filename
(filename)
Sanitize the "filename" value from a Content-Disposition header.
Sanitize the "filename" value from a Content-Disposition header.
def sanitize_content_filename(filename): # type: (str) -> str """ Sanitize the "filename" value from a Content-Disposition header. """ return os.path.basename(filename)
[ "def", "sanitize_content_filename", "(", "filename", ")", ":", "# type: (str) -> str", "return", "os", ".", "path", ".", "basename", "(", "filename", ")" ]
[ 80, 0 ]
[ 85, 37 ]
python
en
['en', 'error', 'th']
False
parse_content_disposition
(content_disposition, default_filename)
Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty.
Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty.
def parse_content_disposition(content_disposition, default_filename): # type: (str, str) -> str """ Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. """ _type, params = cgi.parse_header(content_disposition) filename = param...
[ "def", "parse_content_disposition", "(", "content_disposition", ",", "default_filename", ")", ":", "# type: (str, str) -> str", "_type", ",", "params", "=", "cgi", ".", "parse_header", "(", "content_disposition", ")", "filename", "=", "params", ".", "get", "(", "'fi...
[ 88, 0 ]
[ 100, 39 ]
python
en
['en', 'error', 'th']
False
_get_http_response_filename
(resp, link)
Get an ideal filename from the given HTTP response, falling back to the link filename if not provided.
Get an ideal filename from the given HTTP response, falling back to the link filename if not provided.
def _get_http_response_filename(resp, link): # type: (Response, Link) -> str """Get an ideal filename from the given HTTP response, falling back to the link filename if not provided. """ filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess c...
[ "def", "_get_http_response_filename", "(", "resp", ",", "link", ")", ":", "# type: (Response, Link) -> str", "filename", "=", "link", ".", "filename", "# fallback", "# Have a look at the Content-Disposition header for a better guess", "content_disposition", "=", "resp", ".", ...
[ 103, 0 ]
[ 124, 19 ]
python
en
['en', 'en', 'en']
True
Downloader.__call__
(self, link, location)
Download the file given by link into location.
Download the file given by link into location.
def __call__(self, link, location): # type: (Link, str) -> Tuple[str, str] """Download the file given by link into location.""" try: resp = _http_get_download(self._session, link) except NetworkConnectionError as e: assert e.response is not None logger...
[ "def", "__call__", "(", "self", ",", "link", ",", "location", ")", ":", "# type: (Link, str) -> Tuple[str, str]", "try", ":", "resp", "=", "_http_get_download", "(", "self", ".", "_session", ",", "link", ")", "except", "NetworkConnectionError", "as", "e", ":", ...
[ 145, 4 ]
[ 165, 37 ]
python
en
['en', 'en', 'en']
True
BatchDownloader.__call__
(self, links, location)
Download the files given by links into location.
Download the files given by links into location.
def __call__(self, links, location): # type: (Iterable[Link], str) -> Iterable[Tuple[str, Tuple[str, str]]] """Download the files given by links into location.""" for link in links: try: resp = _http_get_download(self._session, link) except NetworkConnecti...
[ "def", "__call__", "(", "self", ",", "links", ",", "location", ")", ":", "# type: (Iterable[Link], str) -> Iterable[Tuple[str, Tuple[str, str]]]", "for", "link", "in", "links", ":", "try", ":", "resp", "=", "_http_get_download", "(", "self", ".", "_session", ",", ...
[ 179, 4 ]
[ 201, 52 ]
python
en
['en', 'en', 'en']
True
Command.get_input_data
(self, field, message, default=None)
Override this method if you want to customize data inputs or validation exceptions.
Override this method if you want to customize data inputs or validation exceptions.
def get_input_data(self, field, message, default=None): """ Override this method if you want to customize data inputs or validation exceptions. """ raw_value = input(message) if default and raw_value == '': raw_value = default try: val = fi...
[ "def", "get_input_data", "(", "self", ",", "field", ",", "message", ",", "default", "=", "None", ")", ":", "raw_value", "=", "input", "(", "message", ")", "if", "default", "and", "raw_value", "==", "''", ":", "raw_value", "=", "default", "try", ":", "v...
[ 186, 4 ]
[ 200, 18 ]
python
en
['en', 'error', 'th']
False
get_version
(version)
Return a PEP 440-compliant version number from VERSION.
Return a PEP 440-compliant version number from VERSION.
def get_version(version): """Return a PEP 440-compliant version number from VERSION.""" version = get_complete_version(version) # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases # | {a|b|rc}N - for alpha, beta, and rc releases main...
[ "def", "get_version", "(", "version", ")", ":", "version", "=", "get_complete_version", "(", "version", ")", "# Now build the two parts of the version number:", "# main = X.Y[.Z]", "# sub = .devN - for pre-alpha releases", "# | {a|b|rc}N - for alpha, beta, and rc releases", "main...
[ 4, 0 ]
[ 20, 21 ]
python
en
['en', 'en', 'en']
True
get_main_version
(version=None)
Return main version (X.Y[.Z]) from VERSION.
Return main version (X.Y[.Z]) from VERSION.
def get_main_version(version=None): """Return main version (X.Y[.Z]) from VERSION.""" version = get_complete_version(version) parts = 2 if version[2] == 0 else 3 return '.'.join(str(x) for x in version[:parts])
[ "def", "get_main_version", "(", "version", "=", "None", ")", ":", "version", "=", "get_complete_version", "(", "version", ")", "parts", "=", "2", "if", "version", "[", "2", "]", "==", "0", "else", "3", "return", "'.'", ".", "join", "(", "str", "(", "...
[ 23, 0 ]
[ 27, 52 ]
python
en
['en', 'en', 'en']
True
get_complete_version
(version=None)
Return a tuple of the Wagtail version. If version argument is non-empty, check for correctness of the tuple provided.
Return a tuple of the Wagtail version. If version argument is non-empty, check for correctness of the tuple provided.
def get_complete_version(version=None): """ Return a tuple of the Wagtail version. If version argument is non-empty, check for correctness of the tuple provided. """ if version is None: from wagtail import VERSION as version else: assert len(version) == 5 assert version[3...
[ "def", "get_complete_version", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "from", "wagtail", "import", "VERSION", "as", "version", "else", ":", "assert", "len", "(", "version", ")", "==", "5", "assert", "version", "[", "3"...
[ 30, 0 ]
[ 41, 18 ]
python
en
['en', 'error', 'th']
False
get_semver_version
(version)
Returns the semver version (X.Y.Z[-(alpha|beta)]) from VERSION
Returns the semver version (X.Y.Z[-(alpha|beta)]) from VERSION
def get_semver_version(version): "Returns the semver version (X.Y.Z[-(alpha|beta)]) from VERSION" main = '.'.join(str(x) for x in version[:3]) sub = '' if version[3] != 'final': sub = '-{}.{}'.format(*version[3:]) return main + sub
[ "def", "get_semver_version", "(", "version", ")", ":", "main", "=", "'.'", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "version", "[", ":", "3", "]", ")", "sub", "=", "''", "if", "version", "[", "3", "]", "!=", "'final'", ":", "su...
[ 44, 0 ]
[ 51, 21 ]
python
en
['en', 'en', 'en']
True
test_soft_unique_together
(post, project, admin_user)
This tests that SOFT_UNIQUE_TOGETHER restrictions are applied correctly.
This tests that SOFT_UNIQUE_TOGETHER restrictions are applied correctly.
def test_soft_unique_together(post, project, admin_user): """This tests that SOFT_UNIQUE_TOGETHER restrictions are applied correctly.""" jt1 = JobTemplate.objects.create(name='foo_jt', project=project) assert jt1.organization == project.organization r = post( url=reverse('api:job_template_list')...
[ "def", "test_soft_unique_together", "(", "post", ",", "project", ",", "admin_user", ")", ":", "jt1", "=", "JobTemplate", ".", "objects", ".", "create", "(", "name", "=", "'foo_jt'", ",", "project", "=", "project", ")", "assert", "jt1", ".", "organization", ...
[ 27, 0 ]
[ 37, 54 ]
python
en
['en', 'en', 'en']
True
HStoreField.has_changed
(self, initial, data)
Return True if data differs from initial.
Return True if data differs from initial.
def has_changed(self, initial, data): """ Return True if data differs from initial. """ # For purposes of seeing whether something has changed, None is # the same as an empty dict, if the data or initial value we get # is None, replace it w/ {}. initial_value = se...
[ "def", "has_changed", "(", "self", ",", "initial", ",", "data", ")", ":", "# For purposes of seeing whether something has changed, None is", "# the same as an empty dict, if the data or initial value we get", "# is None, replace it w/ {}.", "initial_value", "=", "self", ".", "to_py...
[ 50, 4 ]
[ 58, 72 ]
python
en
['en', 'error', 'th']
False
sample_x_cond
(X, n_x_cond=20, low_percentile = 10, high_percentile=90, random_seed=92)
uniformly samples n_xcond points within the specified percentiles in X Args: X: data on which the percentiles shall be computed - ndarray with shape (n_samples, ndim_x) n_x_cond: number of x_cond points to be sampled low_percentile: lower percentile (int) high_percentile: upper percentile (int) ...
uniformly samples n_xcond points within the specified percentiles in X
def sample_x_cond(X, n_x_cond=20, low_percentile = 10, high_percentile=90, random_seed=92): """ uniformly samples n_xcond points within the specified percentiles in X Args: X: data on which the percentiles shall be computed - ndarray with shape (n_samples, ndim_x) n_x_cond: number of x_cond points to be ...
[ "def", "sample_x_cond", "(", "X", ",", "n_x_cond", "=", "20", ",", "low_percentile", "=", "10", ",", "high_percentile", "=", "90", ",", "random_seed", "=", "92", ")", ":", "assert", "0", "<=", "low_percentile", "<", "high_percentile", "<=", "100", "rand", ...
[ 158, 0 ]
[ 186, 15 ]
python
en
['en', 'error', 'th']
False
GoodnessOfFit.fit_estimator
(self, print_fit_result=True)
Fits the estimator with the provided data Args: print_fit_result: boolean that specifies whether the fitted distribution shall be plotted (only works if ndim_x and ndim_y = 1)
Fits the estimator with the provided data
def fit_estimator(self, print_fit_result=True): #todo set to False """ Fits the estimator with the provided data Args: print_fit_result: boolean that specifies whether the fitted distribution shall be plotted (only works if ndim_x and ndim_y = 1) """ self.time_to_fit = None if not self.e...
[ "def", "fit_estimator", "(", "self", ",", "print_fit_result", "=", "True", ")", ":", "#todo set to False", "self", ".", "time_to_fit", "=", "None", "if", "not", "self", ".", "estimator", ".", "fitted", ":", "# fit estimator if necessary", "t_start", "=", "time",...
[ 60, 2 ]
[ 86, 24 ]
python
en
['en', 'error', 'th']
False