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
extract_template
(image_path: pathlib.Path, bbox: List)
Extract bounding box selection from image path. bbox: (top_row, left_col, bottom_row, right_col)
Extract bounding box selection from image path.
def extract_template(image_path: pathlib.Path, bbox: List) -> Image: """Extract bounding box selection from image path. bbox: (top_row, left_col, bottom_row, right_col) """ assert len(bbox) == 4 # Open image with PIL image = Image.open(image_path) # image.crop takes format (left, upper, r...
[ "def", "extract_template", "(", "image_path", ":", "pathlib", ".", "Path", ",", "bbox", ":", "List", ")", "->", "Image", ":", "assert", "len", "(", "bbox", ")", "==", "4", "# Open image with PIL", "image", "=", "Image", ".", "open", "(", "image_path", ")...
[ 54, 0 ]
[ 67, 19 ]
python
en
['en', 'en', 'en']
True
swap_bbox_format
(bbox_tuple)
Swap between (row0, col0, row1, col1) and (x0, y0, x1, y1) formats.
Swap between (row0, col0, row1, col1) and (x0, y0, x1, y1) formats.
def swap_bbox_format(bbox_tuple): """Swap between (row0, col0, row1, col1) and (x0, y0, x1, y1) formats.""" assert len(bbox_tuple) == 4 return (bbox_tuple[1], bbox_tuple[0], bbox_tuple[3], bbox_tuple[2])
[ "def", "swap_bbox_format", "(", "bbox_tuple", ")", ":", "assert", "len", "(", "bbox_tuple", ")", "==", "4", "return", "(", "bbox_tuple", "[", "1", "]", ",", "bbox_tuple", "[", "0", "]", ",", "bbox_tuple", "[", "3", "]", ",", "bbox_tuple", "[", "2", "...
[ 70, 0 ]
[ 73, 71 ]
python
en
['en', 'es', 'en']
True
QuoteShellArgument
(arg, flavor)
Quote a string such that it will be interpreted as a single argument by the shell.
Quote a string such that it will be interpreted as a single argument by the shell.
def QuoteShellArgument(arg, flavor): """Quote a string such that it will be interpreted as a single argument by the shell.""" # Rather than attempting to enumerate the bad shell characters, just # whitelist common OK ones and quote anything else. if re.match(r'^[a-zA-Z0-9_=.\\/-]+$', arg): return arg # N...
[ "def", "QuoteShellArgument", "(", "arg", ",", "flavor", ")", ":", "# Rather than attempting to enumerate the bad shell characters, just", "# whitelist common OK ones and quote anything else.", "if", "re", ".", "match", "(", "r'^[a-zA-Z0-9_=.\\\\/-]+$'", ",", "arg", ")", ":", ...
[ 72, 0 ]
[ 81, 58 ]
python
en
['en', 'en', 'en']
True
Define
(d, flavor)
Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.
Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.
def Define(d, flavor): """Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.""" if flavor == 'win': # cl.exe replaces literal # characters with = in preprocesor definitions for # some reason. Octal-encode to work around that. d = d.replace('#', '\\%03o' % ord('#'))...
[ "def", "Define", "(", "d", ",", "flavor", ")", ":", "if", "flavor", "==", "'win'", ":", "# cl.exe replaces literal # characters with = in preprocesor definitions for", "# some reason. Octal-encode to work around that.", "d", "=", "d", ".", "replace", "(", "'#'", ",", "'...
[ 84, 0 ]
[ 91, 66 ]
python
en
['en', 'en', 'en']
True
AddArch
(output, arch)
Adds an arch string to an output path.
Adds an arch string to an output path.
def AddArch(output, arch): """Adds an arch string to an output path.""" output, extension = os.path.splitext(output) return '%s.%s%s' % (output, arch, extension)
[ "def", "AddArch", "(", "output", ",", "arch", ")", ":", "output", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "output", ")", "return", "'%s.%s%s'", "%", "(", "output", ",", "arch", ",", "extension", ")" ]
[ 94, 0 ]
[ 97, 46 ]
python
en
['en', 'en', 'en']
True
CalculateVariables
(default_variables, params)
Calculate additional variables for use in the build (called by gyp).
Calculate additional variables for use in the build (called by gyp).
def CalculateVariables(default_variables, params): """Calculate additional variables for use in the build (called by gyp).""" global generator_additional_non_configuration_keys global generator_additional_path_sections flavor = gyp.common.GetFlavor(params) if flavor == 'mac': default_variables.setdefault(...
[ "def", "CalculateVariables", "(", "default_variables", ",", "params", ")", ":", "global", "generator_additional_non_configuration_keys", "global", "generator_additional_path_sections", "flavor", "=", "gyp", ".", "common", ".", "GetFlavor", "(", "params", ")", "if", "fla...
[ 1593, 0 ]
[ 1643, 70 ]
python
en
['en', 'en', 'en']
True
ComputeOutputDir
(params)
Returns the path from the toplevel_dir to the build output directory.
Returns the path from the toplevel_dir to the build output directory.
def ComputeOutputDir(params): """Returns the path from the toplevel_dir to the build output directory.""" # generator_dir: relative path from pwd to where make puts build files. # Makes migrating from make to ninja easier, ninja doesn't put anything here. generator_dir = os.path.relpath(params['options'].genera...
[ "def", "ComputeOutputDir", "(", "params", ")", ":", "# generator_dir: relative path from pwd to where make puts build files.", "# Makes migrating from make to ninja easier, ninja doesn't put anything here.", "generator_dir", "=", "os", ".", "path", ".", "relpath", "(", "params", "[...
[ 1645, 0 ]
[ 1655, 66 ]
python
en
['en', 'en', 'en']
True
CalculateGeneratorInputInfo
(params)
Called by __init__ to initialize generator values based on params.
Called by __init__ to initialize generator values based on params.
def CalculateGeneratorInputInfo(params): """Called by __init__ to initialize generator values based on params.""" # E.g. "out/gypfiles" toplevel = params['options'].toplevel_dir qualified_out_dir = os.path.normpath(os.path.join( toplevel, ComputeOutputDir(params), 'gypfiles')) global generator_filelist...
[ "def", "CalculateGeneratorInputInfo", "(", "params", ")", ":", "# E.g. \"out/gypfiles\"", "toplevel", "=", "params", "[", "'options'", "]", ".", "toplevel_dir", "qualified_out_dir", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", ...
[ 1658, 0 ]
[ 1669, 3 ]
python
en
['en', 'en', 'en']
True
OpenOutput
(path, mode='w')
Open |path| for writing, creating directories if necessary.
Open |path| for writing, creating directories if necessary.
def OpenOutput(path, mode='w'): """Open |path| for writing, creating directories if necessary.""" gyp.common.EnsureDirExists(path) return open(path, mode)
[ "def", "OpenOutput", "(", "path", ",", "mode", "=", "'w'", ")", ":", "gyp", ".", "common", ".", "EnsureDirExists", "(", "path", ")", "return", "open", "(", "path", ",", "mode", ")" ]
[ 1672, 0 ]
[ 1675, 25 ]
python
en
['id', 'en', 'en']
True
GetDefaultConcurrentLinks
()
Returns a best-guess for a number of concurrent links.
Returns a best-guess for a number of concurrent links.
def GetDefaultConcurrentLinks(): """Returns a best-guess for a number of concurrent links.""" pool_size = int(os.environ.get('GYP_LINK_CONCURRENCY', 0)) if pool_size: return pool_size if sys.platform in ('win32', 'cygwin'): import ctypes class MEMORYSTATUSEX(ctypes.Structure): _fields_ = [ ...
[ "def", "GetDefaultConcurrentLinks", "(", ")", ":", "pool_size", "=", "int", "(", "os", ".", "environ", ".", "get", "(", "'GYP_LINK_CONCURRENCY'", ",", "0", ")", ")", "if", "pool_size", ":", "return", "pool_size", "if", "sys", ".", "platform", "in", "(", ...
[ 1685, 0 ]
[ 1737, 12 ]
python
en
['en', 'en', 'en']
True
_GetWinLinkRuleNameSuffix
(embed_manifest)
Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.
Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.
def _GetWinLinkRuleNameSuffix(embed_manifest): """Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.""" return '_embed' if embed_manifest else ''
[ "def", "_GetWinLinkRuleNameSuffix", "(", "embed_manifest", ")", ":", "return", "'_embed'", "if", "embed_manifest", "else", "''" ]
[ 1740, 0 ]
[ 1743, 43 ]
python
en
['en', 'en', 'en']
True
_AddWinLinkRules
(master_ninja, embed_manifest)
Adds link rules for Windows platform to |master_ninja|.
Adds link rules for Windows platform to |master_ninja|.
def _AddWinLinkRules(master_ninja, embed_manifest): """Adds link rules for Windows platform to |master_ninja|.""" def FullLinkCommand(ldcmd, out, binary_type): resource_name = { 'exe': '1', 'dll': '2', }[binary_type] return '%(python)s gyp-win-tool link-with-manifests $arch %(embed)s ' \ ...
[ "def", "_AddWinLinkRules", "(", "master_ninja", ",", "embed_manifest", ")", ":", "def", "FullLinkCommand", "(", "ldcmd", ",", "out", ",", "binary_type", ")", ":", "resource_name", "=", "{", "'exe'", ":", "'1'", ",", "'dll'", ":", "'2'", ",", "}", "[", "b...
[ 1746, 0 ]
[ 1792, 37 ]
python
en
['en', 'da', 'en']
True
Target.Linkable
(self)
Return true if this is a target that can be linked against.
Return true if this is a target that can be linked against.
def Linkable(self): """Return true if this is a target that can be linked against.""" return self.type in ('static_library', 'shared_library')
[ "def", "Linkable", "(", "self", ")", ":", "return", "self", ".", "type", "in", "(", "'static_library'", ",", "'shared_library'", ")" ]
[ 151, 2 ]
[ 153, 60 ]
python
en
['en', 'en', 'en']
True
Target.UsesToc
(self, flavor)
Return true if the target should produce a restat rule based on a TOC file.
Return true if the target should produce a restat rule based on a TOC file.
def UsesToc(self, flavor): """Return true if the target should produce a restat rule based on a TOC file.""" # For bundles, the .TOC should be produced for the binary, not for # FinalOutput(). But the naive approach would put the TOC file into the # bundle, so don't do this for bundles for now. ...
[ "def", "UsesToc", "(", "self", ",", "flavor", ")", ":", "# For bundles, the .TOC should be produced for the binary, not for", "# FinalOutput(). But the naive approach would put the TOC file into the", "# bundle, so don't do this for bundles for now.", "if", "flavor", "==", "'win'", "or...
[ 155, 2 ]
[ 163, 61 ]
python
en
['en', 'en', 'en']
True
Target.PreActionInput
(self, flavor)
Return the path, if any, that should be used as a dependency of any dependent action step.
Return the path, if any, that should be used as a dependency of any dependent action step.
def PreActionInput(self, flavor): """Return the path, if any, that should be used as a dependency of any dependent action step.""" if self.UsesToc(flavor): return self.FinalOutput() + '.TOC' return self.FinalOutput() or self.preaction_stamp
[ "def", "PreActionInput", "(", "self", ",", "flavor", ")", ":", "if", "self", ".", "UsesToc", "(", "flavor", ")", ":", "return", "self", ".", "FinalOutput", "(", ")", "+", "'.TOC'", "return", "self", ".", "FinalOutput", "(", ")", "or", "self", ".", "p...
[ 165, 2 ]
[ 170, 53 ]
python
en
['en', 'en', 'en']
True
Target.PreCompileInput
(self)
Return the path, if any, that should be used as a dependency of any dependent compile step.
Return the path, if any, that should be used as a dependency of any dependent compile step.
def PreCompileInput(self): """Return the path, if any, that should be used as a dependency of any dependent compile step.""" return self.actions_stamp or self.precompile_stamp
[ "def", "PreCompileInput", "(", "self", ")", ":", "return", "self", ".", "actions_stamp", "or", "self", ".", "precompile_stamp" ]
[ 172, 2 ]
[ 175, 54 ]
python
en
['en', 'en', 'en']
True
Target.FinalOutput
(self)
Return the last output of the target, which depends on all prior steps.
Return the last output of the target, which depends on all prior steps.
def FinalOutput(self): """Return the last output of the target, which depends on all prior steps.""" return self.bundle or self.binary or self.actions_stamp
[ "def", "FinalOutput", "(", "self", ")", ":", "return", "self", ".", "bundle", "or", "self", ".", "binary", "or", "self", ".", "actions_stamp" ]
[ 177, 2 ]
[ 180, 59 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.__init__
(self, hash_for_rules, target_outputs, base_dir, build_dir, output_file, toplevel_build, output_file_name, flavor, toplevel_dir=None)
base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative to this build_dir: path from source root to build output toplevel_dir: path to the toplevel directory
base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative to this build_dir: path from source root to build output toplevel_dir: path to the toplevel directory
def __init__(self, hash_for_rules, target_outputs, base_dir, build_dir, output_file, toplevel_build, output_file_name, flavor, toplevel_dir=None): """ base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative...
[ "def", "__init__", "(", "self", ",", "hash_for_rules", ",", "target_outputs", ",", "base_dir", ",", "build_dir", ",", "output_file", ",", "toplevel_build", ",", "output_file_name", ",", "flavor", ",", "toplevel_dir", "=", "None", ")", ":", "self", ".", "hash_f...
[ 208, 2 ]
[ 243, 61 ]
python
en
['en', 'error', 'th']
False
NinjaWriter.ExpandSpecial
(self, path, product_dir=None)
Expand specials like $!PRODUCT_DIR in |path|. If |product_dir| is None, assumes the cwd is already the product dir. Otherwise, |product_dir| is the relative path to the product dir.
Expand specials like $!PRODUCT_DIR in |path|.
def ExpandSpecial(self, path, product_dir=None): """Expand specials like $!PRODUCT_DIR in |path|. If |product_dir| is None, assumes the cwd is already the product dir. Otherwise, |product_dir| is the relative path to the product dir. """ PRODUCT_DIR = '$!PRODUCT_DIR' if PRODUCT_DIR in pat...
[ "def", "ExpandSpecial", "(", "self", ",", "path", ",", "product_dir", "=", "None", ")", ":", "PRODUCT_DIR", "=", "'$!PRODUCT_DIR'", "if", "PRODUCT_DIR", "in", "path", ":", "if", "product_dir", ":", "path", "=", "path", ".", "replace", "(", "PRODUCT_DIR", "...
[ 245, 2 ]
[ 273, 15 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GypPathToNinja
(self, path, env=None)
Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|. See the above discourse on path conversions.
Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|.
def GypPathToNinja(self, path, env=None): """Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|. See the above discourse on path conversions.""" if env: if self.flavor == 'mac': path = gyp.xcode_emulation.ExpandEnvVars(path, env...
[ "def", "GypPathToNinja", "(", "self", ",", "path", ",", "env", "=", "None", ")", ":", "if", "env", ":", "if", "self", ".", "flavor", "==", "'mac'", ":", "path", "=", "gyp", ".", "xcode_emulation", ".", "ExpandEnvVars", "(", "path", ",", "env", ")", ...
[ 287, 2 ]
[ 305, 67 ]
python
en
['en', 'haw', 'en']
True
NinjaWriter.GypPathToUniqueOutput
(self, path, qualified=True)
Translate a gyp path to a ninja path for writing output. If qualified is True, qualify the resulting filename with the name of the target. This is necessary when e.g. compiling the same path twice for two separate output targets. See the above discourse on path conversions.
Translate a gyp path to a ninja path for writing output.
def GypPathToUniqueOutput(self, path, qualified=True): """Translate a gyp path to a ninja path for writing output. If qualified is True, qualify the resulting filename with the name of the target. This is necessary when e.g. compiling the same path twice for two separate output targets. See the a...
[ "def", "GypPathToUniqueOutput", "(", "self", ",", "path", ",", "qualified", "=", "True", ")", ":", "path", "=", "self", ".", "ExpandSpecial", "(", "path", ")", "assert", "not", "path", ".", "startswith", "(", "'$'", ")", ",", "path", "# Translate the path ...
[ 307, 2 ]
[ 341, 56 ]
python
en
['en', 'haw', 'en']
True
NinjaWriter.WriteCollapsedDependencies
(self, name, targets, order_only=None)
Given a list of targets, return a path for a single file representing the result of building all the targets or None. Uses a stamp file if necessary.
Given a list of targets, return a path for a single file representing the result of building all the targets or None.
def WriteCollapsedDependencies(self, name, targets, order_only=None): """Given a list of targets, return a path for a single file representing the result of building all the targets or None. Uses a stamp file if necessary.""" assert targets == filter(None, targets), targets if len(targets) == 0: ...
[ "def", "WriteCollapsedDependencies", "(", "self", ",", "name", ",", "targets", ",", "order_only", "=", "None", ")", ":", "assert", "targets", "==", "filter", "(", "None", ",", "targets", ")", ",", "targets", "if", "len", "(", "targets", ")", "==", "0", ...
[ 343, 2 ]
[ 357, 21 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteSpec
(self, spec, config_name, generator_flags)
The main entry point for NinjaWriter: write the build rules for a spec. Returns a Target object, which represents the output paths for this spec. Returns None if there are no outputs (e.g. a settings-only 'none' type target).
The main entry point for NinjaWriter: write the build rules for a spec.
def WriteSpec(self, spec, config_name, generator_flags): """The main entry point for NinjaWriter: write the build rules for a spec. Returns a Target object, which represents the output paths for this spec. Returns None if there are no outputs (e.g. a settings-only 'none' type target).""" self.conf...
[ "def", "WriteSpec", "(", "self", ",", "spec", ",", "config_name", ",", "generator_flags", ")", ":", "self", ".", "config_name", "=", "config_name", "self", ".", "name", "=", "spec", "[", "'target_name'", "]", "self", ".", "toolset", "=", "spec", "[", "'t...
[ 363, 2 ]
[ 501, 22 ]
python
en
['en', 'en', 'en']
True
NinjaWriter._WinIdlRule
(self, source, prebuild, outputs)
Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.
Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.
def _WinIdlRule(self, source, prebuild, outputs): """Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.""" outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( source, self.config_name) outdir = self.GypPathToNinja(outdir) def fi...
[ "def", "_WinIdlRule", "(", "self", ",", "source", ",", "prebuild", ",", "outputs", ")", ":", "outdir", ",", "output", ",", "vars", ",", "flags", "=", "self", ".", "msvs_settings", ".", "GetIdlBuildData", "(", "source", ",", "self", ".", "config_name", ")...
[ 503, 2 ]
[ 525, 26 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteWinIdlFiles
(self, spec, prebuild)
Writes rules to match MSVS's implicit idl handling.
Writes rules to match MSVS's implicit idl handling.
def WriteWinIdlFiles(self, spec, prebuild): """Writes rules to match MSVS's implicit idl handling.""" assert self.flavor == 'win' if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): return [] outputs = [] for source in filter(lambda x: x.endswith('.idl'), spec['sources']): self._Wi...
[ "def", "WriteWinIdlFiles", "(", "self", ",", "spec", ",", "prebuild", ")", ":", "assert", "self", ".", "flavor", "==", "'win'", "if", "self", ".", "msvs_settings", ".", "HasExplicitIdlRulesOrActions", "(", "spec", ")", ":", "return", "[", "]", "outputs", "...
[ 527, 2 ]
[ 535, 18 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteActionsRulesCopies
(self, spec, extra_sources, prebuild, mac_bundle_depends)
Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.
Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.
def WriteActionsRulesCopies(self, spec, extra_sources, prebuild, mac_bundle_depends): """Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.""" outputs = [] if self.is_mac_bundle: mac_bundle_resources = spec.get('mac...
[ "def", "WriteActionsRulesCopies", "(", "self", ",", "spec", ",", "extra_sources", ",", "prebuild", ",", "mac_bundle_depends", ")", ":", "outputs", "=", "[", "]", "if", "self", ".", "is_mac_bundle", ":", "mac_bundle_resources", "=", "spec", ".", "get", "(", "...
[ 537, 2 ]
[ 569, 16 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GenerateDescription
(self, verb, message, fallback)
Generate and return a description of a build step. |verb| is the short summary, e.g. ACTION or RULE. |message| is a hand-written description, or None if not available. |fallback| is the gyp-level name of the step, usable as a fallback.
Generate and return a description of a build step.
def GenerateDescription(self, verb, message, fallback): """Generate and return a description of a build step. |verb| is the short summary, e.g. ACTION or RULE. |message| is a hand-written description, or None if not available. |fallback| is the gyp-level name of the step, usable as a fallback. """ ...
[ "def", "GenerateDescription", "(", "self", ",", "verb", ",", "message", ",", "fallback", ")", ":", "if", "self", ".", "toolset", "!=", "'target'", ":", "verb", "+=", "'(%s)'", "%", "self", ".", "toolset", "if", "message", ":", "return", "'%s %s'", "%", ...
[ 571, 2 ]
[ 583, 54 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteMacBundleResources
(self, resources, bundle_depends)
Writes ninja edges for 'mac_bundle_resources'.
Writes ninja edges for 'mac_bundle_resources'.
def WriteMacBundleResources(self, resources, bundle_depends): """Writes ninja edges for 'mac_bundle_resources'.""" xcassets = [] for output, res in gyp.xcode_emulation.GetMacBundleResources( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, map(self.GypPathToNinja, resources))...
[ "def", "WriteMacBundleResources", "(", "self", ",", "resources", ",", "bundle_depends", ")", ":", "xcassets", "=", "[", "]", "for", "output", ",", "res", "in", "gyp", ".", "xcode_emulation", ".", "GetMacBundleResources", "(", "generator_default_variables", "[", ...
[ 764, 2 ]
[ 779, 19 ]
python
en
['nn', 'jv', 'en']
False
NinjaWriter.WriteMacXCassets
(self, xcassets, bundle_depends)
Writes ninja edges for 'mac_bundle_resources' .xcassets files. This add an invocation of 'actool' via the 'mac_tool.py' helper script. It assumes that the assets catalogs define at least one imageset and thus an Assets.car file will be generated in the application resources directory. If this is not th...
Writes ninja edges for 'mac_bundle_resources' .xcassets files.
def WriteMacXCassets(self, xcassets, bundle_depends): """Writes ninja edges for 'mac_bundle_resources' .xcassets files. This add an invocation of 'actool' via the 'mac_tool.py' helper script. It assumes that the assets catalogs define at least one imageset and thus an Assets.car file will be generated ...
[ "def", "WriteMacXCassets", "(", "self", ",", "xcassets", ",", "bundle_depends", ")", ":", "if", "not", "xcassets", ":", "return", "extra_arguments", "=", "{", "}", "settings_to_arg", "=", "{", "'XCASSETS_APP_ICON'", ":", "'app-icon'", ",", "'XCASSETS_LAUNCH_IMAGE'...
[ 781, 2 ]
[ 825, 29 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteMacInfoPlist
(self, partial_info_plist, bundle_depends)
Write build rules for bundle Info.plist files.
Write build rules for bundle Info.plist files.
def WriteMacInfoPlist(self, partial_info_plist, bundle_depends): """Write build rules for bundle Info.plist files.""" info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, self.GypPathToNinja) if not info_p...
[ "def", "WriteMacInfoPlist", "(", "self", ",", "partial_info_plist", ",", "bundle_depends", ")", ":", "info_plist", ",", "out", ",", "defines", ",", "extra_env", "=", "gyp", ".", "xcode_emulation", ".", "GetMacInfoPlist", "(", "generator_default_variables", "[", "'...
[ 827, 2 ]
[ 859, 30 ]
python
en
['en', 'fr', 'en']
True
NinjaWriter.WriteSources
(self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec)
Write build rules to compile all of |sources|.
Write build rules to compile all of |sources|.
def WriteSources(self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec): """Write build rules to compile all of |sources|.""" if self.toolset == 'host': self.ninja.variable('ar', '$ar_host') self.ninja.variable('cc', '$cc_host') self.ninja.vari...
[ "def", "WriteSources", "(", "self", ",", "ninja_file", ",", "config_name", ",", "config", ",", "sources", ",", "predepends", ",", "precompiled_header", ",", "spec", ")", ":", "if", "self", ".", "toolset", "==", "'host'", ":", "self", ".", "ninja", ".", "...
[ 861, 2 ]
[ 881, 33 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteSourcesForArch
(self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, arch=None)
Write build rules to compile all of |sources|.
Write build rules to compile all of |sources|.
def WriteSourcesForArch(self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, arch=None): """Write build rules to compile all of |sources|.""" extra_defines = [] if self.flavor == 'mac': cflags = self.xcode_settings.GetCflags(config_name, arch...
[ "def", "WriteSourcesForArch", "(", "self", ",", "ninja_file", ",", "config_name", ",", "config", ",", "sources", ",", "predepends", ",", "precompiled_header", ",", "spec", ",", "arch", "=", "None", ")", ":", "extra_defines", "=", "[", "]", "if", "self", "....
[ 883, 2 ]
[ 1041, 18 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WritePchTargets
(self, ninja_file, pch_commands)
Writes ninja rules to compile prefix headers.
Writes ninja rules to compile prefix headers.
def WritePchTargets(self, ninja_file, pch_commands): """Writes ninja rules to compile prefix headers.""" if not pch_commands: return for gch, lang_flag, lang, input in pch_commands: var_name = { 'c': 'cflags_pch_c', 'cc': 'cflags_pch_cc', 'm': 'cflags_pch_objc', ...
[ "def", "WritePchTargets", "(", "self", ",", "ninja_file", ",", "pch_commands", ")", ":", "if", "not", "pch_commands", ":", "return", "for", "gch", ",", "lang_flag", ",", "lang", ",", "input", "in", "pch_commands", ":", "var_name", "=", "{", "'c'", ":", "...
[ 1043, 2 ]
[ 1058, 74 ]
python
en
['en', 'et', 'en']
True
NinjaWriter.WriteLink
(self, spec, config_name, config, link_deps)
Write out a link step. Fills out target.binary.
Write out a link step. Fills out target.binary.
def WriteLink(self, spec, config_name, config, link_deps): """Write out a link step. Fills out target.binary. """ if self.flavor != 'mac' or len(self.archs) == 1: return self.WriteLinkForArch( self.ninja, spec, config_name, config, link_deps) else: output = self.ComputeOutput(spec) ...
[ "def", "WriteLink", "(", "self", ",", "spec", ",", "config_name", ",", "config", ",", "link_deps", ")", ":", "if", "self", ".", "flavor", "!=", "'mac'", "or", "len", "(", "self", ".", "archs", ")", "==", "1", ":", "return", "self", ".", "WriteLinkFor...
[ 1060, 2 ]
[ 1085, 19 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteLinkForArch
(self, ninja_file, spec, config_name, config, link_deps, arch=None)
Write out a link step. Fills out target.binary.
Write out a link step. Fills out target.binary.
def WriteLinkForArch(self, ninja_file, spec, config_name, config, link_deps, arch=None): """Write out a link step. Fills out target.binary. """ command = { 'executable': 'link', 'loadable_module': 'solink_module', 'shared_library': 'solink', }[spec['type']] ...
[ "def", "WriteLinkForArch", "(", "self", ",", "ninja_file", ",", "spec", ",", "config_name", ",", "config", ",", "link_deps", ",", "arch", "=", "None", ")", ":", "command", "=", "{", "'executable'", ":", "'link'", ",", "'loadable_module'", ":", "'solink_modul...
[ 1087, 2 ]
[ 1260, 24 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetToolchainEnv
(self, additional_settings=None)
Returns the variables toolchain would set for build steps.
Returns the variables toolchain would set for build steps.
def GetToolchainEnv(self, additional_settings=None): """Returns the variables toolchain would set for build steps.""" env = self.GetSortedXcodeEnv(additional_settings=additional_settings) if self.flavor == 'win': env = self.GetMsvsToolchainEnv( additional_settings=additional_settings) re...
[ "def", "GetToolchainEnv", "(", "self", ",", "additional_settings", "=", "None", ")", ":", "env", "=", "self", ".", "GetSortedXcodeEnv", "(", "additional_settings", "=", "additional_settings", ")", "if", "self", ".", "flavor", "==", "'win'", ":", "env", "=", ...
[ 1332, 2 ]
[ 1338, 14 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetMsvsToolchainEnv
(self, additional_settings=None)
Returns the variables Visual Studio would set for build steps.
Returns the variables Visual Studio would set for build steps.
def GetMsvsToolchainEnv(self, additional_settings=None): """Returns the variables Visual Studio would set for build steps.""" return self.msvs_settings.GetVSMacroEnv('$!PRODUCT_DIR', config=self.config_name)
[ "def", "GetMsvsToolchainEnv", "(", "self", ",", "additional_settings", "=", "None", ")", ":", "return", "self", ".", "msvs_settings", ".", "GetVSMacroEnv", "(", "'$!PRODUCT_DIR'", ",", "config", "=", "self", ".", "config_name", ")" ]
[ 1340, 2 ]
[ 1343, 69 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetSortedXcodeEnv
(self, additional_settings=None)
Returns the variables Xcode would set for build steps.
Returns the variables Xcode would set for build steps.
def GetSortedXcodeEnv(self, additional_settings=None): """Returns the variables Xcode would set for build steps.""" assert self.abs_build_dir abs_build_dir = self.abs_build_dir return gyp.xcode_emulation.GetSortedXcodeEnv( self.xcode_settings, abs_build_dir, os.path.join(abs_build_dir, s...
[ "def", "GetSortedXcodeEnv", "(", "self", ",", "additional_settings", "=", "None", ")", ":", "assert", "self", ".", "abs_build_dir", "abs_build_dir", "=", "self", ".", "abs_build_dir", "return", "gyp", ".", "xcode_emulation", ".", "GetSortedXcodeEnv", "(", "self", ...
[ 1345, 2 ]
[ 1352, 28 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetSortedXcodePostbuildEnv
(self)
Returns the variables Xcode would set for postbuild steps.
Returns the variables Xcode would set for postbuild steps.
def GetSortedXcodePostbuildEnv(self): """Returns the variables Xcode would set for postbuild steps.""" postbuild_settings = {} # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. # TODO(thakis): It would be nice to have some general mechanism instead. strip_save_file = self.xcode_settings.GetPer...
[ "def", "GetSortedXcodePostbuildEnv", "(", "self", ")", ":", "postbuild_settings", "=", "{", "}", "# CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack.", "# TODO(thakis): It would be nice to have some general mechanism instead.", "strip_save_file", "=", "self", ".", "xcode_settings...
[ 1354, 2 ]
[ 1363, 73 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.AppendPostbuildVariable
(self, variables, spec, output, binary, is_command_start=False)
Adds a 'postbuild' variable if there is a postbuild for |output|.
Adds a 'postbuild' variable if there is a postbuild for |output|.
def AppendPostbuildVariable(self, variables, spec, output, binary, is_command_start=False): """Adds a 'postbuild' variable if there is a postbuild for |output|.""" postbuild = self.GetPostbuildCommand(spec, output, binary, is_command_start) if postbuild: variables.append(...
[ "def", "AppendPostbuildVariable", "(", "self", ",", "variables", ",", "spec", ",", "output", ",", "binary", ",", "is_command_start", "=", "False", ")", ":", "postbuild", "=", "self", ".", "GetPostbuildCommand", "(", "spec", ",", "output", ",", "binary", ",",...
[ 1365, 2 ]
[ 1370, 49 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetPostbuildCommand
(self, spec, output, output_binary, is_command_start)
Returns a shell command that runs all the postbuilds, and removes |output| if any of them fails. If |is_command_start| is False, then the returned string will start with ' && '.
Returns a shell command that runs all the postbuilds, and removes |output| if any of them fails. If |is_command_start| is False, then the returned string will start with ' && '.
def GetPostbuildCommand(self, spec, output, output_binary, is_command_start): """Returns a shell command that runs all the postbuilds, and removes |output| if any of them fails. If |is_command_start| is False, then the returned string will start with ' && '.""" if not self.xcode_settings or spec['type']...
[ "def", "GetPostbuildCommand", "(", "self", ",", "spec", ",", "output", ",", "output_binary", ",", "is_command_start", ")", ":", "if", "not", "self", ".", "xcode_settings", "or", "spec", "[", "'type'", "]", "==", "'none'", "or", "not", "output", ":", "retur...
[ 1372, 2 ]
[ 1406, 38 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.ComputeExportEnvString
(self, env)
Given an environment, returns a string looking like 'export FOO=foo; export BAR="${FOO} bar;' that exports |env| to the shell.
Given an environment, returns a string looking like 'export FOO=foo; export BAR="${FOO} bar;' that exports |env| to the shell.
def ComputeExportEnvString(self, env): """Given an environment, returns a string looking like 'export FOO=foo; export BAR="${FOO} bar;' that exports |env| to the shell.""" export_str = [] for k, v in env: export_str.append('export %s=%s;' % (k, ninja_syntax.escape(gyp.common.Enco...
[ "def", "ComputeExportEnvString", "(", "self", ",", "env", ")", ":", "export_str", "=", "[", "]", "for", "k", ",", "v", "in", "env", ":", "export_str", ".", "append", "(", "'export %s=%s;'", "%", "(", "k", ",", "ninja_syntax", ".", "escape", "(", "gyp",...
[ 1408, 2 ]
[ 1416, 31 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.ComputeMacBundleOutput
(self)
Return the 'output' (full output path) to a bundle output directory.
Return the 'output' (full output path) to a bundle output directory.
def ComputeMacBundleOutput(self): """Return the 'output' (full output path) to a bundle output directory.""" assert self.is_mac_bundle path = generator_default_variables['PRODUCT_DIR'] return self.ExpandSpecial( os.path.join(path, self.xcode_settings.GetWrapperName()))
[ "def", "ComputeMacBundleOutput", "(", "self", ")", ":", "assert", "self", ".", "is_mac_bundle", "path", "=", "generator_default_variables", "[", "'PRODUCT_DIR'", "]", "return", "self", ".", "ExpandSpecial", "(", "os", ".", "path", ".", "join", "(", "path", ","...
[ 1418, 2 ]
[ 1423, 65 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.ComputeOutputFileName
(self, spec, type=None)
Compute the filename of the final output for the current target.
Compute the filename of the final output for the current target.
def ComputeOutputFileName(self, spec, type=None): """Compute the filename of the final output for the current target.""" if not type: type = spec['type'] default_variables = copy.copy(generator_default_variables) CalculateVariables(default_variables, {'flavor': self.flavor}) # Compute filena...
[ "def", "ComputeOutputFileName", "(", "self", ",", "spec", ",", "type", "=", "None", ")", ":", "if", "not", "type", ":", "type", "=", "spec", "[", "'type'", "]", "default_variables", "=", "copy", ".", "copy", "(", "generator_default_variables", ")", "Calcul...
[ 1425, 2 ]
[ 1473, 56 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.ComputeOutput
(self, spec, arch=None)
Compute the path for the final output of the spec.
Compute the path for the final output of the spec.
def ComputeOutput(self, spec, arch=None): """Compute the path for the final output of the spec.""" type = spec['type'] if self.flavor == 'win': override = self.msvs_settings.GetOutputName(self.config_name, self.ExpandSpecial) if override: ...
[ "def", "ComputeOutput", "(", "self", ",", "spec", ",", "arch", "=", "None", ")", ":", "type", "=", "spec", "[", "'type'", "]", "if", "self", ".", "flavor", "==", "'win'", ":", "override", "=", "self", ".", "msvs_settings", ".", "GetOutputName", "(", ...
[ 1475, 2 ]
[ 1518, 66 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteNewNinjaRule
(self, name, args, description, is_cygwin, env, pool, depfile=None)
Write out a new ninja "rule" statement for a given command. Returns the name of the new rule, and a copy of |args| with variables expanded.
Write out a new ninja "rule" statement for a given command.
def WriteNewNinjaRule(self, name, args, description, is_cygwin, env, pool, depfile=None): """Write out a new ninja "rule" statement for a given command. Returns the name of the new rule, and a copy of |args| with variables expanded.""" if self.flavor == 'win': args = [sel...
[ "def", "WriteNewNinjaRule", "(", "self", ",", "name", ",", "args", ",", "description", ",", "is_cygwin", ",", "env", ",", "pool", ",", "depfile", "=", "None", ")", ":", "if", "self", ".", "flavor", "==", "'win'", ":", "args", "=", "[", "self", ".", ...
[ 1526, 2 ]
[ 1590, 26 ]
python
en
['en', 'en', 'en']
True
test_anonymizer__is_parent_class_recognized
()
What does this test and why? The method Anonymizer._is_parent_class_recognized() should return the name of the parent class if it is or is a subclass of one of the classes_to_check. If not, it should return None. It should do so regardless of the parameter used to pass in the object definition (object_, object...
What does this test and why? The method Anonymizer._is_parent_class_recognized() should return the name of the parent class if it is or is a subclass of one of the classes_to_check. If not, it should return None. It should do so regardless of the parameter used to pass in the object definition (object_, object...
def test_anonymizer__is_parent_class_recognized(): """ What does this test and why? The method Anonymizer._is_parent_class_recognized() should return the name of the parent class if it is or is a subclass of one of the classes_to_check. If not, it should return None. It should do so regardless of the parame...
[ "def", "test_anonymizer__is_parent_class_recognized", "(", ")", ":", "anonymizer", "=", "Anonymizer", "(", ")", "# classes_to_check in order of inheritance hierarchy", "classes_to_check", "=", "[", "TestClass", ",", "BaseTestClass", "]", "assert", "(", "anonymizer", ".", ...
[ 66, 0 ]
[ 152, 5 ]
python
en
['en', 'error', 'th']
False
build_docs
( context: DataContext, usage_stats_event: str, site_names: Optional[List[str]] = None, view: Optional[bool] = True, assume_yes: Optional[bool] = False, )
Build documentation in a context
Build documentation in a context
def build_docs( context: DataContext, usage_stats_event: str, site_names: Optional[List[str]] = None, view: Optional[bool] = True, assume_yes: Optional[bool] = False, ): """Build documentation in a context""" logger.debug("Starting cli.datasource.build_docs") index_page_locator_infos: D...
[ "def", "build_docs", "(", "context", ":", "DataContext", ",", "usage_stats_event", ":", "str", ",", "site_names", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "view", ":", "Optional", "[", "bool", "]", "=", "True", ",", "assume...
[ 8, 0 ]
[ 40, 79 ]
python
en
['en', 'en', 'en']
True
ExpectColumnDistinctValuesToContainSet.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validating that user has inputted a value set and that configuration has been initialized
Validating that user has inputted a value set and that configuration has been initialized
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """Validating that user has inputted a value set and that configuration has been initialized""" super().validate_configuration(configuration) try: assert "value_set" in configuration.kwargs, "value_...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "try", ":", "assert", "\"value_set\"", "in", "configur...
[ 47, 4 ]
[ 62, 19 ]
python
en
['en', 'en', 'en']
True
_AddTool
(tool)
Adds a tool to the four dictionaries used to process settings. This only defines the tool. Each setting also needs to be added. Args: tool: The _Tool object to be added.
Adds a tool to the four dictionaries used to process settings.
def _AddTool(tool): """Adds a tool to the four dictionaries used to process settings. This only defines the tool. Each setting also needs to be added. Args: tool: The _Tool object to be added. """ _msvs_validators[tool.msvs_name] = {} _msbuild_validators[tool.msbuild_name] = {} _msvs_to_msbuild_con...
[ "def", "_AddTool", "(", "tool", ")", ":", "_msvs_validators", "[", "tool", ".", "msvs_name", "]", "=", "{", "}", "_msbuild_validators", "[", "tool", ".", "msbuild_name", "]", "=", "{", "}", "_msvs_to_msbuild_converters", "[", "tool", ".", "msvs_name", "]", ...
[ 47, 0 ]
[ 58, 59 ]
python
en
['en', 'en', 'en']
True
_GetMSBuildToolSettings
(msbuild_settings, tool)
Returns an MSBuild tool dictionary. Creates it if needed.
Returns an MSBuild tool dictionary. Creates it if needed.
def _GetMSBuildToolSettings(msbuild_settings, tool): """Returns an MSBuild tool dictionary. Creates it if needed.""" return msbuild_settings.setdefault(tool.msbuild_name, {})
[ "def", "_GetMSBuildToolSettings", "(", "msbuild_settings", ",", "tool", ")", ":", "return", "msbuild_settings", ".", "setdefault", "(", "tool", ".", "msbuild_name", ",", "{", "}", ")" ]
[ 61, 0 ]
[ 63, 59 ]
python
en
['en', 'en', 'en']
True
_Same
(tool, name, setting_type)
Defines a setting that has the same name in MSVS and MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting.
Defines a setting that has the same name in MSVS and MSBuild.
def _Same(tool, name, setting_type): """Defines a setting that has the same name in MSVS and MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting. """ _Renamed(tool, name, name, setting_type)
[ "def", "_Same", "(", "tool", ",", "name", ",", "setting_type", ")", ":", "_Renamed", "(", "tool", ",", "name", ",", "name", ",", "setting_type", ")" ]
[ 232, 0 ]
[ 240, 42 ]
python
en
['en', 'en', 'en']
True
_Renamed
(tool, msvs_name, msbuild_name, setting_type)
Defines a setting for which the name has changed. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_name: the name of the MSVS setting. msbuild_name: the name of the MSBuild setting. setting_type: the type of this setting.
Defines a setting for which the name has changed.
def _Renamed(tool, msvs_name, msbuild_name, setting_type): """Defines a setting for which the name has changed. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_name: the name of the MSVS setting. msbuild_name: the name of the MSBuild setting. setting_type: the t...
[ "def", "_Renamed", "(", "tool", ",", "msvs_name", ",", "msbuild_name", ",", "setting_type", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "msbuild_tool_settings", "=", "_GetMSBuildToolSettings", "(", "msbuild_settings", ",", "tool...
[ 243, 0 ]
[ 260, 69 ]
python
en
['en', 'en', 'en']
True
_MovedAndRenamed
(tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type)
Defines a setting that may have moved to a new section. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_settings_name: the MSVS name of the setting. msbuild_tool_name: the name of the MSBuild tool to place the setting under. msbuild_settings_name: the MSBuild name...
Defines a setting that may have moved to a new section.
def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type): """Defines a setting that may have moved to a new section. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_settings_name: the MSVS name of the se...
[ "def", "_MovedAndRenamed", "(", "tool", ",", "msvs_settings_name", ",", "msbuild_tool_name", ",", "msbuild_settings_name", ",", "setting_type", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "tool_settings", "=", "msbuild_settings", ...
[ 268, 0 ]
[ 288, 78 ]
python
en
['en', 'en', 'en']
True
_MSVSOnly
(tool, name, setting_type)
Defines a setting that is only found in MSVS. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting.
Defines a setting that is only found in MSVS.
def _MSVSOnly(tool, name, setting_type): """Defines a setting that is only found in MSVS. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting. """ def _Translate(unused_value, unused_msbuild_settings)...
[ "def", "_MSVSOnly", "(", "tool", ",", "name", ",", "setting_type", ")", ":", "def", "_Translate", "(", "unused_value", ",", "unused_msbuild_settings", ")", ":", "# Since this is for MSVS only settings, no translation will happen.", "pass", "_msvs_validators", "[", "tool",...
[ 291, 0 ]
[ 305, 64 ]
python
en
['en', 'en', 'en']
True
_MSBuildOnly
(tool, name, setting_type)
Defines a setting that is only found in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting.
Defines a setting that is only found in MSBuild.
def _MSBuildOnly(tool, name, setting_type): """Defines a setting that is only found in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting. """ def _Translate(value, msbuild_settings): # ...
[ "def", "_MSBuildOnly", "(", "tool", ",", "name", ",", "setting_type", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "# Let msbuild-only properties get translated as-is from msvs_settings.", "tool_settings", "=", "msbuild_settings", ".", ...
[ 308, 0 ]
[ 323, 64 ]
python
en
['en', 'en', 'en']
True
_ConvertedToAdditionalOption
(tool, msvs_name, flag)
Defines a setting that's handled via a command line option in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_name: the name of the MSVS setting that if 'true' becomes a flag flag: the flag to insert at the end of the AdditionalOptions
Defines a setting that's handled via a command line option in MSBuild.
def _ConvertedToAdditionalOption(tool, msvs_name, flag): """Defines a setting that's handled via a command line option in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. msvs_name: the name of the MSVS setting that if 'true' becomes a flag flag: the flag to inse...
[ "def", "_ConvertedToAdditionalOption", "(", "tool", ",", "msvs_name", ",", "flag", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "if", "value", "==", "'true'", ":", "tool_settings", "=", "_GetMSBuildToolSettings", "(", "msbuild_...
[ 326, 0 ]
[ 344, 69 ]
python
en
['en', 'en', 'en']
True
_ValidateExclusionSetting
(setting, settings, error_msg, stderr=sys.stderr)
Verify that 'setting' is valid if it is generated from an exclusion list. If the setting appears to be generated from an exclusion list, the root name is checked. Args: setting: A string that is the setting name to validate settings: A dictionary where the keys are valid settings error_msg:...
Verify that 'setting' is valid if it is generated from an exclusion list.
def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr): """Verify that 'setting' is valid if it is generated from an exclusion list. If the setting appears to be generated from an exclusion list, the root name is checked. Args: setting: A string that is the setting name to vali...
[ "def", "_ValidateExclusionSetting", "(", "setting", ",", "settings", ",", "error_msg", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "# This may be unrecognized because it's an exclusion list. If the", "# setting name has the _excluded suffix, then check the root name.", "u...
[ 380, 0 ]
[ 402, 30 ]
python
en
['en', 'en', 'en']
True
FixVCMacroSlashes
(s)
Replace macros which have excessive following slashes. These macros are known to have a built-in trailing slash. Furthermore, many scripts hiccup on processing paths with extra slashes in the middle. This list is probably not exhaustive. Add as needed.
Replace macros which have excessive following slashes.
def FixVCMacroSlashes(s): """Replace macros which have excessive following slashes. These macros are known to have a built-in trailing slash. Furthermore, many scripts hiccup on processing paths with extra slashes in the middle. This list is probably not exhaustive. Add as needed. """ if '$' in s: s ...
[ "def", "FixVCMacroSlashes", "(", "s", ")", ":", "if", "'$'", "in", "s", ":", "s", "=", "fix_vc_macro_slashes_regex", ".", "sub", "(", "r'\\1'", ",", "s", ")", "return", "s" ]
[ 405, 0 ]
[ 415, 10 ]
python
en
['en', 'en', 'en']
True
ConvertVCMacrosToMSBuild
(s)
Convert the MSVS macros found in the string to the MSBuild equivalent. This list is probably not exhaustive. Add as needed.
Convert the MSVS macros found in the string to the MSBuild equivalent.
def ConvertVCMacrosToMSBuild(s): """Convert the MSVS macros found in the string to the MSBuild equivalent. This list is probably not exhaustive. Add as needed. """ if '$' in s: replace_map = { '$(ConfigurationName)': '$(Configuration)', '$(InputDir)': '%(RelativeDir)', '$(InputExt)...
[ "def", "ConvertVCMacrosToMSBuild", "(", "s", ")", ":", "if", "'$'", "in", "s", ":", "replace_map", "=", "{", "'$(ConfigurationName)'", ":", "'$(Configuration)'", ",", "'$(InputDir)'", ":", "'%(RelativeDir)'", ",", "'$(InputExt)'", ":", "'%(Extension)'", ",", "'$(I...
[ 418, 0 ]
[ 438, 10 ]
python
en
['en', 'en', 'en']
True
ConvertToMSBuildSettings
(msvs_settings, stderr=sys.stderr)
Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). Args: msvs_settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages. Returns: A dictionary of MSBui...
Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). Args: msvs_settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream ...
[ "def", "ConvertToMSBuildSettings", "(", "msvs_settings", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "msbuild_settings", "=", "{", "}", "for", "msvs_tool_name", ",", "msvs_tool_settings", "in", "msvs_settings", ".", "iteritems", "(", ")", ":", "if", "m...
[ 441, 0 ]
[ 476, 25 ]
python
en
['en', 'en', 'en']
True
ValidateMSVSSettings
(settings, stderr=sys.stderr)
Validates that the names of the settings are valid for MSVS. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages.
Validates that the names of the settings are valid for MSVS.
def ValidateMSVSSettings(settings, stderr=sys.stderr): """Validates that the names of the settings are valid for MSVS. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages...
[ "def", "ValidateMSVSSettings", "(", "settings", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "_ValidateSettings", "(", "_msvs_validators", ",", "settings", ",", "stderr", ")" ]
[ 479, 0 ]
[ 487, 55 ]
python
en
['en', 'en', 'en']
True
ValidateMSBuildSettings
(settings, stderr=sys.stderr)
Validates that the names of the settings are valid for MSBuild. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages.
Validates that the names of the settings are valid for MSBuild.
def ValidateMSBuildSettings(settings, stderr=sys.stderr): """Validates that the names of the settings are valid for MSBuild. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error me...
[ "def", "ValidateMSBuildSettings", "(", "settings", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "_ValidateSettings", "(", "_msbuild_validators", ",", "settings", ",", "stderr", ")" ]
[ 490, 0 ]
[ 498, 58 ]
python
en
['en', 'en', 'en']
True
_ValidateSettings
(validators, settings, stderr)
Validates that the settings are valid for MSBuild or MSVS. We currently only validate the names of the settings, not their values. Args: validators: A dictionary of tools and their validators. settings: A dictionary. The key is the tool name. The values are themselves dictionaries of setti...
Validates that the settings are valid for MSBuild or MSVS.
def _ValidateSettings(validators, settings, stderr): """Validates that the settings are valid for MSBuild or MSVS. We currently only validate the names of the settings, not their values. Args: validators: A dictionary of tools and their validators. settings: A dictionary. The key is the tool name. ...
[ "def", "_ValidateSettings", "(", "validators", ",", "settings", ",", "stderr", ")", ":", "for", "tool_name", "in", "settings", ":", "if", "tool_name", "in", "validators", ":", "tool_validators", "=", "validators", "[", "tool_name", "]", "for", "setting", ",", ...
[ 501, 0 ]
[ 530, 68 ]
python
en
['en', 'en', 'en']
True
_Type.ValidateMSVS
(self, value)
Verifies that the value is legal for MSVS. Args: value: the value to check for this type. Raises: ValueError if value is not valid for MSVS.
Verifies that the value is legal for MSVS.
def ValidateMSVS(self, value): """Verifies that the value is legal for MSVS. Args: value: the value to check for this type. Raises: ValueError if value is not valid for MSVS. """
[ "def", "ValidateMSVS", "(", "self", ",", "value", ")", ":" ]
[ 69, 2 ]
[ 77, 7 ]
python
en
['en', 'en', 'en']
True
_Type.ValidateMSBuild
(self, value)
Verifies that the value is legal for MSBuild. Args: value: the value to check for this type. Raises: ValueError if value is not valid for MSBuild.
Verifies that the value is legal for MSBuild.
def ValidateMSBuild(self, value): """Verifies that the value is legal for MSBuild. Args: value: the value to check for this type. Raises: ValueError if value is not valid for MSBuild. """
[ "def", "ValidateMSBuild", "(", "self", ",", "value", ")", ":" ]
[ 79, 2 ]
[ 87, 7 ]
python
en
['en', 'en', 'en']
True
_Type.ConvertToMSBuild
(self, value)
Returns the MSBuild equivalent of the MSVS value given. Args: value: the MSVS value to convert. Returns: the MSBuild equivalent. Raises: ValueError if value is not valid.
Returns the MSBuild equivalent of the MSVS value given.
def ConvertToMSBuild(self, value): """Returns the MSBuild equivalent of the MSVS value given. Args: value: the MSVS value to convert. Returns: the MSBuild equivalent. Raises: ValueError if value is not valid. """ return value
[ "def", "ConvertToMSBuild", "(", "self", ",", "value", ")", ":", "return", "value" ]
[ 89, 2 ]
[ 101, 16 ]
python
en
['en', 'en', 'en']
True
Azure.default_function_name
(self, code_package: Benchmark)
Functionapp names must be globally unique in Azure.
Functionapp names must be globally unique in Azure.
def default_function_name(self, code_package: Benchmark) -> str: """ Functionapp names must be globally unique in Azure. """ func_name = ( "{}-{}-{}".format( code_package.benchmark, code_package.language_name, self.config.resources_id, ) ...
[ "def", "default_function_name", "(", "self", ",", "code_package", ":", "Benchmark", ")", "->", "str", ":", "func_name", "=", "(", "\"{}-{}-{}\"", ".", "format", "(", "code_package", ".", "benchmark", ",", "code_package", ".", "language_name", ",", "self", ".",...
[ 239, 4 ]
[ 250, 24 ]
python
en
['en', 'error', 'th']
False
IRAmbassador.handle_ip_allow_deny
(self, allow: bool, principals: List[str])
Handle IP Allow/Deny. "allow" here states whether this is an allow rule (True) or a deny rule (False); "principals" is a list of IP addresses or CIDR ranges to allow or deny. Only one of ip_allow or ip_deny can be set, so it's an error to call this twice (even if "allow" is the...
Handle IP Allow/Deny. "allow" here states whether this is an allow rule (True) or a deny rule (False); "principals" is a list of IP addresses or CIDR ranges to allow or deny.
def handle_ip_allow_deny(self, allow: bool, principals: List[str]) -> None: """ Handle IP Allow/Deny. "allow" here states whether this is an allow rule (True) or a deny rule (False); "principals" is a list of IP addresses or CIDR ranges to allow or deny. Only one of ip_allow or ...
[ "def", "handle_ip_allow_deny", "(", "self", ",", "allow", ":", "bool", ",", "principals", ":", "List", "[", "str", "]", ")", "->", "None", ":", "if", "self", ".", "get", "(", "'ip_allow_deny'", ")", "is", "not", "None", ":", "self", ".", "post_error", ...
[ 459, 4 ]
[ 482, 39 ]
python
en
['en', 'error', 'th']
False
TrioToken.run_sync_soon
(self, sync_fn, *args, idempotent=False)
Schedule a call to ``sync_fn(*args)`` to occur in the context of a Trio task. This is safe to call from the main thread, from other threads, and from signal handlers. This is the fundamental primitive used to re-enter the Trio run loop from outside of it. The call will happen "...
Schedule a call to ``sync_fn(*args)`` to occur in the context of a Trio task.
def run_sync_soon(self, sync_fn, *args, idempotent=False): """Schedule a call to ``sync_fn(*args)`` to occur in the context of a Trio task. This is safe to call from the main thread, from other threads, and from signal handlers. This is the fundamental primitive used to re-enter...
[ "def", "run_sync_soon", "(", "self", ",", "sync_fn", ",", "*", "args", ",", "idempotent", "=", "False", ")", ":", "self", ".", "_reentry_queue", ".", "run_sync_soon", "(", "sync_fn", ",", "*", "args", ",", "idempotent", "=", "idempotent", ")" ]
[ 152, 4 ]
[ 196, 80 ]
python
en
['en', 'en', 'en']
True
RAGenerator.__init__
( self, model_name_or_path: str = "facebook/rag-token-nq", model_version: Optional[str] = None, retriever: Optional[DensePassageRetriever] = None, generator_type: RAGeneratorType = RAGeneratorType.TOKEN, top_k_answers: int = 2, max_leng...
Load a RAG model from Transformers along with passage_embedding_model. See https://huggingface.co/transformers/model_doc/rag.html for more details :param model_name_or_path: Directory of a saved model or the name of a public model e.g. 'facebook/rag-token-nq'...
Load a RAG model from Transformers along with passage_embedding_model. See https://huggingface.co/transformers/model_doc/rag.html for more details
def __init__( self, model_name_or_path: str = "facebook/rag-token-nq", model_version: Optional[str] = None, retriever: Optional[DensePassageRetriever] = None, generator_type: RAGeneratorType = RAGeneratorType.TOKEN, top_k_answers: int = 2, ...
[ "def", "__init__", "(", "self", ",", "model_name_or_path", ":", "str", "=", "\"facebook/rag-token-nq\"", ",", "model_version", ":", "Optional", "[", "str", "]", "=", "None", ",", "retriever", ":", "Optional", "[", "DensePassageRetriever", "]", "=", "None", ","...
[ 63, 4 ]
[ 124, 122 ]
python
en
['en', 'error', 'th']
False
RAGenerator.predict
(self, query: str, documents: List[Document], top_k: Optional[int] = None)
Generate the answer to the input query. The generation will be conditioned on the supplied documents. These document can for example be retrieved via the Retriever. :param query: Query :param documents: Related documents (e.g. coming from a retriever) that the answer shall be condition...
Generate the answer to the input query. The generation will be conditioned on the supplied documents. These document can for example be retrieved via the Retriever.
def predict(self, query: str, documents: List[Document], top_k: Optional[int] = None) -> Dict: """ Generate the answer to the input query. The generation will be conditioned on the supplied documents. These document can for example be retrieved via the Retriever. :param query: Query ...
[ "def", "predict", "(", "self", ",", "query", ":", "str", ",", "documents", ":", "List", "[", "Document", "]", ",", "top_k", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "Dict", ":", "torch", ".", "set_grad_enabled", "(", "False", ")", ...
[ 186, 4 ]
[ 286, 21 ]
python
en
['en', 'error', 'th']
False
OrderedDict.__init__
(self, *args, **kwds)
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "raise", "TypeError", "(", "'expected at most 1 arguments, got %d'", "%", "len", "(", "args", ")", ")", "try", ":", "self...
[ 54, 4 ]
[ 68, 36 ]
python
en
['en', 'en', 'en']
True
OrderedDict.__setitem__
(self, key, value, dict_setitem=dict.__setitem__)
od.__setitem__(i, y) <==> od[i]=y
od.__setitem__(i, y) <==> od[i]=y
def __setitem__(self, key, value, dict_setitem=dict.__setitem__): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: r...
[ "def", "__setitem__", "(", "self", ",", "key", ",", "value", ",", "dict_setitem", "=", "dict", ".", "__setitem__", ")", ":", "# Setting a new item creates a new link which goes at the end of the linked", "# list, and the inherited dictionary is updated with the new key/value pair."...
[ 70, 4 ]
[ 78, 38 ]
python
cy
['de', 'cy', 'es']
False
OrderedDict.__delitem__
(self, key, dict_delitem=dict.__delitem__)
od.__delitem__(y) <==> del od[y]
od.__delitem__(y) <==> del od[y]
def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link_prev, link...
[ "def", "__delitem__", "(", "self", ",", "key", ",", "dict_delitem", "=", "dict", ".", "__delitem__", ")", ":", "# Deleting an existing item uses self.__map to find the link which is", "# then removed by updating the links in the predecessor and successor nodes.", "dict_delitem", "(...
[ 80, 4 ]
[ 87, 32 ]
python
it
['it', 'es', 'it']
True
OrderedDict.__iter__
(self)
od.__iter__() <==> iter(od)
od.__iter__() <==> iter(od)
def __iter__(self): 'od.__iter__() <==> iter(od)' root = self.__root curr = root[1] while curr is not root: yield curr[2] curr = curr[1]
[ "def", "__iter__", "(", "self", ")", ":", "root", "=", "self", ".", "__root", "curr", "=", "root", "[", "1", "]", "while", "curr", "is", "not", "root", ":", "yield", "curr", "[", "2", "]", "curr", "=", "curr", "[", "1", "]" ]
[ 89, 4 ]
[ 95, 26 ]
python
en
['en', 'hr', 'ur']
False
OrderedDict.__reversed__
(self)
od.__reversed__() <==> reversed(od)
od.__reversed__() <==> reversed(od)
def __reversed__(self): 'od.__reversed__() <==> reversed(od)' root = self.__root curr = root[0] while curr is not root: yield curr[2] curr = curr[0]
[ "def", "__reversed__", "(", "self", ")", ":", "root", "=", "self", ".", "__root", "curr", "=", "root", "[", "0", "]", "while", "curr", "is", "not", "root", ":", "yield", "curr", "[", "2", "]", "curr", "=", "curr", "[", "0", "]" ]
[ 97, 4 ]
[ 103, 26 ]
python
en
['en', 'no', 'en']
True
OrderedDict.clear
(self)
od.clear() -> None. Remove all items from od.
od.clear() -> None. Remove all items from od.
def clear(self): 'od.clear() -> None. Remove all items from od.' try: for node in self.__map.itervalues(): del node[:] root = self.__root root[:] = [root, root, None] self.__map.clear() except AttributeError: pass ...
[ "def", "clear", "(", "self", ")", ":", "try", ":", "for", "node", "in", "self", ".", "__map", ".", "itervalues", "(", ")", ":", "del", "node", "[", ":", "]", "root", "=", "self", ".", "__root", "root", "[", ":", "]", "=", "[", "root", ",", "r...
[ 105, 4 ]
[ 115, 24 ]
python
en
['en', 'en', 'en']
True
OrderedDict.popitem
(self, last=True)
od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false.
od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false.
def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: ...
[ "def", "popitem", "(", "self", ",", "last", "=", "True", ")", ":", "if", "not", "self", ":", "raise", "KeyError", "(", "'dictionary is empty'", ")", "root", "=", "self", ".", "__root", "if", "last", ":", "link", "=", "root", "[", "0", "]", "link_prev...
[ 117, 4 ]
[ 138, 25 ]
python
en
['en', 'hi-Latn', 'en']
True
OrderedDict.keys
(self)
od.keys() -> list of keys in od
od.keys() -> list of keys in od
def keys(self): 'od.keys() -> list of keys in od' return list(self)
[ "def", "keys", "(", "self", ")", ":", "return", "list", "(", "self", ")" ]
[ 142, 4 ]
[ 144, 25 ]
python
en
['en', 'fy', 'en']
True
OrderedDict.values
(self)
od.values() -> list of values in od
od.values() -> list of values in od
def values(self): 'od.values() -> list of values in od' return [self[key] for key in self]
[ "def", "values", "(", "self", ")", ":", "return", "[", "self", "[", "key", "]", "for", "key", "in", "self", "]" ]
[ 146, 4 ]
[ 148, 42 ]
python
en
['en', 'en', 'en']
True
OrderedDict.items
(self)
od.items() -> list of (key, value) pairs in od
od.items() -> list of (key, value) pairs in od
def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self]
[ "def", "items", "(", "self", ")", ":", "return", "[", "(", "key", ",", "self", "[", "key", "]", ")", "for", "key", "in", "self", "]" ]
[ 150, 4 ]
[ 152, 49 ]
python
en
['en', 'en', 'en']
True
OrderedDict.iterkeys
(self)
od.iterkeys() -> an iterator over the keys in od
od.iterkeys() -> an iterator over the keys in od
def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self)
[ "def", "iterkeys", "(", "self", ")", ":", "return", "iter", "(", "self", ")" ]
[ 154, 4 ]
[ 156, 25 ]
python
en
['en', 'sv', 'en']
True
OrderedDict.itervalues
(self)
od.itervalues -> an iterator over the values in od
od.itervalues -> an iterator over the values in od
def itervalues(self): 'od.itervalues -> an iterator over the values in od' for k in self: yield self[k]
[ "def", "itervalues", "(", "self", ")", ":", "for", "k", "in", "self", ":", "yield", "self", "[", "k", "]" ]
[ 158, 4 ]
[ 161, 25 ]
python
en
['en', 'en', 'en']
True
OrderedDict.iteritems
(self)
od.iteritems -> an iterator over the (key, value) items in od
od.iteritems -> an iterator over the (key, value) items in od
def iteritems(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k])
[ "def", "iteritems", "(", "self", ")", ":", "for", "k", "in", "self", ":", "yield", "(", "k", ",", "self", "[", "k", "]", ")" ]
[ 163, 4 ]
[ 166, 30 ]
python
en
['en', 'en', 'en']
True
OrderedDict.update
(*args, **kwds)
od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, ...
od.update(E, **F) -> None. Update od from dict/iterable E and F.
def update(*args, **kwds): '''od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in...
[ "def", "update", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "args", ")", ">", "2", ":", "raise", "TypeError", "(", "'update() takes at most 2 positional '", "'arguments (%d given)'", "%", "(", "len", "(", "args", ")", ",", ")", ...
[ 170, 4 ]
[ 199, 29 ]
python
en
['en', 'en', 'en']
True
OrderedDict.pop
(self, key, default=__marker)
od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] retur...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "__marker", ")", ":", "if", "key", "in", "self", ":", "result", "=", "self", "[", "key", "]", "del", "self", "[", "key", "]", "return", "result", "if", "default", "is", "self", ".", "__m...
[ 205, 4 ]
[ 216, 22 ]
python
en
['en', 'en', 'en']
True
OrderedDict.setdefault
(self, key, default=None)
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "self", ":", "return", "self", "[", "key", "]", "self", "[", "key", "]", "=", "default", "return", "default" ]
[ 218, 4 ]
[ 223, 22 ]
python
en
['en', 'sl', 'en']
True
OrderedDict.__repr__
(self, _repr_running={})
od.__repr__() <==> repr(od)
od.__repr__() <==> repr(od)
def __repr__(self, _repr_running={}): 'od.__repr__() <==> repr(od)' call_key = id(self), _get_ident() if call_key in _repr_running: return '...' _repr_running[call_key] = 1 try: if not self: return '%s()' % (self.__class__.__name__,) ...
[ "def", "__repr__", "(", "self", ",", "_repr_running", "=", "{", "}", ")", ":", "call_key", "=", "id", "(", "self", ")", ",", "_get_ident", "(", ")", "if", "call_key", "in", "_repr_running", ":", "return", "'...'", "_repr_running", "[", "call_key", "]", ...
[ 225, 4 ]
[ 236, 39 ]
python
en
['en', 'it', 'hi']
False
OrderedDict.__reduce__
(self)
Return state information for pickling
Return state information for pickling
def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return ...
[ "def", "__reduce__", "(", "self", ")", ":", "items", "=", "[", "[", "k", ",", "self", "[", "k", "]", "]", "for", "k", "in", "self", "]", "inst_dict", "=", "vars", "(", "self", ")", ".", "copy", "(", ")", "for", "k", "in", "vars", "(", "Ordere...
[ 238, 4 ]
[ 246, 39 ]
python
en
['en', 'da', 'en']
True
OrderedDict.copy
(self)
od.copy() -> a shallow copy of od
od.copy() -> a shallow copy of od
def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ")" ]
[ 248, 4 ]
[ 250, 35 ]
python
en
['en', 'cs', 'en']
True
OrderedDict.fromkeys
(cls, iterable, value=None)
OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None).
OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None).
def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). ''' d = cls() for key in iterable: d[key] = value return d
[ "def", "fromkeys", "(", "cls", ",", "iterable", ",", "value", "=", "None", ")", ":", "d", "=", "cls", "(", ")", "for", "key", "in", "iterable", ":", "d", "[", "key", "]", "=", "value", "return", "d" ]
[ 253, 4 ]
[ 261, 16 ]
python
en
['en', 'en', 'en']
True
OrderedDict.__eq__
(self, other)
od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive.
od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive.
def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self)==len(other) and self.items() == other.items() return ...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "OrderedDict", ")", ":", "return", "len", "(", "self", ")", "==", "len", "(", "other", ")", "and", "self", ".", "items", "(", ")", "==", "other", ".", "i...
[ 263, 4 ]
[ 270, 39 ]
python
en
['en', 'en', 'en']
True
OrderedDict.viewkeys
(self)
od.viewkeys() -> a set-like object providing a view on od's keys
od.viewkeys() -> a set-like object providing a view on od's keys
def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" return KeysView(self)
[ "def", "viewkeys", "(", "self", ")", ":", "return", "KeysView", "(", "self", ")" ]
[ 277, 4 ]
[ 279, 29 ]
python
en
['en', 'cs', 'en']
True
OrderedDict.viewvalues
(self)
od.viewvalues() -> an object providing a view on od's values
od.viewvalues() -> an object providing a view on od's values
def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" return ValuesView(self)
[ "def", "viewvalues", "(", "self", ")", ":", "return", "ValuesView", "(", "self", ")" ]
[ 281, 4 ]
[ 283, 31 ]
python
en
['en', 'en', 'en']
True
OrderedDict.viewitems
(self)
od.viewitems() -> a set-like object providing a view on od's items
od.viewitems() -> a set-like object providing a view on od's items
def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self)
[ "def", "viewitems", "(", "self", ")", ":", "return", "ItemsView", "(", "self", ")" ]
[ 285, 4 ]
[ 287, 30 ]
python
en
['en', 'haw', 'en']
True
PublicIngredientsApiTests.test_login_required
(self)
Test that login is required to access the endpoint
Test that login is required to access the endpoint
def test_login_required(self): """"Test that login is required to access the endpoint""" res = self.client.get(INGREDIENTS_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
[ "def", "test_login_required", "(", "self", ")", ":", "res", "=", "self", ".", "client", ".", "get", "(", "INGREDIENTS_URL", ")", "self", ".", "assertEqual", "(", "res", ".", "status_code", ",", "status", ".", "HTTP_401_UNAUTHORIZED", ")" ]
[ 21, 4 ]
[ 25, 71 ]
python
en
['en', 'en', 'en']
True
PrivateIngredientsApiTests.test_retrieve_ingredient_list
(self)
Test retrieving a list of ingredients
Test retrieving a list of ingredients
def test_retrieve_ingredient_list(self): """"Test retrieving a list of ingredients""" Ingredient.objects.create(user=self.user, name='Kale') Ingredient.objects.create(user=self.user, name='Salt') res = self.client.get(INGREDIENTS_URL) ingredients = Ingredient.objects.all().orde...
[ "def", "test_retrieve_ingredient_list", "(", "self", ")", ":", "Ingredient", ".", "objects", ".", "create", "(", "user", "=", "self", ".", "user", ",", "name", "=", "'Kale'", ")", "Ingredient", ".", "objects", ".", "create", "(", "user", "=", "self", "."...
[ 39, 4 ]
[ 50, 51 ]
python
en
['en', 'en', 'en']
True
PrivateIngredientsApiTests.test_ingredients_limited_to_user
(self)
Test that ingredients for the authenticated user are returned
Test that ingredients for the authenticated user are returned
def test_ingredients_limited_to_user(self): """"Test that ingredients for the authenticated user are returned""" user2 = get_user_model().objects.create_user( 'test2@testmail.com', 'testpass' ) Ingredient.objects.create(user=user2, name='Vinegar') ingredie...
[ "def", "test_ingredients_limited_to_user", "(", "self", ")", ":", "user2", "=", "get_user_model", "(", ")", ".", "objects", ".", "create_user", "(", "'test2@testmail.com'", ",", "'testpass'", ")", "Ingredient", ".", "objects", ".", "create", "(", "user", "=", ...
[ 52, 4 ]
[ 65, 62 ]
python
en
['en', 'en', 'en']
True
PrivateIngredientsApiTests.test_create_ingredient_successful
(self)
Test create a new ingredient
Test create a new ingredient
def test_create_ingredient_successful(self): """Test create a new ingredient""" payload = {'name': 'Cabbage'} self.client.post(INGREDIENTS_URL, payload) exists = Ingredient.objects.filter( user=self.user, name=payload['name'], ).exists() self.ass...
[ "def", "test_create_ingredient_successful", "(", "self", ")", ":", "payload", "=", "{", "'name'", ":", "'Cabbage'", "}", "self", ".", "client", ".", "post", "(", "INGREDIENTS_URL", ",", "payload", ")", "exists", "=", "Ingredient", ".", "objects", ".", "filte...
[ 67, 4 ]
[ 77, 31 ]
python
en
['nl', 'en', 'en']
True