Datasets:
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b5842703ca8bb1831f5d523d7e7e968c1ba5293a | tombch/swell | swell/swell.py | [
"MIT"
] | Python | swell_from_fasta | <not_specific> | def swell_from_fasta(fasta_path):
'''
Calculate fasta statistics given the path to a fasta/multifasta.
'''
if fasta_path == "-":
fastas = readfq.readfq(sys.stdin)
else:
fastas = readfq.readfq(open(fasta_path))
rows = []
for name, seq, qual in fastas:
rows.app... |
Calculate fasta statistics given the path to a fasta/multifasta.
| Calculate fasta statistics given the path to a fasta/multifasta. | [
"Calculate",
"fasta",
"statistics",
"given",
"the",
"path",
"to",
"a",
"fasta",
"/",
"multifasta",
"."
] | def swell_from_fasta(fasta_path):
if fasta_path == "-":
fastas = readfq.readfq(sys.stdin)
else:
fastas = readfq.readfq(open(fasta_path))
rows = []
for name, seq, qual in fastas:
rows.append([fasta_path, name] + calculate_fasta_stats(seq))
if fasta_path != "-":
fastas.... | [
"def",
"swell_from_fasta",
"(",
"fasta_path",
")",
":",
"if",
"fasta_path",
"==",
"\"-\"",
":",
"fastas",
"=",
"readfq",
".",
"readfq",
"(",
"sys",
".",
"stdin",
")",
"else",
":",
"fastas",
"=",
"readfq",
".",
"readfq",
"(",
"open",
"(",
"fasta_path",
... | Calculate fasta statistics given the path to a fasta/multifasta. | [
"Calculate",
"fasta",
"statistics",
"given",
"the",
"path",
"to",
"a",
"fasta",
"/",
"multifasta",
"."
] | [
"'''\n Calculate fasta statistics given the path to a fasta/multifasta.\n '''"
] | [
{
"param": "fasta_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b5842703ca8bb1831f5d523d7e7e968c1ba5293a | tombch/swell | swell/swell.py | [
"MIT"
] | Python | swell_from_fasta_seq | <not_specific> | def swell_from_fasta_seq(seq, fasta_path="", header=""):
'''
Calculate fasta statistics directly from a sequence.
'''
rows = [[fasta_path, header] + calculate_fasta_stats(seq)]
return ["fasta_path", "header", "num_seqs", "num_bases", "pc_acgt", "pc_masked", "pc_invalid", "pc_ambiguous", "longest_gap... |
Calculate fasta statistics directly from a sequence.
| Calculate fasta statistics directly from a sequence. | [
"Calculate",
"fasta",
"statistics",
"directly",
"from",
"a",
"sequence",
"."
] | def swell_from_fasta_seq(seq, fasta_path="", header=""):
rows = [[fasta_path, header] + calculate_fasta_stats(seq)]
return ["fasta_path", "header", "num_seqs", "num_bases", "pc_acgt", "pc_masked", "pc_invalid", "pc_ambiguous", "longest_gap", "longest_ungap"], rows | [
"def",
"swell_from_fasta_seq",
"(",
"seq",
",",
"fasta_path",
"=",
"\"\"",
",",
"header",
"=",
"\"\"",
")",
":",
"rows",
"=",
"[",
"[",
"fasta_path",
",",
"header",
"]",
"+",
"calculate_fasta_stats",
"(",
"seq",
")",
"]",
"return",
"[",
"\"fasta_path\"",
... | Calculate fasta statistics directly from a sequence. | [
"Calculate",
"fasta",
"statistics",
"directly",
"from",
"a",
"sequence",
"."
] | [
"'''\n Calculate fasta statistics directly from a sequence.\n '''"
] | [
{
"param": "seq",
"type": null
},
{
"param": "fasta_path",
"type": null
},
{
"param": "header",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_path",
"type": null,
"docstring": null,
"docstring_token... |
93f081e2ae6f8c8a487b20db6ef00a1232381cea | tiny-mouse/prove-it | calc/calculator.py | [
"MIT"
] | Python | add | <not_specific> | def add(numbers):
"""Sums all the numbers in the specified iterable"""
the_sum = 0
for number in numbers:
the_sum += int(number)
return the_sum | Sums all the numbers in the specified iterable | Sums all the numbers in the specified iterable | [
"Sums",
"all",
"the",
"numbers",
"in",
"the",
"specified",
"iterable"
] | def add(numbers):
the_sum = 0
for number in numbers:
the_sum += int(number)
return the_sum | [
"def",
"add",
"(",
"numbers",
")",
":",
"the_sum",
"=",
"0",
"for",
"number",
"in",
"numbers",
":",
"the_sum",
"+=",
"int",
"(",
"number",
")",
"return",
"the_sum"
] | Sums all the numbers in the specified iterable | [
"Sums",
"all",
"the",
"numbers",
"in",
"the",
"specified",
"iterable"
] | [
"\"\"\"Sums all the numbers in the specified iterable\"\"\""
] | [
{
"param": "numbers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "numbers",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
93f081e2ae6f8c8a487b20db6ef00a1232381cea | tiny-mouse/prove-it | calc/calculator.py | [
"MIT"
] | Python | divide | <not_specific> | def divide(numbers):
"""Divides the 1..Nth numbers from the 0th one"""
result = numbers[0]
for number in numbers[1:]:
result /= number
return result | Divides the 1..Nth numbers from the 0th one | Divides the 1..Nth numbers from the 0th one | [
"Divides",
"the",
"1",
"..",
"Nth",
"numbers",
"from",
"the",
"0th",
"one"
] | def divide(numbers):
result = numbers[0]
for number in numbers[1:]:
result /= number
return result | [
"def",
"divide",
"(",
"numbers",
")",
":",
"result",
"=",
"numbers",
"[",
"0",
"]",
"for",
"number",
"in",
"numbers",
"[",
"1",
":",
"]",
":",
"result",
"/=",
"number",
"return",
"result"
] | Divides the 1..Nth numbers from the 0th one | [
"Divides",
"the",
"1",
"..",
"Nth",
"numbers",
"from",
"the",
"0th",
"one"
] | [
"\"\"\"Divides the 1..Nth numbers from the 0th one\"\"\""
] | [
{
"param": "numbers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "numbers",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
93f081e2ae6f8c8a487b20db6ef00a1232381cea | tiny-mouse/prove-it | calc/calculator.py | [
"MIT"
] | Python | exponent | <not_specific> | def exponent(numbers):
"""Raises the 0th number to the 1..Nth numbers as powers"""
result = numbers[0]
for number in numbers[1:]:
result *= number
return result | Raises the 0th number to the 1..Nth numbers as powers | Raises the 0th number to the 1..Nth numbers as powers | [
"Raises",
"the",
"0th",
"number",
"to",
"the",
"1",
"..",
"Nth",
"numbers",
"as",
"powers"
] | def exponent(numbers):
result = numbers[0]
for number in numbers[1:]:
result *= number
return result | [
"def",
"exponent",
"(",
"numbers",
")",
":",
"result",
"=",
"numbers",
"[",
"0",
"]",
"for",
"number",
"in",
"numbers",
"[",
"1",
":",
"]",
":",
"result",
"*=",
"number",
"return",
"result"
] | Raises the 0th number to the 1..Nth numbers as powers | [
"Raises",
"the",
"0th",
"number",
"to",
"the",
"1",
"..",
"Nth",
"numbers",
"as",
"powers"
] | [
"\"\"\"Raises the 0th number to the 1..Nth numbers as powers\"\"\""
] | [
{
"param": "numbers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "numbers",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | add | <not_specific> | def add():
"""Takes numbers params and sums them together"""
if not request.args.getlist('numbers'):
return "You need to give numbers to add", 400
numbers = request.args.get('numbers')
return str(calculator.add(numbers)) | Takes numbers params and sums them together | Takes numbers params and sums them together | [
"Takes",
"numbers",
"params",
"and",
"sums",
"them",
"together"
] | def add():
if not request.args.getlist('numbers'):
return "You need to give numbers to add", 400
numbers = request.args.get('numbers')
return str(calculator.add(numbers)) | [
"def",
"add",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"getlist",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to add\"",
",",
"400",
"numbers",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
"return",
... | Takes numbers params and sums them together | [
"Takes",
"numbers",
"params",
"and",
"sums",
"them",
"together"
] | [
"\"\"\"Takes numbers params and sums them together\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | subtract | <not_specific> | def subtract():
"""Takes numbers params and subtracts them from the first"""
if not request.args.get('numbers'):
return "You need to give numbers to subtract", 400
numbers = request.args.getlist('numbers')
return str(calculator.subtract(numbers)) | Takes numbers params and subtracts them from the first | Takes numbers params and subtracts them from the first | [
"Takes",
"numbers",
"params",
"and",
"subtracts",
"them",
"from",
"the",
"first"
] | def subtract():
if not request.args.get('numbers'):
return "You need to give numbers to subtract", 400
numbers = request.args.getlist('numbers')
return str(calculator.subtract(numbers)) | [
"def",
"subtract",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to subtract\"",
",",
"400",
"numbers",
"=",
"request",
".",
"args",
".",
"getlist",
"(",
"'numbers'",
")",
... | Takes numbers params and subtracts them from the first | [
"Takes",
"numbers",
"params",
"and",
"subtracts",
"them",
"from",
"the",
"first"
] | [
"\"\"\"Takes numbers params and subtracts them from the first\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | multiply | <not_specific> | def multiply():
"""Takes numbers params and multiplies them together"""
if not request.args.get('numbers'):
return "You need to give numbers to multiply", 400
numbers = request.args['numbers']
return str(calculator.multiply(numbers)) | Takes numbers params and multiplies them together | Takes numbers params and multiplies them together | [
"Takes",
"numbers",
"params",
"and",
"multiplies",
"them",
"together"
] | def multiply():
if not request.args.get('numbers'):
return "You need to give numbers to multiply", 400
numbers = request.args['numbers']
return str(calculator.multiply(numbers)) | [
"def",
"multiply",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to multiply\"",
",",
"400",
"numbers",
"=",
"request",
".",
"args",
"[",
"'numbers'",
"]",
"return",
"str",
... | Takes numbers params and multiplies them together | [
"Takes",
"numbers",
"params",
"and",
"multiplies",
"them",
"together"
] | [
"\"\"\"Takes numbers params and multiplies them together\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | divide | <not_specific> | def divide():
"""Takes numbers params and divides them."""
if not request.args.get('numbers'):
return "You need to give numbers to divide", 400
return "I'm a divider" | Takes numbers params and divides them. | Takes numbers params and divides them. | [
"Takes",
"numbers",
"params",
"and",
"divides",
"them",
"."
] | def divide():
if not request.args.get('numbers'):
return "You need to give numbers to divide", 400
return "I'm a divider" | [
"def",
"divide",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to divide\"",
",",
"400",
"return",
"\"I'm a divider\""
] | Takes numbers params and divides them. | [
"Takes",
"numbers",
"params",
"and",
"divides",
"them",
"."
] | [
"\"\"\"Takes numbers params and divides them.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | exponential | <not_specific> | def exponential():
"""Takes numbers params and creates the exponential of them aka x^y."""
if not request.args.get('numbers'):
return "You need to give numbers to do x^y", 400
numbers = request.args['numbers']
return str(calculator.exponent(numbers)) | Takes numbers params and creates the exponential of them aka x^y. | Takes numbers params and creates the exponential of them aka x^y. | [
"Takes",
"numbers",
"params",
"and",
"creates",
"the",
"exponential",
"of",
"them",
"aka",
"x^y",
"."
] | def exponential():
if not request.args.get('numbers'):
return "You need to give numbers to do x^y", 400
numbers = request.args['numbers']
return str(calculator.exponent(numbers)) | [
"def",
"exponential",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to do x^y\"",
",",
"400",
"numbers",
"=",
"request",
".",
"args",
"[",
"'numbers'",
"]",
"return",
"str",
... | Takes numbers params and creates the exponential of them aka x^y. | [
"Takes",
"numbers",
"params",
"and",
"creates",
"the",
"exponential",
"of",
"them",
"aka",
"x^y",
"."
] | [
"\"\"\"Takes numbers params and creates the exponential of them aka x^y.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
71b8a28e225dcde9e93ae68c8399184302be65cd | tiny-mouse/prove-it | calc/views.py | [
"MIT"
] | Python | root | <not_specific> | def root():
"""Calculates the root of the inputs.
Takes numbers params and finds the xth root of y where x is the first
number param and y is the second
"""
if not request.args.get('numbers'):
return "You need to give numbers to find the root.", 400
numbers = request.args['nu... | Calculates the root of the inputs.
Takes numbers params and finds the xth root of y where x is the first
number param and y is the second
| Calculates the root of the inputs.
Takes numbers params and finds the xth root of y where x is the first
number param and y is the second | [
"Calculates",
"the",
"root",
"of",
"the",
"inputs",
".",
"Takes",
"numbers",
"params",
"and",
"finds",
"the",
"xth",
"root",
"of",
"y",
"where",
"x",
"is",
"the",
"first",
"number",
"param",
"and",
"y",
"is",
"the",
"second"
] | def root():
if not request.args.get('numbers'):
return "You need to give numbers to find the root.", 400
numbers = request.args['numbers']
return str(calculator.root(numbers)) | [
"def",
"root",
"(",
")",
":",
"if",
"not",
"request",
".",
"args",
".",
"get",
"(",
"'numbers'",
")",
":",
"return",
"\"You need to give numbers to find the root.\"",
",",
"400",
"numbers",
"=",
"request",
".",
"args",
"[",
"'numbers'",
"]",
"return",
"str",... | Calculates the root of the inputs. | [
"Calculates",
"the",
"root",
"of",
"the",
"inputs",
"."
] | [
"\"\"\"Calculates the root of the inputs.\n \n Takes numbers params and finds the xth root of y where x is the first \n number param and y is the second\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e492972045a63af8bc0242e8f05dbd97d64bc41d | lab-a1/captcha-recognition | src/lib/metrics.py | [
"WTFPL"
] | Python | accuracy | <not_specific> | def accuracy(output, target):
"""Mean between the predictions for the five characters."""
accuracy_result = 0
for y, t in zip(output, target):
_, predicted = torch.max(y.data, 1)
correct_predictions = (predicted == t).sum().item()
accuracy_result += correct_predictions / t.size(0)
... | Mean between the predictions for the five characters. | Mean between the predictions for the five characters. | [
"Mean",
"between",
"the",
"predictions",
"for",
"the",
"five",
"characters",
"."
] | def accuracy(output, target):
accuracy_result = 0
for y, t in zip(output, target):
_, predicted = torch.max(y.data, 1)
correct_predictions = (predicted == t).sum().item()
accuracy_result += correct_predictions / t.size(0)
return accuracy_result / len(target) | [
"def",
"accuracy",
"(",
"output",
",",
"target",
")",
":",
"accuracy_result",
"=",
"0",
"for",
"y",
",",
"t",
"in",
"zip",
"(",
"output",
",",
"target",
")",
":",
"_",
",",
"predicted",
"=",
"torch",
".",
"max",
"(",
"y",
".",
"data",
",",
"1",
... | Mean between the predictions for the five characters. | [
"Mean",
"between",
"the",
"predictions",
"for",
"the",
"five",
"characters",
"."
] | [
"\"\"\"Mean between the predictions for the five characters.\"\"\""
] | [
{
"param": "output",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens... |
8f16b8482680785e92b1e9ccf9bc06e257c8b43f | roman-baldaev/test-task-weather | frontend/database.py | [
"MIT"
] | Python | yandex | <not_specific> | def yandex(city):
"""Function for obtaining temperature from Yandex.
Accepts the name of the city (city).
The temperature is extracted directly from the HTML page.
Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL.
"""
... | Function for obtaining temperature from Yandex.
Accepts the name of the city (city).
The temperature is extracted directly from the HTML page.
Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL.
| Function for obtaining temperature from Yandex.
Accepts the name of the city (city).
The temperature is extracted directly from the HTML page.
Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL. | [
"Function",
"for",
"obtaining",
"temperature",
"from",
"Yandex",
".",
"Accepts",
"the",
"name",
"of",
"the",
"city",
"(",
"city",
")",
".",
"The",
"temperature",
"is",
"extracted",
"directly",
"from",
"the",
"HTML",
"page",
".",
"Return",
"a",
"list",
"wit... | def yandex(city):
try:
myheader = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' \
'(KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36',
}
url = 'https://yandex.ru/pogoda/{}'.format(city)
req = request.Re... | [
"def",
"yandex",
"(",
"city",
")",
":",
"try",
":",
"myheader",
"=",
"{",
"'User-Agent'",
":",
"'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 '",
"'(KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36'",
",",
"}",
"url",
"=",
"'https://yandex.ru/pogoda/{}'",
".",
"fo... | Function for obtaining temperature from Yandex. | [
"Function",
"for",
"obtaining",
"temperature",
"from",
"Yandex",
"."
] | [
"\"\"\"Function for obtaining temperature from Yandex.\n\n Accepts the name of the city (city).\n The temperature is extracted directly from the HTML page.\n Return a list with two values.\n In case of success - value of temperature and URL, otherwise - error and URL.\n\n \"\"\"",
"... | [
{
"param": "city",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "city",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f16b8482680785e92b1e9ccf9bc06e257c8b43f | roman-baldaev/test-task-weather | frontend/database.py | [
"MIT"
] | Python | open_weather_map | <not_specific> | def open_weather_map(city):
"""Function for obtaining temperature from Yandex.
Accepts the name of the city (city)
The temperature is extracted from the JSON file obtained with OpenWeatherMap API.
Return a list with two values.
In case of success - value of temperature and URL, oth... | Function for obtaining temperature from Yandex.
Accepts the name of the city (city)
The temperature is extracted from the JSON file obtained with OpenWeatherMap API.
Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL.
| Function for obtaining temperature from Yandex.
Accepts the name of the city (city)
The temperature is extracted from the JSON file obtained with OpenWeatherMap API.
Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL. | [
"Function",
"for",
"obtaining",
"temperature",
"from",
"Yandex",
".",
"Accepts",
"the",
"name",
"of",
"the",
"city",
"(",
"city",
")",
"The",
"temperature",
"is",
"extracted",
"from",
"the",
"JSON",
"file",
"obtained",
"with",
"OpenWeatherMap",
"API",
".",
"... | def open_weather_map(city):
try:
url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=c7365fbce4cdaa0eed49c8adb6828336'.format(city)
req = requests.get(url)
temperature = float(req.json()['main']['temp']) - 273.15
return [round(temperature, 1), url]
except Exception a... | [
"def",
"open_weather_map",
"(",
"city",
")",
":",
"try",
":",
"url",
"=",
"'http://api.openweathermap.org/data/2.5/weather?q={}&appid=c7365fbce4cdaa0eed49c8adb6828336'",
".",
"format",
"(",
"city",
")",
"req",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"temperature... | Function for obtaining temperature from Yandex. | [
"Function",
"for",
"obtaining",
"temperature",
"from",
"Yandex",
"."
] | [
"\"\"\"Function for obtaining temperature from Yandex.\n\n Accepts the name of the city (city)\n The temperature is extracted from the JSON file obtained with OpenWeatherMap API.\n\n Return a list with two values.\n In case of success - value of temperature and URL, otherwise - error and... | [
{
"param": "city",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "city",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f16b8482680785e92b1e9ccf9bc06e257c8b43f | roman-baldaev/test-task-weather | frontend/database.py | [
"MIT"
] | Python | auto_update_function | <not_specific> | def auto_update_function(cities):
"""Auto-update weather function
The function takes a list of the cities to update.
If the error connecting to sources - an error with
a status of 500 and JSON with the cause of the error and URL.
If the connection is successful, it enters the
... | Auto-update weather function
The function takes a list of the cities to update.
If the error connecting to sources - an error with
a status of 500 and JSON with the cause of the error and URL.
If the connection is successful, it enters the
data into the database and returns an ... | Auto-update weather function
The function takes a list of the cities to update.
If the error connecting to sources - an error with
a status of 500 and JSON with the cause of the error and URL.
If the connection is successful, it enters the
data into the database and returns an empty response with code 200. | [
"Auto",
"-",
"update",
"weather",
"function",
"The",
"function",
"takes",
"a",
"list",
"of",
"the",
"cities",
"to",
"update",
".",
"If",
"the",
"error",
"connecting",
"to",
"sources",
"-",
"an",
"error",
"with",
"a",
"status",
"of",
"500",
"and",
"JSON",... | def auto_update_function(cities):
try:
connect = psycopg2.connect(database = 'django_test', user = 'roman',
host = 'localhost', password = 'admin')
cursor = connect.cursor()
cursor.execute(
'SELECT city_name FROM frontend_cit... | [
"def",
"auto_update_function",
"(",
"cities",
")",
":",
"try",
":",
"connect",
"=",
"psycopg2",
".",
"connect",
"(",
"database",
"=",
"'django_test'",
",",
"user",
"=",
"'roman'",
",",
"host",
"=",
"'localhost'",
",",
"password",
"=",
"'admin'",
")",
"curs... | Auto-update weather function
The function takes a list of the cities to update. | [
"Auto",
"-",
"update",
"weather",
"function",
"The",
"function",
"takes",
"a",
"list",
"of",
"the",
"cities",
"to",
"update",
"."
] | [
"\"\"\"Auto-update weather function\n The function takes a list of the cities to update.\n\n If the error connecting to sources - an error with\n a status of 500 and JSON with the cause of the error and URL.\n\n If the connection is successful, it enters the\n data into the databa... | [
{
"param": "cities",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cities",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3f7d19ea1361b53c9bad3edb8a7b61141a83f49a | roman-baldaev/test-task-weather | frontend/last_update.py | [
"MIT"
] | Python | last_update_temperature | <not_specific> | def last_update_temperature(city):
"""A script to retrieve data from the last update.
First check the availability of the city in the database - if not,
then the error 404 and JSON with error and reason.
If the city is in the database - sort by the time of the addition and select the last ent... | A script to retrieve data from the last update.
First check the availability of the city in the database - if not,
then the error 404 and JSON with error and reason.
If the city is in the database - sort by the time of the addition and select the last entry.
Return JSON with the results, c... | A script to retrieve data from the last update.
First check the availability of the city in the database - if not,
then the error 404 and JSON with error and reason.
If the city is in the database - sort by the time of the addition and select the last entry.
Return JSON with the results, code 200.
If the error connec... | [
"A",
"script",
"to",
"retrieve",
"data",
"from",
"the",
"last",
"update",
".",
"First",
"check",
"the",
"availability",
"of",
"the",
"city",
"in",
"the",
"database",
"-",
"if",
"not",
"then",
"the",
"error",
"404",
"and",
"JSON",
"with",
"error",
"and",
... | def last_update_temperature(city):
try:
utc_timezone = pytz.timezone('UTC')
connect = psycopg2.connect(database='django_test', user='roman',
host='localhost', password='admin')
cursor = connect.cursor()
cursor.execute("SELECT id FROM frontend_city W... | [
"def",
"last_update_temperature",
"(",
"city",
")",
":",
"try",
":",
"utc_timezone",
"=",
"pytz",
".",
"timezone",
"(",
"'UTC'",
")",
"connect",
"=",
"psycopg2",
".",
"connect",
"(",
"database",
"=",
"'django_test'",
",",
"user",
"=",
"'roman'",
",",
"host... | A script to retrieve data from the last update. | [
"A",
"script",
"to",
"retrieve",
"data",
"from",
"the",
"last",
"update",
"."
] | [
"\"\"\"A script to retrieve data from the last update.\n\n First check the availability of the city in the database - if not,\n then the error 404 and JSON with error and reason.\n\n If the city is in the database - sort by the time of the addition and select the last entry.\n Return JSON wi... | [
{
"param": "city",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "city",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
306796f94a06d9a56bad1aded06bdccd3be77267 | possoj/Mobile-URSONet | src/my_mobile_ursonet.py | [
"MIT"
] | Python | copy_state_dict | <not_specific> | def copy_state_dict(state_dict_1, state_dict_2):
"""Manual copy of state dict.
Why ? Because when copying a state dict to another with load_state_dict, the values of weight are copied only
when keys are the same in both state_dict, even if strict=False.
"""
state1_keys = list(state_dict_1.keys())
... | Manual copy of state dict.
Why ? Because when copying a state dict to another with load_state_dict, the values of weight are copied only
when keys are the same in both state_dict, even if strict=False.
| Manual copy of state dict.
Why . Because when copying a state dict to another with load_state_dict, the values of weight are copied only
when keys are the same in both state_dict, even if strict=False. | [
"Manual",
"copy",
"of",
"state",
"dict",
".",
"Why",
".",
"Because",
"when",
"copying",
"a",
"state",
"dict",
"to",
"another",
"with",
"load_state_dict",
"the",
"values",
"of",
"weight",
"are",
"copied",
"only",
"when",
"keys",
"are",
"the",
"same",
"in",
... | def copy_state_dict(state_dict_1, state_dict_2):
state1_keys = list(state_dict_1.keys())
state2_keys = list(state_dict_2.keys())
for x in range(len(state1_keys)):
state_dict_2[state2_keys[x]] = state_dict_1[state1_keys[x]]
return state_dict_2 | [
"def",
"copy_state_dict",
"(",
"state_dict_1",
",",
"state_dict_2",
")",
":",
"state1_keys",
"=",
"list",
"(",
"state_dict_1",
".",
"keys",
"(",
")",
")",
"state2_keys",
"=",
"list",
"(",
"state_dict_2",
".",
"keys",
"(",
")",
")",
"for",
"x",
"in",
"ran... | Manual copy of state dict. | [
"Manual",
"copy",
"of",
"state",
"dict",
"."
] | [
"\"\"\"Manual copy of state dict.\n Why ? Because when copying a state dict to another with load_state_dict, the values of weight are copied only\n when keys are the same in both state_dict, even if strict=False.\n \"\"\""
] | [
{
"param": "state_dict_1",
"type": null
},
{
"param": "state_dict_2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "state_dict_1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state_dict_2",
"type": null,
"docstring": null,
"docs... |
6a722055313c732c10b3d4f42d8740e1030f0cea | possoj/Mobile-URSONet | src/utils.py | [
"MIT"
] | Python | build_histogram | <not_specific> | def build_histogram(n_bins_per_dim, min_lim, max_lim):
"""Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf
The histogram is built only once to save time during execution
... | Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf
The histogram is built only once to save time during execution
| Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation). | [
"Building",
"the",
"histogram",
"of",
"all",
"possible",
"orientation",
"bins",
"given",
"the",
"number",
"of",
"bins",
"per",
"dimension",
"and",
"min",
"/",
"max",
"limits",
"on",
"Z",
"Y",
"and",
"X",
"axis",
"(",
"rotation",
")",
"."
] | def build_histogram(n_bins_per_dim, min_lim, max_lim):
d = 3
n_bins = n_bins_per_dim ** d
bins_per_dim = torch.linspace(0.0, 1.0, n_bins_per_dim)
bins_all_dims = torch.cartesian_prod(bins_per_dim, bins_per_dim, bins_per_dim)
euler_bins = bins_all_dims * (max_lim - min_lim) + min_lim
quaternions_... | [
"def",
"build_histogram",
"(",
"n_bins_per_dim",
",",
"min_lim",
",",
"max_lim",
")",
":",
"d",
"=",
"3",
"n_bins",
"=",
"n_bins_per_dim",
"**",
"d",
"bins_per_dim",
"=",
"torch",
".",
"linspace",
"(",
"0.0",
",",
"1.0",
",",
"n_bins_per_dim",
")",
"bins_a... | Building the histogram of all possible orientation bins, given the number of bins per dimension and
min/max limits on Z, Y and X axis (rotation). | [
"Building",
"the",
"histogram",
"of",
"all",
"possible",
"orientation",
"bins",
"given",
"the",
"number",
"of",
"bins",
"per",
"dimension",
"and",
"min",
"/",
"max",
"limits",
"on",
"Z",
"Y",
"and",
"X",
"axis",
"(",
"rotation",
")",
"."
] | [
"\"\"\"Building the histogram of all possible orientation bins, given the number of bins per dimension and\n min/max limits on Z, Y and X axis (rotation). See https://arxiv.org/pdf/1906.09868.pdf\n The histogram is built only once to save time during execution\n \"\"\"",
"# Construct histogram structure"... | [
{
"param": "n_bins_per_dim",
"type": null
},
{
"param": "min_lim",
"type": null
},
{
"param": "max_lim",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n_bins_per_dim",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "min_lim",
"type": null,
"docstring": null,
"docstri... |
6a722055313c732c10b3d4f42d8740e1030f0cea | possoj/Mobile-URSONet | src/utils.py | [
"MIT"
] | Python | decode_ori_batch | <not_specific> | def decode_ori_batch(ori, b):
"""Decode a batch of orientation (ori) using the pre-computed orientation decode variable (b) based on the histogram
(see pre_compute_ori_decode)
"""
ori = ori.cpu()
batch_size = ori.size(0)
ori_avg = torch.zeros((batch_size, 4), dtype=torch.float32)
h_avg = t... | Decode a batch of orientation (ori) using the pre-computed orientation decode variable (b) based on the histogram
(see pre_compute_ori_decode)
| Decode a batch of orientation (ori) using the pre-computed orientation decode variable (b) based on the histogram | [
"Decode",
"a",
"batch",
"of",
"orientation",
"(",
"ori",
")",
"using",
"the",
"pre",
"-",
"computed",
"orientation",
"decode",
"variable",
"(",
"b",
")",
"based",
"on",
"the",
"histogram"
] | def decode_ori_batch(ori, b):
ori = ori.cpu()
batch_size = ori.size(0)
ori_avg = torch.zeros((batch_size, 4), dtype=torch.float32)
h_avg = torch.zeros((batch_size, 4, 4), dtype=torch.float32)
for i in range(batch_size):
ori_avg[i], h_avg[i] = decode_ori(ori[i], b)
return ori_avg, h_avg | [
"def",
"decode_ori_batch",
"(",
"ori",
",",
"b",
")",
":",
"ori",
"=",
"ori",
".",
"cpu",
"(",
")",
"batch_size",
"=",
"ori",
".",
"size",
"(",
"0",
")",
"ori_avg",
"=",
"torch",
".",
"zeros",
"(",
"(",
"batch_size",
",",
"4",
")",
",",
"dtype",
... | Decode a batch of orientation (ori) using the pre-computed orientation decode variable (b) based on the histogram
(see pre_compute_ori_decode) | [
"Decode",
"a",
"batch",
"of",
"orientation",
"(",
"ori",
")",
"using",
"the",
"pre",
"-",
"computed",
"orientation",
"decode",
"variable",
"(",
"b",
")",
"based",
"on",
"the",
"histogram",
"(",
"see",
"pre_compute_ori_decode",
")"
] | [
"\"\"\"Decode a batch of orientation (ori) using the pre-computed orientation decode variable (b) based on the histogram\n (see pre_compute_ori_decode)\n \"\"\""
] | [
{
"param": "ori",
"type": null
},
{
"param": "b",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ori",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
b92b611f413dd6eec68bab2a417c805eb92b5a92 | possoj/Mobile-URSONet | src/data.py | [
"MIT"
] | Python | copy_speed_dataset_resize | null | def copy_speed_dataset_resize(old_path, new_path, new_size=(224, 224), split='train'):
"""copy and resize Speed images to a new directory. The new (empty) folders must be created before calling
this function"""
if split not in {'train', 'test', 'real_test'}:
raise ValueError('Invalid split, has to ... | copy and resize Speed images to a new directory. The new (empty) folders must be created before calling
this function | copy and resize Speed images to a new directory. The new (empty) folders must be created before calling
this function | [
"copy",
"and",
"resize",
"Speed",
"images",
"to",
"a",
"new",
"directory",
".",
"The",
"new",
"(",
"empty",
")",
"folders",
"must",
"be",
"created",
"before",
"calling",
"this",
"function"
] | def copy_speed_dataset_resize(old_path, new_path, new_size=(224, 224), split='train'):
if split not in {'train', 'test', 'real_test'}:
raise ValueError('Invalid split, has to be either \'train\', \'test\' or \'real_test\'')
with open(os.path.join(old_path, split + '.json'), 'r') as f:
target_lis... | [
"def",
"copy_speed_dataset_resize",
"(",
"old_path",
",",
"new_path",
",",
"new_size",
"=",
"(",
"224",
",",
"224",
")",
",",
"split",
"=",
"'train'",
")",
":",
"if",
"split",
"not",
"in",
"{",
"'train'",
",",
"'test'",
",",
"'real_test'",
"}",
":",
"r... | copy and resize Speed images to a new directory. | [
"copy",
"and",
"resize",
"Speed",
"images",
"to",
"a",
"new",
"directory",
"."
] | [
"\"\"\"copy and resize Speed images to a new directory. The new (empty) folders must be created before calling\n this function\"\"\""
] | [
{
"param": "old_path",
"type": null
},
{
"param": "new_path",
"type": null
},
{
"param": "new_size",
"type": null
},
{
"param": "split",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "old_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new_path",
"type": null,
"docstring": null,
"docstring_to... |
8cd96511c23ec58df9bfdfb466a9a888c10dea24 | possoj/Mobile-URSONet | src/pose_net.py | [
"MIT"
] | Python | import_dataset | <not_specific> | def import_dataset(self):
"""Import the dataset. May take some seconds as we pre-compute the histogram to save time later"""
print('Import dataset...')
if self.config.DATASET == 'SPEED':
dataloader = prepare_speed_dataset(self.config)
else:
raise ValueError('Datas... | Import the dataset. May take some seconds as we pre-compute the histogram to save time later | Import the dataset. May take some seconds as we pre-compute the histogram to save time later | [
"Import",
"the",
"dataset",
".",
"May",
"take",
"some",
"seconds",
"as",
"we",
"pre",
"-",
"compute",
"the",
"histogram",
"to",
"save",
"time",
"later"
] | def import_dataset(self):
print('Import dataset...')
if self.config.DATASET == 'SPEED':
dataloader = prepare_speed_dataset(self.config)
else:
raise ValueError('Dataset must be \'SPEED\' (URSO dataset not implemented)')
return dataloader | [
"def",
"import_dataset",
"(",
"self",
")",
":",
"print",
"(",
"'Import dataset...'",
")",
"if",
"self",
".",
"config",
".",
"DATASET",
"==",
"'SPEED'",
":",
"dataloader",
"=",
"prepare_speed_dataset",
"(",
"self",
".",
"config",
")",
"else",
":",
"raise",
... | Import the dataset. | [
"Import",
"the",
"dataset",
"."
] | [
"\"\"\"Import the dataset. May take some seconds as we pre-compute the histogram to save time later\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8cd96511c23ec58df9bfdfb466a9a888c10dea24 | possoj/Mobile-URSONet | src/pose_net.py | [
"MIT"
] | Python | evaluate_submit | null | def evaluate_submit(self, sub):
"""Evaluation on test set for submission on ESA website"""
for phase in ['test', 'real_test']:
loop = tqdm(self.dataloader[phase], desc="Evaluation for submission",
bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}', file=sys.stdout)
... | Evaluation on test set for submission on ESA website | Evaluation on test set for submission on ESA website | [
"Evaluation",
"on",
"test",
"set",
"for",
"submission",
"on",
"ESA",
"website"
] | def evaluate_submit(self, sub):
for phase in ['test', 'real_test']:
loop = tqdm(self.dataloader[phase], desc="Evaluation for submission",
bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}', file=sys.stdout)
for inputs, filenames in loop:
inputs = inputs... | [
"def",
"evaluate_submit",
"(",
"self",
",",
"sub",
")",
":",
"for",
"phase",
"in",
"[",
"'test'",
",",
"'real_test'",
"]",
":",
"loop",
"=",
"tqdm",
"(",
"self",
".",
"dataloader",
"[",
"phase",
"]",
",",
"desc",
"=",
"\"Evaluation for submission\"",
","... | Evaluation on test set for submission on ESA website | [
"Evaluation",
"on",
"test",
"set",
"for",
"submission",
"on",
"ESA",
"website"
] | [
"\"\"\"Evaluation on test set for submission on ESA website\"\"\"",
"# Send inputs to GPU memory if device is CUDA",
"# Runs the forward pass under autocast",
"# forward: predict output"
] | [
{
"param": "self",
"type": null
},
{
"param": "sub",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sub",
"type": null,
"docstring": null,
"docstring_tokens": []... |
8cd96511c23ec58df9bfdfb466a9a888c10dea24 | possoj/Mobile-URSONet | src/pose_net.py | [
"MIT"
] | Python | eval_error_distance | <not_specific> | def eval_error_distance(self):
"""Evaluation on validation set. Distance with the target spacecraft is also returned for each prediction"""
phase = 'valid'
loop = tqdm(self.dataloader[phase], desc="Evaluation by distance", file=sys.stdout,
bar_format='{l_bar}{bar:10}{r_bar}{... | Evaluation on validation set. Distance with the target spacecraft is also returned for each prediction | Evaluation on validation set. Distance with the target spacecraft is also returned for each prediction | [
"Evaluation",
"on",
"validation",
"set",
".",
"Distance",
"with",
"the",
"target",
"spacecraft",
"is",
"also",
"returned",
"for",
"each",
"prediction"
] | def eval_error_distance(self):
phase = 'valid'
loop = tqdm(self.dataloader[phase], desc="Evaluation by distance", file=sys.stdout,
bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}')
ori_error = []
pos_error = []
distance = []
for inputs, targets in loop:
... | [
"def",
"eval_error_distance",
"(",
"self",
")",
":",
"phase",
"=",
"'valid'",
"loop",
"=",
"tqdm",
"(",
"self",
".",
"dataloader",
"[",
"phase",
"]",
",",
"desc",
"=",
"\"Evaluation by distance\"",
",",
"file",
"=",
"sys",
".",
"stdout",
",",
"bar_format",... | Evaluation on validation set. | [
"Evaluation",
"on",
"validation",
"set",
"."
] | [
"\"\"\"Evaluation on validation set. Distance with the target spacecraft is also returned for each prediction\"\"\"",
"# Send inputs and targets tu GPU memory if device is CUDA ",
"# Scaling down intermediate sum. See get_score function for more details"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8cd96511c23ec58df9bfdfb466a9a888c10dea24 | possoj/Mobile-URSONet | src/pose_net.py | [
"MIT"
] | Python | objective | <not_specific> | def objective(self, trial):
"""This is an objective function for hyperparameter tuning with Optuna"""
self.hparam_step += 1
# Uncomment the following to add hyperparameters:
# lr = trial.suggest_uniform("lr", 1e-5, 1e-1)
# self.config.ROT_PROBABILITY = trial.suggest_float("ROT_P... | This is an objective function for hyperparameter tuning with Optuna | This is an objective function for hyperparameter tuning with Optuna | [
"This",
"is",
"an",
"objective",
"function",
"for",
"hyperparameter",
"tuning",
"with",
"Optuna"
] | def objective(self, trial):
self.hparam_step += 1
self.config.WEIGHT_DECAY = trial.suggest_float("WEIGHT_DECAY", 0, 1e-2, step=1e-5)
self.model = self.import_model()
self.dataloader = self.import_dataset()
self.ori_criterion, self.pos_criterion = self.set_loss()
self.opti... | [
"def",
"objective",
"(",
"self",
",",
"trial",
")",
":",
"self",
".",
"hparam_step",
"+=",
"1",
"self",
".",
"config",
".",
"WEIGHT_DECAY",
"=",
"trial",
".",
"suggest_float",
"(",
"\"WEIGHT_DECAY\"",
",",
"0",
",",
"1e-2",
",",
"step",
"=",
"1e-5",
")... | This is an objective function for hyperparameter tuning with Optuna | [
"This",
"is",
"an",
"objective",
"function",
"for",
"hyperparameter",
"tuning",
"with",
"Optuna"
] | [
"\"\"\"This is an objective function for hyperparameter tuning with Optuna\"\"\"",
"# Uncomment the following to add hyperparameters:",
"# lr = trial.suggest_uniform(\"lr\", 1e-5, 1e-1)",
"# self.config.ROT_PROBABILITY = trial.suggest_float(\"ROT_PROBABILITY\", 0, 1, step=0.1)",
"# self.config.ROT_MAX_MAGNI... | [
{
"param": "self",
"type": null
},
{
"param": "trial",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "trial",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8d68d32606b5ec842e383048c2b8a235a4f7a412 | kwarodom/mib_ui_data_analytics | energygame/views.py | [
"Unlicense"
] | Python | smap_plot_thermostat | <not_specific> | def smap_plot_thermostat(request, mac):
"""Page load definition for thermostat statistics."""
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
mac = '18b4302964f1'
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.obje... | Page load definition for thermostat statistics. | Page load definition for thermostat statistics. | [
"Page",
"load",
"definition",
"for",
"thermostat",
"statistics",
"."
] | def smap_plot_thermostat(request, mac):
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
mac = '18b4302964f1'
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print device_metadata
... | [
"def",
"smap_plot_thermostat",
"(",
"request",
",",
"mac",
")",
":",
"print",
"\"inside smap view method\"",
"context",
"=",
"RequestContext",
"(",
"request",
")",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"mac",
"=",
"'18b4302964f1'",
"device_metadata",... | Page load definition for thermostat statistics. | [
"Page",
"load",
"definition",
"for",
"thermostat",
"statistics",
"."
] | [
"\"\"\"Page load definition for thermostat statistics.\"\"\""
] | [
{
"param": "request",
"type": null
},
{
"param": "mac",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac",
"type": null,
"docstring": null,
"docstring_tokens":... |
8d68d32606b5ec842e383048c2b8a235a4f7a412 | kwarodom/mib_ui_data_analytics | energygame/views.py | [
"Unlicense"
] | Python | smap_plot_vav | <not_specific> | def smap_plot_vav(request, mac):
"""Page load definition for VAV statistics."""
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print ... | Page load definition for VAV statistics. | Page load definition for VAV statistics. | [
"Page",
"load",
"definition",
"for",
"VAV",
"statistics",
"."
] | def smap_plot_vav(request, mac):
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print device_metadata
device_id = device_metadata[... | [
"def",
"smap_plot_vav",
"(",
"request",
",",
"mac",
")",
":",
"print",
"\"inside smap view method\"",
"context",
"=",
"RequestContext",
"(",
"request",
")",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"device_metadata",
"=",
"[",
"ob",
".",
"device_con... | Page load definition for VAV statistics. | [
"Page",
"load",
"definition",
"for",
"VAV",
"statistics",
"."
] | [
"\"\"\"Page load definition for VAV statistics.\"\"\""
] | [
{
"param": "request",
"type": null
},
{
"param": "mac",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac",
"type": null,
"docstring": null,
"docstring_tokens":... |
8d68d32606b5ec842e383048c2b8a235a4f7a412 | kwarodom/mib_ui_data_analytics | energygame/views.py | [
"Unlicense"
] | Python | smap_plot_rtu | <not_specific> | def smap_plot_rtu(request, mac):
"""Page load definition for RTU statistics."""
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print ... | Page load definition for RTU statistics. | Page load definition for RTU statistics. | [
"Page",
"load",
"definition",
"for",
"RTU",
"statistics",
"."
] | def smap_plot_rtu(request, mac):
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print device_metadata
device_id = device_metadata[... | [
"def",
"smap_plot_rtu",
"(",
"request",
",",
"mac",
")",
":",
"print",
"\"inside smap view method\"",
"context",
"=",
"RequestContext",
"(",
"request",
")",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"device_metadata",
"=",
"[",
"ob",
".",
"device_con... | Page load definition for RTU statistics. | [
"Page",
"load",
"definition",
"for",
"RTU",
"statistics",
"."
] | [
"\"\"\"Page load definition for RTU statistics.\"\"\"",
"#parsed_json = [[1406349525000.0, 74.0], [1406349581000.0, 74.0], [1406349641000.0, 74.0], [1406349701000.0, 74.0], [1406349762000.0, 74.0], [1406349822000.0, 74.0], [1406349882000.0, 74.0], [1406349942000.0, 74.0], [1406350002000.0, 74.0], [1406350065000.0... | [
{
"param": "request",
"type": null
},
{
"param": "mac",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac",
"type": null,
"docstring": null,
"docstring_tokens":... |
afbfe2075bc7282dde472eed9fb933923c108afe | kwarodom/mib_ui_data_analytics | dashboard/views.py | [
"Unlicense"
] | Python | smap_plot_thermostat | <not_specific> | def smap_plot_thermostat(request, mac):
"""Page load definition for thermostat statistics."""
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
... | Page load definition for thermostat statistics. | Page load definition for thermostat statistics. | [
"Page",
"load",
"definition",
"for",
"thermostat",
"statistics",
"."
] | def smap_plot_thermostat(request, mac):
print "inside smap view method"
context = RequestContext(request)
if request.method == 'GET':
device_metadata = [ob.device_control_page_info() for ob in DeviceMetadata.objects.filter(mac_address=mac)]
print device_metadata
device_id = device_me... | [
"def",
"smap_plot_thermostat",
"(",
"request",
",",
"mac",
")",
":",
"print",
"\"inside smap view method\"",
"context",
"=",
"RequestContext",
"(",
"request",
")",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"device_metadata",
"=",
"[",
"ob",
".",
"dev... | Page load definition for thermostat statistics. | [
"Page",
"load",
"definition",
"for",
"thermostat",
"statistics",
"."
] | [
"\"\"\"Page load definition for thermostat statistics.\"\"\""
] | [
{
"param": "request",
"type": null
},
{
"param": "mac",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac",
"type": null,
"docstring": null,
"docstring_tokens":... |
65f423e476999d2a0ff3d5806c533bff23d4a718 | kwarodom/mib_ui_data_analytics | IEBSubscriber/iebsubscriber/agent.py | [
"Unlicense"
] | Python | on_match_device_status_update | null | def on_match_device_status_update(self, topic, headers, message, match):
'''Handle message and send to browser.'''
print os.path.basename(__file__)+"@on_match_device_status_update"
print "message:"+str(message)
device_info = topic.split('/')
device_id = device_info[6]
dev... | Handle message and send to browser. | Handle message and send to browser. | [
"Handle",
"message",
"and",
"send",
"to",
"browser",
"."
] | def on_match_device_status_update(self, topic, headers, message, match):
print os.path.basename(__file__)+"@on_match_device_status_update"
print "message:"+str(message)
device_info = topic.split('/')
device_id = device_info[6]
device_type = device_info[5]
page_load_helper... | [
"def",
"on_match_device_status_update",
"(",
"self",
",",
"topic",
",",
"headers",
",",
"message",
",",
"match",
")",
":",
"print",
"os",
".",
"path",
".",
"basename",
"(",
"__file__",
")",
"+",
"\"@on_match_device_status_update\"",
"print",
"\"message:\"",
"+",... | Handle message and send to browser. | [
"Handle",
"message",
"and",
"send",
"to",
"browser",
"."
] | [
"'''Handle message and send to browser.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "topic",
"type": null
},
{
"param": "headers",
"type": null
},
{
"param": "message",
"type": null
},
{
"param": "match",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "topic",
"type": null,
"docstring": null,
"docstring_tokens": ... |
65f423e476999d2a0ff3d5806c533bff23d4a718 | kwarodom/mib_ui_data_analytics | IEBSubscriber/iebsubscriber/agent.py | [
"Unlicense"
] | Python | on_match_device_status_update_rtu | null | def on_match_device_status_update_rtu(self, topic, headers, message, match):
'''Handle message and send to browser.'''
print os.path.basename(__file__)+"@on_match_device_status_update"
print "message:"+str(message)
device_info = topic.split('/')
device_id = device_info[6]
... | Handle message and send to browser. | Handle message and send to browser. | [
"Handle",
"message",
"and",
"send",
"to",
"browser",
"."
] | def on_match_device_status_update_rtu(self, topic, headers, message, match):
print os.path.basename(__file__)+"@on_match_device_status_update"
print "message:"+str(message)
device_info = topic.split('/')
device_id = device_info[6]
device_type = device_info[5]
page_load_he... | [
"def",
"on_match_device_status_update_rtu",
"(",
"self",
",",
"topic",
",",
"headers",
",",
"message",
",",
"match",
")",
":",
"print",
"os",
".",
"path",
".",
"basename",
"(",
"__file__",
")",
"+",
"\"@on_match_device_status_update\"",
"print",
"\"message:\"",
... | Handle message and send to browser. | [
"Handle",
"message",
"and",
"send",
"to",
"browser",
"."
] | [
"'''Handle message and send to browser.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "topic",
"type": null
},
{
"param": "headers",
"type": null
},
{
"param": "message",
"type": null
},
{
"param": "match",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "topic",
"type": null,
"docstring": null,
"docstring_tokens": ... |
Python execution prediction training pool
Short Python functions, a concrete call of each one, and the value that call really returns, from five public sources read at the pinned revisions named below and laid out twice. Train on either layer or on both.
pool.jsonl
Every source rewritten into one shape, 38154 rows, one JSON object per line, with these fields.
| Field | What it holds |
|---|---|
id |
a row identifier unique within this file |
code |
the Python source that defines the function |
entry_point |
the name of the function the call names |
input |
the argument text, so the call is entry_point(input) |
output |
the repr of the value that call returns |
source |
the name of the source directory the row came from |
source_repo, source_revision |
the dataset and the revision it was read at |
source_file, source_id |
the file and the row's own name in that set: its id or task and position for PyX, the execution trace set and MBPP, the function's URL for CodeSearchNet, and repository, path and identifier for The Vault |
provenance_class |
how the row came to exist |
licence |
the licence the row is under: the source's term, or for The Vault the repository's own licence as the source publishes it |
Every output here was computed by running the function, not copied from its source. Each candidate
was run twice in a separate process under a two second deadline, and a row survives only when both
runs return the same value, the value's repr parses back to an equal value, and that text is at
most 200 characters. Rows whose function returns None were dropped. Rows are deduplicated across
sources on the function text together with its entry point and its input, keeping the first source
in the order of the sections below.
sources/
The same data untouched, 604602 rows, one directory per source, holding the files at the paths, in the formats and with the columns its own repository publishes. Nothing here was renamed, reshaped, reordered or deduplicated, and no output here was computed by this builder. Use this layer if you want a field the rewritten one drops, such as the written reasoning in the first source or the documentation strings in the two code corpora, or if you would rather choose the calls yourself.
The sources
sources/pyx
Python functions written by a language model from short problem statements, each paired with a concrete call of the function. Two of every three rows carry no call this builder can read and contribute to the raw layer only.
From semcoder/PyX at revision 7f328668db983ff1d52deec102f65c4ca117e094, files pyx.jsonl. 93158
rows here, and 30571 rows of pool.jsonl were built from them. Provenance class model-generated,
licence mit.
Worth knowing. The functions and the calls were produced by a model, so a function may be odd or wrong in the way a model is wrong. That does not matter for this shape of data: the output recorded here is what the function really returns, whatever the function meant to do, which is also true of the graded material.
sources/execution_trace
Self-contained Python programs written by people for this purpose, each with a call and the output it produces, chosen to exercise control flow, collections, exceptions and standard library behaviour.
From databounty-io/python-execution-trace-output-prediction-cmskdimp at revision
88c74bd6525825f46bec4d68b2a9ed7f11fa0cf9, files data/items.jsonl, manifest.json. 996 rows
here, and 935 rows of pool.jsonl were built from them. Provenance class human, licence cc- by-4.0.
Worth knowing. One thousand rows, the smallest source here and the one closest in intent to what the rows are for. Its own card names the twenty six people who wrote it.
sources/mbpp
Short Python programming problems written by crowdworkers, each with a reference solution and three assertions. Every assertion of the form call equals value is one row here, so one problem contributes up to three.
From google-research-datasets/mbpp at revision 4bb6404fdc6cacfda99d4ac4205087b89d32030c, files
full/train-00000-of-00001.parquet, full/validation-00000-of-00001.parquet,
full/prompt-00000-of-00001.parquet. 474 rows here, and 1391 rows of pool.jsonl were built from
them. Provenance class human, licence cc-by-4.0.
Worth knowing. The train, validation and prompt splits only. The test split is left out, since it is the held-out half of its own release and is widely used as one.
sources/code_search_net
Python functions with documentation, collected from open source repositories on GitHub. The calls are not published with them and are drawn here.
From code-search-net/code_search_net at revision bd0cf261e357a3eb5c8fba490d23ec1a1cd59555, files
python/train-00000-of-00001.parquet, python/validation-00000-of-00001.parquet,
python/test-00000-of-00001.parquet. 457339 rows here, and 4685 rows of pool.jsonl were built
from them. Provenance class collected, licence unknown.
Worth knowing. The licence tag on the repository is literally other. Its collectors kept only repositories whose licence permits redistributing parts of the project, but the corpus does not record which licence each function came under, so every row here carries the licence unknown and names its repository instead.
sources/the_vault
Python functions with documentation, collected from permissively licensed repositories. The calls are not published with them and are drawn here.
From Fsoft-AIC/the-vault-function at revision 505c679056e49a2a269b64777ee7c496d22e1440, files
data/validation/python-00000-of-00001.parquet, data/test/python-00000-of-00001.parquet. 52635
rows here, and 572 rows of pool.jsonl were built from them. Provenance class collected, licence
mit.
Worth knowing. The validation and test splits only, which are two complete files. Its train configurations run to fifteen gigabytes of Python and yield the same kind of row as the other corpus here, so they would add size rather than variety.
Provenance and licences
By provenance class the curated layer holds 5257 rows collected, 2326 rows human, 30571 rows
model-generated. human means a person wrote the function and the call, collected means the
function was taken from a public repository and the call was drawn here from a fixed catalogue of
values, and model-generated means a language model wrote both. Every output, in every class, was
computed by running the function.
The pool as a whole is offered under cc-by-4.0, which is the most restrictive term its sources
compose to. PyX is mit, the execution trace set and MBPP are cc-by-4.0, The Vault publishes the
licence of each function's repository with the row and every one of its rows here is under a
permissive term (mit, apache-2.0, the BSD family and a few others, none copyleft), and
CodeSearchNet carries the tag other with no per-row licence recorded, so its rows carry the
licence unknown and name their repository instead. Each row carries its own, so a subset under a
single licence can be selected.
Filtering
Rows whose function duplicated or closely matched a function in a held-out set were removed before publication, from both layers alike, by a check on the normalised function text (0 rows) followed by a word-level 8-gram overlap check (576 rows). That held-out set is not distributed here. Nothing else was filtered out of the raw layer.
- Downloads last month
- 55