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 list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager._cleanup_resourceprovider | def _cleanup_resourceprovider(self):
"""
Calls cleanup for ResourceProvider of this run.
:return: Nothing
"""
# Disable too broad exception warning
# pylint: disable=W0703
self.resourceprovider = ResourceProvider(self.args)
try:
self.resourcep... | python | def _cleanup_resourceprovider(self):
"""
Calls cleanup for ResourceProvider of this run.
:return: Nothing
"""
# Disable too broad exception warning
# pylint: disable=W0703
self.resourceprovider = ResourceProvider(self.args)
try:
self.resourcep... | [
"def",
"_cleanup_resourceprovider",
"(",
"self",
")",
":",
"self",
".",
"resourceprovider",
"=",
"ResourceProvider",
"(",
"self",
".",
"args",
")",
"try",
":",
"self",
".",
"resourceprovider",
".",
"cleanup",
"(",
")",
"self",
".",
"logger",
".",
"info",
"... | Calls cleanup for ResourceProvider of this run.
:return: Nothing | [
"Calls",
"cleanup",
"for",
"ResourceProvider",
"of",
"this",
"run",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L292-L305 | train |
ARMmbed/icetea | icetea_lib/IceteaManager.py | IceteaManager._init_cloud | def _init_cloud(self, cloud_arg):
"""
Initializes Cloud module if cloud_arg is set.
:param cloud_arg: taken from args.cloud
:return: cloud module object instance
"""
# Disable too broad exception warning
# pylint: disable=W0703
cloud = None
if clo... | python | def _init_cloud(self, cloud_arg):
"""
Initializes Cloud module if cloud_arg is set.
:param cloud_arg: taken from args.cloud
:return: cloud module object instance
"""
# Disable too broad exception warning
# pylint: disable=W0703
cloud = None
if clo... | [
"def",
"_init_cloud",
"(",
"self",
",",
"cloud_arg",
")",
":",
"cloud",
"=",
"None",
"if",
"cloud_arg",
":",
"try",
":",
"if",
"hasattr",
"(",
"self",
".",
"args",
",",
"\"cm\"",
")",
":",
"cloud_module",
"=",
"self",
".",
"args",
".",
"cm",
"if",
... | Initializes Cloud module if cloud_arg is set.
:param cloud_arg: taken from args.cloud
:return: cloud module object instance | [
"Initializes",
"Cloud",
"module",
"if",
"cloud_arg",
"is",
"set",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/IceteaManager.py#L307-L329 | train |
ARMmbed/icetea | icetea_lib/Reports/ReportHtml.py | ReportHtml.generate | def generate(self, *args, **kwargs):
"""
Implementation for the generate method defined in ReportBase.
Generates a html report and saves it.
:param args: 1 argument, which is the filename
:param kwargs: 3 keyword arguments with keys 'title', 'heads' and 'refresh'
:return... | python | def generate(self, *args, **kwargs):
"""
Implementation for the generate method defined in ReportBase.
Generates a html report and saves it.
:param args: 1 argument, which is the filename
:param kwargs: 3 keyword arguments with keys 'title', 'heads' and 'refresh'
:return... | [
"def",
"generate",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"title",
"=",
"kwargs",
".",
"get",
"(",
"\"title\"",
")",
"heads",
"=",
"kwargs",
".",
"get",
"(",
"\"heads\"",
")",
"refresh",
"=",
"kwargs",
".",
"get",
"(",
"\"ref... | Implementation for the generate method defined in ReportBase.
Generates a html report and saves it.
:param args: 1 argument, which is the filename
:param kwargs: 3 keyword arguments with keys 'title', 'heads' and 'refresh'
:return: Nothing. | [
"Implementation",
"for",
"the",
"generate",
"method",
"defined",
"in",
"ReportBase",
".",
"Generates",
"a",
"html",
"report",
"and",
"saves",
"it",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Reports/ReportHtml.py#L35-L49 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | check_int | def check_int(integer):
"""
Check if number is integer or not.
:param integer: Number as str
:return: Boolean
"""
if not isinstance(integer, str):
return False
if integer[0] in ('-', '+'):
return integer[1:].isdigit()
return integer.isdigit() | python | def check_int(integer):
"""
Check if number is integer or not.
:param integer: Number as str
:return: Boolean
"""
if not isinstance(integer, str):
return False
if integer[0] in ('-', '+'):
return integer[1:].isdigit()
return integer.isdigit() | [
"def",
"check_int",
"(",
"integer",
")",
":",
"if",
"not",
"isinstance",
"(",
"integer",
",",
"str",
")",
":",
"return",
"False",
"if",
"integer",
"[",
"0",
"]",
"in",
"(",
"'-'",
",",
"'+'",
")",
":",
"return",
"integer",
"[",
"1",
":",
"]",
"."... | Check if number is integer or not.
:param integer: Number as str
:return: Boolean | [
"Check",
"if",
"number",
"is",
"integer",
"or",
"not",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L92-L103 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | _is_pid_running_on_unix | def _is_pid_running_on_unix(pid):
"""
Check if PID is running for Unix systems.
"""
try:
os.kill(pid, 0)
except OSError as err:
# if error is ESRCH, it means the process doesn't exist
return not err.errno == os.errno.ESRCH
return True | python | def _is_pid_running_on_unix(pid):
"""
Check if PID is running for Unix systems.
"""
try:
os.kill(pid, 0)
except OSError as err:
# if error is ESRCH, it means the process doesn't exist
return not err.errno == os.errno.ESRCH
return True | [
"def",
"_is_pid_running_on_unix",
"(",
"pid",
")",
":",
"try",
":",
"os",
".",
"kill",
"(",
"pid",
",",
"0",
")",
"except",
"OSError",
"as",
"err",
":",
"return",
"not",
"err",
".",
"errno",
"==",
"os",
".",
"errno",
".",
"ESRCH",
"return",
"True"
] | Check if PID is running for Unix systems. | [
"Check",
"if",
"PID",
"is",
"running",
"for",
"Unix",
"systems",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L135-L144 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | _is_pid_running_on_windows | def _is_pid_running_on_windows(pid):
"""
Check if PID is running for Windows systems
"""
import ctypes.wintypes
kernel32 = ctypes.windll.kernel32
handle = kernel32.OpenProcess(1, 0, pid)
if handle == 0:
return False
exit_code = ctypes.wintypes.DWORD()
ret = kernel32.GetExitC... | python | def _is_pid_running_on_windows(pid):
"""
Check if PID is running for Windows systems
"""
import ctypes.wintypes
kernel32 = ctypes.windll.kernel32
handle = kernel32.OpenProcess(1, 0, pid)
if handle == 0:
return False
exit_code = ctypes.wintypes.DWORD()
ret = kernel32.GetExitC... | [
"def",
"_is_pid_running_on_windows",
"(",
"pid",
")",
":",
"import",
"ctypes",
".",
"wintypes",
"kernel32",
"=",
"ctypes",
".",
"windll",
".",
"kernel32",
"handle",
"=",
"kernel32",
".",
"OpenProcess",
"(",
"1",
",",
"0",
",",
"pid",
")",
"if",
"handle",
... | Check if PID is running for Windows systems | [
"Check",
"if",
"PID",
"is",
"running",
"for",
"Windows",
"systems"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L147-L161 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | strip_escape | def strip_escape(string='', encoding="utf-8"): # pylint: disable=redefined-outer-name
"""
Strip escape characters from string.
:param string: string to work on
:param encoding: string name of the encoding used.
:return: stripped string
"""
matches = []
try:
if hasattr(string, "... | python | def strip_escape(string='', encoding="utf-8"): # pylint: disable=redefined-outer-name
"""
Strip escape characters from string.
:param string: string to work on
:param encoding: string name of the encoding used.
:return: stripped string
"""
matches = []
try:
if hasattr(string, "... | [
"def",
"strip_escape",
"(",
"string",
"=",
"''",
",",
"encoding",
"=",
"\"utf-8\"",
")",
":",
"matches",
"=",
"[",
"]",
"try",
":",
"if",
"hasattr",
"(",
"string",
",",
"\"decode\"",
")",
":",
"string",
"=",
"string",
".",
"decode",
"(",
"encoding",
... | Strip escape characters from string.
:param string: string to work on
:param encoding: string name of the encoding used.
:return: stripped string | [
"Strip",
"escape",
"characters",
"from",
"string",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L167-L194 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | import_module | def import_module(modulename):
"""
Static method for importing module modulename. Can handle relative imports as well.
:param modulename: Name of module to import. Can be relative
:return: imported module instance.
"""
module = None
try:
module = importlib.import_module(modulename)
... | python | def import_module(modulename):
"""
Static method for importing module modulename. Can handle relative imports as well.
:param modulename: Name of module to import. Can be relative
:return: imported module instance.
"""
module = None
try:
module = importlib.import_module(modulename)
... | [
"def",
"import_module",
"(",
"modulename",
")",
":",
"module",
"=",
"None",
"try",
":",
"module",
"=",
"importlib",
".",
"import_module",
"(",
"modulename",
")",
"except",
"ImportError",
":",
"if",
"\".\"",
"in",
"modulename",
":",
"modules",
"=",
"modulenam... | Static method for importing module modulename. Can handle relative imports as well.
:param modulename: Name of module to import. Can be relative
:return: imported module instance. | [
"Static",
"method",
"for",
"importing",
"module",
"modulename",
".",
"Can",
"handle",
"relative",
"imports",
"as",
"well",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L222-L242 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | get_abs_path | def get_abs_path(relative_path):
"""
Get absolute path for relative path.
:param relative_path: Relative path
:return: absolute path
"""
abs_path = os.path.sep.join(
os.path.abspath(sys.modules[__name__].__file__).split(os.path.sep)[:-1])
abs_path = os.path.abspath(abs_path + os.pat... | python | def get_abs_path(relative_path):
"""
Get absolute path for relative path.
:param relative_path: Relative path
:return: absolute path
"""
abs_path = os.path.sep.join(
os.path.abspath(sys.modules[__name__].__file__).split(os.path.sep)[:-1])
abs_path = os.path.abspath(abs_path + os.pat... | [
"def",
"get_abs_path",
"(",
"relative_path",
")",
":",
"abs_path",
"=",
"os",
".",
"path",
".",
"sep",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"sys",
".",
"modules",
"[",
"__name__",
"]",
".",
"__file__",
")",
".",
"split",
"(",
"... | Get absolute path for relative path.
:param relative_path: Relative path
:return: absolute path | [
"Get",
"absolute",
"path",
"for",
"relative",
"path",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L259-L269 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | get_pkg_version | def get_pkg_version(pkg_name, parse=False):
"""
Verify and get installed python package version.
:param pkg_name: python package name
:param parse: parse version number with pkg_resourc.parse_version -function
:return: None if pkg is not installed,
otherwise version as a string or parsed ver... | python | def get_pkg_version(pkg_name, parse=False):
"""
Verify and get installed python package version.
:param pkg_name: python package name
:param parse: parse version number with pkg_resourc.parse_version -function
:return: None if pkg is not installed,
otherwise version as a string or parsed ver... | [
"def",
"get_pkg_version",
"(",
"pkg_name",
",",
"parse",
"=",
"False",
")",
":",
"import",
"pkg_resources",
"try",
":",
"version",
"=",
"pkg_resources",
".",
"require",
"(",
"pkg_name",
")",
"[",
"0",
"]",
".",
"version",
"return",
"pkg_resources",
".",
"p... | Verify and get installed python package version.
:param pkg_name: python package name
:param parse: parse version number with pkg_resourc.parse_version -function
:return: None if pkg is not installed,
otherwise version as a string or parsed version when parse=True | [
"Verify",
"and",
"get",
"installed",
"python",
"package",
"version",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L272-L286 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | generate_object_graphs_by_class | def generate_object_graphs_by_class(classlist):
"""
Generate reference and backreference graphs
for objects of type class for each class given in classlist.
Useful for debugging reference leaks in framework etc.
Usage example to generate graphs for class "someclass":
>>> import someclass
>>... | python | def generate_object_graphs_by_class(classlist):
"""
Generate reference and backreference graphs
for objects of type class for each class given in classlist.
Useful for debugging reference leaks in framework etc.
Usage example to generate graphs for class "someclass":
>>> import someclass
>>... | [
"def",
"generate_object_graphs_by_class",
"(",
"classlist",
")",
":",
"try",
":",
"import",
"objgraph",
"import",
"gc",
"except",
"ImportError",
":",
"return",
"graphcount",
"=",
"0",
"if",
"not",
"isinstance",
"(",
"classlist",
",",
"list",
")",
":",
"classli... | Generate reference and backreference graphs
for objects of type class for each class given in classlist.
Useful for debugging reference leaks in framework etc.
Usage example to generate graphs for class "someclass":
>>> import someclass
>>> someclassobject = someclass()
>>> generate_object_grap... | [
"Generate",
"reference",
"and",
"backreference",
"graphs",
"for",
"objects",
"of",
"type",
"class",
"for",
"each",
"class",
"given",
"in",
"classlist",
".",
"Useful",
"for",
"debugging",
"reference",
"leaks",
"in",
"framework",
"etc",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L303-L331 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | remove_empty_from_dict | def remove_empty_from_dict(dictionary):
"""
Remove empty items from dictionary d
:param dictionary:
:return:
"""
if isinstance(dictionary, dict):
return dict(
(k,
remove_empty_from_dict(v)) for k, v in iteritems(
dictionary) if v and remove_empt... | python | def remove_empty_from_dict(dictionary):
"""
Remove empty items from dictionary d
:param dictionary:
:return:
"""
if isinstance(dictionary, dict):
return dict(
(k,
remove_empty_from_dict(v)) for k, v in iteritems(
dictionary) if v and remove_empt... | [
"def",
"remove_empty_from_dict",
"(",
"dictionary",
")",
":",
"if",
"isinstance",
"(",
"dictionary",
",",
"dict",
")",
":",
"return",
"dict",
"(",
"(",
"k",
",",
"remove_empty_from_dict",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
... | Remove empty items from dictionary d
:param dictionary:
:return: | [
"Remove",
"empty",
"items",
"from",
"dictionary",
"d"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L396-L410 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | set_or_delete | def set_or_delete(dictionary, key, value):
"""
Set value as value of dict key key. If value is None, delete key key from dict.
:param dictionary: Dictionary to work on.
:param key: Key to set or delete. If deleting and key does not exist in dict, nothing is done.
:param value: Value to set. If valu... | python | def set_or_delete(dictionary, key, value):
"""
Set value as value of dict key key. If value is None, delete key key from dict.
:param dictionary: Dictionary to work on.
:param key: Key to set or delete. If deleting and key does not exist in dict, nothing is done.
:param value: Value to set. If valu... | [
"def",
"set_or_delete",
"(",
"dictionary",
",",
"key",
",",
"value",
")",
":",
"if",
"value",
":",
"dictionary",
"[",
"key",
"]",
"=",
"value",
"else",
":",
"if",
"dictionary",
".",
"get",
"(",
"key",
")",
":",
"del",
"dictionary",
"[",
"key",
"]"
] | Set value as value of dict key key. If value is None, delete key key from dict.
:param dictionary: Dictionary to work on.
:param key: Key to set or delete. If deleting and key does not exist in dict, nothing is done.
:param value: Value to set. If value is None, delete key.
:return: Nothing, modifies d... | [
"Set",
"value",
"as",
"value",
"of",
"dict",
"key",
"key",
".",
"If",
"value",
"is",
"None",
"delete",
"key",
"key",
"from",
"dict",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L434-L447 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | initLogger | def initLogger(name): # pylint: disable=invalid-name
'''
Initializes a basic logger. Can be replaced when constructing the
HttpApi object or afterwards with setter
'''
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
# Skip attaching StreamHandler if one is already attached to... | python | def initLogger(name): # pylint: disable=invalid-name
'''
Initializes a basic logger. Can be replaced when constructing the
HttpApi object or afterwards with setter
'''
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
# Skip attaching StreamHandler if one is already attached to... | [
"def",
"initLogger",
"(",
"name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"logger",
".",
"setLevel",
"(",
"logging",
".",
"INFO",
")",
"if",
"not",
"getattr",
"(",
"logger",
",",
"\"streamhandler_set\"",
",",
"None",
")",
... | Initializes a basic logger. Can be replaced when constructing the
HttpApi object or afterwards with setter | [
"Initializes",
"a",
"basic",
"logger",
".",
"Can",
"be",
"replaced",
"when",
"constructing",
"the",
"HttpApi",
"object",
"or",
"afterwards",
"with",
"setter"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L499-L514 | train |
ARMmbed/icetea | icetea_lib/tools/tools.py | find_duplicate_keys | def find_duplicate_keys(data):
"""
Find duplicate keys in a layer of ordered pairs. Intended as the object_pairs_hook callable
for json.load or loads.
:param data: ordered pairs
:return: Dictionary with no duplicate keys
:raises ValueError if duplicate keys are found
"""
out_dict = {}
... | python | def find_duplicate_keys(data):
"""
Find duplicate keys in a layer of ordered pairs. Intended as the object_pairs_hook callable
for json.load or loads.
:param data: ordered pairs
:return: Dictionary with no duplicate keys
:raises ValueError if duplicate keys are found
"""
out_dict = {}
... | [
"def",
"find_duplicate_keys",
"(",
"data",
")",
":",
"out_dict",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"data",
":",
"if",
"key",
"in",
"out_dict",
":",
"raise",
"ValueError",
"(",
"\"Duplicate key: {}\"",
".",
"format",
"(",
"key",
")",
")",
... | Find duplicate keys in a layer of ordered pairs. Intended as the object_pairs_hook callable
for json.load or loads.
:param data: ordered pairs
:return: Dictionary with no duplicate keys
:raises ValueError if duplicate keys are found | [
"Find",
"duplicate",
"keys",
"in",
"a",
"layer",
"of",
"ordered",
"pairs",
".",
"Intended",
"as",
"the",
"object_pairs_hook",
"callable",
"for",
"json",
".",
"load",
"or",
"loads",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/tools.py#L613-L627 | train |
ARMmbed/icetea | icetea_lib/build/build.py | BuildFile._load | def _load(self):
"""
Function load.
:return: file contents
:raises: NotFoundError if file not found
"""
if self.is_exists():
return open(self._ref, "rb").read()
raise NotFoundError("File %s not found" % self._ref) | python | def _load(self):
"""
Function load.
:return: file contents
:raises: NotFoundError if file not found
"""
if self.is_exists():
return open(self._ref, "rb").read()
raise NotFoundError("File %s not found" % self._ref) | [
"def",
"_load",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_exists",
"(",
")",
":",
"return",
"open",
"(",
"self",
".",
"_ref",
",",
"\"rb\"",
")",
".",
"read",
"(",
")",
"raise",
"NotFoundError",
"(",
"\"File %s not found\"",
"%",
"self",
".",
"_r... | Function load.
:return: file contents
:raises: NotFoundError if file not found | [
"Function",
"load",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/build/build.py#L152-L161 | train |
ARMmbed/icetea | icetea_lib/build/build.py | BuildHttp.get_file | def get_file(self):
"""
Load data into a file and return file path.
:return: path to file as string
"""
content = self._load()
if not content:
return None
filename = "temporary_file.bin"
with open(filename, "wb") as file_name:
file... | python | def get_file(self):
"""
Load data into a file and return file path.
:return: path to file as string
"""
content = self._load()
if not content:
return None
filename = "temporary_file.bin"
with open(filename, "wb") as file_name:
file... | [
"def",
"get_file",
"(",
"self",
")",
":",
"content",
"=",
"self",
".",
"_load",
"(",
")",
"if",
"not",
"content",
":",
"return",
"None",
"filename",
"=",
"\"temporary_file.bin\"",
"with",
"open",
"(",
"filename",
",",
"\"wb\"",
")",
"as",
"file_name",
":... | Load data into a file and return file path.
:return: path to file as string | [
"Load",
"data",
"into",
"a",
"file",
"and",
"return",
"file",
"path",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/build/build.py#L200-L212 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/DutInformation.py | DutInformation.as_dict | def as_dict(self):
"""
Generate a dictionary of the contents of this DutInformation object.
:return: dict
"""
my_info = {}
if self.platform:
my_info["model"] = self.platform
if self.resource_id:
my_info["sn"] = self.resource_id
if ... | python | def as_dict(self):
"""
Generate a dictionary of the contents of this DutInformation object.
:return: dict
"""
my_info = {}
if self.platform:
my_info["model"] = self.platform
if self.resource_id:
my_info["sn"] = self.resource_id
if ... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"my_info",
"=",
"{",
"}",
"if",
"self",
".",
"platform",
":",
"my_info",
"[",
"\"model\"",
"]",
"=",
"self",
".",
"platform",
"if",
"self",
".",
"resource_id",
":",
"my_info",
"[",
"\"sn\"",
"]",
"=",
"self",
... | Generate a dictionary of the contents of this DutInformation object.
:return: dict | [
"Generate",
"a",
"dictionary",
"of",
"the",
"contents",
"of",
"this",
"DutInformation",
"object",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/DutInformation.py#L44-L59 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/DutInformation.py | DutInformationList.get_resource_ids | def get_resource_ids(self):
"""
Get resource ids as a list.
:return: List of resource id:s or "unknown"
"""
resids = []
if self.dutinformations:
for info in self.dutinformations:
resids.append(info.resource_id)
return resids
... | python | def get_resource_ids(self):
"""
Get resource ids as a list.
:return: List of resource id:s or "unknown"
"""
resids = []
if self.dutinformations:
for info in self.dutinformations:
resids.append(info.resource_id)
return resids
... | [
"def",
"get_resource_ids",
"(",
"self",
")",
":",
"resids",
"=",
"[",
"]",
"if",
"self",
".",
"dutinformations",
":",
"for",
"info",
"in",
"self",
".",
"dutinformations",
":",
"resids",
".",
"append",
"(",
"info",
".",
"resource_id",
")",
"return",
"resi... | Get resource ids as a list.
:return: List of resource id:s or "unknown" | [
"Get",
"resource",
"ids",
"as",
"a",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/DutInformation.py#L133-L144 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/DutInformation.py | DutInformationList.push_resource_cache | def push_resource_cache(resourceid, info):
"""
Cache resource specific information
:param resourceid: Resource id as string
:param info: Dict to push
:return: Nothing
"""
if not resourceid:
raise ResourceInitError("Resource id missing")
if not... | python | def push_resource_cache(resourceid, info):
"""
Cache resource specific information
:param resourceid: Resource id as string
:param info: Dict to push
:return: Nothing
"""
if not resourceid:
raise ResourceInitError("Resource id missing")
if not... | [
"def",
"push_resource_cache",
"(",
"resourceid",
",",
"info",
")",
":",
"if",
"not",
"resourceid",
":",
"raise",
"ResourceInitError",
"(",
"\"Resource id missing\"",
")",
"if",
"not",
"DutInformationList",
".",
"_cache",
".",
"get",
"(",
"resourceid",
")",
":",
... | Cache resource specific information
:param resourceid: Resource id as string
:param info: Dict to push
:return: Nothing | [
"Cache",
"resource",
"specific",
"information"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/DutInformation.py#L164-L176 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/DutInformation.py | DutInformationList.get_resource_cache | def get_resource_cache(resourceid):
"""
Get a cached dictionary related to an individual resourceid.
:param resourceid: String resource id.
:return: dict
"""
if not resourceid:
raise ResourceInitError("Resource id missing")
if not DutInformationList._... | python | def get_resource_cache(resourceid):
"""
Get a cached dictionary related to an individual resourceid.
:param resourceid: String resource id.
:return: dict
"""
if not resourceid:
raise ResourceInitError("Resource id missing")
if not DutInformationList._... | [
"def",
"get_resource_cache",
"(",
"resourceid",
")",
":",
"if",
"not",
"resourceid",
":",
"raise",
"ResourceInitError",
"(",
"\"Resource id missing\"",
")",
"if",
"not",
"DutInformationList",
".",
"_cache",
".",
"get",
"(",
"resourceid",
")",
":",
"DutInformationL... | Get a cached dictionary related to an individual resourceid.
:param resourceid: String resource id.
:return: dict | [
"Get",
"a",
"cached",
"dictionary",
"related",
"to",
"an",
"individual",
"resourceid",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/DutInformation.py#L179-L190 | train |
ARMmbed/icetea | icetea_lib/cloud.py | create_result_object | def create_result_object(result):
"""
Create cloud result object from Result.
:param result: Result
:return: dictionary
"""
_result = {
'tcid': result.get_tc_name(),
'campaign': result.campaign,
'cre': {
'user': result.tester
},
'job': {
... | python | def create_result_object(result):
"""
Create cloud result object from Result.
:param result: Result
:return: dictionary
"""
_result = {
'tcid': result.get_tc_name(),
'campaign': result.campaign,
'cre': {
'user': result.tester
},
'job': {
... | [
"def",
"create_result_object",
"(",
"result",
")",
":",
"_result",
"=",
"{",
"'tcid'",
":",
"result",
".",
"get_tc_name",
"(",
")",
",",
"'campaign'",
":",
"result",
".",
"campaign",
",",
"'cre'",
":",
"{",
"'user'",
":",
"result",
".",
"tester",
"}",
... | Create cloud result object from Result.
:param result: Result
:return: dictionary | [
"Create",
"cloud",
"result",
"object",
"from",
"Result",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/cloud.py#L25-L80 | train |
ARMmbed/icetea | icetea_lib/cloud.py | append_logs_to_result_object | def append_logs_to_result_object(result_obj, result):
"""
Append log files to cloud result object from Result.
:param result_obj: Target result object
:param result: Result
:return: Nothing, modifies result_obj in place.
"""
logs = result.has_logs()
result_obj["exec"]["logs"] = []
i... | python | def append_logs_to_result_object(result_obj, result):
"""
Append log files to cloud result object from Result.
:param result_obj: Target result object
:param result: Result
:return: Nothing, modifies result_obj in place.
"""
logs = result.has_logs()
result_obj["exec"]["logs"] = []
i... | [
"def",
"append_logs_to_result_object",
"(",
"result_obj",
",",
"result",
")",
":",
"logs",
"=",
"result",
".",
"has_logs",
"(",
")",
"result_obj",
"[",
"\"exec\"",
"]",
"[",
"\"logs\"",
"]",
"=",
"[",
"]",
"if",
"logs",
"and",
"result",
".",
"logfiles",
... | Append log files to cloud result object from Result.
:param result_obj: Target result object
:param result: Result
:return: Nothing, modifies result_obj in place. | [
"Append",
"log",
"files",
"to",
"cloud",
"result",
"object",
"from",
"Result",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/cloud.py#L83-L112 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutDetection.py | DutDetection.get_available_devices | def get_available_devices(self):
"""
Gets available devices using mbedls and self.available_edbg_ports.
:return: List of connected devices as dictionaries.
"""
connected_devices = self.mbeds.list_mbeds() if self.mbeds else []
# Check non mbedOS supported devices.
... | python | def get_available_devices(self):
"""
Gets available devices using mbedls and self.available_edbg_ports.
:return: List of connected devices as dictionaries.
"""
connected_devices = self.mbeds.list_mbeds() if self.mbeds else []
# Check non mbedOS supported devices.
... | [
"def",
"get_available_devices",
"(",
"self",
")",
":",
"connected_devices",
"=",
"self",
".",
"mbeds",
".",
"list_mbeds",
"(",
")",
"if",
"self",
".",
"mbeds",
"else",
"[",
"]",
"edbg_ports",
"=",
"self",
".",
"available_edbg_ports",
"(",
")",
"for",
"port... | Gets available devices using mbedls and self.available_edbg_ports.
:return: List of connected devices as dictionaries. | [
"Gets",
"available",
"devices",
"using",
"mbedls",
"and",
"self",
".",
"available_edbg_ports",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutDetection.py#L58-L79 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutDetection.py | DutDetection.available_edbg_ports | def available_edbg_ports(self):
"""
Finds available EDBG COM ports.
:return: list of available ports
"""
ports_available = sorted(list(list_ports.comports()))
edbg_ports = []
for iport in ports_available:
port = iport[0]
desc = iport[1]
... | python | def available_edbg_ports(self):
"""
Finds available EDBG COM ports.
:return: list of available ports
"""
ports_available = sorted(list(list_ports.comports()))
edbg_ports = []
for iport in ports_available:
port = iport[0]
desc = iport[1]
... | [
"def",
"available_edbg_ports",
"(",
"self",
")",
":",
"ports_available",
"=",
"sorted",
"(",
"list",
"(",
"list_ports",
".",
"comports",
"(",
")",
")",
")",
"edbg_ports",
"=",
"[",
"]",
"for",
"iport",
"in",
"ports_available",
":",
"port",
"=",
"iport",
... | Finds available EDBG COM ports.
:return: list of available ports | [
"Finds",
"available",
"EDBG",
"COM",
"ports",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutDetection.py#L81-L102 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.store_traces | def store_traces(self, value):
"""
Setter for _store_traces. _store_traces controls in memory storing of received lines.
Also logs the change for the user.
:param value: Boolean
:return: Nothing
"""
if not value:
self.logger.debug("Stopping storing re... | python | def store_traces(self, value):
"""
Setter for _store_traces. _store_traces controls in memory storing of received lines.
Also logs the change for the user.
:param value: Boolean
:return: Nothing
"""
if not value:
self.logger.debug("Stopping storing re... | [
"def",
"store_traces",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Stopping storing received lines for dut %d\"",
",",
"self",
".",
"index",
")",
"self",
".",
"_store_traces",
"=",
"False",
"el... | Setter for _store_traces. _store_traces controls in memory storing of received lines.
Also logs the change for the user.
:param value: Boolean
:return: Nothing | [
"Setter",
"for",
"_store_traces",
".",
"_store_traces",
"controls",
"in",
"memory",
"storing",
"of",
"received",
"lines",
".",
"Also",
"logs",
"the",
"change",
"for",
"the",
"user",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L196-L209 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.init_wait_register | def init_wait_register(self):
"""
Initialize EventMatcher to wait for certain cli_ready_trigger to arrive from this Dut.
:return: None
"""
app = self.config.get("application")
if app:
bef_init_cmds = app.get("cli_ready_trigger")
if bef_init_cmds:... | python | def init_wait_register(self):
"""
Initialize EventMatcher to wait for certain cli_ready_trigger to arrive from this Dut.
:return: None
"""
app = self.config.get("application")
if app:
bef_init_cmds = app.get("cli_ready_trigger")
if bef_init_cmds:... | [
"def",
"init_wait_register",
"(",
"self",
")",
":",
"app",
"=",
"self",
".",
"config",
".",
"get",
"(",
"\"application\"",
")",
"if",
"app",
":",
"bef_init_cmds",
"=",
"app",
".",
"get",
"(",
"\"cli_ready_trigger\"",
")",
"if",
"bef_init_cmds",
":",
"self"... | Initialize EventMatcher to wait for certain cli_ready_trigger to arrive from this Dut.
:return: None | [
"Initialize",
"EventMatcher",
"to",
"wait",
"for",
"certain",
"cli_ready_trigger",
"to",
"arrive",
"from",
"this",
"Dut",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L362-L379 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.wait_init | def wait_init(self):
"""
Block until init_done flag is set or until init_wait_timeout happens.
:return: value of init_done
"""
init_done = self.init_done.wait(timeout=self.init_wait_timeout)
if not init_done:
if hasattr(self, "peek"):
app = se... | python | def wait_init(self):
"""
Block until init_done flag is set or until init_wait_timeout happens.
:return: value of init_done
"""
init_done = self.init_done.wait(timeout=self.init_wait_timeout)
if not init_done:
if hasattr(self, "peek"):
app = se... | [
"def",
"wait_init",
"(",
"self",
")",
":",
"init_done",
"=",
"self",
".",
"init_done",
".",
"wait",
"(",
"timeout",
"=",
"self",
".",
"init_wait_timeout",
")",
"if",
"not",
"init_done",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"peek\"",
")",
":",
"app... | Block until init_done flag is set or until init_wait_timeout happens.
:return: value of init_done | [
"Block",
"until",
"init_done",
"flag",
"is",
"set",
"or",
"until",
"init_wait_timeout",
"happens",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L381-L395 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.init_cli_human | def init_cli_human(self):
"""
Send post_cli_cmds to dut
:return: Nothing
"""
if self.post_cli_cmds is None:
self.post_cli_cmds = self.set_default_init_cli_human_cmds()
for cli_cmd in self.post_cli_cmds:
try:
if isinstance(cli_cmd, ... | python | def init_cli_human(self):
"""
Send post_cli_cmds to dut
:return: Nothing
"""
if self.post_cli_cmds is None:
self.post_cli_cmds = self.set_default_init_cli_human_cmds()
for cli_cmd in self.post_cli_cmds:
try:
if isinstance(cli_cmd, ... | [
"def",
"init_cli_human",
"(",
"self",
")",
":",
"if",
"self",
".",
"post_cli_cmds",
"is",
"None",
":",
"self",
".",
"post_cli_cmds",
"=",
"self",
".",
"set_default_init_cli_human_cmds",
"(",
")",
"for",
"cli_cmd",
"in",
"self",
".",
"post_cli_cmds",
":",
"tr... | Send post_cli_cmds to dut
:return: Nothing | [
"Send",
"post_cli_cmds",
"to",
"dut"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L397-L417 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.set_time_function | def set_time_function(self, function):
"""
Set time function to be used.
:param function: callable function
:return: Nothing
:raises: ValueError if function is not types.FunctionType.
"""
if isinstance(function, types.FunctionType):
self.get_time = fu... | python | def set_time_function(self, function):
"""
Set time function to be used.
:param function: callable function
:return: Nothing
:raises: ValueError if function is not types.FunctionType.
"""
if isinstance(function, types.FunctionType):
self.get_time = fu... | [
"def",
"set_time_function",
"(",
"self",
",",
"function",
")",
":",
"if",
"isinstance",
"(",
"function",
",",
"types",
".",
"FunctionType",
")",
":",
"self",
".",
"get_time",
"=",
"function",
"else",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for DUT ti... | Set time function to be used.
:param function: callable function
:return: Nothing
:raises: ValueError if function is not types.FunctionType. | [
"Set",
"time",
"function",
"to",
"be",
"used",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L419-L430 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.open_dut | def open_dut(self, port=None):
"""
Open connection to dut.
:param port: com port to use.
:return:
"""
if port is not None:
self.comport = port
try:
self.open_connection()
except (DutConnectionError, ValueError) as err:
... | python | def open_dut(self, port=None):
"""
Open connection to dut.
:param port: com port to use.
:return:
"""
if port is not None:
self.comport = port
try:
self.open_connection()
except (DutConnectionError, ValueError) as err:
... | [
"def",
"open_dut",
"(",
"self",
",",
"port",
"=",
"None",
")",
":",
"if",
"port",
"is",
"not",
"None",
":",
"self",
".",
"comport",
"=",
"port",
"try",
":",
"self",
".",
"open_connection",
"(",
")",
"except",
"(",
"DutConnectionError",
",",
"ValueError... | Open connection to dut.
:param port: com port to use.
:return: | [
"Open",
"connection",
"to",
"dut",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L432-L450 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut._wait_for_exec_ready | def _wait_for_exec_ready(self):
"""
Wait for response.
:return: CliResponse object coming in
:raises: TestStepTimeout, TestStepError
"""
while not self.response_received.wait(1) and self.query_timeout != 0:
if self.query_timeout != 0 and self.query_timeout < ... | python | def _wait_for_exec_ready(self):
"""
Wait for response.
:return: CliResponse object coming in
:raises: TestStepTimeout, TestStepError
"""
while not self.response_received.wait(1) and self.query_timeout != 0:
if self.query_timeout != 0 and self.query_timeout < ... | [
"def",
"_wait_for_exec_ready",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"response_received",
".",
"wait",
"(",
"1",
")",
"and",
"self",
".",
"query_timeout",
"!=",
"0",
":",
"if",
"self",
".",
"query_timeout",
"!=",
"0",
"and",
"self",
".",
... | Wait for response.
:return: CliResponse object coming in
:raises: TestStepTimeout, TestStepError | [
"Wait",
"for",
"response",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L460-L495 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.execute_command | def execute_command(self, req, **kwargs):
"""
Execute command and return CliResponse
:param req: String, command to be executed in DUT, or CliRequest, command class which
contains all configurations like timeout.
:param kwargs: Configurations (wait, timeout) which will be used w... | python | def execute_command(self, req, **kwargs):
"""
Execute command and return CliResponse
:param req: String, command to be executed in DUT, or CliRequest, command class which
contains all configurations like timeout.
:param kwargs: Configurations (wait, timeout) which will be used w... | [
"def",
"execute_command",
"(",
"self",
",",
"req",
",",
"**",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"req",
",",
"string_types",
")",
":",
"timeout",
"=",
"50",
"wait",
"=",
"True",
"asynchronous",
"=",
"False",
"for",
"key",
"in",
"kwargs",
":",... | Execute command and return CliResponse
:param req: String, command to be executed in DUT, or CliRequest, command class which
contains all configurations like timeout.
:param kwargs: Configurations (wait, timeout) which will be used when string mode is in use.
:return: CliResponse, which... | [
"Execute",
"command",
"and",
"return",
"CliResponse"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L497-L565 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.close_dut | def close_dut(self, use_prepare=True):
"""
Close connection to dut.
:param use_prepare: Boolean, default is True. Call prepare_connection_close before
closing connection.
:return: Nothing
"""
if not self.stopped:
self.logger.debug("Close '%s' connecti... | python | def close_dut(self, use_prepare=True):
"""
Close connection to dut.
:param use_prepare: Boolean, default is True. Call prepare_connection_close before
closing connection.
:return: Nothing
"""
if not self.stopped:
self.logger.debug("Close '%s' connecti... | [
"def",
"close_dut",
"(",
"self",
",",
"use_prepare",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"stopped",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Close '%s' connection\"",
"%",
"self",
".",
"dut_name",
",",
"extra",
"=",
"{",
"'type'",
... | Close connection to dut.
:param use_prepare: Boolean, default is True. Call prepare_connection_close before
closing connection.
:return: Nothing | [
"Close",
"connection",
"to",
"dut",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L567-L600 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.process_dut | def process_dut(dut):
"""
Signal worker thread that specified Dut needs processing
"""
if dut.finished():
return
Dut._signalled_duts.appendleft(dut)
Dut._sem.release() | python | def process_dut(dut):
"""
Signal worker thread that specified Dut needs processing
"""
if dut.finished():
return
Dut._signalled_duts.appendleft(dut)
Dut._sem.release() | [
"def",
"process_dut",
"(",
"dut",
")",
":",
"if",
"dut",
".",
"finished",
"(",
")",
":",
"return",
"Dut",
".",
"_signalled_duts",
".",
"appendleft",
"(",
"dut",
")",
"Dut",
".",
"_sem",
".",
"release",
"(",
")"
] | Signal worker thread that specified Dut needs processing | [
"Signal",
"worker",
"thread",
"that",
"specified",
"Dut",
"needs",
"processing"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L621-L628 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.run | def run(): # pylint: disable=too-many-branches
"""
Main thread runner for all Duts.
:return: Nothing
"""
Dut._logger.debug("Start DUT communication", extra={'type': '<->'})
while Dut._run:
Dut._sem.acquire()
try:
dut = Dut._signal... | python | def run(): # pylint: disable=too-many-branches
"""
Main thread runner for all Duts.
:return: Nothing
"""
Dut._logger.debug("Start DUT communication", extra={'type': '<->'})
while Dut._run:
Dut._sem.acquire()
try:
dut = Dut._signal... | [
"def",
"run",
"(",
")",
":",
"Dut",
".",
"_logger",
".",
"debug",
"(",
"\"Start DUT communication\"",
",",
"extra",
"=",
"{",
"'type'",
":",
"'<->'",
"}",
")",
"while",
"Dut",
".",
"_run",
":",
"Dut",
".",
"_sem",
".",
"acquire",
"(",
")",
"try",
"... | Main thread runner for all Duts.
:return: Nothing | [
"Main",
"thread",
"runner",
"for",
"all",
"Duts",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L632-L695 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut._read_response | def _read_response(self):
"""
Internal response reader.
:return: CliResponse or None
"""
try:
line = self.readline()
except RuntimeError:
Dut._logger.warning("Failed to read PIPE", extra={'type': '!<-'})
return -1
if line:
... | python | def _read_response(self):
"""
Internal response reader.
:return: CliResponse or None
"""
try:
line = self.readline()
except RuntimeError:
Dut._logger.warning("Failed to read PIPE", extra={'type': '!<-'})
return -1
if line:
... | [
"def",
"_read_response",
"(",
"self",
")",
":",
"try",
":",
"line",
"=",
"self",
".",
"readline",
"(",
")",
"except",
"RuntimeError",
":",
"Dut",
".",
"_logger",
".",
"warning",
"(",
"\"Failed to read PIPE\"",
",",
"extra",
"=",
"{",
"'type'",
":",
"'!<-... | Internal response reader.
:return: CliResponse or None | [
"Internal",
"response",
"reader",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L697-L727 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.check_retcode | def check_retcode(self, line):
"""
Look for retcode on line line and return return code if found.
:param line: Line to search from
:return: integer return code or -1 if "cmd tasklet init" is found. None if retcode or cmd
tasklet init not found.
"""
retcode = None... | python | def check_retcode(self, line):
"""
Look for retcode on line line and return return code if found.
:param line: Line to search from
:return: integer return code or -1 if "cmd tasklet init" is found. None if retcode or cmd
tasklet init not found.
"""
retcode = None... | [
"def",
"check_retcode",
"(",
"self",
",",
"line",
")",
":",
"retcode",
"=",
"None",
"match",
"=",
"re",
".",
"search",
"(",
"r\"retcode\\: ([-\\d]{1,})\"",
",",
"line",
")",
"if",
"match",
":",
"retcode",
"=",
"num",
"(",
"str",
"(",
"match",
".",
"gro... | Look for retcode on line line and return return code if found.
:param line: Line to search from
:return: integer return code or -1 if "cmd tasklet init" is found. None if retcode or cmd
tasklet init not found. | [
"Look",
"for",
"retcode",
"on",
"line",
"line",
"and",
"return",
"return",
"code",
"if",
"found",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L730-L747 | train |
ARMmbed/icetea | icetea_lib/DeviceConnectors/Dut.py | Dut.start_dut_thread | def start_dut_thread(self): # pylint: disable=no-self-use
"""
Start Dut thread.
:return: Nothing
"""
if Dut._th is None:
Dut._run = True
Dut._sem = Semaphore(0)
Dut._signalled_duts = deque()
Dut._logger = LogManager.get_bench_logg... | python | def start_dut_thread(self): # pylint: disable=no-self-use
"""
Start Dut thread.
:return: Nothing
"""
if Dut._th is None:
Dut._run = True
Dut._sem = Semaphore(0)
Dut._signalled_duts = deque()
Dut._logger = LogManager.get_bench_logg... | [
"def",
"start_dut_thread",
"(",
"self",
")",
":",
"if",
"Dut",
".",
"_th",
"is",
"None",
":",
"Dut",
".",
"_run",
"=",
"True",
"Dut",
".",
"_sem",
"=",
"Semaphore",
"(",
"0",
")",
"Dut",
".",
"_signalled_duts",
"=",
"deque",
"(",
")",
"Dut",
".",
... | Start Dut thread.
:return: Nothing | [
"Start",
"Dut",
"thread",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/DeviceConnectors/Dut.py#L757-L771 | train |
ARMmbed/icetea | icetea_lib/Events/EventMatcher.py | EventMatcher._event_received | def _event_received(self, ref, data):
"""
Handle received event.
:param ref: ref is the object that generated the event.
:param data: event data.
:return: Nothing.
"""
match = self._resolve_match_data(ref, data)
if match:
if self.flag_to_set:
... | python | def _event_received(self, ref, data):
"""
Handle received event.
:param ref: ref is the object that generated the event.
:param data: event data.
:return: Nothing.
"""
match = self._resolve_match_data(ref, data)
if match:
if self.flag_to_set:
... | [
"def",
"_event_received",
"(",
"self",
",",
"ref",
",",
"data",
")",
":",
"match",
"=",
"self",
".",
"_resolve_match_data",
"(",
"ref",
",",
"data",
")",
"if",
"match",
":",
"if",
"self",
".",
"flag_to_set",
":",
"self",
".",
"flag_to_set",
".",
"set",... | Handle received event.
:param ref: ref is the object that generated the event.
:param data: event data.
:return: Nothing. | [
"Handle",
"received",
"event",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Events/EventMatcher.py#L39-L54 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile.write_file | def write_file(self, content, filepath=None, filename=None, indent=None, keys_to_write=None):
'''
Write a Python dictionary as JSON to a file.
:param content: Dictionary of key-value pairs to save to a file
:param filepath: Path where the file is to be created
:param filename: N... | python | def write_file(self, content, filepath=None, filename=None, indent=None, keys_to_write=None):
'''
Write a Python dictionary as JSON to a file.
:param content: Dictionary of key-value pairs to save to a file
:param filepath: Path where the file is to be created
:param filename: N... | [
"def",
"write_file",
"(",
"self",
",",
"content",
",",
"filepath",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"indent",
"=",
"None",
",",
"keys_to_write",
"=",
"None",
")",
":",
"path",
"=",
"filepath",
"if",
"filepath",
"else",
"self",
".",
"file... | Write a Python dictionary as JSON to a file.
:param content: Dictionary of key-value pairs to save to a file
:param filepath: Path where the file is to be created
:param filename: Name of the file to be created
:param indent: You can use this to specify indent level for pretty printing ... | [
"Write",
"a",
"Python",
"dictionary",
"as",
"JSON",
"to",
"a",
"file",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L33-L73 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile.read_file | def read_file(self, filepath=None, filename=None):
"""
Tries to read JSON content from filename and convert it to a dict.
:param filepath: Path where the file is
:param filename: File name
:return: Dictionary read from the file
:raises EnvironmentError, ValueError
... | python | def read_file(self, filepath=None, filename=None):
"""
Tries to read JSON content from filename and convert it to a dict.
:param filepath: Path where the file is
:param filename: File name
:return: Dictionary read from the file
:raises EnvironmentError, ValueError
... | [
"def",
"read_file",
"(",
"self",
",",
"filepath",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"name",
"=",
"filename",
"if",
"filename",
"else",
"self",
".",
"filename",
"path",
"=",
"filepath",
"if",
"filepath",
"else",
"self",
".",
"filepath",... | Tries to read JSON content from filename and convert it to a dict.
:param filepath: Path where the file is
:param filename: File name
:return: Dictionary read from the file
:raises EnvironmentError, ValueError | [
"Tries",
"to",
"read",
"JSON",
"content",
"from",
"filename",
"and",
"convert",
"it",
"to",
"a",
"dict",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L75-L96 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile.read_value | def read_value(self, key, filepath=None, filename=None):
"""
Tries to read the value of given key from JSON file filename.
:param filepath: Path to file
:param filename: Name of file
:param key: Key to search for
:return: Value corresponding to given key
:raises ... | python | def read_value(self, key, filepath=None, filename=None):
"""
Tries to read the value of given key from JSON file filename.
:param filepath: Path to file
:param filename: Name of file
:param key: Key to search for
:return: Value corresponding to given key
:raises ... | [
"def",
"read_value",
"(",
"self",
",",
"key",
",",
"filepath",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"path",
"=",
"filepath",
"if",
"filepath",
"else",
"self",
".",
"filepath",
"name",
"=",
"filename",
"if",
"filename",
"else",
"self",
"... | Tries to read the value of given key from JSON file filename.
:param filepath: Path to file
:param filename: Name of file
:param key: Key to search for
:return: Value corresponding to given key
:raises OSError, EnvironmentError, KeyError | [
"Tries",
"to",
"read",
"the",
"value",
"of",
"given",
"key",
"from",
"JSON",
"file",
"filename",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L98-L121 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile.write_values | def write_values(self, data, filepath=None, filename=None, indent=None, keys_to_write=None):
"""
Tries to write extra content to a JSON file.
Creates filename.temp with updated content, removes the old file and
finally renames the .temp to match the old file.
This is in effort t... | python | def write_values(self, data, filepath=None, filename=None, indent=None, keys_to_write=None):
"""
Tries to write extra content to a JSON file.
Creates filename.temp with updated content, removes the old file and
finally renames the .temp to match the old file.
This is in effort t... | [
"def",
"write_values",
"(",
"self",
",",
"data",
",",
"filepath",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"indent",
"=",
"None",
",",
"keys_to_write",
"=",
"None",
")",
":",
"name",
"=",
"filename",
"if",
"filename",
"else",
"self",
".",
"filen... | Tries to write extra content to a JSON file.
Creates filename.temp with updated content, removes the old file and
finally renames the .temp to match the old file.
This is in effort to preserve the data in case of some weird errors cause problems.
:param filepath: Path to file
:... | [
"Tries",
"to",
"write",
"extra",
"content",
"to",
"a",
"JSON",
"file",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L123-L188 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile._write_json | def _write_json(self, filepath, filename, writemode, content, indent):
"""
Helper for writing content to a file.
:param filepath: path to file
:param filename: name of file
:param writemode: writemode used
:param content: content to write
:param indent: value for... | python | def _write_json(self, filepath, filename, writemode, content, indent):
"""
Helper for writing content to a file.
:param filepath: path to file
:param filename: name of file
:param writemode: writemode used
:param content: content to write
:param indent: value for... | [
"def",
"_write_json",
"(",
"self",
",",
"filepath",
",",
"filename",
",",
"writemode",
",",
"content",
",",
"indent",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"filepath",
",",
"filename",
")",
",",
"writemode",
")",
"as",
"... | Helper for writing content to a file.
:param filepath: path to file
:param filename: name of file
:param writemode: writemode used
:param content: content to write
:param indent: value for dump indent parameter.
:return: Norhing | [
"Helper",
"for",
"writing",
"content",
"to",
"a",
"file",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L190-L203 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile._read_json | def _read_json(self, path, name):
"""
Load a json into a dictionary from a file.
:param path: path to file
:param name: name of file
:return: dict
"""
with open(os.path.join(path, name), 'r') as fil:
output = json.load(fil)
self.logger.inf... | python | def _read_json(self, path, name):
"""
Load a json into a dictionary from a file.
:param path: path to file
:param name: name of file
:return: dict
"""
with open(os.path.join(path, name), 'r') as fil:
output = json.load(fil)
self.logger.inf... | [
"def",
"_read_json",
"(",
"self",
",",
"path",
",",
"name",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"name",
")",
",",
"'r'",
")",
"as",
"fil",
":",
"output",
"=",
"json",
".",
"load",
"(",
"fil",
")",
... | Load a json into a dictionary from a file.
:param path: path to file
:param name: name of file
:return: dict | [
"Load",
"a",
"json",
"into",
"a",
"dictionary",
"from",
"a",
"file",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L205-L216 | train |
ARMmbed/icetea | icetea_lib/tools/file/SessionFiles.py | JsonFile._ends_with | def _ends_with(self, string_to_edit, end): # pylint: disable=no-self-use
"""
Check if string ends with characters in end, if not merge end to string.
:param string_to_edit: string to check and edit.
:param end: str
:return: string_to_edit or string_to_edit + end
"""
... | python | def _ends_with(self, string_to_edit, end): # pylint: disable=no-self-use
"""
Check if string ends with characters in end, if not merge end to string.
:param string_to_edit: string to check and edit.
:param end: str
:return: string_to_edit or string_to_edit + end
"""
... | [
"def",
"_ends_with",
"(",
"self",
",",
"string_to_edit",
",",
"end",
")",
":",
"if",
"not",
"string_to_edit",
".",
"endswith",
"(",
"end",
")",
":",
"return",
"string_to_edit",
"+",
"end",
"return",
"string_to_edit"
] | Check if string ends with characters in end, if not merge end to string.
:param string_to_edit: string to check and edit.
:param end: str
:return: string_to_edit or string_to_edit + end | [
"Check",
"if",
"string",
"ends",
"with",
"characters",
"in",
"end",
"if",
"not",
"merge",
"end",
"to",
"string",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/SessionFiles.py#L218-L228 | train |
ARMmbed/icetea | icetea_lib/CliResponseParser.py | ParserManager.parse | def parse(self, *args, **kwargs): # pylint: disable=unused-argument
"""
Parse response.
:param args: List. 2 first items used as parser name and response to parse
:param kwargs: dict, not used
:return: dictionary or return value of called callable from parser.
"""
... | python | def parse(self, *args, **kwargs): # pylint: disable=unused-argument
"""
Parse response.
:param args: List. 2 first items used as parser name and response to parse
:param kwargs: dict, not used
:return: dictionary or return value of called callable from parser.
"""
... | [
"def",
"parse",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"cmd",
"=",
"args",
"[",
"0",
"]",
"resp",
"=",
"args",
"[",
"1",
"]",
"if",
"cmd",
"in",
"self",
".",
"parsers",
":",
"try",
":",
"return",
"self",
".",
"parsers",
... | Parse response.
:param args: List. 2 first items used as parser name and response to parse
:param kwargs: dict, not used
:return: dictionary or return value of called callable from parser. | [
"Parse",
"response",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/CliResponseParser.py#L54-L70 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.append | def append(self, result):
"""
Append a new Result to the list.
:param result: Result to append
:return: Nothing
:raises: TypeError if result is not Result or ResultList
"""
if isinstance(result, Result):
self.data.append(result)
elif isinstanc... | python | def append(self, result):
"""
Append a new Result to the list.
:param result: Result to append
:return: Nothing
:raises: TypeError if result is not Result or ResultList
"""
if isinstance(result, Result):
self.data.append(result)
elif isinstanc... | [
"def",
"append",
"(",
"self",
",",
"result",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
"Result",
")",
":",
"self",
".",
"data",
".",
"append",
"(",
"result",
")",
"elif",
"isinstance",
"(",
"result",
",",
"ResultList",
")",
":",
"self",
".",
... | Append a new Result to the list.
:param result: Result to append
:return: Nothing
:raises: TypeError if result is not Result or ResultList | [
"Append",
"a",
"new",
"Result",
"to",
"the",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L46-L59 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.save | def save(self, heads, console=True):
"""
Create reports in different formats.
:param heads: html table extra values in title rows
:param console: Boolean, default is True. If set, also print out the console log.
"""
# Junit
self._save_junit()
# HTML
... | python | def save(self, heads, console=True):
"""
Create reports in different formats.
:param heads: html table extra values in title rows
:param console: Boolean, default is True. If set, also print out the console log.
"""
# Junit
self._save_junit()
# HTML
... | [
"def",
"save",
"(",
"self",
",",
"heads",
",",
"console",
"=",
"True",
")",
":",
"self",
".",
"_save_junit",
"(",
")",
"self",
".",
"_save_html_report",
"(",
"heads",
")",
"if",
"console",
":",
"self",
".",
"_print_console_summary",
"(",
")"
] | Create reports in different formats.
:param heads: html table extra values in title rows
:param console: Boolean, default is True. If set, also print out the console log. | [
"Create",
"reports",
"in",
"different",
"formats",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L64-L77 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList._save_junit | def _save_junit(self):
"""
Save Junit report.
:return: Nothing
"""
report = ReportJunit(self)
file_name = report.get_latest_filename("result.junit.xml", "")
report.generate(file_name)
file_name = report.get_latest_filename("junit.xml", "../")
rep... | python | def _save_junit(self):
"""
Save Junit report.
:return: Nothing
"""
report = ReportJunit(self)
file_name = report.get_latest_filename("result.junit.xml", "")
report.generate(file_name)
file_name = report.get_latest_filename("junit.xml", "../")
rep... | [
"def",
"_save_junit",
"(",
"self",
")",
":",
"report",
"=",
"ReportJunit",
"(",
"self",
")",
"file_name",
"=",
"report",
".",
"get_latest_filename",
"(",
"\"result.junit.xml\"",
",",
"\"\"",
")",
"report",
".",
"generate",
"(",
"file_name",
")",
"file_name",
... | Save Junit report.
:return: Nothing | [
"Save",
"Junit",
"report",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L79-L90 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList._save_html_report | def _save_html_report(self, heads=None, refresh=None):
"""
Save html report.
:param heads: headers as dict
:param refresh: Boolean, if True will add a reload-tag to the report
:return: Nothing
"""
report = ReportHtml(self)
heads = heads if heads else {}
... | python | def _save_html_report(self, heads=None, refresh=None):
"""
Save html report.
:param heads: headers as dict
:param refresh: Boolean, if True will add a reload-tag to the report
:return: Nothing
"""
report = ReportHtml(self)
heads = heads if heads else {}
... | [
"def",
"_save_html_report",
"(",
"self",
",",
"heads",
"=",
"None",
",",
"refresh",
"=",
"None",
")",
":",
"report",
"=",
"ReportHtml",
"(",
"self",
")",
"heads",
"=",
"heads",
"if",
"heads",
"else",
"{",
"}",
"test_report_filename",
"=",
"report",
".",
... | Save html report.
:param heads: headers as dict
:param refresh: Boolean, if True will add a reload-tag to the report
:return: Nothing | [
"Save",
"html",
"report",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L92-L107 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.success_count | def success_count(self):
"""
Amount of passed test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.success]) | python | def success_count(self):
"""
Amount of passed test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.success]) | [
"def",
"success_count",
"(",
"self",
")",
":",
"return",
"len",
"(",
"[",
"i",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
"if",
"result",
".",
"success",
"]",
")"
] | Amount of passed test cases in this list.
:return: integer | [
"Amount",
"of",
"passed",
"test",
"cases",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L117-L123 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.failure_count | def failure_count(self):
"""
Amount of failed test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.failure]) | python | def failure_count(self):
"""
Amount of failed test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.failure]) | [
"def",
"failure_count",
"(",
"self",
")",
":",
"return",
"len",
"(",
"[",
"i",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
"if",
"result",
".",
"failure",
"]",
")"
] | Amount of failed test cases in this list.
:return: integer | [
"Amount",
"of",
"failed",
"test",
"cases",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L125-L131 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.inconclusive_count | def inconclusive_count(self):
"""
Amount of inconclusive test cases in this list.
:return: integer
"""
inconc_count = len([i for i, result in enumerate(self.data) if result.inconclusive])
unknown_count = len([i for i, result in enumerate(self.data) if result.get_verdict(... | python | def inconclusive_count(self):
"""
Amount of inconclusive test cases in this list.
:return: integer
"""
inconc_count = len([i for i, result in enumerate(self.data) if result.inconclusive])
unknown_count = len([i for i, result in enumerate(self.data) if result.get_verdict(... | [
"def",
"inconclusive_count",
"(",
"self",
")",
":",
"inconc_count",
"=",
"len",
"(",
"[",
"i",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
"if",
"result",
".",
"inconclusive",
"]",
")",
"unknown_count",
"=",
"len",
"(",... | Amount of inconclusive test cases in this list.
:return: integer | [
"Amount",
"of",
"inconclusive",
"test",
"cases",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L133-L142 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.retry_count | def retry_count(self):
"""
Amount of retried test cases in this list.
:return: integer
"""
retries = len([i for i, result in enumerate(self.data) if result.retries_left > 0])
return retries | python | def retry_count(self):
"""
Amount of retried test cases in this list.
:return: integer
"""
retries = len([i for i, result in enumerate(self.data) if result.retries_left > 0])
return retries | [
"def",
"retry_count",
"(",
"self",
")",
":",
"retries",
"=",
"len",
"(",
"[",
"i",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
"if",
"result",
".",
"retries_left",
">",
"0",
"]",
")",
"return",
"retries"
] | Amount of retried test cases in this list.
:return: integer | [
"Amount",
"of",
"retried",
"test",
"cases",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L144-L151 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.skip_count | def skip_count(self):
"""
Amount of skipped test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.skip]) | python | def skip_count(self):
"""
Amount of skipped test cases in this list.
:return: integer
"""
return len([i for i, result in enumerate(self.data) if result.skip]) | [
"def",
"skip_count",
"(",
"self",
")",
":",
"return",
"len",
"(",
"[",
"i",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
"if",
"result",
".",
"skip",
"]",
")"
] | Amount of skipped test cases in this list.
:return: integer | [
"Amount",
"of",
"skipped",
"test",
"cases",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L153-L159 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.clean_fails | def clean_fails(self):
"""
Check if there are any fails that were not subsequently retried.
:return: Boolean
"""
for item in self.data:
if item.failure and not item.retries_left > 0:
return True
return False | python | def clean_fails(self):
"""
Check if there are any fails that were not subsequently retried.
:return: Boolean
"""
for item in self.data:
if item.failure and not item.retries_left > 0:
return True
return False | [
"def",
"clean_fails",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"data",
":",
"if",
"item",
".",
"failure",
"and",
"not",
"item",
".",
"retries_left",
">",
"0",
":",
"return",
"True",
"return",
"False"
] | Check if there are any fails that were not subsequently retried.
:return: Boolean | [
"Check",
"if",
"there",
"are",
"any",
"fails",
"that",
"were",
"not",
"subsequently",
"retried",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L161-L170 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.clean_inconcs | def clean_inconcs(self):
"""
Check if there are any inconclusives or uknowns that were not subsequently retried.
:return: Boolean
"""
for item in self.data:
if (item.inconclusive or item.get_verdict() == "unknown") and not item.retries_left > 0:
retur... | python | def clean_inconcs(self):
"""
Check if there are any inconclusives or uknowns that were not subsequently retried.
:return: Boolean
"""
for item in self.data:
if (item.inconclusive or item.get_verdict() == "unknown") and not item.retries_left > 0:
retur... | [
"def",
"clean_inconcs",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"data",
":",
"if",
"(",
"item",
".",
"inconclusive",
"or",
"item",
".",
"get_verdict",
"(",
")",
"==",
"\"unknown\"",
")",
"and",
"not",
"item",
".",
"retries_left",
">",
... | Check if there are any inconclusives or uknowns that were not subsequently retried.
:return: Boolean | [
"Check",
"if",
"there",
"are",
"any",
"inconclusives",
"or",
"uknowns",
"that",
"were",
"not",
"subsequently",
"retried",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L172-L181 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.total_duration | def total_duration(self):
"""
Sum of the durations of the tests in this list.
:return: integer
"""
durations = [result.duration for result in self.data]
return sum(durations) | python | def total_duration(self):
"""
Sum of the durations of the tests in this list.
:return: integer
"""
durations = [result.duration for result in self.data]
return sum(durations) | [
"def",
"total_duration",
"(",
"self",
")",
":",
"durations",
"=",
"[",
"result",
".",
"duration",
"for",
"result",
"in",
"self",
".",
"data",
"]",
"return",
"sum",
"(",
"durations",
")"
] | Sum of the durations of the tests in this list.
:return: integer | [
"Sum",
"of",
"the",
"durations",
"of",
"the",
"tests",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L236-L243 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.pass_rate | def pass_rate(self, include_skips=False, include_inconclusive=False, include_retries=True):
"""
Calculate pass rate for tests in this list.
:param include_skips: Boolean, if True skipped tc:s will be included. Default is False
:param include_inconclusive: Boolean, if True inconclusive t... | python | def pass_rate(self, include_skips=False, include_inconclusive=False, include_retries=True):
"""
Calculate pass rate for tests in this list.
:param include_skips: Boolean, if True skipped tc:s will be included. Default is False
:param include_inconclusive: Boolean, if True inconclusive t... | [
"def",
"pass_rate",
"(",
"self",
",",
"include_skips",
"=",
"False",
",",
"include_inconclusive",
"=",
"False",
",",
"include_retries",
"=",
"True",
")",
":",
"total",
"=",
"self",
".",
"count",
"(",
")",
"success",
"=",
"self",
".",
"success_count",
"(",
... | Calculate pass rate for tests in this list.
:param include_skips: Boolean, if True skipped tc:s will be included. Default is False
:param include_inconclusive: Boolean, if True inconclusive tc:s will be included.
Default is False.
:param include_retries: Boolean, if True retried tc:s wi... | [
"Calculate",
"pass",
"rate",
"for",
"tests",
"in",
"this",
"list",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L245-L283 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.get_summary | def get_summary(self):
"""
Get a summary of this ResultLists contents as dictionary.
:return: dictionary
"""
return {
"count": self.count(),
"pass": self.success_count(),
"fail": self.failure_count(),
"skip": self.skip_count(),
... | python | def get_summary(self):
"""
Get a summary of this ResultLists contents as dictionary.
:return: dictionary
"""
return {
"count": self.count(),
"pass": self.success_count(),
"fail": self.failure_count(),
"skip": self.skip_count(),
... | [
"def",
"get_summary",
"(",
"self",
")",
":",
"return",
"{",
"\"count\"",
":",
"self",
".",
"count",
"(",
")",
",",
"\"pass\"",
":",
"self",
".",
"success_count",
"(",
")",
",",
"\"fail\"",
":",
"self",
".",
"failure_count",
"(",
")",
",",
"\"skip\"",
... | Get a summary of this ResultLists contents as dictionary.
:return: dictionary | [
"Get",
"a",
"summary",
"of",
"this",
"ResultLists",
"contents",
"as",
"dictionary",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L285-L299 | train |
ARMmbed/icetea | icetea_lib/ResultList.py | ResultList.next | def next(self):
"""
Implementation of next method from Iterator.
:return: Result
:raises: StopIteration if IndexError occurs.
"""
try:
result = self.data[self.index]
except IndexError:
self.index = 0
raise StopIteration
... | python | def next(self):
"""
Implementation of next method from Iterator.
:return: Result
:raises: StopIteration if IndexError occurs.
"""
try:
result = self.data[self.index]
except IndexError:
self.index = 0
raise StopIteration
... | [
"def",
"next",
"(",
"self",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"data",
"[",
"self",
".",
"index",
"]",
"except",
"IndexError",
":",
"self",
".",
"index",
"=",
"0",
"raise",
"StopIteration",
"self",
".",
"index",
"+=",
"1",
"return",
... | Implementation of next method from Iterator.
:return: Result
:raises: StopIteration if IndexError occurs. | [
"Implementation",
"of",
"next",
"method",
"from",
"Iterator",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResultList.py#L325-L338 | train |
ARMmbed/icetea | icetea_lib/tools/deprecated.py | deprecated | def deprecated(message=""):
"""
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used first time and filter is set for show DeprecationWarning.
"""
def decorator_wrapper(func):
"""
Generate decor... | python | def deprecated(message=""):
"""
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used first time and filter is set for show DeprecationWarning.
"""
def decorator_wrapper(func):
"""
Generate decor... | [
"def",
"deprecated",
"(",
"message",
"=",
"\"\"",
")",
":",
"def",
"decorator_wrapper",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"function_wrapper",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"current_call_sou... | This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used first time and filter is set for show DeprecationWarning. | [
"This",
"is",
"a",
"decorator",
"which",
"can",
"be",
"used",
"to",
"mark",
"functions",
"as",
"deprecated",
".",
"It",
"will",
"result",
"in",
"a",
"warning",
"being",
"emitted",
"when",
"the",
"function",
"is",
"used",
"first",
"time",
"and",
"filter",
... | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/deprecated.py#L24-L55 | train |
ARMmbed/icetea | icetea_lib/tools/file/FileUtils.py | remove_file | def remove_file(filename, path=None):
"""
Remove file filename from path.
:param filename: Name of file to remove
:param path: Path where file is located
:return: True if successfull
:raises OSError if chdir or remove fails.
"""
cwd = os.getcwd()
try:
if path:
os... | python | def remove_file(filename, path=None):
"""
Remove file filename from path.
:param filename: Name of file to remove
:param path: Path where file is located
:return: True if successfull
:raises OSError if chdir or remove fails.
"""
cwd = os.getcwd()
try:
if path:
os... | [
"def",
"remove_file",
"(",
"filename",
",",
"path",
"=",
"None",
")",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"try",
":",
"if",
"path",
":",
"os",
".",
"chdir",
"(",
"path",
")",
"except",
"OSError",
":",
"raise",
"try",
":",
"os",
".",
... | Remove file filename from path.
:param filename: Name of file to remove
:param path: Path where file is located
:return: True if successfull
:raises OSError if chdir or remove fails. | [
"Remove",
"file",
"filename",
"from",
"path",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/file/FileUtils.py#L55-L76 | train |
ARMmbed/icetea | icetea_lib/CliResponse.py | CliResponse.verify_message | def verify_message(self, expected_response, break_in_fail=True):
"""
Verifies that expected_response is found in self.lines.
:param expected_response: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True,
re-raises exceptions caught or if ... | python | def verify_message(self, expected_response, break_in_fail=True):
"""
Verifies that expected_response is found in self.lines.
:param expected_response: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True,
re-raises exceptions caught or if ... | [
"def",
"verify_message",
"(",
"self",
",",
"expected_response",
",",
"break_in_fail",
"=",
"True",
")",
":",
"ok",
"=",
"True",
"try",
":",
"ok",
"=",
"verify_message",
"(",
"self",
".",
"lines",
",",
"expected_response",
")",
"except",
"(",
"TypeError",
"... | Verifies that expected_response is found in self.lines.
:param expected_response: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True,
re-raises exceptions caught or if message was not found
:return: True or False
:raises: LookupError if ... | [
"Verifies",
"that",
"expected_response",
"is",
"found",
"in",
"self",
".",
"lines",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/CliResponse.py#L68-L88 | train |
ARMmbed/icetea | icetea_lib/CliResponse.py | CliResponse.verify_trace | def verify_trace(self, expected_traces, break_in_fail=True):
"""
Verifies that expectedResponse is found in self.traces
:param expected_traces: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True, re-raises exceptions caught or if message was
... | python | def verify_trace(self, expected_traces, break_in_fail=True):
"""
Verifies that expectedResponse is found in self.traces
:param expected_traces: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True, re-raises exceptions caught or if message was
... | [
"def",
"verify_trace",
"(",
"self",
",",
"expected_traces",
",",
"break_in_fail",
"=",
"True",
")",
":",
"ok",
"=",
"True",
"try",
":",
"ok",
"=",
"verify_message",
"(",
"self",
".",
"traces",
",",
"expected_traces",
")",
"except",
"(",
"TypeError",
",",
... | Verifies that expectedResponse is found in self.traces
:param expected_traces: response or responses to look for. Must be list or str.
:param break_in_fail: If set to True, re-raises exceptions caught or if message was
not found
:return: True or False
:raises: LookupError if mes... | [
"Verifies",
"that",
"expectedResponse",
"is",
"found",
"in",
"self",
".",
"traces"
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/CliResponse.py#L90-L110 | train |
ARMmbed/icetea | icetea_lib/CliResponse.py | CliResponse.verify_response_duration | def verify_response_duration(self, expected=None, zero=0, threshold_percent=0,
break_in_fail=True):
"""
Verify that response duration is in bounds.
:param expected: seconds what is expected duration
:param zero: seconds if one to normalize duration befor... | python | def verify_response_duration(self, expected=None, zero=0, threshold_percent=0,
break_in_fail=True):
"""
Verify that response duration is in bounds.
:param expected: seconds what is expected duration
:param zero: seconds if one to normalize duration befor... | [
"def",
"verify_response_duration",
"(",
"self",
",",
"expected",
"=",
"None",
",",
"zero",
"=",
"0",
",",
"threshold_percent",
"=",
"0",
",",
"break_in_fail",
"=",
"True",
")",
":",
"was",
"=",
"self",
".",
"timedelta",
"-",
"zero",
"error",
"=",
"abs",
... | Verify that response duration is in bounds.
:param expected: seconds what is expected duration
:param zero: seconds if one to normalize duration before calculating error rate
:param threshold_percent: allowed error in percents
:param break_in_fail: boolean, True if raise TestStepFail wh... | [
"Verify",
"that",
"response",
"duration",
"is",
"in",
"bounds",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/CliResponse.py#L121-L142 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._hardware_count | def _hardware_count(self):
"""
Amount of hardware resources.
:return: integer
"""
return self._counts.get("hardware") + self._counts.get("serial") + self._counts.get("mbed") | python | def _hardware_count(self):
"""
Amount of hardware resources.
:return: integer
"""
return self._counts.get("hardware") + self._counts.get("serial") + self._counts.get("mbed") | [
"def",
"_hardware_count",
"(",
"self",
")",
":",
"return",
"self",
".",
"_counts",
".",
"get",
"(",
"\"hardware\"",
")",
"+",
"self",
".",
"_counts",
".",
"get",
"(",
"\"serial\"",
")",
"+",
"self",
".",
"_counts",
".",
"get",
"(",
"\"mbed\"",
")"
] | Amount of hardware resources.
:return: integer | [
"Amount",
"of",
"hardware",
"resources",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L41-L47 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._resolve_requirements | def _resolve_requirements(self, requirements):
"""
Internal method for resolving requirements into resource configurations.
:param requirements: Resource requirements from test case configuration as dictionary.
:return: Empty list if dut_count cannot be resolved, or nothing
"""
... | python | def _resolve_requirements(self, requirements):
"""
Internal method for resolving requirements into resource configurations.
:param requirements: Resource requirements from test case configuration as dictionary.
:return: Empty list if dut_count cannot be resolved, or nothing
"""
... | [
"def",
"_resolve_requirements",
"(",
"self",
",",
"requirements",
")",
":",
"try",
":",
"dut_count",
"=",
"requirements",
"[",
"\"duts\"",
"]",
"[",
"\"*\"",
"]",
"[",
"\"count\"",
"]",
"except",
"KeyError",
":",
"return",
"[",
"]",
"default_values",
"=",
... | Internal method for resolving requirements into resource configurations.
:param requirements: Resource requirements from test case configuration as dictionary.
:return: Empty list if dut_count cannot be resolved, or nothing | [
"Internal",
"method",
"for",
"resolving",
"requirements",
"into",
"resource",
"configurations",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L109-L158 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._solve_location | def _solve_location(self, req, dut_req_len, idx):
"""
Helper function for resolving the location for a resource.
:param req: Requirements dictionary
:param dut_req_len: Amount of required resources
:param idx: index, integer
:return: Nothing, modifies req object
... | python | def _solve_location(self, req, dut_req_len, idx):
"""
Helper function for resolving the location for a resource.
:param req: Requirements dictionary
:param dut_req_len: Amount of required resources
:param idx: index, integer
:return: Nothing, modifies req object
... | [
"def",
"_solve_location",
"(",
"self",
",",
"req",
",",
"dut_req_len",
",",
"idx",
")",
":",
"if",
"not",
"req",
".",
"get",
"(",
"\"location\"",
")",
":",
"return",
"if",
"len",
"(",
"req",
".",
"get",
"(",
"\"location\"",
")",
")",
"==",
"2",
":"... | Helper function for resolving the location for a resource.
:param req: Requirements dictionary
:param dut_req_len: Amount of required resources
:param idx: index, integer
:return: Nothing, modifies req object | [
"Helper",
"function",
"for",
"resolving",
"the",
"location",
"for",
"a",
"resource",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L160-L190 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig.__replace_base_variables | def __replace_base_variables(text, req_len, idx):
"""
Replace i and n in text with index+1 and req_len.
:param text: base text to modify
:param req_len: amount of required resources
:param idx: index of resource we are working on
:return: modified string
"""
... | python | def __replace_base_variables(text, req_len, idx):
"""
Replace i and n in text with index+1 and req_len.
:param text: base text to modify
:param req_len: amount of required resources
:param idx: index of resource we are working on
:return: modified string
"""
... | [
"def",
"__replace_base_variables",
"(",
"text",
",",
"req_len",
",",
"idx",
")",
":",
"return",
"text",
".",
"replace",
"(",
"\"{i}\"",
",",
"str",
"(",
"idx",
"+",
"1",
")",
")",
".",
"replace",
"(",
"\"{n}\"",
",",
"str",
"(",
"req_len",
")",
")"
] | Replace i and n in text with index+1 and req_len.
:param text: base text to modify
:param req_len: amount of required resources
:param idx: index of resource we are working on
:return: modified string | [
"Replace",
"i",
"and",
"n",
"in",
"text",
"with",
"index",
"+",
"1",
"and",
"req_len",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L193-L204 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig.__replace_coord_variables | def __replace_coord_variables(text, x_and_y, req_len, idx):
"""
Replace x and y with their coordinates and replace pi with value of pi.
:param text: text: base text to modify
:param x_and_y: location x and y
:param req_len: amount of required resources
:param idx: index ... | python | def __replace_coord_variables(text, x_and_y, req_len, idx):
"""
Replace x and y with their coordinates and replace pi with value of pi.
:param text: text: base text to modify
:param x_and_y: location x and y
:param req_len: amount of required resources
:param idx: index ... | [
"def",
"__replace_coord_variables",
"(",
"text",
",",
"x_and_y",
",",
"req_len",
",",
"idx",
")",
":",
"return",
"ResourceConfig",
".",
"__replace_base_variables",
"(",
"text",
",",
"req_len",
",",
"idx",
")",
".",
"replace",
"(",
"\"{xy}\"",
",",
"str",
"("... | Replace x and y with their coordinates and replace pi with value of pi.
:param text: text: base text to modify
:param x_and_y: location x and y
:param req_len: amount of required resources
:param idx: index of resource we are working on
:return: str | [
"Replace",
"x",
"and",
"y",
"with",
"their",
"coordinates",
"and",
"replace",
"pi",
"with",
"value",
"of",
"pi",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L207-L219 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig.__generate_indexed_requirements | def __generate_indexed_requirements(dut_count, basekeys, requirements):
"""
Generate indexed requirements from general requirements.
:param dut_count: Amount of duts
:param basekeys: base keys as dict
:param requirements: requirements
:return: Indexed requirements as dic... | python | def __generate_indexed_requirements(dut_count, basekeys, requirements):
"""
Generate indexed requirements from general requirements.
:param dut_count: Amount of duts
:param basekeys: base keys as dict
:param requirements: requirements
:return: Indexed requirements as dic... | [
"def",
"__generate_indexed_requirements",
"(",
"dut_count",
",",
"basekeys",
",",
"requirements",
")",
":",
"dut_requirements",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"dut_count",
"+",
"1",
")",
":",
"dut_requirement",
"=",
"ResourceRequireme... | Generate indexed requirements from general requirements.
:param dut_count: Amount of duts
:param basekeys: base keys as dict
:param requirements: requirements
:return: Indexed requirements as dict. | [
"Generate",
"indexed",
"requirements",
"from",
"general",
"requirements",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L222-L242 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._resolve_hardware_count | def _resolve_hardware_count(self):
"""
Calculate amount of hardware resources.
:return: Nothing, adds results to self._hardware_count
"""
length = len([d for d in self._dut_requirements if d.get("type") in ["hardware",
... | python | def _resolve_hardware_count(self):
"""
Calculate amount of hardware resources.
:return: Nothing, adds results to self._hardware_count
"""
length = len([d for d in self._dut_requirements if d.get("type") in ["hardware",
... | [
"def",
"_resolve_hardware_count",
"(",
"self",
")",
":",
"length",
"=",
"len",
"(",
"[",
"d",
"for",
"d",
"in",
"self",
".",
"_dut_requirements",
"if",
"d",
".",
"get",
"(",
"\"type\"",
")",
"in",
"[",
"\"hardware\"",
",",
"\"serial\"",
",",
"\"mbed\"",
... | Calculate amount of hardware resources.
:return: Nothing, adds results to self._hardware_count | [
"Calculate",
"amount",
"of",
"hardware",
"resources",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L258-L266 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._resolve_process_count | def _resolve_process_count(self):
"""
Calculate amount of process resources.
:return: Nothing, adds results to self._process_count
"""
length = len([d for d in self._dut_requirements if d.get("type") == "process"])
self._process_count = length | python | def _resolve_process_count(self):
"""
Calculate amount of process resources.
:return: Nothing, adds results to self._process_count
"""
length = len([d for d in self._dut_requirements if d.get("type") == "process"])
self._process_count = length | [
"def",
"_resolve_process_count",
"(",
"self",
")",
":",
"length",
"=",
"len",
"(",
"[",
"d",
"for",
"d",
"in",
"self",
".",
"_dut_requirements",
"if",
"d",
".",
"get",
"(",
"\"type\"",
")",
"==",
"\"process\"",
"]",
")",
"self",
".",
"_process_count",
... | Calculate amount of process resources.
:return: Nothing, adds results to self._process_count | [
"Calculate",
"amount",
"of",
"process",
"resources",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L274-L281 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig._resolve_dut_count | def _resolve_dut_count(self):
"""
Calculates total amount of resources required and their types.
:return: Nothing, modifies _dut_count, _hardware_count and
_process_count
:raises: ValueError if total count does not match counts of types separately.
"""
self._dut_... | python | def _resolve_dut_count(self):
"""
Calculates total amount of resources required and their types.
:return: Nothing, modifies _dut_count, _hardware_count and
_process_count
:raises: ValueError if total count does not match counts of types separately.
"""
self._dut_... | [
"def",
"_resolve_dut_count",
"(",
"self",
")",
":",
"self",
".",
"_dut_count",
"=",
"len",
"(",
"self",
".",
"_dut_requirements",
")",
"self",
".",
"_resolve_process_count",
"(",
")",
"self",
".",
"_resolve_hardware_count",
"(",
")",
"if",
"self",
".",
"_dut... | Calculates total amount of resources required and their types.
:return: Nothing, modifies _dut_count, _hardware_count and
_process_count
:raises: ValueError if total count does not match counts of types separately. | [
"Calculates",
"total",
"amount",
"of",
"resources",
"required",
"and",
"their",
"types",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L289-L301 | train |
ARMmbed/icetea | icetea_lib/ResourceProvider/ResourceConfig.py | ResourceConfig.set_dut_configuration | def set_dut_configuration(self, ident, config):
"""
Set requirements for dut ident.
:param ident: Identity of dut.
:param config: If ResourceRequirements object, add object as requirements for resource
ident. If dictionary, create new ResourceRequirements object from dictionary.... | python | def set_dut_configuration(self, ident, config):
"""
Set requirements for dut ident.
:param ident: Identity of dut.
:param config: If ResourceRequirements object, add object as requirements for resource
ident. If dictionary, create new ResourceRequirements object from dictionary.... | [
"def",
"set_dut_configuration",
"(",
"self",
",",
"ident",
",",
"config",
")",
":",
"if",
"hasattr",
"(",
"config",
",",
"\"get_requirements\"",
")",
":",
"self",
".",
"_dut_requirements",
"[",
"ident",
"]",
"=",
"config",
"elif",
"isinstance",
"(",
"config"... | Set requirements for dut ident.
:param ident: Identity of dut.
:param config: If ResourceRequirements object, add object as requirements for resource
ident. If dictionary, create new ResourceRequirements object from dictionary.
:return: Nothing | [
"Set",
"requirements",
"for",
"dut",
"ident",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/ResourceProvider/ResourceConfig.py#L313-L325 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutMbed.py | DutMbed.flash | def flash(self, binary_location=None, forceflash=None):
"""
Flash a binary to the target device using mbed-flasher.
:param binary_location: Binary to flash to device.
:param forceflash: Not used.
:return: False if an unknown error was encountered during flashing.
True if... | python | def flash(self, binary_location=None, forceflash=None):
"""
Flash a binary to the target device using mbed-flasher.
:param binary_location: Binary to flash to device.
:param forceflash: Not used.
:return: False if an unknown error was encountered during flashing.
True if... | [
"def",
"flash",
"(",
"self",
",",
"binary_location",
"=",
"None",
",",
"forceflash",
"=",
"None",
")",
":",
"if",
"not",
"Flash",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"Mbed-flasher not installed!\"",
")",
"raise",
"ImportError",
"(",
"\"Mbed-flas... | Flash a binary to the target device using mbed-flasher.
:param binary_location: Binary to flash to device.
:param forceflash: Not used.
:return: False if an unknown error was encountered during flashing.
True if flasher retcode == 0
:raises: ImportError if mbed-flasher not insta... | [
"Flash",
"a",
"binary",
"to",
"the",
"target",
"device",
"using",
"mbed",
"-",
"flasher",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutMbed.py#L59-L117 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutMbed.py | DutMbed._flash_needed | def _flash_needed(self, **kwargs):
"""
Check if flashing is needed. Flashing can be skipped if resource binary_sha1 attribute
matches build sha1 and forceflash is not True.
:param kwargs: Keyword arguments (forceflash: Boolean)
:return: Boolean
"""
forceflash = k... | python | def _flash_needed(self, **kwargs):
"""
Check if flashing is needed. Flashing can be skipped if resource binary_sha1 attribute
matches build sha1 and forceflash is not True.
:param kwargs: Keyword arguments (forceflash: Boolean)
:return: Boolean
"""
forceflash = k... | [
"def",
"_flash_needed",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"forceflash",
"=",
"kwargs",
".",
"get",
"(",
"\"forceflash\"",
",",
"False",
")",
"cur_binary_sha1",
"=",
"self",
".",
"dutinformation",
".",
"build_binary_sha1",
"if",
"not",
"forceflash",
... | Check if flashing is needed. Flashing can be skipped if resource binary_sha1 attribute
matches build sha1 and forceflash is not True.
:param kwargs: Keyword arguments (forceflash: Boolean)
:return: Boolean | [
"Check",
"if",
"flashing",
"is",
"needed",
".",
"Flashing",
"can",
"be",
"skipped",
"if",
"resource",
"binary_sha1",
"attribute",
"matches",
"build",
"sha1",
"and",
"forceflash",
"is",
"not",
"True",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutMbed.py#L119-L131 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | SerialParams.get_params | def get_params(self):
"""
Get parameters as a tuple.
:return: timeout, xonxoff, rtscts, baudrate
"""
return self.timeout, self.xonxoff, self.rtscts, self.baudrate | python | def get_params(self):
"""
Get parameters as a tuple.
:return: timeout, xonxoff, rtscts, baudrate
"""
return self.timeout, self.xonxoff, self.rtscts, self.baudrate | [
"def",
"get_params",
"(",
"self",
")",
":",
"return",
"self",
".",
"timeout",
",",
"self",
".",
"xonxoff",
",",
"self",
".",
"rtscts",
",",
"self",
".",
"baudrate"
] | Get parameters as a tuple.
:return: timeout, xonxoff, rtscts, baudrate | [
"Get",
"parameters",
"as",
"a",
"tuple",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L46-L52 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.open_connection | def open_connection(self):
"""
Open serial port connection.
:return: Nothing
:raises: DutConnectionError if serial port was already open or a SerialException occurs.
ValueError if EnhancedSerial __init__ or value setters raise ValueError
"""
if self.readthread is... | python | def open_connection(self):
"""
Open serial port connection.
:return: Nothing
:raises: DutConnectionError if serial port was already open or a SerialException occurs.
ValueError if EnhancedSerial __init__ or value setters raise ValueError
"""
if self.readthread is... | [
"def",
"open_connection",
"(",
"self",
")",
":",
"if",
"self",
".",
"readthread",
"is",
"not",
"None",
":",
"raise",
"DutConnectionError",
"(",
"\"Trying to open serial port which was already open\"",
")",
"self",
".",
"logger",
".",
"info",
"(",
"\"Open Connection ... | Open serial port connection.
:return: Nothing
:raises: DutConnectionError if serial port was already open or a SerialException occurs.
ValueError if EnhancedSerial __init__ or value setters raise ValueError | [
"Open",
"serial",
"port",
"connection",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L246-L292 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.close_connection | def close_connection(self): # pylint: disable=C0103
"""
Closes serial port connection.
:return: Nothing
"""
if self.port:
self.stop()
self.logger.debug("Close port '%s'" % self.comport,
extra={'type': '<->'})
sel... | python | def close_connection(self): # pylint: disable=C0103
"""
Closes serial port connection.
:return: Nothing
"""
if self.port:
self.stop()
self.logger.debug("Close port '%s'" % self.comport,
extra={'type': '<->'})
sel... | [
"def",
"close_connection",
"(",
"self",
")",
":",
"if",
"self",
".",
"port",
":",
"self",
".",
"stop",
"(",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Close port '%s'\"",
"%",
"self",
".",
"comport",
",",
"extra",
"=",
"{",
"'type'",
":",
"'<-... | Closes serial port connection.
:return: Nothing | [
"Closes",
"serial",
"port",
"connection",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L316-L327 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.__send_break | def __send_break(self):
"""
Sends break to device.
:return: result of EnhancedSerial safe_sendBreak()
"""
if self.port:
self.logger.debug("sendBreak to device to reboot", extra={'type': '<->'})
result = self.port.safe_sendBreak()
time.sleep(1)... | python | def __send_break(self):
"""
Sends break to device.
:return: result of EnhancedSerial safe_sendBreak()
"""
if self.port:
self.logger.debug("sendBreak to device to reboot", extra={'type': '<->'})
result = self.port.safe_sendBreak()
time.sleep(1)... | [
"def",
"__send_break",
"(",
"self",
")",
":",
"if",
"self",
".",
"port",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"sendBreak to device to reboot\"",
",",
"extra",
"=",
"{",
"'type'",
":",
"'<->'",
"}",
")",
"result",
"=",
"self",
".",
"port",
"... | Sends break to device.
:return: result of EnhancedSerial safe_sendBreak() | [
"Sends",
"break",
"to",
"device",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L348-L363 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.writeline | def writeline(self, data):
"""
Writes data to serial port.
:param data: Data to write
:return: Nothing
:raises: IOError if SerialException occurs.
"""
try:
if self.ch_mode:
data += "\n"
parts = split_by_n(data, self.ch_... | python | def writeline(self, data):
"""
Writes data to serial port.
:param data: Data to write
:return: Nothing
:raises: IOError if SerialException occurs.
"""
try:
if self.ch_mode:
data += "\n"
parts = split_by_n(data, self.ch_... | [
"def",
"writeline",
"(",
"self",
",",
"data",
")",
":",
"try",
":",
"if",
"self",
".",
"ch_mode",
":",
"data",
"+=",
"\"\\n\"",
"parts",
"=",
"split_by_n",
"(",
"data",
",",
"self",
".",
"ch_mode_chunk_size",
")",
"for",
"split_str",
"in",
"parts",
":"... | Writes data to serial port.
:param data: Data to write
:return: Nothing
:raises: IOError if SerialException occurs. | [
"Writes",
"data",
"to",
"serial",
"port",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L366-L385 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial._readline | def _readline(self, timeout=1):
"""
Read line from serial port.
:param timeout: timeout, default is 1
:return: stripped line or None
"""
line = self.port.readline(timeout=timeout)
return strip_escape(line.strip()) if line is not None else line | python | def _readline(self, timeout=1):
"""
Read line from serial port.
:param timeout: timeout, default is 1
:return: stripped line or None
"""
line = self.port.readline(timeout=timeout)
return strip_escape(line.strip()) if line is not None else line | [
"def",
"_readline",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"line",
"=",
"self",
".",
"port",
".",
"readline",
"(",
"timeout",
"=",
"timeout",
")",
"return",
"strip_escape",
"(",
"line",
".",
"strip",
"(",
")",
")",
"if",
"line",
"is",
"no... | Read line from serial port.
:param timeout: timeout, default is 1
:return: stripped line or None | [
"Read",
"line",
"from",
"serial",
"port",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L388-L396 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.run | def run(self):
"""
Read lines while keep_reading is True. Calls process_dut for each received line.
:return: Nothing
"""
self.keep_reading = True
while self.keep_reading:
line = self._readline()
if line:
self.input_queue.appendleft... | python | def run(self):
"""
Read lines while keep_reading is True. Calls process_dut for each received line.
:return: Nothing
"""
self.keep_reading = True
while self.keep_reading:
line = self._readline()
if line:
self.input_queue.appendleft... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"keep_reading",
"=",
"True",
"while",
"self",
".",
"keep_reading",
":",
"line",
"=",
"self",
".",
"_readline",
"(",
")",
"if",
"line",
":",
"self",
".",
"input_queue",
".",
"appendleft",
"(",
"line",
... | Read lines while keep_reading is True. Calls process_dut for each received line.
:return: Nothing | [
"Read",
"lines",
"while",
"keep_reading",
"is",
"True",
".",
"Calls",
"process_dut",
"for",
"each",
"received",
"line",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L408-L419 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.stop | def stop(self):
"""
Stops and joins readthread.
:return: Nothing
"""
self.keep_reading = False
if self.readthread is not None:
self.readthread.join()
self.readthread = None | python | def stop(self):
"""
Stops and joins readthread.
:return: Nothing
"""
self.keep_reading = False
if self.readthread is not None:
self.readthread.join()
self.readthread = None | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"keep_reading",
"=",
"False",
"if",
"self",
".",
"readthread",
"is",
"not",
"None",
":",
"self",
".",
"readthread",
".",
"join",
"(",
")",
"self",
".",
"readthread",
"=",
"None"
] | Stops and joins readthread.
:return: Nothing | [
"Stops",
"and",
"joins",
"readthread",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L421-L430 | train |
ARMmbed/icetea | icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py | DutSerial.print_info | def print_info(self):
"""
Prints Dut information nicely formatted into a table.
"""
table = PrettyTable()
start_string = "DutSerial {} \n".format(self.name)
row = []
info_string = ""
if self.config:
info_string = info_string + "Configuration fo... | python | def print_info(self):
"""
Prints Dut information nicely formatted into a table.
"""
table = PrettyTable()
start_string = "DutSerial {} \n".format(self.name)
row = []
info_string = ""
if self.config:
info_string = info_string + "Configuration fo... | [
"def",
"print_info",
"(",
"self",
")",
":",
"table",
"=",
"PrettyTable",
"(",
")",
"start_string",
"=",
"\"DutSerial {} \\n\"",
".",
"format",
"(",
"self",
".",
"name",
")",
"row",
"=",
"[",
"]",
"info_string",
"=",
"\"\"",
"if",
"self",
".",
"config",
... | Prints Dut information nicely formatted into a table. | [
"Prints",
"Dut",
"information",
"nicely",
"formatted",
"into",
"a",
"table",
"."
] | b2b97ac607429830cf7d62dae2e3903692c7c778 | https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/plugins/LocalAllocator/DutSerial.py#L445-L477 | train |
bootphon/h5features | h5features/data.py | Data.append | def append(self, data):
"""Append a Data instance to self"""
for k in self._entries.keys():
self._entries[k].append(data._entries[k]) | python | def append(self, data):
"""Append a Data instance to self"""
for k in self._entries.keys():
self._entries[k].append(data._entries[k]) | [
"def",
"append",
"(",
"self",
",",
"data",
")",
":",
"for",
"k",
"in",
"self",
".",
"_entries",
".",
"keys",
"(",
")",
":",
"self",
".",
"_entries",
"[",
"k",
"]",
".",
"append",
"(",
"data",
".",
"_entries",
"[",
"k",
"]",
")"
] | Append a Data instance to self | [
"Append",
"a",
"Data",
"instance",
"to",
"self"
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/data.py#L72-L75 | train |
bootphon/h5features | h5features/data.py | Data.init_group | def init_group(self, group, chunk_size,
compression=None, compression_opts=None):
"""Initializes a HDF5 group compliant with the stored data.
This method creates the datasets 'items', 'labels', 'features'
and 'index' and leaves them empty.
:param h5py.Group group: Th... | python | def init_group(self, group, chunk_size,
compression=None, compression_opts=None):
"""Initializes a HDF5 group compliant with the stored data.
This method creates the datasets 'items', 'labels', 'features'
and 'index' and leaves them empty.
:param h5py.Group group: Th... | [
"def",
"init_group",
"(",
"self",
",",
"group",
",",
"chunk_size",
",",
"compression",
"=",
"None",
",",
"compression_opts",
"=",
"None",
")",
":",
"create_index",
"(",
"group",
",",
"chunk_size",
")",
"self",
".",
"_entries",
"[",
"'items'",
"]",
".",
"... | Initializes a HDF5 group compliant with the stored data.
This method creates the datasets 'items', 'labels', 'features'
and 'index' and leaves them empty.
:param h5py.Group group: The group to initializes.
:param float chunk_size: The size of a chunk in the file (in MB).
:param... | [
"Initializes",
"a",
"HDF5",
"group",
"compliant",
"with",
"the",
"stored",
"data",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/data.py#L111-L145 | train |
bootphon/h5features | h5features/data.py | Data.is_appendable_to | def is_appendable_to(self, group):
"""Returns True if the data can be appended in a given group."""
# First check only the names
if not all([k in group for k in self._entries.keys()]):
return False
# If names are matching, check the contents
for k in self._entries.ke... | python | def is_appendable_to(self, group):
"""Returns True if the data can be appended in a given group."""
# First check only the names
if not all([k in group for k in self._entries.keys()]):
return False
# If names are matching, check the contents
for k in self._entries.ke... | [
"def",
"is_appendable_to",
"(",
"self",
",",
"group",
")",
":",
"if",
"not",
"all",
"(",
"[",
"k",
"in",
"group",
"for",
"k",
"in",
"self",
".",
"_entries",
".",
"keys",
"(",
")",
"]",
")",
":",
"return",
"False",
"for",
"k",
"in",
"self",
".",
... | Returns True if the data can be appended in a given group. | [
"Returns",
"True",
"if",
"the",
"data",
"can",
"be",
"appended",
"in",
"a",
"given",
"group",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/data.py#L147-L158 | train |
bootphon/h5features | h5features/data.py | Data.write_to | def write_to(self, group, append=False):
"""Write the data to the given group.
:param h5py.Group group: The group to write the data on. It is
assumed that the group is already existing or initialized
to store h5features data (i.e. the method
``Data.init_group`` have ... | python | def write_to(self, group, append=False):
"""Write the data to the given group.
:param h5py.Group group: The group to write the data on. It is
assumed that the group is already existing or initialized
to store h5features data (i.e. the method
``Data.init_group`` have ... | [
"def",
"write_to",
"(",
"self",
",",
"group",
",",
"append",
"=",
"False",
")",
":",
"write_index",
"(",
"self",
",",
"group",
",",
"append",
")",
"self",
".",
"_entries",
"[",
"'items'",
"]",
".",
"write_to",
"(",
"group",
")",
"self",
".",
"_entrie... | Write the data to the given group.
:param h5py.Group group: The group to write the data on. It is
assumed that the group is already existing or initialized
to store h5features data (i.e. the method
``Data.init_group`` have been called.
:param bool append: If False, ... | [
"Write",
"the",
"data",
"to",
"the",
"given",
"group",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/data.py#L160-L179 | train |
bootphon/h5features | h5features/labels.py | Labels.check | def check(labels):
"""Raise IOError if labels are not correct
`labels` must be a list of sorted numpy arrays of equal
dimensions (must be 1D or 2D). In the case of 2D labels,
the second axis must have the same shape for all labels.
"""
# type checking
... | python | def check(labels):
"""Raise IOError if labels are not correct
`labels` must be a list of sorted numpy arrays of equal
dimensions (must be 1D or 2D). In the case of 2D labels,
the second axis must have the same shape for all labels.
"""
# type checking
... | [
"def",
"check",
"(",
"labels",
")",
":",
"if",
"not",
"isinstance",
"(",
"labels",
",",
"list",
")",
":",
"raise",
"IOError",
"(",
"'labels are not in a list'",
")",
"if",
"not",
"len",
"(",
"labels",
")",
":",
"raise",
"IOError",
"(",
"'the labels list is... | Raise IOError if labels are not correct
`labels` must be a list of sorted numpy arrays of equal
dimensions (must be 1D or 2D). In the case of 2D labels,
the second axis must have the same shape for all labels. | [
"Raise",
"IOError",
"if",
"labels",
"are",
"not",
"correct"
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/labels.py#L56-L91 | train |
bootphon/h5features | h5features/converter.py | Converter._write | def _write(self, item, labels, features):
""" Writes the given item to the owned file."""
data = Data([item], [labels], [features])
self._writer.write(data, self.groupname, append=True) | python | def _write(self, item, labels, features):
""" Writes the given item to the owned file."""
data = Data([item], [labels], [features])
self._writer.write(data, self.groupname, append=True) | [
"def",
"_write",
"(",
"self",
",",
"item",
",",
"labels",
",",
"features",
")",
":",
"data",
"=",
"Data",
"(",
"[",
"item",
"]",
",",
"[",
"labels",
"]",
",",
"[",
"features",
"]",
")",
"self",
".",
"_writer",
".",
"write",
"(",
"data",
",",
"s... | Writes the given item to the owned file. | [
"Writes",
"the",
"given",
"item",
"to",
"the",
"owned",
"file",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/converter.py#L65-L68 | train |
bootphon/h5features | h5features/converter.py | Converter.convert | def convert(self, infile, item=None):
"""Convert an input file to h5features based on its extension.
:raise IOError: if `infile` is not a valid file.
:raise IOError: if `infile` extension is not supported.
"""
if not os.path.isfile(infile):
raise IOError('{} is not ... | python | def convert(self, infile, item=None):
"""Convert an input file to h5features based on its extension.
:raise IOError: if `infile` is not a valid file.
:raise IOError: if `infile` extension is not supported.
"""
if not os.path.isfile(infile):
raise IOError('{} is not ... | [
"def",
"convert",
"(",
"self",
",",
"infile",
",",
"item",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"infile",
")",
":",
"raise",
"IOError",
"(",
"'{} is not a valid file'",
".",
"format",
"(",
"infile",
")",
")",
"if... | Convert an input file to h5features based on its extension.
:raise IOError: if `infile` is not a valid file.
:raise IOError: if `infile` extension is not supported. | [
"Convert",
"an",
"input",
"file",
"to",
"h5features",
"based",
"on",
"its",
"extension",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/converter.py#L80-L101 | train |
bootphon/h5features | h5features/converter.py | Converter.npz_convert | def npz_convert(self, infile, item):
"""Convert a numpy NPZ file to h5features."""
data = np.load(infile)
labels = self._labels(data)
features = data['features']
self._write(item, labels, features) | python | def npz_convert(self, infile, item):
"""Convert a numpy NPZ file to h5features."""
data = np.load(infile)
labels = self._labels(data)
features = data['features']
self._write(item, labels, features) | [
"def",
"npz_convert",
"(",
"self",
",",
"infile",
",",
"item",
")",
":",
"data",
"=",
"np",
".",
"load",
"(",
"infile",
")",
"labels",
"=",
"self",
".",
"_labels",
"(",
"data",
")",
"features",
"=",
"data",
"[",
"'features'",
"]",
"self",
".",
"_wr... | Convert a numpy NPZ file to h5features. | [
"Convert",
"a",
"numpy",
"NPZ",
"file",
"to",
"h5features",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/converter.py#L103-L108 | train |
bootphon/h5features | h5features/converter.py | Converter.h5features_convert | def h5features_convert(self, infile):
"""Convert a h5features file to the latest h5features version."""
with h5py.File(infile, 'r') as f:
groups = list(f.keys())
for group in groups:
self._writer.write(
Reader(infile, group).read(),
self.gr... | python | def h5features_convert(self, infile):
"""Convert a h5features file to the latest h5features version."""
with h5py.File(infile, 'r') as f:
groups = list(f.keys())
for group in groups:
self._writer.write(
Reader(infile, group).read(),
self.gr... | [
"def",
"h5features_convert",
"(",
"self",
",",
"infile",
")",
":",
"with",
"h5py",
".",
"File",
"(",
"infile",
",",
"'r'",
")",
"as",
"f",
":",
"groups",
"=",
"list",
"(",
"f",
".",
"keys",
"(",
")",
")",
"for",
"group",
"in",
"groups",
":",
"sel... | Convert a h5features file to the latest h5features version. | [
"Convert",
"a",
"h5features",
"file",
"to",
"the",
"latest",
"h5features",
"version",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/converter.py#L117-L124 | train |
bootphon/h5features | h5features/h5features.py | read | def read(filename, groupname=None, from_item=None, to_item=None,
from_time=None, to_time=None, index=None):
"""Reads in a h5features file.
:param str filename: Path to a hdf5 file potentially serving as a
container for many small files
:param str groupname: HDF5 group to read the data fro... | python | def read(filename, groupname=None, from_item=None, to_item=None,
from_time=None, to_time=None, index=None):
"""Reads in a h5features file.
:param str filename: Path to a hdf5 file potentially serving as a
container for many small files
:param str groupname: HDF5 group to read the data fro... | [
"def",
"read",
"(",
"filename",
",",
"groupname",
"=",
"None",
",",
"from_item",
"=",
"None",
",",
"to_item",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"not",
... | Reads in a h5features file.
:param str filename: Path to a hdf5 file potentially serving as a
container for many small files
:param str groupname: HDF5 group to read the data from. If None,
guess there is one and only one group in `filename`.
:param str from_item: Optional. Read the data ... | [
"Reads",
"in",
"a",
"h5features",
"file",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/h5features.py#L34-L88 | train |
bootphon/h5features | h5features/h5features.py | write | def write(filename, groupname, items, times, features, properties=None,
dformat='dense', chunk_size='auto', sparsity=0.1, mode='a'):
"""Write h5features data in a HDF5 file.
This function is a wrapper to the Writer class. It has three purposes:
* Check parameters for errors (see details below),
... | python | def write(filename, groupname, items, times, features, properties=None,
dformat='dense', chunk_size='auto', sparsity=0.1, mode='a'):
"""Write h5features data in a HDF5 file.
This function is a wrapper to the Writer class. It has three purposes:
* Check parameters for errors (see details below),
... | [
"def",
"write",
"(",
"filename",
",",
"groupname",
",",
"items",
",",
"times",
",",
"features",
",",
"properties",
"=",
"None",
",",
"dformat",
"=",
"'dense'",
",",
"chunk_size",
"=",
"'auto'",
",",
"sparsity",
"=",
"0.1",
",",
"mode",
"=",
"'a'",
")",... | Write h5features data in a HDF5 file.
This function is a wrapper to the Writer class. It has three purposes:
* Check parameters for errors (see details below),
* Create Items, Times and Features objects
* Send them to the Writer.
:param str filename: HDF5 file to be writted, potentially serving
... | [
"Write",
"h5features",
"data",
"in",
"a",
"HDF5",
"file",
"."
] | d5f95db0f1cee58ac1ba4575d1212e796c39e1f9 | https://github.com/bootphon/h5features/blob/d5f95db0f1cee58ac1ba4575d1212e796c39e1f9/h5features/h5features.py#L91-L158 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.