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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_TargetFromSpec | (old_spec, params) | Create fake target for xcode-ninja wrapper. | Create fake target for xcode-ninja wrapper. | def _TargetFromSpec(old_spec, params):
""" Create fake target for xcode-ninja wrapper. """
# Determine ninja top level build dir (e.g. /path/to/out).
ninja_toplevel = None
jobs = 0
if params:
options = params['options']
ninja_toplevel = \
os.path.join(options.toplevel_dir,
... | [
"def",
"_TargetFromSpec",
"(",
"old_spec",
",",
"params",
")",
":",
"# Determine ninja top level build dir (e.g. /path/to/out).",
"ninja_toplevel",
"=",
"None",
"jobs",
"=",
"0",
"if",
"params",
":",
"options",
"=",
"params",
"[",
"'options'",
"]",
"ninja_toplevel",
... | [
55,
0
] | [
123,
21
] | python | en | ['en', 'en', 'en'] | True |
IsValidTargetForWrapper | (target_extras, executable_target_pattern, spec) | Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matching any target.
executable_target_pattern: Regular expression limiting executable ... | Limit targets for Xcode wrapper. | def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):
"""Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matching ... | [
"def",
"IsValidTargetForWrapper",
"(",
"target_extras",
",",
"executable_target_pattern",
",",
"spec",
")",
":",
"target_name",
"=",
"spec",
".",
"get",
"(",
"'target_name'",
")",
"# Always include targets matching target_extras.",
"if",
"target_extras",
"is",
"not",
"N... | [
125,
0
] | [
149,
14
] | python | en | ['en', 'en', 'en'] | True |
CreateWrapper | (target_list, target_dicts, data, params) | Initialize targets for the ninja wrapper.
This sets up the necessary variables in the targets to generate Xcode projects
that use ninja as an external builder.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dict ... | Initialize targets for the ninja wrapper. | def CreateWrapper(target_list, target_dicts, data, params):
"""Initialize targets for the ninja wrapper.
This sets up the necessary variables in the targets to generate Xcode projects
that use ninja as an external builder.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts... | [
"def",
"CreateWrapper",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"orig_gyp",
"=",
"params",
"[",
"'build_files'",
"]",
"[",
"0",
"]",
"for",
"gyp_name",
",",
"gyp_dict",
"in",
"data",
".",
"iteritems",
"(",
")",
":",... | [
151,
0
] | [
269,
54
] | python | en | ['en', 'en', 'en'] | True |
_NormalizedSource | (source) | Normalize the path.
But not if that gets rid of a variable, as this may expand to something
larger than one directory.
Arguments:
source: The path to be normalize.d
Returns:
The normalized path.
| Normalize the path. | def _NormalizedSource(source):
"""Normalize the path.
But not if that gets rid of a variable, as this may expand to something
larger than one directory.
Arguments:
source: The path to be normalize.d
Returns:
The normalized path.
"""
normalized = os.path.normpath(source)
if source.count('$... | [
"def",
"_NormalizedSource",
"(",
"source",
")",
":",
"normalized",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"source",
")",
"if",
"source",
".",
"count",
"(",
"'$'",
")",
"==",
"normalized",
".",
"count",
"(",
"'$'",
")",
":",
"source",
"=",
"nor... | [
138,
0
] | [
153,
15
] | python | en | ['en', 'en', 'en'] | True |
_FixPath | (path) | Convert paths to a form that will make sense in a vcproj file.
Arguments:
path: The path to convert, may contain / etc.
Returns:
The path with all slashes made into backslashes.
| Convert paths to a form that will make sense in a vcproj file. | def _FixPath(path):
"""Convert paths to a form that will make sense in a vcproj file.
Arguments:
path: The path to convert, may contain / etc.
Returns:
The path with all slashes made into backslashes.
"""
if fixpath_prefix and path and not os.path.isabs(path) and not path[0] == '$':
path = os.pat... | [
"def",
"_FixPath",
"(",
"path",
")",
":",
"if",
"fixpath_prefix",
"and",
"path",
"and",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
"and",
"not",
"path",
"[",
"0",
"]",
"==",
"'$'",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
... | [
156,
0
] | [
170,
13
] | python | en | ['en', 'en', 'en'] | True |
_FixPaths | (paths) | Fix each of the paths of the list. | Fix each of the paths of the list. | def _FixPaths(paths):
"""Fix each of the paths of the list."""
return [_FixPath(i) for i in paths] | [
"def",
"_FixPaths",
"(",
"paths",
")",
":",
"return",
"[",
"_FixPath",
"(",
"i",
")",
"for",
"i",
"in",
"paths",
"]"
] | [
173,
0
] | [
175,
37
] | python | en | ['en', 'en', 'en'] | True |
_ConvertSourcesToFilterHierarchy | (sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None) | Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source file path layers meant to apply to each of sources.
excluded: A set of excluded files.
msvs_version: A MSVSVersion object.
Returns:
A hierarch... | Converts a list split source file paths into a vcproj folder hierarchy. | def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None):
"""Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source f... | [
"def",
"_ConvertSourcesToFilterHierarchy",
"(",
"sources",
",",
"prefix",
"=",
"None",
",",
"excluded",
"=",
"None",
",",
"list_excluded",
"=",
"True",
",",
"msvs_version",
"=",
"None",
")",
":",
"if",
"not",
"prefix",
":",
"prefix",
"=",
"[",
"]",
"result... | [
178,
0
] | [
240,
15
] | python | en | ['en', 'fr', 'en'] | True |
_AddActionStep | (actions_dict, inputs, outputs, description, command) | Merge action into an existing list of actions.
Care must be taken so that actions which have overlapping inputs either don't
get assigned to the same input, or get collapsed into one.
Arguments:
actions_dict: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached... | Merge action into an existing list of actions. | def _AddActionStep(actions_dict, inputs, outputs, description, command):
"""Merge action into an existing list of actions.
Care must be taken so that actions which have overlapping inputs either don't
get assigned to the same input, or get collapsed into one.
Arguments:
actions_dict: dictionary keyed on i... | [
"def",
"_AddActionStep",
"(",
"actions_dict",
",",
"inputs",
",",
"outputs",
",",
"description",
",",
"command",
")",
":",
"# Require there to be at least one input (call sites will ensure this).",
"assert",
"inputs",
"action",
"=",
"{",
"'inputs'",
":",
"inputs",
",",
... | [
393,
0
] | [
425,
43
] | python | en | ['en', 'en', 'en'] | True |
_AddCustomBuildToolForMSVS | (p, spec, primary_input,
inputs, outputs, description, cmd) | Add a custom build tool to execute something.
Arguments:
p: the target project
spec: the target project dict
primary_input: input file to attach the build tool to
inputs: list of inputs
outputs: list of outputs
description: description of the action
cmd: command line to execute
| Add a custom build tool to execute something. | def _AddCustomBuildToolForMSVS(p, spec, primary_input,
inputs, outputs, description, cmd):
"""Add a custom build tool to execute something.
Arguments:
p: the target project
spec: the target project dict
primary_input: input file to attach the build tool to
inputs: lis... | [
"def",
"_AddCustomBuildToolForMSVS",
"(",
"p",
",",
"spec",
",",
"primary_input",
",",
"inputs",
",",
"outputs",
",",
"description",
",",
"cmd",
")",
":",
"inputs",
"=",
"_FixPaths",
"(",
"inputs",
")",
"outputs",
"=",
"_FixPaths",
"(",
"outputs",
")",
"to... | [
428,
0
] | [
453,
71
] | python | en | ['en', 'en', 'en'] | True |
_AddAccumulatedActionsToMSVS | (p, spec, actions_dict) | Add actions accumulated into an actions_dict, merging as needed.
Arguments:
p: the target project
spec: the target project dict
actions_dict: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file.
| Add actions accumulated into an actions_dict, merging as needed. | def _AddAccumulatedActionsToMSVS(p, spec, actions_dict):
"""Add actions accumulated into an actions_dict, merging as needed.
Arguments:
p: the target project
spec: the target project dict
actions_dict: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached... | [
"def",
"_AddAccumulatedActionsToMSVS",
"(",
"p",
",",
"spec",
",",
"actions_dict",
")",
":",
"for",
"primary_input",
"in",
"actions_dict",
":",
"inputs",
"=",
"OrderedSet",
"(",
")",
"outputs",
"=",
"OrderedSet",
"(",
")",
"descriptions",
"=",
"[",
"]",
"com... | [
456,
0
] | [
483,
43
] | python | en | ['en', 'en', 'en'] | True |
_RuleExpandPath | (path, input_file) | Given the input file to which a rule applied, string substitute a path.
Arguments:
path: a path to string expand
input_file: the file to which the rule applied.
Returns:
The string substituted path.
| Given the input file to which a rule applied, string substitute a path. | def _RuleExpandPath(path, input_file):
"""Given the input file to which a rule applied, string substitute a path.
Arguments:
path: a path to string expand
input_file: the file to which the rule applied.
Returns:
The string substituted path.
"""
path = path.replace('$(InputName)',
... | [
"def",
"_RuleExpandPath",
"(",
"path",
",",
"input_file",
")",
":",
"path",
"=",
"path",
".",
"replace",
"(",
"'$(InputName)'",
",",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"split",
"(",
"input_file",
")",
"[",
"1",
"]",
")",... | [
486,
0
] | [
502,
13
] | python | en | ['en', 'en', 'en'] | True |
_FindRuleTriggerFiles | (rule, sources) | Find the list of files which a particular rule applies to.
Arguments:
rule: the rule in question
sources: the set of all known source files for this project
Returns:
The list of sources that trigger a particular rule.
| Find the list of files which a particular rule applies to. | def _FindRuleTriggerFiles(rule, sources):
"""Find the list of files which a particular rule applies to.
Arguments:
rule: the rule in question
sources: the set of all known source files for this project
Returns:
The list of sources that trigger a particular rule.
"""
return rule.get('rule_sources'... | [
"def",
"_FindRuleTriggerFiles",
"(",
"rule",
",",
"sources",
")",
":",
"return",
"rule",
".",
"get",
"(",
"'rule_sources'",
",",
"[",
"]",
")"
] | [
505,
0
] | [
514,
37
] | python | en | ['en', 'en', 'en'] | True |
_RuleInputsAndOutputs | (rule, trigger_file) | Find the inputs and outputs generated by a rule.
Arguments:
rule: the rule in question.
trigger_file: the main trigger for this rule.
Returns:
The pair of (inputs, outputs) involved in this rule.
| Find the inputs and outputs generated by a rule. | def _RuleInputsAndOutputs(rule, trigger_file):
"""Find the inputs and outputs generated by a rule.
Arguments:
rule: the rule in question.
trigger_file: the main trigger for this rule.
Returns:
The pair of (inputs, outputs) involved in this rule.
"""
raw_inputs = _FixPaths(rule.get('inputs', []))
... | [
"def",
"_RuleInputsAndOutputs",
"(",
"rule",
",",
"trigger_file",
")",
":",
"raw_inputs",
"=",
"_FixPaths",
"(",
"rule",
".",
"get",
"(",
"'inputs'",
",",
"[",
"]",
")",
")",
"raw_outputs",
"=",
"_FixPaths",
"(",
"rule",
".",
"get",
"(",
"'outputs'",
","... | [
517,
0
] | [
535,
26
] | python | en | ['en', 'en', 'en'] | True |
_GenerateNativeRulesForMSVS | (p, rules, output_dir, spec, options) | Generate a native rules file.
Arguments:
p: the target project
rules: the set of rules to include
output_dir: the directory in which the project/gyp resides
spec: the project dict
options: global generator options
| Generate a native rules file. | def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options):
"""Generate a native rules file.
Arguments:
p: the target project
rules: the set of rules to include
output_dir: the directory in which the project/gyp resides
spec: the project dict
options: global generator options
"""
... | [
"def",
"_GenerateNativeRulesForMSVS",
"(",
"p",
",",
"rules",
",",
"output_dir",
",",
"spec",
",",
"options",
")",
":",
"rules_filename",
"=",
"'%s%s.rules'",
"%",
"(",
"spec",
"[",
"'target_name'",
"]",
",",
"options",
".",
"suffix",
")",
"rules_file",
"=",... | [
538,
0
] | [
573,
31
] | python | en | ['en', 'co', 'en'] | True |
_GenerateExternalRules | (rules, output_dir, spec,
sources, options, actions_to_add) | Generate an external makefile to do a set of rules.
Arguments:
rules: the list of rules to include
output_dir: path containing project and gyp files
spec: project specification data
sources: set of sources known
options: global generator options
actions_to_add: The list of actions we will add... | Generate an external makefile to do a set of rules. | def _GenerateExternalRules(rules, output_dir, spec,
sources, options, actions_to_add):
"""Generate an external makefile to do a set of rules.
Arguments:
rules: the list of rules to include
output_dir: path containing project and gyp files
spec: project specification data
... | [
"def",
"_GenerateExternalRules",
"(",
"rules",
",",
"output_dir",
",",
"spec",
",",
"sources",
",",
"options",
",",
"actions_to_add",
")",
":",
"filename",
"=",
"'%s_rules%s.mk'",
"%",
"(",
"spec",
"[",
"'target_name'",
"]",
",",
"options",
".",
"suffix",
")... | [
582,
0
] | [
660,
29
] | python | en | ['en', 'en', 'en'] | True |
_EscapeEnvironmentVariableExpansion | (s) | Escapes % characters.
Escapes any % characters so that Windows-style environment variable
expansions will leave them alone.
See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
to understand why we have to do this.
Args:
s... | Escapes % characters. | def _EscapeEnvironmentVariableExpansion(s):
"""Escapes % characters.
Escapes any % characters so that Windows-style environment variable
expansions will leave them alone.
See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
to un... | [
"def",
"_EscapeEnvironmentVariableExpansion",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"'%'",
",",
"'%%'",
")",
"return",
"s"
] | [
663,
0
] | [
678,
10
] | python | en | ['es', 'en', 'en'] | True |
_EscapeCommandLineArgumentForMSVS | (s) | Escapes a Windows command-line argument.
So that the Win32 CommandLineToArgv function will turn the escaped result back
into the original string.
See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
("Parsing C++ Command-Line Arguments") to understand why we have to do
this.
Args:
s: the string... | Escapes a Windows command-line argument. | def _EscapeCommandLineArgumentForMSVS(s):
"""Escapes a Windows command-line argument.
So that the Win32 CommandLineToArgv function will turn the escaped result back
into the original string.
See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
("Parsing C++ Command-Line Arguments") to understand why we ... | [
"def",
"_EscapeCommandLineArgumentForMSVS",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"# For a literal quote, CommandLineToArgv requires an odd number of",
"# backslashes preceding it, and it produces half as many literal backslashes",
"# (rounded down). So we need t... | [
684,
0
] | [
709,
10
] | python | en | ['en', 'fr', 'en'] | True |
_EscapeVCProjCommandLineArgListItem | (s) | Escapes command line arguments for MSVS.
The VCProj format stores string lists in a single string using commas and
semi-colons as separators, which must be quoted if they are to be
interpreted literally. However, command-line arguments may already have
quotes, and the VCProj parser is ignorant of the backslash... | Escapes command line arguments for MSVS. | def _EscapeVCProjCommandLineArgListItem(s):
"""Escapes command line arguments for MSVS.
The VCProj format stores string lists in a single string using commas and
semi-colons as separators, which must be quoted if they are to be
interpreted literally. However, command-line arguments may already have
quotes, a... | [
"def",
"_EscapeVCProjCommandLineArgListItem",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"# For a non-literal quote, CommandLineToArgv requires an even number of",
"# backslashes preceding it, and it produces half as many literal",
"# backslashes. So we need to produc... | [
715,
0
] | [
759,
10
] | python | en | ['en', 'fr', 'en'] | True |
_EscapeCppDefineForMSVS | (s) | Escapes a CPP define so that it will reach the compiler unaltered. | Escapes a CPP define so that it will reach the compiler unaltered. | def _EscapeCppDefineForMSVS(s):
"""Escapes a CPP define so that it will reach the compiler unaltered."""
s = _EscapeEnvironmentVariableExpansion(s)
s = _EscapeCommandLineArgumentForMSVS(s)
s = _EscapeVCProjCommandLineArgListItem(s)
# cl.exe replaces literal # characters with = in preprocesor definitions for
... | [
"def",
"_EscapeCppDefineForMSVS",
"(",
"s",
")",
":",
"s",
"=",
"_EscapeEnvironmentVariableExpansion",
"(",
"s",
")",
"s",
"=",
"_EscapeCommandLineArgumentForMSVS",
"(",
"s",
")",
"s",
"=",
"_EscapeVCProjCommandLineArgListItem",
"(",
"s",
")",
"# cl.exe replaces liter... | [
762,
0
] | [
770,
10
] | python | en | ['en', 'en', 'en'] | True |
_EscapeCommandLineArgumentForMSBuild | (s) | Escapes a Windows command-line argument for use by MSBuild. | Escapes a Windows command-line argument for use by MSBuild. | def _EscapeCommandLineArgumentForMSBuild(s):
"""Escapes a Windows command-line argument for use by MSBuild."""
def _Replace(match):
return (len(match.group(1)) / 2 * 4) * '\\' + '\\"'
# Escape all quotes so that they are interpreted literally.
s = quote_replacer_regex2.sub(_Replace, s)
return s | [
"def",
"_EscapeCommandLineArgumentForMSBuild",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"return",
"(",
"len",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
"/",
"2",
"*",
"4",
")",
"*",
"'\\\\'",
"+",
"'\\\\\"'",
"# Escape all q... | [
776,
0
] | [
784,
10
] | python | en | ['en', 'en', 'en'] | True |
_EscapeCppDefineForMSBuild | (s) | Escapes a CPP define so that it will reach the compiler unaltered. | Escapes a CPP define so that it will reach the compiler unaltered. | def _EscapeCppDefineForMSBuild(s):
"""Escapes a CPP define so that it will reach the compiler unaltered."""
s = _EscapeEnvironmentVariableExpansion(s)
s = _EscapeCommandLineArgumentForMSBuild(s)
s = _EscapeMSBuildSpecialCharacters(s)
# cl.exe replaces literal # characters with = in preprocesor definitions for... | [
"def",
"_EscapeCppDefineForMSBuild",
"(",
"s",
")",
":",
"s",
"=",
"_EscapeEnvironmentVariableExpansion",
"(",
"s",
")",
"s",
"=",
"_EscapeCommandLineArgumentForMSBuild",
"(",
"s",
")",
"s",
"=",
"_EscapeMSBuildSpecialCharacters",
"(",
"s",
")",
"# cl.exe replaces lit... | [
801,
0
] | [
809,
10
] | python | en | ['en', 'en', 'en'] | True |
_GenerateRulesForMSVS | (p, output_dir, options, spec,
sources, excluded_sources,
actions_to_add) | Generate all the rules for a particular project.
Arguments:
p: the project
output_dir: directory to emit rules to
options: global options passed to the generator
spec: the specification for this project
sources: the set of all known source files in this project
excluded_sources: the set of so... | Generate all the rules for a particular project. | def _GenerateRulesForMSVS(p, output_dir, options, spec,
sources, excluded_sources,
actions_to_add):
"""Generate all the rules for a particular project.
Arguments:
p: the project
output_dir: directory to emit rules to
options: global options passed to ... | [
"def",
"_GenerateRulesForMSVS",
"(",
"p",
",",
"output_dir",
",",
"options",
",",
"spec",
",",
"sources",
",",
"excluded_sources",
",",
"actions_to_add",
")",
":",
"rules",
"=",
"spec",
".",
"get",
"(",
"'rules'",
",",
"[",
"]",
")",
"rules_native",
"=",
... | [
812,
0
] | [
838,
65
] | python | en | ['en', 'en', 'en'] | True |
_FilterActionsFromExcluded | (excluded_sources, actions_to_add) | Take inputs with actions attached out of the list of exclusions.
Arguments:
excluded_sources: list of source files not to be built.
actions_to_add: dict of actions keyed on source file they're attached to.
Returns:
excluded_sources with files that have actions attached removed.
| Take inputs with actions attached out of the list of exclusions. | def _FilterActionsFromExcluded(excluded_sources, actions_to_add):
"""Take inputs with actions attached out of the list of exclusions.
Arguments:
excluded_sources: list of source files not to be built.
actions_to_add: dict of actions keyed on source file they're attached to.
Returns:
excluded_sources ... | [
"def",
"_FilterActionsFromExcluded",
"(",
"excluded_sources",
",",
"actions_to_add",
")",
":",
"must_keep",
"=",
"OrderedSet",
"(",
"_FixPaths",
"(",
"actions_to_add",
".",
"keys",
"(",
")",
")",
")",
"return",
"[",
"s",
"for",
"s",
"in",
"excluded_sources",
"... | [
863,
0
] | [
873,
60
] | python | en | ['en', 'en', 'en'] | True |
_GetGuidOfProject | (proj_path, spec) | Get the guid for the project.
Arguments:
proj_path: Path of the vcproj or vcxproj file to generate.
spec: The target dictionary containing the properties of the target.
Returns:
the guid.
Raises:
ValueError: if the specified GUID is invalid.
| Get the guid for the project. | def _GetGuidOfProject(proj_path, spec):
"""Get the guid for the project.
Arguments:
proj_path: Path of the vcproj or vcxproj file to generate.
spec: The target dictionary containing the properties of the target.
Returns:
the guid.
Raises:
ValueError: if the specified GUID is invalid.
"""
# ... | [
"def",
"_GetGuidOfProject",
"(",
"proj_path",
",",
"spec",
")",
":",
"# Pluck out the default configuration.",
"default_config",
"=",
"_GetDefaultConfiguration",
"(",
"spec",
")",
"# Decide the guid of the project.",
"guid",
"=",
"default_config",
".",
"get",
"(",
"'msvs_... | [
880,
0
] | [
901,
13
] | python | en | ['en', 'en', 'en'] | True |
_GetMsbuildToolsetOfProject | (proj_path, spec, version) | Get the platform toolset for the project.
Arguments:
proj_path: Path of the vcproj or vcxproj file to generate.
spec: The target dictionary containing the properties of the target.
version: The MSVSVersion object.
Returns:
the platform toolset string or None.
| Get the platform toolset for the project. | def _GetMsbuildToolsetOfProject(proj_path, spec, version):
"""Get the platform toolset for the project.
Arguments:
proj_path: Path of the vcproj or vcxproj file to generate.
spec: The target dictionary containing the properties of the target.
version: The MSVSVersion object.
Returns:
the platform... | [
"def",
"_GetMsbuildToolsetOfProject",
"(",
"proj_path",
",",
"spec",
",",
"version",
")",
":",
"# Pluck out the default configuration.",
"default_config",
"=",
"_GetDefaultConfiguration",
"(",
"spec",
")",
"toolset",
"=",
"default_config",
".",
"get",
"(",
"'msbuild_too... | [
904,
0
] | [
919,
16
] | python | en | ['en', 'en', 'en'] | True |
_GenerateProject | (project, options, version, generator_flags) | Generates a vcproj file.
Arguments:
project: the MSVSProject object.
options: global generator options.
version: the MSVSVersion object.
generator_flags: dict of generator-specific flags.
Returns:
A list of source files that cannot be found on disk.
| Generates a vcproj file. | def _GenerateProject(project, options, version, generator_flags):
"""Generates a vcproj file.
Arguments:
project: the MSVSProject object.
options: global generator options.
version: the MSVSVersion object.
generator_flags: dict of generator-specific flags.
Returns:
A list of source files that... | [
"def",
"_GenerateProject",
"(",
"project",
",",
"options",
",",
"version",
",",
"generator_flags",
")",
":",
"default_config",
"=",
"_GetDefaultConfiguration",
"(",
"project",
".",
"spec",
")",
"# Skip emitting anything if told to with msvs_existing_vcproj option.",
"if",
... | [
922,
0
] | [
942,
75
] | python | en | ['en', 'it', 'pt'] | False |
_ValidateSourcesForMSVSProject | (spec, version) | Makes sure if duplicate basenames are not specified in the source list.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The VisualStudioVersion object.
| Makes sure if duplicate basenames are not specified in the source list. | def _ValidateSourcesForMSVSProject(spec, version):
"""Makes sure if duplicate basenames are not specified in the source list.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The VisualStudioVersion object.
"""
# This validation should not be applied to MSVC2010 ... | [
"def",
"_ValidateSourcesForMSVSProject",
"(",
"spec",
",",
"version",
")",
":",
"# This validation should not be applied to MSVC2010 and later.",
"assert",
"not",
"version",
".",
"UsesVcxproj",
"(",
")",
"# TODO: Check if MSVC allows this for loadable_module targets.",
"if",
"spe... | [
946,
0
] | [
978,
76
] | python | en | ['en', 'en', 'en'] | True |
_GenerateMSVSProject | (project, options, version, generator_flags) | Generates a .vcproj file. It may create .rules and .user files too.
Arguments:
project: The project object we will generate the file for.
options: Global options passed to the generator.
version: The VisualStudioVersion object.
generator_flags: dict of generator-specific flags.
| Generates a .vcproj file. It may create .rules and .user files too. | def _GenerateMSVSProject(project, options, version, generator_flags):
"""Generates a .vcproj file. It may create .rules and .user files too.
Arguments:
project: The project object we will generate the file for.
options: Global options passed to the generator.
version: The VisualStudioVersion object.
... | [
"def",
"_GenerateMSVSProject",
"(",
"project",
",",
"options",
",",
"version",
",",
"generator_flags",
")",
":",
"spec",
"=",
"project",
".",
"spec",
"gyp",
".",
"common",
".",
"EnsureDirExists",
"(",
"project",
".",
"path",
")",
"platforms",
"=",
"_GetUniqu... | [
981,
0
] | [
1048,
24
] | python | en | ['en', 'en', 'en'] | True |
_GetUniquePlatforms | (spec) | Returns the list of unique platforms for this spec, e.g ['win32', ...].
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The MSVSUserFile object created.
| Returns the list of unique platforms for this spec, e.g ['win32', ...]. | def _GetUniquePlatforms(spec):
"""Returns the list of unique platforms for this spec, e.g ['win32', ...].
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The MSVSUserFile object created.
"""
# Gather list of unique platforms.
platforms = OrderedSet()
for c... | [
"def",
"_GetUniquePlatforms",
"(",
"spec",
")",
":",
"# Gather list of unique platforms.",
"platforms",
"=",
"OrderedSet",
"(",
")",
"for",
"configuration",
"in",
"spec",
"[",
"'configurations'",
"]",
":",
"platforms",
".",
"add",
"(",
"_ConfigPlatform",
"(",
"spe... | [
1051,
0
] | [
1064,
18
] | python | en | ['en', 'en', 'en'] | True |
_CreateMSVSUserFile | (proj_path, version, spec) | Generates a .user file for the user running this Gyp program.
Arguments:
proj_path: The path of the project file being created. The .user file
shares the same path (with an appropriate suffix).
version: The VisualStudioVersion object.
spec: The target dictionary containing the properties ... | Generates a .user file for the user running this Gyp program. | def _CreateMSVSUserFile(proj_path, version, spec):
"""Generates a .user file for the user running this Gyp program.
Arguments:
proj_path: The path of the project file being created. The .user file
shares the same path (with an appropriate suffix).
version: The VisualStudioVersion object.
... | [
"def",
"_CreateMSVSUserFile",
"(",
"proj_path",
",",
"version",
",",
"spec",
")",
":",
"(",
"domain",
",",
"username",
")",
"=",
"_GetDomainAndUserName",
"(",
")",
"vcuser_filename",
"=",
"'.'",
".",
"join",
"(",
"[",
"proj_path",
",",
"domain",
",",
"user... | [
1067,
0
] | [
1082,
18
] | python | en | ['en', 'en', 'en'] | True |
_GetMSVSConfigurationType | (spec, build_file) | Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integer, the configuration type.
| Returns the configuration type for this project. | def _GetMSVSConfigurationType(spec, build_file):
"""Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integ... | [
"def",
"_GetMSVSConfigurationType",
"(",
"spec",
",",
"build_file",
")",
":",
"try",
":",
"config_type",
"=",
"{",
"'executable'",
":",
"'1'",
",",
"# .exe",
"'shared_library'",
":",
"'2'",
",",
"# .dll",
"'loadable_module'",
":",
"'2'",
",",
"# .dll",
"'stati... | [
1085,
0
] | [
1112,
20
] | python | en | ['en', 'en', 'en'] | True |
_AddConfigurationToMSVSProject | (p, spec, config_type, config_name, config) | Adds a configuration to the MSVS project.
Many settings in a vcproj file are specific to a configuration. This
function the main part of the vcproj file that's configuration specific.
Arguments:
p: The target project being generated.
spec: The target dictionary containing the properties of the target.
... | Adds a configuration to the MSVS project. | def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
"""Adds a configuration to the MSVS project.
Many settings in a vcproj file are specific to a configuration. This
function the main part of the vcproj file that's configuration specific.
Arguments:
p: The target project being ... | [
"def",
"_AddConfigurationToMSVSProject",
"(",
"p",
",",
"spec",
",",
"config_type",
",",
"config_name",
",",
"config",
")",
":",
"# Get the information for this configuration",
"include_dirs",
",",
"midl_include_dirs",
",",
"resource_include_dirs",
"=",
"_GetIncludeDirs",
... | [
1115,
0
] | [
1199,
75
] | python | en | ['en', 'en', 'en'] | True |
_GetIncludeDirs | (config) | Returns the list of directories to be used for #include directives.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths.
| Returns the list of directories to be used for #include directives. | def _GetIncludeDirs(config):
"""Returns the list of directories to be used for #include directives.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths.
"""
# TODO(bradnelson): include_dirs should re... | [
"def",
"_GetIncludeDirs",
"(",
"config",
")",
":",
"# TODO(bradnelson): include_dirs should really be flexible enough not to",
"# require this sort of thing.",
"include_dirs",
"=",
"(",
"config",
".",
"get",
"(",
"'include_dirs'",
",",
"[",
"]",
")",
"+",
... | [
1202,
0
] | [
1223,
63
] | python | en | ['en', 'en', 'en'] | True |
_GetLibraryDirs | (config) | Returns the list of directories to be used for library search paths.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths.
| Returns the list of directories to be used for library search paths. | def _GetLibraryDirs(config):
"""Returns the list of directories to be used for library search paths.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths.
"""
library_dirs = config.get('library_dirs'... | [
"def",
"_GetLibraryDirs",
"(",
"config",
")",
":",
"library_dirs",
"=",
"config",
".",
"get",
"(",
"'library_dirs'",
",",
"[",
"]",
")",
"library_dirs",
"=",
"_FixPaths",
"(",
"library_dirs",
")",
"return",
"library_dirs"
] | [
1226,
0
] | [
1238,
21
] | python | en | ['en', 'en', 'en'] | True |
_GetLibraries | (spec) | Returns the list of libraries for this configuration.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The list of directory paths.
| Returns the list of libraries for this configuration. | def _GetLibraries(spec):
"""Returns the list of libraries for this configuration.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The list of directory paths.
"""
libraries = spec.get('libraries', [])
# Strip out -l, as it is not used on windows (but is need... | [
"def",
"_GetLibraries",
"(",
"spec",
")",
":",
"libraries",
"=",
"spec",
".",
"get",
"(",
"'libraries'",
",",
"[",
"]",
")",
"# Strip out -l, as it is not used on windows (but is needed so we can pass",
"# in libraries that are assumed to be in the default library path).",
"# A... | [
1241,
0
] | [
1264,
30
] | python | en | ['en', 'en', 'en'] | True |
_GetOutputFilePathAndTool | (spec, msbuild) | Returns the path and tool to use for this target.
Figures out the path of the file this spec will create and the name of
the VC tool that will create it.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
A triple of (file path, name of the vc tool, name of the ms... | Returns the path and tool to use for this target. | def _GetOutputFilePathAndTool(spec, msbuild):
"""Returns the path and tool to use for this target.
Figures out the path of the file this spec will create and the name of
the VC tool that will create it.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
A triple... | [
"def",
"_GetOutputFilePathAndTool",
"(",
"spec",
",",
"msbuild",
")",
":",
"# Select a name for the output file.",
"out_file",
"=",
"''",
"vc_tool",
"=",
"''",
"msbuild_tool",
"=",
"''",
"output_file_map",
"=",
"{",
"'executable'",
":",
"(",
"'VCLinkerTool'",
",",
... | [
1267,
0
] | [
1302,
40
] | python | en | ['en', 'en', 'en'] | True |
_GetOutputTargetExt | (spec) | Returns the extension for this target, including the dot
If product_extension is specified, set target_extension to this to avoid
MSB8012, returns None otherwise. Ignores any target_extension settings in
the input files.
Arguments:
spec: The target dictionary containing the properties of the target.
Ret... | Returns the extension for this target, including the dot | def _GetOutputTargetExt(spec):
"""Returns the extension for this target, including the dot
If product_extension is specified, set target_extension to this to avoid
MSB8012, returns None otherwise. Ignores any target_extension settings in
the input files.
Arguments:
spec: The target dictionary containing... | [
"def",
"_GetOutputTargetExt",
"(",
"spec",
")",
":",
"target_extension",
"=",
"spec",
".",
"get",
"(",
"'product_extension'",
")",
"if",
"target_extension",
":",
"return",
"'.'",
"+",
"target_extension",
"return",
"None"
] | [
1305,
0
] | [
1320,
13
] | python | en | ['en', 'en', 'en'] | True |
_GetDefines | (config) | Returns the list of preprocessor definitions for this configuation.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of preprocessor definitions.
| Returns the list of preprocessor definitions for this configuation. | def _GetDefines(config):
"""Returns the list of preprocessor definitions for this configuation.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of preprocessor definitions.
"""
defines = []
for d in config.get('d... | [
"def",
"_GetDefines",
"(",
"config",
")",
":",
"defines",
"=",
"[",
"]",
"for",
"d",
"in",
"config",
".",
"get",
"(",
"'defines'",
",",
"[",
"]",
")",
":",
"if",
"type",
"(",
"d",
")",
"==",
"list",
":",
"fd",
"=",
"'='",
".",
"join",
"(",
"[... | [
1323,
0
] | [
1339,
16
] | python | en | ['en', 'en', 'en'] | True |
_ConvertToolsToExpectedForm | (tools) | Convert tools to a form expected by Visual Studio.
Arguments:
tools: A dictionary of settings; the tool name is the key.
Returns:
A list of Tool objects.
| Convert tools to a form expected by Visual Studio. | def _ConvertToolsToExpectedForm(tools):
"""Convert tools to a form expected by Visual Studio.
Arguments:
tools: A dictionary of settings; the tool name is the key.
Returns:
A list of Tool objects.
"""
tool_list = []
for tool, settings in tools.iteritems():
# Collapse settings with lists.
se... | [
"def",
"_ConvertToolsToExpectedForm",
"(",
"tools",
")",
":",
"tool_list",
"=",
"[",
"]",
"for",
"tool",
",",
"settings",
"in",
"tools",
".",
"iteritems",
"(",
")",
":",
"# Collapse settings with lists.",
"settings_fixed",
"=",
"{",
"}",
"for",
"setting",
",",... | [
1360,
0
] | [
1384,
18
] | python | en | ['en', 'en', 'en'] | True |
_AddConfigurationToMSVS | (p, spec, tools, config, config_type, config_name) | Add to the project file the configuration specified by config.
Arguments:
p: The target project being generated.
spec: the target project dict.
tools: A dictionary of settings; the tool name is the key.
config: The dictionary that defines the special processing to be done
for this configu... | Add to the project file the configuration specified by config. | def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name):
"""Add to the project file the configuration specified by config.
Arguments:
p: The target project being generated.
spec: the target project dict.
tools: A dictionary of settings; the tool name is the key.
config: The di... | [
"def",
"_AddConfigurationToMSVS",
"(",
"p",
",",
"spec",
",",
"tools",
",",
"config",
",",
"config_type",
",",
"config_name",
")",
":",
"attributes",
"=",
"_GetMSVSAttributes",
"(",
"spec",
",",
"config",
",",
"config_type",
")",
"# Add in this configuration.",
... | [
1387,
0
] | [
1403,
48
] | python | en | ['en', 'en', 'en'] | True |
_PrepareListOfSources | (spec, generator_flags, gyp_file) | Prepare list of sources and excluded sources.
Besides the sources specified directly in the spec, adds the gyp file so
that a change to it will cause a re-compile. Also adds appropriate sources
for actions and copies. Assumes later stage will un-exclude files which
have custom build steps attached.
Argument... | Prepare list of sources and excluded sources. | def _PrepareListOfSources(spec, generator_flags, gyp_file):
"""Prepare list of sources and excluded sources.
Besides the sources specified directly in the spec, adds the gyp file so
that a change to it will cause a re-compile. Also adds appropriate sources
for actions and copies. Assumes later stage will un-ex... | [
"def",
"_PrepareListOfSources",
"(",
"spec",
",",
"generator_flags",
",",
"gyp_file",
")",
":",
"sources",
"=",
"OrderedSet",
"(",
")",
"_AddNormalizedSources",
"(",
"sources",
",",
"spec",
".",
"get",
"(",
"'sources'",
",",
"[",
"]",
")",
")",
"excluded_sou... | [
1436,
0
] | [
1472,
36
] | python | en | ['en', 'en', 'en'] | True |
_AdjustSourcesAndConvertToFilterHierarchy | (
spec, options, gyp_dir, sources, excluded_sources, list_excluded, version) | Adjusts the list of sources and excluded sources.
Also converts the sets to lists.
Arguments:
spec: The target dictionary containing the properties of the target.
options: Global generator options.
gyp_dir: The path to the gyp file being processed.
sources: A set of sources to be included for this... | Adjusts the list of sources and excluded sources. | def _AdjustSourcesAndConvertToFilterHierarchy(
spec, options, gyp_dir, sources, excluded_sources, list_excluded, version):
"""Adjusts the list of sources and excluded sources.
Also converts the sets to lists.
Arguments:
spec: The target dictionary containing the properties of the target.
options: Gl... | [
"def",
"_AdjustSourcesAndConvertToFilterHierarchy",
"(",
"spec",
",",
"options",
",",
"gyp_dir",
",",
"sources",
",",
"excluded_sources",
",",
"list_excluded",
",",
"version",
")",
":",
"# Exclude excluded sources coming into the generator.",
"excluded_sources",
".",
"updat... | [
1475,
0
] | [
1526,
48
] | python | en | ['en', 'en', 'en'] | True |
_CreateProjectObjects | (target_list, target_dicts, options, msvs_version) | Create a MSVSProject object for the targets found in target list.
Arguments:
target_list: the list of targets to generate project objects for.
target_dicts: the dictionary of specifications.
options: global generator options.
msvs_version: the MSVSVersion object.
Returns:
A set of created proje... | Create a MSVSProject object for the targets found in target list. | def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
"""Create a MSVSProject object for the targets found in target list.
Arguments:
target_list: the list of targets to generate project objects for.
target_dicts: the dictionary of specifications.
options: global generator option... | [
"def",
"_CreateProjectObjects",
"(",
"target_list",
",",
"target_dicts",
",",
"options",
",",
"msvs_version",
")",
":",
"global",
"fixpath_prefix",
"# Generate each project.",
"projects",
"=",
"{",
"}",
"for",
"qualified_target",
"in",
"target_list",
":",
"spec",
"=... | [
1811,
0
] | [
1857,
17
] | python | en | ['en', 'en', 'en'] | True |
_InitNinjaFlavor | (params, target_list, target_dicts) | Initialize targets for the ninja flavor.
This sets up the necessary variables in the targets to generate msvs projects
that use ninja as an external builder. The variables in the spec are only set
if they have not been set. This allows individual specs to override the
default values initialized here.
Argumen... | Initialize targets for the ninja flavor. | def _InitNinjaFlavor(params, target_list, target_dicts):
"""Initialize targets for the ninja flavor.
This sets up the necessary variables in the targets to generate msvs projects
that use ninja as an external builder. The variables in the spec are only set
if they have not been set. This allows individual spec... | [
"def",
"_InitNinjaFlavor",
"(",
"params",
",",
"target_list",
",",
"target_dicts",
")",
":",
"for",
"qualified_target",
"in",
"target_list",
":",
"spec",
"=",
"target_dicts",
"[",
"qualified_target",
"]",
"if",
"spec",
".",
"get",
"(",
"'msvs_external_builder'",
... | [
1860,
0
] | [
1905,
7
] | python | en | ['en', 'en', 'en'] | True |
CalculateVariables | (default_variables, params) | Generated variables that require params to be known. | Generated variables that require params to be known. | def CalculateVariables(default_variables, params):
"""Generated variables that require params to be known."""
generator_flags = params.get('generator_flags', {})
# Select project file format version (if unset, default to auto detecting).
msvs_version = MSVSVersion.SelectVisualStudioVersion(
generator_fl... | [
"def",
"CalculateVariables",
"(",
"default_variables",
",",
"params",
")",
":",
"generator_flags",
"=",
"params",
".",
"get",
"(",
"'generator_flags'",
",",
"{",
"}",
")",
"# Select project file format version (if unset, default to auto detecting).",
"msvs_version",
"=",
... | [
1908,
0
] | [
1933,
65
] | python | en | ['en', 'en', 'en'] | True |
GenerateOutput | (target_list, target_dicts, data, params) | Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing per .gyp data.
| Generate .sln and .vcproj files. | def GenerateOutput(target_list, target_dicts, data, params):
"""Generate .sln and .vcproj files.
This is the entry point for this generator.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
data: Dictionary containing pe... | [
"def",
"GenerateOutput",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"global",
"fixpath_prefix",
"options",
"=",
"params",
"[",
"'options'",
"]",
"# Get the project file format version back out of where we stashed it in",
"# GeneratorCalcu... | [
1955,
0
] | [
2033,
54
] | python | it | ['en', 'it', 'it'] | True |
_GenerateMSBuildFiltersFile | (filters_path, source_files,
rule_dependencies, extension_to_rule_name) | Generate the filters file.
This file is used by Visual Studio to organize the presentation of source
files into folders.
Arguments:
filters_path: The path of the file to be created.
source_files: The hierarchical structure of all the sources.
extension_to_rule_name: A dictionary mapping file e... | Generate the filters file. | def _GenerateMSBuildFiltersFile(filters_path, source_files,
rule_dependencies, extension_to_rule_name):
"""Generate the filters file.
This file is used by Visual Studio to organize the presentation of source
files into folders.
Arguments:
filters_path: The path of the fil... | [
"def",
"_GenerateMSBuildFiltersFile",
"(",
"filters_path",
",",
"source_files",
",",
"rule_dependencies",
",",
"extension_to_rule_name",
")",
":",
"filter_group",
"=",
"[",
"]",
"source_group",
"=",
"[",
"]",
"_AppendFiltersForMSBuild",
"(",
"''",
",",
"source_files",... | [
2036,
0
] | [
2063,
27
] | python | en | ['en', 'en', 'en'] | True |
_AppendFiltersForMSBuild | (parent_filter_name, sources, rule_dependencies,
extension_to_rule_name,
filter_group, source_group) | Creates the list of filters and sources to be added in the filter file.
Args:
parent_filter_name: The name of the filter under which the sources are
found.
sources: The hierarchy of filters and sources to process.
extension_to_rule_name: A dictionary mapping file extensions to rules.
... | Creates the list of filters and sources to be added in the filter file. | def _AppendFiltersForMSBuild(parent_filter_name, sources, rule_dependencies,
extension_to_rule_name,
filter_group, source_group):
"""Creates the list of filters and sources to be added in the filter file.
Args:
parent_filter_name: The name of the filt... | [
"def",
"_AppendFiltersForMSBuild",
"(",
"parent_filter_name",
",",
"sources",
",",
"rule_dependencies",
",",
"extension_to_rule_name",
",",
"filter_group",
",",
"source_group",
")",
":",
"for",
"source",
"in",
"sources",
":",
"if",
"isinstance",
"(",
"source",
",",
... | [
2066,
0
] | [
2102,
39
] | python | en | ['en', 'en', 'en'] | True |
_MapFileToMsBuildSourceType | (source, rule_dependencies,
extension_to_rule_name) | Returns the group and element type of the source file.
Arguments:
source: The source file name.
extension_to_rule_name: A dictionary mapping file extensions to rules.
Returns:
A pair of (group this file should be part of, the label of element)
| Returns the group and element type of the source file. | def _MapFileToMsBuildSourceType(source, rule_dependencies,
extension_to_rule_name):
"""Returns the group and element type of the source file.
Arguments:
source: The source file name.
extension_to_rule_name: A dictionary mapping file extensions to rules.
Returns:
... | [
"def",
"_MapFileToMsBuildSourceType",
"(",
"source",
",",
"rule_dependencies",
",",
"extension_to_rule_name",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"source",
")",
"if",
"ext",
"in",
"extension_to_rule_name",
":",
"group",
"="... | [
2105,
0
] | [
2141,
25
] | python | en | ['en', 'en', 'en'] | True |
_GenerateMSBuildRulePropsFile | (props_path, msbuild_rules) | Generate the .props file. | Generate the .props file. | def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules):
"""Generate the .props file."""
content = ['Project',
{'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}]
for rule in msbuild_rules:
content.extend([
['PropertyGroup',
{'Condition': "'$(%s)' == '' and '$(... | [
"def",
"_GenerateMSBuildRulePropsFile",
"(",
"props_path",
",",
"msbuild_rules",
")",
":",
"content",
"=",
"[",
"'Project'",
",",
"{",
"'xmlns'",
":",
"'http://schemas.microsoft.com/developer/msbuild/2003'",
"}",
"]",
"for",
"rule",
"in",
"msbuild_rules",
":",
"conten... | [
2242,
0
] | [
2271,
74
] | python | en | ['en', 'en', 'en'] | True |
_GenerateMSBuildRuleTargetsFile | (targets_path, msbuild_rules) | Generate the .targets file. | Generate the .targets file. | def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules):
"""Generate the .targets file."""
content = ['Project',
{'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'
}
]
item_group = [
'ItemGroup',
['PropertyPageSchema',
{'Include': '$(M... | [
"def",
"_GenerateMSBuildRuleTargetsFile",
"(",
"targets_path",
",",
"msbuild_rules",
")",
":",
"content",
"=",
"[",
"'Project'",
",",
"{",
"'xmlns'",
":",
"'http://schemas.microsoft.com/developer/msbuild/2003'",
"}",
"]",
"item_group",
"=",
"[",
"'ItemGroup'",
",",
"[... | [
2274,
0
] | [
2436,
76
] | python | en | ['en', 'en', 'en'] | True |
RuntimeDataConnector._get_data_reference_list | (
self, data_asset_name: Optional[str] = None
) |
List objects in the cache to create a list of data_references. If data_asset_name is passed in, method will
return all data_references for the named data_asset. If no data_asset_name is passed in, will return a list of
all data_references for all data_assets in the cache.
|
List objects in the cache to create a list of data_references. If data_asset_name is passed in, method will
return all data_references for the named data_asset. If no data_asset_name is passed in, will return a list of
all data_references for all data_assets in the cache.
| def _get_data_reference_list(
self, data_asset_name: Optional[str] = None
) -> List[str]:
"""
List objects in the cache to create a list of data_references. If data_asset_name is passed in, method will
return all data_references for the named data_asset. If no data_asset_name is pass... | [
"def",
"_get_data_reference_list",
"(",
"self",
",",
"data_asset_name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"data_asset_name",
":",
"return",
"self",
".",
"_get_data_reference_list_from_cache_by_data_asset_... | [
65,
4
] | [
84,
38
] | python | en | ['en', 'error', 'th'] | False |
RuntimeDataConnector._get_data_reference_list_from_cache_by_data_asset_name | (
self, data_asset_name: str
) | Fetch data_references corresponding to data_asset_name from the cache. | Fetch data_references corresponding to data_asset_name from the cache. | def _get_data_reference_list_from_cache_by_data_asset_name(
self, data_asset_name: str
) -> List[str]:
"""Fetch data_references corresponding to data_asset_name from the cache."""
data_references_for_data_asset_name = self._data_references_cache.get(
data_asset_name
)
... | [
"def",
"_get_data_reference_list_from_cache_by_data_asset_name",
"(",
"self",
",",
"data_asset_name",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"data_references_for_data_asset_name",
"=",
"self",
".",
"_data_references_cache",
".",
"get",
"(",
"data_asset_nam... | [
86,
4
] | [
96,
21
] | python | en | ['en', 'en', 'en'] | True |
RuntimeDataConnector.get_data_reference_list_count | (self) |
Get number of data_references corresponding to all data_asset_names in cache. In cases where the
RuntimeDataConnector has been passed a BatchRequest with the same data_asset_name but different
batch_identifiers, it is possible to have more than one data_reference for a data_asset.
|
Get number of data_references corresponding to all data_asset_names in cache. In cases where the
RuntimeDataConnector has been passed a BatchRequest with the same data_asset_name but different
batch_identifiers, it is possible to have more than one data_reference for a data_asset.
| def get_data_reference_list_count(self) -> int:
"""
Get number of data_references corresponding to all data_asset_names in cache. In cases where the
RuntimeDataConnector has been passed a BatchRequest with the same data_asset_name but different
batch_identifiers, it is possible to have m... | [
"def",
"get_data_reference_list_count",
"(",
"self",
")",
"->",
"int",
":",
"return",
"sum",
"(",
"len",
"(",
"data_reference_dict",
")",
"for",
"key",
",",
"data_reference_dict",
"in",
"self",
".",
"_data_references_cache",
".",
"items",
"(",
")",
")"
] | [
98,
4
] | [
107,
9
] | python | en | ['en', 'error', 'th'] | False |
RuntimeDataConnector.get_available_data_asset_names | (self) | Please see note in : _get_batch_definition_list_from_batch_request() | Please see note in : _get_batch_definition_list_from_batch_request() | def get_available_data_asset_names(self) -> List[str]:
"""Please see note in : _get_batch_definition_list_from_batch_request()"""
return list(self._data_references_cache.keys()) | [
"def",
"get_available_data_asset_names",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_data_references_cache",
".",
"keys",
"(",
")",
")"
] | [
112,
4
] | [
114,
55
] | python | en | ['en', 'en', 'en'] | True |
RuntimeDataConnector._get_batch_definition_list_from_batch_request | (
self,
batch_request: BatchRequest,
) |
<Will> 202103. The following behavior of the _data_references_cache follows a pattern that we are using for
other data_connectors, including variations of FilePathDataConnector. When BatchRequest contains batch_data
that is passed in as a in-memory dataframe, the cache will contain the names of... |
<Will> 202103. The following behavior of the _data_references_cache follows a pattern that we are using for
other data_connectors, including variations of FilePathDataConnector. When BatchRequest contains batch_data
that is passed in as a in-memory dataframe, the cache will contain the names of... | def _get_batch_definition_list_from_batch_request(
self,
batch_request: BatchRequest,
) -> List[BatchDefinition]:
"""
<Will> 202103. The following behavior of the _data_references_cache follows a pattern that we are using for
other data_connectors, including variations of Fil... | [
"def",
"_get_batch_definition_list_from_batch_request",
"(",
"self",
",",
"batch_request",
":",
"BatchRequest",
",",
")",
"->",
"List",
"[",
"BatchDefinition",
"]",
":",
"self",
".",
"_validate_batch_request",
"(",
"batch_request",
"=",
"batch_request",
")",
"batch_id... | [
143,
4
] | [
180,
36
] | python | en | ['en', 'error', 'th'] | False |
Anonymizer._is_parent_class_recognized | (
self,
classes_to_check,
object_=None,
object_class=None,
object_config=None,
) |
Check if the parent class is a subclass of any core GE class.
This private method is intended to be used by anonymizers in a public `is_parent_class_recognized()` method. These anonymizers define and provide the core GE classes_to_check.
Returns:
The name of the parent class found, ... |
Check if the parent class is a subclass of any core GE class.
This private method is intended to be used by anonymizers in a public `is_parent_class_recognized()` method. These anonymizers define and provide the core GE classes_to_check.
Returns:
The name of the parent class found, ... | def _is_parent_class_recognized(
self,
classes_to_check,
object_=None,
object_class=None,
object_config=None,
) -> Optional[str]:
"""
Check if the parent class is a subclass of any core GE class.
This private method is intended to be used by anonymizer... | [
"def",
"_is_parent_class_recognized",
"(",
"self",
",",
"classes_to_check",
",",
"object_",
"=",
"None",
",",
"object_class",
"=",
"None",
",",
"object_config",
"=",
"None",
",",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"assert",
"(",
"object_",
"or",
... | [
71,
4
] | [
102,
23
] | python | en | ['en', 'error', 'th'] | False |
BasePreProcessor.process | (
self,
document: dict,
clean_whitespace: Optional[bool] = True,
clean_header_footer: Optional[bool] = False,
clean_empty_lines: Optional[bool] = True,
split_by: Optional[str] = "word",
split_length: Optional[int] = 1000,
split_overlap: Optional[int] = Non... |
Perform document cleaning and splitting. Takes a single document as input and returns a list of documents.
|
Perform document cleaning and splitting. Takes a single document as input and returns a list of documents.
| def process(
self,
document: dict,
clean_whitespace: Optional[bool] = True,
clean_header_footer: Optional[bool] = False,
clean_empty_lines: Optional[bool] = True,
split_by: Optional[str] = "word",
split_length: Optional[int] = 1000,
split_overlap: Optional... | [
"def",
"process",
"(",
"self",
",",
"document",
":",
"dict",
",",
"clean_whitespace",
":",
"Optional",
"[",
"bool",
"]",
"=",
"True",
",",
"clean_header_footer",
":",
"Optional",
"[",
"bool",
"]",
"=",
"False",
",",
"clean_empty_lines",
":",
"Optional",
"[... | [
8,
4
] | [
22,
33
] | python | en | ['en', 'error', 'th'] | False |
start | (benchmark, benchmark_input_size, output, deployments, remove_containers, **kwargs) |
Start a given number of function instances and a storage instance.
|
Start a given number of function instances and a storage instance.
| def start(benchmark, benchmark_input_size, output, deployments, remove_containers, **kwargs):
"""
Start a given number of function instances and a storage instance.
"""
(
config,
output_dir,
logging_filename,
sebs_client,
deployment_client
) = parse_commo... | [
"def",
"start",
"(",
"benchmark",
",",
"benchmark_input_size",
",",
"output",
",",
"deployments",
",",
"remove_containers",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"config",
",",
"output_dir",
",",
"logging_filename",
",",
"sebs_client",
",",
"deployment_client"... | [
298,
0
] | [
345,
74
] | python | en | ['en', 'error', 'th'] | False |
stop | (input_json, **kwargs) |
Stop function and storage containers.
|
Stop function and storage containers.
| def stop(input_json, **kwargs):
"""
Stop function and storage containers.
"""
sebs.utils.global_logging()
logging.info(f"Stopping deployment from {os.path.abspath(input_json)}")
deployment = sebs.local.Deployment.deserialize(input_json, None)
deployment.shutdown()
logging.info(f"St... | [
"def",
"stop",
"(",
"input_json",
",",
"*",
"*",
"kwargs",
")",
":",
"sebs",
".",
"utils",
".",
"global_logging",
"(",
")",
"logging",
".",
"info",
"(",
"f\"Stopping deployment from {os.path.abspath(input_json)}\"",
")",
"deployment",
"=",
"sebs",
".",
"local",
... | [
350,
0
] | [
360,
74
] | python | en | ['en', 'error', 'th'] | False |
base_version | (release_version: str) | Given 'X.Y.Z[-rc.N]', return 'X.Y'. | Given 'X.Y.Z[-rc.N]', return 'X.Y'. | def base_version(release_version: str) -> str:
"""Given 'X.Y.Z[-rc.N]', return 'X.Y'."""
return build_version(release_version).rsplit(sep='.', maxsplit=1)[0] | [
"def",
"base_version",
"(",
"release_version",
":",
"str",
")",
"->",
"str",
":",
"return",
"build_version",
"(",
"release_version",
")",
".",
"rsplit",
"(",
"sep",
"=",
"'.'",
",",
"maxsplit",
"=",
"1",
")",
"[",
"0",
"]"
] | [
21,
0
] | [
23,
72
] | python | en | ['en', 'cy', 'en'] | True |
build_version | (release_version: str) | Given 'X.Y.Z[-rc.N]', return 'X.Y.Z'. | Given 'X.Y.Z[-rc.N]', return 'X.Y.Z'. | def build_version(release_version: str) -> str:
"""Given 'X.Y.Z[-rc.N]', return 'X.Y.Z'."""
return release_version.split('-')[0] | [
"def",
"build_version",
"(",
"release_version",
":",
"str",
")",
"->",
"str",
":",
"return",
"release_version",
".",
"split",
"(",
"'-'",
")",
"[",
"0",
"]"
] | [
26,
0
] | [
28,
40
] | python | en | ['en', 'cy', 'en'] | True |
assert_eq | (actual: Any, expected: Any) | `assert_eq(a, b)` is like `assert a == b`, but has a useful error
message when they're not equal.
| `assert_eq(a, b)` is like `assert a == b`, but has a useful error
message when they're not equal.
| def assert_eq(actual: Any, expected: Any) -> None:
"""`assert_eq(a, b)` is like `assert a == b`, but has a useful error
message when they're not equal.
"""
if actual != expected:
raise AssertionError(f"wanted '{expected}', got '{actual}'") | [
"def",
"assert_eq",
"(",
"actual",
":",
"Any",
",",
"expected",
":",
"Any",
")",
"->",
"None",
":",
"if",
"actual",
"!=",
"expected",
":",
"raise",
"AssertionError",
"(",
"f\"wanted '{expected}', got '{actual}'\"",
")"
] | [
31,
0
] | [
36,
68
] | python | en | ['en', 'lb', 'en'] | True |
get_is_private | () | Return whether we're in a "private" Git checkout, for doing
embargoed work.
| Return whether we're in a "private" Git checkout, for doing
embargoed work.
| def get_is_private() -> bool:
"""Return whether we're in a "private" Git checkout, for doing
embargoed work.
"""
remote_names = run_txtcapture(['git', 'remote']).split()
remote_urls: List[str] = []
for remote_name in remote_names:
remote_urls += run_txtcapture(['git', 'remote', 'get-url'... | [
"def",
"get_is_private",
"(",
")",
"->",
"bool",
":",
"remote_names",
"=",
"run_txtcapture",
"(",
"[",
"'git'",
",",
"'remote'",
"]",
")",
".",
"split",
"(",
")",
"remote_urls",
":",
"List",
"[",
"str",
"]",
"=",
"[",
"]",
"for",
"remote_name",
"in",
... | [
39,
0
] | [
47,
46
] | python | en | ['en', 'en', 'en'] | True |
match_prods_res | (dc, products, method='min') |
Determines a resolution that matches a set of Data Cube products -
either the minimum or maximum resolution along the x and y dimensions.
Product resolutions are derived from Data Cube metadata for those products.
Parameters
----------
dc: datacube.Datacube
A connection to the Data Cub... |
Determines a resolution that matches a set of Data Cube products -
either the minimum or maximum resolution along the x and y dimensions.
Product resolutions are derived from Data Cube metadata for those products. | def match_prods_res(dc, products, method='min'):
"""
Determines a resolution that matches a set of Data Cube products -
either the minimum or maximum resolution along the x and y dimensions.
Product resolutions are derived from Data Cube metadata for those products.
Parameters
----------
dc... | [
"def",
"match_prods_res",
"(",
"dc",
",",
"products",
",",
"method",
"=",
"'min'",
")",
":",
"if",
"method",
"not",
"in",
"[",
"'min'",
",",
"'max'",
"]",
":",
"raise",
"ValueError",
"(",
"\"The method \\\"{}\\\" is not supported. \"",
"\"Please choose one of ['mi... | [
26,
0
] | [
70,
23
] | python | en | ['en', 'error', 'th'] | False |
match_dim_sizes | (dc, products, x, y, x_y_coords=['longitude', 'latitude'], method='min') |
Returns the x and y dimension sizes that match some x and y extents for some products.
This is useful when determining an absolute resolution to scale products to with
`xr_scale_res()` in the `aggregate.py` utility file.
Parameters
----------
dc: datacube.Datacube
A connection to the D... |
Returns the x and y dimension sizes that match some x and y extents for some products.
This is useful when determining an absolute resolution to scale products to with
`xr_scale_res()` in the `aggregate.py` utility file. | def match_dim_sizes(dc, products, x, y, x_y_coords=['longitude', 'latitude'], method='min'):
"""
Returns the x and y dimension sizes that match some x and y extents for some products.
This is useful when determining an absolute resolution to scale products to with
`xr_scale_res()` in the `aggregate.py` ... | [
"def",
"match_dim_sizes",
"(",
"dc",
",",
"products",
",",
"x",
",",
"y",
",",
"x_y_coords",
"=",
"[",
"'longitude'",
",",
"'latitude'",
"]",
",",
"method",
"=",
"'min'",
")",
":",
"coords",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"x_y_coords",
",",
... | [
73,
0
] | [
135,
34
] | python | en | ['en', 'error', 'th'] | False |
xarray_concat_and_merge | (*args, concat_dim='time', sort_dim='time') |
Given parameters that are each a list of `xarray.Dataset` objects, merge each list
into an `xarray.Dataset` object and return all such objects in the same order.
Parameters
----------
*args: list of lists of `xarray.Dataset`.
A list of lists of `xarray.Dataset` objects to merge.
conca... |
Given parameters that are each a list of `xarray.Dataset` objects, merge each list
into an `xarray.Dataset` object and return all such objects in the same order. | def xarray_concat_and_merge(*args, concat_dim='time', sort_dim='time'):
"""
Given parameters that are each a list of `xarray.Dataset` objects, merge each list
into an `xarray.Dataset` object and return all such objects in the same order.
Parameters
----------
*args: list of lists of `xarray.Da... | [
"def",
"xarray_concat_and_merge",
"(",
"*",
"args",
",",
"concat_dim",
"=",
"'time'",
",",
"sort_dim",
"=",
"'time'",
")",
":",
"merged",
"=",
"[",
"]",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"dataset_temp",
"=",
"xr",
".",
... | [
137,
0
] | [
158,
17
] | python | en | ['en', 'error', 'th'] | False |
merge_datasets | (datasets_temp, clean_masks_temp, masks_per_platform=None,
x_coord='longitude', y_coord='latitude') |
Merges dictionaries of platform names mapping to datasets, dataset clean masks,
and lists of other masks into one dataset, one dataset clean mask, and one
of each type of other mask, ordering all by time.
Parameters
----------
datasets_temp: dict
Dictionary that maps platforms to `xarr... |
Merges dictionaries of platform names mapping to datasets, dataset clean masks,
and lists of other masks into one dataset, one dataset clean mask, and one
of each type of other mask, ordering all by time. | def merge_datasets(datasets_temp, clean_masks_temp, masks_per_platform=None,
x_coord='longitude', y_coord='latitude'):
"""
Merges dictionaries of platform names mapping to datasets, dataset clean masks,
and lists of other masks into one dataset, one dataset clean mask, and one
of each... | [
"def",
"merge_datasets",
"(",
"datasets_temp",
",",
"clean_masks_temp",
",",
"masks_per_platform",
"=",
"None",
",",
"x_coord",
"=",
"'longitude'",
",",
"y_coord",
"=",
"'latitude'",
")",
":",
"def",
"xr_set_same_coords",
"(",
"datasets",
")",
":",
"first_ds",
"... | [
160,
0
] | [
245,
37
] | python | en | ['en', 'error', 'th'] | False |
load_simple | (dc, platform, product, frac_res=None, abs_res=None,
load_params={}, masking_params={}, indiv_masks=None) |
**This function is DEPRECATED.**
Simplifies loading from the Data Cube by retrieving a dataset along
with its mask. Currently only tested on Landsat data.
Parameters
----------
dc: datacube.api.core.Datacube
The Datacube instance to load data with.
platform, product: str
St... |
**This function is DEPRECATED.**
Simplifies loading from the Data Cube by retrieving a dataset along
with its mask. Currently only tested on Landsat data. | def load_simple(dc, platform, product, frac_res=None, abs_res=None,
load_params={}, masking_params={}, indiv_masks=None):
"""
**This function is DEPRECATED.**
Simplifies loading from the Data Cube by retrieving a dataset along
with its mask. Currently only tested on Landsat data.
Pa... | [
"def",
"load_simple",
"(",
"dc",
",",
"platform",
",",
"product",
",",
"frac_res",
"=",
"None",
",",
"abs_res",
"=",
"None",
",",
"load_params",
"=",
"{",
"}",
",",
"masking_params",
"=",
"{",
"}",
",",
"indiv_masks",
"=",
"None",
")",
":",
"current_lo... | [
251,
0
] | [
320,
37
] | python | en | ['en', 'error', 'th'] | False |
load_multiplatform | (dc, platforms, products, frac_res=None, abs_res=None,
load_params={}, masking_params={}, indiv_masks=None) |
**This function is DEPRECATED.**
Load and merge data as well as clean masks given a list of platforms
and products. Currently only tested on Landsat data.
Parameters
----------
dc: datacube.api.core.Datacube
The Datacube instance to load data with.
platforms, products: list-lik... |
**This function is DEPRECATED.**
Load and merge data as well as clean masks given a list of platforms
and products. Currently only tested on Landsat data.
Parameters
----------
dc: datacube.api.core.Datacube
The Datacube instance to load data with.
platforms, products: list-lik... | def load_multiplatform(dc, platforms, products, frac_res=None, abs_res=None,
load_params={}, masking_params={}, indiv_masks=None):
"""
**This function is DEPRECATED.**
Load and merge data as well as clean masks given a list of platforms
and products. Currently only tested on Lands... | [
"def",
"load_multiplatform",
"(",
"dc",
",",
"platforms",
",",
"products",
",",
"frac_res",
"=",
"None",
",",
"abs_res",
"=",
"None",
",",
"load_params",
"=",
"{",
"}",
",",
"masking_params",
"=",
"{",
"}",
",",
"indiv_masks",
"=",
"None",
")",
":",
"#... | [
322,
0
] | [
461,
78
] | python | en | ['en', 'error', 'th'] | False |
get_product_extents | (api, platform, product, **kwargs) |
Returns the minimum and maximum latitude, longitude, and date range of a product.
Parameters
----------
api: DataAccessApi
An instance of `DataAccessApi` to get query metadata from.
platform, product: str
Names of the platform and product to query extent information for.
**kwar... |
Returns the minimum and maximum latitude, longitude, and date range of a product. | def get_product_extents(api, platform, product, **kwargs):
"""
Returns the minimum and maximum latitude, longitude, and date range of a product.
Parameters
----------
api: DataAccessApi
An instance of `DataAccessApi` to get query metadata from.
platform, product: str
Names of th... | [
"def",
"get_product_extents",
"(",
"api",
",",
"platform",
",",
"product",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get the extents of the cube",
"descriptor",
"=",
"api",
".",
"get_query_metadata",
"(",
"platform",
"=",
"platform",
",",
"product",
"=",
"product",
... | [
467,
0
] | [
492,
50
] | python | en | ['en', 'error', 'th'] | False |
get_overlapping_area | (api, platforms, products, **product_kwargs) |
Returns the minimum and maximum latitude, longitude, and date range of the overlapping
area for a set of products.
Parameters
----------
api: DataAccessApi
An instance of `DataAccessApi` to get query metadata from.
platforms, products: list-like of str
A list-like of names ... |
Returns the minimum and maximum latitude, longitude, and date range of the overlapping
area for a set of products.
Parameters
----------
api: DataAccessApi
An instance of `DataAccessApi` to get query metadata from.
platforms, products: list-like of str
A list-like of names ... | def get_overlapping_area(api, platforms, products, **product_kwargs):
"""
Returns the minimum and maximum latitude, longitude, and date range of the overlapping
area for a set of products.
Parameters
----------
api: DataAccessApi
An instance of `DataAccessApi` to get query metadata ... | [
"def",
"get_overlapping_area",
"(",
"api",
",",
"platforms",
",",
"products",
",",
"*",
"*",
"product_kwargs",
")",
":",
"min_max_dates",
"=",
"np",
".",
"empty",
"(",
"(",
"len",
"(",
"platforms",
")",
",",
"2",
")",
",",
"dtype",
"=",
"object",
")",
... | [
494,
0
] | [
531,
44
] | python | en | ['en', 'error', 'th'] | False |
find_desired_acq_inds | (dataset=None, clean_mask=None, time_dim='time', pct_clean=None, not_empty=False) |
Returns indices of acquisitions that meet a specified set of criteria in
an `xarray.Dataset` or `xarray.DataArray`.
Parameters
----------
dataset: xarray.Dataset or xarray.DataArray
The `xarray` object to remove undesired acquisitions from.
clean_mask: xarray.DataArray
A boolea... |
Returns indices of acquisitions that meet a specified set of criteria in
an `xarray.Dataset` or `xarray.DataArray`. | def find_desired_acq_inds(dataset=None, clean_mask=None, time_dim='time', pct_clean=None, not_empty=False):
"""
Returns indices of acquisitions that meet a specified set of criteria in
an `xarray.Dataset` or `xarray.DataArray`.
Parameters
----------
dataset: xarray.Dataset or xarray.DataArray
... | [
"def",
"find_desired_acq_inds",
"(",
"dataset",
"=",
"None",
",",
"clean_mask",
"=",
"None",
",",
"time_dim",
"=",
"'time'",
",",
"pct_clean",
"=",
"None",
",",
"not_empty",
"=",
"False",
")",
":",
"if",
"pct_clean",
"is",
"not",
"None",
":",
"assert",
"... | [
537,
0
] | [
578,
27
] | python | en | ['en', 'error', 'th'] | False |
group_dates_by_day | (dates) |
Given a list of dates, return the list of lists of dates grouped by day.
Parameters
----------
dates: List[np.datetime64]
Returns
-------
grouped_dates: List[List[np.datetime64]]
|
Given a list of dates, return the list of lists of dates grouped by day. | def group_dates_by_day(dates):
"""
Given a list of dates, return the list of lists of dates grouped by day.
Parameters
----------
dates: List[np.datetime64]
Returns
-------
grouped_dates: List[List[np.datetime64]]
"""
generate_key = lambda b: ((b - np.datetime64('1970-01-01T00:... | [
"def",
"group_dates_by_day",
"(",
"dates",
")",
":",
"generate_key",
"=",
"lambda",
"b",
":",
"(",
"(",
"b",
"-",
"np",
".",
"datetime64",
"(",
"'1970-01-01T00:00:00Z'",
")",
")",
"/",
"(",
"np",
".",
"timedelta64",
"(",
"1",
",",
"'h'",
")",
"*",
"2... | [
581,
0
] | [
594,
85
] | python | en | ['en', 'error', 'th'] | False |
reduce_on_day | (ds, reduction_func=np.nanmean) |
Combine data in an `xarray.Dataset` for dates with the same day
Parameters
----------
ds: xr.Dataset
reduction_func: np.ufunc
Returns
-------
reduced_ds: xr.Dataset
|
Combine data in an `xarray.Dataset` for dates with the same day | def reduce_on_day(ds, reduction_func=np.nanmean):
"""
Combine data in an `xarray.Dataset` for dates with the same day
Parameters
----------
ds: xr.Dataset
reduction_func: np.ufunc
Returns
-------
reduced_ds: xr.Dataset
"""
# Save dtypes to convert back to them.
dataset_... | [
"def",
"reduce_on_day",
"(",
"ds",
",",
"reduction_func",
"=",
"np",
".",
"nanmean",
")",
":",
"# Save dtypes to convert back to them.",
"dataset_in_dtypes",
"=",
"{",
"}",
"for",
"band",
"in",
"ds",
".",
"data_vars",
":",
"dataset_in_dtypes",
"[",
"band",
"]",
... | [
597,
0
] | [
633,
22
] | python | en | ['en', 'error', 'th'] | False |
SeBS.ignore_cache | (self) |
The cache will only store code packages,
and won't update new functions and storage.
|
The cache will only store code packages,
and won't update new functions and storage.
| def ignore_cache(self):
"""
The cache will only store code packages,
and won't update new functions and storage.
"""
self._cache_client.ignore_storage = True
self._cache_client.ignore_functions = True | [
"def",
"ignore_cache",
"(",
"self",
")",
":",
"self",
".",
"_cache_client",
".",
"ignore_storage",
"=",
"True",
"self",
".",
"_cache_client",
".",
"ignore_functions",
"=",
"True"
] | [
66,
4
] | [
72,
50
] | python | en | ['en', 'error', 'th'] | False |
StoreBackend.__init__ | (
self,
fixed_length_key=False,
suppress_store_backend_id=False,
manually_initialize_store_backend_id: str = "",
store_name="no_store_name",
) |
Initialize a StoreBackend
Args:
fixed_length_key:
suppress_store_backend_id: skip construction of a StoreBackend.store_backend_id
manually_initialize_store_backend_id: UUID as a string to use if the store_backend_id is not already set
store_name: store na... |
Initialize a StoreBackend
Args:
fixed_length_key:
suppress_store_backend_id: skip construction of a StoreBackend.store_backend_id
manually_initialize_store_backend_id: UUID as a string to use if the store_backend_id is not already set
store_name: store na... | def __init__(
self,
fixed_length_key=False,
suppress_store_backend_id=False,
manually_initialize_store_backend_id: str = "",
store_name="no_store_name",
):
"""
Initialize a StoreBackend
Args:
fixed_length_key:
suppress_store_bac... | [
"def",
"__init__",
"(",
"self",
",",
"fixed_length_key",
"=",
"False",
",",
"suppress_store_backend_id",
"=",
"False",
",",
"manually_initialize_store_backend_id",
":",
"str",
"=",
"\"\"",
",",
"store_name",
"=",
"\"no_store_name\"",
",",
")",
":",
"self",
".",
... | [
27,
4
] | [
47,
37
] | python | en | ['en', 'error', 'th'] | False |
StoreBackend._construct_store_backend_id | (
self, suppress_warning: bool = False
) |
Create a store_backend_id if one does not exist, and return it if it exists
If a valid UUID store_backend_id is passed in param manually_initialize_store_backend_id
and there is not already an existing store_backend_id then the store_backend_id
from param manually_initialize_store_backe... |
Create a store_backend_id if one does not exist, and return it if it exists
If a valid UUID store_backend_id is passed in param manually_initialize_store_backend_id
and there is not already an existing store_backend_id then the store_backend_id
from param manually_initialize_store_backe... | def _construct_store_backend_id(
self, suppress_warning: bool = False
) -> Optional[str]:
"""
Create a store_backend_id if one does not exist, and return it if it exists
If a valid UUID store_backend_id is passed in param manually_initialize_store_backend_id
and there is not ... | [
"def",
"_construct_store_backend_id",
"(",
"self",
",",
"suppress_warning",
":",
"bool",
"=",
"False",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"self",
".",
"_suppress_store_backend_id",
":",
"if",
"not",
"suppress_warning",
":",
"logger",
".",
"warn... | [
57,
4
] | [
98,
62
] | python | en | ['en', 'error', 'th'] | False |
ColumnQuantileValues._pandas | (cls, column, quantiles, allow_relative_error, **kwargs) | Quantile Function | Quantile Function | def _pandas(cls, column, quantiles, allow_relative_error, **kwargs):
"""Quantile Function"""
interpolation_options = ("linear", "lower", "higher", "midpoint", "nearest")
if not allow_relative_error:
allow_relative_error = "nearest"
if allow_relative_error not in interpolati... | [
"def",
"_pandas",
"(",
"cls",
",",
"column",
",",
"quantiles",
",",
"allow_relative_error",
",",
"*",
"*",
"kwargs",
")",
":",
"interpolation_options",
"=",
"(",
"\"linear\"",
",",
"\"lower\"",
",",
"\"higher\"",
",",
"\"midpoint\"",
",",
"\"nearest\"",
")",
... | [
62,
4
] | [
74,
86
] | python | en | ['en', 'la', 'en'] | False |
Config._reset | (self) |
Resets this Config to the empty, default state so it can load a new config.
|
Resets this Config to the empty, default state so it can load a new config.
| def _reset(self) -> None:
"""
Resets this Config to the empty, default state so it can load a new config.
"""
self.logger.debug("ACONF RESET")
self.current_resource = None
self.helm_chart = None
self.validators = {}
self.config = {}
self.breake... | [
"def",
"_reset",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"ACONF RESET\"",
")",
"self",
".",
"current_resource",
"=",
"None",
"self",
".",
"helm_chart",
"=",
"None",
"self",
".",
"validators",
"=",
"{",
"}",
"sel... | [
153,
4
] | [
188,
74
] | python | en | ['en', 'error', 'th'] | False |
Config.save_source | (self, resource: ACResource) |
Save a given ACResource as a source of Ambassador config information.
|
Save a given ACResource as a source of Ambassador config information.
| def save_source(self, resource: ACResource) -> None:
"""
Save a given ACResource as a source of Ambassador config information.
"""
self.sources[resource.rkey] = resource | [
"def",
"save_source",
"(",
"self",
",",
"resource",
":",
"ACResource",
")",
"->",
"None",
":",
"self",
".",
"sources",
"[",
"resource",
".",
"rkey",
"]",
"=",
"resource"
] | [
278,
4
] | [
282,
46
] | python | en | ['en', 'error', 'th'] | False |
Config.load_all | (self, resources: Iterable[ACResource]) |
Loads all of a set of ACResources. It is the caller's responsibility to arrange for
the set of ACResources to be sorted in some way that makes sense.
|
Loads all of a set of ACResources. It is the caller's responsibility to arrange for
the set of ACResources to be sorted in some way that makes sense.
| def load_all(self, resources: Iterable[ACResource]) -> None:
"""
Loads all of a set of ACResources. It is the caller's responsibility to arrange for
the set of ACResources to be sorted in some way that makes sense.
"""
self.logger.debug(f"Loading config; legacy mode is {'enabled... | [
"def",
"load_all",
"(",
"self",
",",
"resources",
":",
"Iterable",
"[",
"ACResource",
"]",
")",
"->",
"None",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"f\"Loading config; legacy mode is {'enabled' if Config.legacy_mode else 'disabled'}\"",
")",
"rcount",
"=",
... | [
284,
4
] | [
317,
85
] | python | en | ['en', 'error', 'th'] | False |
Config.safe_store | (self, storage_name: str, resource: ACResource, allow_log: bool=True) |
Safely store a ACResource under a given storage name. The storage_name is separate
because we may need to e.g. store a Module under the 'ratelimit' name or the like.
Within a storage_name bucket, the ACResource will be stored under its name.
:param storage_name: where shall we file thi... |
Safely store a ACResource under a given storage name. The storage_name is separate
because we may need to e.g. store a Module under the 'ratelimit' name or the like.
Within a storage_name bucket, the ACResource will be stored under its name. | def safe_store(self, storage_name: str, resource: ACResource, allow_log: bool=True) -> None:
"""
Safely store a ACResource under a given storage name. The storage_name is separate
because we may need to e.g. store a Module under the 'ratelimit' name or the like.
Within a storage_name buc... | [
"def",
"safe_store",
"(",
"self",
",",
"storage_name",
":",
"str",
",",
"resource",
":",
"ACResource",
",",
"allow_log",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"storage",
"=",
"self",
".",
"config",
".",
"setdefault",
"(",
"storage_name",
",",... | [
674,
4
] | [
705,
41
] | python | en | ['en', 'error', 'th'] | False |
Config.save_object | (self, resource: ACResource, allow_log: bool=False) |
Saves a ACResource using its kind as the storage class name. Sort of the
defaulted version of safe_store.
:param resource: what shall we file?
:param allow_log: if True, logs that we're saving this thing.
|
Saves a ACResource using its kind as the storage class name. Sort of the
defaulted version of safe_store. | def save_object(self, resource: ACResource, allow_log: bool=False) -> None:
"""
Saves a ACResource using its kind as the storage class name. Sort of the
defaulted version of safe_store.
:param resource: what shall we file?
:param allow_log: if True, logs that we're saving this t... | [
"def",
"save_object",
"(",
"self",
",",
"resource",
":",
"ACResource",
",",
"allow_log",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"self",
".",
"safe_store",
"(",
"resource",
".",
"kind",
",",
"resource",
",",
"allow_log",
"=",
"allow_log",
")"
... | [
707,
4
] | [
716,
69
] | python | en | ['en', 'error', 'th'] | False |
Config.get_module | (self, module_name: str) |
Fetch a module from the module store. Can return None if no
such module exists.
:param module_name: name of the module you want.
|
Fetch a module from the module store. Can return None if no
such module exists. | def get_module(self, module_name: str) -> Optional[ACResource]:
"""
Fetch a module from the module store. Can return None if no
such module exists.
:param module_name: name of the module you want.
"""
modules = self.get_config("modules")
if modules:
... | [
"def",
"get_module",
"(",
"self",
",",
"module_name",
":",
"str",
")",
"->",
"Optional",
"[",
"ACResource",
"]",
":",
"modules",
"=",
"self",
".",
"get_config",
"(",
"\"modules\"",
")",
"if",
"modules",
":",
"return",
"modules",
".",
"get",
"(",
"module_... | [
721,
4
] | [
734,
23
] | python | en | ['en', 'error', 'th'] | False |
Config.module_lookup | (self, module_name: str, key: str, default: Any=None) |
Look up a specific key in a given module. If the named module doesn't
exist, or if the key doesn't exist in the module, return the default.
:param module_name: name of the module you want.
:param key: key to look up within the module
:param default: default value if the module ... |
Look up a specific key in a given module. If the named module doesn't
exist, or if the key doesn't exist in the module, return the default. | def module_lookup(self, module_name: str, key: str, default: Any=None) -> Any:
"""
Look up a specific key in a given module. If the named module doesn't
exist, or if the key doesn't exist in the module, return the default.
:param module_name: name of the module you want.
:param ... | [
"def",
"module_lookup",
"(",
"self",
",",
"module_name",
":",
"str",
",",
"key",
":",
"str",
",",
"default",
":",
"Any",
"=",
"None",
")",
"->",
"Any",
":",
"module",
"=",
"self",
".",
"get_module",
"(",
"module_name",
")",
"if",
"module",
":",
"retu... | [
736,
4
] | [
751,
22
] | python | en | ['en', 'error', 'th'] | False |
Config.handle_module | (self, resource: ACResource) |
Handles a Module resource.
|
Handles a Module resource.
| def handle_module(self, resource: ACResource) -> None:
"""
Handles a Module resource.
"""
# Make a new ACResource from the 'config' element of this ACResource
# Note that we leave the original serialization intact, since it will
# indeed show a human the YAML that define... | [
"def",
"handle_module",
"(",
"self",
",",
"resource",
":",
"ACResource",
")",
"->",
"None",
":",
"# Make a new ACResource from the 'config' element of this ACResource",
"# Note that we leave the original serialization intact, since it will",
"# indeed show a human the YAML that defined t... | [
753,
4
] | [
765,
51
] | python | en | ['en', 'error', 'th'] | False |
Config.handle_secret | (self, resource: ACResource) |
Handles a Secret resource. We need a handler for this because the key needs to be
the rkey, not the name.
|
Handles a Secret resource. We need a handler for this because the key needs to be
the rkey, not the name.
| def handle_secret(self, resource: ACResource) -> None:
"""
Handles a Secret resource. We need a handler for this because the key needs to be
the rkey, not the name.
"""
self.logger.debug(f"Handling secret resource {resource.as_dict()}")
storage = self.config.setdefault(... | [
"def",
"handle_secret",
"(",
"self",
",",
"resource",
":",
"ACResource",
")",
"->",
"None",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"f\"Handling secret resource {resource.as_dict()}\"",
")",
"storage",
"=",
"self",
".",
"config",
".",
"setdefault",
"(",
... | [
767,
4
] | [
783,
31
] | python | en | ['en', 'error', 'th'] | False |
Config.handle_service | (self, resource: ACResource) |
Handles a Service resource. We need a handler for this because the key needs to be
the rkey, not the name, and because we need to check the helm_chart attribute.
|
Handles a Service resource. We need a handler for this because the key needs to be
the rkey, not the name, and because we need to check the helm_chart attribute.
| def handle_service(self, resource: ACResource) -> None:
"""
Handles a Service resource. We need a handler for this because the key needs to be
the rkey, not the name, and because we need to check the helm_chart attribute.
"""
storage = self.config.setdefault('service', {})
... | [
"def",
"handle_service",
"(",
"self",
",",
"resource",
":",
"ACResource",
")",
"->",
"None",
":",
"storage",
"=",
"self",
".",
"config",
".",
"setdefault",
"(",
"'service'",
",",
"{",
"}",
")",
"key",
"=",
"resource",
".",
"rkey",
"if",
"key",
"in",
... | [
796,
4
] | [
818,
35
] | python | en | ['en', 'error', 'th'] | False |
OrderedProfilerCardinality.get_basic_column_cardinality | (cls, num_unique=0, pct_unique=0) |
Takes the number and percentage of unique values in a column and returns the column cardinality.
If you are unexpectedly returning a cardinality of "None", ensure that you are passing in values for both
num_unique and pct_unique.
Args:
num_unique: The number of unique values... |
Takes the number and percentage of unique values in a column and returns the column cardinality.
If you are unexpectedly returning a cardinality of "None", ensure that you are passing in values for both
num_unique and pct_unique.
Args:
num_unique: The number of unique values... | def get_basic_column_cardinality(cls, num_unique=0, pct_unique=0):
"""
Takes the number and percentage of unique values in a column and returns the column cardinality.
If you are unexpectedly returning a cardinality of "None", ensure that you are passing in values for both
num_unique and... | [
"def",
"get_basic_column_cardinality",
"(",
"cls",
",",
"num_unique",
"=",
"0",
",",
"pct_unique",
"=",
"0",
")",
":",
"if",
"pct_unique",
"==",
"1.0",
":",
"cardinality",
"=",
"cls",
".",
"UNIQUE",
"elif",
"num_unique",
"==",
"1",
":",
"cardinality",
"=",... | [
52,
4
] | [
80,
26
] | python | en | ['en', 'error', 'th'] | False |
ErbLexer.get_tokens_unprocessed | (self, text) |
Since ERB doesn't allow "<%" and other tags inside of ruby
blocks we have to use a split approach here that fails for
that too.
|
Since ERB doesn't allow "<%" and other tags inside of ruby
blocks we have to use a split approach here that fails for
that too.
| def get_tokens_unprocessed(self, text):
"""
Since ERB doesn't allow "<%" and other tags inside of ruby
blocks we have to use a split approach here that fails for
that too.
"""
tokens = self._block_re.split(text)
tokens.reverse()
state = idx = 0
try... | [
"def",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
")",
":",
"tokens",
"=",
"self",
".",
"_block_re",
".",
"split",
"(",
"text",
")",
"tokens",
".",
"reverse",
"(",
")",
"state",
"=",
"idx",
"=",
"0",
"try",
":",
"while",
"True",
":",
"# text... | [
71,
4
] | [
137,
18
] | python | en | ['en', 'error', 'th'] | False |
TeamcityReport._get_capture_plugin | (self) |
:rtype: nose.plugins.capture.Capture
|
:rtype: nose.plugins.capture.Capture
| def _get_capture_plugin(self):
"""
:rtype: nose.plugins.capture.Capture
"""
for plugin in self.config.plugins.plugins:
if plugin.name == "capture":
return plugin
return None | [
"def",
"_get_capture_plugin",
"(",
"self",
")",
":",
"for",
"plugin",
"in",
"self",
".",
"config",
".",
"plugins",
".",
"plugins",
":",
"if",
"plugin",
".",
"name",
"==",
"\"capture\"",
":",
"return",
"plugin",
"return",
"None"
] | [
123,
4
] | [
130,
19
] | python | en | ['en', 'error', 'th'] | False |
TeamcityReport.prepareTestLoader | (self, loader) | Insert ourselves into loader calls to count tests.
The top-level loader call often returns lazy results, like a LazySuite.
This is a problem, as we would destroy the suite by iterating over it
to count the tests. Consequently, we monkey-patch the top-level loader
call to do the load twic... | Insert ourselves into loader calls to count tests.
The top-level loader call often returns lazy results, like a LazySuite.
This is a problem, as we would destroy the suite by iterating over it
to count the tests. Consequently, we monkey-patch the top-level loader
call to do the load twic... | def prepareTestLoader(self, loader):
"""Insert ourselves into loader calls to count tests.
The top-level loader call often returns lazy results, like a LazySuite.
This is a problem, as we would destroy the suite by iterating over it
to count the tests. Consequently, we monkey-patch the t... | [
"def",
"prepareTestLoader",
"(",
"self",
",",
"loader",
")",
":",
"# TODO: If there's ever a practical need, also patch loader.suiteClass",
"# or even TestProgram.createTests. createTests seems to be main top-",
"# level caller of loader methods, and nose.core.collector() (which",
"# isn't eve... | [
190,
4
] | [
221,
59
] | python | en | ['en', 'en', 'en'] | True |
test_subclass_pandas_subset_retains_subclass | () | A subclass of PandasDataset should still be that subclass after a Pandas subsetting operation | A subclass of PandasDataset should still be that subclass after a Pandas subsetting operation | def test_subclass_pandas_subset_retains_subclass():
"""A subclass of PandasDataset should still be that subclass after a Pandas subsetting operation"""
class CustomPandasDataset(ge.dataset.PandasDataset):
@ge.dataset.MetaPandasDataset.column_map_expectation
def expect_column_values_to_be_odd(se... | [
"def",
"test_subclass_pandas_subset_retains_subclass",
"(",
")",
":",
"class",
"CustomPandasDataset",
"(",
"ge",
".",
"dataset",
".",
"PandasDataset",
")",
":",
"@",
"ge",
".",
"dataset",
".",
"MetaPandasDataset",
".",
"column_map_expectation",
"def",
"expect_column_v... | [
801,
0
] | [
851,
46
] | python | en | ['en', 'en', 'en'] | True |
test_ge_value_count_of_object_dtype_column_with_mixed_types | () |
Having mixed type values in a object dtype column (e.g., strings and floats)
used to raise a TypeError when sorting value_counts. This test verifies
that the issue is fixed.
|
Having mixed type values in a object dtype column (e.g., strings and floats)
used to raise a TypeError when sorting value_counts. This test verifies
that the issue is fixed.
| def test_ge_value_count_of_object_dtype_column_with_mixed_types():
"""
Having mixed type values in a object dtype column (e.g., strings and floats)
used to raise a TypeError when sorting value_counts. This test verifies
that the issue is fixed.
"""
df = ge.dataset.PandasDataset(
{
... | [
"def",
"test_ge_value_count_of_object_dtype_column_with_mixed_types",
"(",
")",
":",
"df",
"=",
"ge",
".",
"dataset",
".",
"PandasDataset",
"(",
"{",
"\"A\"",
":",
"[",
"1.5",
",",
"0.009",
",",
"0.5",
",",
"\"I am a string in an otherwise float column\"",
"]",
",",... | [
868,
0
] | [
881,
74
] | python | en | ['en', 'error', 'th'] | False |
test_expect_values_to_be_of_type_list | () |
Having lists in a Pandas column used to raise a ValueError when parsing to
see if any rows had missing values. This test verifies that the issue is fixed.
|
Having lists in a Pandas column used to raise a ValueError when parsing to
see if any rows had missing values. This test verifies that the issue is fixed.
| def test_expect_values_to_be_of_type_list():
"""
Having lists in a Pandas column used to raise a ValueError when parsing to
see if any rows had missing values. This test verifies that the issue is fixed.
"""
df = ge.dataset.PandasDataset(
{
"A": [[1, 2], None, [4, 5], 6],
... | [
"def",
"test_expect_values_to_be_of_type_list",
"(",
")",
":",
"df",
"=",
"ge",
".",
"dataset",
".",
"PandasDataset",
"(",
"{",
"\"A\"",
":",
"[",
"[",
"1",
",",
"2",
"]",
",",
"None",
",",
"[",
"4",
",",
"5",
"]",
",",
"6",
"]",
",",
"}",
")",
... | [
884,
0
] | [
896,
33
] | python | en | ['en', 'error', 'th'] | False |
test_expect_values_quantiles_to_be_between | () |
Test that quantile bounds set to zero actually get interpreted as such. Zero
used to be interpreted as None (and thus +-inf) and we'd get false negatives.
|
Test that quantile bounds set to zero actually get interpreted as such. Zero
used to be interpreted as None (and thus +-inf) and we'd get false negatives.
| def test_expect_values_quantiles_to_be_between():
"""
Test that quantile bounds set to zero actually get interpreted as such. Zero
used to be interpreted as None (and thus +-inf) and we'd get false negatives.
"""
T = [
([1, 2, 3, 4, 5], [0.5], [[0, 0]], False),
([0, 0, 0, 0, 0], [0.5... | [
"def",
"test_expect_values_quantiles_to_be_between",
"(",
")",
":",
"T",
"=",
"[",
"(",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
"]",
",",
"[",
"0.5",
"]",
",",
"[",
"[",
"0",
",",
"0",
"]",
"]",
",",
"False",
")",
",",
"(",
"[",
"... | [
899,
0
] | [
919,
44
] | python | en | ['en', 'error', 'th'] | False |
Path.open | (self, *args, **kwargs) | Open the file pointed to by the path, like the :func:`trio.open_file`
function does.
| Open the file pointed to by the path, like the :func:`trio.open_file`
function does. | async def open(self, *args, **kwargs):
"""Open the file pointed to by the path, like the :func:`trio.open_file`
function does.
"""
func = partial(self._wrapped.open, *args, **kwargs)
value = await trio.to_thread.run_sync(func)
return trio.wrap_file(value) | [
"async",
"def",
"open",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"partial",
"(",
"self",
".",
"_wrapped",
".",
"open",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"value",
"=",
"await",
"trio",
".",
"to... | [
174,
4
] | [
182,
36
] | python | en | ['en', 'en', 'en'] | True |
declaration_t.__str__ | (self) |
Default __str__ method.
This version just returns the decl_string and the class.
Derived classes may override this method to provide more detailed
information.
A __str__ method for a declaration should always provide enough
information so that it uniquely identifies th... |
Default __str__ method. | def __str__(self):
"""
Default __str__ method.
This version just returns the decl_string and the class.
Derived classes may override this method to provide more detailed
information.
A __str__ method for a declaration should always provide enough
information so ... | [
"def",
"__str__",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"decl_string",
"if",
"name",
"[",
":",
"2",
"]",
"==",
"\"::\"",
":",
"name",
"=",
"name",
"[",
"2",
":",
"]",
"# Append the declaration class",
"cls",
"=",
"self",
".",
"__class__",
... | [
42,
4
] | [
65,
38
] | python | en | ['en', 'error', 'th'] | False |
declaration_t._get__cmp__items | (self) |
Implementation detail.
|
Implementation detail. | def _get__cmp__items(self):
"""
Implementation detail.
"""
# Every derived class should implement this method. This method should
# return a list of items, that should be compared.
print(
'_get__cmp__items not implemented for class ',
self.__clas... | [
"def",
"_get__cmp__items",
"(",
"self",
")",
":",
"# Every derived class should implement this method. This method should",
"# return a list of items, that should be compared.",
"print",
"(",
"'_get__cmp__items not implemented for class '",
",",
"self",
".",
"__class__",
".",
"__name... | [
67,
4
] | [
79,
35
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.