partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | RegistryThing.createFromSource | returns a registry component for anything that's a valid package
name (this does not guarantee that the component actually exists in
the registry: use availableVersions() for that). | yotta/lib/registry_access.py | def createFromSource(cls, vs, name, registry):
''' returns a registry component for anything that's a valid package
name (this does not guarantee that the component actually exists in
the registry: use availableVersions() for that).
'''
# we deliberately allow only lowerc... | def createFromSource(cls, vs, name, registry):
''' returns a registry component for anything that's a valid package
name (this does not guarantee that the component actually exists in
the registry: use availableVersions() for that).
'''
# we deliberately allow only lowerc... | [
"returns",
"a",
"registry",
"component",
"for",
"anything",
"that",
"s",
"a",
"valid",
"package",
"name",
"(",
"this",
"does",
"not",
"guarantee",
"that",
"the",
"component",
"actually",
"exists",
"in",
"the",
"registry",
":",
"use",
"availableVersions",
"()",... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/registry_access.py#L455-L477 | [
"def",
"createFromSource",
"(",
"cls",
",",
"vs",
",",
"name",
",",
"registry",
")",
":",
"# we deliberately allow only lowercase, hyphen, and (unfortunately)",
"# numbers in package names, to reduce the possibility of confusingly",
"# similar names: if the name doesn't match this then e... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _JSONConfigParser.read | Read a list of files. Their configuration values are merged, with
preference to values from files earlier in the list. | yotta/lib/settings.py | def read(self, filenames):
'''' Read a list of files. Their configuration values are merged, with
preference to values from files earlier in the list.
'''
for fn in filenames:
try:
self.configs[fn] = ordered_json.load(fn)
except IOError:
... | def read(self, filenames):
'''' Read a list of files. Their configuration values are merged, with
preference to values from files earlier in the list.
'''
for fn in filenames:
try:
self.configs[fn] = ordered_json.load(fn)
except IOError:
... | [
"Read",
"a",
"list",
"of",
"files",
".",
"Their",
"configuration",
"values",
"are",
"merged",
"with",
"preference",
"to",
"values",
"from",
"files",
"earlier",
"in",
"the",
"list",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/settings.py#L60-L74 | [
"def",
"read",
"(",
"self",
",",
"filenames",
")",
":",
"for",
"fn",
"in",
"filenames",
":",
"try",
":",
"self",
".",
"configs",
"[",
"fn",
"]",
"=",
"ordered_json",
".",
"load",
"(",
"fn",
")",
"except",
"IOError",
":",
"self",
".",
"configs",
"["... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _JSONConfigParser.get | return a configuration value
usage:
get('section.property')
Note that currently array indexes are not supported. You must
get the whole array.
returns None if any path element or the property is missing | yotta/lib/settings.py | def get(self, path):
''' return a configuration value
usage:
get('section.property')
Note that currently array indexes are not supported. You must
get the whole array.
returns None if any path element or the property is missing
'''
... | def get(self, path):
''' return a configuration value
usage:
get('section.property')
Note that currently array indexes are not supported. You must
get the whole array.
returns None if any path element or the property is missing
'''
... | [
"return",
"a",
"configuration",
"value"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/settings.py#L76-L98 | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"_splitPath",
"(",
"path",
")",
"for",
"config",
"in",
"self",
".",
"configs",
".",
"values",
"(",
")",
":",
"cur",
"=",
"config",
"for",
"el",
"in",
"path",
":",
"if",
"el",
"in",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _JSONConfigParser.set | Set a configuration value. If no filename is specified, the
property is set in the first configuration file. Note that if a
filename is specified and the property path is present in an
earlier filename then set property will be hidden.
usage:
set('section... | yotta/lib/settings.py | def set(self, path, value=None, filename=None):
''' Set a configuration value. If no filename is specified, the
property is set in the first configuration file. Note that if a
filename is specified and the property path is present in an
earlier filename then set property will... | def set(self, path, value=None, filename=None):
''' Set a configuration value. If no filename is specified, the
property is set in the first configuration file. Note that if a
filename is specified and the property path is present in an
earlier filename then set property will... | [
"Set",
"a",
"configuration",
"value",
".",
"If",
"no",
"filename",
"is",
"specified",
"the",
"property",
"is",
"set",
"in",
"the",
"first",
"configuration",
"file",
".",
"Note",
"that",
"if",
"a",
"filename",
"is",
"specified",
"and",
"the",
"property",
"p... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/settings.py#L100-L124 | [
"def",
"set",
"(",
"self",
",",
"path",
",",
"value",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"config",
"=",
"self",
".",
"_firstConfig",
"(",
")",
"[",
"1",
"]",
"else",
":",
"config",
"=",
"self... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | islast | indicate whether the current item is the last one in a generator | yotta/lib/utils.py | def islast(generator):
''' indicate whether the current item is the last one in a generator
'''
next_x = None
first = True
for x in generator:
if not first:
yield (next_x, False)
next_x = x
first = False
if not first:
yield (next_x, True) | def islast(generator):
''' indicate whether the current item is the last one in a generator
'''
next_x = None
first = True
for x in generator:
if not first:
yield (next_x, False)
next_x = x
first = False
if not first:
yield (next_x, True) | [
"indicate",
"whether",
"the",
"current",
"item",
"is",
"the",
"last",
"one",
"in",
"a",
"generator"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/utils.py#L9-L20 | [
"def",
"islast",
"(",
"generator",
")",
":",
"next_x",
"=",
"None",
"first",
"=",
"True",
"for",
"x",
"in",
"generator",
":",
"if",
"not",
"first",
":",
"yield",
"(",
"next_x",
",",
"False",
")",
"next_x",
"=",
"x",
"first",
"=",
"False",
"if",
"no... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | remoteComponentFor | Return a RemoteComponent sublclass for the specified component name and
source url (or version specification)
Raises an exception if any arguments are invalid. | yotta/lib/access.py | def remoteComponentFor(name, version_required, registry='modules'):
''' Return a RemoteComponent sublclass for the specified component name and
source url (or version specification)
Raises an exception if any arguments are invalid.
'''
try:
vs = sourceparse.parseSourceURL(version_re... | def remoteComponentFor(name, version_required, registry='modules'):
''' Return a RemoteComponent sublclass for the specified component name and
source url (or version specification)
Raises an exception if any arguments are invalid.
'''
try:
vs = sourceparse.parseSourceURL(version_re... | [
"Return",
"a",
"RemoteComponent",
"sublclass",
"for",
"the",
"specified",
"component",
"name",
"and",
"source",
"url",
"(",
"or",
"version",
"specification",
")",
"Raises",
"an",
"exception",
"if",
"any",
"arguments",
"are",
"invalid",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access.py#L48-L74 | [
"def",
"remoteComponentFor",
"(",
"name",
",",
"version_required",
",",
"registry",
"=",
"'modules'",
")",
":",
"try",
":",
"vs",
"=",
"sourceparse",
".",
"parseSourceURL",
"(",
"version_required",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"access_... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | satisfyVersionFromSearchPaths | returns a Component/Target for the specified version, if found in the
list of search paths. If `update' is True, then also check for newer
versions of the found component, and update it in-place (unless it was
installed via a symlink). | yotta/lib/access.py | def satisfyVersionFromSearchPaths(name, version_required, search_paths, update=False, type='module', inherit_shrinkwrap=None):
''' returns a Component/Target for the specified version, if found in the
list of search paths. If `update' is True, then also check for newer
versions of the found componen... | def satisfyVersionFromSearchPaths(name, version_required, search_paths, update=False, type='module', inherit_shrinkwrap=None):
''' returns a Component/Target for the specified version, if found in the
list of search paths. If `update' is True, then also check for newer
versions of the found componen... | [
"returns",
"a",
"Component",
"/",
"Target",
"for",
"the",
"specified",
"version",
"if",
"found",
"in",
"the",
"list",
"of",
"search",
"paths",
".",
"If",
"update",
"is",
"True",
"then",
"also",
"check",
"for",
"newer",
"versions",
"of",
"the",
"found",
"... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access.py#L262-L320 | [
"def",
"satisfyVersionFromSearchPaths",
"(",
"name",
",",
"version_required",
",",
"search_paths",
",",
"update",
"=",
"False",
",",
"type",
"=",
"'module'",
",",
"inherit_shrinkwrap",
"=",
"None",
")",
":",
"# Pack, , base class for targets and components, internal",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | satisfyVersionByInstalling | installs and returns a Component/Target for the specified name+version
requirement, into a subdirectory of `working_directory' | yotta/lib/access.py | def satisfyVersionByInstalling(name, version_required, working_directory, type='module', inherit_shrinkwrap=None):
''' installs and returns a Component/Target for the specified name+version
requirement, into a subdirectory of `working_directory'
'''
v = latestSuitableVersion(name, version_required, ... | def satisfyVersionByInstalling(name, version_required, working_directory, type='module', inherit_shrinkwrap=None):
''' installs and returns a Component/Target for the specified name+version
requirement, into a subdirectory of `working_directory'
'''
v = latestSuitableVersion(name, version_required, ... | [
"installs",
"and",
"returns",
"a",
"Component",
"/",
"Target",
"for",
"the",
"specified",
"name",
"+",
"version",
"requirement",
"into",
"a",
"subdirectory",
"of",
"working_directory"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access.py#L322-L330 | [
"def",
"satisfyVersionByInstalling",
"(",
"name",
",",
"version_required",
",",
"working_directory",
",",
"type",
"=",
"'module'",
",",
"inherit_shrinkwrap",
"=",
"None",
")",
":",
"v",
"=",
"latestSuitableVersion",
"(",
"name",
",",
"version_required",
",",
"_reg... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _satisfyVersionByInstallingVersion | installs and returns a Component/Target for the specified version requirement into
'working_directory' using the provided remote version object.
This function is not normally called via `satisfyVersionByInstalling',
which looks up a suitable remote version object. | yotta/lib/access.py | def _satisfyVersionByInstallingVersion(name, version_required, working_directory, version, type='module', inherit_shrinkwrap=None):
''' installs and returns a Component/Target for the specified version requirement into
'working_directory' using the provided remote version object.
This function is no... | def _satisfyVersionByInstallingVersion(name, version_required, working_directory, version, type='module', inherit_shrinkwrap=None):
''' installs and returns a Component/Target for the specified version requirement into
'working_directory' using the provided remote version object.
This function is no... | [
"installs",
"and",
"returns",
"a",
"Component",
"/",
"Target",
"for",
"the",
"specified",
"version",
"requirement",
"into",
"working_directory",
"using",
"the",
"provided",
"remote",
"version",
"object",
".",
"This",
"function",
"is",
"not",
"normally",
"called",
... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access.py#L332-L354 | [
"def",
"_satisfyVersionByInstallingVersion",
"(",
"name",
",",
"version_required",
",",
"working_directory",
",",
"version",
",",
"type",
"=",
"'module'",
",",
"inherit_shrinkwrap",
"=",
"None",
")",
":",
"assert",
"(",
"version",
")",
"logger",
".",
"info",
"("... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | satisfyVersion | returns a Component/Target for the specified version (either to an already
installed copy (from the available list, or from disk), or to a newly
downloaded one), or None if the version could not be satisfied.
update_installed = None / 'Update'
None: prevent any attempt to look for... | yotta/lib/access.py | def satisfyVersion(
name,
version_required,
available,
search_paths,
working_directory,
update_installed=None,
type='module', # or 'target'
inherit_shrinkwrap=None
):
''' returns a Component/Target for the specified version (either to an already
... | def satisfyVersion(
name,
version_required,
available,
search_paths,
working_directory,
update_installed=None,
type='module', # or 'target'
inherit_shrinkwrap=None
):
''' returns a Component/Target for the specified version (either to an already
... | [
"returns",
"a",
"Component",
"/",
"Target",
"for",
"the",
"specified",
"version",
"(",
"either",
"to",
"an",
"already",
"installed",
"copy",
"(",
"from",
"the",
"available",
"list",
"or",
"from",
"disk",
")",
"or",
"to",
"a",
"newly",
"downloaded",
"one",
... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access.py#L356-L398 | [
"def",
"satisfyVersion",
"(",
"name",
",",
"version_required",
",",
"available",
",",
"search_paths",
",",
"working_directory",
",",
"update_installed",
"=",
"None",
",",
"type",
"=",
"'module'",
",",
"# or 'target'",
"inherit_shrinkwrap",
"=",
"None",
")",
":",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | sourceDirValidationError | validate source directory names in components | yotta/lib/validate.py | def sourceDirValidationError(dirname, component_name):
''' validate source directory names in components '''
if dirname == component_name:
return 'Module %s public include directory %s should not contain source files' % (component_name, dirname)
elif dirname.lower() in ('source', 'src') and dirname ... | def sourceDirValidationError(dirname, component_name):
''' validate source directory names in components '''
if dirname == component_name:
return 'Module %s public include directory %s should not contain source files' % (component_name, dirname)
elif dirname.lower() in ('source', 'src') and dirname ... | [
"validate",
"source",
"directory",
"names",
"in",
"components"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/validate.py#L28-L42 | [
"def",
"sourceDirValidationError",
"(",
"dirname",
",",
"component_name",
")",
":",
"if",
"dirname",
"==",
"component_name",
":",
"return",
"'Module %s public include directory %s should not contain source files'",
"%",
"(",
"component_name",
",",
"dirname",
")",
"elif",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | displayOutdated | print information about outdated modules,
return 0 if there is nothing to be done and nonzero otherwise | yotta/outdated.py | def displayOutdated(modules, dependency_specs, use_colours):
''' print information about outdated modules,
return 0 if there is nothing to be done and nonzero otherwise
'''
if use_colours:
DIM = colorama.Style.DIM #pylint: disable=no-member
NORMAL = colorama.Style.NORMAL ... | def displayOutdated(modules, dependency_specs, use_colours):
''' print information about outdated modules,
return 0 if there is nothing to be done and nonzero otherwise
'''
if use_colours:
DIM = colorama.Style.DIM #pylint: disable=no-member
NORMAL = colorama.Style.NORMAL ... | [
"print",
"information",
"about",
"outdated",
"modules",
"return",
"0",
"if",
"there",
"is",
"nothing",
"to",
"be",
"done",
"and",
"nonzero",
"otherwise"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/outdated.py#L40-L114 | [
"def",
"displayOutdated",
"(",
"modules",
",",
"dependency_specs",
",",
"use_colours",
")",
":",
"if",
"use_colours",
":",
"DIM",
"=",
"colorama",
".",
"Style",
".",
"DIM",
"#pylint: disable=no-member",
"NORMAL",
"=",
"colorama",
".",
"Style",
".",
"NORMAL",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.origin | Read the .yotta_origin.json file (if present), and return the value
of the 'url' property | yotta/lib/pack.py | def origin(self):
''' Read the .yotta_origin.json file (if present), and return the value
of the 'url' property '''
if self.origin_info is None:
self.origin_info = {}
try:
self.origin_info = ordered_json.load(os.path.join(self.path, Origin_Info_Fname))... | def origin(self):
''' Read the .yotta_origin.json file (if present), and return the value
of the 'url' property '''
if self.origin_info is None:
self.origin_info = {}
try:
self.origin_info = ordered_json.load(os.path.join(self.path, Origin_Info_Fname))... | [
"Read",
"the",
".",
"yotta_origin",
".",
"json",
"file",
"(",
"if",
"present",
")",
"and",
"return",
"the",
"value",
"of",
"the",
"url",
"property"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L282-L291 | [
"def",
"origin",
"(",
"self",
")",
":",
"if",
"self",
".",
"origin_info",
"is",
"None",
":",
"self",
".",
"origin_info",
"=",
"{",
"}",
"try",
":",
"self",
".",
"origin_info",
"=",
"ordered_json",
".",
"load",
"(",
"os",
".",
"path",
".",
"join",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.outdated | Return a truthy object if a newer suitable version is available,
otherwise return None.
(in fact the object returned is a ComponentVersion that can be used
to get the newer version) | yotta/lib/pack.py | def outdated(self):
''' Return a truthy object if a newer suitable version is available,
otherwise return None.
(in fact the object returned is a ComponentVersion that can be used
to get the newer version)
'''
if self.latest_suitable_version and self.latest_s... | def outdated(self):
''' Return a truthy object if a newer suitable version is available,
otherwise return None.
(in fact the object returned is a ComponentVersion that can be used
to get the newer version)
'''
if self.latest_suitable_version and self.latest_s... | [
"Return",
"a",
"truthy",
"object",
"if",
"a",
"newer",
"suitable",
"version",
"is",
"available",
"otherwise",
"return",
"None",
".",
"(",
"in",
"fact",
"the",
"object",
"returned",
"is",
"a",
"ComponentVersion",
"that",
"can",
"be",
"used",
"to",
"get",
"t... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L319-L328 | [
"def",
"outdated",
"(",
"self",
")",
":",
"if",
"self",
".",
"latest_suitable_version",
"and",
"self",
".",
"latest_suitable_version",
">",
"self",
".",
"version",
":",
"return",
"self",
".",
"latest_suitable_version",
"else",
":",
"return",
"None"
] | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.commitVCS | Commit the current working directory state (or do nothing if the
working directory is not version controlled) | yotta/lib/pack.py | def commitVCS(self, tag=None):
''' Commit the current working directory state (or do nothing if the
working directory is not version controlled)
'''
if not self.vcs:
return
self.vcs.commit(message='version %s' % tag, tag=tag) | def commitVCS(self, tag=None):
''' Commit the current working directory state (or do nothing if the
working directory is not version controlled)
'''
if not self.vcs:
return
self.vcs.commit(message='version %s' % tag, tag=tag) | [
"Commit",
"the",
"current",
"working",
"directory",
"state",
"(",
"or",
"do",
"nothing",
"if",
"the",
"working",
"directory",
"is",
"not",
"version",
"controlled",
")"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L338-L344 | [
"def",
"commitVCS",
"(",
"self",
",",
"tag",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"vcs",
":",
"return",
"self",
".",
"vcs",
".",
"commit",
"(",
"message",
"=",
"'version %s'",
"%",
"tag",
",",
"tag",
"=",
"tag",
")"
] | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.ignores | Test if this module ignores the file at "path", which must be a
path relative to the root of the module.
If a file is within a directory that is ignored, the file is also
ignored. | yotta/lib/pack.py | def ignores(self, path):
''' Test if this module ignores the file at "path", which must be a
path relative to the root of the module.
If a file is within a directory that is ignored, the file is also
ignored.
'''
test_path = PurePath('/', path)
# als... | def ignores(self, path):
''' Test if this module ignores the file at "path", which must be a
path relative to the root of the module.
If a file is within a directory that is ignored, the file is also
ignored.
'''
test_path = PurePath('/', path)
# als... | [
"Test",
"if",
"this",
"module",
"ignores",
"the",
"file",
"at",
"path",
"which",
"must",
"be",
"a",
"path",
"relative",
"to",
"the",
"root",
"of",
"the",
"module",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L378-L396 | [
"def",
"ignores",
"(",
"self",
",",
"path",
")",
":",
"test_path",
"=",
"PurePath",
"(",
"'/'",
",",
"path",
")",
"# also check any parent directories of this path against the ignore",
"# patterns:",
"test_paths",
"=",
"tuple",
"(",
"[",
"test_path",
"]",
"+",
"li... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.writeDescription | Write the current (possibly modified) component description to a
package description file in the component directory. | yotta/lib/pack.py | def writeDescription(self):
''' Write the current (possibly modified) component description to a
package description file in the component directory.
'''
ordered_json.dump(os.path.join(self.path, self.description_filename), self.description)
if self.vcs:
self.vcs.... | def writeDescription(self):
''' Write the current (possibly modified) component description to a
package description file in the component directory.
'''
ordered_json.dump(os.path.join(self.path, self.description_filename), self.description)
if self.vcs:
self.vcs.... | [
"Write",
"the",
"current",
"(",
"possibly",
"modified",
")",
"component",
"description",
"to",
"a",
"package",
"description",
"file",
"in",
"the",
"component",
"directory",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L405-L411 | [
"def",
"writeDescription",
"(",
"self",
")",
":",
"ordered_json",
".",
"dump",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"self",
".",
"description_filename",
")",
",",
"self",
".",
"description",
")",
"if",
"self",
".",
"vcs",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.generateTarball | Write a tarball of the current component/target to the file object
"file_object", which must already be open for writing at position 0 | yotta/lib/pack.py | def generateTarball(self, file_object):
''' Write a tarball of the current component/target to the file object
"file_object", which must already be open for writing at position 0
'''
archive_name = '%s-%s' % (self.getName(), self.getVersion())
def filterArchive(tarinfo):
... | def generateTarball(self, file_object):
''' Write a tarball of the current component/target to the file object
"file_object", which must already be open for writing at position 0
'''
archive_name = '%s-%s' % (self.getName(), self.getVersion())
def filterArchive(tarinfo):
... | [
"Write",
"a",
"tarball",
"of",
"the",
"current",
"component",
"/",
"target",
"to",
"the",
"file",
"object",
"file_object",
"which",
"must",
"already",
"be",
"open",
"for",
"writing",
"at",
"position",
"0"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L413-L430 | [
"def",
"generateTarball",
"(",
"self",
",",
"file_object",
")",
":",
"archive_name",
"=",
"'%s-%s'",
"%",
"(",
"self",
".",
"getName",
"(",
")",
",",
"self",
".",
"getVersion",
"(",
")",
")",
"def",
"filterArchive",
"(",
"tarinfo",
")",
":",
"if",
"tar... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.publish | Publish to the appropriate registry, return a description of any
errors that occured, or None if successful.
No VCS tagging is performed. | yotta/lib/pack.py | def publish(self, registry=None):
''' Publish to the appropriate registry, return a description of any
errors that occured, or None if successful.
No VCS tagging is performed.
'''
if (registry is None) or (registry == registry_access.Registry_Base_URL):
if 'pr... | def publish(self, registry=None):
''' Publish to the appropriate registry, return a description of any
errors that occured, or None if successful.
No VCS tagging is performed.
'''
if (registry is None) or (registry == registry_access.Registry_Base_URL):
if 'pr... | [
"Publish",
"to",
"the",
"appropriate",
"registry",
"return",
"a",
"description",
"of",
"any",
"errors",
"that",
"occured",
"or",
"None",
"if",
"successful",
".",
"No",
"VCS",
"tagging",
"is",
"performed",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L448-L486 | [
"def",
"publish",
"(",
"self",
",",
"registry",
"=",
"None",
")",
":",
"if",
"(",
"registry",
"is",
"None",
")",
"or",
"(",
"registry",
"==",
"registry_access",
".",
"Registry_Base_URL",
")",
":",
"if",
"'private'",
"in",
"self",
".",
"description",
"and... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.unpublish | Try to un-publish the current version. Return a description of any
errors that occured, or None if successful. | yotta/lib/pack.py | def unpublish(self, registry=None):
''' Try to un-publish the current version. Return a description of any
errors that occured, or None if successful.
'''
return registry_access.unpublish(
self.getRegistryNamespace(),
self.getName(),
self.getVersio... | def unpublish(self, registry=None):
''' Try to un-publish the current version. Return a description of any
errors that occured, or None if successful.
'''
return registry_access.unpublish(
self.getRegistryNamespace(),
self.getName(),
self.getVersio... | [
"Try",
"to",
"un",
"-",
"publish",
"the",
"current",
"version",
".",
"Return",
"a",
"description",
"of",
"any",
"errors",
"that",
"occured",
"or",
"None",
"if",
"successful",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L488-L497 | [
"def",
"unpublish",
"(",
"self",
",",
"registry",
"=",
"None",
")",
":",
"return",
"registry_access",
".",
"unpublish",
"(",
"self",
".",
"getRegistryNamespace",
"(",
")",
",",
"self",
".",
"getName",
"(",
")",
",",
"self",
".",
"getVersion",
"(",
")",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.getScript | Return the specified script command. If the first part of the
command is a .py file, then the current python interpreter is
prepended.
If the script is a single string, rather than an array, it is
shlex-split. | yotta/lib/pack.py | def getScript(self, scriptname):
''' Return the specified script command. If the first part of the
command is a .py file, then the current python interpreter is
prepended.
If the script is a single string, rather than an array, it is
shlex-split.
'''
... | def getScript(self, scriptname):
''' Return the specified script command. If the first part of the
command is a .py file, then the current python interpreter is
prepended.
If the script is a single string, rather than an array, it is
shlex-split.
'''
... | [
"Return",
"the",
"specified",
"script",
"command",
".",
"If",
"the",
"first",
"part",
"of",
"the",
"command",
"is",
"a",
".",
"py",
"file",
"then",
"the",
"current",
"python",
"interpreter",
"is",
"prepended",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L499-L525 | [
"def",
"getScript",
"(",
"self",
",",
"scriptname",
")",
":",
"script",
"=",
"self",
".",
"description",
".",
"get",
"(",
"'scripts'",
",",
"{",
"}",
")",
".",
"get",
"(",
"scriptname",
",",
"None",
")",
"if",
"script",
"is",
"not",
"None",
":",
"i... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Pack.runScript | Run the specified script from the scripts section of the
module.json file in the directory of this module. | yotta/lib/pack.py | def runScript(self, scriptname, additional_environment=None):
''' Run the specified script from the scripts section of the
module.json file in the directory of this module.
'''
import subprocess
import shlex
command = self.getScript(scriptname)
if command is ... | def runScript(self, scriptname, additional_environment=None):
''' Run the specified script from the scripts section of the
module.json file in the directory of this module.
'''
import subprocess
import shlex
command = self.getScript(scriptname)
if command is ... | [
"Run",
"the",
"specified",
"script",
"from",
"the",
"scripts",
"section",
"of",
"the",
"module",
".",
"json",
"file",
"in",
"the",
"directory",
"of",
"this",
"module",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/pack.py#L529-L570 | [
"def",
"runScript",
"(",
"self",
",",
"scriptname",
",",
"additional_environment",
"=",
"None",
")",
":",
"import",
"subprocess",
"import",
"shlex",
"command",
"=",
"self",
".",
"getScript",
"(",
"scriptname",
")",
"if",
"command",
"is",
"None",
":",
"logger... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _truthyConfValue | Determine yotta-config truthiness. In yotta config land truthiness is
different to python or json truthiness (in order to map nicely only
preprocessor and CMake definediness):
json -> python -> truthy/falsey
false -> False -> Falsey
null -> None -> Falsey
... | yotta/lib/component.py | def _truthyConfValue(v):
''' Determine yotta-config truthiness. In yotta config land truthiness is
different to python or json truthiness (in order to map nicely only
preprocessor and CMake definediness):
json -> python -> truthy/falsey
false -> False -> Falsey
... | def _truthyConfValue(v):
''' Determine yotta-config truthiness. In yotta config land truthiness is
different to python or json truthiness (in order to map nicely only
preprocessor and CMake definediness):
json -> python -> truthy/falsey
false -> False -> Falsey
... | [
"Determine",
"yotta",
"-",
"config",
"truthiness",
".",
"In",
"yotta",
"config",
"land",
"truthiness",
"is",
"different",
"to",
"python",
"or",
"json",
"truthiness",
"(",
"in",
"order",
"to",
"map",
"nicely",
"only",
"preprocessor",
"and",
"CMake",
"definedine... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L41-L65 | [
"def",
"_truthyConfValue",
"(",
"v",
")",
":",
"if",
"v",
"is",
"False",
":",
"return",
"False",
"elif",
"v",
"is",
"None",
":",
"return",
"False",
"elif",
"v",
"==",
"0",
":",
"return",
"False",
"else",
":",
"# everything else is truthy!",
"return",
"Tr... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getDependencySpecs | Returns [DependencySpec]
These are returned in the order that they are listed in the
component description file: this is so that dependency resolution
proceeds in a predictable way. | yotta/lib/component.py | def getDependencySpecs(self, target=None):
''' Returns [DependencySpec]
These are returned in the order that they are listed in the
component description file: this is so that dependency resolution
proceeds in a predictable way.
'''
deps = []
def spe... | def getDependencySpecs(self, target=None):
''' Returns [DependencySpec]
These are returned in the order that they are listed in the
component description file: this is so that dependency resolution
proceeds in a predictable way.
'''
deps = []
def spe... | [
"Returns",
"[",
"DependencySpec",
"]"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L147-L204 | [
"def",
"getDependencySpecs",
"(",
"self",
",",
"target",
"=",
"None",
")",
":",
"deps",
"=",
"[",
"]",
"def",
"specForDependency",
"(",
"name",
",",
"version_spec",
",",
"istest",
")",
":",
"shrinkwrap",
"=",
"self",
".",
"getShrinkwrapMapping",
"(",
")",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.hasDependency | Check if this module has any dependencies with the specified name
in its dependencies list, or in target dependencies for the
specified target | yotta/lib/component.py | def hasDependency(self, name, target=None, test_dependencies=False):
''' Check if this module has any dependencies with the specified name
in its dependencies list, or in target dependencies for the
specified target
'''
if name in self.description.get('dependencies', {}).... | def hasDependency(self, name, target=None, test_dependencies=False):
''' Check if this module has any dependencies with the specified name
in its dependencies list, or in target dependencies for the
specified target
'''
if name in self.description.get('dependencies', {}).... | [
"Check",
"if",
"this",
"module",
"has",
"any",
"dependencies",
"with",
"the",
"specified",
"name",
"in",
"its",
"dependencies",
"list",
"or",
"in",
"target",
"dependencies",
"for",
"the",
"specified",
"target"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L206-L231 | [
"def",
"hasDependency",
"(",
"self",
",",
"name",
",",
"target",
"=",
"None",
",",
"test_dependencies",
"=",
"False",
")",
":",
"if",
"name",
"in",
"self",
".",
"description",
".",
"get",
"(",
"'dependencies'",
",",
"{",
"}",
")",
".",
"keys",
"(",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.hasDependencyRecursively | Check if this module, or any of its dependencies, have a
dependencies with the specified name in their dependencies, or in
their targetDependencies corresponding to the specified target.
Note that if recursive dependencies are not installed, this test
may return a false-... | yotta/lib/component.py | def hasDependencyRecursively(self, name, target=None, test_dependencies=False):
''' Check if this module, or any of its dependencies, have a
dependencies with the specified name in their dependencies, or in
their targetDependencies corresponding to the specified target.
Note... | def hasDependencyRecursively(self, name, target=None, test_dependencies=False):
''' Check if this module, or any of its dependencies, have a
dependencies with the specified name in their dependencies, or in
their targetDependencies corresponding to the specified target.
Note... | [
"Check",
"if",
"this",
"module",
"or",
"any",
"of",
"its",
"dependencies",
"have",
"a",
"dependencies",
"with",
"the",
"specified",
"name",
"in",
"their",
"dependencies",
"or",
"in",
"their",
"targetDependencies",
"corresponding",
"to",
"the",
"specified",
"targ... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L233-L247 | [
"def",
"hasDependencyRecursively",
"(",
"self",
",",
"name",
",",
"target",
"=",
"None",
",",
"test_dependencies",
"=",
"False",
")",
":",
"# checking dependencies recursively isn't entirely straightforward, so",
"# use the existing method to resolve them all before checking:",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getDependencies | Returns {component_name:component} | yotta/lib/component.py | def getDependencies(self,
available_components = None,
search_dirs = None,
target = None,
available_only = False,
test = False,
warnings = True
):
''' Returns {component_name:component}
'''
... | def getDependencies(self,
available_components = None,
search_dirs = None,
target = None,
available_only = False,
test = False,
warnings = True
):
''' Returns {component_name:component}
'''
... | [
"Returns",
"{",
"component_name",
":",
"component",
"}"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L250-L277 | [
"def",
"getDependencies",
"(",
"self",
",",
"available_components",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"target",
"=",
"None",
",",
"available_only",
"=",
"False",
",",
"test",
"=",
"False",
",",
"warnings",
"=",
"True",
")",
":",
"if",
"s... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.__getDependenciesWithProvider | Get installed components using "provider" to find (and possibly
install) components.
See documentation for __getDependenciesRecursiveWithProvider
returns (components, errors) | yotta/lib/component.py | def __getDependenciesWithProvider(self,
available_components = None,
search_dirs = None,
target = None,
update_installed = False,
provider = None,
... | def __getDependenciesWithProvider(self,
available_components = None,
search_dirs = None,
target = None,
update_installed = False,
provider = None,
... | [
"Get",
"installed",
"components",
"using",
"provider",
"to",
"find",
"(",
"and",
"possibly",
"install",
")",
"components",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L279-L334 | [
"def",
"__getDependenciesWithProvider",
"(",
"self",
",",
"available_components",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"target",
"=",
"None",
",",
"update_installed",
"=",
"False",
",",
"provider",
"=",
"None",
",",
"test",
"=",
"False",
")",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.__getDependenciesRecursiveWithProvider | Get installed components using "provider" to find (and possibly
install) components.
This function is called with different provider functions in order
to retrieve a list of all of the dependencies, or install all
dependencies.
Returns
=======
... | yotta/lib/component.py | def __getDependenciesRecursiveWithProvider(self,
available_components = None,
search_dirs = None,
target = None,
traverse_links = False,
... | def __getDependenciesRecursiveWithProvider(self,
available_components = None,
search_dirs = None,
target = None,
traverse_links = False,
... | [
"Get",
"installed",
"components",
"using",
"provider",
"to",
"find",
"(",
"and",
"possibly",
"install",
")",
"components",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L337-L456 | [
"def",
"__getDependenciesRecursiveWithProvider",
"(",
"self",
",",
"available_components",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"target",
"=",
"None",
",",
"traverse_links",
"=",
"False",
",",
"update_installed",
"=",
"False",
",",
"provider",
"=",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getDependenciesRecursive | Get available and already installed components, don't check for
remotely available components. See also
satisfyDependenciesRecursive()
Returns {component_name:component} | yotta/lib/component.py | def getDependenciesRecursive(self,
available_components = None,
processed = None,
search_dirs = None,
target = None,
available_only = False,
test = False
... | def getDependenciesRecursive(self,
available_components = None,
processed = None,
search_dirs = None,
target = None,
available_only = False,
test = False
... | [
"Get",
"available",
"and",
"already",
"installed",
"components",
"don",
"t",
"check",
"for",
"remotely",
"available",
"components",
".",
"See",
"also",
"satisfyDependenciesRecursive",
"()"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L505-L532 | [
"def",
"getDependenciesRecursive",
"(",
"self",
",",
"available_components",
"=",
"None",
",",
"processed",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"target",
"=",
"None",
",",
"available_only",
"=",
"False",
",",
"test",
"=",
"False",
")",
":",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.satisfyDependenciesRecursive | Retrieve and install all the dependencies of this component and its
dependencies, recursively, or satisfy them from a collection of
available_components or from disk.
Returns
=======
(components, errors)
components: dictionary of name:Com... | yotta/lib/component.py | def satisfyDependenciesRecursive(
self,
available_components = None,
search_dirs = None,
update_installed = False,
traverse_links = False,
target = None,
test = False
... | def satisfyDependenciesRecursive(
self,
available_components = None,
search_dirs = None,
update_installed = False,
traverse_links = False,
target = None,
test = False
... | [
"Retrieve",
"and",
"install",
"all",
"the",
"dependencies",
"of",
"this",
"component",
"and",
"its",
"dependencies",
"recursively",
"or",
"satisfy",
"them",
"from",
"a",
"collection",
"of",
"available_components",
"or",
"from",
"disk",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L540-L667 | [
"def",
"satisfyDependenciesRecursive",
"(",
"self",
",",
"available_components",
"=",
"None",
",",
"search_dirs",
"=",
"None",
",",
"update_installed",
"=",
"False",
",",
"traverse_links",
"=",
"False",
",",
"target",
"=",
"None",
",",
"test",
"=",
"False",
")... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.satisfyTarget | Ensure that the specified target name (and optionally version,
github ref or URL) is installed in the targets directory of the
current component
returns (derived_target, errors) | yotta/lib/component.py | def satisfyTarget(self, target_name_and_version, update_installed=False, additional_config=None, install_missing=True):
''' Ensure that the specified target name (and optionally version,
github ref or URL) is installed in the targets directory of the
current component
return... | def satisfyTarget(self, target_name_and_version, update_installed=False, additional_config=None, install_missing=True):
''' Ensure that the specified target name (and optionally version,
github ref or URL) is installed in the targets directory of the
current component
return... | [
"Ensure",
"that",
"the",
"specified",
"target",
"name",
"(",
"and",
"optionally",
"version",
"github",
"ref",
"or",
"URL",
")",
"is",
"installed",
"in",
"the",
"targets",
"directory",
"of",
"the",
"current",
"component"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L669-L689 | [
"def",
"satisfyTarget",
"(",
"self",
",",
"target_name_and_version",
",",
"update_installed",
"=",
"False",
",",
"additional_config",
"=",
"None",
",",
"install_missing",
"=",
"True",
")",
":",
"# Target, , represent an installed target, internal",
"from",
"yotta",
".",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getTarget | Return a derived target object representing the selected target: if
the target is not installed, or is invalid then the returned object
will test false in a boolean context.
Returns derived_target
Errors are not displayed. | yotta/lib/component.py | def getTarget(self, target_name_and_version, additional_config=None):
''' Return a derived target object representing the selected target: if
the target is not installed, or is invalid then the returned object
will test false in a boolean context.
Returns derived_target
... | def getTarget(self, target_name_and_version, additional_config=None):
''' Return a derived target object representing the selected target: if
the target is not installed, or is invalid then the returned object
will test false in a boolean context.
Returns derived_target
... | [
"Return",
"a",
"derived",
"target",
"object",
"representing",
"the",
"selected",
"target",
":",
"if",
"the",
"target",
"is",
"not",
"installed",
"or",
"is",
"invalid",
"then",
"the",
"returned",
"object",
"will",
"test",
"false",
"in",
"a",
"boolean",
"conte... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L691-L708 | [
"def",
"getTarget",
"(",
"self",
",",
"target_name_and_version",
",",
"additional_config",
"=",
"None",
")",
":",
"derived_target",
",",
"errors",
"=",
"self",
".",
"satisfyTarget",
"(",
"target_name_and_version",
",",
"additional_config",
"=",
"additional_config",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getBinaries | Return a dictionary of binaries to compile: {"dirname":"exename"},
this is used when automatically generating CMakeLists
Note that currently modules may define only a single executable
binary or library to be built by the automatic build system, by
specifying `"bin": "di... | yotta/lib/component.py | def getBinaries(self):
''' Return a dictionary of binaries to compile: {"dirname":"exename"},
this is used when automatically generating CMakeLists
Note that currently modules may define only a single executable
binary or library to be built by the automatic build system, by... | def getBinaries(self):
''' Return a dictionary of binaries to compile: {"dirname":"exename"},
this is used when automatically generating CMakeLists
Note that currently modules may define only a single executable
binary or library to be built by the automatic build system, by... | [
"Return",
"a",
"dictionary",
"of",
"binaries",
"to",
"compile",
":",
"{",
"dirname",
":",
"exename",
"}",
"this",
"is",
"used",
"when",
"automatically",
"generating",
"CMakeLists"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L724-L749 | [
"def",
"getBinaries",
"(",
"self",
")",
":",
"# the module.json syntax is a subset of the package.json syntax: a",
"# single string that defines the source directory to use to build an",
"# executable with the same name as the component. This may be extended",
"# to include the rest of the npm syn... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getLibs | Return a dictionary of libraries to compile: {"dirname":"libname"},
this is used when automatically generating CMakeLists.
If explicit_only is not set, then in the absence of both 'lib' and
'bin' sections in the module.json file, the "source" directory
will be returned.
... | yotta/lib/component.py | def getLibs(self, explicit_only=False):
''' Return a dictionary of libraries to compile: {"dirname":"libname"},
this is used when automatically generating CMakeLists.
If explicit_only is not set, then in the absence of both 'lib' and
'bin' sections in the module.json file, t... | def getLibs(self, explicit_only=False):
''' Return a dictionary of libraries to compile: {"dirname":"libname"},
this is used when automatically generating CMakeLists.
If explicit_only is not set, then in the absence of both 'lib' and
'bin' sections in the module.json file, t... | [
"Return",
"a",
"dictionary",
"of",
"libraries",
"to",
"compile",
":",
"{",
"dirname",
":",
"libname",
"}",
"this",
"is",
"used",
"when",
"automatically",
"generating",
"CMakeLists",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L751-L777 | [
"def",
"getLibs",
"(",
"self",
",",
"explicit_only",
"=",
"False",
")",
":",
"if",
"'lib'",
"in",
"self",
".",
"description",
":",
"return",
"{",
"os",
".",
"path",
".",
"normpath",
"(",
"self",
".",
"description",
"[",
"'lib'",
"]",
")",
":",
"self"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.licenses | Return a list of licenses that apply to this module. (Strings,
which may be SPDX identifiers) | yotta/lib/component.py | def licenses(self):
''' Return a list of licenses that apply to this module. (Strings,
which may be SPDX identifiers)
'''
if 'license' in self.description:
return [self.description['license']]
else:
return [x['type'] for x in self.description['licenses... | def licenses(self):
''' Return a list of licenses that apply to this module. (Strings,
which may be SPDX identifiers)
'''
if 'license' in self.description:
return [self.description['license']]
else:
return [x['type'] for x in self.description['licenses... | [
"Return",
"a",
"list",
"of",
"licenses",
"that",
"apply",
"to",
"this",
"module",
".",
"(",
"Strings",
"which",
"may",
"be",
"SPDX",
"identifiers",
")"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L779-L786 | [
"def",
"licenses",
"(",
"self",
")",
":",
"if",
"'license'",
"in",
"self",
".",
"description",
":",
"return",
"[",
"self",
".",
"description",
"[",
"'license'",
"]",
"]",
"else",
":",
"return",
"[",
"x",
"[",
"'type'",
"]",
"for",
"x",
"in",
"self",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getExtraIncludes | Some components must export whole directories full of headers into
the search path. This is really really bad, and they shouldn't do
it, but support is provided as a concession to compatibility. | yotta/lib/component.py | def getExtraIncludes(self):
''' Some components must export whole directories full of headers into
the search path. This is really really bad, and they shouldn't do
it, but support is provided as a concession to compatibility.
'''
if 'extraIncludes' in self.description:
... | def getExtraIncludes(self):
''' Some components must export whole directories full of headers into
the search path. This is really really bad, and they shouldn't do
it, but support is provided as a concession to compatibility.
'''
if 'extraIncludes' in self.description:
... | [
"Some",
"components",
"must",
"export",
"whole",
"directories",
"full",
"of",
"headers",
"into",
"the",
"search",
"path",
".",
"This",
"is",
"really",
"really",
"bad",
"and",
"they",
"shouldn",
"t",
"do",
"it",
"but",
"support",
"is",
"provided",
"as",
"a"... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L788-L796 | [
"def",
"getExtraIncludes",
"(",
"self",
")",
":",
"if",
"'extraIncludes'",
"in",
"self",
".",
"description",
":",
"return",
"[",
"os",
".",
"path",
".",
"normpath",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"description",
"[",
"'extraIncludes'",
"]",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Component.getExtraSysIncludes | Some components (e.g. libc) must export directories of header files
into the system include search path. They do this by adding a
'extraSysIncludes' : [ array of directories ] field in their
package description. This function returns the list of directories
(or an empty l... | yotta/lib/component.py | def getExtraSysIncludes(self):
''' Some components (e.g. libc) must export directories of header files
into the system include search path. They do this by adding a
'extraSysIncludes' : [ array of directories ] field in their
package description. This function returns the lis... | def getExtraSysIncludes(self):
''' Some components (e.g. libc) must export directories of header files
into the system include search path. They do this by adding a
'extraSysIncludes' : [ array of directories ] field in their
package description. This function returns the lis... | [
"Some",
"components",
"(",
"e",
".",
"g",
".",
"libc",
")",
"must",
"export",
"directories",
"of",
"header",
"files",
"into",
"the",
"system",
"include",
"search",
"path",
".",
"They",
"do",
"this",
"by",
"adding",
"a",
"extraSysIncludes",
":",
"[",
"arr... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L798-L808 | [
"def",
"getExtraSysIncludes",
"(",
"self",
")",
":",
"if",
"'extraSysIncludes'",
"in",
"self",
".",
"description",
":",
"return",
"[",
"os",
".",
"path",
".",
"normpath",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"description",
"[",
"'extraSysIncludes'... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | checkDependenciesForShrinkwrap | return a list of errors encountered (e.g. dependency missing or
specification not met | yotta/shrinkwrap.py | def checkDependenciesForShrinkwrap(dependency_list):
''' return a list of errors encountered (e.g. dependency missing or
specification not met
'''
# sourceparse, , parse version specifications, internall
from yotta.lib import sourceparse
errors = []
# first gather the available versions ... | def checkDependenciesForShrinkwrap(dependency_list):
''' return a list of errors encountered (e.g. dependency missing or
specification not met
'''
# sourceparse, , parse version specifications, internall
from yotta.lib import sourceparse
errors = []
# first gather the available versions ... | [
"return",
"a",
"list",
"of",
"errors",
"encountered",
"(",
"e",
".",
"g",
".",
"dependency",
"missing",
"or",
"specification",
"not",
"met"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/shrinkwrap.py#L59-L91 | [
"def",
"checkDependenciesForShrinkwrap",
"(",
"dependency_list",
")",
":",
"# sourceparse, , parse version specifications, internall",
"from",
"yotta",
".",
"lib",
"import",
"sourceparse",
"errors",
"=",
"[",
"]",
"# first gather the available versions of things:",
"available_ver... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | GitWorkingCopy.availableVersions | return a list of GitCloneVersion objects for tags which are valid
semantic version idenfitifiers. | yotta/lib/git_access.py | def availableVersions(self):
''' return a list of GitCloneVersion objects for tags which are valid
semantic version idenfitifiers.
'''
r = []
for t in self.vcs.tags():
logger.debug("available version tag: %s", t)
# ignore empty tags:
if not... | def availableVersions(self):
''' return a list of GitCloneVersion objects for tags which are valid
semantic version idenfitifiers.
'''
r = []
for t in self.vcs.tags():
logger.debug("available version tag: %s", t)
# ignore empty tags:
if not... | [
"return",
"a",
"list",
"of",
"GitCloneVersion",
"objects",
"for",
"tags",
"which",
"are",
"valid",
"semantic",
"version",
"idenfitifiers",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/git_access.py#L48-L62 | [
"def",
"availableVersions",
"(",
"self",
")",
":",
"r",
"=",
"[",
"]",
"for",
"t",
"in",
"self",
".",
"vcs",
".",
"tags",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"available version tag: %s\"",
",",
"t",
")",
"# ignore empty tags:",
"if",
"not",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | GitWorkingCopy.commitVersion | return a GithubComponentVersion object for a specific commit if valid | yotta/lib/git_access.py | def commitVersion(self, spec):
''' return a GithubComponentVersion object for a specific commit if valid
'''
import re
commit_match = re.match('^[a-f0-9]{7,40}$', spec, re.I)
if commit_match:
return GitCloneVersion('', spec, self)
return None | def commitVersion(self, spec):
''' return a GithubComponentVersion object for a specific commit if valid
'''
import re
commit_match = re.match('^[a-f0-9]{7,40}$', spec, re.I)
if commit_match:
return GitCloneVersion('', spec, self)
return None | [
"return",
"a",
"GithubComponentVersion",
"object",
"for",
"a",
"specific",
"commit",
"if",
"valid"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/git_access.py#L78-L87 | [
"def",
"commitVersion",
"(",
"self",
",",
"spec",
")",
":",
"import",
"re",
"commit_match",
"=",
"re",
".",
"match",
"(",
"'^[a-f0-9]{7,40}$'",
",",
"spec",
",",
"re",
".",
"I",
")",
"if",
"commit_match",
":",
"return",
"GitCloneVersion",
"(",
"''",
",",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | GitComponent.createFromSource | returns a git component for any git:// url, or None if this is not
a git component.
Normally version will be empty, unless the original url was of the
form 'git://...#version', which can be used to grab a particular
tag or branch, or ...#>=1.2.3, which can be used to spe... | yotta/lib/git_access.py | def createFromSource(cls, vs, name=None):
''' returns a git component for any git:// url, or None if this is not
a git component.
Normally version will be empty, unless the original url was of the
form 'git://...#version', which can be used to grab a particular
t... | def createFromSource(cls, vs, name=None):
''' returns a git component for any git:// url, or None if this is not
a git component.
Normally version will be empty, unless the original url was of the
form 'git://...#version', which can be used to grab a particular
t... | [
"returns",
"a",
"git",
"component",
"for",
"any",
"git",
":",
"//",
"url",
"or",
"None",
"if",
"this",
"is",
"not",
"a",
"git",
"component",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/git_access.py#L98-L107 | [
"def",
"createFromSource",
"(",
"cls",
",",
"vs",
",",
"name",
"=",
"None",
")",
":",
"return",
"GitComponent",
"(",
"vs",
".",
"location",
",",
"vs",
".",
"spec",
",",
"vs",
".",
"semantic_spec",
")"
] | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _mergeDictionaries | merge dictionaries of dictionaries recursively, with elements from
dictionaries earlier in the argument sequence taking precedence | yotta/lib/target.py | def _mergeDictionaries(*args):
''' merge dictionaries of dictionaries recursively, with elements from
dictionaries earlier in the argument sequence taking precedence
'''
# to support merging of OrderedDicts, copy the result type from the first
# argument:
result = type(args[0])()
for k, ... | def _mergeDictionaries(*args):
''' merge dictionaries of dictionaries recursively, with elements from
dictionaries earlier in the argument sequence taking precedence
'''
# to support merging of OrderedDicts, copy the result type from the first
# argument:
result = type(args[0])()
for k, ... | [
"merge",
"dictionaries",
"of",
"dictionaries",
"recursively",
"with",
"elements",
"from",
"dictionaries",
"earlier",
"in",
"the",
"argument",
"sequence",
"taking",
"precedence"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L41-L53 | [
"def",
"_mergeDictionaries",
"(",
"*",
"args",
")",
":",
"# to support merging of OrderedDicts, copy the result type from the first",
"# argument:",
"result",
"=",
"type",
"(",
"args",
"[",
"0",
"]",
")",
"(",
")",
"for",
"k",
",",
"v",
"in",
"itertools",
".",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _mirrorStructure | create a new nested dictionary object with the same structure as
'dictionary', but with all scalar values replaced with 'value' | yotta/lib/target.py | def _mirrorStructure(dictionary, value):
''' create a new nested dictionary object with the same structure as
'dictionary', but with all scalar values replaced with 'value'
'''
result = type(dictionary)()
for k in dictionary.keys():
if isinstance(dictionary[k], dict):
result[... | def _mirrorStructure(dictionary, value):
''' create a new nested dictionary object with the same structure as
'dictionary', but with all scalar values replaced with 'value'
'''
result = type(dictionary)()
for k in dictionary.keys():
if isinstance(dictionary[k], dict):
result[... | [
"create",
"a",
"new",
"nested",
"dictionary",
"object",
"with",
"the",
"same",
"structure",
"as",
"dictionary",
"but",
"with",
"all",
"scalar",
"values",
"replaced",
"with",
"value"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L55-L65 | [
"def",
"_mirrorStructure",
"(",
"dictionary",
",",
"value",
")",
":",
"result",
"=",
"type",
"(",
"dictionary",
")",
"(",
")",
"for",
"k",
"in",
"dictionary",
".",
"keys",
"(",
")",
":",
"if",
"isinstance",
"(",
"dictionary",
"[",
"k",
"]",
",",
"dic... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | loadAdditionalConfig | returns (error, config) | yotta/lib/target.py | def loadAdditionalConfig(config_path):
''' returns (error, config)
'''
error = None
config = {}
if not config_path:
return (error, config)
if os.path.isfile(config_path):
try:
config = ordered_json.load(config_path)
except Exception as e:
error = "... | def loadAdditionalConfig(config_path):
''' returns (error, config)
'''
error = None
config = {}
if not config_path:
return (error, config)
if os.path.isfile(config_path):
try:
config = ordered_json.load(config_path)
except Exception as e:
error = "... | [
"returns",
"(",
"error",
"config",
")"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L79-L103 | [
"def",
"loadAdditionalConfig",
"(",
"config_path",
")",
":",
"error",
"=",
"None",
"config",
"=",
"{",
"}",
"if",
"not",
"config_path",
":",
"return",
"(",
"error",
",",
"config",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"config_path",
")",
":... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | getDerivedTarget | Get the specified target description, optionally ensuring that it (and
all dependencies) are installed in targets_path.
Returns (DerivedTarget, errors), or (None, errors) if the leaf target
could not be found/installed. | yotta/lib/target.py | def getDerivedTarget(
target_name_and_version,
targets_path,
application_dir = None,
install_missing = True,
update_installed = False,
additional_config = None,
shrinkwrap = None
):
# access, , get compo... | def getDerivedTarget(
target_name_and_version,
targets_path,
application_dir = None,
install_missing = True,
update_installed = False,
additional_config = None,
shrinkwrap = None
):
# access, , get compo... | [
"Get",
"the",
"specified",
"target",
"description",
"optionally",
"ensuring",
"that",
"it",
"(",
"and",
"all",
"dependencies",
")",
"are",
"installed",
"in",
"targets_path",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L105-L206 | [
"def",
"getDerivedTarget",
"(",
"target_name_and_version",
",",
"targets_path",
",",
"application_dir",
"=",
"None",
",",
"install_missing",
"=",
"True",
",",
"update_installed",
"=",
"False",
",",
"additional_config",
"=",
"None",
",",
"shrinkwrap",
"=",
"None",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | Target.baseTargetSpec | returns pack.DependencySpec for the base target of this target (or
None if this target does not inherit from another target. | yotta/lib/target.py | def baseTargetSpec(self):
''' returns pack.DependencySpec for the base target of this target (or
None if this target does not inherit from another target.
'''
inherits = self.description.get('inherits', {})
if len(inherits) == 1:
name, version_req = list(inherits.... | def baseTargetSpec(self):
''' returns pack.DependencySpec for the base target of this target (or
None if this target does not inherit from another target.
'''
inherits = self.description.get('inherits', {})
if len(inherits) == 1:
name, version_req = list(inherits.... | [
"returns",
"pack",
".",
"DependencySpec",
"for",
"the",
"base",
"target",
"of",
"this",
"target",
"(",
"or",
"None",
"if",
"this",
"target",
"does",
"not",
"inherit",
"from",
"another",
"target",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L235-L254 | [
"def",
"baseTargetSpec",
"(",
"self",
")",
":",
"inherits",
"=",
"self",
".",
"description",
".",
"get",
"(",
"'inherits'",
",",
"{",
"}",
")",
"if",
"len",
"(",
"inherits",
")",
"==",
"1",
":",
"name",
",",
"version_req",
"=",
"list",
"(",
"inherits... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.getScript | return the specified script if one exists (possibly inherited from
a base target) | yotta/lib/target.py | def getScript(self, scriptname):
''' return the specified script if one exists (possibly inherited from
a base target)
'''
for t in self.hierarchy:
s = t.getScript(scriptname)
if s:
return s
return None | def getScript(self, scriptname):
''' return the specified script if one exists (possibly inherited from
a base target)
'''
for t in self.hierarchy:
s = t.getScript(scriptname)
if s:
return s
return None | [
"return",
"the",
"specified",
"script",
"if",
"one",
"exists",
"(",
"possibly",
"inherited",
"from",
"a",
"base",
"target",
")"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L301-L309 | [
"def",
"getScript",
"(",
"self",
",",
"scriptname",
")",
":",
"for",
"t",
"in",
"self",
".",
"hierarchy",
":",
"s",
"=",
"t",
".",
"getScript",
"(",
"scriptname",
")",
"if",
"s",
":",
"return",
"s",
"return",
"None"
] | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget._loadConfig | load the configuration information from the target hierarchy | yotta/lib/target.py | def _loadConfig(self):
''' load the configuration information from the target hierarchy '''
config_dicts = [self.additional_config, self.app_config] + [t.getConfig() for t in self.hierarchy]
# create an identical set of dictionaries, but with the names of the
# sources in place of the va... | def _loadConfig(self):
''' load the configuration information from the target hierarchy '''
config_dicts = [self.additional_config, self.app_config] + [t.getConfig() for t in self.hierarchy]
# create an identical set of dictionaries, but with the names of the
# sources in place of the va... | [
"load",
"the",
"configuration",
"information",
"from",
"the",
"target",
"hierarchy"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L311-L325 | [
"def",
"_loadConfig",
"(",
"self",
")",
":",
"config_dicts",
"=",
"[",
"self",
".",
"additional_config",
",",
"self",
".",
"app_config",
"]",
"+",
"[",
"t",
".",
"getConfig",
"(",
")",
"for",
"t",
"in",
"self",
".",
"hierarchy",
"]",
"# create an identic... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.getToolchainFiles | return a list of toolchain file paths in override order (starting
at the bottom/leaf of the hierarchy and ending at the base).
The list is returned in the order they should be included
(most-derived last). | yotta/lib/target.py | def getToolchainFiles(self):
''' return a list of toolchain file paths in override order (starting
at the bottom/leaf of the hierarchy and ending at the base).
The list is returned in the order they should be included
(most-derived last).
'''
return reversed([... | def getToolchainFiles(self):
''' return a list of toolchain file paths in override order (starting
at the bottom/leaf of the hierarchy and ending at the base).
The list is returned in the order they should be included
(most-derived last).
'''
return reversed([... | [
"return",
"a",
"list",
"of",
"toolchain",
"file",
"paths",
"in",
"override",
"order",
"(",
"starting",
"at",
"the",
"bottom",
"/",
"leaf",
"of",
"the",
"hierarchy",
"and",
"ending",
"at",
"the",
"base",
")",
".",
"The",
"list",
"is",
"returned",
"in",
... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L367-L375 | [
"def",
"getToolchainFiles",
"(",
"self",
")",
":",
"return",
"reversed",
"(",
"[",
"os",
".",
"path",
".",
"join",
"(",
"x",
".",
"path",
",",
"x",
".",
"description",
"[",
"'toolchain'",
"]",
")",
"for",
"x",
"in",
"self",
".",
"hierarchy",
"if",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.getAdditionalIncludes | Return the list of cmake files which are to be included by yotta in
every module built. The list is returned in the order they should
be included (most-derived last). | yotta/lib/target.py | def getAdditionalIncludes(self):
''' Return the list of cmake files which are to be included by yotta in
every module built. The list is returned in the order they should
be included (most-derived last).
'''
return reversed([
os.path.join(t.path, include_file)... | def getAdditionalIncludes(self):
''' Return the list of cmake files which are to be included by yotta in
every module built. The list is returned in the order they should
be included (most-derived last).
'''
return reversed([
os.path.join(t.path, include_file)... | [
"Return",
"the",
"list",
"of",
"cmake",
"files",
"which",
"are",
"to",
"be",
"included",
"by",
"yotta",
"in",
"every",
"module",
"built",
".",
"The",
"list",
"is",
"returned",
"in",
"the",
"order",
"they",
"should",
"be",
"included",
"(",
"most",
"-",
... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L377-L386 | [
"def",
"getAdditionalIncludes",
"(",
"self",
")",
":",
"return",
"reversed",
"(",
"[",
"os",
".",
"path",
".",
"join",
"(",
"t",
".",
"path",
",",
"include_file",
")",
"for",
"t",
"in",
"self",
".",
"hierarchy",
"for",
"include_file",
"in",
"t",
".",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.inheritsFrom | Return true if this target inherits from the named target (directly
or indirectly. Also returns true if this target is the named
target. Otherwise return false. | yotta/lib/target.py | def inheritsFrom(self, target_name):
''' Return true if this target inherits from the named target (directly
or indirectly. Also returns true if this target is the named
target. Otherwise return false.
'''
for t in self.hierarchy:
if t and t.getName() == targe... | def inheritsFrom(self, target_name):
''' Return true if this target inherits from the named target (directly
or indirectly. Also returns true if this target is the named
target. Otherwise return false.
'''
for t in self.hierarchy:
if t and t.getName() == targe... | [
"Return",
"true",
"if",
"this",
"target",
"inherits",
"from",
"the",
"named",
"target",
"(",
"directly",
"or",
"indirectly",
".",
"Also",
"returns",
"true",
"if",
"this",
"target",
"is",
"the",
"named",
"target",
".",
"Otherwise",
"return",
"false",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L388-L396 | [
"def",
"inheritsFrom",
"(",
"self",
",",
"target_name",
")",
":",
"for",
"t",
"in",
"self",
".",
"hierarchy",
":",
"if",
"t",
"and",
"t",
".",
"getName",
"(",
")",
"==",
"target_name",
"or",
"target_name",
"in",
"t",
".",
"description",
".",
"get",
"... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.exec_helper | Execute the given command, returning an error message if an error occured
or None if the command was succesful. | yotta/lib/target.py | def exec_helper(self, cmd, builddir):
''' Execute the given command, returning an error message if an error occured
or None if the command was succesful.'''
try:
child = subprocess.Popen(cmd, cwd=builddir)
child.wait()
except OSError as e:
if e.err... | def exec_helper(self, cmd, builddir):
''' Execute the given command, returning an error message if an error occured
or None if the command was succesful.'''
try:
child = subprocess.Popen(cmd, cwd=builddir)
child.wait()
except OSError as e:
if e.err... | [
"Execute",
"the",
"given",
"command",
"returning",
"an",
"error",
"message",
"if",
"an",
"error",
"occured",
"or",
"None",
"if",
"the",
"command",
"was",
"succesful",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L460-L475 | [
"def",
"exec_helper",
"(",
"self",
",",
"cmd",
",",
"builddir",
")",
":",
"try",
":",
"child",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"cwd",
"=",
"builddir",
")",
"child",
".",
"wait",
"(",
")",
"except",
"OSError",
"as",
"e",
":",
"if",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.build | Execute the commands necessary to build this component, and all of
its dependencies. | yotta/lib/target.py | def build(self, builddir, component, args, release_build=False, build_args=None, targets=None,
release_no_debug_info_build=False):
''' Execute the commands necessary to build this component, and all of
its dependencies. '''
if build_args is None:
build_args = []
... | def build(self, builddir, component, args, release_build=False, build_args=None, targets=None,
release_no_debug_info_build=False):
''' Execute the commands necessary to build this component, and all of
its dependencies. '''
if build_args is None:
build_args = []
... | [
"Execute",
"the",
"commands",
"necessary",
"to",
"build",
"this",
"component",
"and",
"all",
"of",
"its",
"dependencies",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L478-L519 | [
"def",
"build",
"(",
"self",
",",
"builddir",
",",
"component",
",",
"args",
",",
"release_build",
"=",
"False",
",",
"build_args",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"release_no_debug_info_build",
"=",
"False",
")",
":",
"if",
"build_args",
"i... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.findProgram | Return the builddir-relative path of program, if only a partial
path is specified. Returns None and logs an error message if the
program is ambiguous or not found | yotta/lib/target.py | def findProgram(self, builddir, program):
''' Return the builddir-relative path of program, if only a partial
path is specified. Returns None and logs an error message if the
program is ambiguous or not found
'''
# if this is an exact match, do no further checking:
if os... | def findProgram(self, builddir, program):
''' Return the builddir-relative path of program, if only a partial
path is specified. Returns None and logs an error message if the
program is ambiguous or not found
'''
# if this is an exact match, do no further checking:
if os... | [
"Return",
"the",
"builddir",
"-",
"relative",
"path",
"of",
"program",
"if",
"only",
"a",
"partial",
"path",
"is",
"specified",
".",
"Returns",
"None",
"and",
"logs",
"an",
"error",
"message",
"if",
"the",
"program",
"is",
"ambiguous",
"or",
"not",
"found"... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L521-L595 | [
"def",
"findProgram",
"(",
"self",
",",
"builddir",
",",
"program",
")",
":",
"# if this is an exact match, do no further checking:",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"builddir",
",",
"program",
")",
")",
":",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.start | Launch the specified program. Uses the `start` script if specified
by the target, attempts to run it natively if that script is not
defined. | yotta/lib/target.py | def start(self, builddir, program, forward_args):
''' Launch the specified program. Uses the `start` script if specified
by the target, attempts to run it natively if that script is not
defined.
'''
child = None
try:
prog_path = self.findProgram(buildd... | def start(self, builddir, program, forward_args):
''' Launch the specified program. Uses the `start` script if specified
by the target, attempts to run it natively if that script is not
defined.
'''
child = None
try:
prog_path = self.findProgram(buildd... | [
"Launch",
"the",
"specified",
"program",
".",
"Uses",
"the",
"start",
"script",
"if",
"specified",
"by",
"the",
"target",
"attempts",
"to",
"run",
"it",
"natively",
"if",
"that",
"script",
"is",
"not",
"defined",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L609-L645 | [
"def",
"start",
"(",
"self",
",",
"builddir",
",",
"program",
",",
"forward_args",
")",
":",
"child",
"=",
"None",
"try",
":",
"prog_path",
"=",
"self",
".",
"findProgram",
"(",
"builddir",
",",
"program",
")",
"if",
"prog_path",
"is",
"None",
":",
"re... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | DerivedTarget.debug | Launch a debugger for the specified program. Uses the `debug`
script if specified by the target, falls back to the `debug` and
`debugServer` commands if not. `program` is inserted into the
$program variable in commands. | yotta/lib/target.py | def debug(self, builddir, program):
''' Launch a debugger for the specified program. Uses the `debug`
script if specified by the target, falls back to the `debug` and
`debugServer` commands if not. `program` is inserted into the
$program variable in commands.
'''
... | def debug(self, builddir, program):
''' Launch a debugger for the specified program. Uses the `debug`
script if specified by the target, falls back to the `debug` and
`debugServer` commands if not. `program` is inserted into the
$program variable in commands.
'''
... | [
"Launch",
"a",
"debugger",
"for",
"the",
"specified",
"program",
".",
"Uses",
"the",
"debug",
"script",
"if",
"specified",
"by",
"the",
"target",
"falls",
"back",
"to",
"the",
"debug",
"and",
"debugServer",
"commands",
"if",
"not",
".",
"program",
"is",
"i... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/target.py#L647-L668 | [
"def",
"debug",
"(",
"self",
",",
"builddir",
",",
"program",
")",
":",
"try",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"_ignoreSignal",
")",
"if",
"self",
".",
"getScript",
"(",
"'debug'",
")",
"is",
"not",
"None",
":",
"retu... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | which | look for "program" in PATH (respecting PATHEXT), and return the path to
it, or None if it was not found | yotta/lib/fsutils_win.py | def which(program):
''' look for "program" in PATH (respecting PATHEXT), and return the path to
it, or None if it was not found
'''
# current directory / absolute paths:
if os.path.exists(program) and os.access(program, os.X_OK):
return program
# PATH:
for path in os.environ['PAT... | def which(program):
''' look for "program" in PATH (respecting PATHEXT), and return the path to
it, or None if it was not found
'''
# current directory / absolute paths:
if os.path.exists(program) and os.access(program, os.X_OK):
return program
# PATH:
for path in os.environ['PAT... | [
"look",
"for",
"program",
"in",
"PATH",
"(",
"respecting",
"PATHEXT",
")",
"and",
"return",
"the",
"path",
"to",
"it",
"or",
"None",
"if",
"it",
"was",
"not",
"found"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/fsutils_win.py#L57-L73 | [
"def",
"which",
"(",
"program",
")",
":",
"# current directory / absolute paths:",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"program",
")",
"and",
"os",
".",
"access",
"(",
"program",
",",
"os",
".",
"X_OK",
")",
":",
"return",
"program",
"# PATH:",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | pruneCache | Prune the cache | yotta/lib/access_common.py | def pruneCache():
''' Prune the cache '''
cache_dir = folders.cacheDirectory()
def fullpath(f):
return os.path.join(cache_dir, f)
def getMTimeSafe(f):
# it's possible that another process removed the file before we stat
# it, handle this gracefully
try:
return... | def pruneCache():
''' Prune the cache '''
cache_dir = folders.cacheDirectory()
def fullpath(f):
return os.path.join(cache_dir, f)
def getMTimeSafe(f):
# it's possible that another process removed the file before we stat
# it, handle this gracefully
try:
return... | [
"Prune",
"the",
"cache"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L112-L137 | [
"def",
"pruneCache",
"(",
")",
":",
"cache_dir",
"=",
"folders",
".",
"cacheDirectory",
"(",
")",
"def",
"fullpath",
"(",
"f",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"cache_dir",
",",
"f",
")",
"def",
"getMTimeSafe",
"(",
"f",
")",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | sometimesPruneCache | return decorator to prune cache after calling fn with a probability of p | yotta/lib/access_common.py | def sometimesPruneCache(p):
''' return decorator to prune cache after calling fn with a probability of p'''
def decorator(fn):
@functools.wraps(fn)
def wrapped(*args, **kwargs):
r = fn(*args, **kwargs)
if random.random() < p:
pruneCache()
retur... | def sometimesPruneCache(p):
''' return decorator to prune cache after calling fn with a probability of p'''
def decorator(fn):
@functools.wraps(fn)
def wrapped(*args, **kwargs):
r = fn(*args, **kwargs)
if random.random() < p:
pruneCache()
retur... | [
"return",
"decorator",
"to",
"prune",
"cache",
"after",
"calling",
"fn",
"with",
"a",
"probability",
"of",
"p"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L139-L149 | [
"def",
"sometimesPruneCache",
"(",
"p",
")",
":",
"def",
"decorator",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"fn",
"(",
"*",
"args",
... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | unpackFromCache | If the specified cache key exists, unpack the tarball into the
specified directory, otherwise raise NotInCache (a KeyError subclass). | yotta/lib/access_common.py | def unpackFromCache(cache_key, to_directory):
''' If the specified cache key exists, unpack the tarball into the
specified directory, otherwise raise NotInCache (a KeyError subclass).
'''
if cache_key is None:
raise NotInCache('"None" is never in cache')
cache_key = _encodeCacheKey(cach... | def unpackFromCache(cache_key, to_directory):
''' If the specified cache key exists, unpack the tarball into the
specified directory, otherwise raise NotInCache (a KeyError subclass).
'''
if cache_key is None:
raise NotInCache('"None" is never in cache')
cache_key = _encodeCacheKey(cach... | [
"If",
"the",
"specified",
"cache",
"key",
"exists",
"unpack",
"the",
"tarball",
"into",
"the",
"specified",
"directory",
"otherwise",
"raise",
"NotInCache",
"(",
"a",
"KeyError",
"subclass",
")",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L208-L240 | [
"def",
"unpackFromCache",
"(",
"cache_key",
",",
"to_directory",
")",
":",
"if",
"cache_key",
"is",
"None",
":",
"raise",
"NotInCache",
"(",
"'\"None\" is never in cache'",
")",
"cache_key",
"=",
"_encodeCacheKey",
"(",
"cache_key",
")",
"cache_dir",
"=",
"folders... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _downloadToCache | Download the specified stream to a temporary cache directory, and
returns a cache key that can be used to access/remove the file.
You should use either removeFromCache(cache_key) or _moveCachedFile to
move the downloaded file to a known key after downloading. | yotta/lib/access_common.py | def _downloadToCache(stream, hashinfo={}, origin_info=dict()):
''' Download the specified stream to a temporary cache directory, and
returns a cache key that can be used to access/remove the file.
You should use either removeFromCache(cache_key) or _moveCachedFile to
move the downloaded file... | def _downloadToCache(stream, hashinfo={}, origin_info=dict()):
''' Download the specified stream to a temporary cache directory, and
returns a cache key that can be used to access/remove the file.
You should use either removeFromCache(cache_key) or _moveCachedFile to
move the downloaded file... | [
"Download",
"the",
"specified",
"stream",
"to",
"a",
"temporary",
"cache",
"directory",
"and",
"returns",
"a",
"cache",
"key",
"that",
"can",
"be",
"used",
"to",
"access",
"/",
"remove",
"the",
"file",
".",
"You",
"should",
"use",
"either",
"removeFromCache"... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L242-L297 | [
"def",
"_downloadToCache",
"(",
"stream",
",",
"hashinfo",
"=",
"{",
"}",
",",
"origin_info",
"=",
"dict",
"(",
")",
")",
":",
"hash_name",
"=",
"None",
"hash_value",
"=",
"None",
"m",
"=",
"None",
"if",
"len",
"(",
"hashinfo",
")",
":",
"# check for h... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | _moveCachedFile | Move a file atomically within the cache: used to make cached files
available at known keys, so they can be used by other processes. | yotta/lib/access_common.py | def _moveCachedFile(from_key, to_key):
''' Move a file atomically within the cache: used to make cached files
available at known keys, so they can be used by other processes.
'''
cache_dir = folders.cacheDirectory()
from_path = os.path.join(cache_dir, from_key)
to_path = os.path.join(cache... | def _moveCachedFile(from_key, to_key):
''' Move a file atomically within the cache: used to make cached files
available at known keys, so they can be used by other processes.
'''
cache_dir = folders.cacheDirectory()
from_path = os.path.join(cache_dir, from_key)
to_path = os.path.join(cache... | [
"Move",
"a",
"file",
"atomically",
"within",
"the",
"cache",
":",
"used",
"to",
"make",
"cached",
"files",
"available",
"at",
"known",
"keys",
"so",
"they",
"can",
"be",
"used",
"by",
"other",
"processes",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L299-L321 | [
"def",
"_moveCachedFile",
"(",
"from_key",
",",
"to_key",
")",
":",
"cache_dir",
"=",
"folders",
".",
"cacheDirectory",
"(",
")",
"from_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cache_dir",
",",
"from_key",
")",
"to_path",
"=",
"os",
".",
"path",... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | unpackTarballStream | Unpack a responses stream that contains a tarball into a directory. If
a hash is provided, then it will be used as a cache key (for future
requests you can try to retrieve the key value from the cache first,
before making the request) | yotta/lib/access_common.py | def unpackTarballStream(stream, into_directory, hash={}, cache_key=None, origin_info=dict()):
''' Unpack a responses stream that contains a tarball into a directory. If
a hash is provided, then it will be used as a cache key (for future
requests you can try to retrieve the key value from the cache f... | def unpackTarballStream(stream, into_directory, hash={}, cache_key=None, origin_info=dict()):
''' Unpack a responses stream that contains a tarball into a directory. If
a hash is provided, then it will be used as a cache key (for future
requests you can try to retrieve the key value from the cache f... | [
"Unpack",
"a",
"responses",
"stream",
"that",
"contains",
"a",
"tarball",
"into",
"a",
"directory",
".",
"If",
"a",
"hash",
"is",
"provided",
"then",
"it",
"will",
"be",
"used",
"as",
"a",
"cache",
"key",
"(",
"for",
"future",
"requests",
"you",
"can",
... | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/access_common.py#L324-L346 | [
"def",
"unpackTarballStream",
"(",
"stream",
",",
"into_directory",
",",
"hash",
"=",
"{",
"}",
",",
"cache_key",
"=",
"None",
",",
"origin_info",
"=",
"dict",
"(",
")",
")",
":",
"cache_key",
"=",
"_encodeCacheKey",
"(",
"cache_key",
")",
"# if the cache is... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | parseSourceURL | Parse the specified version source URL (or version spec), and return an
instance of VersionSource | yotta/lib/sourceparse.py | def parseSourceURL(source_url):
''' Parse the specified version source URL (or version spec), and return an
instance of VersionSource
'''
name, spec = _getNonRegistryRef(source_url)
if spec:
return spec
try:
url_is_spec = version.Spec(source_url)
except ValueError:
... | def parseSourceURL(source_url):
''' Parse the specified version source URL (or version spec), and return an
instance of VersionSource
'''
name, spec = _getNonRegistryRef(source_url)
if spec:
return spec
try:
url_is_spec = version.Spec(source_url)
except ValueError:
... | [
"Parse",
"the",
"specified",
"version",
"source",
"URL",
"(",
"or",
"version",
"spec",
")",
"and",
"return",
"an",
"instance",
"of",
"VersionSource"
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/sourceparse.py#L96-L114 | [
"def",
"parseSourceURL",
"(",
"source_url",
")",
":",
"name",
",",
"spec",
"=",
"_getNonRegistryRef",
"(",
"source_url",
")",
"if",
"spec",
":",
"return",
"spec",
"try",
":",
"url_is_spec",
"=",
"version",
".",
"Spec",
"(",
"source_url",
")",
"except",
"Va... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | parseTargetNameAndSpec | Parse targetname[@versionspec] and return a tuple
(target_name_string, version_spec_string).
targetname[,versionspec] is also supported (this is how target names
and specifications are stored internally, and was the documented way of
setting the spec on the commandline)
Also ac... | yotta/lib/sourceparse.py | def parseTargetNameAndSpec(target_name_and_spec):
''' Parse targetname[@versionspec] and return a tuple
(target_name_string, version_spec_string).
targetname[,versionspec] is also supported (this is how target names
and specifications are stored internally, and was the documented way of
... | def parseTargetNameAndSpec(target_name_and_spec):
''' Parse targetname[@versionspec] and return a tuple
(target_name_string, version_spec_string).
targetname[,versionspec] is also supported (this is how target names
and specifications are stored internally, and was the documented way of
... | [
"Parse",
"targetname",
"[",
"@versionspec",
"]",
"and",
"return",
"a",
"tuple",
"(",
"target_name_string",
"version_spec_string",
")",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/sourceparse.py#L128-L165 | [
"def",
"parseTargetNameAndSpec",
"(",
"target_name_and_spec",
")",
":",
"import",
"re",
"# fist check if this is a raw github specification that we can get the",
"# target name from:",
"name",
",",
"spec",
"=",
"_getNonRegistryRef",
"(",
"target_name_and_spec",
")",
"if",
"name... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | parseModuleNameAndSpec | Parse modulename[@versionspec] and return a tuple
(module_name_string, version_spec_string).
Also accepts raw github version specs (Owner/reponame#whatever), as the
name can be deduced from these.
Note that the specification split from the name is not validated. If
there is no ... | yotta/lib/sourceparse.py | def parseModuleNameAndSpec(module_name_and_spec):
''' Parse modulename[@versionspec] and return a tuple
(module_name_string, version_spec_string).
Also accepts raw github version specs (Owner/reponame#whatever), as the
name can be deduced from these.
Note that the specification spl... | def parseModuleNameAndSpec(module_name_and_spec):
''' Parse modulename[@versionspec] and return a tuple
(module_name_string, version_spec_string).
Also accepts raw github version specs (Owner/reponame#whatever), as the
name can be deduced from these.
Note that the specification spl... | [
"Parse",
"modulename",
"[",
"@versionspec",
"]",
"and",
"return",
"a",
"tuple",
"(",
"module_name_string",
"version_spec_string",
")",
"."
] | ARMmbed/yotta | python | https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/sourceparse.py#L167-L196 | [
"def",
"parseModuleNameAndSpec",
"(",
"module_name_and_spec",
")",
":",
"import",
"re",
"# fist check if this is a raw github specification that we can get the",
"# module name from:",
"name",
",",
"spec",
"=",
"_getNonRegistryRef",
"(",
"module_name_and_spec",
")",
"if",
"name... | 56bc1e56c602fa20307b23fe27518e9cd6c11af1 |
valid | gfit | Fit empirical Bayes prior in the hierarchical model [Efron2014]_.
.. math::
mu ~ G, X ~ N(mu, sigma^2)
Parameters
----------
X: ndarray
A 1D array of observations.
sigma: float
Noise estimate on X.
p: int
Number of parameters used to fit G. Default: 5
nbin:... | forestci/calibration.py | def gfit(X, sigma, p=5, nbin=200, unif_fraction=0.1):
"""
Fit empirical Bayes prior in the hierarchical model [Efron2014]_.
.. math::
mu ~ G, X ~ N(mu, sigma^2)
Parameters
----------
X: ndarray
A 1D array of observations.
sigma: float
Noise estimate on X.
p: in... | def gfit(X, sigma, p=5, nbin=200, unif_fraction=0.1):
"""
Fit empirical Bayes prior in the hierarchical model [Efron2014]_.
.. math::
mu ~ G, X ~ N(mu, sigma^2)
Parameters
----------
X: ndarray
A 1D array of observations.
sigma: float
Noise estimate on X.
p: in... | [
"Fit",
"empirical",
"Bayes",
"prior",
"in",
"the",
"hierarchical",
"model",
"[",
"Efron2014",
"]",
"_",
"."
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/calibration.py#L35-L106 | [
"def",
"gfit",
"(",
"X",
",",
"sigma",
",",
"p",
"=",
"5",
",",
"nbin",
"=",
"200",
",",
"unif_fraction",
"=",
"0.1",
")",
":",
"min_x",
"=",
"min",
"(",
"min",
"(",
"X",
")",
"-",
"2",
"*",
"np",
".",
"std",
"(",
"X",
",",
"ddof",
"=",
"... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | gbayes | Estimate Bayes posterior with Gaussian noise [Efron2014]_.
Parameters
----------
x0: ndarray
an observation
g_est: float
a prior density, as returned by gfit
sigma: int
noise estimate
Returns
-------
An array of the posterior estimate E[mu | x0] | forestci/calibration.py | def gbayes(x0, g_est, sigma):
"""
Estimate Bayes posterior with Gaussian noise [Efron2014]_.
Parameters
----------
x0: ndarray
an observation
g_est: float
a prior density, as returned by gfit
sigma: int
noise estimate
Returns
-------
An array of the post... | def gbayes(x0, g_est, sigma):
"""
Estimate Bayes posterior with Gaussian noise [Efron2014]_.
Parameters
----------
x0: ndarray
an observation
g_est: float
a prior density, as returned by gfit
sigma: int
noise estimate
Returns
-------
An array of the post... | [
"Estimate",
"Bayes",
"posterior",
"with",
"Gaussian",
"noise",
"[",
"Efron2014",
"]",
"_",
"."
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/calibration.py#L109-L130 | [
"def",
"gbayes",
"(",
"x0",
",",
"g_est",
",",
"sigma",
")",
":",
"Kx",
"=",
"norm",
"(",
")",
".",
"pdf",
"(",
"(",
"g_est",
"[",
"0",
"]",
"-",
"x0",
")",
"/",
"sigma",
")",
"post",
"=",
"Kx",
"*",
"g_est",
"[",
"1",
"]",
"post",
"/=",
... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | calibrateEB | Calibrate noisy variance estimates with empirical Bayes.
Parameters
----------
vars: ndarray
List of variance estimates.
sigma2: int
Estimate of the Monte Carlo noise in vars.
Returns
-------
An array of the calibrated variance estimates | forestci/calibration.py | def calibrateEB(variances, sigma2):
"""
Calibrate noisy variance estimates with empirical Bayes.
Parameters
----------
vars: ndarray
List of variance estimates.
sigma2: int
Estimate of the Monte Carlo noise in vars.
Returns
-------
An array of the calibrated varianc... | def calibrateEB(variances, sigma2):
"""
Calibrate noisy variance estimates with empirical Bayes.
Parameters
----------
vars: ndarray
List of variance estimates.
sigma2: int
Estimate of the Monte Carlo noise in vars.
Returns
-------
An array of the calibrated varianc... | [
"Calibrate",
"noisy",
"variance",
"estimates",
"with",
"empirical",
"Bayes",
"."
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/calibration.py#L133-L164 | [
"def",
"calibrateEB",
"(",
"variances",
",",
"sigma2",
")",
":",
"if",
"(",
"sigma2",
"<=",
"0",
"or",
"min",
"(",
"variances",
")",
"==",
"max",
"(",
"variances",
")",
")",
":",
"return",
"(",
"np",
".",
"maximum",
"(",
"variances",
",",
"0",
")",... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | calc_inbag | Derive samples used to create trees in scikit-learn RandomForest objects.
Recovers the samples in each tree from the random state of that tree using
:func:`forest._generate_sample_indices`.
Parameters
----------
n_samples : int
The number of samples used to fit the scikit-learn RandomFores... | forestci/forestci.py | def calc_inbag(n_samples, forest):
"""
Derive samples used to create trees in scikit-learn RandomForest objects.
Recovers the samples in each tree from the random state of that tree using
:func:`forest._generate_sample_indices`.
Parameters
----------
n_samples : int
The number of s... | def calc_inbag(n_samples, forest):
"""
Derive samples used to create trees in scikit-learn RandomForest objects.
Recovers the samples in each tree from the random state of that tree using
:func:`forest._generate_sample_indices`.
Parameters
----------
n_samples : int
The number of s... | [
"Derive",
"samples",
"used",
"to",
"create",
"trees",
"in",
"scikit",
"-",
"learn",
"RandomForest",
"objects",
"."
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L32-L67 | [
"def",
"calc_inbag",
"(",
"n_samples",
",",
"forest",
")",
":",
"if",
"not",
"forest",
".",
"bootstrap",
":",
"e_s",
"=",
"\"Cannot calculate the inbag from a forest that has \"",
"e_s",
"=",
"\" bootstrap=False\"",
"raise",
"ValueError",
"(",
"e_s",
")",
"n_trees",... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | _core_computation | Helper function, that performs the core computation
Parameters
----------
X_train : ndarray
An array with shape (n_train_sample, n_features).
X_test : ndarray
An array with shape (n_test_sample, n_features).
inbag : ndarray
The inbag matrix that fit the data. If set to `No... | forestci/forestci.py | def _core_computation(X_train, X_test, inbag, pred_centered, n_trees,
memory_constrained=False, memory_limit=None,
test_mode=False):
"""
Helper function, that performs the core computation
Parameters
----------
X_train : ndarray
An array with shap... | def _core_computation(X_train, X_test, inbag, pred_centered, n_trees,
memory_constrained=False, memory_limit=None,
test_mode=False):
"""
Helper function, that performs the core computation
Parameters
----------
X_train : ndarray
An array with shap... | [
"Helper",
"function",
"that",
"performs",
"the",
"core",
"computation"
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L70-L132 | [
"def",
"_core_computation",
"(",
"X_train",
",",
"X_test",
",",
"inbag",
",",
"pred_centered",
",",
"n_trees",
",",
"memory_constrained",
"=",
"False",
",",
"memory_limit",
"=",
"None",
",",
"test_mode",
"=",
"False",
")",
":",
"if",
"not",
"memory_constrained... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | _bias_correction | Helper functions that implements bias correction
Parameters
----------
V_IJ : ndarray
Intermediate result in the computation.
inbag : ndarray
The inbag matrix that fit the data. If set to `None` (default) it
will be inferred from the forest. However, this only works for trees
... | forestci/forestci.py | def _bias_correction(V_IJ, inbag, pred_centered, n_trees):
"""
Helper functions that implements bias correction
Parameters
----------
V_IJ : ndarray
Intermediate result in the computation.
inbag : ndarray
The inbag matrix that fit the data. If set to `None` (default) it
... | def _bias_correction(V_IJ, inbag, pred_centered, n_trees):
"""
Helper functions that implements bias correction
Parameters
----------
V_IJ : ndarray
Intermediate result in the computation.
inbag : ndarray
The inbag matrix that fit the data. If set to `None` (default) it
... | [
"Helper",
"functions",
"that",
"implements",
"bias",
"correction"
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L135-L164 | [
"def",
"_bias_correction",
"(",
"V_IJ",
",",
"inbag",
",",
"pred_centered",
",",
"n_trees",
")",
":",
"n_train_samples",
"=",
"inbag",
".",
"shape",
"[",
"0",
"]",
"n_var",
"=",
"np",
".",
"mean",
"(",
"np",
".",
"square",
"(",
"inbag",
"[",
"0",
":"... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | random_forest_error | Calculate error bars from scikit-learn RandomForest estimators.
RandomForest is a regressor or classifier object
this variance can be used to plot error bars for RandomForest objects
Parameters
----------
forest : RandomForest
Regressor or Classifier object.
X_train : ndarray
... | forestci/forestci.py | def random_forest_error(forest, X_train, X_test, inbag=None,
calibrate=True, memory_constrained=False,
memory_limit=None):
"""
Calculate error bars from scikit-learn RandomForest estimators.
RandomForest is a regressor or classifier object
this variance c... | def random_forest_error(forest, X_train, X_test, inbag=None,
calibrate=True, memory_constrained=False,
memory_limit=None):
"""
Calculate error bars from scikit-learn RandomForest estimators.
RandomForest is a regressor or classifier object
this variance c... | [
"Calculate",
"error",
"bars",
"from",
"scikit",
"-",
"learn",
"RandomForest",
"estimators",
"."
] | scikit-learn-contrib/forest-confidence-interval | python | https://github.com/scikit-learn-contrib/forest-confidence-interval/blob/401c63a74a27d775eff0f72b6c20ffd568491fe0/forestci/forestci.py#L167-L275 | [
"def",
"random_forest_error",
"(",
"forest",
",",
"X_train",
",",
"X_test",
",",
"inbag",
"=",
"None",
",",
"calibrate",
"=",
"True",
",",
"memory_constrained",
"=",
"False",
",",
"memory_limit",
"=",
"None",
")",
":",
"if",
"inbag",
"is",
"None",
":",
"... | 401c63a74a27d775eff0f72b6c20ffd568491fe0 |
valid | SSLSatchel.generate_self_signed_certificate | Generates a self-signed certificate for use in an internal development
environment for testing SSL pages.
http://almostalldigital.wordpress.com/2013/03/07/self-signed-ssl-certificate-for-ec2-load-balancer/ | burlap/ssl.py | def generate_self_signed_certificate(self, domain='', r=None):
"""
Generates a self-signed certificate for use in an internal development
environment for testing SSL pages.
http://almostalldigital.wordpress.com/2013/03/07/self-signed-ssl-certificate-for-ec2-load-balancer/
"""
... | def generate_self_signed_certificate(self, domain='', r=None):
"""
Generates a self-signed certificate for use in an internal development
environment for testing SSL pages.
http://almostalldigital.wordpress.com/2013/03/07/self-signed-ssl-certificate-for-ec2-load-balancer/
"""
... | [
"Generates",
"a",
"self",
"-",
"signed",
"certificate",
"for",
"use",
"in",
"an",
"internal",
"development",
"environment",
"for",
"testing",
"SSL",
"pages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ssl.py#L35-L53 | [
"def",
"generate_self_signed_certificate",
"(",
"self",
",",
"domain",
"=",
"''",
",",
"r",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"domain",
"=",
"domain",
"or",
"r",
".",
"env",
".",
"domain",
"assert",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SSLSatchel.generate_csr | Creates a certificate signing request to be submitted to a formal
certificate authority to generate a certificate.
Note, the provider may say the CSR must be created on the target server,
but this is not necessary. | burlap/ssl.py | def generate_csr(self, domain='', r=None):
"""
Creates a certificate signing request to be submitted to a formal
certificate authority to generate a certificate.
Note, the provider may say the CSR must be created on the target server,
but this is not necessary.
"""
... | def generate_csr(self, domain='', r=None):
"""
Creates a certificate signing request to be submitted to a formal
certificate authority to generate a certificate.
Note, the provider may say the CSR must be created on the target server,
but this is not necessary.
"""
... | [
"Creates",
"a",
"certificate",
"signing",
"request",
"to",
"be",
"submitted",
"to",
"a",
"formal",
"certificate",
"authority",
"to",
"generate",
"a",
"certificate",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ssl.py#L57-L82 | [
"def",
"generate_csr",
"(",
"self",
",",
"domain",
"=",
"''",
",",
"r",
"=",
"None",
")",
":",
"r",
"=",
"r",
"or",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"domain",
"=",
"domain",
"or",
"r",
".",
"env",
".",
"domain",
"role",
"=",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SSLSatchel.get_expiration_date | Reads the expiration date of a local crt file. | burlap/ssl.py | def get_expiration_date(self, fn):
"""
Reads the expiration date of a local crt file.
"""
r = self.local_renderer
r.env.crt_fn = fn
with hide('running'):
ret = r.local('openssl x509 -noout -in {ssl_crt_fn} -dates', capture=True)
matches = re.findall('n... | def get_expiration_date(self, fn):
"""
Reads the expiration date of a local crt file.
"""
r = self.local_renderer
r.env.crt_fn = fn
with hide('running'):
ret = r.local('openssl x509 -noout -in {ssl_crt_fn} -dates', capture=True)
matches = re.findall('n... | [
"Reads",
"the",
"expiration",
"date",
"of",
"a",
"local",
"crt",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ssl.py#L84-L94 | [
"def",
"get_expiration_date",
"(",
"self",
",",
"fn",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"crt_fn",
"=",
"fn",
"with",
"hide",
"(",
"'running'",
")",
":",
"ret",
"=",
"r",
".",
"local",
"(",
"'openssl x509 -noout -i... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SSLSatchel.list_expiration_dates | Scans through all local .crt files and displays the expiration dates. | burlap/ssl.py | def list_expiration_dates(self, base='roles/all/ssl'):
"""
Scans through all local .crt files and displays the expiration dates.
"""
max_fn_len = 0
max_date_len = 0
data = []
for fn in os.listdir(base):
fqfn = os.path.join(base, fn)
if not ... | def list_expiration_dates(self, base='roles/all/ssl'):
"""
Scans through all local .crt files and displays the expiration dates.
"""
max_fn_len = 0
max_date_len = 0
data = []
for fn in os.listdir(base):
fqfn = os.path.join(base, fn)
if not ... | [
"Scans",
"through",
"all",
"local",
".",
"crt",
"files",
"and",
"displays",
"the",
"expiration",
"dates",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ssl.py#L97-L124 | [
"def",
"list_expiration_dates",
"(",
"self",
",",
"base",
"=",
"'roles/all/ssl'",
")",
":",
"max_fn_len",
"=",
"0",
"max_date_len",
"=",
"0",
"data",
"=",
"[",
"]",
"for",
"fn",
"in",
"os",
".",
"listdir",
"(",
"base",
")",
":",
"fqfn",
"=",
"os",
".... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SSLSatchel.verify_certificate_chain | Confirms the key, CSR, and certificate files all match. | burlap/ssl.py | def verify_certificate_chain(self, base=None, crt=None, csr=None, key=None):
"""
Confirms the key, CSR, and certificate files all match.
"""
from burlap.common import get_verbose, print_fail, print_success
r = self.local_renderer
if base:
crt = base + '.crt'... | def verify_certificate_chain(self, base=None, crt=None, csr=None, key=None):
"""
Confirms the key, CSR, and certificate files all match.
"""
from burlap.common import get_verbose, print_fail, print_success
r = self.local_renderer
if base:
crt = base + '.crt'... | [
"Confirms",
"the",
"key",
"CSR",
"and",
"certificate",
"files",
"all",
"match",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ssl.py#L127-L161 | [
"def",
"verify_certificate_chain",
"(",
"self",
",",
"base",
"=",
"None",
",",
"crt",
"=",
"None",
",",
"csr",
"=",
"None",
",",
"key",
"=",
"None",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"get_verbose",
",",
"print_fail",
",",
"print_succes... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | _get_environ_handler | Dynamically creates a Fabric task for each configuration role. | burlap/__init__.py | def _get_environ_handler(name, d):
"""
Dynamically creates a Fabric task for each configuration role.
"""
def func(site=None, **kwargs):
from fabric import state
# We can't auto-set default_site, because that break tasks that have
# to operate over multiple sites.
# If ... | def _get_environ_handler(name, d):
"""
Dynamically creates a Fabric task for each configuration role.
"""
def func(site=None, **kwargs):
from fabric import state
# We can't auto-set default_site, because that break tasks that have
# to operate over multiple sites.
# If ... | [
"Dynamically",
"creates",
"a",
"Fabric",
"task",
"for",
"each",
"configuration",
"role",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/__init__.py#L80-L185 | [
"def",
"_get_environ_handler",
"(",
"name",
",",
"d",
")",
":",
"def",
"func",
"(",
"site",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"fabric",
"import",
"state",
"# We can't auto-set default_site, because that break tasks that have",
"# to operate ove... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | update_merge | Recursively merges two dictionaries.
Uses fabric's AttributeDict so you can reference values via dot-notation.
e.g. env.value1.value2.value3...
http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth | burlap/__init__.py | def update_merge(d, u):
"""
Recursively merges two dictionaries.
Uses fabric's AttributeDict so you can reference values via dot-notation.
e.g. env.value1.value2.value3...
http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
"""
import collections... | def update_merge(d, u):
"""
Recursively merges two dictionaries.
Uses fabric's AttributeDict so you can reference values via dot-notation.
e.g. env.value1.value2.value3...
http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
"""
import collections... | [
"Recursively",
"merges",
"two",
"dictionaries",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/__init__.py#L187-L203 | [
"def",
"update_merge",
"(",
"d",
",",
"u",
")",
":",
"import",
"collections",
"for",
"k",
",",
"v",
"in",
"u",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"collections",
".",
"Mapping",
")",
":",
"r",
"=",
"update_merge",
"(",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | check_version | Compares the local version against the latest official version on PyPI and displays a warning message if a newer release is available.
This check can be disabled by setting the environment variable BURLAP_CHECK_VERSION=0. | burlap/__init__.py | def check_version():
"""
Compares the local version against the latest official version on PyPI and displays a warning message if a newer release is available.
This check can be disabled by setting the environment variable BURLAP_CHECK_VERSION=0.
"""
global CHECK_VERSION
if not CHECK_VERSION:
... | def check_version():
"""
Compares the local version against the latest official version on PyPI and displays a warning message if a newer release is available.
This check can be disabled by setting the environment variable BURLAP_CHECK_VERSION=0.
"""
global CHECK_VERSION
if not CHECK_VERSION:
... | [
"Compares",
"the",
"local",
"version",
"against",
"the",
"latest",
"official",
"version",
"on",
"PyPI",
"and",
"displays",
"a",
"warning",
"message",
"if",
"a",
"newer",
"release",
"is",
"available",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/__init__.py#L287-L316 | [
"def",
"check_version",
"(",
")",
":",
"global",
"CHECK_VERSION",
"if",
"not",
"CHECK_VERSION",
":",
"return",
"# Ensure we only check once in this process.",
"CHECK_VERSION",
"=",
"0",
"# Lookup most recent remote version.",
"from",
"six",
".",
"moves",
".",
"urllib",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | populate_fabfile | Automatically includes all submodules and role selectors
in the top-level fabfile using spooky-scary black magic.
This allows us to avoid manually declaring imports for every module, e.g.
import burlap.pip
import burlap.vm
import burlap...
which has the added benefit of allowing u... | burlap/__init__.py | def populate_fabfile():
"""
Automatically includes all submodules and role selectors
in the top-level fabfile using spooky-scary black magic.
This allows us to avoid manually declaring imports for every module, e.g.
import burlap.pip
import burlap.vm
import burlap...
which... | def populate_fabfile():
"""
Automatically includes all submodules and role selectors
in the top-level fabfile using spooky-scary black magic.
This allows us to avoid manually declaring imports for every module, e.g.
import burlap.pip
import burlap.vm
import burlap...
which... | [
"Automatically",
"includes",
"all",
"submodules",
"and",
"role",
"selectors",
"in",
"the",
"top",
"-",
"level",
"fabfile",
"using",
"spooky",
"-",
"scary",
"black",
"magic",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/__init__.py#L321-L372 | [
"def",
"populate_fabfile",
"(",
")",
":",
"stack",
"=",
"inspect",
".",
"stack",
"(",
")",
"fab_frame",
"=",
"None",
"for",
"frame_obj",
",",
"script_fn",
",",
"line",
",",
"_",
",",
"_",
",",
"_",
"in",
"stack",
":",
"if",
"'fabfile.py'",
"in",
"scr... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | task_or_dryrun | Decorator declaring the wrapped function to be a new-style task.
May be invoked as a simple, argument-less decorator (i.e. ``@task``) or
with arguments customizing its behavior (e.g. ``@task(alias='myalias')``).
Please see the :ref:`new-style task <task-decorator>` documentation for
details on how to ... | burlap/decorators.py | def task_or_dryrun(*args, **kwargs):
"""
Decorator declaring the wrapped function to be a new-style task.
May be invoked as a simple, argument-less decorator (i.e. ``@task``) or
with arguments customizing its behavior (e.g. ``@task(alias='myalias')``).
Please see the :ref:`new-style task <task-dec... | def task_or_dryrun(*args, **kwargs):
"""
Decorator declaring the wrapped function to be a new-style task.
May be invoked as a simple, argument-less decorator (i.e. ``@task``) or
with arguments customizing its behavior (e.g. ``@task(alias='myalias')``).
Please see the :ref:`new-style task <task-dec... | [
"Decorator",
"declaring",
"the",
"wrapped",
"function",
"to",
"be",
"a",
"new",
"-",
"style",
"task",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/decorators.py#L14-L44 | [
"def",
"task_or_dryrun",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"invoked",
"=",
"bool",
"(",
"not",
"args",
"or",
"kwargs",
")",
"task_class",
"=",
"kwargs",
".",
"pop",
"(",
"\"task_class\"",
",",
"WrappedCallableTask",
")",
"# if invoke... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | task | Decorator for registering a satchel method as a Fabric task.
Can be used like:
@task
def my_method(self):
...
@task(precursors=['other_satchel'])
def my_method(self):
... | burlap/decorators.py | def task(*args, **kwargs):
"""
Decorator for registering a satchel method as a Fabric task.
Can be used like:
@task
def my_method(self):
...
@task(precursors=['other_satchel'])
def my_method(self):
...
"""
precursors = kwargs.pop('precursor... | def task(*args, **kwargs):
"""
Decorator for registering a satchel method as a Fabric task.
Can be used like:
@task
def my_method(self):
...
@task(precursors=['other_satchel'])
def my_method(self):
...
"""
precursors = kwargs.pop('precursor... | [
"Decorator",
"for",
"registering",
"a",
"satchel",
"method",
"as",
"a",
"Fabric",
"task",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/decorators.py#L68-L98 | [
"def",
"task",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"precursors",
"=",
"kwargs",
".",
"pop",
"(",
"'precursors'",
",",
"None",
")",
"post_callback",
"=",
"kwargs",
".",
"pop",
"(",
"'post_callback'",
",",
"False",
")",
"if",
"args",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | runs_once | A wrapper around Fabric's runs_once() to support our dryrun feature. | burlap/decorators.py | def runs_once(meth):
"""
A wrapper around Fabric's runs_once() to support our dryrun feature.
"""
from burlap.common import get_dryrun, runs_once_methods
if get_dryrun():
pass
else:
runs_once_methods.append(meth)
_runs_once(meth)
return meth | def runs_once(meth):
"""
A wrapper around Fabric's runs_once() to support our dryrun feature.
"""
from burlap.common import get_dryrun, runs_once_methods
if get_dryrun():
pass
else:
runs_once_methods.append(meth)
_runs_once(meth)
return meth | [
"A",
"wrapper",
"around",
"Fabric",
"s",
"runs_once",
"()",
"to",
"support",
"our",
"dryrun",
"feature",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/decorators.py#L100-L110 | [
"def",
"runs_once",
"(",
"meth",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"get_dryrun",
",",
"runs_once_methods",
"if",
"get_dryrun",
"(",
")",
":",
"pass",
"else",
":",
"runs_once_methods",
".",
"append",
"(",
"meth",
")",
"_runs_once",
"(",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.is_file | Check if a path exists, and is a file. | burlap/files.py | def is_file(self, path, use_sudo=False):
"""
Check if a path exists, and is a file.
"""
if self.is_local and not use_sudo:
return os.path.isfile(path)
else:
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), warn_... | def is_file(self, path, use_sudo=False):
"""
Check if a path exists, and is a file.
"""
if self.is_local and not use_sudo:
return os.path.isfile(path)
else:
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), warn_... | [
"Check",
"if",
"a",
"path",
"exists",
"and",
"is",
"a",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L107-L116 | [
"def",
"is_file",
"(",
"self",
",",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"if",
"self",
".",
"is_local",
"and",
"not",
"use_sudo",
":",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"else",
":",
"func",
"=",
"use_sudo",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.is_dir | Check if a path exists, and is a directory. | burlap/files.py | def is_dir(self, path, use_sudo=False):
"""
Check if a path exists, and is a directory.
"""
if self.is_local and not use_sudo:
return os.path.isdir(path)
else:
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), wa... | def is_dir(self, path, use_sudo=False):
"""
Check if a path exists, and is a directory.
"""
if self.is_local and not use_sudo:
return os.path.isdir(path)
else:
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), wa... | [
"Check",
"if",
"a",
"path",
"exists",
"and",
"is",
"a",
"directory",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L119-L128 | [
"def",
"is_dir",
"(",
"self",
",",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"if",
"self",
".",
"is_local",
"and",
"not",
"use_sudo",
":",
"return",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
"else",
":",
"func",
"=",
"use_sudo",
"an... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.is_link | Check if a path exists, and is a symbolic link. | burlap/files.py | def is_link(self, path, use_sudo=False):
"""
Check if a path exists, and is a symbolic link.
"""
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), warn_only=True):
return func('[ -L "%(path)s" ]' % locals()).succeeded | def is_link(self, path, use_sudo=False):
"""
Check if a path exists, and is a symbolic link.
"""
func = use_sudo and _sudo or _run
with self.settings(hide('running', 'warnings'), warn_only=True):
return func('[ -L "%(path)s" ]' % locals()).succeeded | [
"Check",
"if",
"a",
"path",
"exists",
"and",
"is",
"a",
"symbolic",
"link",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L131-L137 | [
"def",
"is_link",
"(",
"self",
",",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"_sudo",
"or",
"_run",
"with",
"self",
".",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'warnings'",
")",
",",
"warn_only",
"=",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.get_owner | Get the owner name of a file or directory. | burlap/files.py | def get_owner(self, path, use_sudo=False):
"""
Get the owner name of a file or directory.
"""
func = use_sudo and run_as_root or self.run
# I'd prefer to use quiet=True, but that's not supported with older
# versions of Fabric.
with self.settings(hide('running', '... | def get_owner(self, path, use_sudo=False):
"""
Get the owner name of a file or directory.
"""
func = use_sudo and run_as_root or self.run
# I'd prefer to use quiet=True, but that's not supported with older
# versions of Fabric.
with self.settings(hide('running', '... | [
"Get",
"the",
"owner",
"name",
"of",
"a",
"file",
"or",
"directory",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L140-L152 | [
"def",
"get_owner",
"(",
"self",
",",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"# I'd prefer to use quiet=True, but that's not supported with older",
"# versions of Fabric.",
"with",
"sel... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.umask | Get the user's umask.
Returns a string such as ``'0002'``, representing the user's umask
as an octal number.
If `use_sudo` is `True`, this function returns root's umask. | burlap/files.py | def umask(self, use_sudo=False):
"""
Get the user's umask.
Returns a string such as ``'0002'``, representing the user's umask
as an octal number.
If `use_sudo` is `True`, this function returns root's umask.
"""
func = use_sudo and run_as_root or self.run
... | def umask(self, use_sudo=False):
"""
Get the user's umask.
Returns a string such as ``'0002'``, representing the user's umask
as an octal number.
If `use_sudo` is `True`, this function returns root's umask.
"""
func = use_sudo and run_as_root or self.run
... | [
"Get",
"the",
"user",
"s",
"umask",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L188-L198 | [
"def",
"umask",
"(",
"self",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"return",
"func",
"(",
"'umask'",
")"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.upload_template | Upload a template file.
This is a wrapper around :func:`fabric.contrib.files.upload_template`
that adds some extra parameters.
If ``mkdir`` is True, then the remote directory will be created, as
the current user or as ``user`` if specified.
If ``chown`` is True, then it will e... | burlap/files.py | def upload_template(self, filename, destination, context=None, use_jinja=False,
template_dir=None, use_sudo=False, backup=True,
mirror_local_mode=False, mode=None,
mkdir=False, chown=False, user=None):
"""
Upload a template file.
... | def upload_template(self, filename, destination, context=None, use_jinja=False,
template_dir=None, use_sudo=False, backup=True,
mirror_local_mode=False, mode=None,
mkdir=False, chown=False, user=None):
"""
Upload a template file.
... | [
"Upload",
"a",
"template",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L201-L241 | [
"def",
"upload_template",
"(",
"self",
",",
"filename",
",",
"destination",
",",
"context",
"=",
"None",
",",
"use_jinja",
"=",
"False",
",",
"template_dir",
"=",
"None",
",",
"use_sudo",
"=",
"False",
",",
"backup",
"=",
"True",
",",
"mirror_local_mode",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.md5sum | Compute the MD5 sum of a file. | burlap/files.py | def md5sum(self, filename, use_sudo=False):
"""
Compute the MD5 sum of a file.
"""
func = use_sudo and run_as_root or self.run
with self.settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
# Linux (LSB)
if exists(u'/usr/bin/md5sum'):... | def md5sum(self, filename, use_sudo=False):
"""
Compute the MD5 sum of a file.
"""
func = use_sudo and run_as_root or self.run
with self.settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
# Linux (LSB)
if exists(u'/usr/bin/md5sum'):... | [
"Compute",
"the",
"MD5",
"sum",
"of",
"a",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L244-L283 | [
"def",
"md5sum",
"(",
"self",
",",
"filename",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"with",
"self",
".",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
",",
"'std... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.uncommented_lines | Get the lines of a remote file, ignoring empty or commented ones | burlap/files.py | def uncommented_lines(self, filename, use_sudo=False):
"""
Get the lines of a remote file, ignoring empty or commented ones
"""
func = run_as_root if use_sudo else self.run
res = func('cat %s' % quote(filename), quiet=True)
if res.succeeded:
return [line for l... | def uncommented_lines(self, filename, use_sudo=False):
"""
Get the lines of a remote file, ignoring empty or commented ones
"""
func = run_as_root if use_sudo else self.run
res = func('cat %s' % quote(filename), quiet=True)
if res.succeeded:
return [line for l... | [
"Get",
"the",
"lines",
"of",
"a",
"remote",
"file",
"ignoring",
"empty",
"or",
"commented",
"ones"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L286-L294 | [
"def",
"uncommented_lines",
"(",
"self",
",",
"filename",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"run_as_root",
"if",
"use_sudo",
"else",
"self",
".",
"run",
"res",
"=",
"func",
"(",
"'cat %s'",
"%",
"quote",
"(",
"filename",
")",
",",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.getmtime | Return the time of last modification of path.
The return value is a number giving the number of seconds since the epoch
Same as :py:func:`os.path.getmtime()` | burlap/files.py | def getmtime(self, path, use_sudo=False):
"""
Return the time of last modification of path.
The return value is a number giving the number of seconds since the epoch
Same as :py:func:`os.path.getmtime()`
"""
func = use_sudo and run_as_root or self.run
with self.s... | def getmtime(self, path, use_sudo=False):
"""
Return the time of last modification of path.
The return value is a number giving the number of seconds since the epoch
Same as :py:func:`os.path.getmtime()`
"""
func = use_sudo and run_as_root or self.run
with self.s... | [
"Return",
"the",
"time",
"of",
"last",
"modification",
"of",
"path",
".",
"The",
"return",
"value",
"is",
"a",
"number",
"giving",
"the",
"number",
"of",
"seconds",
"since",
"the",
"epoch"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L297-L306 | [
"def",
"getmtime",
"(",
"self",
",",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"with",
"self",
".",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
")",
")",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.copy | Copy a file or directory | burlap/files.py | def copy(self, source, destination, recursive=False, use_sudo=False):
"""
Copy a file or directory
"""
func = use_sudo and run_as_root or self.run
options = '-r ' if recursive else ''
func('/bin/cp {0}{1} {2}'.format(options, quote(source), quote(destination))) | def copy(self, source, destination, recursive=False, use_sudo=False):
"""
Copy a file or directory
"""
func = use_sudo and run_as_root or self.run
options = '-r ' if recursive else ''
func('/bin/cp {0}{1} {2}'.format(options, quote(source), quote(destination))) | [
"Copy",
"a",
"file",
"or",
"directory"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L309-L315 | [
"def",
"copy",
"(",
"self",
",",
"source",
",",
"destination",
",",
"recursive",
"=",
"False",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"options",
"=",
"'-r '",
"if",
"recursive",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.move | Move a file or directory | burlap/files.py | def move(self, source, destination, use_sudo=False):
"""
Move a file or directory
"""
func = use_sudo and run_as_root or self.run
func('/bin/mv {0} {1}'.format(quote(source), quote(destination))) | def move(self, source, destination, use_sudo=False):
"""
Move a file or directory
"""
func = use_sudo and run_as_root or self.run
func('/bin/mv {0} {1}'.format(quote(source), quote(destination))) | [
"Move",
"a",
"file",
"or",
"directory"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L318-L323 | [
"def",
"move",
"(",
"self",
",",
"source",
",",
"destination",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"func",
"(",
"'/bin/mv {0} {1}'",
".",
"format",
"(",
"quote",
"(",
"source",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.remove | Remove a file or directory | burlap/files.py | def remove(self, path, recursive=False, use_sudo=False):
"""
Remove a file or directory
"""
func = use_sudo and run_as_root or self.run
options = '-r ' if recursive else ''
func('/bin/rm {0}{1}'.format(options, quote(path))) | def remove(self, path, recursive=False, use_sudo=False):
"""
Remove a file or directory
"""
func = use_sudo and run_as_root or self.run
options = '-r ' if recursive else ''
func('/bin/rm {0}{1}'.format(options, quote(path))) | [
"Remove",
"a",
"file",
"or",
"directory"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L334-L340 | [
"def",
"remove",
"(",
"self",
",",
"path",
",",
"recursive",
"=",
"False",
",",
"use_sudo",
"=",
"False",
")",
":",
"func",
"=",
"use_sudo",
"and",
"run_as_root",
"or",
"self",
".",
"run",
"options",
"=",
"'-r '",
"if",
"recursive",
"else",
"''",
"func... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FileSatchel.require | Require a file to exist and have specific contents and properties.
You can provide either:
- *contents*: the required contents of the file::
from fabtools import require
require.file('/tmp/hello.txt', contents='Hello, world')
- *source*: the local path of a file to u... | burlap/files.py | def require(self, path=None, contents=None, source=None, url=None, md5=None,
use_sudo=False, owner=None, group='', mode=None, verify_remote=True,
temp_dir='/tmp'):
"""
Require a file to exist and have specific contents and properties.
You can provide either:
- *conten... | def require(self, path=None, contents=None, source=None, url=None, md5=None,
use_sudo=False, owner=None, group='', mode=None, verify_remote=True,
temp_dir='/tmp'):
"""
Require a file to exist and have specific contents and properties.
You can provide either:
- *conten... | [
"Require",
"a",
"file",
"to",
"exist",
"and",
"have",
"specific",
"contents",
"and",
"properties",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/files.py#L352-L464 | [
"def",
"require",
"(",
"self",
",",
"path",
"=",
"None",
",",
"contents",
"=",
"None",
",",
"source",
"=",
"None",
",",
"url",
"=",
"None",
",",
"md5",
"=",
"None",
",",
"use_sudo",
"=",
"False",
",",
"owner",
"=",
"None",
",",
"group",
"=",
"''"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SeleniumSatchel.check_for_change | Determines if a new release has been made. | burlap/selenium.py | def check_for_change(self):
"""
Determines if a new release has been made.
"""
r = self.local_renderer
lm = self.last_manifest
last_fingerprint = lm.fingerprint
current_fingerprint = self.get_target_geckodriver_version_number()
self.vprint('last_fingerprin... | def check_for_change(self):
"""
Determines if a new release has been made.
"""
r = self.local_renderer
lm = self.last_manifest
last_fingerprint = lm.fingerprint
current_fingerprint = self.get_target_geckodriver_version_number()
self.vprint('last_fingerprin... | [
"Determines",
"if",
"a",
"new",
"release",
"has",
"been",
"made",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/selenium.py#L73-L87 | [
"def",
"check_for_change",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"lm",
"=",
"self",
".",
"last_manifest",
"last_fingerprint",
"=",
"lm",
".",
"fingerprint",
"current_fingerprint",
"=",
"self",
".",
"get_target_geckodriver_version_number",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.