repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
klen/graphite-beacon | graphite_beacon/units.py | TimeUnit._normalize_unit | def _normalize_unit(cls, unit):
"""Resolve a unit to its real name if it's an alias.
:param unit str: the unit to normalize
:return: the normalized unit, or None one isn't found
:rtype: Union[None, str]
"""
if unit in cls.UNITS_IN_SECONDS:
return unit
... | python | def _normalize_unit(cls, unit):
"""Resolve a unit to its real name if it's an alias.
:param unit str: the unit to normalize
:return: the normalized unit, or None one isn't found
:rtype: Union[None, str]
"""
if unit in cls.UNITS_IN_SECONDS:
return unit
... | [
"def",
"_normalize_unit",
"(",
"cls",
",",
"unit",
")",
":",
"if",
"unit",
"in",
"cls",
".",
"UNITS_IN_SECONDS",
":",
"return",
"unit",
"return",
"cls",
".",
"UNIT_ALIASES_REVERSE",
".",
"get",
"(",
"unit",
",",
"None",
")"
] | Resolve a unit to its real name if it's an alias.
:param unit str: the unit to normalize
:return: the normalized unit, or None one isn't found
:rtype: Union[None, str] | [
"Resolve",
"a",
"unit",
"to",
"its",
"real",
"name",
"if",
"it",
"s",
"an",
"alias",
"."
] | c1f071e9f557693bc90f6acbc314994985dc3b77 | https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/units.py#L121-L130 | train | 25,700 |
klen/graphite-beacon | graphite_beacon/units.py | TimeUnit.convert | def convert(cls, value, from_unit, to_unit):
"""Convert a value from one time unit to another.
:return: the numeric value converted to the desired unit
:rtype: float
"""
value_ms = value * cls.UNITS_IN_MILLISECONDS[from_unit]
return value_ms / cls.UNITS_IN_MILLISECONDS[t... | python | def convert(cls, value, from_unit, to_unit):
"""Convert a value from one time unit to another.
:return: the numeric value converted to the desired unit
:rtype: float
"""
value_ms = value * cls.UNITS_IN_MILLISECONDS[from_unit]
return value_ms / cls.UNITS_IN_MILLISECONDS[t... | [
"def",
"convert",
"(",
"cls",
",",
"value",
",",
"from_unit",
",",
"to_unit",
")",
":",
"value_ms",
"=",
"value",
"*",
"cls",
".",
"UNITS_IN_MILLISECONDS",
"[",
"from_unit",
"]",
"return",
"value_ms",
"/",
"cls",
".",
"UNITS_IN_MILLISECONDS",
"[",
"to_unit",... | Convert a value from one time unit to another.
:return: the numeric value converted to the desired unit
:rtype: float | [
"Convert",
"a",
"value",
"from",
"one",
"time",
"unit",
"to",
"another",
"."
] | c1f071e9f557693bc90f6acbc314994985dc3b77 | https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/units.py#L148-L155 | train | 25,701 |
klen/graphite-beacon | graphite_beacon/handlers/smtp.py | SMTPHandler.init_handler | def init_handler(self):
""" Check self options. """
assert self.options.get('host') and self.options.get('port'), "Invalid options"
assert self.options.get('to'), 'Recipients list is empty. SMTP disabled.'
if not isinstance(self.options['to'], (list, tuple)):
self.options['to... | python | def init_handler(self):
""" Check self options. """
assert self.options.get('host') and self.options.get('port'), "Invalid options"
assert self.options.get('to'), 'Recipients list is empty. SMTP disabled.'
if not isinstance(self.options['to'], (list, tuple)):
self.options['to... | [
"def",
"init_handler",
"(",
"self",
")",
":",
"assert",
"self",
".",
"options",
".",
"get",
"(",
"'host'",
")",
"and",
"self",
".",
"options",
".",
"get",
"(",
"'port'",
")",
",",
"\"Invalid options\"",
"assert",
"self",
".",
"options",
".",
"get",
"("... | Check self options. | [
"Check",
"self",
"options",
"."
] | c1f071e9f557693bc90f6acbc314994985dc3b77 | https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/handlers/smtp.py#L28-L33 | train | 25,702 |
alexprengere/FormalSystems | formalsystems/formalsystems.py | iterator_mix | def iterator_mix(*iterators):
"""
Iterating over list of iterators.
Bit like zip, but zip stops after the
shortest iterator is empty, abd here
we go one until all iterators are empty.
"""
while True:
one_left = False
for it in iterators:
try:
yiel... | python | def iterator_mix(*iterators):
"""
Iterating over list of iterators.
Bit like zip, but zip stops after the
shortest iterator is empty, abd here
we go one until all iterators are empty.
"""
while True:
one_left = False
for it in iterators:
try:
yiel... | [
"def",
"iterator_mix",
"(",
"*",
"iterators",
")",
":",
"while",
"True",
":",
"one_left",
"=",
"False",
"for",
"it",
"in",
"iterators",
":",
"try",
":",
"yield",
"it",
".",
"next",
"(",
")",
"except",
"StopIteration",
":",
"pass",
"else",
":",
"one_lef... | Iterating over list of iterators.
Bit like zip, but zip stops after the
shortest iterator is empty, abd here
we go one until all iterators are empty. | [
"Iterating",
"over",
"list",
"of",
"iterators",
".",
"Bit",
"like",
"zip",
"but",
"zip",
"stops",
"after",
"the",
"shortest",
"iterator",
"is",
"empty",
"abd",
"here",
"we",
"go",
"one",
"until",
"all",
"iterators",
"are",
"empty",
"."
] | e46d9cc6f8dc076e9dc86f6f8511fc6f3aa95f6e | https://github.com/alexprengere/FormalSystems/blob/e46d9cc6f8dc076e9dc86f6f8511fc6f3aa95f6e/formalsystems/formalsystems.py#L309-L328 | train | 25,703 |
grantmcconnaughey/Lintly | lintly/parsers.py | BaseLintParser._normalize_path | def _normalize_path(self, path):
"""
Normalizes a file path so that it returns a path relative to the root repo directory.
"""
norm_path = os.path.normpath(path)
return os.path.relpath(norm_path, start=self._get_working_dir()) | python | def _normalize_path(self, path):
"""
Normalizes a file path so that it returns a path relative to the root repo directory.
"""
norm_path = os.path.normpath(path)
return os.path.relpath(norm_path, start=self._get_working_dir()) | [
"def",
"_normalize_path",
"(",
"self",
",",
"path",
")",
":",
"norm_path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")",
"return",
"os",
".",
"path",
".",
"relpath",
"(",
"norm_path",
",",
"start",
"=",
"self",
".",
"_get_working_dir",
"("... | Normalizes a file path so that it returns a path relative to the root repo directory. | [
"Normalizes",
"a",
"file",
"path",
"so",
"that",
"it",
"returns",
"a",
"path",
"relative",
"to",
"the",
"root",
"repo",
"directory",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/parsers.py#L21-L26 | train | 25,704 |
grantmcconnaughey/Lintly | lintly/backends/github.py | translate_github_exception | def translate_github_exception(func):
"""
Decorator to catch GitHub-specific exceptions and raise them as GitClientError exceptions.
"""
@functools.wraps(func)
def _wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except UnknownObjectException as e:
... | python | def translate_github_exception(func):
"""
Decorator to catch GitHub-specific exceptions and raise them as GitClientError exceptions.
"""
@functools.wraps(func)
def _wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except UnknownObjectException as e:
... | [
"def",
"translate_github_exception",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kw... | Decorator to catch GitHub-specific exceptions and raise them as GitClientError exceptions. | [
"Decorator",
"to",
"catch",
"GitHub",
"-",
"specific",
"exceptions",
"and",
"raise",
"them",
"as",
"GitClientError",
"exceptions",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/backends/github.py#L29-L45 | train | 25,705 |
grantmcconnaughey/Lintly | lintly/builds.py | LintlyBuild.violations | def violations(self):
"""
Returns either the diff violations or all violations depending on configuration.
"""
return self._all_violations if self.config.fail_on == FAIL_ON_ANY else self._diff_violations | python | def violations(self):
"""
Returns either the diff violations or all violations depending on configuration.
"""
return self._all_violations if self.config.fail_on == FAIL_ON_ANY else self._diff_violations | [
"def",
"violations",
"(",
"self",
")",
":",
"return",
"self",
".",
"_all_violations",
"if",
"self",
".",
"config",
".",
"fail_on",
"==",
"FAIL_ON_ANY",
"else",
"self",
".",
"_diff_violations"
] | Returns either the diff violations or all violations depending on configuration. | [
"Returns",
"either",
"the",
"diff",
"violations",
"or",
"all",
"violations",
"depending",
"on",
"configuration",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/builds.py#L35-L39 | train | 25,706 |
grantmcconnaughey/Lintly | lintly/builds.py | LintlyBuild.execute | def execute(self):
"""
Executes a new build on a project.
"""
if not self.config.pr:
raise NotPullRequestException
logger.debug('Using the following configuration:')
for name, value in self.config.as_dict().items():
logger.debug(' - {}={}'.format... | python | def execute(self):
"""
Executes a new build on a project.
"""
if not self.config.pr:
raise NotPullRequestException
logger.debug('Using the following configuration:')
for name, value in self.config.as_dict().items():
logger.debug(' - {}={}'.format... | [
"def",
"execute",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"config",
".",
"pr",
":",
"raise",
"NotPullRequestException",
"logger",
".",
"debug",
"(",
"'Using the following configuration:'",
")",
"for",
"name",
",",
"value",
"in",
"self",
".",
"config... | Executes a new build on a project. | [
"Executes",
"a",
"new",
"build",
"on",
"a",
"project",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/builds.py#L51-L74 | train | 25,707 |
grantmcconnaughey/Lintly | lintly/builds.py | LintlyBuild.find_diff_violations | def find_diff_violations(self, patch):
"""
Uses the diff for this build to find changed lines that also have violations.
"""
violations = collections.defaultdict(list)
for line in patch.changed_lines:
file_violations = self._all_violations.get(line['file_name'])
... | python | def find_diff_violations(self, patch):
"""
Uses the diff for this build to find changed lines that also have violations.
"""
violations = collections.defaultdict(list)
for line in patch.changed_lines:
file_violations = self._all_violations.get(line['file_name'])
... | [
"def",
"find_diff_violations",
"(",
"self",
",",
"patch",
")",
":",
"violations",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"line",
"in",
"patch",
".",
"changed_lines",
":",
"file_violations",
"=",
"self",
".",
"_all_violations",
".",
... | Uses the diff for this build to find changed lines that also have violations. | [
"Uses",
"the",
"diff",
"for",
"this",
"build",
"to",
"find",
"changed",
"lines",
"that",
"also",
"have",
"violations",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/builds.py#L82-L97 | train | 25,708 |
grantmcconnaughey/Lintly | lintly/builds.py | LintlyBuild.post_pr_comment | def post_pr_comment(self, patch):
"""
Posts a comment to the GitHub PR if the diff results have issues.
"""
if self.has_violations:
post_pr_comment = True
# Attempt to post a PR review. If posting the PR review fails because the bot account
# does not... | python | def post_pr_comment(self, patch):
"""
Posts a comment to the GitHub PR if the diff results have issues.
"""
if self.has_violations:
post_pr_comment = True
# Attempt to post a PR review. If posting the PR review fails because the bot account
# does not... | [
"def",
"post_pr_comment",
"(",
"self",
",",
"patch",
")",
":",
"if",
"self",
".",
"has_violations",
":",
"post_pr_comment",
"=",
"True",
"# Attempt to post a PR review. If posting the PR review fails because the bot account",
"# does not have permission to review the PR then simply... | Posts a comment to the GitHub PR if the diff results have issues. | [
"Posts",
"a",
"comment",
"to",
"the",
"GitHub",
"PR",
"if",
"the",
"diff",
"results",
"have",
"issues",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/builds.py#L99-L131 | train | 25,709 |
grantmcconnaughey/Lintly | lintly/builds.py | LintlyBuild.post_commit_status | def post_commit_status(self):
"""
Posts results to a commit status in GitHub if this build is for a pull request.
"""
if self.violations:
plural = '' if self.introduced_issues_count == 1 else 's'
description = 'Pull Request introduced {} linting violation{}'.forma... | python | def post_commit_status(self):
"""
Posts results to a commit status in GitHub if this build is for a pull request.
"""
if self.violations:
plural = '' if self.introduced_issues_count == 1 else 's'
description = 'Pull Request introduced {} linting violation{}'.forma... | [
"def",
"post_commit_status",
"(",
"self",
")",
":",
"if",
"self",
".",
"violations",
":",
"plural",
"=",
"''",
"if",
"self",
".",
"introduced_issues_count",
"==",
"1",
"else",
"'s'",
"description",
"=",
"'Pull Request introduced {} linting violation{}'",
".",
"for... | Posts results to a commit status in GitHub if this build is for a pull request. | [
"Posts",
"results",
"to",
"a",
"commit",
"status",
"in",
"GitHub",
"if",
"this",
"build",
"is",
"for",
"a",
"pull",
"request",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/builds.py#L133-L143 | train | 25,710 |
alexprengere/FormalSystems | formalsystems/leplparsing.py | reg_to_lex | def reg_to_lex(conditions, wildcards):
"""Transform a regular expression into a LEPL object.
Replace the wildcards in the conditions by LEPL elements,
like xM will be replaced by Any() & 'M'.
In case of multiple same wildcards (like xMx), aliases
are created to allow the regexp to compile, like
... | python | def reg_to_lex(conditions, wildcards):
"""Transform a regular expression into a LEPL object.
Replace the wildcards in the conditions by LEPL elements,
like xM will be replaced by Any() & 'M'.
In case of multiple same wildcards (like xMx), aliases
are created to allow the regexp to compile, like
... | [
"def",
"reg_to_lex",
"(",
"conditions",
",",
"wildcards",
")",
":",
"aliases",
"=",
"defaultdict",
"(",
"set",
")",
"n_conds",
"=",
"[",
"]",
"# All conditions",
"for",
"i",
",",
"_",
"in",
"enumerate",
"(",
"conditions",
")",
":",
"n_cond",
"=",
"[",
... | Transform a regular expression into a LEPL object.
Replace the wildcards in the conditions by LEPL elements,
like xM will be replaced by Any() & 'M'.
In case of multiple same wildcards (like xMx), aliases
are created to allow the regexp to compile, like
Any() > 'x_0' & 'M' & Any() > 'x_1', and we c... | [
"Transform",
"a",
"regular",
"expression",
"into",
"a",
"LEPL",
"object",
"."
] | e46d9cc6f8dc076e9dc86f6f8511fc6f3aa95f6e | https://github.com/alexprengere/FormalSystems/blob/e46d9cc6f8dc076e9dc86f6f8511fc6f3aa95f6e/formalsystems/leplparsing.py#L11-L39 | train | 25,711 |
grantmcconnaughey/Lintly | lintly/cli.py | main | def main(**options):
"""Slurp up linter output and send it to a GitHub PR review."""
configure_logging(log_all=options.get('log'))
stdin_stream = click.get_text_stream('stdin')
stdin_text = stdin_stream.read()
click.echo(stdin_text)
ci = find_ci_provider()
config = Config(options, ci=ci)
... | python | def main(**options):
"""Slurp up linter output and send it to a GitHub PR review."""
configure_logging(log_all=options.get('log'))
stdin_stream = click.get_text_stream('stdin')
stdin_text = stdin_stream.read()
click.echo(stdin_text)
ci = find_ci_provider()
config = Config(options, ci=ci)
... | [
"def",
"main",
"(",
"*",
"*",
"options",
")",
":",
"configure_logging",
"(",
"log_all",
"=",
"options",
".",
"get",
"(",
"'log'",
")",
")",
"stdin_stream",
"=",
"click",
".",
"get_text_stream",
"(",
"'stdin'",
")",
"stdin_text",
"=",
"stdin_stream",
".",
... | Slurp up linter output and send it to a GitHub PR review. | [
"Slurp",
"up",
"linter",
"output",
"and",
"send",
"it",
"to",
"a",
"GitHub",
"PR",
"review",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/cli.py#L53-L73 | train | 25,712 |
grantmcconnaughey/Lintly | lintly/backends/gitlab.py | translate_gitlab_exception | def translate_gitlab_exception(func):
"""
Decorator to catch GitLab-specific exceptions and raise them as GitClientError exceptions.
"""
@functools.wraps(func)
def _wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except gitlab.GitlabError as e:
st... | python | def translate_gitlab_exception(func):
"""
Decorator to catch GitLab-specific exceptions and raise them as GitClientError exceptions.
"""
@functools.wraps(func)
def _wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except gitlab.GitlabError as e:
st... | [
"def",
"translate_gitlab_exception",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kw... | Decorator to catch GitLab-specific exceptions and raise them as GitClientError exceptions. | [
"Decorator",
"to",
"catch",
"GitLab",
"-",
"specific",
"exceptions",
"and",
"raise",
"them",
"as",
"GitClientError",
"exceptions",
"."
] | 73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466 | https://github.com/grantmcconnaughey/Lintly/blob/73c1ee36740ac5bb2a32d3f24fca2a27f4d4e466/lintly/backends/gitlab.py#L29-L47 | train | 25,713 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py | init_process_dut | def init_process_dut(contextlist, conf, index, args):
"""
Initialize process type Dut as DutProcess or DutConsole.
"""
if "subtype" in conf and conf["subtype"]:
if conf["subtype"] != "console":
msg = "Unrecognized process subtype: {}"
contextlist.logger.error(msg.format(c... | python | def init_process_dut(contextlist, conf, index, args):
"""
Initialize process type Dut as DutProcess or DutConsole.
"""
if "subtype" in conf and conf["subtype"]:
if conf["subtype"] != "console":
msg = "Unrecognized process subtype: {}"
contextlist.logger.error(msg.format(c... | [
"def",
"init_process_dut",
"(",
"contextlist",
",",
"conf",
",",
"index",
",",
"args",
")",
":",
"if",
"\"subtype\"",
"in",
"conf",
"and",
"conf",
"[",
"\"subtype\"",
"]",
":",
"if",
"conf",
"[",
"\"subtype\"",
"]",
"!=",
"\"console\"",
":",
"msg",
"=",
... | Initialize process type Dut as DutProcess or DutConsole. | [
"Initialize",
"process",
"type",
"Dut",
"as",
"DutProcess",
"or",
"DutConsole",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py#L140-L189 | train | 25,714 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py | LocalAllocator.allocate | def allocate(self, dut_configuration_list, args=None):
"""
Allocates resources from available local devices.
:param dut_configuration_list: List of ResourceRequirements objects
:param args: Not used
:return: AllocationContextList with allocated resources
"""
dut_... | python | def allocate(self, dut_configuration_list, args=None):
"""
Allocates resources from available local devices.
:param dut_configuration_list: List of ResourceRequirements objects
:param args: Not used
:return: AllocationContextList with allocated resources
"""
dut_... | [
"def",
"allocate",
"(",
"self",
",",
"dut_configuration_list",
",",
"args",
"=",
"None",
")",
":",
"dut_config_list",
"=",
"dut_configuration_list",
".",
"get_dut_configuration",
"(",
")",
"# if we need one or more local hardware duts let's search attached",
"# devices using ... | Allocates resources from available local devices.
:param dut_configuration_list: List of ResourceRequirements objects
:param args: Not used
:return: AllocationContextList with allocated resources | [
"Allocates",
"resources",
"from",
"available",
"local",
"devices",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py#L225-L266 | train | 25,715 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py | LocalAllocator._allocate | def _allocate(self, dut_configuration): # pylint: disable=too-many-branches
"""
Internal allocation function. Allocates a single resource based on dut_configuration.
:param dut_configuration: ResourceRequirements object which describes a required resource
:return: True
:raises:... | python | def _allocate(self, dut_configuration): # pylint: disable=too-many-branches
"""
Internal allocation function. Allocates a single resource based on dut_configuration.
:param dut_configuration: ResourceRequirements object which describes a required resource
:return: True
:raises:... | [
"def",
"_allocate",
"(",
"self",
",",
"dut_configuration",
")",
":",
"# pylint: disable=too-many-branches",
"if",
"dut_configuration",
"[",
"\"type\"",
"]",
"==",
"\"hardware\"",
":",
"dut_configuration",
".",
"set",
"(",
"\"type\"",
",",
"\"mbed\"",
")",
"if",
"d... | Internal allocation function. Allocates a single resource based on dut_configuration.
:param dut_configuration: ResourceRequirements object which describes a required resource
:return: True
:raises: AllocationError if suitable resource was not found or if the platform was not
allowed to... | [
"Internal",
"allocation",
"function",
".",
"Allocates",
"a",
"single",
"resource",
"based",
"on",
"dut_configuration",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/LocalAllocator.py#L277-L331 | train | 25,716 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.register_tc_plugins | def register_tc_plugins(self, plugin_name, plugin_class):
"""
Loads a plugin as a dictionary and attaches needed parts to correct areas for testing
parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing
"""
if plug... | python | def register_tc_plugins(self, plugin_name, plugin_class):
"""
Loads a plugin as a dictionary and attaches needed parts to correct areas for testing
parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing
"""
if plug... | [
"def",
"register_tc_plugins",
"(",
"self",
",",
"plugin_name",
",",
"plugin_class",
")",
":",
"if",
"plugin_name",
"in",
"self",
".",
"registered_plugins",
":",
"raise",
"PluginException",
"(",
"\"Plugin {} already registered! Duplicate \"",
"\"plugins?\"",
".",
"format... | Loads a plugin as a dictionary and attaches needed parts to correct areas for testing
parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing | [
"Loads",
"a",
"plugin",
"as",
"a",
"dictionary",
"and",
"attaches",
"needed",
"parts",
"to",
"correct",
"areas",
"for",
"testing",
"parts",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L64-L88 | train | 25,717 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.register_run_plugins | def register_run_plugins(self, plugin_name, plugin_class):
"""
Loads a plugin as a dictionary and attaches needed parts to correct Icetea run
global parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing
"""
if plu... | python | def register_run_plugins(self, plugin_name, plugin_class):
"""
Loads a plugin as a dictionary and attaches needed parts to correct Icetea run
global parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing
"""
if plu... | [
"def",
"register_run_plugins",
"(",
"self",
",",
"plugin_name",
",",
"plugin_class",
")",
":",
"if",
"plugin_name",
"in",
"self",
".",
"registered_plugins",
":",
"raise",
"PluginException",
"(",
"\"Plugin {} already registered! \"",
"\"Duplicate plugins?\"",
".",
"forma... | Loads a plugin as a dictionary and attaches needed parts to correct Icetea run
global parts.
:param plugin_name: Name of the plugins
:param plugin_class: PluginBase
:return: Nothing | [
"Loads",
"a",
"plugin",
"as",
"a",
"dictionary",
"and",
"attaches",
"needed",
"parts",
"to",
"correct",
"Icetea",
"run",
"global",
"parts",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L90-L106 | train | 25,718 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.load_default_tc_plugins | def load_default_tc_plugins(self):
"""
Load default test case level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing
"""
for plugin_name, plugin_class in default_plugins.items():
if issubclass(plugin_class, PluginBase):
try:
... | python | def load_default_tc_plugins(self):
"""
Load default test case level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing
"""
for plugin_name, plugin_class in default_plugins.items():
if issubclass(plugin_class, PluginBase):
try:
... | [
"def",
"load_default_tc_plugins",
"(",
"self",
")",
":",
"for",
"plugin_name",
",",
"plugin_class",
"in",
"default_plugins",
".",
"items",
"(",
")",
":",
"if",
"issubclass",
"(",
"plugin_class",
",",
"PluginBase",
")",
":",
"try",
":",
"self",
".",
"register... | Load default test case level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing | [
"Load",
"default",
"test",
"case",
"level",
"plugins",
"from",
"icetea_lib",
".",
"Plugin",
".",
"plugins",
".",
"default_plugins",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L119-L131 | train | 25,719 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.load_custom_tc_plugins | def load_custom_tc_plugins(self, plugin_path=None):
"""
Load custom test case level plugins from plugin_path.
:param plugin_path: Path to file, which contains the imports and mapping for plugins.
:return: None if plugin_path is None or False or something equivalent to those.
"""... | python | def load_custom_tc_plugins(self, plugin_path=None):
"""
Load custom test case level plugins from plugin_path.
:param plugin_path: Path to file, which contains the imports and mapping for plugins.
:return: None if plugin_path is None or False or something equivalent to those.
"""... | [
"def",
"load_custom_tc_plugins",
"(",
"self",
",",
"plugin_path",
"=",
"None",
")",
":",
"if",
"not",
"plugin_path",
":",
"return",
"directory",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"plugin_path",
")",
"sys",
".",
"path",
".",
"append",
"(",
"dir... | Load custom test case level plugins from plugin_path.
:param plugin_path: Path to file, which contains the imports and mapping for plugins.
:return: None if plugin_path is None or False or something equivalent to those. | [
"Load",
"custom",
"test",
"case",
"level",
"plugins",
"from",
"plugin_path",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L133-L159 | train | 25,720 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.load_default_run_plugins | def load_default_run_plugins(self):
"""
Load default run level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing
"""
for plugin_name, plugin_class in default_plugins.items():
if issubclass(plugin_class, RunPluginBase):
try:
... | python | def load_default_run_plugins(self):
"""
Load default run level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing
"""
for plugin_name, plugin_class in default_plugins.items():
if issubclass(plugin_class, RunPluginBase):
try:
... | [
"def",
"load_default_run_plugins",
"(",
"self",
")",
":",
"for",
"plugin_name",
",",
"plugin_class",
"in",
"default_plugins",
".",
"items",
"(",
")",
":",
"if",
"issubclass",
"(",
"plugin_class",
",",
"RunPluginBase",
")",
":",
"try",
":",
"self",
".",
"regi... | Load default run level plugins from icetea_lib.Plugin.plugins.default_plugins.
:return: Nothing | [
"Load",
"default",
"run",
"level",
"plugins",
"from",
"icetea_lib",
".",
"Plugin",
".",
"plugins",
".",
"default_plugins",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L161-L173 | train | 25,721 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.start_external_service | def start_external_service(self, service_name, conf=None):
"""
Start external service service_name with configuration conf.
:param service_name: Name of service to start
:param conf:
:return: nothing
"""
if service_name in self._external_services:
ser... | python | def start_external_service(self, service_name, conf=None):
"""
Start external service service_name with configuration conf.
:param service_name: Name of service to start
:param conf:
:return: nothing
"""
if service_name in self._external_services:
ser... | [
"def",
"start_external_service",
"(",
"self",
",",
"service_name",
",",
"conf",
"=",
"None",
")",
":",
"if",
"service_name",
"in",
"self",
".",
"_external_services",
":",
"ser",
"=",
"self",
".",
"_external_services",
"[",
"service_name",
"]",
"service",
"=",
... | Start external service service_name with configuration conf.
:param service_name: Name of service to start
:param conf:
:return: nothing | [
"Start",
"external",
"service",
"service_name",
"with",
"configuration",
"conf",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L203-L222 | train | 25,722 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager.stop_external_services | def stop_external_services(self):
"""
Stop all external services.
:return: Nothing
"""
for service in self._started_services:
self.logger.debug("Stopping application %s", service.name)
try:
service.stop()
except PluginException... | python | def stop_external_services(self):
"""
Stop all external services.
:return: Nothing
"""
for service in self._started_services:
self.logger.debug("Stopping application %s", service.name)
try:
service.stop()
except PluginException... | [
"def",
"stop_external_services",
"(",
"self",
")",
":",
"for",
"service",
"in",
"self",
".",
"_started_services",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Stopping application %s\"",
",",
"service",
".",
"name",
")",
"try",
":",
"service",
".",
"sto... | Stop all external services.
:return: Nothing | [
"Stop",
"all",
"external",
"services",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L224-L237 | train | 25,723 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager._register_bench_extension | def _register_bench_extension(self, plugin_name, plugin_instance):
"""
Register a bench extension.
:param plugin_name: Plugin name
:param plugin_instance: PluginBase
:return: Nothing
"""
for attr in plugin_instance.get_bench_api().keys():
if hasattr(s... | python | def _register_bench_extension(self, plugin_name, plugin_instance):
"""
Register a bench extension.
:param plugin_name: Plugin name
:param plugin_instance: PluginBase
:return: Nothing
"""
for attr in plugin_instance.get_bench_api().keys():
if hasattr(s... | [
"def",
"_register_bench_extension",
"(",
"self",
",",
"plugin_name",
",",
"plugin_instance",
")",
":",
"for",
"attr",
"in",
"plugin_instance",
".",
"get_bench_api",
"(",
")",
".",
"keys",
"(",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"bench",
",",
"att... | Register a bench extension.
:param plugin_name: Plugin name
:param plugin_instance: PluginBase
:return: Nothing | [
"Register",
"a",
"bench",
"extension",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L239-L251 | train | 25,724 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager._register_dataparser | def _register_dataparser(self, plugin_name, plugin_instance):
"""
Register a parser.
:param plugin_name: Parser name
:param plugin_instance: PluginBase
:return: Nothing
"""
for parser in plugin_instance.get_parsers().keys():
if self.responseparser.has... | python | def _register_dataparser(self, plugin_name, plugin_instance):
"""
Register a parser.
:param plugin_name: Parser name
:param plugin_instance: PluginBase
:return: Nothing
"""
for parser in plugin_instance.get_parsers().keys():
if self.responseparser.has... | [
"def",
"_register_dataparser",
"(",
"self",
",",
"plugin_name",
",",
"plugin_instance",
")",
":",
"for",
"parser",
"in",
"plugin_instance",
".",
"get_parsers",
"(",
")",
".",
"keys",
"(",
")",
":",
"if",
"self",
".",
"responseparser",
".",
"has_parser",
"(",... | Register a parser.
:param plugin_name: Parser name
:param plugin_instance: PluginBase
:return: Nothing | [
"Register",
"a",
"parser",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L253-L265 | train | 25,725 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager._register_external_service | def _register_external_service(self, plugin_name, plugin_instance):
"""
Register an external service.
:param plugin_name: Service name
:param plugin_instance: PluginBase
:return:
"""
for attr in plugin_instance.get_external_services().keys():
if attr ... | python | def _register_external_service(self, plugin_name, plugin_instance):
"""
Register an external service.
:param plugin_name: Service name
:param plugin_instance: PluginBase
:return:
"""
for attr in plugin_instance.get_external_services().keys():
if attr ... | [
"def",
"_register_external_service",
"(",
"self",
",",
"plugin_name",
",",
"plugin_instance",
")",
":",
"for",
"attr",
"in",
"plugin_instance",
".",
"get_external_services",
"(",
")",
".",
"keys",
"(",
")",
":",
"if",
"attr",
"in",
"self",
".",
"_external_serv... | Register an external service.
:param plugin_name: Service name
:param plugin_instance: PluginBase
:return: | [
"Register",
"an",
"external",
"service",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L267-L279 | train | 25,726 |
ARMmbed/icetea | icetea_lib/Plugin/PluginManager.py | PluginManager._register_allocator | def _register_allocator(self, plugin_name, plugin_instance):
"""
Register an allocator.
:param plugin_name: Allocator name
:param plugin_instance: RunPluginBase
:return:
"""
for allocator in plugin_instance.get_allocators().keys():
if allocator in sel... | python | def _register_allocator(self, plugin_name, plugin_instance):
"""
Register an allocator.
:param plugin_name: Allocator name
:param plugin_instance: RunPluginBase
:return:
"""
for allocator in plugin_instance.get_allocators().keys():
if allocator in sel... | [
"def",
"_register_allocator",
"(",
"self",
",",
"plugin_name",
",",
"plugin_instance",
")",
":",
"for",
"allocator",
"in",
"plugin_instance",
".",
"get_allocators",
"(",
")",
".",
"keys",
"(",
")",
":",
"if",
"allocator",
"in",
"self",
".",
"_allocators",
":... | Register an allocator.
:param plugin_name: Allocator name
:param plugin_instance: RunPluginBase
:return: | [
"Register",
"an",
"allocator",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L281-L293 | train | 25,727 |
ARMmbed/icetea | examples/sample_cloud.py | create | def create(host, port, result_converter=None, testcase_converter=None, args=None):
"""
Function which is called by Icetea to create an instance of the cloud client. This function
must exists.
This function myust not return None. Either return an instance of Client or raise.
"""
return SampleClie... | python | def create(host, port, result_converter=None, testcase_converter=None, args=None):
"""
Function which is called by Icetea to create an instance of the cloud client. This function
must exists.
This function myust not return None. Either return an instance of Client or raise.
"""
return SampleClie... | [
"def",
"create",
"(",
"host",
",",
"port",
",",
"result_converter",
"=",
"None",
",",
"testcase_converter",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"return",
"SampleClient",
"(",
"host",
",",
"port",
",",
"result_converter",
",",
"testcase_converter... | Function which is called by Icetea to create an instance of the cloud client. This function
must exists.
This function myust not return None. Either return an instance of Client or raise. | [
"Function",
"which",
"is",
"called",
"by",
"Icetea",
"to",
"create",
"an",
"instance",
"of",
"the",
"cloud",
"client",
".",
"This",
"function",
"must",
"exists",
".",
"This",
"function",
"myust",
"not",
"return",
"None",
".",
"Either",
"return",
"an",
"ins... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/examples/sample_cloud.py#L24-L30 | train | 25,728 |
ARMmbed/icetea | examples/sample_cloud.py | SampleClient.send_results | def send_results(self, result):
"""
Upload a result object to server.
If resultConverter has been provided, use it to convert result object to format accepted
by the server.
If needed, use testcase_converter to convert tc metadata in result to suitable format.
returns ne... | python | def send_results(self, result):
"""
Upload a result object to server.
If resultConverter has been provided, use it to convert result object to format accepted
by the server.
If needed, use testcase_converter to convert tc metadata in result to suitable format.
returns ne... | [
"def",
"send_results",
"(",
"self",
",",
"result",
")",
":",
"if",
"self",
".",
"result_converter",
":",
"print",
"(",
"self",
".",
"result_converter",
"(",
"result",
")",
")",
"else",
":",
"print",
"(",
"result",
")"
] | Upload a result object to server.
If resultConverter has been provided, use it to convert result object to format accepted
by the server.
If needed, use testcase_converter to convert tc metadata in result to suitable format.
returns new result entry as a dictionary or None. | [
"Upload",
"a",
"result",
"object",
"to",
"server",
".",
"If",
"resultConverter",
"has",
"been",
"provided",
"use",
"it",
"to",
"convert",
"result",
"object",
"to",
"format",
"accepted",
"by",
"the",
"server",
".",
"If",
"needed",
"use",
"testcase_converter",
... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/examples/sample_cloud.py#L93-L105 | train | 25,729 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/HttpApi.py | HttpApiPlugin.get_tc_api | def get_tc_api(self, host, headers=None, cert=None, logger=None):
'''
Gets HttpApi wrapped into a neat little package that raises TestStepFail
if expected status code is not returned by the server.
Default setting for expected status code is 200. Set expected to None when calling methods... | python | def get_tc_api(self, host, headers=None, cert=None, logger=None):
'''
Gets HttpApi wrapped into a neat little package that raises TestStepFail
if expected status code is not returned by the server.
Default setting for expected status code is 200. Set expected to None when calling methods... | [
"def",
"get_tc_api",
"(",
"self",
",",
"host",
",",
"headers",
"=",
"None",
",",
"cert",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"None",
"and",
"self",
".",
"logger",
":",
"logger",
"=",
"self",
".",
"logger",
"retu... | Gets HttpApi wrapped into a neat little package that raises TestStepFail
if expected status code is not returned by the server.
Default setting for expected status code is 200. Set expected to None when calling methods
to ignore the expected status code parameter or
set raiseException = ... | [
"Gets",
"HttpApi",
"wrapped",
"into",
"a",
"neat",
"little",
"package",
"that",
"raises",
"TestStepFail",
"if",
"expected",
"status",
"code",
"is",
"not",
"returned",
"by",
"the",
"server",
".",
"Default",
"setting",
"for",
"expected",
"status",
"code",
"is",
... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/HttpApi.py#L43-L53 | train | 25,730 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/HttpApi.py | Api._raise_fail | def _raise_fail(self, response, expected):
"""
Raise a TestStepFail with neatly formatted error message
"""
try:
if self.logger:
self.logger.error("Status code "
"{} != {}. \n\n "
"Payload: {}... | python | def _raise_fail(self, response, expected):
"""
Raise a TestStepFail with neatly formatted error message
"""
try:
if self.logger:
self.logger.error("Status code "
"{} != {}. \n\n "
"Payload: {}... | [
"def",
"_raise_fail",
"(",
"self",
",",
"response",
",",
"expected",
")",
":",
"try",
":",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"Status code \"",
"\"{} != {}. \\n\\n \"",
"\"Payload: {}\"",
".",
"format",
"(",
"respon... | Raise a TestStepFail with neatly formatted error message | [
"Raise",
"a",
"TestStepFail",
"with",
"neatly",
"formatted",
"error",
"message"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/HttpApi.py#L63-L84 | train | 25,731 |
ARMmbed/icetea | icetea_lib/Reports/ReportJunit.py | ReportJunit.generate | def generate(self, *args, **kwargs):
"""
Implementation for generate method from ReportBase. Generates the xml and saves the
report in Junit xml format.
:param args: 1 argument, filename is used.
:param kwargs: Not used
:return: Nothing
"""
xmlstr = str(s... | python | def generate(self, *args, **kwargs):
"""
Implementation for generate method from ReportBase. Generates the xml and saves the
report in Junit xml format.
:param args: 1 argument, filename is used.
:param kwargs: Not used
:return: Nothing
"""
xmlstr = str(s... | [
"def",
"generate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"xmlstr",
"=",
"str",
"(",
"self",
")",
"filename",
"=",
"args",
"[",
"0",
"]",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"fil",
":",
"fil",
".",... | Implementation for generate method from ReportBase. Generates the xml and saves the
report in Junit xml format.
:param args: 1 argument, filename is used.
:param kwargs: Not used
:return: Nothing | [
"Implementation",
"for",
"generate",
"method",
"from",
"ReportBase",
".",
"Generates",
"the",
"xml",
"and",
"saves",
"the",
"report",
"in",
"Junit",
"xml",
"format",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Reports/ReportJunit.py#L71-L86 | train | 25,732 |
ARMmbed/icetea | icetea_lib/Reports/ReportJunit.py | ReportJunit.__generate | def __generate(results):
"""
Static method which generates the Junit xml string from results
:param results: Results as ResultList object.
:return: Junit xml format string.
"""
doc, tag, text = Doc().tagtext()
# Counters for testsuite tag info
count = 0
... | python | def __generate(results):
"""
Static method which generates the Junit xml string from results
:param results: Results as ResultList object.
:return: Junit xml format string.
"""
doc, tag, text = Doc().tagtext()
# Counters for testsuite tag info
count = 0
... | [
"def",
"__generate",
"(",
"results",
")",
":",
"doc",
",",
"tag",
",",
"text",
"=",
"Doc",
"(",
")",
".",
"tagtext",
"(",
")",
"# Counters for testsuite tag info",
"count",
"=",
"0",
"fails",
"=",
"0",
"errors",
"=",
"0",
"skips",
"=",
"0",
"for",
"r... | Static method which generates the Junit xml string from results
:param results: Results as ResultList object.
:return: Junit xml format string. | [
"Static",
"method",
"which",
"generates",
"the",
"Junit",
"xml",
"string",
"from",
"results"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Reports/ReportJunit.py#L106-L170 | train | 25,733 |
ARMmbed/icetea | icetea_lib/AllocationContext.py | AllocationContextList.open_dut_connections | def open_dut_connections(self):
"""
Opens connections to Duts. Starts Dut read threads.
:return: Nothing
:raises DutConnectionError: if problems were encountered while opening dut connection.
"""
for dut in self.duts:
try:
dut.start_dut_thread... | python | def open_dut_connections(self):
"""
Opens connections to Duts. Starts Dut read threads.
:return: Nothing
:raises DutConnectionError: if problems were encountered while opening dut connection.
"""
for dut in self.duts:
try:
dut.start_dut_thread... | [
"def",
"open_dut_connections",
"(",
"self",
")",
":",
"for",
"dut",
"in",
"self",
".",
"duts",
":",
"try",
":",
"dut",
".",
"start_dut_thread",
"(",
")",
"if",
"hasattr",
"(",
"dut",
",",
"\"command\"",
")",
":",
"dut",
".",
"open_dut",
"(",
"dut",
"... | Opens connections to Duts. Starts Dut read threads.
:return: Nothing
:raises DutConnectionError: if problems were encountered while opening dut connection. | [
"Opens",
"connections",
"to",
"Duts",
".",
"Starts",
"Dut",
"read",
"threads",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/AllocationContext.py#L352-L371 | train | 25,734 |
ARMmbed/icetea | icetea_lib/AllocationContext.py | AllocationContextList.check_flashing_need | def check_flashing_need(self, execution_type, build_id, force):
"""
Check if flashing of local device is required.
:param execution_type: Should be 'hardware'
:param build_id: Build id, usually file name
:param force: Forceflash flag
:return: Boolean
"""
... | python | def check_flashing_need(self, execution_type, build_id, force):
"""
Check if flashing of local device is required.
:param execution_type: Should be 'hardware'
:param build_id: Build id, usually file name
:param force: Forceflash flag
:return: Boolean
"""
... | [
"def",
"check_flashing_need",
"(",
"self",
",",
"execution_type",
",",
"build_id",
",",
"force",
")",
":",
"binary_file_name",
"=",
"AllocationContextList",
".",
"get_build",
"(",
"build_id",
")",
"if",
"binary_file_name",
":",
"if",
"execution_type",
"==",
"'hard... | Check if flashing of local device is required.
:param execution_type: Should be 'hardware'
:param build_id: Build id, usually file name
:param force: Forceflash flag
:return: Boolean | [
"Check",
"if",
"flashing",
"of",
"local",
"device",
"is",
"required",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/AllocationContext.py#L373-L398 | train | 25,735 |
ARMmbed/icetea | icetea_lib/LogManager.py | remove_handlers | def remove_handlers(logger):
# TODO: Issue related to placeholder logger objects appearing in some rare cases. Check below
# required as a workaround
"""
Remove handlers from logger.
:param logger: Logger whose handlers to remove
"""
if hasattr(logger, "handlers"):
for handler in lo... | python | def remove_handlers(logger):
# TODO: Issue related to placeholder logger objects appearing in some rare cases. Check below
# required as a workaround
"""
Remove handlers from logger.
:param logger: Logger whose handlers to remove
"""
if hasattr(logger, "handlers"):
for handler in lo... | [
"def",
"remove_handlers",
"(",
"logger",
")",
":",
"# TODO: Issue related to placeholder logger objects appearing in some rare cases. Check below",
"# required as a workaround",
"if",
"hasattr",
"(",
"logger",
",",
"\"handlers\"",
")",
":",
"for",
"handler",
"in",
"logger",
"... | Remove handlers from logger.
:param logger: Logger whose handlers to remove | [
"Remove",
"handlers",
"from",
"logger",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L184-L201 | train | 25,736 |
ARMmbed/icetea | icetea_lib/LogManager.py | get_base_logfilename | def get_base_logfilename(logname):
""" Return filename for a logfile, filename will contain the actual path +
filename
:param logname: Name of the log including the extension, should describe
what it contains (eg. "device_serial_port.log")
"""
logdir = get_base_dir()
fname = os.path.join(lo... | python | def get_base_logfilename(logname):
""" Return filename for a logfile, filename will contain the actual path +
filename
:param logname: Name of the log including the extension, should describe
what it contains (eg. "device_serial_port.log")
"""
logdir = get_base_dir()
fname = os.path.join(lo... | [
"def",
"get_base_logfilename",
"(",
"logname",
")",
":",
"logdir",
"=",
"get_base_dir",
"(",
")",
"fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"logdir",
",",
"logname",
")",
"GLOBAL_LOGFILES",
".",
"append",
"(",
"fname",
")",
"return",
"fname"
] | Return filename for a logfile, filename will contain the actual path +
filename
:param logname: Name of the log including the extension, should describe
what it contains (eg. "device_serial_port.log") | [
"Return",
"filename",
"for",
"a",
"logfile",
"filename",
"will",
"contain",
"the",
"actual",
"path",
"+",
"filename"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L236-L246 | train | 25,737 |
ARMmbed/icetea | icetea_lib/LogManager.py | get_file_logger | def get_file_logger(name, formatter=None):
"""
Return a file logger that will log into a file located in the testcase log
directory. Anything logged with a file logger won't be visible in the
console or any other logger.
:param name: Name of the logger, eg. the module name
:param formatter: For... | python | def get_file_logger(name, formatter=None):
"""
Return a file logger that will log into a file located in the testcase log
directory. Anything logged with a file logger won't be visible in the
console or any other logger.
:param name: Name of the logger, eg. the module name
:param formatter: For... | [
"def",
"get_file_logger",
"(",
"name",
",",
"formatter",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
"or",
"name",
"==",
"\"\"",
":",
"raise",
"ValueError",
"(",
"\"Can't make a logger without name\"",
")",
"logger",
"=",
"logging",
".",
"getLogger",
... | Return a file logger that will log into a file located in the testcase log
directory. Anything logged with a file logger won't be visible in the
console or any other logger.
:param name: Name of the logger, eg. the module name
:param formatter: Formatter to use | [
"Return",
"a",
"file",
"logger",
"that",
"will",
"log",
"into",
"a",
"file",
"located",
"in",
"the",
"testcase",
"log",
"directory",
".",
"Anything",
"logged",
"with",
"a",
"file",
"logger",
"won",
"t",
"be",
"visible",
"in",
"the",
"console",
"or",
"any... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L256-L278 | train | 25,738 |
ARMmbed/icetea | icetea_lib/LogManager.py | _check_existing_logger | def _check_existing_logger(loggername, short_name):
"""
Check if logger with name loggername exists.
:param loggername: Name of logger.
:param short_name: Shortened name for the logger.
:return: Logger or None
"""
if loggername in LOGGERS:
# Check if short_name matches the existing ... | python | def _check_existing_logger(loggername, short_name):
"""
Check if logger with name loggername exists.
:param loggername: Name of logger.
:param short_name: Shortened name for the logger.
:return: Logger or None
"""
if loggername in LOGGERS:
# Check if short_name matches the existing ... | [
"def",
"_check_existing_logger",
"(",
"loggername",
",",
"short_name",
")",
":",
"if",
"loggername",
"in",
"LOGGERS",
":",
"# Check if short_name matches the existing one, if not update it",
"if",
"isinstance",
"(",
"LOGGERS",
"[",
"loggername",
"]",
",",
"BenchLoggerAdap... | Check if logger with name loggername exists.
:param loggername: Name of logger.
:param short_name: Shortened name for the logger.
:return: Logger or None | [
"Check",
"if",
"logger",
"with",
"name",
"loggername",
"exists",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L281-L296 | train | 25,739 |
ARMmbed/icetea | icetea_lib/LogManager.py | _add_filehandler | def _add_filehandler(logger, logpath, formatter=None, name="Bench"):
"""
Adds a FileHandler to logger.
:param logger: Logger.
:param logpath: Path to file.
:param formatter: Formatter to be used
:param name: Name for logger
:return: Logger
"""
formatter = formatter if formatter else... | python | def _add_filehandler(logger, logpath, formatter=None, name="Bench"):
"""
Adds a FileHandler to logger.
:param logger: Logger.
:param logpath: Path to file.
:param formatter: Formatter to be used
:param name: Name for logger
:return: Logger
"""
formatter = formatter if formatter else... | [
"def",
"_add_filehandler",
"(",
"logger",
",",
"logpath",
",",
"formatter",
"=",
"None",
",",
"name",
"=",
"\"Bench\"",
")",
":",
"formatter",
"=",
"formatter",
"if",
"formatter",
"else",
"BenchFormatterWithType",
"(",
"loggername",
"=",
"name",
")",
"handler"... | Adds a FileHandler to logger.
:param logger: Logger.
:param logpath: Path to file.
:param formatter: Formatter to be used
:param name: Name for logger
:return: Logger | [
"Adds",
"a",
"FileHandler",
"to",
"logger",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L299-L314 | train | 25,740 |
ARMmbed/icetea | icetea_lib/LogManager.py | _get_basic_logger | def _get_basic_logger(loggername, log_to_file, logpath):
"""
Get a logger with our basic configuration done.
:param loggername: Name of logger.
:param log_to_file: Boolean, True if this logger should write a file.
:return: Logger
"""
logger = logging.getLogger(loggername)
logger.propaga... | python | def _get_basic_logger(loggername, log_to_file, logpath):
"""
Get a logger with our basic configuration done.
:param loggername: Name of logger.
:param log_to_file: Boolean, True if this logger should write a file.
:return: Logger
"""
logger = logging.getLogger(loggername)
logger.propaga... | [
"def",
"_get_basic_logger",
"(",
"loggername",
",",
"log_to_file",
",",
"logpath",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"loggername",
")",
"logger",
".",
"propagate",
"=",
"False",
"remove_handlers",
"(",
"logger",
")",
"logger",
".",
"... | Get a logger with our basic configuration done.
:param loggername: Name of logger.
:param log_to_file: Boolean, True if this logger should write a file.
:return: Logger | [
"Get",
"a",
"logger",
"with",
"our",
"basic",
"configuration",
"done",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L317-L346 | train | 25,741 |
ARMmbed/icetea | icetea_lib/LogManager.py | get_resourceprovider_logger | def get_resourceprovider_logger(name=None, short_name=" ", log_to_file=True):
"""
Get a logger for ResourceProvider and it's components, such as Allocators.
:param name: Name for logger
:param short_name: Shorthand name for the logger
:param log_to_file: Boolean, True if logger should log to a file... | python | def get_resourceprovider_logger(name=None, short_name=" ", log_to_file=True):
"""
Get a logger for ResourceProvider and it's components, such as Allocators.
:param name: Name for logger
:param short_name: Shorthand name for the logger
:param log_to_file: Boolean, True if logger should log to a file... | [
"def",
"get_resourceprovider_logger",
"(",
"name",
"=",
"None",
",",
"short_name",
"=",
"\" \"",
",",
"log_to_file",
"=",
"True",
")",
":",
"global",
"LOGGERS",
"loggername",
"=",
"name",
"logger",
"=",
"_check_existing_logger",
"(",
"loggername",
",",
"short_na... | Get a logger for ResourceProvider and it's components, such as Allocators.
:param name: Name for logger
:param short_name: Shorthand name for the logger
:param log_to_file: Boolean, True if logger should log to a file as well.
:return: Logger | [
"Get",
"a",
"logger",
"for",
"ResourceProvider",
"and",
"it",
"s",
"components",
"such",
"as",
"Allocators",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L349-L379 | train | 25,742 |
ARMmbed/icetea | icetea_lib/LogManager.py | get_external_logger | def get_external_logger(name=None, short_name=" ", log_to_file=True):
"""
Get a logger for external modules, whose logging should usually be on a less verbose level.
:param name: Name for logger
:param short_name: Shorthand name for logger
:param log_to_file: Boolean, True if logger should log to a... | python | def get_external_logger(name=None, short_name=" ", log_to_file=True):
"""
Get a logger for external modules, whose logging should usually be on a less verbose level.
:param name: Name for logger
:param short_name: Shorthand name for logger
:param log_to_file: Boolean, True if logger should log to a... | [
"def",
"get_external_logger",
"(",
"name",
"=",
"None",
",",
"short_name",
"=",
"\" \"",
",",
"log_to_file",
"=",
"True",
")",
":",
"global",
"LOGGERS",
"loggername",
"=",
"name",
"logger",
"=",
"_check_existing_logger",
"(",
"loggername",
",",
"short_name",
"... | Get a logger for external modules, whose logging should usually be on a less verbose level.
:param name: Name for logger
:param short_name: Shorthand name for logger
:param log_to_file: Boolean, True if logger should log to a file as well.
:return: Logger | [
"Get",
"a",
"logger",
"for",
"external",
"modules",
"whose",
"logging",
"should",
"usually",
"be",
"on",
"a",
"less",
"verbose",
"level",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L382-L417 | train | 25,743 |
ARMmbed/icetea | icetea_lib/LogManager.py | get_bench_logger | def get_bench_logger(name=None, short_name=" ", log_to_file=True):
"""
Return a logger instance for given name. The logger will be a child
of the bench logger, so anything that is logged to it, will be also logged
to bench logger. If a logger with the given name doesn't already exist,
create it usi... | python | def get_bench_logger(name=None, short_name=" ", log_to_file=True):
"""
Return a logger instance for given name. The logger will be a child
of the bench logger, so anything that is logged to it, will be also logged
to bench logger. If a logger with the given name doesn't already exist,
create it usi... | [
"def",
"get_bench_logger",
"(",
"name",
"=",
"None",
",",
"short_name",
"=",
"\" \"",
",",
"log_to_file",
"=",
"True",
")",
":",
"global",
"LOGGERS",
"# Get the root bench logger if name is none or empty or bench",
"if",
"name",
"is",
"None",
"or",
"name",
"==",
... | Return a logger instance for given name. The logger will be a child
of the bench logger, so anything that is logged to it, will be also logged
to bench logger. If a logger with the given name doesn't already exist,
create it using the given parameters.
:param name: Name of the logger
:param short_n... | [
"Return",
"a",
"logger",
"instance",
"for",
"given",
"name",
".",
"The",
"logger",
"will",
"be",
"a",
"child",
"of",
"the",
"bench",
"logger",
"so",
"anything",
"that",
"is",
"logged",
"to",
"it",
"will",
"be",
"also",
"logged",
"to",
"bench",
"logger",
... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L420-L447 | train | 25,744 |
ARMmbed/icetea | icetea_lib/LogManager.py | init_base_logging | def init_base_logging(directory="./log", verbose=0, silent=False, color=False, no_file=False,
truncate=True, config_location=None):
"""
Initialize the Icetea logging by creating a directory to store logs
for this run and initialize the console logger for Icetea itself.
:param dire... | python | def init_base_logging(directory="./log", verbose=0, silent=False, color=False, no_file=False,
truncate=True, config_location=None):
"""
Initialize the Icetea logging by creating a directory to store logs
for this run and initialize the console logger for Icetea itself.
:param dire... | [
"def",
"init_base_logging",
"(",
"directory",
"=",
"\"./log\"",
",",
"verbose",
"=",
"0",
",",
"silent",
"=",
"False",
",",
"color",
"=",
"False",
",",
"no_file",
"=",
"False",
",",
"truncate",
"=",
"True",
",",
"config_location",
"=",
"None",
")",
":",
... | Initialize the Icetea logging by creating a directory to store logs
for this run and initialize the console logger for Icetea itself.
:param directory: Directory where to store the resulting logs
:param verbose: Log level as integer
:param silent: Log level warning
:param no_file: Log to file
:... | [
"Initialize",
"the",
"Icetea",
"logging",
"by",
"creating",
"a",
"directory",
"to",
"store",
"logs",
"for",
"this",
"run",
"and",
"initialize",
"the",
"console",
"logger",
"for",
"Icetea",
"itself",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L480-L572 | train | 25,745 |
ARMmbed/icetea | icetea_lib/LogManager.py | _read_config | def _read_config(config_location):
"""
Read configuration for logging from a json file. Merges the read dictionary to LOGGING_CONFIG.
:param config_location: Location of file.
:return: nothing.
"""
global LOGGING_CONFIG
with open(config_location, "r") as config_loc:
cfg_file = json.... | python | def _read_config(config_location):
"""
Read configuration for logging from a json file. Merges the read dictionary to LOGGING_CONFIG.
:param config_location: Location of file.
:return: nothing.
"""
global LOGGING_CONFIG
with open(config_location, "r") as config_loc:
cfg_file = json.... | [
"def",
"_read_config",
"(",
"config_location",
")",
":",
"global",
"LOGGING_CONFIG",
"with",
"open",
"(",
"config_location",
",",
"\"r\"",
")",
"as",
"config_loc",
":",
"cfg_file",
"=",
"json",
".",
"load",
"(",
"config_loc",
")",
"if",
"\"logging\"",
"in",
... | Read configuration for logging from a json file. Merges the read dictionary to LOGGING_CONFIG.
:param config_location: Location of file.
:return: nothing. | [
"Read",
"configuration",
"for",
"logging",
"from",
"a",
"json",
"file",
".",
"Merges",
"the",
"read",
"dictionary",
"to",
"LOGGING_CONFIG",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L762-L780 | train | 25,746 |
ARMmbed/icetea | icetea_lib/LogManager.py | BenchFormatterWithType.format | def format(self, record):
"""
Format record with formatter.
:param record: Record to format
:return: Formatted record
"""
if not hasattr(record, "type"):
record.type = " "
return self._formatter.format(record) | python | def format(self, record):
"""
Format record with formatter.
:param record: Record to format
:return: Formatted record
"""
if not hasattr(record, "type"):
record.type = " "
return self._formatter.format(record) | [
"def",
"format",
"(",
"self",
",",
"record",
")",
":",
"if",
"not",
"hasattr",
"(",
"record",
",",
"\"type\"",
")",
":",
"record",
".",
"type",
"=",
"\" \"",
"return",
"self",
".",
"_formatter",
".",
"format",
"(",
"record",
")"
] | Format record with formatter.
:param record: Record to format
:return: Formatted record | [
"Format",
"record",
"with",
"formatter",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L172-L181 | train | 25,747 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | format_message | def format_message(msg):
"""
Formatting function for assert messages. Fetches the filename,
function and line number of the code causing the fail
and formats it into a three-line error message. Stack inspection is used to get the information.
Originally done by BLE-team for their testcases.
:pa... | python | def format_message(msg):
"""
Formatting function for assert messages. Fetches the filename,
function and line number of the code causing the fail
and formats it into a three-line error message. Stack inspection is used to get the information.
Originally done by BLE-team for their testcases.
:pa... | [
"def",
"format_message",
"(",
"msg",
")",
":",
"callerframerecord",
"=",
"inspect",
".",
"stack",
"(",
")",
"[",
"2",
"]",
"frame",
"=",
"callerframerecord",
"[",
"0",
"]",
"info",
"=",
"inspect",
".",
"getframeinfo",
"(",
"frame",
")",
"_",
",",
"file... | Formatting function for assert messages. Fetches the filename,
function and line number of the code causing the fail
and formats it into a three-line error message. Stack inspection is used to get the information.
Originally done by BLE-team for their testcases.
:param msg: Message to be printed along ... | [
"Formatting",
"function",
"for",
"assert",
"messages",
".",
"Fetches",
"the",
"filename",
"function",
"and",
"line",
"number",
"of",
"the",
"code",
"causing",
"the",
"fail",
"and",
"formats",
"it",
"into",
"a",
"three",
"-",
"line",
"error",
"message",
".",
... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L25-L42 | train | 25,748 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertTraceDoesNotContain | def assertTraceDoesNotContain(response, message):
"""
Raise TestStepFail if response.verify_trace finds message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not con... | python | def assertTraceDoesNotContain(response, message):
"""
Raise TestStepFail if response.verify_trace finds message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not con... | [
"def",
"assertTraceDoesNotContain",
"(",
"response",
",",
"message",
")",
":",
"if",
"not",
"hasattr",
"(",
"response",
",",
"\"verify_trace\"",
")",
":",
"raise",
"AttributeError",
"(",
"\"Response object does not contain verify_trace method!\"",
")",
"if",
"response",... | Raise TestStepFail if response.verify_trace finds message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not contain verify_trace method.
TestStepFail if verify_trace ret... | [
"Raise",
"TestStepFail",
"if",
"response",
".",
"verify_trace",
"finds",
"message",
"from",
"response",
"traces",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L45-L58 | train | 25,749 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertTraceContains | def assertTraceContains(response, message):
"""
Raise TestStepFail if response.verify_trace does not find message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not c... | python | def assertTraceContains(response, message):
"""
Raise TestStepFail if response.verify_trace does not find message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not c... | [
"def",
"assertTraceContains",
"(",
"response",
",",
"message",
")",
":",
"if",
"not",
"hasattr",
"(",
"response",
",",
"\"verify_trace\"",
")",
":",
"raise",
"AttributeError",
"(",
"\"Response object does not contain verify_trace method!\"",
")",
"if",
"not",
"respons... | Raise TestStepFail if response.verify_trace does not find message from response traces.
:param response: Response. Must contain method verify_trace
:param message: Message to look for
:return: Nothing
:raises: AttributeError if response does not contain verify_trace method.
TestStepFail if verify_t... | [
"Raise",
"TestStepFail",
"if",
"response",
".",
"verify_trace",
"does",
"not",
"find",
"message",
"from",
"response",
"traces",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L61-L74 | train | 25,750 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertDutTraceDoesNotContain | def assertDutTraceDoesNotContain(dut, message, bench):
"""
Raise TestStepFail if bench.verify_trace does not find message from dut traces.
:param dut: Dut object.
:param message: Message to look for.
:param: Bench, must contain verify_trace method.
:raises: AttributeError if bench does not cont... | python | def assertDutTraceDoesNotContain(dut, message, bench):
"""
Raise TestStepFail if bench.verify_trace does not find message from dut traces.
:param dut: Dut object.
:param message: Message to look for.
:param: Bench, must contain verify_trace method.
:raises: AttributeError if bench does not cont... | [
"def",
"assertDutTraceDoesNotContain",
"(",
"dut",
",",
"message",
",",
"bench",
")",
":",
"if",
"not",
"hasattr",
"(",
"bench",
",",
"\"verify_trace\"",
")",
":",
"raise",
"AttributeError",
"(",
"\"Bench object does not contain verify_trace method!\"",
")",
"if",
"... | Raise TestStepFail if bench.verify_trace does not find message from dut traces.
:param dut: Dut object.
:param message: Message to look for.
:param: Bench, must contain verify_trace method.
:raises: AttributeError if bench does not contain verify_trace method.
TestStepFail if verify_trace returns T... | [
"Raise",
"TestStepFail",
"if",
"bench",
".",
"verify_trace",
"does",
"not",
"find",
"message",
"from",
"dut",
"traces",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L77-L90 | train | 25,751 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertNone | def assertNone(expr, message=None):
"""
Assert that expr is None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is not None.
"""
if expr is not None:
raise TestStepFail(
format_message(message) if message is not No... | python | def assertNone(expr, message=None):
"""
Assert that expr is None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is not None.
"""
if expr is not None:
raise TestStepFail(
format_message(message) if message is not No... | [
"def",
"assertNone",
"(",
"expr",
",",
"message",
"=",
"None",
")",
":",
"if",
"expr",
"is",
"not",
"None",
":",
"raise",
"TestStepFail",
"(",
"format_message",
"(",
"message",
")",
"if",
"message",
"is",
"not",
"None",
"else",
"\"Assert: %s != None\"",
"%... | Assert that expr is None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is not None. | [
"Assert",
"that",
"expr",
"is",
"None",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L135-L145 | train | 25,752 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertNotNone | def assertNotNone(expr, message=None):
"""
Assert that expr is not None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is None.
"""
if expr is None:
raise TestStepFail(
format_message(message) if message is not Non... | python | def assertNotNone(expr, message=None):
"""
Assert that expr is not None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is None.
"""
if expr is None:
raise TestStepFail(
format_message(message) if message is not Non... | [
"def",
"assertNotNone",
"(",
"expr",
",",
"message",
"=",
"None",
")",
":",
"if",
"expr",
"is",
"None",
":",
"raise",
"TestStepFail",
"(",
"format_message",
"(",
"message",
")",
"if",
"message",
"is",
"not",
"None",
"else",
"\"Assert: %s == None\"",
"%",
"... | Assert that expr is not None.
:param expr: expression.
:param message: Message set to raised Exception
:raises: TestStepFail if expr is None. | [
"Assert",
"that",
"expr",
"is",
"not",
"None",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L148-L158 | train | 25,753 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertEqual | def assertEqual(first, second, message=None):
"""
Assert that first equals second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first == second
"""
if not first == second:
raise TestStepF... | python | def assertEqual(first, second, message=None):
"""
Assert that first equals second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first == second
"""
if not first == second:
raise TestStepF... | [
"def",
"assertEqual",
"(",
"first",
",",
"second",
",",
"message",
"=",
"None",
")",
":",
"if",
"not",
"first",
"==",
"second",
":",
"raise",
"TestStepFail",
"(",
"format_message",
"(",
"message",
")",
"if",
"message",
"is",
"not",
"None",
"else",
"\"Ass... | Assert that first equals second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first == second | [
"Assert",
"that",
"first",
"equals",
"second",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L161-L173 | train | 25,754 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertNotEqual | def assertNotEqual(first, second, message=None):
"""
Assert that first does not equal second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first != second
"""
if not first != second:
rais... | python | def assertNotEqual(first, second, message=None):
"""
Assert that first does not equal second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first != second
"""
if not first != second:
rais... | [
"def",
"assertNotEqual",
"(",
"first",
",",
"second",
",",
"message",
"=",
"None",
")",
":",
"if",
"not",
"first",
"!=",
"second",
":",
"raise",
"TestStepFail",
"(",
"format_message",
"(",
"message",
")",
"if",
"message",
"is",
"not",
"None",
"else",
"\"... | Assert that first does not equal second.
:param first: First part to evaluate
:param second: Second part to evaluate
:param message: Failure message
:raises: TestStepFail if not first != second | [
"Assert",
"that",
"first",
"does",
"not",
"equal",
"second",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L176-L188 | train | 25,755 |
ARMmbed/icetea | icetea_lib/tools/asserts.py | assertJsonContains | def assertJsonContains(jsonStr=None, key=None, message=None):
"""
Assert that jsonStr contains key.
:param jsonStr: Json as string
:param key: Key to look for
:param message: Failure message
:raises: TestStepFail if key is not in jsonStr or
if loading jsonStr to a dictionary fails or if jso... | python | def assertJsonContains(jsonStr=None, key=None, message=None):
"""
Assert that jsonStr contains key.
:param jsonStr: Json as string
:param key: Key to look for
:param message: Failure message
:raises: TestStepFail if key is not in jsonStr or
if loading jsonStr to a dictionary fails or if jso... | [
"def",
"assertJsonContains",
"(",
"jsonStr",
"=",
"None",
",",
"key",
"=",
"None",
",",
"message",
"=",
"None",
")",
":",
"if",
"jsonStr",
"is",
"not",
"None",
":",
"try",
":",
"data",
"=",
"json",
".",
"loads",
"(",
"jsonStr",
")",
"if",
"key",
"n... | Assert that jsonStr contains key.
:param jsonStr: Json as string
:param key: Key to look for
:param message: Failure message
:raises: TestStepFail if key is not in jsonStr or
if loading jsonStr to a dictionary fails or if jsonStr is None. | [
"Assert",
"that",
"jsonStr",
"contains",
"key",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/asserts.py#L191-L215 | train | 25,756 |
ARMmbed/icetea | icetea_lib/tools/GitTool.py | get_path | def get_path(filename):
"""
Get absolute path for filename.
:param filename: file
:return: path
"""
path = abspath(filename) if os.path.isdir(filename) else dirname(abspath(filename))
return path | python | def get_path(filename):
"""
Get absolute path for filename.
:param filename: file
:return: path
"""
path = abspath(filename) if os.path.isdir(filename) else dirname(abspath(filename))
return path | [
"def",
"get_path",
"(",
"filename",
")",
":",
"path",
"=",
"abspath",
"(",
"filename",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
"else",
"dirname",
"(",
"abspath",
"(",
"filename",
")",
")",
"return",
"path"
] | Get absolute path for filename.
:param filename: file
:return: path | [
"Get",
"absolute",
"path",
"for",
"filename",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GitTool.py#L24-L32 | train | 25,757 |
ARMmbed/icetea | icetea_lib/tools/GitTool.py | get_git_file_path | def get_git_file_path(filename):
"""
Get relative path for filename in git root.
:param filename: File name
:return: relative path or None
"""
git_root = get_git_root(filename)
return relpath(filename, git_root).replace("\\", "/") if git_root else '' | python | def get_git_file_path(filename):
"""
Get relative path for filename in git root.
:param filename: File name
:return: relative path or None
"""
git_root = get_git_root(filename)
return relpath(filename, git_root).replace("\\", "/") if git_root else '' | [
"def",
"get_git_file_path",
"(",
"filename",
")",
":",
"git_root",
"=",
"get_git_root",
"(",
"filename",
")",
"return",
"relpath",
"(",
"filename",
",",
"git_root",
")",
".",
"replace",
"(",
"\"\\\\\"",
",",
"\"/\"",
")",
"if",
"git_root",
"else",
"''"
] | Get relative path for filename in git root.
:param filename: File name
:return: relative path or None | [
"Get",
"relative",
"path",
"for",
"filename",
"in",
"git",
"root",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GitTool.py#L46-L54 | train | 25,758 |
ARMmbed/icetea | icetea_lib/tools/GitTool.py | get_git_info | def get_git_info(git_folder, verbose=False):
"""
Detect GIT information by folder.
:param git_folder: Folder
:param verbose: Verbosity, boolean, default is False
:return: dict
"""
if verbose:
print("detect GIT info by folder: '%s'" % git_folder)
try:
git_info = {
... | python | def get_git_info(git_folder, verbose=False):
"""
Detect GIT information by folder.
:param git_folder: Folder
:param verbose: Verbosity, boolean, default is False
:return: dict
"""
if verbose:
print("detect GIT info by folder: '%s'" % git_folder)
try:
git_info = {
... | [
"def",
"get_git_info",
"(",
"git_folder",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"print",
"(",
"\"detect GIT info by folder: '%s'\"",
"%",
"git_folder",
")",
"try",
":",
"git_info",
"=",
"{",
"\"commitid\"",
":",
"get_commit_id",
"(",
"g... | Detect GIT information by folder.
:param git_folder: Folder
:param verbose: Verbosity, boolean, default is False
:return: dict | [
"Detect",
"GIT",
"information",
"by",
"folder",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GitTool.py#L105-L148 | train | 25,759 |
ARMmbed/icetea | icetea_lib/tools/GitTool.py | __get_git_bin | def __get_git_bin():
"""
Get git binary location.
:return: Check git location
"""
git = 'git'
alternatives = [
'/usr/bin/git'
]
for alt in alternatives:
if os.path.exists(alt):
git = alt
break
return git | python | def __get_git_bin():
"""
Get git binary location.
:return: Check git location
"""
git = 'git'
alternatives = [
'/usr/bin/git'
]
for alt in alternatives:
if os.path.exists(alt):
git = alt
break
return git | [
"def",
"__get_git_bin",
"(",
")",
":",
"git",
"=",
"'git'",
"alternatives",
"=",
"[",
"'/usr/bin/git'",
"]",
"for",
"alt",
"in",
"alternatives",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"alt",
")",
":",
"git",
"=",
"alt",
"break",
"return",
... | Get git binary location.
:return: Check git location | [
"Get",
"git",
"binary",
"location",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GitTool.py#L151-L165 | train | 25,760 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build | def build(self):
"""
get build name.
:return: build name. None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.name
return ... | python | def build(self):
"""
get build name.
:return: build name. None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.name
return ... | [
"def",
"build",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
")",
"... | get build name.
:return: build name. None if not found | [
"get",
"build",
"name",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L140-L149 | train | 25,761 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_date | def build_date(self):
"""
get build date.
:return: build date. None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.date
re... | python | def build_date(self):
"""
get build date.
:return: build date. None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.date
re... | [
"def",
"build_date",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
")"... | get build date.
:return: build date. None if not found | [
"get",
"build",
"date",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L159-L168 | train | 25,762 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_sha1 | def build_sha1(self):
"""
get sha1 hash of build.
:return: build sha1 or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.sha1
... | python | def build_sha1(self):
"""
get sha1 hash of build.
:return: build sha1 or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.sha1
... | [
"def",
"build_sha1",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
")"... | get sha1 hash of build.
:return: build sha1 or None if not found | [
"get",
"sha1",
"hash",
"of",
"build",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L178-L187 | train | 25,763 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_git_url | def build_git_url(self):
"""
get build git url.
:return: build git url or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.gitu... | python | def build_git_url(self):
"""
get build git url.
:return: build git url or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.gitu... | [
"def",
"build_git_url",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
... | get build git url.
:return: build git url or None if not found | [
"get",
"build",
"git",
"url",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L214-L223 | train | 25,764 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_data | def build_data(self):
"""
get build data.
:return: build data or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.get_data()
... | python | def build_data(self):
"""
get build data.
:return: build data or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.get_data()
... | [
"def",
"build_data",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
")"... | get build data.
:return: build data or None if not found | [
"get",
"build",
"data",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L232-L241 | train | 25,765 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_branch | def build_branch(self):
"""
get build branch.
:return: build branch or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.branch
... | python | def build_branch(self):
"""
get build branch.
:return: build branch or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.branch
... | [
"def",
"build_branch",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
"... | get build branch.
:return: build branch or None if not found | [
"get",
"build",
"branch",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L244-L253 | train | 25,766 |
ARMmbed/icetea | icetea_lib/Result.py | Result.buildcommit | def buildcommit(self):
"""
get build commit id.
:return: build commit id or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.co... | python | def buildcommit(self):
"""
get build commit id.
:return: build commit id or None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.co... | [
"def",
"buildcommit",
"(",
"self",
")",
":",
"# pylint: disable=len-as-condition",
"if",
"len",
"(",
"self",
".",
"dutinformation",
")",
">",
"0",
"and",
"(",
"self",
".",
"dutinformation",
".",
"get",
"(",
"0",
")",
".",
"build",
"is",
"not",
"None",
")... | get build commit id.
:return: build commit id or None if not found | [
"get",
"build",
"commit",
"id",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L262-L271 | train | 25,767 |
ARMmbed/icetea | icetea_lib/Result.py | Result.set_verdict | def set_verdict(self, verdict, retcode=-1, duration=-1):
"""
Set the final verdict for this Result.
:param verdict: Verdict, must be from ['pass', 'fail', 'unknown', 'skip', 'inconclusive']'
:param retcode: integer return code
:param duration: test duration
:return: Noth... | python | def set_verdict(self, verdict, retcode=-1, duration=-1):
"""
Set the final verdict for this Result.
:param verdict: Verdict, must be from ['pass', 'fail', 'unknown', 'skip', 'inconclusive']'
:param retcode: integer return code
:param duration: test duration
:return: Noth... | [
"def",
"set_verdict",
"(",
"self",
",",
"verdict",
",",
"retcode",
"=",
"-",
"1",
",",
"duration",
"=",
"-",
"1",
")",
":",
"verdict",
"=",
"verdict",
".",
"lower",
"(",
")",
"if",
"not",
"verdict",
"in",
"[",
"'pass'",
",",
"'fail'",
",",
"'unknow... | Set the final verdict for this Result.
:param verdict: Verdict, must be from ['pass', 'fail', 'unknown', 'skip', 'inconclusive']'
:param retcode: integer return code
:param duration: test duration
:return: Nothing
:raises: ValueError if verdict was unknown. | [
"Set",
"the",
"final",
"verdict",
"for",
"this",
"Result",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L352-L370 | train | 25,768 |
ARMmbed/icetea | icetea_lib/Result.py | Result.build_result_metadata | def build_result_metadata(self, data=None, args=None):
"""
collect metadata into this object
:param data: dict
:param args: build from args instead of data
"""
data = data if data else self._build_result_metainfo(args)
if data.get("build_branch"):
sel... | python | def build_result_metadata(self, data=None, args=None):
"""
collect metadata into this object
:param data: dict
:param args: build from args instead of data
"""
data = data if data else self._build_result_metainfo(args)
if data.get("build_branch"):
sel... | [
"def",
"build_result_metadata",
"(",
"self",
",",
"data",
"=",
"None",
",",
"args",
"=",
"None",
")",
":",
"data",
"=",
"data",
"if",
"data",
"else",
"self",
".",
"_build_result_metainfo",
"(",
"args",
")",
"if",
"data",
".",
"get",
"(",
"\"build_branch\... | collect metadata into this object
:param data: dict
:param args: build from args instead of data | [
"collect",
"metadata",
"into",
"this",
"object"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L372-L395 | train | 25,769 |
ARMmbed/icetea | icetea_lib/Result.py | Result._build_result_metainfo | def _build_result_metainfo(args):
"""
Internal helper for collecting metadata from args to results
"""
data = dict()
if hasattr(args, "branch") and args.branch:
data["build_branch"] = args.branch
if hasattr(args, "commitId") and args.commitId:
data... | python | def _build_result_metainfo(args):
"""
Internal helper for collecting metadata from args to results
"""
data = dict()
if hasattr(args, "branch") and args.branch:
data["build_branch"] = args.branch
if hasattr(args, "commitId") and args.commitId:
data... | [
"def",
"_build_result_metainfo",
"(",
"args",
")",
":",
"data",
"=",
"dict",
"(",
")",
"if",
"hasattr",
"(",
"args",
",",
"\"branch\"",
")",
"and",
"args",
".",
"branch",
":",
"data",
"[",
"\"build_branch\"",
"]",
"=",
"args",
".",
"branch",
"if",
"has... | Internal helper for collecting metadata from args to results | [
"Internal",
"helper",
"for",
"collecting",
"metadata",
"from",
"args",
"to",
"results"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L398-L419 | train | 25,770 |
ARMmbed/icetea | icetea_lib/Result.py | Result.get_duration | def get_duration(self, seconds=False):
"""
Get test case duration.
:param seconds: if set to True, return tc duration in seconds, otherwise as str(
datetime.timedelta)
:return: str(datetime.timedelta) or duration as string in seconds
"""
if seconds:
r... | python | def get_duration(self, seconds=False):
"""
Get test case duration.
:param seconds: if set to True, return tc duration in seconds, otherwise as str(
datetime.timedelta)
:return: str(datetime.timedelta) or duration as string in seconds
"""
if seconds:
r... | [
"def",
"get_duration",
"(",
"self",
",",
"seconds",
"=",
"False",
")",
":",
"if",
"seconds",
":",
"return",
"str",
"(",
"self",
".",
"duration",
")",
"delta",
"=",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"self",
".",
"duration",
")",
"return... | Get test case duration.
:param seconds: if set to True, return tc duration in seconds, otherwise as str(
datetime.timedelta)
:return: str(datetime.timedelta) or duration as string in seconds | [
"Get",
"test",
"case",
"duration",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L531-L542 | train | 25,771 |
ARMmbed/icetea | icetea_lib/Result.py | Result.has_logs | def has_logs(self):
"""
Check if log files are available and return file names if they exist.
:return: list
"""
found_files = []
if self.logpath is None:
return found_files
if os.path.exists(self.logpath):
for root, _, files in os.walk(os.... | python | def has_logs(self):
"""
Check if log files are available and return file names if they exist.
:return: list
"""
found_files = []
if self.logpath is None:
return found_files
if os.path.exists(self.logpath):
for root, _, files in os.walk(os.... | [
"def",
"has_logs",
"(",
"self",
")",
":",
"found_files",
"=",
"[",
"]",
"if",
"self",
".",
"logpath",
"is",
"None",
":",
"return",
"found_files",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"logpath",
")",
":",
"for",
"root",
",",
"_"... | Check if log files are available and return file names if they exist.
:return: list | [
"Check",
"if",
"log",
"files",
"are",
"available",
"and",
"return",
"file",
"names",
"if",
"they",
"exist",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Result.py#L553-L567 | train | 25,772 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutProcess.py | DutProcess.open_connection | def open_connection(self):
"""
Open connection by starting the process.
:raises: DutConnectionError
"""
self.logger.debug("Open CLI Process '%s'",
(self.comport), extra={'type': '<->'})
self.cmd = self.comport if isinstance(self.comport, list) e... | python | def open_connection(self):
"""
Open connection by starting the process.
:raises: DutConnectionError
"""
self.logger.debug("Open CLI Process '%s'",
(self.comport), extra={'type': '<->'})
self.cmd = self.comport if isinstance(self.comport, list) e... | [
"def",
"open_connection",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Open CLI Process '%s'\"",
",",
"(",
"self",
".",
"comport",
")",
",",
"extra",
"=",
"{",
"'type'",
":",
"'<->'",
"}",
")",
"self",
".",
"cmd",
"=",
"self",
... | Open connection by starting the process.
:raises: DutConnectionError | [
"Open",
"connection",
"by",
"starting",
"the",
"process",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutProcess.py#L42-L68 | train | 25,773 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutProcess.py | DutProcess.writeline | def writeline(self, data, crlf="\n"): # pylint: disable=arguments-differ
"""
Write data to process.
:param data: data to write
:param crlf: line end character
:return: Nothing
"""
GenericProcess.writeline(self, data, crlf=crlf) | python | def writeline(self, data, crlf="\n"): # pylint: disable=arguments-differ
"""
Write data to process.
:param data: data to write
:param crlf: line end character
:return: Nothing
"""
GenericProcess.writeline(self, data, crlf=crlf) | [
"def",
"writeline",
"(",
"self",
",",
"data",
",",
"crlf",
"=",
"\"\\n\"",
")",
":",
"# pylint: disable=arguments-differ",
"GenericProcess",
".",
"writeline",
"(",
"self",
",",
"data",
",",
"crlf",
"=",
"crlf",
")"
] | Write data to process.
:param data: data to write
:param crlf: line end character
:return: Nothing | [
"Write",
"data",
"to",
"process",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutProcess.py#L96-L104 | train | 25,774 |
ARMmbed/icetea | icetea_lib/Plugin/plugins/FileApi.py | FileApiPlugin._jsonfileconstructor | def _jsonfileconstructor(self, filename=None, filepath=None, logger=None):
"""
Constructor method for the JsonFile object.
:param filename: Name of the file
:param filepath: Path to the file
:param logger: Optional logger.
:return: JsonFile
"""
if filepat... | python | def _jsonfileconstructor(self, filename=None, filepath=None, logger=None):
"""
Constructor method for the JsonFile object.
:param filename: Name of the file
:param filepath: Path to the file
:param logger: Optional logger.
:return: JsonFile
"""
if filepat... | [
"def",
"_jsonfileconstructor",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"filepath",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"if",
"filepath",
":",
"path",
"=",
"filepath",
"else",
":",
"tc_path",
"=",
"os",
".",
"path",
".",
"abspath"... | Constructor method for the JsonFile object.
:param filename: Name of the file
:param filepath: Path to the file
:param logger: Optional logger.
:return: JsonFile | [
"Constructor",
"method",
"for",
"the",
"JsonFile",
"object",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/FileApi.py#L52-L70 | train | 25,775 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | NonBlockingStreamReader._get_sd | def _get_sd(file_descr):
"""
Get streamdescriptor matching file_descr fileno.
:param file_descr: file object
:return: StreamDescriptor or None
"""
for stream_descr in NonBlockingStreamReader._streams:
if file_descr == stream_descr.stream.fileno():
... | python | def _get_sd(file_descr):
"""
Get streamdescriptor matching file_descr fileno.
:param file_descr: file object
:return: StreamDescriptor or None
"""
for stream_descr in NonBlockingStreamReader._streams:
if file_descr == stream_descr.stream.fileno():
... | [
"def",
"_get_sd",
"(",
"file_descr",
")",
":",
"for",
"stream_descr",
"in",
"NonBlockingStreamReader",
".",
"_streams",
":",
"if",
"file_descr",
"==",
"stream_descr",
".",
"stream",
".",
"fileno",
"(",
")",
":",
"return",
"stream_descr",
"return",
"None"
] | Get streamdescriptor matching file_descr fileno.
:param file_descr: file object
:return: StreamDescriptor or None | [
"Get",
"streamdescriptor",
"matching",
"file_descr",
"fileno",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L76-L86 | train | 25,776 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | NonBlockingStreamReader._read_fd | def _read_fd(file_descr):
"""
Read incoming data from file handle.
Then find the matching StreamDescriptor by file_descr value.
:param file_descr: file object
:return: Return number of bytes read
"""
try:
line = os.read(file_descr, 1024 * 1024)
... | python | def _read_fd(file_descr):
"""
Read incoming data from file handle.
Then find the matching StreamDescriptor by file_descr value.
:param file_descr: file object
:return: Return number of bytes read
"""
try:
line = os.read(file_descr, 1024 * 1024)
... | [
"def",
"_read_fd",
"(",
"file_descr",
")",
":",
"try",
":",
"line",
"=",
"os",
".",
"read",
"(",
"file_descr",
",",
"1024",
"*",
"1024",
")",
"except",
"OSError",
":",
"stream_desc",
"=",
"NonBlockingStreamReader",
".",
"_get_sd",
"(",
"file_descr",
")",
... | Read incoming data from file handle.
Then find the matching StreamDescriptor by file_descr value.
:param file_descr: file object
:return: Return number of bytes read | [
"Read",
"incoming",
"data",
"from",
"file",
"handle",
".",
"Then",
"find",
"the",
"matching",
"StreamDescriptor",
"by",
"file_descr",
"value",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L89-L129 | train | 25,777 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | NonBlockingStreamReader._read_select_kqueue | def _read_select_kqueue(k_queue):
"""
Read PIPES using BSD Kqueue
"""
npipes = len(NonBlockingStreamReader._streams)
# Create list of kevent objects
# pylint: disable=no-member
kevents = [select.kevent(s.stream.fileno(),
filter=sel... | python | def _read_select_kqueue(k_queue):
"""
Read PIPES using BSD Kqueue
"""
npipes = len(NonBlockingStreamReader._streams)
# Create list of kevent objects
# pylint: disable=no-member
kevents = [select.kevent(s.stream.fileno(),
filter=sel... | [
"def",
"_read_select_kqueue",
"(",
"k_queue",
")",
":",
"npipes",
"=",
"len",
"(",
"NonBlockingStreamReader",
".",
"_streams",
")",
"# Create list of kevent objects",
"# pylint: disable=no-member",
"kevents",
"=",
"[",
"select",
".",
"kevent",
"(",
"s",
".",
"stream... | Read PIPES using BSD Kqueue | [
"Read",
"PIPES",
"using",
"BSD",
"Kqueue"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L167-L185 | train | 25,778 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | NonBlockingStreamReader.stop | def stop(self):
"""
Stop the reader
"""
# print('stopping NonBlockingStreamReader..')
# print('acquire..')
NonBlockingStreamReader._stream_mtx.acquire()
# print('acquire..ok')
NonBlockingStreamReader._streams.remove(self._descriptor)
if not NonBloc... | python | def stop(self):
"""
Stop the reader
"""
# print('stopping NonBlockingStreamReader..')
# print('acquire..')
NonBlockingStreamReader._stream_mtx.acquire()
# print('acquire..ok')
NonBlockingStreamReader._streams.remove(self._descriptor)
if not NonBloc... | [
"def",
"stop",
"(",
"self",
")",
":",
"# print('stopping NonBlockingStreamReader..')",
"# print('acquire..')",
"NonBlockingStreamReader",
".",
"_stream_mtx",
".",
"acquire",
"(",
")",
"# print('acquire..ok')",
"NonBlockingStreamReader",
".",
"_streams",
".",
"remove",
"(",
... | Stop the reader | [
"Stop",
"the",
"reader"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L219-L238 | train | 25,779 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | GenericProcess.use_gdbs | def use_gdbs(self, gdbs=True, port=2345):
"""
Set gdbs use for process.
:param gdbs: Boolean, default is True
:param port: Port number for gdbserver
"""
self.gdbs = gdbs
self.gdbs_port = port | python | def use_gdbs(self, gdbs=True, port=2345):
"""
Set gdbs use for process.
:param gdbs: Boolean, default is True
:param port: Port number for gdbserver
"""
self.gdbs = gdbs
self.gdbs_port = port | [
"def",
"use_gdbs",
"(",
"self",
",",
"gdbs",
"=",
"True",
",",
"port",
"=",
"2345",
")",
":",
"self",
".",
"gdbs",
"=",
"gdbs",
"self",
".",
"gdbs_port",
"=",
"port"
] | Set gdbs use for process.
:param gdbs: Boolean, default is True
:param port: Port number for gdbserver | [
"Set",
"gdbs",
"use",
"for",
"process",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L331-L339 | train | 25,780 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | GenericProcess.use_valgrind | def use_valgrind(self, tool, xml, console, track_origins, valgrind_extra_params):
"""
Use Valgrind.
:param tool: Tool name, must be memcheck, callgrind or massif
:param xml: Boolean output xml
:param console: Dump output to console, Boolean
:param track_origins: Boolean,... | python | def use_valgrind(self, tool, xml, console, track_origins, valgrind_extra_params):
"""
Use Valgrind.
:param tool: Tool name, must be memcheck, callgrind or massif
:param xml: Boolean output xml
:param console: Dump output to console, Boolean
:param track_origins: Boolean,... | [
"def",
"use_valgrind",
"(",
"self",
",",
"tool",
",",
"xml",
",",
"console",
",",
"track_origins",
",",
"valgrind_extra_params",
")",
":",
"self",
".",
"valgrind",
"=",
"tool",
"self",
".",
"valgrind_xml",
"=",
"xml",
"self",
".",
"valgrind_console",
"=",
... | Use Valgrind.
:param tool: Tool name, must be memcheck, callgrind or massif
:param xml: Boolean output xml
:param console: Dump output to console, Boolean
:param track_origins: Boolean, set --track-origins=yes
:param valgrind_extra_params: Extra parameters
:return: Noth... | [
"Use",
"Valgrind",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L359-L377 | train | 25,781 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | GenericProcess.__get_valgrind_params | def __get_valgrind_params(self):
"""
Get Valgrind command as list.
:return: list
"""
valgrind = []
if self.valgrind:
valgrind.extend(['valgrind'])
if self.valgrind == 'memcheck':
valgrind.extend(['--tool=memcheck', '--leak-check=fu... | python | def __get_valgrind_params(self):
"""
Get Valgrind command as list.
:return: list
"""
valgrind = []
if self.valgrind:
valgrind.extend(['valgrind'])
if self.valgrind == 'memcheck':
valgrind.extend(['--tool=memcheck', '--leak-check=fu... | [
"def",
"__get_valgrind_params",
"(",
"self",
")",
":",
"valgrind",
"=",
"[",
"]",
"if",
"self",
".",
"valgrind",
":",
"valgrind",
".",
"extend",
"(",
"[",
"'valgrind'",
"]",
")",
"if",
"self",
".",
"valgrind",
"==",
"'memcheck'",
":",
"valgrind",
".",
... | Get Valgrind command as list.
:return: list | [
"Get",
"Valgrind",
"command",
"as",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L379-L438 | train | 25,782 |
ARMmbed/icetea | icetea_lib/tools/GenericProcess.py | GenericProcess.writeline | def writeline(self, data, crlf="\r\n"):
"""
Writeline implementation.
:param data: Data to write
:param crlf: Line end characters, defailt is \r\n
:return: Nothing
:raises: RuntimeError if errors happen while writing to PIPE or process stops.
"""
if self.... | python | def writeline(self, data, crlf="\r\n"):
"""
Writeline implementation.
:param data: Data to write
:param crlf: Line end characters, defailt is \r\n
:return: Nothing
:raises: RuntimeError if errors happen while writing to PIPE or process stops.
"""
if self.... | [
"def",
"writeline",
"(",
"self",
",",
"data",
",",
"crlf",
"=",
"\"\\r\\n\"",
")",
":",
"if",
"self",
".",
"read_thread",
":",
"if",
"self",
".",
"read_thread",
".",
"has_error",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Error writing PIPE\"",
")",
... | Writeline implementation.
:param data: Data to write
:param crlf: Line end characters, defailt is \r\n
:return: Nothing
:raises: RuntimeError if errors happen while writing to PIPE or process stops. | [
"Writeline",
"implementation",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L572-L590 | train | 25,783 |
ARMmbed/icetea | icetea_lib/Randomize/seed.py | SeedInteger.load | def load(filename):
"""
Load seed from a file.
:param filename: Source file name
:return: SeedInteger
"""
json_obj = Seed.load(filename)
return SeedInteger(json_obj["seed_value"], json_obj["seed_id"], json_obj["date"]) | python | def load(filename):
"""
Load seed from a file.
:param filename: Source file name
:return: SeedInteger
"""
json_obj = Seed.load(filename)
return SeedInteger(json_obj["seed_value"], json_obj["seed_id"], json_obj["date"]) | [
"def",
"load",
"(",
"filename",
")",
":",
"json_obj",
"=",
"Seed",
".",
"load",
"(",
"filename",
")",
"return",
"SeedInteger",
"(",
"json_obj",
"[",
"\"seed_value\"",
"]",
",",
"json_obj",
"[",
"\"seed_id\"",
"]",
",",
"json_obj",
"[",
"\"date\"",
"]",
"... | Load seed from a file.
:param filename: Source file name
:return: SeedInteger | [
"Load",
"seed",
"from",
"a",
"file",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Randomize/seed.py#L100-L108 | train | 25,784 |
ARMmbed/icetea | icetea_lib/enhancedserial.py | EnhancedSerial.get_pyserial_version | def get_pyserial_version(self):
"""! Retrieve pyserial module version
@return Returns float with pyserial module number
"""
pyserial_version = pkg_resources.require("pyserial")[0].version
version = 3.0
match = self.re_float.search(pyserial_version)
if match:
... | python | def get_pyserial_version(self):
"""! Retrieve pyserial module version
@return Returns float with pyserial module number
"""
pyserial_version = pkg_resources.require("pyserial")[0].version
version = 3.0
match = self.re_float.search(pyserial_version)
if match:
... | [
"def",
"get_pyserial_version",
"(",
"self",
")",
":",
"pyserial_version",
"=",
"pkg_resources",
".",
"require",
"(",
"\"pyserial\"",
")",
"[",
"0",
"]",
".",
"version",
"version",
"=",
"3.0",
"match",
"=",
"self",
".",
"re_float",
".",
"search",
"(",
"pyse... | ! Retrieve pyserial module version
@return Returns float with pyserial module number | [
"!",
"Retrieve",
"pyserial",
"module",
"version"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/enhancedserial.py#L40-L52 | train | 25,785 |
ARMmbed/icetea | icetea_lib/enhancedserial.py | EnhancedSerial.readline | def readline(self, timeout=1):
"""
maxsize is ignored, timeout in seconds is the max time that is way for a complete line
"""
tries = 0
while 1:
try:
block = self.read(512)
if isinstance(block, bytes):
block = block.... | python | def readline(self, timeout=1):
"""
maxsize is ignored, timeout in seconds is the max time that is way for a complete line
"""
tries = 0
while 1:
try:
block = self.read(512)
if isinstance(block, bytes):
block = block.... | [
"def",
"readline",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"tries",
"=",
"0",
"while",
"1",
":",
"try",
":",
"block",
"=",
"self",
".",
"read",
"(",
"512",
")",
"if",
"isinstance",
"(",
"block",
",",
"bytes",
")",
":",
"block",
"=",
"b... | maxsize is ignored, timeout in seconds is the max time that is way for a complete line | [
"maxsize",
"is",
"ignored",
"timeout",
"in",
"seconds",
"is",
"the",
"max",
"time",
"that",
"is",
"way",
"for",
"a",
"complete",
"line"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/enhancedserial.py#L97-L132 | train | 25,786 |
ARMmbed/icetea | icetea_lib/enhancedserial.py | EnhancedSerial.readlines | def readlines(self, timeout=1):
"""
read all lines that are available. abort after timeout
when no more data arrives.
"""
lines = []
while 1:
line = self.readline(timeout=timeout)
if line:
lines.append(line)
if not line ... | python | def readlines(self, timeout=1):
"""
read all lines that are available. abort after timeout
when no more data arrives.
"""
lines = []
while 1:
line = self.readline(timeout=timeout)
if line:
lines.append(line)
if not line ... | [
"def",
"readlines",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"lines",
"=",
"[",
"]",
"while",
"1",
":",
"line",
"=",
"self",
".",
"readline",
"(",
"timeout",
"=",
"timeout",
")",
"if",
"line",
":",
"lines",
".",
"append",
"(",
"line",
")"... | read all lines that are available. abort after timeout
when no more data arrives. | [
"read",
"all",
"lines",
"that",
"are",
"available",
".",
"abort",
"after",
"timeout",
"when",
"no",
"more",
"data",
"arrives",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/enhancedserial.py#L144-L156 | train | 25,787 |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceRequirements.py | ResourceRequirements.set | def set(self, key, value):
"""
Sets the value for a specific requirement.
:param key: Name of requirement to be set
:param value: Value to set for requirement key
:return: Nothing, modifies requirement
"""
if key == "tags":
self._set_tag(tags=value)
... | python | def set(self, key, value):
"""
Sets the value for a specific requirement.
:param key: Name of requirement to be set
:param value: Value to set for requirement key
:return: Nothing, modifies requirement
"""
if key == "tags":
self._set_tag(tags=value)
... | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"==",
"\"tags\"",
":",
"self",
".",
"_set_tag",
"(",
"tags",
"=",
"value",
")",
"else",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"key",
"in",
"self... | Sets the value for a specific requirement.
:param key: Name of requirement to be set
:param value: Value to set for requirement key
:return: Nothing, modifies requirement | [
"Sets",
"the",
"value",
"for",
"a",
"specific",
"requirement",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceRequirements.py#L32-L47 | train | 25,788 |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceRequirements.py | ResourceRequirements._set_tag | def _set_tag(self, tag=None, tags=None, value=True):
"""
Sets the value of a specific tag or merges existing tags with a dict of new tags.
Either tag or tags must be None.
:param tag: Tag which needs to be set.
:param tags: Set of tags which needs to be merged with existing tags... | python | def _set_tag(self, tag=None, tags=None, value=True):
"""
Sets the value of a specific tag or merges existing tags with a dict of new tags.
Either tag or tags must be None.
:param tag: Tag which needs to be set.
:param tags: Set of tags which needs to be merged with existing tags... | [
"def",
"_set_tag",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"value",
"=",
"True",
")",
":",
"existing_tags",
"=",
"self",
".",
"_requirements",
".",
"get",
"(",
"\"tags\"",
")",
"if",
"tags",
"and",
"not",
"tag",
":",
"e... | Sets the value of a specific tag or merges existing tags with a dict of new tags.
Either tag or tags must be None.
:param tag: Tag which needs to be set.
:param tags: Set of tags which needs to be merged with existing tags.
:param value: Value to set for net tag named by :param tag.
... | [
"Sets",
"the",
"value",
"of",
"a",
"specific",
"tag",
"or",
"merges",
"existing",
"tags",
"with",
"a",
"dict",
"of",
"new",
"tags",
".",
"Either",
"tag",
"or",
"tags",
"must",
"be",
"None",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceRequirements.py#L85-L101 | train | 25,789 |
ARMmbed/icetea | icetea_lib/main.py | icetea_main | def icetea_main():
"""
Main function for running Icetea. Calls sys.exit with the return code to exit.
:return: Nothing.
"""
from icetea_lib import IceteaManager
manager = IceteaManager.IceteaManager()
return_code = manager.run()
sys.exit(return_code) | python | def icetea_main():
"""
Main function for running Icetea. Calls sys.exit with the return code to exit.
:return: Nothing.
"""
from icetea_lib import IceteaManager
manager = IceteaManager.IceteaManager()
return_code = manager.run()
sys.exit(return_code) | [
"def",
"icetea_main",
"(",
")",
":",
"from",
"icetea_lib",
"import",
"IceteaManager",
"manager",
"=",
"IceteaManager",
".",
"IceteaManager",
"(",
")",
"return_code",
"=",
"manager",
".",
"run",
"(",
")",
"sys",
".",
"exit",
"(",
"return_code",
")"
] | Main function for running Icetea. Calls sys.exit with the return code to exit.
:return: Nothing. | [
"Main",
"function",
"for",
"running",
"Icetea",
".",
"Calls",
"sys",
".",
"exit",
"with",
"the",
"return",
"code",
"to",
"exit",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/main.py#L19-L28 | train | 25,790 |
ARMmbed/icetea | build_docs.py | build_docs | def build_docs(location="doc-source", target=None, library="icetea_lib"):
"""
Build documentation for Icetea. Start by autogenerating module documentation
and finish by building html.
:param location: Documentation source
:param target: Documentation target path
:param library: Library location... | python | def build_docs(location="doc-source", target=None, library="icetea_lib"):
"""
Build documentation for Icetea. Start by autogenerating module documentation
and finish by building html.
:param location: Documentation source
:param target: Documentation target path
:param library: Library location... | [
"def",
"build_docs",
"(",
"location",
"=",
"\"doc-source\"",
",",
"target",
"=",
"None",
",",
"library",
"=",
"\"icetea_lib\"",
")",
":",
"cmd_ar",
"=",
"[",
"\"sphinx-apidoc\"",
",",
"\"-o\"",
",",
"location",
",",
"library",
"]",
"try",
":",
"print",
"("... | Build documentation for Icetea. Start by autogenerating module documentation
and finish by building html.
:param location: Documentation source
:param target: Documentation target path
:param library: Library location for autodoc.
:return: -1 if something fails. 0 if successfull. | [
"Build",
"documentation",
"for",
"Icetea",
".",
"Start",
"by",
"autogenerating",
"module",
"documentation",
"and",
"finish",
"by",
"building",
"html",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/build_docs.py#L23-L60 | train | 25,791 |
ARMmbed/icetea | icetea_lib/Searcher.py | find_next | def find_next(lines, find_str, start_index):
"""
Find the next instance of find_str from lines starting from start_index.
:param lines: Lines to look through
:param find_str: String or Invert to look for
:param start_index: Index to start from
:return: (boolean, index, line)
"""
mode = ... | python | def find_next(lines, find_str, start_index):
"""
Find the next instance of find_str from lines starting from start_index.
:param lines: Lines to look through
:param find_str: String or Invert to look for
:param start_index: Index to start from
:return: (boolean, index, line)
"""
mode = ... | [
"def",
"find_next",
"(",
"lines",
",",
"find_str",
",",
"start_index",
")",
":",
"mode",
"=",
"None",
"if",
"isinstance",
"(",
"find_str",
",",
"basestring",
")",
":",
"mode",
"=",
"'normal'",
"message",
"=",
"find_str",
"elif",
"isinstance",
"(",
"find_st... | Find the next instance of find_str from lines starting from start_index.
:param lines: Lines to look through
:param find_str: String or Invert to look for
:param start_index: Index to start from
:return: (boolean, index, line) | [
"Find",
"the",
"next",
"instance",
"of",
"find_str",
"from",
"lines",
"starting",
"from",
"start_index",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Searcher.py#L37-L62 | train | 25,792 |
ARMmbed/icetea | icetea_lib/Searcher.py | verify_message | def verify_message(lines, expected_response):
"""
Looks for expectedResponse in lines.
:param lines: a list of strings to look through
:param expected_response: list or str to look for in lines.
:return: True or False.
:raises: TypeError if expectedResponse was not list or str.
LookUpError ... | python | def verify_message(lines, expected_response):
"""
Looks for expectedResponse in lines.
:param lines: a list of strings to look through
:param expected_response: list or str to look for in lines.
:return: True or False.
:raises: TypeError if expectedResponse was not list or str.
LookUpError ... | [
"def",
"verify_message",
"(",
"lines",
",",
"expected_response",
")",
":",
"position",
"=",
"0",
"if",
"isinstance",
"(",
"expected_response",
",",
"basestring",
")",
":",
"expected_response",
"=",
"[",
"expected_response",
"]",
"if",
"isinstance",
"(",
"expecte... | Looks for expectedResponse in lines.
:param lines: a list of strings to look through
:param expected_response: list or str to look for in lines.
:return: True or False.
:raises: TypeError if expectedResponse was not list or str.
LookUpError through FindNext function. | [
"Looks",
"for",
"expectedResponse",
"in",
"lines",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Searcher.py#L65-L92 | train | 25,793 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | _cleanlogs | def _cleanlogs(silent=False, log_location="log"):
"""
Cleans up Mbed-test default log directory.
:param silent: Defaults to False
:param log_location: Location of log files, defaults to "log"
:return: Nothing
"""
try:
print("cleaning up Icetea log directory.")
shutil.rmtree(... | python | def _cleanlogs(silent=False, log_location="log"):
"""
Cleans up Mbed-test default log directory.
:param silent: Defaults to False
:param log_location: Location of log files, defaults to "log"
:return: Nothing
"""
try:
print("cleaning up Icetea log directory.")
shutil.rmtree(... | [
"def",
"_cleanlogs",
"(",
"silent",
"=",
"False",
",",
"log_location",
"=",
"\"log\"",
")",
":",
"try",
":",
"print",
"(",
"\"cleaning up Icetea log directory.\"",
")",
"shutil",
".",
"rmtree",
"(",
"log_location",
",",
"ignore_errors",
"=",
"silent",
",",
"on... | Cleans up Mbed-test default log directory.
:param silent: Defaults to False
:param log_location: Location of log files, defaults to "log"
:return: Nothing | [
"Cleans",
"up",
"Mbed",
"-",
"test",
"default",
"log",
"directory",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L50-L63 | train | 25,794 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager.list_suites | def list_suites(suitedir="./testcases/suites", cloud=False):
"""
Static method for listing suites from both local source and cloud.
Uses PrettyTable to generate the table.
:param suitedir: Local directory for suites.
:param cloud: cloud module
:return: PrettyTable object... | python | def list_suites(suitedir="./testcases/suites", cloud=False):
"""
Static method for listing suites from both local source and cloud.
Uses PrettyTable to generate the table.
:param suitedir: Local directory for suites.
:param cloud: cloud module
:return: PrettyTable object... | [
"def",
"list_suites",
"(",
"suitedir",
"=",
"\"./testcases/suites\"",
",",
"cloud",
"=",
"False",
")",
":",
"suites",
"=",
"[",
"]",
"suites",
".",
"extend",
"(",
"TestSuite",
".",
"get_suite_files",
"(",
"suitedir",
")",
")",
"# no suitedir, or no suites -> app... | Static method for listing suites from both local source and cloud.
Uses PrettyTable to generate the table.
:param suitedir: Local directory for suites.
:param cloud: cloud module
:return: PrettyTable object or None if no test cases were found | [
"Static",
"method",
"for",
"listing",
"suites",
"from",
"both",
"local",
"source",
"and",
"cloud",
".",
"Uses",
"PrettyTable",
"to",
"generate",
"the",
"table",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L129-L156 | train | 25,795 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager._parse_arguments | def _parse_arguments():
"""
Static method for paring arguments
"""
parser = get_base_arguments(get_parser())
parser = get_tc_arguments(parser)
args, unknown = parser.parse_known_args()
return args, unknown | python | def _parse_arguments():
"""
Static method for paring arguments
"""
parser = get_base_arguments(get_parser())
parser = get_tc_arguments(parser)
args, unknown = parser.parse_known_args()
return args, unknown | [
"def",
"_parse_arguments",
"(",
")",
":",
"parser",
"=",
"get_base_arguments",
"(",
"get_parser",
"(",
")",
")",
"parser",
"=",
"get_tc_arguments",
"(",
"parser",
")",
"args",
",",
"unknown",
"=",
"parser",
".",
"parse_known_args",
"(",
")",
"return",
"args"... | Static method for paring arguments | [
"Static",
"method",
"for",
"paring",
"arguments"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L159-L166 | train | 25,796 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager.check_args | def check_args(self):
"""
Validates that a valid number of arguments were received and that all arguments were
recognised.
:return: True or False.
"""
parser = get_base_arguments(get_parser())
parser = get_tc_arguments(parser)
# Disable "Do not use len(SE... | python | def check_args(self):
"""
Validates that a valid number of arguments were received and that all arguments were
recognised.
:return: True or False.
"""
parser = get_base_arguments(get_parser())
parser = get_tc_arguments(parser)
# Disable "Do not use len(SE... | [
"def",
"check_args",
"(",
"self",
")",
":",
"parser",
"=",
"get_base_arguments",
"(",
"get_parser",
"(",
")",
")",
"parser",
"=",
"get_tc_arguments",
"(",
"parser",
")",
"# Disable \"Do not use len(SEQ) as condition value\"",
"# pylint: disable=C1801",
"if",
"len",
"(... | Validates that a valid number of arguments were received and that all arguments were
recognised.
:return: True or False. | [
"Validates",
"that",
"a",
"valid",
"number",
"of",
"arguments",
"were",
"received",
"and",
"that",
"all",
"arguments",
"were",
"recognised",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L168-L189 | train | 25,797 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager._init_pluginmanager | def _init_pluginmanager(self):
"""
Initialize PluginManager and load run wide plugins.
"""
self.pluginmanager = PluginManager(logger=self.logger)
self.logger.debug("Registering execution wide plugins:")
self.pluginmanager.load_default_run_plugins()
self.pluginmana... | python | def _init_pluginmanager(self):
"""
Initialize PluginManager and load run wide plugins.
"""
self.pluginmanager = PluginManager(logger=self.logger)
self.logger.debug("Registering execution wide plugins:")
self.pluginmanager.load_default_run_plugins()
self.pluginmana... | [
"def",
"_init_pluginmanager",
"(",
"self",
")",
":",
"self",
".",
"pluginmanager",
"=",
"PluginManager",
"(",
"logger",
"=",
"self",
".",
"logger",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Registering execution wide plugins:\"",
")",
"self",
".",
"plu... | Initialize PluginManager and load run wide plugins. | [
"Initialize",
"PluginManager",
"and",
"load",
"run",
"wide",
"plugins",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L191-L199 | train | 25,798 |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager.run | def run(self, args=None):
"""
Runs the set of tests within the given path.
"""
# Disable "Too many branches" and "Too many return statemets" warnings
# pylint: disable=R0912,R0911
retcodesummary = ExitCodes.EXIT_SUCCESS
self.args = args if args else self.args
... | python | def run(self, args=None):
"""
Runs the set of tests within the given path.
"""
# Disable "Too many branches" and "Too many return statemets" warnings
# pylint: disable=R0912,R0911
retcodesummary = ExitCodes.EXIT_SUCCESS
self.args = args if args else self.args
... | [
"def",
"run",
"(",
"self",
",",
"args",
"=",
"None",
")",
":",
"# Disable \"Too many branches\" and \"Too many return statemets\" warnings",
"# pylint: disable=R0912,R0911",
"retcodesummary",
"=",
"ExitCodes",
".",
"EXIT_SUCCESS",
"self",
".",
"args",
"=",
"args",
"if",
... | Runs the set of tests within the given path. | [
"Runs",
"the",
"set",
"of",
"tests",
"within",
"the",
"given",
"path",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L201-L265 | train | 25,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.