hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
faab2cbc0da47673efe05fe345fc812c127a6162 | opendatatrentino/opendata-harvester | harvester_odt/comunweb/converter.py | [
"BSD-2-Clause"
] | Python | _fix_resource_format_case | null | def _fix_resource_format_case(self, resources):
"""
Hack to set the case of the resource format.
Ckan will convert certain formats to uppercase and certain
others to lowercase, but the client will complain about this..
- todo: apply a workaround for this in the client?
... |
Hack to set the case of the resource format.
Ckan will convert certain formats to uppercase and certain
others to lowercase, but the client will complain about this..
- todo: apply a workaround for this in the client?
- todo: make the client just issue warnings if updated data... | Hack to set the case of the resource format.
Ckan will convert certain formats to uppercase and certain
others to lowercase, but the client will complain about this
apply a workaround for this in the client.
todo: make the client just issue warnings if updated dataset
doesn't match. -> warnings.warn() + logger.warn()
... | [
"Hack",
"to",
"set",
"the",
"case",
"of",
"the",
"resource",
"format",
".",
"Ckan",
"will",
"convert",
"certain",
"formats",
"to",
"uppercase",
"and",
"certain",
"others",
"to",
"lowercase",
"but",
"the",
"client",
"will",
"complain",
"about",
"this",
"apply... | def _fix_resource_format_case(self, resources):
must_upper = ['CSV', 'KML', 'ZIP']
for res in resources:
if res['format'].upper() in must_upper:
res['format'] = res['format'].upper()
else:
res['format'] = res['format'].lower() | [
"def",
"_fix_resource_format_case",
"(",
"self",
",",
"resources",
")",
":",
"must_upper",
"=",
"[",
"'CSV'",
",",
"'KML'",
",",
"'ZIP'",
"]",
"for",
"res",
"in",
"resources",
":",
"if",
"res",
"[",
"'format'",
"]",
".",
"upper",
"(",
")",
"in",
"must_... | Hack to set the case of the resource format. | [
"Hack",
"to",
"set",
"the",
"case",
"of",
"the",
"resource",
"format",
"."
] | [
"\"\"\"\n Hack to set the case of the resource format.\n\n Ckan will convert certain formats to uppercase and certain\n others to lowercase, but the client will complain about this..\n\n - todo: apply a workaround for this in the client?\n - todo: make the client just issue warnin... | [
{
"param": "self",
"type": null
},
{
"param": "resources",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resources",
"type": null,
"docstring": null,
"docstring_token... |
faab2cbc0da47673efe05fe345fc812c127a6162 | opendatatrentino/opendata-harvester | harvester_odt/comunweb/converter.py | [
"BSD-2-Clause"
] | Python | comunweb_normalize_field_values | <not_specific> | def comunweb_normalize_field_values(obj):
"""
Normalize values from a ComunWeb object.
:param obj:
A metadata object in the format returned by ComunWeb.
Some examples can be found in ``docs/open_data-node-*.json``.
Basically, it is a dict with a top-level key "fields" pointing
... |
Normalize values from a ComunWeb object.
:param obj:
A metadata object in the format returned by ComunWeb.
Some examples can be found in ``docs/open_data-node-*.json``.
Basically, it is a dict with a top-level key "fields" pointing
to a dict whose keys are mapping to dicts des... | Normalize values from a ComunWeb object. | [
"Normalize",
"values",
"from",
"a",
"ComunWeb",
"object",
"."
] | def comunweb_normalize_field_values(obj):
def _get_field_value(fld):
if fld['type'] == 'ezxmltext':
return _html_unescape(fld['string_value']) or None
if fld['type'] == 'ezstring':
if fld['value'] != fld['string_value']:
logger.warning(
"St... | [
"def",
"comunweb_normalize_field_values",
"(",
"obj",
")",
":",
"def",
"_get_field_value",
"(",
"fld",
")",
":",
"if",
"fld",
"[",
"'type'",
"]",
"==",
"'ezxmltext'",
":",
"return",
"_html_unescape",
"(",
"fld",
"[",
"'string_value'",
"]",
")",
"or",
"None",... | Normalize values from a ComunWeb object. | [
"Normalize",
"values",
"from",
"a",
"ComunWeb",
"object",
"."
] | [
"\"\"\"\n Normalize values from a ComunWeb object.\n\n :param obj:\n A metadata object in the format returned by ComunWeb.\n Some examples can be found in ``docs/open_data-node-*.json``.\n\n Basically, it is a dict with a top-level key \"fields\" pointing\n to a dict whose keys are... | [
{
"param": "obj",
"type": null
}
] | {
"returns": [
{
"docstring": "a dict like this::\n{\n'field_name': {\n'label': 'Field label',\n'value': 'Field value',\n}\n}",
"docstring_tokens": [
"a",
"dict",
"like",
"this",
"::",
"{",
"'",
"field_name",
"'",
":",
... |
49b08e31718d61bcdfbf1d02a422ae12667aa315 | opendatatrentino/opendata-harvester | harvester/ext/crawler/base.py | [
"BSD-2-Clause"
] | Python | fetch_data | null | def fetch_data(self, storage):
"""
Download data into a storage.
We expect to be able to manipulate the storage as it
were a dict of dicts::
{
"object-type": {
"object-id": { ..the object.. }
}
}
"""
pa... |
Download data into a storage.
We expect to be able to manipulate the storage as it
were a dict of dicts::
{
"object-type": {
"object-id": { ..the object.. }
}
}
| Download data into a storage.
We expect to be able to manipulate the storage as it
were a dict of dicts:.
| [
"Download",
"data",
"into",
"a",
"storage",
".",
"We",
"expect",
"to",
"be",
"able",
"to",
"manipulate",
"the",
"storage",
"as",
"it",
"were",
"a",
"dict",
"of",
"dicts",
":",
"."
] | def fetch_data(self, storage):
pass | [
"def",
"fetch_data",
"(",
"self",
",",
"storage",
")",
":",
"pass"
] | Download data into a storage. | [
"Download",
"data",
"into",
"a",
"storage",
"."
] | [
"\"\"\"\n Download data into a storage.\n\n We expect to be able to manipulate the storage as it\n were a dict of dicts::\n\n {\n \"object-type\": {\n \"object-id\": { ..the object.. }\n }\n }\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "storage",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "storage",
"type": null,
"docstring": null,
"docstring_tokens"... |
99553ee184f8a5b4ca6fc41c52cac09dc8bd5fc8 | opendatatrentino/opendata-harvester | harvester/ext/importer/ckan.py | [
"BSD-2-Clause"
] | Python | import_to_ckan | null | def import_to_ckan(storage, ckan_url, api_key, source_name,
organization_merge_strategy='create',
group_merge_strategy='create',
dataset_preserve_names=True,
dataset_preserve_organization=True,
dataset_group_merge_strategy='a... |
Import data from a storage to CKAN.
:param storage:
Input storage. Must contain data in CKAN format.
Can be either a Storage object or a dict
like ``{'url': '...', 'conf': {}}``.
:param ckan_url: URL to the CKAN instance
:param api_key: CKAN API key
:param source_name: N... | Import data from a storage to CKAN. | [
"Import",
"data",
"from",
"a",
"storage",
"to",
"CKAN",
"."
] | def import_to_ckan(storage, ckan_url, api_key, source_name,
organization_merge_strategy='create',
group_merge_strategy='create',
dataset_preserve_names=True,
dataset_preserve_organization=True,
dataset_group_merge_strategy='a... | [
"def",
"import_to_ckan",
"(",
"storage",
",",
"ckan_url",
",",
"api_key",
",",
"source_name",
",",
"organization_merge_strategy",
"=",
"'create'",
",",
"group_merge_strategy",
"=",
"'create'",
",",
"dataset_preserve_names",
"=",
"True",
",",
"dataset_preserve_organizati... | Import data from a storage to CKAN. | [
"Import",
"data",
"from",
"a",
"storage",
"to",
"CKAN",
"."
] | [
"\"\"\"\n Import data from a storage to CKAN.\n\n :param storage:\n Input storage. Must contain data in CKAN format.\n Can be either a Storage object or a dict\n like ``{'url': '...', 'conf': {}}``.\n\n :param ckan_url: URL to the CKAN instance\n\n :param api_key: CKAN API key\n\n ... | [
{
"param": "storage",
"type": null
},
{
"param": "ckan_url",
"type": null
},
{
"param": "api_key",
"type": null
},
{
"param": "source_name",
"type": null
},
{
"param": "organization_merge_strategy",
"type": null
},
{
"param": "group_merge_strategy",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "storage",
"type": null,
"docstring": "Input storage. Must contain data in CKAN format.\nCan be either a Storage object or a dict\nlike ``{'url': '...', 'conf': {}}``.",
"docstring_tokens": [
"Input",
"storage",... |
99553ee184f8a5b4ca6fc41c52cac09dc8bd5fc8 | opendatatrentino/opendata-harvester | harvester/ext/importer/ckan.py | [
"BSD-2-Clause"
] | Python | _get_input_storage | <not_specific> | def _get_input_storage():
"""
Get the input storage from job dependencies.
"""
# Get a list of dependencies of this job
# We expect to get exactly *one*
from jobcontrol.globals import current_app, execution_context
deps = current_app.storage.get_job_deps(execution_context.job_id)
if ... |
Get the input storage from job dependencies.
| Get the input storage from job dependencies. | [
"Get",
"the",
"input",
"storage",
"from",
"job",
"dependencies",
"."
] | def _get_input_storage():
from jobcontrol.globals import current_app, execution_context
deps = current_app.storage.get_job_deps(execution_context.job_id)
if len(deps) != 1:
raise RuntimeError("This job requires exactly *one* dependency, "
"which returned the URL to storage... | [
"def",
"_get_input_storage",
"(",
")",
":",
"from",
"jobcontrol",
".",
"globals",
"import",
"current_app",
",",
"execution_context",
"deps",
"=",
"current_app",
".",
"storage",
".",
"get_job_deps",
"(",
"execution_context",
".",
"job_id",
")",
"if",
"len",
"(",
... | Get the input storage from job dependencies. | [
"Get",
"the",
"input",
"storage",
"from",
"job",
"dependencies",
"."
] | [
"\"\"\"\n Get the input storage from job dependencies.\n \"\"\"",
"# Get a list of dependencies of this job",
"# We expect to get exactly *one*",
"# Get the output storage URL from the latest successful",
"# build. Again, we need at least one successful build."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
152384b2ac7ae15cca8a1cc585b6b7c87728f60c | opendatatrentino/opendata-harvester | harvester/utils/cli.py | [
"BSD-2-Clause"
] | Python | configure_logging | <not_specific> | def configure_logging(self):
"""
Create logging handlers for any log output.
Modified version to set custom formatter for console
"""
root_logger = logging.getLogger('')
root_logger.setLevel(logging.DEBUG)
# Set up logging to a file
if self.options.log_fi... |
Create logging handlers for any log output.
Modified version to set custom formatter for console
| Create logging handlers for any log output.
Modified version to set custom formatter for console | [
"Create",
"logging",
"handlers",
"for",
"any",
"log",
"output",
".",
"Modified",
"version",
"to",
"set",
"custom",
"formatter",
"for",
"console"
] | def configure_logging(self):
root_logger = logging.getLogger('')
root_logger.setLevel(logging.DEBUG)
if self.options.log_file:
file_handler = logging.FileHandler(
filename=self.options.log_file,
)
formatter = logging.Formatter(self.LOG_FILE_MES... | [
"def",
"configure_logging",
"(",
"self",
")",
":",
"root_logger",
"=",
"logging",
".",
"getLogger",
"(",
"''",
")",
"root_logger",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"if",
"self",
".",
"options",
".",
"log_file",
":",
"file_handler",
"=",
... | Create logging handlers for any log output. | [
"Create",
"logging",
"handlers",
"for",
"any",
"log",
"output",
"."
] | [
"\"\"\"\n Create logging handlers for any log output.\n Modified version to set custom formatter for console\n \"\"\"",
"# Set up logging to a file",
"# Always send higher-level messages to the console via stderr",
"# formatter = logging.Formatter(self.CONSOLE_MESSAGE_FORMAT)",
"# This ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fe60992723004bf69476c304634ab6ae52c92033 | opendatatrentino/opendata-harvester | harvester_odt/pat_geocatalogo/converter.py | [
"BSD-2-Clause"
] | Python | _clean_tags | <not_specific> | def _clean_tags(tags, tags_map=TAGS_MAP):
"""Clean tags according to the map"""
def _clean_tag(tag):
if tag not in tags_map:
logger.warn('Found an unknown tag: {0!r}'.format(tag))
return []
tagvalue = tags_map[tag]
if (tagvalue is None) or (tagvalue is False):
... | Clean tags according to the map | Clean tags according to the map | [
"Clean",
"tags",
"according",
"to",
"the",
"map"
] | def _clean_tags(tags, tags_map=TAGS_MAP):
def _clean_tag(tag):
if tag not in tags_map:
logger.warn('Found an unknown tag: {0!r}'.format(tag))
return []
tagvalue = tags_map[tag]
if (tagvalue is None) or (tagvalue is False):
return []
if tagvalue is ... | [
"def",
"_clean_tags",
"(",
"tags",
",",
"tags_map",
"=",
"TAGS_MAP",
")",
":",
"def",
"_clean_tag",
"(",
"tag",
")",
":",
"if",
"tag",
"not",
"in",
"tags_map",
":",
"logger",
".",
"warn",
"(",
"'Found an unknown tag: {0!r}'",
".",
"format",
"(",
"tag",
"... | Clean tags according to the map | [
"Clean",
"tags",
"according",
"to",
"the",
"map"
] | [
"\"\"\"Clean tags according to the map\"\"\""
] | [
{
"param": "tags",
"type": null
},
{
"param": "tags_map",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tags",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tags_map",
"type": null,
"docstring": null,
"docstring_tokens... |
4ad96f95c2493f0a16dacd1846f68ffc03119db1 | GANG5TER/calculator-1 | team1.py | [
"Apache-2.0"
] | Python | sqrt | <not_specific> | def sqrt(x):
"""
Returns the square root of a given number
"""
return (x**.5) |
Returns the square root of a given number
| Returns the square root of a given number | [
"Returns",
"the",
"square",
"root",
"of",
"a",
"given",
"number"
] | def sqrt(x):
return (x**.5) | [
"def",
"sqrt",
"(",
"x",
")",
":",
"return",
"(",
"x",
"**",
".5",
")"
] | Returns the square root of a given number | [
"Returns",
"the",
"square",
"root",
"of",
"a",
"given",
"number"
] | [
"\"\"\"\n\tReturns the square root of a given number\n\t\"\"\""
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b9340bbfb480bf21d84df86b26eb3e81c44c26bd | GANG5TER/calculator-1 | team4.py | [
"Apache-2.0"
] | Python | log10 | <not_specific> | def log10(x):
"""
Taking a number, giving it a base and raising it to a power is log
"""
temp = x
count = 0
while temp >= 10:
temp = temp / 10
count += 1
return count |
Taking a number, giving it a base and raising it to a power is log
| Taking a number, giving it a base and raising it to a power is log | [
"Taking",
"a",
"number",
"giving",
"it",
"a",
"base",
"and",
"raising",
"it",
"to",
"a",
"power",
"is",
"log"
] | def log10(x):
temp = x
count = 0
while temp >= 10:
temp = temp / 10
count += 1
return count | [
"def",
"log10",
"(",
"x",
")",
":",
"temp",
"=",
"x",
"count",
"=",
"0",
"while",
"temp",
">=",
"10",
":",
"temp",
"=",
"temp",
"/",
"10",
"count",
"+=",
"1",
"return",
"count"
] | Taking a number, giving it a base and raising it to a power is log | [
"Taking",
"a",
"number",
"giving",
"it",
"a",
"base",
"and",
"raising",
"it",
"to",
"a",
"power",
"is",
"log"
] | [
"\"\"\"\n Taking a number, giving it a base and raising it to a power is log\n \"\"\""
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4486e285986b53a4af15c98fbf3d39d67f6cb272 | GANG5TER/calculator-1 | team2.py | [
"Apache-2.0"
] | Python | factorial | <not_specific> | def factorial(n):
""" Returns the factorial of a number """
if n == 0:
return 1
else:
return n * factorial(n-1)
if x <= 0:
return -x
else:
return x | Returns the factorial of a number | Returns the factorial of a number | [
"Returns",
"the",
"factorial",
"of",
"a",
"number"
] | def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
if x <= 0:
return -x
else:
return x | [
"def",
"factorial",
"(",
"n",
")",
":",
"if",
"n",
"==",
"0",
":",
"return",
"1",
"else",
":",
"return",
"n",
"*",
"factorial",
"(",
"n",
"-",
"1",
")",
"if",
"x",
"<=",
"0",
":",
"return",
"-",
"x",
"else",
":",
"return",
"x"
] | Returns the factorial of a number | [
"Returns",
"the",
"factorial",
"of",
"a",
"number"
] | [
"\"\"\" Returns the factorial of a number \"\"\""
] | [
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a74a4d59e2c64bfafa64219ef9540784cf4f409 | GANG5TER/calculator-1 | team5.py | [
"Apache-2.0"
] | Python | multiply | <not_specific> | def multiply(x, y):
""" Return the product of x and y """
answer = 0 # one equal sign means assignment
if x == 0: # two equal signs means compare
return 0
if y == 0:
return 0
while y > 0:
answer += x
y = y - 1
return answer | Return the product of x and y | Return the product of x and y | [
"Return",
"the",
"product",
"of",
"x",
"and",
"y"
] | def multiply(x, y):
answer = 0
if x == 0:
return 0
if y == 0:
return 0
while y > 0:
answer += x
y = y - 1
return answer | [
"def",
"multiply",
"(",
"x",
",",
"y",
")",
":",
"answer",
"=",
"0",
"if",
"x",
"==",
"0",
":",
"return",
"0",
"if",
"y",
"==",
"0",
":",
"return",
"0",
"while",
"y",
">",
"0",
":",
"answer",
"+=",
"x",
"y",
"=",
"y",
"-",
"1",
"return",
... | Return the product of x and y | [
"Return",
"the",
"product",
"of",
"x",
"and",
"y"
] | [
"\"\"\" Return the product of x and y \"\"\"",
"# one equal sign means assignment",
"# two equal signs means compare"
] | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
7d69fdabc2d63ec65d9c15fc7577c501e8e754ca | GANG5TER/calculator-1 | team3.py | [
"Apache-2.0"
] | Python | pow | <not_specific> | def pow(b, e):
""" This function will raise the number b to the power e """
total = 1
for i in range(e):
total = total * b
return total | This function will raise the number b to the power e | This function will raise the number b to the power e | [
"This",
"function",
"will",
"raise",
"the",
"number",
"b",
"to",
"the",
"power",
"e"
] | def pow(b, e):
total = 1
for i in range(e):
total = total * b
return total | [
"def",
"pow",
"(",
"b",
",",
"e",
")",
":",
"total",
"=",
"1",
"for",
"i",
"in",
"range",
"(",
"e",
")",
":",
"total",
"=",
"total",
"*",
"b",
"return",
"total"
] | This function will raise the number b to the power e | [
"This",
"function",
"will",
"raise",
"the",
"number",
"b",
"to",
"the",
"power",
"e"
] | [
"\"\"\" This function will raise the number b to the power e \"\"\""
] | [
{
"param": "b",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "b",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | weekString | <not_specific> | def weekString():
"""
Returns: a string based on the current weekdays
"""
return dumps({"current_week": getCurrentWeek()}) |
Returns: a string based on the current weekdays
| a string based on the current weekdays | [
"a",
"string",
"based",
"on",
"the",
"current",
"weekdays"
] | def weekString():
return dumps({"current_week": getCurrentWeek()}) | [
"def",
"weekString",
"(",
")",
":",
"return",
"dumps",
"(",
"{",
"\"current_week\"",
":",
"getCurrentWeek",
"(",
")",
"}",
")"
] | Returns: a string based on the current weekdays | [
"Returns",
":",
"a",
"string",
"based",
"on",
"the",
"current",
"weekdays"
] | [
"\"\"\"\n Returns: a string based on the current weekdays \n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | newTutor | <not_specific> | def newTutor(u_id):
myDb, myCursor = dbConnect()
"""
Allow an ADMIN to add a new tutor (ADMIN ONLY)
Raises:
AccessError: [non-admin permissions]
InputError: [invalid u_id]
InputError: [invalid tutor_id]
InputError: [invalid first or last names]
InputError: [inv... |
Allow an ADMIN to add a new tutor (ADMIN ONLY)
Raises:
AccessError: [non-admin permissions]
InputError: [invalid u_id]
InputError: [invalid tutor_id]
InputError: [invalid first or last names]
InputError: [invalid rate_id]
InputError: [invalid email]
| Allow an ADMIN to add a new tutor (ADMIN ONLY) | [
"Allow",
"an",
"ADMIN",
"to",
"add",
"a",
"new",
"tutor",
"(",
"ADMIN",
"ONLY",
")"
] | def newTutor(u_id):
myDb, myCursor = dbConnect()
data = request.get_json()
if not validateUidLength(data["u_id"]):
raise InputError(description = "u_id is of incorrect length")
elif not validateTutorIdFormat(data["tutor_id"]):
raise InputError(description = "tutor_id is of incorrect form... | [
"def",
"newTutor",
"(",
"u_id",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"if",
"not",
"validateUidLength",
"(",
"data",
"[",
"\"u_id\"",
"]",
")",
":",
"raise",
"InputError",
"(",... | Allow an ADMIN to add a new tutor (ADMIN ONLY) | [
"Allow",
"an",
"ADMIN",
"to",
"add",
"a",
"new",
"tutor",
"(",
"ADMIN",
"ONLY",
")"
] | [
"\"\"\"\n Allow an ADMIN to add a new tutor (ADMIN ONLY)\n\n Raises:\n AccessError: [non-admin permissions]\n InputError: [invalid u_id]\n InputError: [invalid tutor_id]\n InputError: [invalid first or last names]\n InputError: [invalid rate_id]\n InputError: [invalid... | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "AccessError"
},
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "InputError"
},
{
"docstring": null,
"docstring_toke... |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorPayrate | <not_specific> | def tutorPayrate():
"""
Retrieves a tutor's payrate
Returns:
dictionary
"""
myDb, myCursor = dbConnect()
data = request.args
res = getTutorPayrate(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"rate": res}) |
Retrieves a tutor's payrate
Returns:
dictionary
| Retrieves a tutor's payrate | [
"Retrieves",
"a",
"tutor",
"'",
"s",
"payrate"
] | def tutorPayrate():
myDb, myCursor = dbConnect()
data = request.args
res = getTutorPayrate(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"rate": res}) | [
"def",
"tutorPayrate",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"args",
"res",
"=",
"getTutorPayrate",
"(",
"myCursor",
",",
"data",
"[",
"\"u_id\"",
"]",
")",
"dbDisconnect",
"(",
"myCursor",
",",
... | Retrieves a tutor's payrate | [
"Retrieves",
"a",
"tutor",
"'",
"s",
"payrate"
] | [
"\"\"\"\n Retrieves a tutor's payrate \n\n Returns:\n dictionary\n \"\"\""
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorClasses | <not_specific> | def tutorClasses():
"""
Retrieves data about all the classes taught by a tutor
Returns: dictionary of list of lists
"""
myDb, myCursor = dbConnect()
data = request.args
res = getTutorClasses(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"classes": res}) |
Retrieves data about all the classes taught by a tutor
Returns: dictionary of list of lists
| Retrieves data about all the classes taught by a tutor
Returns: dictionary of list of lists | [
"Retrieves",
"data",
"about",
"all",
"the",
"classes",
"taught",
"by",
"a",
"tutor",
"Returns",
":",
"dictionary",
"of",
"list",
"of",
"lists"
] | def tutorClasses():
myDb, myCursor = dbConnect()
data = request.args
res = getTutorClasses(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"classes": res}) | [
"def",
"tutorClasses",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"args",
"res",
"=",
"getTutorClasses",
"(",
"myCursor",
",",
"data",
"[",
"\"u_id\"",
"]",
")",
"dbDisconnect",
"(",
"myCursor",
",",
... | Retrieves data about all the classes taught by a tutor
Returns: dictionary of list of lists | [
"Retrieves",
"data",
"about",
"all",
"the",
"classes",
"taught",
"by",
"a",
"tutor",
"Returns",
":",
"dictionary",
"of",
"list",
"of",
"lists"
] | [
"\"\"\"\n Retrieves data about all the classes taught by a tutor \n\n Returns: dictionary of list of lists\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorProfile | <not_specific> | def tutorProfile():
"""
Retrieves the first_name, last_name, email and start_date of a tutor
Returns: dictionary of a list
"""
myDb, myCursor = dbConnect()
data = request.args
res = getTutorProfile(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"profile": ... |
Retrieves the first_name, last_name, email and start_date of a tutor
Returns: dictionary of a list
| Retrieves the first_name, last_name, email and start_date of a tutor
Returns: dictionary of a list | [
"Retrieves",
"the",
"first_name",
"last_name",
"email",
"and",
"start_date",
"of",
"a",
"tutor",
"Returns",
":",
"dictionary",
"of",
"a",
"list"
] | def tutorProfile():
myDb, myCursor = dbConnect()
data = request.args
res = getTutorProfile(myCursor, data["u_id"])
dbDisconnect(myCursor, myDb)
return dumps({"profile": res}) | [
"def",
"tutorProfile",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"args",
"res",
"=",
"getTutorProfile",
"(",
"myCursor",
",",
"data",
"[",
"\"u_id\"",
"]",
")",
"dbDisconnect",
"(",
"myCursor",
",",
... | Retrieves the first_name, last_name, email and start_date of a tutor
Returns: dictionary of a list | [
"Retrieves",
"the",
"first_name",
"last_name",
"email",
"and",
"start_date",
"of",
"a",
"tutor",
"Returns",
":",
"dictionary",
"of",
"a",
"list"
] | [
"\"\"\"\n Retrieves the first_name, last_name, email and start_date of a tutor\n\n Returns: dictionary of a list\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorUpdatePayrate | <not_specific> | def tutorUpdatePayrate(u_id):
"""
Allow a admin to update the payrate of a tutor (ADMIN ONLY)
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
UpdateTutorPayrate(myCursor, myDb, data["tutor_id"], data["rate_id"])
dbDisconnect(myCursor, myDb)
return dum... |
Allow a admin to update the payrate of a tutor (ADMIN ONLY)
Returns: none
| Allow a admin to update the payrate of a tutor (ADMIN ONLY)
Returns: none | [
"Allow",
"a",
"admin",
"to",
"update",
"the",
"payrate",
"of",
"a",
"tutor",
"(",
"ADMIN",
"ONLY",
")",
"Returns",
":",
"none"
] | def tutorUpdatePayrate(u_id):
myDb, myCursor = dbConnect()
data = request.get_json()
UpdateTutorPayrate(myCursor, myDb, data["tutor_id"], data["rate_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"tutorUpdatePayrate",
"(",
"u_id",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"UpdateTutorPayrate",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"\"tutor_id\"",
"]",
",",
"d... | Allow a admin to update the payrate of a tutor (ADMIN ONLY)
Returns: none | [
"Allow",
"a",
"admin",
"to",
"update",
"the",
"payrate",
"of",
"a",
"tutor",
"(",
"ADMIN",
"ONLY",
")",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow a admin to update the payrate of a tutor (ADMIN ONLY)\n\n Returns: none\n \"\"\""
] | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorFirstName | <not_specific> | def tutorFirstName():
"""
Allow a tutor to update their first name
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorFirstName(myCursor, myDb, data["first_name"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) |
Allow a tutor to update their first name
Returns: none
| Allow a tutor to update their first name
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"first",
"name",
"Returns",
":",
"none"
] | def tutorFirstName():
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorFirstName(myCursor, myDb, data["first_name"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"tutorFirstName",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"updateTutorFirstName",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"\"first_name\"",
"]",
",",
"data",
"[... | Allow a tutor to update their first name
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"first",
"name",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow a tutor to update their first name \n\n Returns: none\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorLastName | <not_specific> | def tutorLastName():
"""
Allow a tutor to update their last name
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorLastName(myCursor, myDb, data["last_name"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) |
Allow a tutor to update their last name
Returns: none
| Allow a tutor to update their last name
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"last",
"name",
"Returns",
":",
"none"
] | def tutorLastName():
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorLastName(myCursor, myDb, data["last_name"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"tutorLastName",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"updateTutorLastName",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"\"last_name\"",
"]",
",",
"data",
"[",
... | Allow a tutor to update their last name
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"last",
"name",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow a tutor to update their last name \n\n Returns: none\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | tutorEmail | <not_specific> | def tutorEmail():
"""
Allow a tutor to update their email
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorEmail(myCursor, myDb, data["email"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) |
Allow a tutor to update their email
Returns: none
| Allow a tutor to update their email
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"email",
"Returns",
":",
"none"
] | def tutorEmail():
myDb, myCursor = dbConnect()
data = request.get_json()
updateTutorEmail(myCursor, myDb, data["email"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"tutorEmail",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"updateTutorEmail",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"\"email\"",
"]",
",",
"data",
"[",
"\"tutor... | Allow a tutor to update their email
Returns: none | [
"Allow",
"a",
"tutor",
"to",
"update",
"their",
"email",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow a tutor to update their email \n\n Returns: none\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classNew | <not_specific> | def classNew(u_id):
"""
Allow an ADMIN to create a new class (ADMIN ONLY)
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
createNewClass(myCursor, myDb, data)
dbDisconnect(myCursor, myDb)
return dumps({}) |
Allow an ADMIN to create a new class (ADMIN ONLY)
Returns: none
| Allow an ADMIN to create a new class (ADMIN ONLY)
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"create",
"a",
"new",
"class",
"(",
"ADMIN",
"ONLY",
")",
"Returns",
":",
"none"
] | def classNew(u_id):
myDb, myCursor = dbConnect()
data = request.get_json()
createNewClass(myCursor, myDb, data)
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"classNew",
"(",
"u_id",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"createNewClass",
"(",
"myCursor",
",",
"myDb",
",",
"data",
")",
"dbDisconnect",
"(",
"myCursor",
",",
"m... | Allow an ADMIN to create a new class (ADMIN ONLY)
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"create",
"a",
"new",
"class",
"(",
"ADMIN",
"ONLY",
")",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow an ADMIN to create a new class (ADMIN ONLY)\n\n Returns: none\n \"\"\""
] | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classCapacity | <not_specific> | def classCapacity():
"""
Retrieves the current capacity of a class
Returns: dictionary of an integer
"""
myDb, myCursor = dbConnect()
data = request.args
res = getClassCap(myCursor, data["class_id"])
dbDisconnect(myCursor, myDb)
return dumps({"class_capacity": res}) |
Retrieves the current capacity of a class
Returns: dictionary of an integer
| Retrieves the current capacity of a class
Returns: dictionary of an integer | [
"Retrieves",
"the",
"current",
"capacity",
"of",
"a",
"class",
"Returns",
":",
"dictionary",
"of",
"an",
"integer"
] | def classCapacity():
myDb, myCursor = dbConnect()
data = request.args
res = getClassCap(myCursor, data["class_id"])
dbDisconnect(myCursor, myDb)
return dumps({"class_capacity": res}) | [
"def",
"classCapacity",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"args",
"res",
"=",
"getClassCap",
"(",
"myCursor",
",",
"data",
"[",
"\"class_id\"",
"]",
")",
"dbDisconnect",
"(",
"myCursor",
",",... | Retrieves the current capacity of a class
Returns: dictionary of an integer | [
"Retrieves",
"the",
"current",
"capacity",
"of",
"a",
"class",
"Returns",
":",
"dictionary",
"of",
"an",
"integer"
] | [
"\"\"\"\n Retrieves the current capacity of a class\n\n Returns: dictionary of an integer\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classRemove | <not_specific> | def classRemove():
"""
Allow an ADMIN to remove a class and subsequently remove all students from the class in the terms table
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
print(data, "hello")
RemoveClass(myCursor, myDb, data["class_id"])
dbDisc... |
Allow an ADMIN to remove a class and subsequently remove all students from the class in the terms table
Returns: none
| Allow an ADMIN to remove a class and subsequently remove all students from the class in the terms table
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"remove",
"a",
"class",
"and",
"subsequently",
"remove",
"all",
"students",
"from",
"the",
"class",
"in",
"the",
"terms",
"table",
"Returns",
":",
"none"
] | def classRemove():
myDb, myCursor = dbConnect()
data = request.get_json()
print(data, "hello")
RemoveClass(myCursor, myDb, data["class_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"classRemove",
"(",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"print",
"(",
"data",
",",
"\"hello\"",
")",
"RemoveClass",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"... | Allow an ADMIN to remove a class and subsequently remove all students from the class in the terms table
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"remove",
"a",
"class",
"and",
"subsequently",
"remove",
"all",
"students",
"from",
"the",
"class",
"in",
"the",
"terms",
"table",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow an ADMIN to remove a class and subsequently remove all students from the class in the terms table \n\n Returns: none\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classUpdateTutor | <not_specific> | def classUpdateTutor(u_id):
"""
Allow an ADMIN to update the tutor of a class
Returns: none
"""
myDb, myCursor = dbConnect()
data = request.get_json()
updateClassTutor(myCursor, myDb, data["class_id"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) |
Allow an ADMIN to update the tutor of a class
Returns: none
| Allow an ADMIN to update the tutor of a class
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"tutor",
"of",
"a",
"class",
"Returns",
":",
"none"
] | def classUpdateTutor(u_id):
myDb, myCursor = dbConnect()
data = request.get_json()
updateClassTutor(myCursor, myDb, data["class_id"], data["tutor_id"])
dbDisconnect(myCursor, myDb)
return dumps({}) | [
"def",
"classUpdateTutor",
"(",
"u_id",
")",
":",
"myDb",
",",
"myCursor",
"=",
"dbConnect",
"(",
")",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"updateClassTutor",
"(",
"myCursor",
",",
"myDb",
",",
"data",
"[",
"\"class_id\"",
"]",
",",
"data"... | Allow an ADMIN to update the tutor of a class
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"tutor",
"of",
"a",
"class",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow an ADMIN to update the tutor of a class\n\n Returns: none\n \"\"\""
] | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classUpdateDay | <not_specific> | def classUpdateDay(u_id):
"""
Allow an ADMIN to update the day of a class
Returns: none
"""
data = request.get_json()
if not validateWeekday(data["day"]):
raise InputError(description = "weekday is not of correct format")
myDb, myCursor = dbConnect()
updateClassDay(myCursor... |
Allow an ADMIN to update the day of a class
Returns: none
| Allow an ADMIN to update the day of a class
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"day",
"of",
"a",
"class",
"Returns",
":",
"none"
] | def classUpdateDay(u_id):
data = request.get_json()
if not validateWeekday(data["day"]):
raise InputError(description = "weekday is not of correct format")
myDb, myCursor = dbConnect()
updateClassDay(myCursor, myDb, data["class_id"], data["day"])
dbDisconnect(myCursor, myDb)
return dumps... | [
"def",
"classUpdateDay",
"(",
"u_id",
")",
":",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"if",
"not",
"validateWeekday",
"(",
"data",
"[",
"\"day\"",
"]",
")",
":",
"raise",
"InputError",
"(",
"description",
"=",
"\"weekday is not of correct format\"... | Allow an ADMIN to update the day of a class
Returns: none | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"day",
"of",
"a",
"class",
"Returns",
":",
"none"
] | [
"\"\"\"\n Allow an ADMIN to update the day of a class\n\n Returns: none\n \"\"\""
] | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5dad55b91ed4c77c7ed17c7534a8386b4b86ad11 | matth3wliuu/trackMe | trackMe-backend/src/server.py | [
"MIT"
] | Python | classUpdateTime | <not_specific> | def classUpdateTime(u_id):
"""
Allow an ADMIN to update the start time of a class
"""
data = request.get_json()
if not validateTime(data["start_time"]):
raise InputError(description = "start_time is of incorrect format")
myDb, myCursor = dbConnect()
updateClassStartTime(myCursor... |
Allow an ADMIN to update the start time of a class
| Allow an ADMIN to update the start time of a class | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"start",
"time",
"of",
"a",
"class"
] | def classUpdateTime(u_id):
data = request.get_json()
if not validateTime(data["start_time"]):
raise InputError(description = "start_time is of incorrect format")
myDb, myCursor = dbConnect()
updateClassStartTime(myCursor, myDb, data["class_id"], data["start_time"])
dbDisconnect(myCursor, myD... | [
"def",
"classUpdateTime",
"(",
"u_id",
")",
":",
"data",
"=",
"request",
".",
"get_json",
"(",
")",
"if",
"not",
"validateTime",
"(",
"data",
"[",
"\"start_time\"",
"]",
")",
":",
"raise",
"InputError",
"(",
"description",
"=",
"\"start_time is of incorrect fo... | Allow an ADMIN to update the start time of a class | [
"Allow",
"an",
"ADMIN",
"to",
"update",
"the",
"start",
"time",
"of",
"a",
"class"
] | [
"\"\"\"\n Allow an ADMIN to update the start time of a class\n \"\"\""
] | [
{
"param": "u_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
194457927c6c8b79ae2c92ff2d0d7c77ab59e540 | kavorite/lopq | spark/example_udf.py | [
"Apache-2.0"
] | Python | udf | <not_specific> | def udf(sc, data_path, sampling_ratio, seed):
"""
This is an example UDF function to load training data. It loads data from a text file
with base64-encoded pickled numpy arrays on each line.
"""
# Compute the number of cores in our cluster - used below to heuristically set the number of partitions
... |
This is an example UDF function to load training data. It loads data from a text file
with base64-encoded pickled numpy arrays on each line.
| This is an example UDF function to load training data. It loads data from a text file
with base64-encoded pickled numpy arrays on each line. | [
"This",
"is",
"an",
"example",
"UDF",
"function",
"to",
"load",
"training",
"data",
".",
"It",
"loads",
"data",
"from",
"a",
"text",
"file",
"with",
"base64",
"-",
"encoded",
"pickled",
"numpy",
"arrays",
"on",
"each",
"line",
"."
] | def udf(sc, data_path, sampling_ratio, seed):
total_cores = int(sc._conf.get('spark.executor.instances')) * int(sc._conf.get('spark.executor.cores'))
d = sc.textFile(data_path, total_cores * 3).sample(False, sampling_ratio, seed)
deserialize_vec = lambda s: pkl.loads(base64.decodestring(s))
vecs = d.map... | [
"def",
"udf",
"(",
"sc",
",",
"data_path",
",",
"sampling_ratio",
",",
"seed",
")",
":",
"total_cores",
"=",
"int",
"(",
"sc",
".",
"_conf",
".",
"get",
"(",
"'spark.executor.instances'",
")",
")",
"*",
"int",
"(",
"sc",
".",
"_conf",
".",
"get",
"("... | This is an example UDF function to load training data. | [
"This",
"is",
"an",
"example",
"UDF",
"function",
"to",
"load",
"training",
"data",
"."
] | [
"\"\"\"\n This is an example UDF function to load training data. It loads data from a text file\n with base64-encoded pickled numpy arrays on each line.\n \"\"\"",
"# Compute the number of cores in our cluster - used below to heuristically set the number of partitions",
"# Load and sample down the data... | [
{
"param": "sc",
"type": null
},
{
"param": "data_path",
"type": null
},
{
"param": "sampling_ratio",
"type": null
},
{
"param": "seed",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_path",
"type": null,
"docstring": null,
"docstring_tokens"... |
96832d0b6312e11226c4ae7633b2f7fc97d3b3ed | kavorite/lopq | python/test/tests.py | [
"Apache-2.0"
] | Python | searcher_instance_battery | null | def searcher_instance_battery(searcher, q):
"""
Helper to perform battery of searcher tests.
"""
retrieved, visited = searcher.get_result_quota(q)
assert_equal(len(retrieved), 12)
assert_equal(visited, 3)
retrieved, visited = searcher.search(q)
assert_equal(len(retrieved), 10)
asser... |
Helper to perform battery of searcher tests.
| Helper to perform battery of searcher tests. | [
"Helper",
"to",
"perform",
"battery",
"of",
"searcher",
"tests",
"."
] | def searcher_instance_battery(searcher, q):
retrieved, visited = searcher.get_result_quota(q)
assert_equal(len(retrieved), 12)
assert_equal(visited, 3)
retrieved, visited = searcher.search(q)
assert_equal(len(retrieved), 10)
assert_equal(visited, 3)
retrieved, visited = searcher.get_result_q... | [
"def",
"searcher_instance_battery",
"(",
"searcher",
",",
"q",
")",
":",
"retrieved",
",",
"visited",
"=",
"searcher",
".",
"get_result_quota",
"(",
"q",
")",
"assert_equal",
"(",
"len",
"(",
"retrieved",
")",
",",
"12",
")",
"assert_equal",
"(",
"visited",
... | Helper to perform battery of searcher tests. | [
"Helper",
"to",
"perform",
"battery",
"of",
"searcher",
"tests",
"."
] | [
"\"\"\"\n Helper to perform battery of searcher tests.\n \"\"\""
] | [
{
"param": "searcher",
"type": null
},
{
"param": "q",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "searcher",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "q",
"type": null,
"docstring": null,
"docstring_tokens": ... |
02b21e8d40f0275049d857a0cb4f797b4c3461d5 | kavorite/lopq | scripts/example.py | [
"Apache-2.0"
] | Python | main | null | def main():
"""
A brief demo script showing how to train various LOPQ models with brief
discussion of trade offs.
"""
# Get the oxford dataset
data = load_oxford_data()
# Compute PCA of oxford dataset. See README in data/oxford for details
# about this dataset.
P, mu = pca(data)
... |
A brief demo script showing how to train various LOPQ models with brief
discussion of trade offs.
| A brief demo script showing how to train various LOPQ models with brief
discussion of trade offs. | [
"A",
"brief",
"demo",
"script",
"showing",
"how",
"to",
"train",
"various",
"LOPQ",
"models",
"with",
"brief",
"discussion",
"of",
"trade",
"offs",
"."
] | def main():
data = load_oxford_data()
P, mu = pca(data)
data = data - mu
data = np.dot(data, P)
train, test = train_test_split(data, test_size=0.2)
nns = compute_all_neighbors(test, train)
m = LOPQModel(V=16, M=8)
m.fit(train, n_init=1)
searcher = LOPQSearcher(m)
searcher.add_dat... | [
"def",
"main",
"(",
")",
":",
"data",
"=",
"load_oxford_data",
"(",
")",
"P",
",",
"mu",
"=",
"pca",
"(",
"data",
")",
"data",
"=",
"data",
"-",
"mu",
"data",
"=",
"np",
".",
"dot",
"(",
"data",
",",
"P",
")",
"train",
",",
"test",
"=",
"trai... | A brief demo script showing how to train various LOPQ models with brief
discussion of trade offs. | [
"A",
"brief",
"demo",
"script",
"showing",
"how",
"to",
"train",
"various",
"LOPQ",
"models",
"with",
"brief",
"discussion",
"of",
"trade",
"offs",
"."
] | [
"\"\"\"\n A brief demo script showing how to train various LOPQ models with brief\n discussion of trade offs.\n \"\"\"",
"# Get the oxford dataset",
"# Compute PCA of oxford dataset. See README in data/oxford for details",
"# about this dataset.",
"# Mean center and rotate the data; includes dimens... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2031cd64e7ef31f433abe99c489b78f1e0b765e2 | IAL32/pso-cancer-evolution | Helper.py | [
"MIT"
] | Python | max_phylogeny_mutations | <not_specific> | def max_phylogeny_mutations(self):
"""
As of now, we are using the sum of the number of mutations of the
phylogeny in order to calculate the distance.
This number is can be between the range: [m; (m(m + 1)) / 2]
The first is given in the case we have the following... |
As of now, we are using the sum of the number of mutations of the
phylogeny in order to calculate the distance.
This number is can be between the range: [m; (m(m + 1)) / 2]
The first is given in the case we have the following case:
/-a
|
... | As of now, we are using the sum of the number of mutations of the
phylogeny in order to calculate the distance. | [
"As",
"of",
"now",
"we",
"are",
"using",
"the",
"sum",
"of",
"the",
"number",
"of",
"mutations",
"of",
"the",
"phylogeny",
"in",
"order",
"to",
"calculate",
"the",
"distance",
"."
] | def max_phylogeny_mutations(self):
return (self.mutations * (self.mutations + 1)) / 2 | [
"def",
"max_phylogeny_mutations",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"mutations",
"*",
"(",
"self",
".",
"mutations",
"+",
"1",
")",
")",
"/",
"2"
] | As of now, we are using the sum of the number of mutations of the
phylogeny in order to calculate the distance. | [
"As",
"of",
"now",
"we",
"are",
"using",
"the",
"sum",
"of",
"the",
"number",
"of",
"mutations",
"of",
"the",
"phylogeny",
"in",
"order",
"to",
"calculate",
"the",
"distance",
"."
] | [
"\"\"\"\n As of now, we are using the sum of the number of mutations of the\n phylogeny in order to calculate the distance.\n This number is can be between the range: [m; (m(m + 1)) / 2]\n The first is given in the case we have the following case:\n /-a\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
788eadf029cc0ccb9e27374f035a04392c4d0010 | IAL32/pso-cancer-evolution | Tree.py | [
"MIT"
] | Python | greedy_loglikelihood | <not_specific> | def greedy_loglikelihood(cls, helper, tree, data=None):
"Gets maximum likelihood of a tree"
nodes_list = tree.phylogeny.get_cached_content()
node_genotypes = [
[0 for j in range(helper.mutations)]
for i in range(len(nodes_list))
]
for i, n in enumerate(no... | Gets maximum likelihood of a tree | Gets maximum likelihood of a tree | [
"Gets",
"maximum",
"likelihood",
"of",
"a",
"tree"
] | def greedy_loglikelihood(cls, helper, tree, data=None):
nodes_list = tree.phylogeny.get_cached_content()
node_genotypes = [
[0 for j in range(helper.mutations)]
for i in range(len(nodes_list))
]
for i, n in enumerate(nodes_list):
n.get_genotype_profile... | [
"def",
"greedy_loglikelihood",
"(",
"cls",
",",
"helper",
",",
"tree",
",",
"data",
"=",
"None",
")",
":",
"nodes_list",
"=",
"tree",
".",
"phylogeny",
".",
"get_cached_content",
"(",
")",
"node_genotypes",
"=",
"[",
"[",
"0",
"for",
"j",
"in",
"range",
... | Gets maximum likelihood of a tree | [
"Gets",
"maximum",
"likelihood",
"of",
"a",
"tree"
] | [
"\"Gets maximum likelihood of a tree\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "helper",
"type": null
},
{
"param": "tree",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "helper",
"type": null,
"docstring": null,
"docstring_tokens": ... |
6eab1a6c89b2c3497c506d020458d553d4c5a8b2 | IAL32/pso-cancer-evolution | Data.py | [
"MIT"
] | Python | average_iteration_time | <not_specific> | def average_iteration_time(self):
"""
Returns the average time for every iteration
"""
sum = 0
for t in self.iteration_times:
sum += t
return t / self.iterations |
Returns the average time for every iteration
| Returns the average time for every iteration | [
"Returns",
"the",
"average",
"time",
"for",
"every",
"iteration"
] | def average_iteration_time(self):
sum = 0
for t in self.iteration_times:
sum += t
return t / self.iterations | [
"def",
"average_iteration_time",
"(",
"self",
")",
":",
"sum",
"=",
"0",
"for",
"t",
"in",
"self",
".",
"iteration_times",
":",
"sum",
"+=",
"t",
"return",
"t",
"/",
"self",
".",
"iterations"
] | Returns the average time for every iteration | [
"Returns",
"the",
"average",
"time",
"for",
"every",
"iteration"
] | [
"\"\"\"\n Returns the average time for every iteration\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6eab1a6c89b2c3497c506d020458d553d4c5a8b2 | IAL32/pso-cancer-evolution | Data.py | [
"MIT"
] | Python | average_particle_time | <not_specific> | def average_particle_time(self):
"""
For each particle, return the average time
that particle has taken to complete its step
"""
sums = [0] * self.nofparticles
for i in range(self.nofparticles):
for j in range(self.iterations):
sums[i]... |
For each particle, return the average time
that particle has taken to complete its step
| For each particle, return the average time
that particle has taken to complete its step | [
"For",
"each",
"particle",
"return",
"the",
"average",
"time",
"that",
"particle",
"has",
"taken",
"to",
"complete",
"its",
"step"
] | def average_particle_time(self):
sums = [0] * self.nofparticles
for i in range(self.nofparticles):
for j in range(self.iterations):
sums[i] += self.particle_iteration_times[i][j]
averages = [0] * self.nofparticles
for p, s in enumerate(sums):
avera... | [
"def",
"average_particle_time",
"(",
"self",
")",
":",
"sums",
"=",
"[",
"0",
"]",
"*",
"self",
".",
"nofparticles",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nofparticles",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"iterations",
")"... | For each particle, return the average time
that particle has taken to complete its step | [
"For",
"each",
"particle",
"return",
"the",
"average",
"time",
"that",
"particle",
"has",
"taken",
"to",
"complete",
"its",
"step"
] | [
"\"\"\"\n For each particle, return the average time\n that particle has taken to complete its step\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | is_loss_valid | <not_specific> | def is_loss_valid(self, mutation_id=None):
""" Checks if current node mutation is valid up until the root node """
if mutation_id is None:
mutation_id = self.mutation_id
for par in self.iter_ancestors():
if par.mutation_id == mutation_id:
return True
... | Checks if current node mutation is valid up until the root node | Checks if current node mutation is valid up until the root node | [
"Checks",
"if",
"current",
"node",
"mutation",
"is",
"valid",
"up",
"until",
"the",
"root",
"node"
] | def is_loss_valid(self, mutation_id=None):
if mutation_id is None:
mutation_id = self.mutation_id
for par in self.iter_ancestors():
if par.mutation_id == mutation_id:
return True
return False | [
"def",
"is_loss_valid",
"(",
"self",
",",
"mutation_id",
"=",
"None",
")",
":",
"if",
"mutation_id",
"is",
"None",
":",
"mutation_id",
"=",
"self",
".",
"mutation_id",
"for",
"par",
"in",
"self",
".",
"iter_ancestors",
"(",
")",
":",
"if",
"par",
".",
... | Checks if current node mutation is valid up until the root node | [
"Checks",
"if",
"current",
"node",
"mutation",
"is",
"valid",
"up",
"until",
"the",
"root",
"node"
] | [
"\"\"\" Checks if current node mutation is valid up until the root node \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mutation_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mutation_id",
"type": null,
"docstring": null,
"docstring_tok... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | is_mutation_already_lost | <not_specific> | def is_mutation_already_lost(self, mutation_id, k=3):
"""
Checks if mutation is already lost in the current tree
"""
for par in self.iter_ancestors():
if par.loss and par.mutation_id == mutation_id:
return True
return False |
Checks if mutation is already lost in the current tree
| Checks if mutation is already lost in the current tree | [
"Checks",
"if",
"mutation",
"is",
"already",
"lost",
"in",
"the",
"current",
"tree"
] | def is_mutation_already_lost(self, mutation_id, k=3):
for par in self.iter_ancestors():
if par.loss and par.mutation_id == mutation_id:
return True
return False | [
"def",
"is_mutation_already_lost",
"(",
"self",
",",
"mutation_id",
",",
"k",
"=",
"3",
")",
":",
"for",
"par",
"in",
"self",
".",
"iter_ancestors",
"(",
")",
":",
"if",
"par",
".",
"loss",
"and",
"par",
".",
"mutation_id",
"==",
"mutation_id",
":",
"r... | Checks if mutation is already lost in the current tree | [
"Checks",
"if",
"mutation",
"is",
"already",
"lost",
"in",
"the",
"current",
"tree"
] | [
"\"\"\"\n Checks if mutation is already lost in the current tree\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mutation_id",
"type": null
},
{
"param": "k",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mutation_id",
"type": null,
"docstring": null,
"docstring_tok... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | swap | null | def swap(self, node):
""" Switch this data with with that of another node """
tmp_node = Node(self.name, None, self.mutation_id, self.loss)
self.copy_from(node)
node.copy_from(tmp_node) | Switch this data with with that of another node | Switch this data with with that of another node | [
"Switch",
"this",
"data",
"with",
"with",
"that",
"of",
"another",
"node"
] | def swap(self, node):
tmp_node = Node(self.name, None, self.mutation_id, self.loss)
self.copy_from(node)
node.copy_from(tmp_node) | [
"def",
"swap",
"(",
"self",
",",
"node",
")",
":",
"tmp_node",
"=",
"Node",
"(",
"self",
".",
"name",
",",
"None",
",",
"self",
".",
"mutation_id",
",",
"self",
".",
"loss",
")",
"self",
".",
"copy_from",
"(",
"node",
")",
"node",
".",
"copy_from",... | Switch this data with with that of another node | [
"Switch",
"this",
"data",
"with",
"with",
"that",
"of",
"another",
"node"
] | [
"\"\"\" Switch this data with with that of another node \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | _get_parent_at_height | <not_specific> | def _get_parent_at_height(self, height=1):
" Support function that returns the parent node at the desired height "
par = self.up
climb = 0
while (par is not None and climb < height):
climb += 1
par = par.up
return par | Support function that returns the parent node at the desired height | Support function that returns the parent node at the desired height | [
"Support",
"function",
"that",
"returns",
"the",
"parent",
"node",
"at",
"the",
"desired",
"height"
] | def _get_parent_at_height(self, height=1):
par = self.up
climb = 0
while (par is not None and climb < height):
climb += 1
par = par.up
return par | [
"def",
"_get_parent_at_height",
"(",
"self",
",",
"height",
"=",
"1",
")",
":",
"par",
"=",
"self",
".",
"up",
"climb",
"=",
"0",
"while",
"(",
"par",
"is",
"not",
"None",
"and",
"climb",
"<",
"height",
")",
":",
"climb",
"+=",
"1",
"par",
"=",
"... | Support function that returns the parent node at the desired height | [
"Support",
"function",
"that",
"returns",
"the",
"parent",
"node",
"at",
"the",
"desired",
"height"
] | [
"\" Support function that returns the parent node at the desired height \""
] | [
{
"param": "self",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": null,
"docstring": null,
"docstring_tokens":... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | back_mutation_ancestry | <not_specific> | def back_mutation_ancestry(self):
"""
Returns a list of nodes representing where a back mutation
happened. Mostly used to know where NOT to cut.
"""
back_mutations = []
for p in self.iter_ancestors():
if p.loss:
back_mutations.append(p)... |
Returns a list of nodes representing where a back mutation
happened. Mostly used to know where NOT to cut.
| Returns a list of nodes representing where a back mutation
happened. Mostly used to know where NOT to cut. | [
"Returns",
"a",
"list",
"of",
"nodes",
"representing",
"where",
"a",
"back",
"mutation",
"happened",
".",
"Mostly",
"used",
"to",
"know",
"where",
"NOT",
"to",
"cut",
"."
] | def back_mutation_ancestry(self):
back_mutations = []
for p in self.iter_ancestors():
if p.loss:
back_mutations.append(p)
return back_mutations | [
"def",
"back_mutation_ancestry",
"(",
"self",
")",
":",
"back_mutations",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"iter_ancestors",
"(",
")",
":",
"if",
"p",
".",
"loss",
":",
"back_mutations",
".",
"append",
"(",
"p",
")",
"return",
"back_mutation... | Returns a list of nodes representing where a back mutation
happened. | [
"Returns",
"a",
"list",
"of",
"nodes",
"representing",
"where",
"a",
"back",
"mutation",
"happened",
"."
] | [
"\"\"\"\n Returns a list of nodes representing where a back mutation\n happened. Mostly used to know where NOT to cut.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | attach_clade | null | def attach_clade(self, helper, tree, clade):
"Remove every node already in clade"
root = self.get_tree_root()
nodes_list = root.get_cached_content()
# clade.fix_for_losses(helper, tree, delete_only=True)
clade_nodes = clade.get_cached_content()
clade_to_attach = self
... | Remove every node already in clade | Remove every node already in clade | [
"Remove",
"every",
"node",
"already",
"in",
"clade"
] | def attach_clade(self, helper, tree, clade):
root = self.get_tree_root()
nodes_list = root.get_cached_content()
clade_nodes = clade.get_cached_content()
clade_to_attach = self
for cln in clade_nodes:
removed = []
if cln.loss:
if clade_to_at... | [
"def",
"attach_clade",
"(",
"self",
",",
"helper",
",",
"tree",
",",
"clade",
")",
":",
"root",
"=",
"self",
".",
"get_tree_root",
"(",
")",
"nodes_list",
"=",
"root",
".",
"get_cached_content",
"(",
")",
"clade_nodes",
"=",
"clade",
".",
"get_cached_conte... | Remove every node already in clade | [
"Remove",
"every",
"node",
"already",
"in",
"clade"
] | [
"\"Remove every node already in clade\"",
"# clade.fix_for_losses(helper, tree, delete_only=True)",
"# moving up"
] | [
{
"param": "self",
"type": null
},
{
"param": "helper",
"type": null
},
{
"param": "tree",
"type": null
},
{
"param": "clade",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "helper",
"type": null,
"docstring": null,
"docstring_tokens":... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | attach_clade_and_fix | null | def attach_clade_and_fix(self, helper, tree, clade):
"""
Attaches a clade to the phylogeny tree and fixes everything
"""
for n in clade.traverse():
if not tree.k_losses_list[n.mutation_id] <= helper.k:
n.delete(prevent_nondicotomic=False)
self.attach_c... |
Attaches a clade to the phylogeny tree and fixes everything
| Attaches a clade to the phylogeny tree and fixes everything | [
"Attaches",
"a",
"clade",
"to",
"the",
"phylogeny",
"tree",
"and",
"fixes",
"everything"
] | def attach_clade_and_fix(self, helper, tree, clade):
for n in clade.traverse():
if not tree.k_losses_list[n.mutation_id] <= helper.k:
n.delete(prevent_nondicotomic=False)
self.attach_clade(helper, tree, clade)
self.fix_for_losses(helper, tree) | [
"def",
"attach_clade_and_fix",
"(",
"self",
",",
"helper",
",",
"tree",
",",
"clade",
")",
":",
"for",
"n",
"in",
"clade",
".",
"traverse",
"(",
")",
":",
"if",
"not",
"tree",
".",
"k_losses_list",
"[",
"n",
".",
"mutation_id",
"]",
"<=",
"helper",
"... | Attaches a clade to the phylogeny tree and fixes everything | [
"Attaches",
"a",
"clade",
"to",
"the",
"phylogeny",
"tree",
"and",
"fixes",
"everything"
] | [
"\"\"\"\n Attaches a clade to the phylogeny tree and fixes everything\n \"\"\"",
"# self.check_integrity()"
] | [
{
"param": "self",
"type": null
},
{
"param": "helper",
"type": null
},
{
"param": "tree",
"type": null
},
{
"param": "clade",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "helper",
"type": null,
"docstring": null,
"docstring_tokens":... |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | _to_json_children | <not_specific> | def _to_json_children(self):
"""
Support function for printing the json tree
"""
node = {"name": self.name, "uid": self.uid, "loss": self.loss, "children": []}
for n in self.children:
node["children"].append(n._to_json_children())
return node |
Support function for printing the json tree
| Support function for printing the json tree | [
"Support",
"function",
"for",
"printing",
"the",
"json",
"tree"
] | def _to_json_children(self):
node = {"name": self.name, "uid": self.uid, "loss": self.loss, "children": []}
for n in self.children:
node["children"].append(n._to_json_children())
return node | [
"def",
"_to_json_children",
"(",
"self",
")",
":",
"node",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"uid\"",
":",
"self",
".",
"uid",
",",
"\"loss\"",
":",
"self",
".",
"loss",
",",
"\"children\"",
":",
"[",
"]",
"}",
"for",
"n",
"in"... | Support function for printing the json tree | [
"Support",
"function",
"for",
"printing",
"the",
"json",
"tree"
] | [
"\"\"\"\n Support function for printing the json tree\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
39862400a3714dc638333eb57c57aaba6581fca1 | IAL32/pso-cancer-evolution | Node.py | [
"MIT"
] | Python | to_json | <not_specific> | def to_json(self):
"""
Returns a json string representing the current tree
"""
node = {"name": self.name, "uid": self.uid, "loss": self.loss, "root": True, "children": []}
for n in self.children:
node["children"].append(n._to_json_children())
return json.d... |
Returns a json string representing the current tree
| Returns a json string representing the current tree | [
"Returns",
"a",
"json",
"string",
"representing",
"the",
"current",
"tree"
] | def to_json(self):
node = {"name": self.name, "uid": self.uid, "loss": self.loss, "root": True, "children": []}
for n in self.children:
node["children"].append(n._to_json_children())
return json.dumps(node, indent=4) | [
"def",
"to_json",
"(",
"self",
")",
":",
"node",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"uid\"",
":",
"self",
".",
"uid",
",",
"\"loss\"",
":",
"self",
".",
"loss",
",",
"\"root\"",
":",
"True",
",",
"\"children\"",
":",
"[",
"]",
... | Returns a json string representing the current tree | [
"Returns",
"a",
"json",
"string",
"representing",
"the",
"current",
"tree"
] | [
"\"\"\"\n Returns a json string representing the current tree\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | race | <not_specific> | def race():
'''Route to race management page.'''
frequencies = [node.frequency for node in INTERFACE.nodes]
nodes = []
for idx, freq in enumerate(frequencies):
if freq:
nodes.append({
'freq': freq,
'index': idx
})
return render_templat... | Route to race management page. | Route to race management page. | [
"Route",
"to",
"race",
"management",
"page",
"."
] | def race():
frequencies = [node.frequency for node in INTERFACE.nodes]
nodes = []
for idx, freq in enumerate(frequencies):
if freq:
nodes.append({
'freq': freq,
'index': idx
})
return render_template('race.html', serverInfo=serverInfo, getO... | [
"def",
"race",
"(",
")",
":",
"frequencies",
"=",
"[",
"node",
".",
"frequency",
"for",
"node",
"in",
"INTERFACE",
".",
"nodes",
"]",
"nodes",
"=",
"[",
"]",
"for",
"idx",
",",
"freq",
"in",
"enumerate",
"(",
"frequencies",
")",
":",
"if",
"freq",
... | Route to race management page. | [
"Route",
"to",
"race",
"management",
"page",
"."
] | [
"'''Route to race management page.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | racepublic | <not_specific> | def racepublic():
'''Route to race management page.'''
frequencies = [node.frequency for node in INTERFACE.nodes]
nodes = []
for idx, freq in enumerate(frequencies):
if freq:
nodes.append({
'freq': freq,
'index': idx
})
return render_t... | Route to race management page. | Route to race management page. | [
"Route",
"to",
"race",
"management",
"page",
"."
] | def racepublic():
frequencies = [node.frequency for node in INTERFACE.nodes]
nodes = []
for idx, freq in enumerate(frequencies):
if freq:
nodes.append({
'freq': freq,
'index': idx
})
return render_template('racepublic.html', serverInfo=serv... | [
"def",
"racepublic",
"(",
")",
":",
"frequencies",
"=",
"[",
"node",
".",
"frequency",
"for",
"node",
"in",
"INTERFACE",
".",
"nodes",
"]",
"nodes",
"=",
"[",
"]",
"for",
"idx",
",",
"freq",
"in",
"enumerate",
"(",
"frequencies",
")",
":",
"if",
"fre... | Route to race management page. | [
"Route",
"to",
"race",
"management",
"page",
"."
] | [
"'''Route to race management page.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | stream_node | <not_specific> | def stream_node(node_id):
'''Route to single node overlay for streaming.'''
if node_id <= RACE.num_nodes:
return render_template('streamnode.html', serverInfo=serverInfo, getOption=Options.get, __=__,
node_id=node_id-1
)
else:
return False | Route to single node overlay for streaming. | Route to single node overlay for streaming. | [
"Route",
"to",
"single",
"node",
"overlay",
"for",
"streaming",
"."
] | def stream_node(node_id):
if node_id <= RACE.num_nodes:
return render_template('streamnode.html', serverInfo=serverInfo, getOption=Options.get, __=__,
node_id=node_id-1
)
else:
return False | [
"def",
"stream_node",
"(",
"node_id",
")",
":",
"if",
"node_id",
"<=",
"RACE",
".",
"num_nodes",
":",
"return",
"render_template",
"(",
"'streamnode.html'",
",",
"serverInfo",
"=",
"serverInfo",
",",
"getOption",
"=",
"Options",
".",
"get",
",",
"__",
"=",
... | Route to single node overlay for streaming. | [
"Route",
"to",
"single",
"node",
"overlay",
"for",
"streaming",
"."
] | [
"'''Route to single node overlay for streaming.'''"
] | [
{
"param": "node_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | stream_class | <not_specific> | def stream_class(class_id):
'''Route to class leaderboard display for streaming.'''
return render_template('streamclass.html', serverInfo=serverInfo, getOption=Options.get, __=__,
class_id=class_id
) | Route to class leaderboard display for streaming. | Route to class leaderboard display for streaming. | [
"Route",
"to",
"class",
"leaderboard",
"display",
"for",
"streaming",
"."
] | def stream_class(class_id):
return render_template('streamclass.html', serverInfo=serverInfo, getOption=Options.get, __=__,
class_id=class_id
) | [
"def",
"stream_class",
"(",
"class_id",
")",
":",
"return",
"render_template",
"(",
"'streamclass.html'",
",",
"serverInfo",
"=",
"serverInfo",
",",
"getOption",
"=",
"Options",
".",
"get",
",",
"__",
"=",
"__",
",",
"class_id",
"=",
"class_id",
")"
] | Route to class leaderboard display for streaming. | [
"Route",
"to",
"class",
"leaderboard",
"display",
"for",
"streaming",
"."
] | [
"'''Route to class leaderboard display for streaming.'''"
] | [
{
"param": "class_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "class_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | stream_heat | <not_specific> | def stream_heat(heat_id):
'''Route to heat display for streaming.'''
return render_template('streamheat.html', serverInfo=serverInfo, getOption=Options.get, __=__,
num_nodes=RACE.num_nodes,
heat_id=heat_id
) | Route to heat display for streaming. | Route to heat display for streaming. | [
"Route",
"to",
"heat",
"display",
"for",
"streaming",
"."
] | def stream_heat(heat_id):
return render_template('streamheat.html', serverInfo=serverInfo, getOption=Options.get, __=__,
num_nodes=RACE.num_nodes,
heat_id=heat_id
) | [
"def",
"stream_heat",
"(",
"heat_id",
")",
":",
"return",
"render_template",
"(",
"'streamheat.html'",
",",
"serverInfo",
"=",
"serverInfo",
",",
"getOption",
"=",
"Options",
".",
"get",
",",
"__",
"=",
"__",
",",
"num_nodes",
"=",
"RACE",
".",
"num_nodes",
... | Route to heat display for streaming. | [
"Route",
"to",
"heat",
"display",
"for",
"streaming",
"."
] | [
"'''Route to heat display for streaming.'''"
] | [
{
"param": "heat_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "heat_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | connect_handler | null | def connect_handler():
'''Starts the interface and a heartbeat thread for rssi.'''
logger.debug('Client connected')
INTERFACE.start()
global HEARTBEAT_THREAD
if HEARTBEAT_THREAD is None:
HEARTBEAT_THREAD = gevent.spawn(heartbeat_thread_function)
logger.debug('Heartbeat thread started... | Starts the interface and a heartbeat thread for rssi. | Starts the interface and a heartbeat thread for rssi. | [
"Starts",
"the",
"interface",
"and",
"a",
"heartbeat",
"thread",
"for",
"rssi",
"."
] | def connect_handler():
logger.debug('Client connected')
INTERFACE.start()
global HEARTBEAT_THREAD
if HEARTBEAT_THREAD is None:
HEARTBEAT_THREAD = gevent.spawn(heartbeat_thread_function)
logger.debug('Heartbeat thread started')
emit_heat_data(nobroadcast=True) | [
"def",
"connect_handler",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"'Client connected'",
")",
"INTERFACE",
".",
"start",
"(",
")",
"global",
"HEARTBEAT_THREAD",
"if",
"HEARTBEAT_THREAD",
"is",
"None",
":",
"HEARTBEAT_THREAD",
"=",
"gevent",
".",
"spawn",
"(... | Starts the interface and a heartbeat thread for rssi. | [
"Starts",
"the",
"interface",
"and",
"a",
"heartbeat",
"thread",
"for",
"rssi",
"."
] | [
"'''Starts the interface and a heartbeat thread for rssi.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_load_data | null | def on_load_data(data):
'''Allow pages to load needed data'''
load_types = data['load_types']
for load_type in load_types:
if load_type == 'node_data':
emit_node_data(nobroadcast=True)
elif load_type == 'environmental_data':
emit_environmental_data(nobroadcast=True)
... | Allow pages to load needed data | Allow pages to load needed data | [
"Allow",
"pages",
"to",
"load",
"needed",
"data"
] | def on_load_data(data):
load_types = data['load_types']
for load_type in load_types:
if load_type == 'node_data':
emit_node_data(nobroadcast=True)
elif load_type == 'environmental_data':
emit_environmental_data(nobroadcast=True)
elif load_type == 'frequency_data':... | [
"def",
"on_load_data",
"(",
"data",
")",
":",
"load_types",
"=",
"data",
"[",
"'load_types'",
"]",
"for",
"load_type",
"in",
"load_types",
":",
"if",
"load_type",
"==",
"'node_data'",
":",
"emit_node_data",
"(",
"nobroadcast",
"=",
"True",
")",
"elif",
"load... | Allow pages to load needed data | [
"Allow",
"pages",
"to",
"load",
"needed",
"data"
] | [
"'''Allow pages to load needed data'''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | restore_node_frequency | null | def restore_node_frequency(node_index):
''' Restore frequency for given node index (update hardware) '''
gevent.sleep(0.250) # pause to get clear of heartbeat actions for scanner
profile = getCurrentProfile()
profile_freqs = json.loads(profile.frequencies)
freq = profile_freqs["f"][node_index]
... | Restore frequency for given node index (update hardware) | Restore frequency for given node index (update hardware) | [
"Restore",
"frequency",
"for",
"given",
"node",
"index",
"(",
"update",
"hardware",
")"
] | def restore_node_frequency(node_index):
gevent.sleep(0.250)
profile = getCurrentProfile()
profile_freqs = json.loads(profile.frequencies)
freq = profile_freqs["f"][node_index]
INTERFACE.set_frequency(node_index, freq)
logger.info('Frequency restored: Node {0} Frequency {1}'.format(node_index+1... | [
"def",
"restore_node_frequency",
"(",
"node_index",
")",
":",
"gevent",
".",
"sleep",
"(",
"0.250",
")",
"profile",
"=",
"getCurrentProfile",
"(",
")",
"profile_freqs",
"=",
"json",
".",
"loads",
"(",
"profile",
".",
"frequencies",
")",
"freq",
"=",
"profile... | Restore frequency for given node index (update hardware) | [
"Restore",
"frequency",
"for",
"given",
"node",
"index",
"(",
"update",
"hardware",
")"
] | [
"''' Restore frequency for given node index (update hardware) '''",
"# pause to get clear of heartbeat actions for scanner"
] | [
{
"param": "node_index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node_index",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_set_enter_at_level | null | def on_set_enter_at_level(data):
'''Set node enter-at level.'''
node_index = data['node']
enter_at_level = data['enter_at_level']
if not enter_at_level:
logger.info('Node enter-at set null; getting from node: Node {0}'.format(node_index+1))
enter_at_level = INTERFACE.nodes[node_index].e... | Set node enter-at level. | Set node enter-at level. | [
"Set",
"node",
"enter",
"-",
"at",
"level",
"."
] | def on_set_enter_at_level(data):
node_index = data['node']
enter_at_level = data['enter_at_level']
if not enter_at_level:
logger.info('Node enter-at set null; getting from node: Node {0}'.format(node_index+1))
enter_at_level = INTERFACE.nodes[node_index].enter_at_level
profile = getCurre... | [
"def",
"on_set_enter_at_level",
"(",
"data",
")",
":",
"node_index",
"=",
"data",
"[",
"'node'",
"]",
"enter_at_level",
"=",
"data",
"[",
"'enter_at_level'",
"]",
"if",
"not",
"enter_at_level",
":",
"logger",
".",
"info",
"(",
"'Node enter-at set null; getting fro... | Set node enter-at level. | [
"Set",
"node",
"enter",
"-",
"at",
"level",
"."
] | [
"'''Set node enter-at level.'''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_cap_enter_at_btn | null | def on_cap_enter_at_btn(data):
'''Capture enter-at level.'''
node_index = data['node_index']
if INTERFACE.start_capture_enter_at_level(node_index):
logger.info('Starting capture of enter-at level for node {0}'.format(node_index+1)) | Capture enter-at level. | Capture enter-at level. | [
"Capture",
"enter",
"-",
"at",
"level",
"."
] | def on_cap_enter_at_btn(data):
node_index = data['node_index']
if INTERFACE.start_capture_enter_at_level(node_index):
logger.info('Starting capture of enter-at level for node {0}'.format(node_index+1)) | [
"def",
"on_cap_enter_at_btn",
"(",
"data",
")",
":",
"node_index",
"=",
"data",
"[",
"'node_index'",
"]",
"if",
"INTERFACE",
".",
"start_capture_enter_at_level",
"(",
"node_index",
")",
":",
"logger",
".",
"info",
"(",
"'Starting capture of enter-at level for node {0}... | Capture enter-at level. | [
"Capture",
"enter",
"-",
"at",
"level",
"."
] | [
"'''Capture enter-at level.'''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_add_heat | null | def on_add_heat():
'''Adds the next available heat number to the database.'''
new_heat = Database.Heat(class_id=Database.CLASS_ID_NONE, cacheStatus=Results.CacheStatus.INVALID)
DB.session.add(new_heat)
DB.session.flush()
DB.session.refresh(new_heat)
for node in range(RACE.num_nodes): # Add next... | Adds the next available heat number to the database. | Adds the next available heat number to the database. | [
"Adds",
"the",
"next",
"available",
"heat",
"number",
"to",
"the",
"database",
"."
] | def on_add_heat():
new_heat = Database.Heat(class_id=Database.CLASS_ID_NONE, cacheStatus=Results.CacheStatus.INVALID)
DB.session.add(new_heat)
DB.session.flush()
DB.session.refresh(new_heat)
for node in range(RACE.num_nodes):
DB.session.add(Database.HeatNode(heat_id=new_heat.id, node_index=... | [
"def",
"on_add_heat",
"(",
")",
":",
"new_heat",
"=",
"Database",
".",
"Heat",
"(",
"class_id",
"=",
"Database",
".",
"CLASS_ID_NONE",
",",
"cacheStatus",
"=",
"Results",
".",
"CacheStatus",
".",
"INVALID",
")",
"DB",
".",
"session",
".",
"add",
"(",
"ne... | Adds the next available heat number to the database. | [
"Adds",
"the",
"next",
"available",
"heat",
"number",
"to",
"the",
"database",
"."
] | [
"'''Adds the next available heat number to the database.'''",
"# Add next heat with empty pilots"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | duplicate_heat | <not_specific> | def duplicate_heat(source, **kwargs):
'''Adds new heat by duplicating an existing one.'''
source_heat = Database.Heat.query.get(source)
if source_heat.note:
all_heat_notes = [heat.note for heat in Database.Heat.query.all()]
new_heat_note = uniqueName(source_heat.note, all_heat_notes)
el... | Adds new heat by duplicating an existing one. | Adds new heat by duplicating an existing one. | [
"Adds",
"new",
"heat",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | def duplicate_heat(source, **kwargs):
source_heat = Database.Heat.query.get(source)
if source_heat.note:
all_heat_notes = [heat.note for heat in Database.Heat.query.all()]
new_heat_note = uniqueName(source_heat.note, all_heat_notes)
else:
new_heat_note = ''
if 'dest_class' in kwa... | [
"def",
"duplicate_heat",
"(",
"source",
",",
"**",
"kwargs",
")",
":",
"source_heat",
"=",
"Database",
".",
"Heat",
".",
"query",
".",
"get",
"(",
"source",
")",
"if",
"source_heat",
".",
"note",
":",
"all_heat_notes",
"=",
"[",
"heat",
".",
"note",
"f... | Adds new heat by duplicating an existing one. | [
"Adds",
"new",
"heat",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | [
"'''Adds new heat by duplicating an existing one.'''"
] | [
{
"param": "source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_add_race_class | null | def on_add_race_class():
'''Adds the next available pilot id number in the database.'''
new_race_class = Database.RaceClass(name='New class', format_id=0, cacheStatus=Results.CacheStatus.INVALID)
DB.session.add(new_race_class)
DB.session.flush()
DB.session.refresh(new_race_class)
new_race_class.... | Adds the next available pilot id number in the database. | Adds the next available pilot id number in the database. | [
"Adds",
"the",
"next",
"available",
"pilot",
"id",
"number",
"in",
"the",
"database",
"."
] | def on_add_race_class():
new_race_class = Database.RaceClass(name='New class', format_id=0, cacheStatus=Results.CacheStatus.INVALID)
DB.session.add(new_race_class)
DB.session.flush()
DB.session.refresh(new_race_class)
new_race_class.name = ''
new_race_class.description = ''
DB.session.commit... | [
"def",
"on_add_race_class",
"(",
")",
":",
"new_race_class",
"=",
"Database",
".",
"RaceClass",
"(",
"name",
"=",
"'New class'",
",",
"format_id",
"=",
"0",
",",
"cacheStatus",
"=",
"Results",
".",
"CacheStatus",
".",
"INVALID",
")",
"DB",
".",
"session",
... | Adds the next available pilot id number in the database. | [
"Adds",
"the",
"next",
"available",
"pilot",
"id",
"number",
"in",
"the",
"database",
"."
] | [
"'''Adds the next available pilot id number in the database.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_duplicate_race_class | null | def on_duplicate_race_class(data):
'''Adds new race class by duplicating an existing one.'''
source_class_id = data['class']
source_class = Database.RaceClass.query.get(source_class_id)
if source_class.name:
all_class_names = [race_class.name for race_class in Database.RaceClass.query.all()]
... | Adds new race class by duplicating an existing one. | Adds new race class by duplicating an existing one. | [
"Adds",
"new",
"race",
"class",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | def on_duplicate_race_class(data):
source_class_id = data['class']
source_class = Database.RaceClass.query.get(source_class_id)
if source_class.name:
all_class_names = [race_class.name for race_class in Database.RaceClass.query.all()]
new_class_name = uniqueName(source_class.name, all_class_... | [
"def",
"on_duplicate_race_class",
"(",
"data",
")",
":",
"source_class_id",
"=",
"data",
"[",
"'class'",
"]",
"source_class",
"=",
"Database",
".",
"RaceClass",
".",
"query",
".",
"get",
"(",
"source_class_id",
")",
"if",
"source_class",
".",
"name",
":",
"a... | Adds new race class by duplicating an existing one. | [
"Adds",
"new",
"race",
"class",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | [
"'''Adds new race class by duplicating an existing one.'''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_add_pilot | null | def on_add_pilot():
'''Adds the next available pilot id number in the database.'''
new_pilot = Database.Pilot(name='New Pilot',
callsign='New Callsign',
team=DEF_TEAM_NAME,
phonetic = '')
DB.session.add(new_pilot)
DB.sessio... | Adds the next available pilot id number in the database. | Adds the next available pilot id number in the database. | [
"Adds",
"the",
"next",
"available",
"pilot",
"id",
"number",
"in",
"the",
"database",
"."
] | def on_add_pilot():
new_pilot = Database.Pilot(name='New Pilot',
callsign='New Callsign',
team=DEF_TEAM_NAME,
phonetic = '')
DB.session.add(new_pilot)
DB.session.flush()
DB.session.refresh(new_pilot)
new_pilot.name = __... | [
"def",
"on_add_pilot",
"(",
")",
":",
"new_pilot",
"=",
"Database",
".",
"Pilot",
"(",
"name",
"=",
"'New Pilot'",
",",
"callsign",
"=",
"'New Callsign'",
",",
"team",
"=",
"DEF_TEAM_NAME",
",",
"phonetic",
"=",
"''",
")",
"DB",
".",
"session",
".",
"add... | Adds the next available pilot id number in the database. | [
"Adds",
"the",
"next",
"available",
"pilot",
"id",
"number",
"in",
"the",
"database",
"."
] | [
"'''Adds the next available pilot id number in the database.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_add_profile | null | def on_add_profile():
'''Adds new profile (frequency set) in the database.'''
profile = getCurrentProfile()
new_freqs = {}
new_freqs["f"] = default_frequencies()
new_profile = Database.Profiles(name=__('New Profile'),
description = __('New Profile'),
... | Adds new profile (frequency set) in the database. | Adds new profile (frequency set) in the database. | [
"Adds",
"new",
"profile",
"(",
"frequency",
"set",
")",
"in",
"the",
"database",
"."
] | def on_add_profile():
profile = getCurrentProfile()
new_freqs = {}
new_freqs["f"] = default_frequencies()
new_profile = Database.Profiles(name=__('New Profile'),
description = __('New Profile'),
frequencies = json.dumps(new_freqs),
... | [
"def",
"on_add_profile",
"(",
")",
":",
"profile",
"=",
"getCurrentProfile",
"(",
")",
"new_freqs",
"=",
"{",
"}",
"new_freqs",
"[",
"\"f\"",
"]",
"=",
"default_frequencies",
"(",
")",
"new_profile",
"=",
"Database",
".",
"Profiles",
"(",
"name",
"=",
"__"... | Adds new profile (frequency set) in the database. | [
"Adds",
"new",
"profile",
"(",
"frequency",
"set",
")",
"in",
"the",
"database",
"."
] | [
"'''Adds new profile (frequency set) in the database.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_add_race_format | null | def on_add_race_format():
'''Adds new format in the database by duplicating an existing one.'''
source_format = getCurrentRaceFormat()
all_format_names = [format.name for format in Database.RaceFormat.query.all()]
new_format = Database.RaceFormat(name=uniqueName(source_format.name, all_format_names),
... | Adds new format in the database by duplicating an existing one. | Adds new format in the database by duplicating an existing one. | [
"Adds",
"new",
"format",
"in",
"the",
"database",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | def on_add_race_format():
source_format = getCurrentRaceFormat()
all_format_names = [format.name for format in Database.RaceFormat.query.all()]
new_format = Database.RaceFormat(name=uniqueName(source_format.name, all_format_names),
race_mode=source_format.race_mode,
... | [
"def",
"on_add_race_format",
"(",
")",
":",
"source_format",
"=",
"getCurrentRaceFormat",
"(",
")",
"all_format_names",
"=",
"[",
"format",
".",
"name",
"for",
"format",
"in",
"Database",
".",
"RaceFormat",
".",
"query",
".",
"all",
"(",
")",
"]",
"new_forma... | Adds new format in the database by duplicating an existing one. | [
"Adds",
"new",
"format",
"in",
"the",
"database",
"by",
"duplicating",
"an",
"existing",
"one",
"."
] | [
"'''Adds new format in the database by duplicating an existing one.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_led_effect_setup | null | def emit_led_effect_setup(**params):
'''Emits LED event/effect wiring options.'''
if led_manager.isEnabled():
effects = led_manager.getRegisteredEffects()
emit_payload = {
'events': []
}
for event in LEDEvent.configurable_events:
selectedEffect = led_man... | Emits LED event/effect wiring options. | Emits LED event/effect wiring options. | [
"Emits",
"LED",
"event",
"/",
"effect",
"wiring",
"options",
"."
] | def emit_led_effect_setup(**params):
if led_manager.isEnabled():
effects = led_manager.getRegisteredEffects()
emit_payload = {
'events': []
}
for event in LEDEvent.configurable_events:
selectedEffect = led_manager.getEventEffect(event['event'])
eff... | [
"def",
"emit_led_effect_setup",
"(",
"**",
"params",
")",
":",
"if",
"led_manager",
".",
"isEnabled",
"(",
")",
":",
"effects",
"=",
"led_manager",
".",
"getRegisteredEffects",
"(",
")",
"emit_payload",
"=",
"{",
"'events'",
":",
"[",
"]",
"}",
"for",
"eve... | Emits LED event/effect wiring options. | [
"Emits",
"LED",
"event",
"/",
"effect",
"wiring",
"options",
"."
] | [
"'''Emits LED event/effect wiring options.'''",
"# never broadcast"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | autoUpdateCalibration | null | def autoUpdateCalibration():
''' Apply best tuning values to nodes '''
for node_index, node in enumerate(INTERFACE.nodes):
calibration = findBestValues(node, node_index)
if node.enter_at_level is not calibration['enter_at_level']:
on_set_enter_at_level({
'node': node... | Apply best tuning values to nodes | Apply best tuning values to nodes | [
"Apply",
"best",
"tuning",
"values",
"to",
"nodes"
] | def autoUpdateCalibration():
for node_index, node in enumerate(INTERFACE.nodes):
calibration = findBestValues(node, node_index)
if node.enter_at_level is not calibration['enter_at_level']:
on_set_enter_at_level({
'node': node_index,
'enter_at_level': calib... | [
"def",
"autoUpdateCalibration",
"(",
")",
":",
"for",
"node_index",
",",
"node",
"in",
"enumerate",
"(",
"INTERFACE",
".",
"nodes",
")",
":",
"calibration",
"=",
"findBestValues",
"(",
"node",
",",
"node_index",
")",
"if",
"node",
".",
"enter_at_level",
"is"... | Apply best tuning values to nodes | [
"Apply",
"best",
"tuning",
"values",
"to",
"nodes"
] | [
"''' Apply best tuning values to nodes '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | findBestValues | <not_specific> | def findBestValues(node, node_index):
''' Search race history for best tuning values '''
# get commonly used values
heat = Database.Heat.query.get(RACE.current_heat)
pilot = Database.HeatNode.query.filter_by(heat_id=RACE.current_heat, node_index=node_index).first().pilot_id
current_class = heat.cla... | Search race history for best tuning values | Search race history for best tuning values | [
"Search",
"race",
"history",
"for",
"best",
"tuning",
"values"
] | def findBestValues(node, node_index):
heat = Database.Heat.query.get(RACE.current_heat)
pilot = Database.HeatNode.query.filter_by(heat_id=RACE.current_heat, node_index=node_index).first().pilot_id
current_class = heat.class_id
if pilot is Database.PILOT_ID_NONE or node.frequency is RHUtils.FREQUENCY_ID_... | [
"def",
"findBestValues",
"(",
"node",
",",
"node_index",
")",
":",
"heat",
"=",
"Database",
".",
"Heat",
".",
"query",
".",
"get",
"(",
"RACE",
".",
"current_heat",
")",
"pilot",
"=",
"Database",
".",
"HeatNode",
".",
"query",
".",
"filter_by",
"(",
"h... | Search race history for best tuning values | [
"Search",
"race",
"history",
"for",
"best",
"tuning",
"values"
] | [
"''' Search race history for best tuning values '''",
"# get commonly used values",
"# test for disabled node",
"# test for same heat, same node",
"# test for same class, same pilot, same node",
"# test for same pilot, same node",
"# test for same node",
"# fallback"
] | [
{
"param": "node",
"type": null
},
{
"param": "node_index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node_index",
"type": null,
"docstring": null,
"docstring_toke... |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_stop_race | null | def on_stop_race():
'''Stops the race and stops registering laps.'''
global RACE
CLUSTER.emit('stop_race')
if RACE.race_status == RaceStatus.RACING:
RACE.end_time = monotonic() # Update the race end time stamp
delta_time = RACE.end_time - RACE.start_time_monotonic
milli_sec = de... | Stops the race and stops registering laps. | Stops the race and stops registering laps. | [
"Stops",
"the",
"race",
"and",
"stops",
"registering",
"laps",
"."
] | def on_stop_race():
global RACE
CLUSTER.emit('stop_race')
if RACE.race_status == RaceStatus.RACING:
RACE.end_time = monotonic()
delta_time = RACE.end_time - RACE.start_time_monotonic
milli_sec = delta_time * 1000.0
RACE.duration_ms = milli_sec
logger.info('Race stopp... | [
"def",
"on_stop_race",
"(",
")",
":",
"global",
"RACE",
"CLUSTER",
".",
"emit",
"(",
"'stop_race'",
")",
"if",
"RACE",
".",
"race_status",
"==",
"RaceStatus",
".",
"RACING",
":",
"RACE",
".",
"end_time",
"=",
"monotonic",
"(",
")",
"delta_time",
"=",
"RA... | Stops the race and stops registering laps. | [
"Stops",
"the",
"race",
"and",
"stops",
"registering",
"laps",
"."
] | [
"'''Stops the race and stops registering laps.'''",
"# Update the race end time stamp",
"# show nodes with laps under minimum (if any)",
"# To stop registering passed laps, waiting for laps to be cleared",
"# Go back to ready state",
"# indicate race timer not running",
"# also stop any deferred start",... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_save_laps | null | def on_save_laps():
'''Save current laps data to the database.'''
global FULL_RESULTS_CACHE_VALID
FULL_RESULTS_CACHE_VALID = False
race_format = getCurrentRaceFormat()
heat = Database.Heat.query.get(RACE.current_heat)
# Get the last saved round for the current heat
max_round = DB.session.que... | Save current laps data to the database. | Save current laps data to the database. | [
"Save",
"current",
"laps",
"data",
"to",
"the",
"database",
"."
] | def on_save_laps():
global FULL_RESULTS_CACHE_VALID
FULL_RESULTS_CACHE_VALID = False
race_format = getCurrentRaceFormat()
heat = Database.Heat.query.get(RACE.current_heat)
max_round = DB.session.query(DB.func.max(Database.SavedRaceMeta.round_id)) \
.filter_by(heat_id=RACE.current_heat).s... | [
"def",
"on_save_laps",
"(",
")",
":",
"global",
"FULL_RESULTS_CACHE_VALID",
"FULL_RESULTS_CACHE_VALID",
"=",
"False",
"race_format",
"=",
"getCurrentRaceFormat",
"(",
")",
"heat",
"=",
"Database",
".",
"Heat",
".",
"query",
".",
"get",
"(",
"RACE",
".",
"current... | Save current laps data to the database. | [
"Save",
"current",
"laps",
"data",
"to",
"the",
"database",
"."
] | [
"'''Save current laps data to the database.'''",
"# Get the last saved round for the current heat",
"# Loop through laps to copy to saved races",
"# spawn thread for updating results caches",
"# Also clear the current laps"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_discard_laps | null | def on_discard_laps(**kwargs):
'''Clear the current laps without saving.'''
CLUSTER.emit('discard_laps')
clear_laps()
RACE.race_status = RaceStatus.READY # Flag status as ready to start next race
INTERFACE.set_race_status(RaceStatus.READY)
emit_current_laps() # Race page, blank laps to the web c... | Clear the current laps without saving. | Clear the current laps without saving. | [
"Clear",
"the",
"current",
"laps",
"without",
"saving",
"."
] | def on_discard_laps(**kwargs):
CLUSTER.emit('discard_laps')
clear_laps()
RACE.race_status = RaceStatus.READY
INTERFACE.set_race_status(RaceStatus.READY)
emit_current_laps()
emit_current_leaderboard()
emit_race_status()
race_format = getCurrentRaceFormat()
if race_format.team_raci... | [
"def",
"on_discard_laps",
"(",
"**",
"kwargs",
")",
":",
"CLUSTER",
".",
"emit",
"(",
"'discard_laps'",
")",
"clear_laps",
"(",
")",
"RACE",
".",
"race_status",
"=",
"RaceStatus",
".",
"READY",
"INTERFACE",
".",
"set_race_status",
"(",
"RaceStatus",
".",
"RE... | Clear the current laps without saving. | [
"Clear",
"the",
"current",
"laps",
"without",
"saving",
"."
] | [
"'''Clear the current laps without saving.'''",
"# Flag status as ready to start next race",
"# Race page, blank laps to the web client",
"# Race page, blank leaderboard to the web client",
"# Race page, to set race button states",
"# Show team-racing status info",
"# clear any displayed \"Winner is\" t... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | clear_laps | null | def clear_laps():
'''Clear the current laps table.'''
global RACE
RACE.last_race_results = Results.calc_leaderboard(DB, current_race=RACE, current_profile=getCurrentProfile())
RACE.last_race_cacheStatus = Results.CacheStatus.VALID
RACE.laps_winner_name = None # clear winner in first-to-X-laps race
... | Clear the current laps table. | Clear the current laps table. | [
"Clear",
"the",
"current",
"laps",
"table",
"."
] | def clear_laps():
global RACE
RACE.last_race_results = Results.calc_leaderboard(DB, current_race=RACE, current_profile=getCurrentProfile())
RACE.last_race_cacheStatus = Results.CacheStatus.VALID
RACE.laps_winner_name = None
RACE.winning_lap_id = 0
db_reset_current_laps()
DB.session.query(... | [
"def",
"clear_laps",
"(",
")",
":",
"global",
"RACE",
"RACE",
".",
"last_race_results",
"=",
"Results",
".",
"calc_leaderboard",
"(",
"DB",
",",
"current_race",
"=",
"RACE",
",",
"current_profile",
"=",
"getCurrentProfile",
"(",
")",
")",
"RACE",
".",
"last_... | Clear the current laps table. | [
"Clear",
"the",
"current",
"laps",
"table",
"."
] | [
"'''Clear the current laps table.'''",
"# clear winner in first-to-X-laps race",
"# Clear out the current laps table"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_set_current_heat | null | def on_set_current_heat(data):
'''Update the current heat variable.'''
new_heat_id = data['heat']
RACE.current_heat = new_heat_id
RACE.node_pilots = {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
}
RACE.node_team... | Update the current heat variable. | Update the current heat variable. | [
"Update",
"the",
"current",
"heat",
"variable",
"."
] | def on_set_current_heat(data):
new_heat_id = data['heat']
RACE.current_heat = new_heat_id
RACE.node_pilots = {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
}
RACE.node_teams = {
'0': None,
'1': None,
... | [
"def",
"on_set_current_heat",
"(",
"data",
")",
":",
"new_heat_id",
"=",
"data",
"[",
"'heat'",
"]",
"RACE",
".",
"current_heat",
"=",
"new_heat_id",
"RACE",
".",
"node_pilots",
"=",
"{",
"'0'",
":",
"0",
",",
"'1'",
":",
"0",
",",
"'2'",
":",
"0",
"... | Update the current heat variable. | [
"Update",
"the",
"current",
"heat",
"variable",
"."
] | [
"'''Update the current heat variable.'''",
"# refresh leaderboard",
"# Race page, to update heat selection button",
"# Race page, to update callsigns in leaderboard"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | on_simulate_lap | null | def on_simulate_lap(data):
'''Simulates a lap (for debug testing).'''
node_index = data['node']
logger.info('Simulated lap: Node {0}'.format(node_index+1))
Events.trigger(Evt.CROSSING_EXIT, {
'nodeIndex': node_index,
'color': hexToColor(Options.get('colorNode_' + str(node_index), '#fffff... | Simulates a lap (for debug testing). | Simulates a lap (for debug testing). | [
"Simulates",
"a",
"lap",
"(",
"for",
"debug",
"testing",
")",
"."
] | def on_simulate_lap(data):
node_index = data['node']
logger.info('Simulated lap: Node {0}'.format(node_index+1))
Events.trigger(Evt.CROSSING_EXIT, {
'nodeIndex': node_index,
'color': hexToColor(Options.get('colorNode_' + str(node_index), '#ffffff'))
})
INTERFACE.intf_simulate_lap... | [
"def",
"on_simulate_lap",
"(",
"data",
")",
":",
"node_index",
"=",
"data",
"[",
"'node'",
"]",
"logger",
".",
"info",
"(",
"'Simulated lap: Node {0}'",
".",
"format",
"(",
"node_index",
"+",
"1",
")",
")",
"Events",
".",
"trigger",
"(",
"Evt",
".",
"CRO... | Simulates a lap (for debug testing). | [
"Simulates",
"a",
"lap",
"(",
"for",
"debug",
"testing",
")",
"."
] | [
"'''Simulates a lap (for debug testing).'''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_enter_and_exit_at_levels | null | def emit_enter_and_exit_at_levels(**params):
'''Emits enter-at and exit-at levels for nodes.'''
profile = getCurrentProfile()
profile_enter_ats = json.loads(profile.enter_ats)
profile_exit_ats = json.loads(profile.exit_ats)
emit_payload = {
'enter_at_levels': profile_enter_ats["v"][:RACE.nu... | Emits enter-at and exit-at levels for nodes. | Emits enter-at and exit-at levels for nodes. | [
"Emits",
"enter",
"-",
"at",
"and",
"exit",
"-",
"at",
"levels",
"for",
"nodes",
"."
] | def emit_enter_and_exit_at_levels(**params):
profile = getCurrentProfile()
profile_enter_ats = json.loads(profile.enter_ats)
profile_exit_ats = json.loads(profile.exit_ats)
emit_payload = {
'enter_at_levels': profile_enter_ats["v"][:RACE.num_nodes],
'exit_at_levels': profile_exit_ats["v"... | [
"def",
"emit_enter_and_exit_at_levels",
"(",
"**",
"params",
")",
":",
"profile",
"=",
"getCurrentProfile",
"(",
")",
"profile_enter_ats",
"=",
"json",
".",
"loads",
"(",
"profile",
".",
"enter_ats",
")",
"profile_exit_ats",
"=",
"json",
".",
"loads",
"(",
"pr... | Emits enter-at and exit-at levels for nodes. | [
"Emits",
"enter",
"-",
"at",
"and",
"exit",
"-",
"at",
"levels",
"for",
"nodes",
"."
] | [
"'''Emits enter-at and exit-at levels for nodes.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | check_emit_team_racing_status | null | def check_emit_team_racing_status(t_laps_dict=None, **params):
'''Checks and emits team-racing status info.'''
# if not passed in then determine number of laps for each team
if t_laps_dict is None:
t_laps_dict = get_team_laps_info()[0]
disp_str = ''
for t_name in sorted(t_laps_dict... | Checks and emits team-racing status info. | Checks and emits team-racing status info. | [
"Checks",
"and",
"emits",
"team",
"-",
"racing",
"status",
"info",
"."
] | def check_emit_team_racing_status(t_laps_dict=None, **params):
if t_laps_dict is None:
t_laps_dict = get_team_laps_info()[0]
disp_str = ''
for t_name in sorted(t_laps_dict.keys()):
disp_str += ' <span class="team-laps">Team ' + t_name + ' Lap: ' + str(t_laps_dict[t_name][0]) + '</span>'
... | [
"def",
"check_emit_team_racing_status",
"(",
"t_laps_dict",
"=",
"None",
",",
"**",
"params",
")",
":",
"if",
"t_laps_dict",
"is",
"None",
":",
"t_laps_dict",
"=",
"get_team_laps_info",
"(",
")",
"[",
"0",
"]",
"disp_str",
"=",
"''",
"for",
"t_name",
"in",
... | Checks and emits team-racing status info. | [
"Checks",
"and",
"emits",
"team",
"-",
"racing",
"status",
"info",
"."
] | [
"'''Checks and emits team-racing status info.'''",
"# if not passed in then determine number of laps for each team",
"#logger.info('Team racing status: ' + disp_str)"
] | [
{
"param": "t_laps_dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t_laps_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_team_racing_stat_if_enb | null | def emit_team_racing_stat_if_enb(**params):
'''Emits team-racing status info if team racing is enabled.'''
race_format = getCurrentRaceFormat()
if race_format.team_racing_mode:
check_emit_team_racing_status(**params)
else:
emit_team_racing_status('') | Emits team-racing status info if team racing is enabled. | Emits team-racing status info if team racing is enabled. | [
"Emits",
"team",
"-",
"racing",
"status",
"info",
"if",
"team",
"racing",
"is",
"enabled",
"."
] | def emit_team_racing_stat_if_enb(**params):
race_format = getCurrentRaceFormat()
if race_format.team_racing_mode:
check_emit_team_racing_status(**params)
else:
emit_team_racing_status('') | [
"def",
"emit_team_racing_stat_if_enb",
"(",
"**",
"params",
")",
":",
"race_format",
"=",
"getCurrentRaceFormat",
"(",
")",
"if",
"race_format",
".",
"team_racing_mode",
":",
"check_emit_team_racing_status",
"(",
"**",
"params",
")",
"else",
":",
"emit_team_racing_sta... | Emits team-racing status info if team racing is enabled. | [
"Emits",
"team",
"-",
"racing",
"status",
"info",
"if",
"team",
"racing",
"is",
"enabled",
"."
] | [
"'''Emits team-racing status info if team racing is enabled.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_team_racing_status | null | def emit_team_racing_status(disp_str, **params):
'''Emits given team-racing status info.'''
emit_payload = {'team_laps_str': disp_str}
if ('nobroadcast' in params):
emit('team_racing_status', emit_payload)
else:
SOCKET_IO.emit('team_racing_status', emit_payload) | Emits given team-racing status info. | Emits given team-racing status info. | [
"Emits",
"given",
"team",
"-",
"racing",
"status",
"info",
"."
] | def emit_team_racing_status(disp_str, **params):
emit_payload = {'team_laps_str': disp_str}
if ('nobroadcast' in params):
emit('team_racing_status', emit_payload)
else:
SOCKET_IO.emit('team_racing_status', emit_payload) | [
"def",
"emit_team_racing_status",
"(",
"disp_str",
",",
"**",
"params",
")",
":",
"emit_payload",
"=",
"{",
"'team_laps_str'",
":",
"disp_str",
"}",
"if",
"(",
"'nobroadcast'",
"in",
"params",
")",
":",
"emit",
"(",
"'team_racing_status'",
",",
"emit_payload",
... | Emits given team-racing status info. | [
"Emits",
"given",
"team",
"-",
"racing",
"status",
"info",
"."
] | [
"'''Emits given team-racing status info.'''"
] | [
{
"param": "disp_str",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "disp_str",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | check_pilot_laps_win | <not_specific> | def check_pilot_laps_win(pass_node_index, num_laps_win):
'''Checks if a pilot has completed enough laps to win.'''
win_pilot_id = -1
win_lap_tstamp = 0
profile_freqs = json.loads(getCurrentProfile().frequencies)
# dict for current heat with key=node_index, value=pilot_id
... | Checks if a pilot has completed enough laps to win. | Checks if a pilot has completed enough laps to win. | [
"Checks",
"if",
"a",
"pilot",
"has",
"completed",
"enough",
"laps",
"to",
"win",
"."
] | def check_pilot_laps_win(pass_node_index, num_laps_win):
win_pilot_id = -1
win_lap_tstamp = 0
profile_freqs = json.loads(getCurrentProfile().frequencies)
node_pilot_dict = dict(Database.HeatNode.query.with_entities(Database.HeatNode.node_index, Database.HeatNode.pilot_id). \
filter... | [
"def",
"check_pilot_laps_win",
"(",
"pass_node_index",
",",
"num_laps_win",
")",
":",
"win_pilot_id",
"=",
"-",
"1",
"win_lap_tstamp",
"=",
"0",
"profile_freqs",
"=",
"json",
".",
"loads",
"(",
"getCurrentProfile",
"(",
")",
".",
"frequencies",
")",
"node_pilot_... | Checks if a pilot has completed enough laps to win. | [
"Checks",
"if",
"a",
"pilot",
"has",
"completed",
"enough",
"laps",
"to",
"win",
"."
] | [
"'''Checks if a pilot has completed enough laps to win.'''",
"# dict for current heat with key=node_index, value=pilot_id",
"# if (other) pilot crossing for possible winning lap then wait",
"# in case lap time turns out to be earliest:",
"# save pilot_id for earliest lap time:"
] | [
{
"param": "pass_node_index",
"type": null
},
{
"param": "num_laps_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pass_node_index",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_laps_win",
"type": null,
"docstring": null,
"d... |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | check_team_laps_win | <not_specific> | def check_team_laps_win(t_laps_dict, num_laps_win, pilot_team_dict, pass_node_index=-1):
'''Checks if a team has completed enough laps to win.'''
global RACE
# make sure there's not a pilot in the process of crossing for a winning lap
if RACE.laps_winner_name is None and pilot_team_dict:
pr... | Checks if a team has completed enough laps to win. | Checks if a team has completed enough laps to win. | [
"Checks",
"if",
"a",
"team",
"has",
"completed",
"enough",
"laps",
"to",
"win",
"."
] | def check_team_laps_win(t_laps_dict, num_laps_win, pilot_team_dict, pass_node_index=-1):
global RACE
if RACE.laps_winner_name is None and pilot_team_dict:
profile_freqs = None
node_pilot_dict = dict(Database.HeatNode.query.with_entities(Database.HeatNode.node_index, Database.HeatNode.pilot_id). ... | [
"def",
"check_team_laps_win",
"(",
"t_laps_dict",
",",
"num_laps_win",
",",
"pilot_team_dict",
",",
"pass_node_index",
"=",
"-",
"1",
")",
":",
"global",
"RACE",
"if",
"RACE",
".",
"laps_winner_name",
"is",
"None",
"and",
"pilot_team_dict",
":",
"profile_freqs",
... | Checks if a team has completed enough laps to win. | [
"Checks",
"if",
"a",
"team",
"has",
"completed",
"enough",
"laps",
"to",
"win",
"."
] | [
"'''Checks if a team has completed enough laps to win.'''",
"# make sure there's not a pilot in the process of crossing for a winning lap",
"# dict for current heat with key=node_index, value=pilot_id",
"# check if (other) pilot node is crossing gate",
"# node is enabled",
"# node has pilot assigned to it... | [
{
"param": "t_laps_dict",
"type": null
},
{
"param": "num_laps_win",
"type": null
},
{
"param": "pilot_team_dict",
"type": null
},
{
"param": "pass_node_index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t_laps_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_laps_win",
"type": null,
"docstring": null,
"docst... |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_first_pass_registered | null | def emit_first_pass_registered(node_idx, **params):
'''Emits when first pass (lap 0) is registered during a race'''
emit_payload = {
'node_index': node_idx,
}
Events.trigger(Evt.RACE_FIRST_PASS, {
'node_index': node_idx,
})
if ('nobroadcast' in params):
emit('first_p... | Emits when first pass (lap 0) is registered during a race | Emits when first pass (lap 0) is registered during a race | [
"Emits",
"when",
"first",
"pass",
"(",
"lap",
"0",
")",
"is",
"registered",
"during",
"a",
"race"
] | def emit_first_pass_registered(node_idx, **params):
emit_payload = {
'node_index': node_idx,
}
Events.trigger(Evt.RACE_FIRST_PASS, {
'node_index': node_idx,
})
if ('nobroadcast' in params):
emit('first_pass_registered', emit_payload)
else:
SOCKET_IO.emit('firs... | [
"def",
"emit_first_pass_registered",
"(",
"node_idx",
",",
"**",
"params",
")",
":",
"emit_payload",
"=",
"{",
"'node_index'",
":",
"node_idx",
",",
"}",
"Events",
".",
"trigger",
"(",
"Evt",
".",
"RACE_FIRST_PASS",
",",
"{",
"'node_index'",
":",
"node_idx",
... | Emits when first pass (lap 0) is registered during a race | [
"Emits",
"when",
"first",
"pass",
"(",
"lap",
"0",
")",
"is",
"registered",
"during",
"a",
"race"
] | [
"'''Emits when first pass (lap 0) is registered during a race'''"
] | [
{
"param": "node_idx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node_idx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_enter_at_level | null | def emit_enter_at_level(node, **params):
'''Emits enter-at level for given node.'''
emit_payload = {
'node_index': node.index,
'level': node.enter_at_level
}
if ('nobroadcast' in params):
emit('node_enter_at_level', emit_payload)
else:
SOCKET_IO.emit('node_enter_at_le... | Emits enter-at level for given node. | Emits enter-at level for given node. | [
"Emits",
"enter",
"-",
"at",
"level",
"for",
"given",
"node",
"."
] | def emit_enter_at_level(node, **params):
emit_payload = {
'node_index': node.index,
'level': node.enter_at_level
}
if ('nobroadcast' in params):
emit('node_enter_at_level', emit_payload)
else:
SOCKET_IO.emit('node_enter_at_level', emit_payload) | [
"def",
"emit_enter_at_level",
"(",
"node",
",",
"**",
"params",
")",
":",
"emit_payload",
"=",
"{",
"'node_index'",
":",
"node",
".",
"index",
",",
"'level'",
":",
"node",
".",
"enter_at_level",
"}",
"if",
"(",
"'nobroadcast'",
"in",
"params",
")",
":",
... | Emits enter-at level for given node. | [
"Emits",
"enter",
"-",
"at",
"level",
"for",
"given",
"node",
"."
] | [
"'''Emits enter-at level for given node.'''"
] | [
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_exit_at_level | null | def emit_exit_at_level(node, **params):
'''Emits exit-at level for given node.'''
emit_payload = {
'node_index': node.index,
'level': node.exit_at_level
}
if ('nobroadcast' in params):
emit('node_exit_at_level', emit_payload)
else:
SOCKET_IO.emit('node_exit_at_level',... | Emits exit-at level for given node. | Emits exit-at level for given node. | [
"Emits",
"exit",
"-",
"at",
"level",
"for",
"given",
"node",
"."
] | def emit_exit_at_level(node, **params):
emit_payload = {
'node_index': node.index,
'level': node.exit_at_level
}
if ('nobroadcast' in params):
emit('node_exit_at_level', emit_payload)
else:
SOCKET_IO.emit('node_exit_at_level', emit_payload) | [
"def",
"emit_exit_at_level",
"(",
"node",
",",
"**",
"params",
")",
":",
"emit_payload",
"=",
"{",
"'node_index'",
":",
"node",
".",
"index",
",",
"'level'",
":",
"node",
".",
"exit_at_level",
"}",
"if",
"(",
"'nobroadcast'",
"in",
"params",
")",
":",
"e... | Emits exit-at level for given node. | [
"Emits",
"exit",
"-",
"at",
"level",
"for",
"given",
"node",
"."
] | [
"'''Emits exit-at level for given node.'''"
] | [
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_node_crossing_change | null | def emit_node_crossing_change(node, **params):
'''Emits crossing-flag change for given node.'''
emit_payload = {
'node_index': node.index,
'crossing_flag': node.crossing_flag
}
if ('nobroadcast' in params):
emit('node_crossing_change', emit_payload)
else:
SOCKET_IO.em... | Emits crossing-flag change for given node. | Emits crossing-flag change for given node. | [
"Emits",
"crossing",
"-",
"flag",
"change",
"for",
"given",
"node",
"."
] | def emit_node_crossing_change(node, **params):
emit_payload = {
'node_index': node.index,
'crossing_flag': node.crossing_flag
}
if ('nobroadcast' in params):
emit('node_crossing_change', emit_payload)
else:
SOCKET_IO.emit('node_crossing_change', emit_payload) | [
"def",
"emit_node_crossing_change",
"(",
"node",
",",
"**",
"params",
")",
":",
"emit_payload",
"=",
"{",
"'node_index'",
":",
"node",
".",
"index",
",",
"'crossing_flag'",
":",
"node",
".",
"crossing_flag",
"}",
"if",
"(",
"'nobroadcast'",
"in",
"params",
"... | Emits crossing-flag change for given node. | [
"Emits",
"crossing",
"-",
"flag",
"change",
"for",
"given",
"node",
"."
] | [
"'''Emits crossing-flag change for given node.'''"
] | [
{
"param": "node",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_imdtabler_page | null | def emit_imdtabler_page(**params):
'''Emits IMDTabler page, using current profile frequencies.'''
if Use_imdtabler_jar_flag:
try: # get IMDTabler version string
imdtabler_ver = subprocess.check_output( \
'java -jar ' + IMDTABLER_JAR_NA... | Emits IMDTabler page, using current profile frequencies. | Emits IMDTabler page, using current profile frequencies. | [
"Emits",
"IMDTabler",
"page",
"using",
"current",
"profile",
"frequencies",
"."
] | def emit_imdtabler_page(**params):
if Use_imdtabler_jar_flag:
try:
imdtabler_ver = subprocess.check_output( \
'java -jar ' + IMDTABLER_JAR_NAME + ' -v', shell=True).rstrip()
profile_freqs = json.loads(getCurrentProfile().frequ... | [
"def",
"emit_imdtabler_page",
"(",
"**",
"params",
")",
":",
"if",
"Use_imdtabler_jar_flag",
":",
"try",
":",
"imdtabler_ver",
"=",
"subprocess",
".",
"check_output",
"(",
"'java -jar '",
"+",
"IMDTABLER_JAR_NAME",
"+",
"' -v'",
",",
"shell",
"=",
"True",
")",
... | Emits IMDTabler page, using current profile frequencies. | [
"Emits",
"IMDTabler",
"page",
"using",
"current",
"profile",
"frequencies",
"."
] | [
"'''Emits IMDTabler page, using current profile frequencies.'''",
"# get IMDTabler version string",
"# remove duplicates",
"# convert list of integers to list of strings",
"# drop any zero entries"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_imdtabler_data | null | def emit_imdtabler_data(fs_list, imdtabler_ver=None, **params):
'''Emits IMDTabler data for given frequencies.'''
try:
imdtabler_data = None
if len(fs_list) > 2: # if 3+ then invoke jar; get response
imdtabler_data = subprocess.check_output( \
'java -jar ' + ... | Emits IMDTabler data for given frequencies. | Emits IMDTabler data for given frequencies. | [
"Emits",
"IMDTabler",
"data",
"for",
"given",
"frequencies",
"."
] | def emit_imdtabler_data(fs_list, imdtabler_ver=None, **params):
try:
imdtabler_data = None
if len(fs_list) > 2:
imdtabler_data = subprocess.check_output( \
'java -jar ' + IMDTABLER_JAR_NAME + ' -t ' + ' '.join(fs_list), shell=True)
except Exception:
... | [
"def",
"emit_imdtabler_data",
"(",
"fs_list",
",",
"imdtabler_ver",
"=",
"None",
",",
"**",
"params",
")",
":",
"try",
":",
"imdtabler_data",
"=",
"None",
"if",
"len",
"(",
"fs_list",
")",
">",
"2",
":",
"imdtabler_data",
"=",
"subprocess",
".",
"check_out... | Emits IMDTabler data for given frequencies. | [
"Emits",
"IMDTabler",
"data",
"for",
"given",
"frequencies",
"."
] | [
"'''Emits IMDTabler data for given frequencies.'''",
"# if 3+ then invoke jar; get response"
] | [
{
"param": "fs_list",
"type": null
},
{
"param": "imdtabler_ver",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "imdtabler_ver",
"type": null,
"docstring": null,
"docstrin... |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_imdtabler_rating | null | def emit_imdtabler_rating():
'''Emits IMDTabler rating for current profile frequencies.'''
try:
profile_freqs = json.loads(getCurrentProfile().frequencies)
imd_val = None
fi_list = list(OrderedDict.fromkeys(profile_freqs['f'][:RACE.num_nodes])) # remove duplicates
fs_list = []
... | Emits IMDTabler rating for current profile frequencies. | Emits IMDTabler rating for current profile frequencies. | [
"Emits",
"IMDTabler",
"rating",
"for",
"current",
"profile",
"frequencies",
"."
] | def emit_imdtabler_rating():
try:
profile_freqs = json.loads(getCurrentProfile().frequencies)
imd_val = None
fi_list = list(OrderedDict.fromkeys(profile_freqs['f'][:RACE.num_nodes]))
fs_list = []
for val in fi_list:
if val > 0:
fs_list.ap... | [
"def",
"emit_imdtabler_rating",
"(",
")",
":",
"try",
":",
"profile_freqs",
"=",
"json",
".",
"loads",
"(",
"getCurrentProfile",
"(",
")",
".",
"frequencies",
")",
"imd_val",
"=",
"None",
"fi_list",
"=",
"list",
"(",
"OrderedDict",
".",
"fromkeys",
"(",
"p... | Emits IMDTabler rating for current profile frequencies. | [
"Emits",
"IMDTabler",
"rating",
"for",
"current",
"profile",
"frequencies",
"."
] | [
"'''Emits IMDTabler rating for current profile frequencies.'''",
"# remove duplicates",
"# convert list of integers to list of strings",
"# drop any zero entries",
"# invoke jar; get response"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | emit_vrx_list | null | def emit_vrx_list(*args, **params):
''' get list of connected VRx devices '''
if vrx_controller:
# if vrx_controller.has_connection:
vrx_list = {}
for vrx in vrx_controller.rx_data:
vrx_list[vrx] = vrx_controller.rx_data[vrx]
emit_payload = {
... | get list of connected VRx devices | get list of connected VRx devices | [
"get",
"list",
"of",
"connected",
"VRx",
"devices"
] | def emit_vrx_list(*args, **params):
if vrx_controller:
vrx_list = {}
for vrx in vrx_controller.rx_data:
vrx_list[vrx] = vrx_controller.rx_data[vrx]
emit_payload = {
'enabled': True,
'connection': True,
'vrx': vrx_lis... | [
"def",
"emit_vrx_list",
"(",
"*",
"args",
",",
"**",
"params",
")",
":",
"if",
"vrx_controller",
":",
"vrx_list",
"=",
"{",
"}",
"for",
"vrx",
"in",
"vrx_controller",
".",
"rx_data",
":",
"vrx_list",
"[",
"vrx",
"]",
"=",
"vrx_controller",
".",
"rx_data"... | get list of connected VRx devices | [
"get",
"list",
"of",
"connected",
"VRx",
"devices"
] | [
"''' get list of connected VRx devices '''",
"# if vrx_controller.has_connection:",
"# else:",
"# emit_payload = {",
"# 'enabled': True,",
"# 'connection': False,",
"# }"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | heartbeat_thread_function | null | def heartbeat_thread_function():
'''Allow time for connection handshake to terminate before emitting data'''
gevent.sleep(0.010)
'''Emits current rssi data.'''
while True:
try:
global RACE
node_data = INTERFACE.get_heartbeat_json()
SOCKET_IO.emit('heartbeat'... | Allow time for connection handshake to terminate before emitting data | Allow time for connection handshake to terminate before emitting data | [
"Allow",
"time",
"for",
"connection",
"handshake",
"to",
"terminate",
"before",
"emitting",
"data"
] | def heartbeat_thread_function():
gevent.sleep(0.010)
while True:
try:
global RACE
node_data = INTERFACE.get_heartbeat_json()
SOCKET_IO.emit('heartbeat', node_data)
heartbeat_thread_function.iter_tracker += 1
if RACE.timer_running:
... | [
"def",
"heartbeat_thread_function",
"(",
")",
":",
"gevent",
".",
"sleep",
"(",
"0.010",
")",
"'''Emits current rssi data.'''",
"while",
"True",
":",
"try",
":",
"global",
"RACE",
"node_data",
"=",
"INTERFACE",
".",
"get_heartbeat_json",
"(",
")",
"SOCKET_IO",
"... | Allow time for connection handshake to terminate before emitting data | [
"Allow",
"time",
"for",
"connection",
"handshake",
"to",
"terminate",
"before",
"emitting",
"data"
] | [
"'''Allow time for connection handshake to terminate before emitting data'''",
"'''Emits current rssi data.'''",
"# check if race timer is finished",
"# update displayed IMD rating after freqs changed:",
"# emit rest of node data, but less often:",
"# emit cluster status less often:",
"# collect vrx loc... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | ms_from_race_start | <not_specific> | def ms_from_race_start():
'''Return milliseconds since race start.'''
delta_time = monotonic() - RACE.start_time_monotonic
milli_sec = delta_time * 1000.0
return milli_sec | Return milliseconds since race start. | Return milliseconds since race start. | [
"Return",
"milliseconds",
"since",
"race",
"start",
"."
] | def ms_from_race_start():
delta_time = monotonic() - RACE.start_time_monotonic
milli_sec = delta_time * 1000.0
return milli_sec | [
"def",
"ms_from_race_start",
"(",
")",
":",
"delta_time",
"=",
"monotonic",
"(",
")",
"-",
"RACE",
".",
"start_time_monotonic",
"milli_sec",
"=",
"delta_time",
"*",
"1000.0",
"return",
"milli_sec"
] | Return milliseconds since race start. | [
"Return",
"milliseconds",
"since",
"race",
"start",
"."
] | [
"'''Return milliseconds since race start.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | ms_to_race_start | <not_specific> | def ms_to_race_start():
'''Return milliseconds since race start.'''
if RACE.scheduled:
delta_time = monotonic() - RACE.scheduled_time
milli_sec = delta_time * 1000.0
return milli_sec
else:
return None | Return milliseconds since race start. | Return milliseconds since race start. | [
"Return",
"milliseconds",
"since",
"race",
"start",
"."
] | def ms_to_race_start():
if RACE.scheduled:
delta_time = monotonic() - RACE.scheduled_time
milli_sec = delta_time * 1000.0
return milli_sec
else:
return None | [
"def",
"ms_to_race_start",
"(",
")",
":",
"if",
"RACE",
".",
"scheduled",
":",
"delta_time",
"=",
"monotonic",
"(",
")",
"-",
"RACE",
".",
"scheduled_time",
"milli_sec",
"=",
"delta_time",
"*",
"1000.0",
"return",
"milli_sec",
"else",
":",
"return",
"None"
] | Return milliseconds since race start. | [
"Return",
"milliseconds",
"since",
"race",
"start",
"."
] | [
"'''Return milliseconds since race start.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | ms_from_program_start | <not_specific> | def ms_from_program_start():
'''Returns the elapsed milliseconds since the start of the program.'''
delta_time = monotonic() - PROGRAM_START
milli_sec = delta_time * 1000.0
return milli_sec | Returns the elapsed milliseconds since the start of the program. | Returns the elapsed milliseconds since the start of the program. | [
"Returns",
"the",
"elapsed",
"milliseconds",
"since",
"the",
"start",
"of",
"the",
"program",
"."
] | def ms_from_program_start():
delta_time = monotonic() - PROGRAM_START
milli_sec = delta_time * 1000.0
return milli_sec | [
"def",
"ms_from_program_start",
"(",
")",
":",
"delta_time",
"=",
"monotonic",
"(",
")",
"-",
"PROGRAM_START",
"milli_sec",
"=",
"delta_time",
"*",
"1000.0",
"return",
"milli_sec"
] | Returns the elapsed milliseconds since the start of the program. | [
"Returns",
"the",
"elapsed",
"milliseconds",
"since",
"the",
"start",
"of",
"the",
"program",
"."
] | [
"'''Returns the elapsed milliseconds since the start of the program.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | pass_record_callback | null | def pass_record_callback(node, lap_timestamp_absolute, source):
'''Handles pass records from the nodes.'''
logger.debug('Raw pass record: Node: {0}, MS Since Lap: {1}'.format(node.index+1, lap_timestamp_absolute))
node.pass_crossing_flag = False # clear the "synchronized" version of the crossing flag
... | Handles pass records from the nodes. | Handles pass records from the nodes. | [
"Handles",
"pass",
"records",
"from",
"the",
"nodes",
"."
] | def pass_record_callback(node, lap_timestamp_absolute, source):
logger.debug('Raw pass record: Node: {0}, MS Since Lap: {1}'.format(node.index+1, lap_timestamp_absolute))
node.pass_crossing_flag = False
node.debug_pass_count += 1
emit_node_data()
global RACE
profile_freqs = json.loads(getCurr... | [
"def",
"pass_record_callback",
"(",
"node",
",",
"lap_timestamp_absolute",
",",
"source",
")",
":",
"logger",
".",
"debug",
"(",
"'Raw pass record: Node: {0}, MS Since Lap: {1}'",
".",
"format",
"(",
"node",
".",
"index",
"+",
"1",
",",
"lap_timestamp_absolute",
")"... | Handles pass records from the nodes. | [
"Handles",
"pass",
"records",
"from",
"the",
"nodes",
"."
] | [
"'''Handles pass records from the nodes.'''",
"# clear the \"synchronized\" version of the crossing flag",
"# For updated triggers and peaks",
"# always count laps if race is running, otherwise test if lap should have counted before race end (RACE.duration_ms is invalid while race is in progress)",
"# Get t... | [
{
"param": "node",
"type": null
},
{
"param": "lap_timestamp_absolute",
"type": null
},
{
"param": "source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lap_timestamp_absolute",
"type": null,
"docstring": null,
"do... |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | db_reset_pilots | null | def db_reset_pilots():
'''Resets database pilots to default.'''
DB.session.query(Database.Pilot).delete()
for node in range(RACE.num_nodes):
DB.session.add(Database.Pilot(callsign='Callsign {0}'.format(node+1), \
name='Pilot {0} Name'.format(node+1), team=DEF_TEAM_NAME, phonetic=''))
... | Resets database pilots to default. | Resets database pilots to default. | [
"Resets",
"database",
"pilots",
"to",
"default",
"."
] | def db_reset_pilots():
DB.session.query(Database.Pilot).delete()
for node in range(RACE.num_nodes):
DB.session.add(Database.Pilot(callsign='Callsign {0}'.format(node+1), \
name='Pilot {0} Name'.format(node+1), team=DEF_TEAM_NAME, phonetic=''))
DB.session.commit()
logger.info('Databas... | [
"def",
"db_reset_pilots",
"(",
")",
":",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"Pilot",
")",
".",
"delete",
"(",
")",
"for",
"node",
"in",
"range",
"(",
"RACE",
".",
"num_nodes",
")",
":",
"DB",
".",
"session",
".",
"add",
"(",
... | Resets database pilots to default. | [
"Resets",
"database",
"pilots",
"to",
"default",
"."
] | [
"'''Resets database pilots to default.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | db_reset_heats | null | def db_reset_heats():
'''Resets database heats to default.'''
DB.session.query(Database.Heat).delete()
DB.session.query(Database.HeatNode).delete()
on_add_heat()
DB.session.commit()
RACE.current_heat = 1
logger.info('Database heats reset') | Resets database heats to default. | Resets database heats to default. | [
"Resets",
"database",
"heats",
"to",
"default",
"."
] | def db_reset_heats():
DB.session.query(Database.Heat).delete()
DB.session.query(Database.HeatNode).delete()
on_add_heat()
DB.session.commit()
RACE.current_heat = 1
logger.info('Database heats reset') | [
"def",
"db_reset_heats",
"(",
")",
":",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"Heat",
")",
".",
"delete",
"(",
")",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"HeatNode",
")",
".",
"delete",
"(",
")",
"on_add_heat",... | Resets database heats to default. | [
"Resets",
"database",
"heats",
"to",
"default",
"."
] | [
"'''Resets database heats to default.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | db_reset_classes | null | def db_reset_classes():
'''Resets database race classes to default.'''
DB.session.query(Database.RaceClass).delete()
DB.session.commit()
logger.info('Database race classes reset') | Resets database race classes to default. | Resets database race classes to default. | [
"Resets",
"database",
"race",
"classes",
"to",
"default",
"."
] | def db_reset_classes():
DB.session.query(Database.RaceClass).delete()
DB.session.commit()
logger.info('Database race classes reset') | [
"def",
"db_reset_classes",
"(",
")",
":",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"RaceClass",
")",
".",
"delete",
"(",
")",
"DB",
".",
"session",
".",
"commit",
"(",
")",
"logger",
".",
"info",
"(",
"'Database race classes reset'",
")"... | Resets database race classes to default. | [
"Resets",
"database",
"race",
"classes",
"to",
"default",
"."
] | [
"'''Resets database race classes to default.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | db_reset_current_laps | null | def db_reset_current_laps():
'''Resets database current laps to default.'''
RACE.node_laps = {}
for idx in range(RACE.num_nodes):
RACE.node_laps[idx] = []
RACE.cacheStatus = Results.CacheStatus.INVALID
logger.debug('Database current laps reset') | Resets database current laps to default. | Resets database current laps to default. | [
"Resets",
"database",
"current",
"laps",
"to",
"default",
"."
] | def db_reset_current_laps():
RACE.node_laps = {}
for idx in range(RACE.num_nodes):
RACE.node_laps[idx] = []
RACE.cacheStatus = Results.CacheStatus.INVALID
logger.debug('Database current laps reset') | [
"def",
"db_reset_current_laps",
"(",
")",
":",
"RACE",
".",
"node_laps",
"=",
"{",
"}",
"for",
"idx",
"in",
"range",
"(",
"RACE",
".",
"num_nodes",
")",
":",
"RACE",
".",
"node_laps",
"[",
"idx",
"]",
"=",
"[",
"]",
"RACE",
".",
"cacheStatus",
"=",
... | Resets database current laps to default. | [
"Resets",
"database",
"current",
"laps",
"to",
"default",
"."
] | [
"'''Resets database current laps to default.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
db4d08d8a8af5173b1f132a9278dee6769422da4 | jukkaaakko/RotorHazard | src/server/server.py | [
"MIT"
] | Python | db_reset_saved_races | null | def db_reset_saved_races():
'''Resets database saved races to default.'''
DB.session.query(Database.SavedRaceMeta).delete()
DB.session.query(Database.SavedPilotRace).delete()
DB.session.query(Database.SavedRaceLap).delete()
DB.session.commit()
logger.info('Database saved races reset') | Resets database saved races to default. | Resets database saved races to default. | [
"Resets",
"database",
"saved",
"races",
"to",
"default",
"."
] | def db_reset_saved_races():
DB.session.query(Database.SavedRaceMeta).delete()
DB.session.query(Database.SavedPilotRace).delete()
DB.session.query(Database.SavedRaceLap).delete()
DB.session.commit()
logger.info('Database saved races reset') | [
"def",
"db_reset_saved_races",
"(",
")",
":",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"SavedRaceMeta",
")",
".",
"delete",
"(",
")",
"DB",
".",
"session",
".",
"query",
"(",
"Database",
".",
"SavedPilotRace",
")",
".",
"delete",
"(",
... | Resets database saved races to default. | [
"Resets",
"database",
"saved",
"races",
"to",
"default",
"."
] | [
"'''Resets database saved races to default.'''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | authenticate | <not_specific> | def authenticate(url, username, password):
"""
Helper function that returns an authentication token
:param url: The url of the authentication service
:param username: The username to be used for authentication
:param password: The password to be used for authentication
:return: The access token... |
Helper function that returns an authentication token
:param url: The url of the authentication service
:param username: The username to be used for authentication
:param password: The password to be used for authentication
:return: The access token
| Helper function that returns an authentication token | [
"Helper",
"function",
"that",
"returns",
"an",
"authentication",
"token"
] | def authenticate(url, username, password):
response = requests.post(
url + '/auth',
data=json.dumps({'username': username, 'password': password}),
headers={'content-type': 'application/json'},
)
response.raise_for_status()
data = response.json()
return data['access_token'] | [
"def",
"authenticate",
"(",
"url",
",",
"username",
",",
"password",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
"+",
"'/auth'",
",",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"'username'",
":",
"username",
",",
"'password'",
":"... | Helper function that returns an authentication token | [
"Helper",
"function",
"that",
"returns",
"an",
"authentication",
"token"
] | [
"\"\"\"\n Helper function that returns an authentication token\n\n :param url: The url of the authentication service\n :param username: The username to be used for authentication\n :param password: The password to be used for authentication\n :return: The access token\n \"\"\""
] | [
{
"param": "url",
"type": null
},
{
"param": "username",
"type": null
},
{
"param": "password",
"type": null
}
] | {
"returns": [
{
"docstring": "The access token",
"docstring_tokens": [
"The",
"access",
"token"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": "The url of the authentication service",... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | http_get | <not_specific> | def http_get(url, api_uri, token, **params):
"""
Helper function to perform an http get, with optional parameters
:param url: The url of the endpoint
:param api_url: The URI of the specific api
:param token: The access token
:param params: kwargs for optional parameter to the http get
:retu... |
Helper function to perform an http get, with optional parameters
:param url: The url of the endpoint
:param api_url: The URI of the specific api
:param token: The access token
:param params: kwargs for optional parameter to the http get
:return: The full requests response
| Helper function to perform an http get, with optional parameters | [
"Helper",
"function",
"to",
"perform",
"an",
"http",
"get",
"with",
"optional",
"parameters"
] | def http_get(url, api_uri, token, **params):
response = requests.get(
url + '/' + api_uri, params=params,
headers={'Authorization': 'JWT ' + token},
)
response.raise_for_status()
return response | [
"def",
"http_get",
"(",
"url",
",",
"api_uri",
",",
"token",
",",
"**",
"params",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/'",
"+",
"api_uri",
",",
"params",
"=",
"params",
",",
"headers",
"=",
"{",
"'Authorization'",
":... | Helper function to perform an http get, with optional parameters | [
"Helper",
"function",
"to",
"perform",
"an",
"http",
"get",
"with",
"optional",
"parameters"
] | [
"\"\"\"\n Helper function to perform an http get, with optional parameters\n\n :param url: The url of the endpoint\n :param api_url: The URI of the specific api\n :param token: The access token\n :param params: kwargs for optional parameter to the http get\n :return: The full requests response\n ... | [
{
"param": "url",
"type": null
},
{
"param": "api_uri",
"type": null
},
{
"param": "token",
"type": null
}
] | {
"returns": [
{
"docstring": "The full requests response",
"docstring_tokens": [
"The",
"full",
"requests",
"response"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": "The url ... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | tissuemaps_interface | <not_specific> | def tissuemaps_interface(url, token, experiment_id, channel_layer_id):
# pylint: disable=R0914
"""
Function which reads a channel layer from the TissueMAPs API.
Given NAPARI_OCTREE==1, it returns a multi-scale (pyramidal) image as a delayed Dask
array. Otherwise, it returns a high-resolution image a... |
Function which reads a channel layer from the TissueMAPs API.
Given NAPARI_OCTREE==1, it returns a multi-scale (pyramidal) image as a delayed Dask
array. Otherwise, it returns a high-resolution image as numpy array.
Note: The later will download the full image into memory!
:param url: The base url... | Function which reads a channel layer from the TissueMAPs API.
Given NAPARI_OCTREE==1, it returns a multi-scale (pyramidal) image as a delayed Dask
array. Otherwise, it returns a high-resolution image as numpy array.
Note: The later will download the full image into memory! | [
"Function",
"which",
"reads",
"a",
"channel",
"layer",
"from",
"the",
"TissueMAPs",
"API",
".",
"Given",
"NAPARI_OCTREE",
"==",
"1",
"it",
"returns",
"a",
"multi",
"-",
"scale",
"(",
"pyramidal",
")",
"image",
"as",
"a",
"delayed",
"Dask",
"array",
".",
... | def tissuemaps_interface(url, token, experiment_id, channel_layer_id):
class LazyTiledTMArray(LazyArray):
def __init__(self, shape, dtype, tile_size, zoom):
super().__init__(shape, dtype, tile_size)
self.zoom = zoom
@dask.delayed
def read_tile(self, y_tile, x_tile):
... | [
"def",
"tissuemaps_interface",
"(",
"url",
",",
"token",
",",
"experiment_id",
",",
"channel_layer_id",
")",
":",
"class",
"LazyTiledTMArray",
"(",
"LazyArray",
")",
":",
"\"\"\"\n A numpy-like array which lazily loads tiles from a TissueMAPS server.\n \"\"\"",
"d... | Function which reads a channel layer from the TissueMAPs API. | [
"Function",
"which",
"reads",
"a",
"channel",
"layer",
"from",
"the",
"TissueMAPs",
"API",
"."
] | [
"# pylint: disable=R0914",
"\"\"\"\n Function which reads a channel layer from the TissueMAPs API.\n Given NAPARI_OCTREE==1, it returns a multi-scale (pyramidal) image as a delayed Dask\n array. Otherwise, it returns a high-resolution image as numpy array.\n Note: The later will download the full imag... | [
{
"param": "url",
"type": null
},
{
"param": "token",
"type": null
},
{
"param": "experiment_id",
"type": null
},
{
"param": "channel_layer_id",
"type": null
}
] | {
"returns": [
{
"docstring": "A tiled multi-scale image if NAPARI_OCTREE==1,\notherwise a numpy array with the high-resolution image",
"docstring_tokens": [
"A",
"tiled",
"multi",
"-",
"scale",
"image",
"if",
"NAPARI_OCTREE",
"==... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | read_tile | <not_specific> | def read_tile(self, y_tile, x_tile):
'''
Reads a tile from a TissuMAPS server
:param y_tile: the y coordinate of the tile
:param x_tile: the x coordinate of the tile
:return: numpy array with the the cooresponding tile updated
'''
api_u... |
Reads a tile from a TissuMAPS server
:param y_tile: the y coordinate of the tile
:param x_tile: the x coordinate of the tile
:return: numpy array with the the cooresponding tile updated
| Reads a tile from a TissuMAPS server | [
"Reads",
"a",
"tile",
"from",
"a",
"TissuMAPS",
"server"
] | def read_tile(self, y_tile, x_tile):
api_url = (
'api/experiments/' + str(experiment_id) + '/channel_layers/' +
str(channel_layer_id) + '/tiles'
)
tiles_resp = http_get(url, api_url, token, x=x_tile, y=y_tile, z=self.zoom)
img = PIL.Image.o... | [
"def",
"read_tile",
"(",
"self",
",",
"y_tile",
",",
"x_tile",
")",
":",
"api_url",
"=",
"(",
"'api/experiments/'",
"+",
"str",
"(",
"experiment_id",
")",
"+",
"'/channel_layers/'",
"+",
"str",
"(",
"channel_layer_id",
")",
"+",
"'/tiles'",
")",
"tiles_resp"... | Reads a tile from a TissuMAPS server | [
"Reads",
"a",
"tile",
"from",
"a",
"TissuMAPS",
"server"
] | [
"'''\n Reads a tile from a TissuMAPS server\n :param y_tile: the y coordinate of the tile\n :param x_tile: the x coordinate of the tile\n :return: numpy array with the the cooresponding tile updated\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "y_tile",
"type": null
},
{
"param": "x_tile",
"type": null
}
] | {
"returns": [
{
"docstring": "numpy array with the the cooresponding tile updated",
"docstring_tokens": [
"numpy",
"array",
"with",
"the",
"the",
"cooresponding",
"tile",
"updated"
],
"type": null
}
],
"raises": [],
... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | tissuemaps_connector | <not_specific> | def tissuemaps_connector(path):
"""
Function which reads an XML specifying TissueMAPS credential and experiment/channel_layer data
and return a multi-scale (pyramidal) JPEG from TissueMAPs api as delayed Dask
array.
:param path: XML file path
:return: List of LayerData tuple
"""
xmldoc ... |
Function which reads an XML specifying TissueMAPS credential and experiment/channel_layer data
and return a multi-scale (pyramidal) JPEG from TissueMAPs api as delayed Dask
array.
:param path: XML file path
:return: List of LayerData tuple
| Function which reads an XML specifying TissueMAPS credential and experiment/channel_layer data
and return a multi-scale (pyramidal) JPEG from TissueMAPs api as delayed Dask
array. | [
"Function",
"which",
"reads",
"an",
"XML",
"specifying",
"TissueMAPS",
"credential",
"and",
"experiment",
"/",
"channel_layer",
"data",
"and",
"return",
"a",
"multi",
"-",
"scale",
"(",
"pyramidal",
")",
"JPEG",
"from",
"TissueMAPs",
"api",
"as",
"delayed",
"D... | def tissuemaps_connector(path):
xmldoc = minidom.parse(path)
auth_data = {}
auth_data['url'] = xmldoc.getElementsByTagName('url')[0].attributes['url'].value
auth_data['user'] = \
xmldoc.getElementsByTagName('user')[0].attributes['name'].value
auth_data['password'] = \
xmldoc.getEleme... | [
"def",
"tissuemaps_connector",
"(",
"path",
")",
":",
"xmldoc",
"=",
"minidom",
".",
"parse",
"(",
"path",
")",
"auth_data",
"=",
"{",
"}",
"auth_data",
"[",
"'url'",
"]",
"=",
"xmldoc",
".",
"getElementsByTagName",
"(",
"'url'",
")",
"[",
"0",
"]",
".... | Function which reads an XML specifying TissueMAPS credential and experiment/channel_layer data
and return a multi-scale (pyramidal) JPEG from TissueMAPs api as delayed Dask
array. | [
"Function",
"which",
"reads",
"an",
"XML",
"specifying",
"TissueMAPS",
"credential",
"and",
"experiment",
"/",
"channel_layer",
"data",
"and",
"return",
"a",
"multi",
"-",
"scale",
"(",
"pyramidal",
")",
"JPEG",
"from",
"TissueMAPs",
"api",
"as",
"delayed",
"D... | [
"\"\"\"\n Function which reads an XML specifying TissueMAPS credential and experiment/channel_layer data\n and return a multi-scale (pyramidal) JPEG from TissueMAPs api as delayed Dask\n array.\n\n :param path: XML file path\n :return: List of LayerData tuple\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "List of LayerData tuple",
"docstring_tokens": [
"List",
"of",
"LayerData",
"tuple"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": "XML file path... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | apply | null | def apply(url="", username="", password="", add_button=True):
# pylint: disable=W0613
"""
Dummy function to respect the FunctionGui logic. Not used since
call_button is False in this widget
""" |
Dummy function to respect the FunctionGui logic. Not used since
call_button is False in this widget
| Dummy function to respect the FunctionGui logic. Not used since
call_button is False in this widget | [
"Dummy",
"function",
"to",
"respect",
"the",
"FunctionGui",
"logic",
".",
"Not",
"used",
"since",
"call_button",
"is",
"False",
"in",
"this",
"widget"
] | def apply(url="", username="", password="", add_button=True): | [
"def",
"apply",
"(",
"url",
"=",
"\"\"",
",",
"username",
"=",
"\"\"",
",",
"password",
"=",
"\"\"",
",",
"add_button",
"=",
"True",
")",
":"
] | Dummy function to respect the FunctionGui logic. | [
"Dummy",
"function",
"to",
"respect",
"the",
"FunctionGui",
"logic",
"."
] | [
"# pylint: disable=W0613",
"\"\"\"\n Dummy function to respect the FunctionGui logic. Not used since\n call_button is False in this widget\n \"\"\""
] | [
{
"param": "url",
"type": null
},
{
"param": "username",
"type": null
},
{
"param": "password",
"type": null
},
{
"param": "add_button",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "username",
"type": null,
"docstring": null,
"docstring_tokens"... |
630d4fcc33ef5a97cde094c940d212e5372e34ac | fractal-napari-plugins-collection/napari_tissuemaps_interface | src/napari_tissuemaps_interface/napari_tissuemaps_interface.py | [
"BSD-3-Clause"
] | Python | value | <not_specific> | def value(self):
"""
Associates the value field of the TissueMAPSGetTokenWidget to the access token
"""
return self.token |
Associates the value field of the TissueMAPSGetTokenWidget to the access token
| Associates the value field of the TissueMAPSGetTokenWidget to the access token | [
"Associates",
"the",
"value",
"field",
"of",
"the",
"TissueMAPSGetTokenWidget",
"to",
"the",
"access",
"token"
] | def value(self):
return self.token | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
".",
"token"
] | Associates the value field of the TissueMAPSGetTokenWidget to the access token | [
"Associates",
"the",
"value",
"field",
"of",
"the",
"TissueMAPSGetTokenWidget",
"to",
"the",
"access",
"token"
] | [
"\"\"\"\n Associates the value field of the TissueMAPSGetTokenWidget to the access token\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.