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": ...
65f423e476999d2a0ff3d5806c533bff23d4a718
kwarodom/mib_ui_data_analytics
IEBSubscriber/iebsubscriber/agent.py
[ "Unlicense" ]
Python
on_match_device_status_update_vav
null
def on_match_device_status_update_vav(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_vav(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_vav", "(", "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": ...
a69cd36c5cfd1a8e127ddda094eff02a64fe0827
kwarodom/mib_ui_data_analytics
AgentSimulator/agentsimulator/agent.py
[ "Unlicense" ]
Python
main
null
def main(argv=sys.argv): '''Main method called by the eggsecutable.''' try: utils.default_main(ListenerAgent, description='Example VOLTTRON heartbeat agent', argv=argv) except Exception as e: _log.exception('unhandled exception')
Main method called by the eggsecutable.
Main method called by the eggsecutable.
[ "Main", "method", "called", "by", "the", "eggsecutable", "." ]
def main(argv=sys.argv): try: utils.default_main(ListenerAgent, description='Example VOLTTRON heartbeat agent', argv=argv) except Exception as e: _log.exception('unhandled exception')
[ "def", "main", "(", "argv", "=", "sys", ".", "argv", ")", ":", "try", ":", "utils", ".", "default_main", "(", "ListenerAgent", ",", "description", "=", "'Example VOLTTRON heartbeat agent'", ",", "argv", "=", "argv", ")", "except", "Exception", "as", "e", "...
Main method called by the eggsecutable.
[ "Main", "method", "called", "by", "the", "eggsecutable", "." ]
[ "'''Main method called by the eggsecutable.'''" ]
[ { "param": "argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "argv", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b5deb83b7e5238bf9068dcf8e2b32cb27b112684
jarokaz/bq-sandbox
beam/proto_to_bq/pipeline.py
[ "Apache-2.0" ]
Python
run
null
def run(argv=None): """The main function which creates the pipeline and runs it.""" parser = argparse.ArgumentParser() parser.add_argument( '--input', dest='input', required=False, help='Input file to read. This can be a local file or ' 'a file in a Google Storage B...
The main function which creates the pipeline and runs it.
The main function which creates the pipeline and runs it.
[ "The", "main", "function", "which", "creates", "the", "pipeline", "and", "runs", "it", "." ]
def run(argv=None): parser = argparse.ArgumentParser() parser.add_argument( '--input', dest='input', required=False, help='Input file to read. This can be a local file or ' 'a file in a Google Storage Bucket.', default='gs://jk-bq-dev-datasets/test.tfrecords') ...
[ "def", "run", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--input'", ",", "dest", "=", "'input'", ",", "required", "=", "False", ",", "help", "=", "'Input file to r...
The main function which creates the pipeline and runs it.
[ "The", "main", "function", "which", "creates", "the", "pipeline", "and", "runs", "it", "." ]
[ "\"\"\"The main function which creates the pipeline and runs it.\"\"\"", "# p = beam.Pipeline(options=PipelineOptions(pipeline_args))", "# _ = (p", "#schema=table_schema," ]
[ { "param": "argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "argv", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
408b16062fad3e601e7f59efd3e1c2d4e1fa724b
newolfsociety/team7-
bot/exts/filter.py
[ "MIT" ]
Python
match_filter_patterns
Optional[typing.Tuple[re.Match, str]]
def match_filter_patterns(self, content: str, guild_id: int) -> Optional[typing.Tuple[re.Match, str]]: """Try to find matches between registered filter patterns with a message.""" for pattern, pattern_identifier in self._filter_cache[guild_id].items(): if search := pattern.search(content): ...
Try to find matches between registered filter patterns with a message.
Try to find matches between registered filter patterns with a message.
[ "Try", "to", "find", "matches", "between", "registered", "filter", "patterns", "with", "a", "message", "." ]
def match_filter_patterns(self, content: str, guild_id: int) -> Optional[typing.Tuple[re.Match, str]]: for pattern, pattern_identifier in self._filter_cache[guild_id].items(): if search := pattern.search(content): return search, pattern_identifier
[ "def", "match_filter_patterns", "(", "self", ",", "content", ":", "str", ",", "guild_id", ":", "int", ")", "->", "Optional", "[", "typing", ".", "Tuple", "[", "re", ".", "Match", ",", "str", "]", "]", ":", "for", "pattern", ",", "pattern_identifier", "...
Try to find matches between registered filter patterns with a message.
[ "Try", "to", "find", "matches", "between", "registered", "filter", "patterns", "with", "a", "message", "." ]
[ "\"\"\"Try to find matches between registered filter patterns with a message.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "content", "type": "str" }, { "param": "guild_id", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "content", "type": "str", "docstring": null, "docstring_tokens...
408b16062fad3e601e7f59efd3e1c2d4e1fa724b
newolfsociety/team7-
bot/exts/filter.py
[ "MIT" ]
Python
notify_mods
None
async def notify_mods( self, event: GuildMessageCreateEvent, matching_content: Optional[str], type_of_filter: str, footer: Optional[str] = None ) -> None: """Notify moderators when a message filter is triggered.""" message_channel = self.bo...
Notify moderators when a message filter is triggered.
Notify moderators when a message filter is triggered.
[ "Notify", "moderators", "when", "a", "message", "filter", "is", "triggered", "." ]
async def notify_mods( self, event: GuildMessageCreateEvent, matching_content: Optional[str], type_of_filter: str, footer: Optional[str] = None ) -> None: message_channel = self.bot.cache.get_guild_channel(event.message.channel_id) user = e...
[ "async", "def", "notify_mods", "(", "self", ",", "event", ":", "GuildMessageCreateEvent", ",", "matching_content", ":", "Optional", "[", "str", "]", ",", "type_of_filter", ":", "str", ",", "footer", ":", "Optional", "[", "str", "]", "=", "None", ")", "->",...
Notify moderators when a message filter is triggered.
[ "Notify", "moderators", "when", "a", "message", "filter", "is", "triggered", "." ]
[ "\"\"\"Notify moderators when a message filter is triggered.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "event", "type": "GuildMessageCreateEvent" }, { "param": "matching_content", "type": "Optional[str]" }, { "param": "type_of_filter", "type": "str" }, { "param": "footer", "type": "Optional[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "event", "type": "GuildMessageCreateEvent", "docstring": null, ...
408b16062fad3e601e7f59efd3e1c2d4e1fa724b
newolfsociety/team7-
bot/exts/filter.py
[ "MIT" ]
Python
plugin_check
<not_specific>
async def plugin_check(self, ctx: Union[lightbulb.Context, GuildMessageCreateEvent]): """Return True for server moderator.""" if Roles.mods in [role.id for role in ctx.member.get_roles()]: return True return False
Return True for server moderator.
Return True for server moderator.
[ "Return", "True", "for", "server", "moderator", "." ]
async def plugin_check(self, ctx: Union[lightbulb.Context, GuildMessageCreateEvent]): if Roles.mods in [role.id for role in ctx.member.get_roles()]: return True return False
[ "async", "def", "plugin_check", "(", "self", ",", "ctx", ":", "Union", "[", "lightbulb", ".", "Context", ",", "GuildMessageCreateEvent", "]", ")", ":", "if", "Roles", ".", "mods", "in", "[", "role", ".", "id", "for", "role", "in", "ctx", ".", "member",...
Return True for server moderator.
[ "Return", "True", "for", "server", "moderator", "." ]
[ "\"\"\"Return True for server moderator.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ctx", "type": "Union[lightbulb.Context, GuildMessageCreateEvent]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctx", "type": "Union[lightbulb.Context, GuildMessageCreateEvent]", ...
b965245c3e51900afe12f0fbc12a04daad0cd5bc
newolfsociety/team7-
postgres/utils.py
[ "MIT" ]
Python
init_db
<not_specific>
async def init_db(): """Connect to database and create initial tables.""" conn: asyncpg.Connection = await asyncpg.connect(Client.database_url) tables = Path("postgres", "tables") logger.info("Creating tables.") for table_file in tables.iterdir(): await conn.execute(table_file.re...
Connect to database and create initial tables.
Connect to database and create initial tables.
[ "Connect", "to", "database", "and", "create", "initial", "tables", "." ]
async def init_db(): conn: asyncpg.Connection = await asyncpg.connect(Client.database_url) tables = Path("postgres", "tables") logger.info("Creating tables.") for table_file in tables.iterdir(): await conn.execute(table_file.read_text()) return conn
[ "async", "def", "init_db", "(", ")", ":", "conn", ":", "asyncpg", ".", "Connection", "=", "await", "asyncpg", ".", "connect", "(", "Client", ".", "database_url", ")", "tables", "=", "Path", "(", "\"postgres\"", ",", "\"tables\"", ")", "logger", ".", "inf...
Connect to database and create initial tables.
[ "Connect", "to", "database", "and", "create", "initial", "tables", "." ]
[ "\"\"\"Connect to database and create initial tables.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e70c26d3cbee96bc2abf80bac522ce8574987171
newolfsociety/team7-
bot/bot.py
[ "MIT" ]
Python
on_starting
None
async def on_starting(self, _event: hikari.StartingEvent) -> None: """Load extensions when bot is starting.""" logging.info("Connecting to database...") self.db_conn = await init_db() logging.info("Loading extensions...") for ext in Client.extensions: ext = str(ext)...
Load extensions when bot is starting.
Load extensions when bot is starting.
[ "Load", "extensions", "when", "bot", "is", "starting", "." ]
async def on_starting(self, _event: hikari.StartingEvent) -> None: logging.info("Connecting to database...") self.db_conn = await init_db() logging.info("Loading extensions...") for ext in Client.extensions: ext = str(ext).replace(os.sep, ".")[:-3] self.load_exten...
[ "async", "def", "on_starting", "(", "self", ",", "_event", ":", "hikari", ".", "StartingEvent", ")", "->", "None", ":", "logging", ".", "info", "(", "\"Connecting to database...\"", ")", "self", ".", "db_conn", "=", "await", "init_db", "(", ")", "logging", ...
Load extensions when bot is starting.
[ "Load", "extensions", "when", "bot", "is", "starting", "." ]
[ "\"\"\"Load extensions when bot is starting.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "_event", "type": "hikari.StartingEvent" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "_event", "type": "hikari.StartingEvent", "docstring": null, "...
f63b992b4fb8d96d9db06be7eff2b8259ba7f4b5
bm371613/slice-aggregator
slice_aggregator/by_ixs.py
[ "MIT" ]
Python
inc
None
def inc(self, start: typing.Optional[int], stop: typing.Optional[int], value: V) -> None: """ Increment the value assigned to a slice """ if start is None: if stop is None: self.value_offset += value else: self.dual[stop - 1] += value elif ...
Increment the value assigned to a slice
Increment the value assigned to a slice
[ "Increment", "the", "value", "assigned", "to", "a", "slice" ]
def inc(self, start: typing.Optional[int], stop: typing.Optional[int], value: V) -> None: if start is None: if stop is None: self.value_offset += value else: self.dual[stop - 1] += value elif stop is None: self.dual[start - 1] -= value ...
[ "def", "inc", "(", "self", ",", "start", ":", "typing", ".", "Optional", "[", "int", "]", ",", "stop", ":", "typing", ".", "Optional", "[", "int", "]", ",", "value", ":", "V", ")", "->", "None", ":", "if", "start", "is", "None", ":", "if", "sto...
Increment the value assigned to a slice
[ "Increment", "the", "value", "assigned", "to", "a", "slice" ]
[ "\"\"\" Increment the value assigned to a slice \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "start", "type": "typing.Optional[int]" }, { "param": "stop", "type": "typing.Optional[int]" }, { "param": "value", "type": "V" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": "typing.Optional[int]", "docstring": null, "d...
da7c3fe3fbe4b63c2923dd271b9b5d4b3fddf599
bm371613/slice-aggregator
slice_aggregator/__init__.py
[ "MIT" ]
Python
ixs_by_slices
by_slices.Aggregator[V]
def ixs_by_slices(*, zero_factory: ZF = None, zero_test: ZT = None) -> by_slices.Aggregator[V]: """ Returns an object that allows assigning values to indices and aggregating them by slices :param zero_factory: callable returning additive identity :param zero_test: test for equality to zero :return: a n...
Returns an object that allows assigning values to indices and aggregating them by slices :param zero_factory: callable returning additive identity :param zero_test: test for equality to zero :return: a new instance of :class:`slice_aggregator.by_slices.Aggregator`
Returns an object that allows assigning values to indices and aggregating them by slices
[ "Returns", "an", "object", "that", "allows", "assigning", "values", "to", "indices", "and", "aggregating", "them", "by", "slices" ]
def ixs_by_slices(*, zero_factory: ZF = None, zero_test: ZT = None) -> by_slices.Aggregator[V]: return by_slices.UnboundedAggregator( negative=by_slices.VariableSizeLeftBoundedAggregator(zero_factory=zero_factory, zero_test=zero_test), non...
[ "def", "ixs_by_slices", "(", "*", ",", "zero_factory", ":", "ZF", "=", "None", ",", "zero_test", ":", "ZT", "=", "None", ")", "->", "by_slices", ".", "Aggregator", "[", "V", "]", ":", "return", "by_slices", ".", "UnboundedAggregator", "(", "negative", "=...
Returns an object that allows assigning values to indices and aggregating them by slices
[ "Returns", "an", "object", "that", "allows", "assigning", "values", "to", "indices", "and", "aggregating", "them", "by", "slices" ]
[ "\"\"\" Returns an object that allows assigning values to indices and aggregating them by slices\n\n :param zero_factory: callable returning additive identity\n :param zero_test: test for equality to zero\n :return: a new instance of :class:`slice_aggregator.by_slices.Aggregator`\n \"\"\"" ]
[ { "param": "zero_factory", "type": "ZF" }, { "param": "zero_test", "type": "ZT" } ]
{ "returns": [ { "docstring": "a new instance of :class:`slice_aggregator.by_slices.Aggregator`", "docstring_tokens": [ "a", "new", "instance", "of", ":", "class", ":", "`", "slice_aggregator", ".", "by_slices", ...
da7c3fe3fbe4b63c2923dd271b9b5d4b3fddf599
bm371613/slice-aggregator
slice_aggregator/__init__.py
[ "MIT" ]
Python
slices_by_ixs
by_ixs.Aggregator[V]
def slices_by_ixs(*, zero_factory: ZF = None, zero_test: ZT = None) -> by_ixs.Aggregator[V]: """ Returns an object that allows assigning values to slices and aggregating them by indices :param zero_factory: callable returning additive identity :param zero_test: test for equality to zero :return: a new ...
Returns an object that allows assigning values to slices and aggregating them by indices :param zero_factory: callable returning additive identity :param zero_test: test for equality to zero :return: a new instance of :class:`slice_aggregator.by_ixs.Aggregator`
Returns an object that allows assigning values to slices and aggregating them by indices
[ "Returns", "an", "object", "that", "allows", "assigning", "values", "to", "slices", "and", "aggregating", "them", "by", "indices" ]
def slices_by_ixs(*, zero_factory: ZF = None, zero_test: ZT = None) -> by_ixs.Aggregator[V]: return by_ixs.Aggregator( dual=ixs_by_slices(zero_factory=zero_factory, zero_test=zero_test), zero_factory=zero_factory, )
[ "def", "slices_by_ixs", "(", "*", ",", "zero_factory", ":", "ZF", "=", "None", ",", "zero_test", ":", "ZT", "=", "None", ")", "->", "by_ixs", ".", "Aggregator", "[", "V", "]", ":", "return", "by_ixs", ".", "Aggregator", "(", "dual", "=", "ixs_by_slices...
Returns an object that allows assigning values to slices and aggregating them by indices
[ "Returns", "an", "object", "that", "allows", "assigning", "values", "to", "slices", "and", "aggregating", "them", "by", "indices" ]
[ "\"\"\" Returns an object that allows assigning values to slices and aggregating them by indices\n\n :param zero_factory: callable returning additive identity\n :param zero_test: test for equality to zero\n :return: a new instance of :class:`slice_aggregator.by_ixs.Aggregator`\n \"\"\"" ]
[ { "param": "zero_factory", "type": "ZF" }, { "param": "zero_test", "type": "ZT" } ]
{ "returns": [ { "docstring": "a new instance of :class:`slice_aggregator.by_ixs.Aggregator`", "docstring_tokens": [ "a", "new", "instance", "of", ":", "class", ":", "`", "slice_aggregator", ".", "by_ixs", ...
e69f552f47f52ec56dcc3bd56f464d73fb522147
reductionista/ipython-sql
src/sql/parse.py
[ "MIT" ]
Python
parse
<not_specific>
def parse(cell, config): """Extract connection info and result variable from SQL Please don't add any more syntax requiring special parsing. Instead, add @arguments to SqlMagic.execute. We're grandfathering the connection string and `<<` operator in. """ result = {"connect...
Extract connection info and result variable from SQL Please don't add any more syntax requiring special parsing. Instead, add @arguments to SqlMagic.execute. We're grandfathering the connection string and `<<` operator in.
Extract connection info and result variable from SQL Please don't add any more syntax requiring special parsing. Instead, add @arguments to SqlMagic.execute. We're grandfathering the connection string and `<<` operator in.
[ "Extract", "connection", "info", "and", "result", "variable", "from", "SQL", "Please", "don", "'", "t", "add", "any", "more", "syntax", "requiring", "special", "parsing", ".", "Instead", "add", "@arguments", "to", "SqlMagic", ".", "execute", ".", "We", "'", ...
def parse(cell, config): result = {"connection": "", "sql": "", "result_var": None} pieces = cell.split(None, 3) if not pieces: return result result["connection"] = _connection_string(pieces[0], config) if result["connection"]: pieces.pop(0) if len(pieces) > 1 and pieces[1] == "<...
[ "def", "parse", "(", "cell", ",", "config", ")", ":", "result", "=", "{", "\"connection\"", ":", "\"\"", ",", "\"sql\"", ":", "\"\"", ",", "\"result_var\"", ":", "None", "}", "pieces", "=", "cell", ".", "split", "(", "None", ",", "3", ")", "if", "n...
Extract connection info and result variable from SQL Please don't add any more syntax requiring special parsing.
[ "Extract", "connection", "info", "and", "result", "variable", "from", "SQL", "Please", "don", "'", "t", "add", "any", "more", "syntax", "requiring", "special", "parsing", "." ]
[ "\"\"\"Extract connection info and result variable from SQL\n \n Please don't add any more syntax requiring \n special parsing. \n Instead, add @arguments to SqlMagic.execute.\n \n We're grandfathering the \n connection string and `<<` operator in.\n \"\"\"", "# discard << operator" ]
[ { "param": "cell", "type": null }, { "param": "config", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cell", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": null, "docstring": null, "docstring_tokens":...
e69f552f47f52ec56dcc3bd56f464d73fb522147
reductionista/ipython-sql
src/sql/parse.py
[ "MIT" ]
Python
without_sql_comment
<not_specific>
def without_sql_comment(parser, line): """Strips -- comment from a line The argparser unfortunately expects -- to precede an option, but in SQL that delineates a comment. So this removes comments so a line can safely be fed to the argparser. :param line: A line of SQL, possibly mixed with opti...
Strips -- comment from a line The argparser unfortunately expects -- to precede an option, but in SQL that delineates a comment. So this removes comments so a line can safely be fed to the argparser. :param line: A line of SQL, possibly mixed with option strings :type line: str
- comment from a line The argparser unfortunately expects -- to precede an option, but in SQL that delineates a comment. So this removes comments so a line can safely be fed to the argparser.
[ "-", "comment", "from", "a", "line", "The", "argparser", "unfortunately", "expects", "--", "to", "precede", "an", "option", "but", "in", "SQL", "that", "delineates", "a", "comment", ".", "So", "this", "removes", "comments", "so", "a", "line", "can", "safel...
def without_sql_comment(parser, line): args = _option_strings_from_parser(parser) result = itertools.takewhile( lambda word: (not word.startswith("--")) or (word in args), shlex.split(line, posix=False), ) return " ".join(result)
[ "def", "without_sql_comment", "(", "parser", ",", "line", ")", ":", "args", "=", "_option_strings_from_parser", "(", "parser", ")", "result", "=", "itertools", ".", "takewhile", "(", "lambda", "word", ":", "(", "not", "word", ".", "startswith", "(", "\"--\""...
Strips -- comment from a line The argparser unfortunately expects -- to precede an option, but in SQL that delineates a comment.
[ "Strips", "--", "comment", "from", "a", "line", "The", "argparser", "unfortunately", "expects", "--", "to", "precede", "an", "option", "but", "in", "SQL", "that", "delineates", "a", "comment", "." ]
[ "\"\"\"Strips -- comment from a line \n\n The argparser unfortunately expects -- to precede an option, \n but in SQL that delineates a comment. So this removes comments \n so a line can safely be fed to the argparser.\n\n :param line: A line of SQL, possibly mixed with option strings \n :type line: ...
[ { "param": "parser", "type": null }, { "param": "line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parser", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "line", "type": null, "docstring": "A line of SQL, possibly mixed ...
e5cea2450a709096167662e80075bd3aae416602
reductionista/ipython-sql
src/sql/magic.py
[ "MIT" ]
Python
_persist_dataframe
<not_specific>
def _persist_dataframe(self, raw, conn, user_ns, append=False): """Implements PERSIST, which writes a DataFrame to the RDBMS""" if not DataFrame: raise ImportError("Must `pip install pandas` to use DataFrames") frame_name = raw.strip(";") # Get the DataFrame from the user n...
Implements PERSIST, which writes a DataFrame to the RDBMS
Implements PERSIST, which writes a DataFrame to the RDBMS
[ "Implements", "PERSIST", "which", "writes", "a", "DataFrame", "to", "the", "RDBMS" ]
def _persist_dataframe(self, raw, conn, user_ns, append=False): if not DataFrame: raise ImportError("Must `pip install pandas` to use DataFrames") frame_name = raw.strip(";") if not frame_name: raise SyntaxError("Syntax: %sql --persist <name_of_data_frame>") try: ...
[ "def", "_persist_dataframe", "(", "self", ",", "raw", ",", "conn", ",", "user_ns", ",", "append", "=", "False", ")", ":", "if", "not", "DataFrame", ":", "raise", "ImportError", "(", "\"Must `pip install pandas` to use DataFrames\"", ")", "frame_name", "=", "raw"...
Implements PERSIST, which writes a DataFrame to the RDBMS
[ "Implements", "PERSIST", "which", "writes", "a", "DataFrame", "to", "the", "RDBMS" ]
[ "\"\"\"Implements PERSIST, which writes a DataFrame to the RDBMS\"\"\"", "# Get the DataFrame from the user namespace", "# Make a suitable name for the resulting database table" ]
[ { "param": "self", "type": null }, { "param": "raw", "type": null }, { "param": "conn", "type": null }, { "param": "user_ns", "type": null }, { "param": "append", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "raw", "type": null, "docstring": null, "docstring_tokens": []...
9fc7916ae7c211eb296824ffb80ae54fe9d0c34c
reductionista/ipython-sql
src/tests/test_magic.py
[ "MIT" ]
Python
ip
null
def ip(): """Provides an IPython session in which tables have been created""" ip_session = get_ipython() runsql( ip_session, [ "CREATE TABLE test (n INT, name TEXT)", "INSERT INTO test VALUES (1, 'foo')", "INSERT INTO test VALUES (2, 'bar')", ...
Provides an IPython session in which tables have been created
Provides an IPython session in which tables have been created
[ "Provides", "an", "IPython", "session", "in", "which", "tables", "have", "been", "created" ]
def ip(): ip_session = get_ipython() runsql( ip_session, [ "CREATE TABLE test (n INT, name TEXT)", "INSERT INTO test VALUES (1, 'foo')", "INSERT INTO test VALUES (2, 'bar')", "CREATE TABLE author (first_name, last_name, year_of_death)", ...
[ "def", "ip", "(", ")", ":", "ip_session", "=", "get_ipython", "(", ")", "runsql", "(", "ip_session", ",", "[", "\"CREATE TABLE test (n INT, name TEXT)\"", ",", "\"INSERT INTO test VALUES (1, 'foo')\"", ",", "\"INSERT INTO test VALUES (2, 'bar')\"", ",", "\"CREATE TABLE auth...
Provides an IPython session in which tables have been created
[ "Provides", "an", "IPython", "session", "in", "which", "tables", "have", "been", "created" ]
[ "\"\"\"Provides an IPython session in which tables have been created\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b62b550f4c146dcd37173a98c5a0cfaf7027b6b3
insaneyilin/face_off
capture_manager.py
[ "BSD-3-Clause" ]
Python
enter_frame
null
def enter_frame(self): """ Capture the next fame, if any """ assert not self._is_entered_frame, \ 'previous enter_frame() had no matching exit_frame()' if self._capture is not None: self._is_entered_frame = self._capture.grab()
Capture the next fame, if any
Capture the next fame, if any
[ "Capture", "the", "next", "fame", "if", "any" ]
def enter_frame(self): assert not self._is_entered_frame, \ 'previous enter_frame() had no matching exit_frame()' if self._capture is not None: self._is_entered_frame = self._capture.grab()
[ "def", "enter_frame", "(", "self", ")", ":", "assert", "not", "self", ".", "_is_entered_frame", ",", "'previous enter_frame() had no matching exit_frame()'", "if", "self", ".", "_capture", "is", "not", "None", ":", "self", ".", "_is_entered_frame", "=", "self", "....
Capture the next fame, if any
[ "Capture", "the", "next", "fame", "if", "any" ]
[ "\"\"\"\n Capture the next fame, if any\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
login
<not_specific>
def login(self, user_id, password): """Authenticate to ownCloud. This will create a session on the server. :param user_id: user id :param password: password :raises: ResponseError in case an HTTP error status was returned """ self.__session = requests.session() ...
Authenticate to ownCloud. This will create a session on the server. :param user_id: user id :param password: password :raises: ResponseError in case an HTTP error status was returned
Authenticate to ownCloud. This will create a session on the server.
[ "Authenticate", "to", "ownCloud", ".", "This", "will", "create", "a", "session", "on", "the", "server", "." ]
def login(self, user_id, password): self.__session = requests.session() self.__session.verify = self.__verify_certs self.__session.auth = (user_id, password) res = self.__session.get(self.url) if res.status_code == 200: if self.__single_session: self._...
[ "def", "login", "(", "self", ",", "user_id", ",", "password", ")", ":", "self", ".", "__session", "=", "requests", ".", "session", "(", ")", "self", ".", "__session", ".", "verify", "=", "self", ".", "__verify_certs", "self", ".", "__session", ".", "au...
Authenticate to ownCloud.
[ "Authenticate", "to", "ownCloud", "." ]
[ "\"\"\"Authenticate to ownCloud.\n This will create a session on the server.\n\n :param user_id: user id\n :param password: password\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"", "# TODO: use another path to prevent that the server renders the fil...
[ { "param": "self", "type": null }, { "param": "user_id", "type": null }, { "param": "password", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "ResponseError in case an HTTP error status was returned", "docstring_tokens": [ "ResponseError", "in", "case", "an", "HTTP", "error", "status", "was", "returned" ], "type"...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
logout
<not_specific>
def logout(self): """Log out the authenticated user and close the session. :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error status was returned """ # TODO actual logout ? self.__session.close() return True
Log out the authenticated user and close the session. :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error status was returned
Log out the authenticated user and close the session.
[ "Log", "out", "the", "authenticated", "user", "and", "close", "the", "session", "." ]
def logout(self): self.__session.close() return True
[ "def", "logout", "(", "self", ")", ":", "self", ".", "__session", ".", "close", "(", ")", "return", "True" ]
Log out the authenticated user and close the session.
[ "Log", "out", "the", "authenticated", "user", "and", "close", "the", "session", "." ]
[ "\"\"\"Log out the authenticated user and close the session.\n\n :returns: True if the operation succeeded, False otherwise\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"", "# TODO actual logout ?" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "True if the operation succeeded, False otherwise", "docstring_tokens": [ "True", "if", "the", "operation", "succeeded", "False", "otherwise" ], "type": null } ], "raises": [ { "docstrin...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
file_info
<not_specific>
def file_info(self, path): """Returns the file info for the given remote file :param path: path to the remote file :returns: file info :rtype: :class:`FileInfo` object or `None` if file was not found :raises: ResponseError in case an HTTP error status was re...
Returns the file info for the given remote file :param path: path to the remote file :returns: file info :rtype: :class:`FileInfo` object or `None` if file was not found :raises: ResponseError in case an HTTP error status was returned
Returns the file info for the given remote file
[ "Returns", "the", "file", "info", "for", "the", "given", "remote", "file" ]
def file_info(self, path): res = self.__make_dav_request('PROPFIND', path) if res: return res[0] return None
[ "def", "file_info", "(", "self", ",", "path", ")", ":", "res", "=", "self", ".", "__make_dav_request", "(", "'PROPFIND'", ",", "path", ")", "if", "res", ":", "return", "res", "[", "0", "]", "return", "None" ]
Returns the file info for the given remote file
[ "Returns", "the", "file", "info", "for", "the", "given", "remote", "file" ]
[ "\"\"\"Returns the file info for the given remote file\n \n :param path: path to the remote file \n :returns: file info\n :rtype: :class:`FileInfo` object or `None` if file\n was not found\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\...
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": ":class:`FileInfo` object or `None` if file\nwas not found" } ], "raises": [ { "docstring": "ResponseError in case an HTTP error status was returned", "docstring_tokens": [ "...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
list
<not_specific>
def list(self, path): """Returns the listing/contents of the given remote directory :param path: path to the remote directory :returns: directory listing :rtype: array of :class:`FileInfo` objects :raises: ResponseError in case an HTTP error status was returned ...
Returns the listing/contents of the given remote directory :param path: path to the remote directory :returns: directory listing :rtype: array of :class:`FileInfo` objects :raises: ResponseError in case an HTTP error status was returned
Returns the listing/contents of the given remote directory
[ "Returns", "the", "listing", "/", "contents", "of", "the", "given", "remote", "directory" ]
def list(self, path): if not path[-1] == '/': path += '/' res = self.__make_dav_request('PROPFIND', path) if res: return res[1:] return None
[ "def", "list", "(", "self", ",", "path", ")", ":", "if", "not", "path", "[", "-", "1", "]", "==", "'/'", ":", "path", "+=", "'/'", "res", "=", "self", ".", "__make_dav_request", "(", "'PROPFIND'", ",", "path", ")", "if", "res", ":", "return", "re...
Returns the listing/contents of the given remote directory
[ "Returns", "the", "listing", "/", "contents", "of", "the", "given", "remote", "directory" ]
[ "\"\"\"Returns the listing/contents of the given remote directory\n \n :param path: path to the remote directory \n :returns: directory listing\n :rtype: array of :class:`FileInfo` objects\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"", "# fi...
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "array of :class:`FileInfo` objects" } ], "raises": [ { "docstring": "ResponseError in case an HTTP error status was returned", "docstring_tokens": [ "ResponseError", ...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
put_file_contents
<not_specific>
def put_file_contents(self, remote_path, data): """Write data into a remote file :param remote_path: path of the remote file :param data: data to write into the remote file :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error st...
Write data into a remote file :param remote_path: path of the remote file :param data: data to write into the remote file :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error status was returned
Write data into a remote file
[ "Write", "data", "into", "a", "remote", "file" ]
def put_file_contents(self, remote_path, data): return self.__make_dav_request('PUT', remote_path, data = data)
[ "def", "put_file_contents", "(", "self", ",", "remote_path", ",", "data", ")", ":", "return", "self", ".", "__make_dav_request", "(", "'PUT'", ",", "remote_path", ",", "data", "=", "data", ")" ]
Write data into a remote file
[ "Write", "data", "into", "a", "remote", "file" ]
[ "\"\"\"Write data into a remote file\n\n :param remote_path: path of the remote file\n :param data: data to write into the remote file\n :returns: True if the operation succeeded, False otherwise\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "remote_path", "type": null }, { "param": "data", "type": null } ]
{ "returns": [ { "docstring": "True if the operation succeeded, False otherwise", "docstring_tokens": [ "True", "if", "the", "operation", "succeeded", "False", "otherwise" ], "type": null } ], "raises": [ { "docstrin...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
put_directory
<not_specific>
def put_directory(self, target_path, local_directory, **kwargs): """Upload a directory with all its contents :param target_path: path of the directory to upload into :param local_directory: path to the local directory to upload :param \*\*kwargs: optional arguments that ``put_file`` acc...
Upload a directory with all its contents :param target_path: path of the directory to upload into :param local_directory: path to the local directory to upload :param \*\*kwargs: optional arguments that ``put_file`` accepts :returns: True if the operation succeeded, False otherwise ...
Upload a directory with all its contents
[ "Upload", "a", "directory", "with", "all", "its", "contents" ]
def put_directory(self, target_path, local_directory, **kwargs): target_path = self.__normalize_path(target_path) if not target_path[-1] == '/': target_path += '/' gathered_files = [] if not local_directory[-1] == '/': local_directory += '/' basedir = os.p...
[ "def", "put_directory", "(", "self", ",", "target_path", ",", "local_directory", ",", "**", "kwargs", ")", ":", "target_path", "=", "self", ".", "__normalize_path", "(", "target_path", ")", "if", "not", "target_path", "[", "-", "1", "]", "==", "'/'", ":", ...
Upload a directory with all its contents
[ "Upload", "a", "directory", "with", "all", "its", "contents" ]
[ "\"\"\"Upload a directory with all its contents\n\n :param target_path: path of the directory to upload into\n :param local_directory: path to the local directory to upload\n :param \\*\\*kwargs: optional arguments that ``put_file`` accepts\n :returns: True if the operation succeeded, Fa...
[ { "param": "self", "type": null }, { "param": "target_path", "type": null }, { "param": "local_directory", "type": null } ]
{ "returns": [ { "docstring": "True if the operation succeeded, False otherwise", "docstring_tokens": [ "True", "if", "the", "operation", "succeeded", "False", "otherwise" ], "type": null } ], "raises": [ { "docstrin...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
__put_file_chunked
<not_specific>
def __put_file_chunked(self, remote_path, local_source_file, **kwargs): """Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly. :param remote_path: path to the target file. A target directory can also be specified instead by appending a "...
Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly. :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/" :param local_source_file: path to the local file to upload :para...
Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly.
[ "Uploads", "a", "file", "using", "chunks", ".", "If", "the", "file", "is", "smaller", "than", "`", "`", "chunk_size", "`", "`", "it", "will", "be", "uploaded", "directly", "." ]
def __put_file_chunked(self, remote_path, local_source_file, **kwargs): chunk_size = kwargs.get('chunk_size', 10 * 1024 * 1024) result = True transfer_id = int(time.time()) remote_path = self.__normalize_path(remote_path) if remote_path[-1] == '/': remote_path += os.p...
[ "def", "__put_file_chunked", "(", "self", ",", "remote_path", ",", "local_source_file", ",", "**", "kwargs", ")", ":", "chunk_size", "=", "kwargs", ".", "get", "(", "'chunk_size'", ",", "10", "*", "1024", "*", "1024", ")", "result", "=", "True", "transfer_...
Uploads a file using chunks.
[ "Uploads", "a", "file", "using", "chunks", "." ]
[ "\"\"\"Uploads a file using chunks. If the file is smaller than\n ``chunk_size`` it will be uploaded directly.\n\n :param remote_path: path to the target file. A target directory can\n also be specified instead by appending a \"/\"\n :param local_source_file: path to the local file to up...
[ { "param": "self", "type": null }, { "param": "remote_path", "type": null }, { "param": "local_source_file", "type": null } ]
{ "returns": [ { "docstring": "True if the operation succeeded, False otherwise", "docstring_tokens": [ "True", "if", "the", "operation", "succeeded", "False", "otherwise" ], "type": null } ], "raises": [ { "docstrin...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
delete
<not_specific>
def delete(self, path): """Deletes a remote file or directory :param path: path to the file or directory to delete :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error status was returned """ return self.__make_dav_reque...
Deletes a remote file or directory :param path: path to the file or directory to delete :returns: True if the operation succeeded, False otherwise :raises: ResponseError in case an HTTP error status was returned
Deletes a remote file or directory
[ "Deletes", "a", "remote", "file", "or", "directory" ]
def delete(self, path): return self.__make_dav_request('DELETE', path)
[ "def", "delete", "(", "self", ",", "path", ")", ":", "return", "self", ".", "__make_dav_request", "(", "'DELETE'", ",", "path", ")" ]
Deletes a remote file or directory
[ "Deletes", "a", "remote", "file", "or", "directory" ]
[ "\"\"\"Deletes a remote file or directory\n\n :param path: path to the file or directory to delete\n :returns: True if the operation succeeded, False otherwise\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "True if the operation succeeded, False otherwise", "docstring_tokens": [ "True", "if", "the", "operation", "succeeded", "False", "otherwise" ], "type": null } ], "raises": [ { "docstrin...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
share_file_with_link
<not_specific>
def share_file_with_link(self, path): """Shares a remote file with link :param path: path to the remote file to share :returns: instance of :class:`PublicShare` with the share info or False if the operation failed :raises: ResponseError in case an HTTP error status was retur...
Shares a remote file with link :param path: path to the remote file to share :returns: instance of :class:`PublicShare` with the share info or False if the operation failed :raises: ResponseError in case an HTTP error status was returned
Shares a remote file with link
[ "Shares", "a", "remote", "file", "with", "link" ]
def share_file_with_link(self, path): path = self.__normalize_path(path) post_data = {'shareType': self.OCS_SHARE_TYPE_LINK, 'path': path} res = self.__make_ocs_request( 'POST', self.OCS_SERVICE_SHARE, 'shares', data = post_data ...
[ "def", "share_file_with_link", "(", "self", ",", "path", ")", ":", "path", "=", "self", ".", "__normalize_path", "(", "path", ")", "post_data", "=", "{", "'shareType'", ":", "self", ".", "OCS_SHARE_TYPE_LINK", ",", "'path'", ":", "path", "}", "res", "=", ...
Shares a remote file with link
[ "Shares", "a", "remote", "file", "with", "link" ]
[ "\"\"\"Shares a remote file with link\n\n :param path: path to the remote file to share\n :returns: instance of :class:`PublicShare` with the share info\n or False if the operation failed\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "instance of :class:`PublicShare` with the share info\nor False if the operation failed", "docstring_tokens": [ "instance", "of", ":", "class", ":", "`", "PublicShare", "`", "with", "the", ...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
is_shared
<not_specific>
def is_shared(self, path): """Checks whether a path is already shared :param path: path to the share to be checked :returns: True if the path is already shared, else False :raises: ResponseError in case an HTTP error status was returned """ # make sure that the path exis...
Checks whether a path is already shared :param path: path to the share to be checked :returns: True if the path is already shared, else False :raises: ResponseError in case an HTTP error status was returned
Checks whether a path is already shared
[ "Checks", "whether", "a", "path", "is", "already", "shared" ]
def is_shared(self, path): self.file_info(path) try: result = self.get_shares(path) if result: return (len(result) > 0) except ResponseError as e: if e.status_code != 404: raise e return False return False
[ "def", "is_shared", "(", "self", ",", "path", ")", ":", "self", ".", "file_info", "(", "path", ")", "try", ":", "result", "=", "self", ".", "get_shares", "(", "path", ")", "if", "result", ":", "return", "(", "len", "(", "result", ")", ">", "0", "...
Checks whether a path is already shared
[ "Checks", "whether", "a", "path", "is", "already", "shared" ]
[ "\"\"\"Checks whether a path is already shared\n\n :param path: path to the share to be checked\n :returns: True if the path is already shared, else False\n :raises: ResponseError in case an HTTP error status was returned\n \"\"\"", "# make sure that the path exist - if not, raise Resp...
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "True if the path is already shared, else False", "docstring_tokens": [ "True", "if", "the", "path", "is", "already", "shared", "else", "False" ], "type": null } ], "raises": [ ...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
share_file_with_user
<not_specific>
def share_file_with_user(self, path, user, **kwargs): """Shares a remote file with specified user :param path: path to the remote file to share :param user: name of the user whom we want to share a file/folder :param perms (optional): permissions of the shared object default...
Shares a remote file with specified user :param path: path to the remote file to share :param user: name of the user whom we want to share a file/folder :param perms (optional): permissions of the shared object defaults to read only (1) http://doc.owncloud.org/server/6.0...
Shares a remote file with specified user
[ "Shares", "a", "remote", "file", "with", "specified", "user" ]
def share_file_with_user(self, path, user, **kwargs): perms = kwargs.get('perms', self.OCS_PERMISSION_READ) if (((not isinstance(perms, int)) or (perms > self.OCS_PERMISSION_ALL)) or ((not isinstance(user, basestring)) or (user == ''))): return False path = self.__normali...
[ "def", "share_file_with_user", "(", "self", ",", "path", ",", "user", ",", "**", "kwargs", ")", ":", "perms", "=", "kwargs", ".", "get", "(", "'perms'", ",", "self", ".", "OCS_PERMISSION_READ", ")", "if", "(", "(", "(", "not", "isinstance", "(", "perms...
Shares a remote file with specified user
[ "Shares", "a", "remote", "file", "with", "specified", "user" ]
[ "\"\"\"Shares a remote file with specified user\n\n :param path: path to the remote file to share\n :param user: name of the user whom we want to share a file/folder\n :param perms (optional): permissions of the shared object\n defaults to read only (1)\n http://doc.ownclo...
[ { "param": "self", "type": null }, { "param": "path", "type": null }, { "param": "user", "type": null } ]
{ "returns": [ { "docstring": "instance of :class:`UserShare` with the share info\nor False if the operation failed", "docstring_tokens": [ "instance", "of", ":", "class", ":", "`", "UserShare", "`", "with", "the", ...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
__check_ocs_status
null
def __check_ocs_status(tree): """Checks the status code of an OCS request :param tree: response parsed with elementtree :raises: ResponseError if the status is not 200 """ code_el = tree.find('meta/statuscode') if code_el is not None and code_el.text != '100': ...
Checks the status code of an OCS request :param tree: response parsed with elementtree :raises: ResponseError if the status is not 200
Checks the status code of an OCS request
[ "Checks", "the", "status", "code", "of", "an", "OCS", "request" ]
def __check_ocs_status(tree): code_el = tree.find('meta/statuscode') if code_el is not None and code_el.text != '100': raise ResponseError(int(code_el.text))
[ "def", "__check_ocs_status", "(", "tree", ")", ":", "code_el", "=", "tree", ".", "find", "(", "'meta/statuscode'", ")", "if", "code_el", "is", "not", "None", "and", "code_el", ".", "text", "!=", "'100'", ":", "raise", "ResponseError", "(", "int", "(", "c...
Checks the status code of an OCS request
[ "Checks", "the", "status", "code", "of", "an", "OCS", "request" ]
[ "\"\"\"Checks the status code of an OCS request\n\n :param tree: response parsed with elementtree\n :raises: ResponseError if the status is not 200\n \"\"\"" ]
[ { "param": "tree", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "ResponseError if the status is not 200", "docstring_tokens": [ "ResponseError", "if", "the", "status", "is", "not", "200" ], "type": null } ], "params": [ { "identifier"...
a6f1d549e1c1ea1762ac2b6c71a5fe07f9a1a848
cernbox/pyocclient
owncloud/owncloud.py
[ "MIT" ]
Python
__strip_dav_path
<not_specific>
def __strip_dav_path(self, path): """Removes the leading "remote.php/webdav" path from the given path :param path: path containing the remote DAV path "remote.php/webdav" :returns: path stripped of the remote DAV path """ if (path.startswith(self.__davpath)): return ...
Removes the leading "remote.php/webdav" path from the given path :param path: path containing the remote DAV path "remote.php/webdav" :returns: path stripped of the remote DAV path
Removes the leading "remote.php/webdav" path from the given path
[ "Removes", "the", "leading", "\"", "remote", ".", "php", "/", "webdav", "\"", "path", "from", "the", "given", "path" ]
def __strip_dav_path(self, path): if (path.startswith(self.__davpath)): return path[len(self.__davpath):] return path
[ "def", "__strip_dav_path", "(", "self", ",", "path", ")", ":", "if", "(", "path", ".", "startswith", "(", "self", ".", "__davpath", ")", ")", ":", "return", "path", "[", "len", "(", "self", ".", "__davpath", ")", ":", "]", "return", "path" ]
Removes the leading "remote.php/webdav" path from the given path
[ "Removes", "the", "leading", "\"", "remote", ".", "php", "/", "webdav", "\"", "path", "from", "the", "given", "path" ]
[ "\"\"\"Removes the leading \"remote.php/webdav\" path from the given path\n\n :param path: path containing the remote DAV path \"remote.php/webdav\"\n :returns: path stripped of the remote DAV path\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [ { "docstring": "path stripped of the remote DAV path", "docstring_tokens": [ "path", "stripped", "of", "the", "remote", "DAV", "path" ], "type": null } ], "raises": [], "params": [ { "identifier": "s...
053d673585ceceaf4a3ed61c2cf79c3c180c8aa3
signalfx/python-tornado
tornado_opentracing/initialization.py
[ "Apache-2.0" ]
Python
_patch_handler_init
<not_specific>
def _patch_handler_init(init, handler, args, kwargs): """ This function patches tornado request handlers init method and then patches method that handle HTTP requests inside. This happens dynamically every time a request handler instace is created. This is needed as HTTP handler method do not exists...
This function patches tornado request handlers init method and then patches method that handle HTTP requests inside. This happens dynamically every time a request handler instace is created. This is needed as HTTP handler method do not exists on request handlers by default and are supposed to be ad...
This function patches tornado request handlers init method and then patches method that handle HTTP requests inside. This happens dynamically every time a request handler instace is created. This is needed as HTTP handler method do not exists on request handlers by default and are supposed to be added by users. check ...
[ "This", "function", "patches", "tornado", "request", "handlers", "init", "method", "and", "then", "patches", "method", "that", "handle", "HTTP", "requests", "inside", ".", "This", "happens", "dynamically", "every", "time", "a", "request", "handler", "instace", "...
def _patch_handler_init(init, handler, args, kwargs): init(*args, **kwargs) tracing = handler.settings.get("opentracing_tracing") if not tracing: return if not tracing._trace_all: return for method in handler.SUPPORTED_METHODS: handlers.wrap_method(handler, method.lower())
[ "def", "_patch_handler_init", "(", "init", ",", "handler", ",", "args", ",", "kwargs", ")", ":", "init", "(", "*", "args", ",", "**", "kwargs", ")", "tracing", "=", "handler", ".", "settings", ".", "get", "(", "\"opentracing_tracing\"", ")", "if", "not",...
This function patches tornado request handlers init method and then patches method that handle HTTP requests inside.
[ "This", "function", "patches", "tornado", "request", "handlers", "init", "method", "and", "then", "patches", "method", "that", "handle", "HTTP", "requests", "inside", "." ]
[ "\"\"\"\n This function patches tornado request handlers init method\n and then patches method that handle HTTP requests inside.\n This happens dynamically every time a request handler instace\n is created. This is needed as HTTP handler method do not exists\n on request handlers by default and are s...
[ { "param": "init", "type": null }, { "param": "handler", "type": null }, { "param": "args", "type": null }, { "param": "kwargs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "init", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler", "type": null, "docstring": null, "docstring_tokens"...
13f35a16943bc06f8ca55c6bb9bd7dd143aa14b7
signalfx/python-tornado
tornado_opentracing/_tracing.py
[ "Apache-2.0" ]
Python
trace
<not_specific>
def trace(self, *attributes): """ Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span """ @wrapt.decorator def wrapp...
Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span
Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span
[ "Function", "decorator", "that", "traces", "functions", "NOTE", ":", "Must", "be", "placed", "before", "the", "Tornado", "decorators", "@param", "attributes", "any", "number", "of", "request", "attributes", "(", "strings", ")", "to", "be", "set", "as", "tags",...
def trace(self, *attributes): @wrapt.decorator def wrapper(wrapped, instance, args, kwargs): if self._trace_all: return wrapped(*args, **kwargs) handler = instance with tornado_context(): try: self._apply_tracing(han...
[ "def", "trace", "(", "self", ",", "*", "attributes", ")", ":", "@", "wrapt", ".", "decorator", "def", "wrapper", "(", "wrapped", ",", "instance", ",", "args", ",", "kwargs", ")", ":", "if", "self", ".", "_trace_all", ":", "return", "wrapped", "(", "*...
Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span
[ "Function", "decorator", "that", "traces", "functions", "NOTE", ":", "Must", "be", "placed", "before", "the", "Tornado", "decorators", "@param", "attributes", "any", "number", "of", "request", "attributes", "(", "strings", ")", "to", "be", "set", "as", "tags",...
[ "\"\"\"\n Function decorator that traces functions\n NOTE: Must be placed before the Tornado decorators\n @param attributes any number of request attributes\n (strings) to be set as tags on the created span\n \"\"\"", "# Run the actual function." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
13f35a16943bc06f8ca55c6bb9bd7dd143aa14b7
signalfx/python-tornado
tornado_opentracing/_tracing.py
[ "Apache-2.0" ]
Python
_apply_tracing
<not_specific>
def _apply_tracing(self, handler, attributes): """ Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func. """ operation_name = self._get_operation_name(handler) ...
Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func.
Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func.
[ "Helper", "function", "to", "avoid", "rewriting", "for", "middleware", "and", "decorator", ".", "Returns", "a", "new", "span", "from", "the", "request", "with", "logged", "attributes", "and", "correct", "operation", "name", "from", "the", "func", "." ]
def _apply_tracing(self, handler, attributes): operation_name = self._get_operation_name(handler) headers = handler.request.headers request = handler.request try: span_ctx = self._tracer.extract(opentracing.Format.HTTP_HEADERS, headers) scope = self._tracer.start_...
[ "def", "_apply_tracing", "(", "self", ",", "handler", ",", "attributes", ")", ":", "operation_name", "=", "self", ".", "_get_operation_name", "(", "handler", ")", "headers", "=", "handler", ".", "request", ".", "headers", "request", "=", "handler", ".", "req...
Helper function to avoid rewriting for middleware and decorator.
[ "Helper", "function", "to", "avoid", "rewriting", "for", "middleware", "and", "decorator", "." ]
[ "\"\"\"\n Helper function to avoid rewriting for middleware and decorator.\n Returns a new span from the request with logged attributes and\n correct operation name from the func.\n \"\"\"", "# start new span from trace info", "# add span to current spans", "# log any traced attrib...
[ { "param": "self", "type": null }, { "param": "handler", "type": null }, { "param": "attributes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler", "type": null, "docstring": null, "docstring_tokens"...
00db83ccd16877e1361e50b2360168acdb6a870f
BozianuLeon/graphnet
src/graphnet/models/utils.py
[ "Apache-2.0" ]
Python
calculate_xyzt_homophily
<not_specific>
def calculate_xyzt_homophily(x, edge_index, batch): """Calculates xyzt homophily from a batch of graphs. Homophily is a graph scalar quantity that measures the likeness of variables in nodes. Notice that this calculator assumes a special order of input features in x. Returns: tuple : tuple...
Calculates xyzt homophily from a batch of graphs. Homophily is a graph scalar quantity that measures the likeness of variables in nodes. Notice that this calculator assumes a special order of input features in x. Returns: tuple : tuple of torch.tensor each with shape [batch_size,1]
Calculates xyzt homophily from a batch of graphs. Homophily is a graph scalar quantity that measures the likeness of variables in nodes. Notice that this calculator assumes a special order of input features in x.
[ "Calculates", "xyzt", "homophily", "from", "a", "batch", "of", "graphs", ".", "Homophily", "is", "a", "graph", "scalar", "quantity", "that", "measures", "the", "likeness", "of", "variables", "in", "nodes", ".", "Notice", "that", "this", "calculator", "assumes"...
def calculate_xyzt_homophily(x, edge_index, batch): hx = homophily(edge_index, x[:, 0], batch).reshape(-1, 1) hy = homophily(edge_index, x[:, 1], batch).reshape(-1, 1) hz = homophily(edge_index, x[:, 2], batch).reshape(-1, 1) ht = homophily(edge_index, x[:, 3], batch).reshape(-1, 1) return hx, hy, h...
[ "def", "calculate_xyzt_homophily", "(", "x", ",", "edge_index", ",", "batch", ")", ":", "hx", "=", "homophily", "(", "edge_index", ",", "x", "[", ":", ",", "0", "]", ",", "batch", ")", ".", "reshape", "(", "-", "1", ",", "1", ")", "hy", "=", "hom...
Calculates xyzt homophily from a batch of graphs.
[ "Calculates", "xyzt", "homophily", "from", "a", "batch", "of", "graphs", "." ]
[ "\"\"\"Calculates xyzt homophily from a batch of graphs.\n\n Homophily is a graph scalar quantity that measures the likeness of variables\n in nodes. Notice that this calculator assumes a special order of input\n features in x.\n\n Returns:\n tuple : tuple of torch.tensor each with shape [batch_s...
[ { "param": "x", "type": null }, { "param": "edge_index", "type": null }, { "param": "batch", "type": null } ]
{ "returns": [ { "docstring": "tuple : tuple of torch.tensor each with shape [batch_size,1]", "docstring_tokens": [ "tuple", ":", "tuple", "of", "torch", ".", "tensor", "each", "with", "shape", "[", "batch_...
00db83ccd16877e1361e50b2360168acdb6a870f
BozianuLeon/graphnet
src/graphnet/models/utils.py
[ "Apache-2.0" ]
Python
calculate_distance_matrix
Tensor
def calculate_distance_matrix(xyz_coords: Tensor) -> Tensor: """ Calculate the matrix of pairwise distances between pulses in (x,y,z)-coordinates. Args: xyz_coords: (x,y,z)-coordinates of pulses, of shape [nb_doms, 3]. Returns: Matrix of pairwise distances, of shape [nb_doms, nb_doms] ...
Calculate the matrix of pairwise distances between pulses in (x,y,z)-coordinates. Args: xyz_coords: (x,y,z)-coordinates of pulses, of shape [nb_doms, 3]. Returns: Matrix of pairwise distances, of shape [nb_doms, nb_doms]
Calculate the matrix of pairwise distances between pulses in (x,y,z)-coordinates.
[ "Calculate", "the", "matrix", "of", "pairwise", "distances", "between", "pulses", "in", "(", "x", "y", "z", ")", "-", "coordinates", "." ]
def calculate_distance_matrix(xyz_coords: Tensor) -> Tensor: diff = xyz_coords.unsqueeze(dim=2) - xyz_coords.T.unsqueeze(dim=0) return torch.sqrt(torch.sum(diff**2, dim=1))
[ "def", "calculate_distance_matrix", "(", "xyz_coords", ":", "Tensor", ")", "->", "Tensor", ":", "diff", "=", "xyz_coords", ".", "unsqueeze", "(", "dim", "=", "2", ")", "-", "xyz_coords", ".", "T", ".", "unsqueeze", "(", "dim", "=", "0", ")", "return", ...
Calculate the matrix of pairwise distances between pulses in (x,y,z)-coordinates.
[ "Calculate", "the", "matrix", "of", "pairwise", "distances", "between", "pulses", "in", "(", "x", "y", "z", ")", "-", "coordinates", "." ]
[ "\"\"\"\n Calculate the matrix of pairwise distances between pulses in (x,y,z)-coordinates.\n\n Args:\n xyz_coords: (x,y,z)-coordinates of pulses, of shape [nb_doms, 3].\n\n Returns:\n Matrix of pairwise distances, of shape [nb_doms, nb_doms]\n \"\"\"" ]
[ { "param": "xyz_coords", "type": "Tensor" } ]
{ "returns": [ { "docstring": "Matrix of pairwise distances, of shape [nb_doms, nb_doms]", "docstring_tokens": [ "Matrix", "of", "pairwise", "distances", "of", "shape", "[", "nb_doms", "nb_doms", "]" ], "type":...
4ee64c31ec5738b0e02d72aafa90b5dab0f9fa89
BozianuLeon/graphnet
src/graphnet/models/detector/icecube.py
[ "Apache-2.0" ]
Python
_forward
Data
def _forward(self, data: Data) -> Data: """Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data. """ # Check(s) self._validate_f...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data.
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
def _forward(self, data: Data) -> Data: self._validate_features(data) data.x[:, 0] /= 100.0 data.x[:, 1] /= 100.0 data.x[:, 2] += 350.0 data.x[:, 2] /= 100.0 data.x[:, 3] /= 1.05e04 data.x[:, 3] -= 1.0 data.x[:, 3] *= 20.0 data.x[:, 4] /= 1...
[ "def", "_forward", "(", "self", ",", "data", ":", "Data", ")", "->", "Data", ":", "self", ".", "_validate_features", "(", "data", ")", "data", ".", "x", "[", ":", ",", "0", "]", "/=", "100.0", "data", ".", "x", "[", ":", ",", "1", "]", "/=", ...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
[ "\"\"\"Ingests data, builds graph (connectivity/adjacency), and preprocesses features.\n\n Args:\n data (Data): Input graph data.\n\n Returns:\n Data: Connected and preprocessed graph data.\n \"\"\"", "# Check(s)", "# Preprocessing", "# dom_x", "# dom_y", "# dom_...
[ { "param": "self", "type": null }, { "param": "data", "type": "Data" } ]
{ "returns": [ { "docstring": "Connected and preprocessed graph data.", "docstring_tokens": [ "Connected", "and", "preprocessed", "graph", "data", "." ], "type": "Data" } ], "raises": [], "params": [ { "identifier": "self"...
4ee64c31ec5738b0e02d72aafa90b5dab0f9fa89
BozianuLeon/graphnet
src/graphnet/models/detector/icecube.py
[ "Apache-2.0" ]
Python
_forward
Data
def _forward(self, data: Data) -> Data: """Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data. """ # Check(s) self._validate_f...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data.
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
def _forward(self, data: Data) -> Data: self._validate_features(data) data.x[:, 0] /= 500.0 data.x[:, 1] /= 500.0 data.x[:, 2] /= 500.0 data.x[:, 3] /= 2e04 data.x[:, 3] -= 1.0 data.x[:, 4] = torch.log10(data.x[:, 4]) / 2.0 data.x[:, 6] /= 0.05 ...
[ "def", "_forward", "(", "self", ",", "data", ":", "Data", ")", "->", "Data", ":", "self", ".", "_validate_features", "(", "data", ")", "data", ".", "x", "[", ":", ",", "0", "]", "/=", "500.0", "data", ".", "x", "[", ":", ",", "1", "]", "/=", ...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
[ "\"\"\"Ingests data, builds graph (connectivity/adjacency), and preprocesses features.\n\n Args:\n data (Data): Input graph data.\n\n Returns:\n Data: Connected and preprocessed graph data.\n \"\"\"", "# Check(s)", "# Preprocessing", "# dom_x", "# dom_y", "# dom_...
[ { "param": "self", "type": null }, { "param": "data", "type": "Data" } ]
{ "returns": [ { "docstring": "Connected and preprocessed graph data.", "docstring_tokens": [ "Connected", "and", "preprocessed", "graph", "data", "." ], "type": "Data" } ], "raises": [], "params": [ { "identifier": "self"...
4ee64c31ec5738b0e02d72aafa90b5dab0f9fa89
BozianuLeon/graphnet
src/graphnet/models/detector/icecube.py
[ "Apache-2.0" ]
Python
_forward
Data
def _forward(self, data: Data) -> Data: """Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data. """ # Check(s) self._validate_f...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features. Args: data (Data): Input graph data. Returns: Data: Connected and preprocessed graph data.
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
def _forward(self, data: Data) -> Data: self._validate_features(data) data = group_pulses_to_dom(data) data = group_pulses_to_pmt(data) xyz = torch.stack((data["dom_x"], data["dom_y"], data["dom_z"]), dim=1) pmt_dir = torch.stack( (data["pmt_dir_x"], data["pmt_dir_x"]...
[ "def", "_forward", "(", "self", ",", "data", ":", "Data", ")", "->", "Data", ":", "self", ".", "_validate_features", "(", "data", ")", "data", "=", "group_pulses_to_dom", "(", "data", ")", "data", "=", "group_pulses_to_pmt", "(", "data", ")", "xyz", "=",...
Ingests data, builds graph (connectivity/adjacency), and preprocesses features.
[ "Ingests", "data", "builds", "graph", "(", "connectivity", "/", "adjacency", ")", "and", "preprocesses", "features", "." ]
[ "\"\"\"Ingests data, builds graph (connectivity/adjacency), and preprocesses features.\n\n Args:\n data (Data): Input graph data.\n\n Returns:\n Data: Connected and preprocessed graph data.\n \"\"\"", "# Check(s)", "# Assign pulse cluster indices to DOMs and PMTs, resp...
[ { "param": "self", "type": null }, { "param": "data", "type": "Data" } ]
{ "returns": [ { "docstring": "Connected and preprocessed graph data.", "docstring_tokens": [ "Connected", "and", "preprocessed", "graph", "data", "." ], "type": "Data" } ], "raises": [], "params": [ { "identifier": "self"...
e9669c4c0d3eb68438594c7c905f70a6d887a566
BozianuLeon/graphnet
src/graphnet/models/coarsening.py
[ "Apache-2.0" ]
Python
_additional_features
Tensor
def _additional_features(self, cluster: LongTensor, data: Data) -> Tensor: """Additional poolings of feature tensor `x` on `data`. By default the nominal `pooling_method` is used for features as well. This method can be overwritten for bespoke coarsening operations. """ return N...
Additional poolings of feature tensor `x` on `data`. By default the nominal `pooling_method` is used for features as well. This method can be overwritten for bespoke coarsening operations.
Additional poolings of feature tensor `x` on `data`. By default the nominal `pooling_method` is used for features as well. This method can be overwritten for bespoke coarsening operations.
[ "Additional", "poolings", "of", "feature", "tensor", "`", "x", "`", "on", "`", "data", "`", ".", "By", "default", "the", "nominal", "`", "pooling_method", "`", "is", "used", "for", "features", "as", "well", ".", "This", "method", "can", "be", "overwritte...
def _additional_features(self, cluster: LongTensor, data: Data) -> Tensor: return None
[ "def", "_additional_features", "(", "self", ",", "cluster", ":", "LongTensor", ",", "data", ":", "Data", ")", "->", "Tensor", ":", "return", "None" ]
Additional poolings of feature tensor `x` on `data`.
[ "Additional", "poolings", "of", "feature", "tensor", "`", "x", "`", "on", "`", "data", "`", "." ]
[ "\"\"\"Additional poolings of feature tensor `x` on `data`.\n\n By default the nominal `pooling_method` is used for features as well.\n This method can be overwritten for bespoke coarsening operations.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "cluster", "type": "LongTensor" }, { "param": "data", "type": "Data" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cluster", "type": "LongTensor", "docstring": null, "docstring...
e9669c4c0d3eb68438594c7c905f70a6d887a566
BozianuLeon/graphnet
src/graphnet/models/coarsening.py
[ "Apache-2.0" ]
Python
_perform_clustering
LongTensor
def _perform_clustering(self, data: Data) -> LongTensor: """Perform clustering of nodes in `data` by assigning unique cluster indices to each.""" # dom_index = group_pulses_to_dom(data) dom_index = group_by( data, ["dom_x", "dom_y", "dom_z", "rde", "pmt_area"] ) retur...
Perform clustering of nodes in `data` by assigning unique cluster indices to each.
Perform clustering of nodes in `data` by assigning unique cluster indices to each.
[ "Perform", "clustering", "of", "nodes", "in", "`", "data", "`", "by", "assigning", "unique", "cluster", "indices", "to", "each", "." ]
def _perform_clustering(self, data: Data) -> LongTensor: dom_index = group_by( data, ["dom_x", "dom_y", "dom_z", "rde", "pmt_area"] ) return dom_index
[ "def", "_perform_clustering", "(", "self", ",", "data", ":", "Data", ")", "->", "LongTensor", ":", "dom_index", "=", "group_by", "(", "data", ",", "[", "\"dom_x\"", ",", "\"dom_y\"", ",", "\"dom_z\"", ",", "\"rde\"", ",", "\"pmt_area\"", "]", ")", "return"...
Perform clustering of nodes in `data` by assigning unique cluster indices to each.
[ "Perform", "clustering", "of", "nodes", "in", "`", "data", "`", "by", "assigning", "unique", "cluster", "indices", "to", "each", "." ]
[ "\"\"\"Perform clustering of nodes in `data` by assigning unique cluster indices to each.\"\"\"", "# dom_index = group_pulses_to_dom(data)" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "Data" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "Data", "docstring": null, "docstring_tokens":...
f339545d5b709f8bf3fc969d7ac24774f0deeb04
BozianuLeon/graphnet
src/graphnet/pisa/plotting.py
[ "Apache-2.0" ]
Python
plot_2D_contour
<not_specific>
def plot_2D_contour( contour_data, xlim=(0.4, 0.6), ylim=(2.38 * 1e-3, 2.55 * 1e-3), chi2_critical_value=4.605, width=3.176, height=2.388, ): """Plots 2D contours from GraphNeT PISA fits. Args: contour_data (list): list of dictionaries with plotting information. Format is for e...
Plots 2D contours from GraphNeT PISA fits. Args: contour_data (list): list of dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "colo...
Plots 2D contours from GraphNeT PISA fits.
[ "Plots", "2D", "contours", "from", "GraphNeT", "PISA", "fits", "." ]
def plot_2D_contour( contour_data, xlim=(0.4, 0.6), ylim=(2.38 * 1e-3, 2.55 * 1e-3), chi2_critical_value=4.605, width=3.176, height=2.388, ): fig, ax = plt.subplots(figsize=(width, height), constrained_layout=True) proxy = [] labels = [] for entry in contour_data: entry_d...
[ "def", "plot_2D_contour", "(", "contour_data", ",", "xlim", "=", "(", "0.4", ",", "0.6", ")", ",", "ylim", "=", "(", "2.38", "*", "1e-3", ",", "2.55", "*", "1e-3", ")", ",", "chi2_critical_value", "=", "4.605", ",", "width", "=", "3.176", ",", "heigh...
Plots 2D contours from GraphNeT PISA fits.
[ "Plots", "2D", "contours", "from", "GraphNeT", "PISA", "fits", "." ]
[ "\"\"\"Plots 2D contours from GraphNeT PISA fits.\n\n Args:\n contour_data (list): list of dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: \"label\" - the leg...
[ { "param": "contour_data", "type": null }, { "param": "xlim", "type": null }, { "param": "ylim", "type": null }, { "param": "chi2_critical_value", "type": null }, { "param": "width", "type": null }, { "param": "height", "type": null } ]
{ "returns": [ { "docstring": "the figure with contours", "docstring_tokens": [ "the", "figure", "with", "contours" ], "type": "matplotlib.pyplot.figure" } ], "raises": [], "params": [ { "identifier": "contour_data", "type": null, ...
f339545d5b709f8bf3fc969d7ac24774f0deeb04
BozianuLeon/graphnet
src/graphnet/pisa/plotting.py
[ "Apache-2.0" ]
Python
plot_1D_contour
<not_specific>
def plot_1D_contour( contour_data, chi2_critical_value=2.706, width=2 * 3.176, height=2.388 ): """Plots 1D contours from GraphNeT PISA fits. Args: contour_data (list): list of dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_...
Plots 1D contours from GraphNeT PISA fits. Args: contour_data (list): list of dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "colo...
Plots 1D contours from GraphNeT PISA fits.
[ "Plots", "1D", "contours", "from", "GraphNeT", "PISA", "fits", "." ]
def plot_1D_contour( contour_data, chi2_critical_value=2.706, width=2 * 3.176, height=2.388 ): variables = ["theta23_fixed", "dm31_fixed"] fig, ax = plt.subplots( 1, 2, figsize=(width, height), constrained_layout=True ) ls = 0 for entry in contour_data: entry_data, model_name, la...
[ "def", "plot_1D_contour", "(", "contour_data", ",", "chi2_critical_value", "=", "2.706", ",", "width", "=", "2", "*", "3.176", ",", "height", "=", "2.388", ")", ":", "variables", "=", "[", "\"theta23_fixed\"", ",", "\"dm31_fixed\"", "]", "fig", ",", "ax", ...
Plots 1D contours from GraphNeT PISA fits.
[ "Plots", "1D", "contours", "from", "GraphNeT", "PISA", "fits", "." ]
[ "\"\"\"Plots 1D contours from GraphNeT PISA fits.\n\n Args:\n contour_data (list): list of dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: \"label\" - the leg...
[ { "param": "contour_data", "type": null }, { "param": "chi2_critical_value", "type": null }, { "param": "width", "type": null }, { "param": "height", "type": null } ]
{ "returns": [ { "docstring": "the figure with contours", "docstring_tokens": [ "the", "figure", "with", "contours" ], "type": "matplotlib.pyplot.figure" } ], "raises": [], "params": [ { "identifier": "contour_data", "type": null, ...
bbac19d83c2856e3f4287b2a5a741e0a5df2e691
BozianuLeon/graphnet
studies/upgrade_noise/deployment/process_i3_file.py
[ "Apache-2.0" ]
Python
main
null
def main(input_files, output_file, key, pulsemaps, gcd_file, events_max): """Run minimal icetray chain with GraphNeT module.""" # Make sure output directory exists makedirs(dirname(output_file), exist_ok=True) # Get GCD file if gcd_file is None: gcd_candidates = [p for p in input_files if ...
Run minimal icetray chain with GraphNeT module.
Run minimal icetray chain with GraphNeT module.
[ "Run", "minimal", "icetray", "chain", "with", "GraphNeT", "module", "." ]
def main(input_files, output_file, key, pulsemaps, gcd_file, events_max): makedirs(dirname(output_file), exist_ok=True) if gcd_file is None: gcd_candidates = [p for p in input_files if is_gcd_file(p)] assert ( len(gcd_candidates) == 1 ), f"Did not get exactly one GCD-file can...
[ "def", "main", "(", "input_files", ",", "output_file", ",", "key", ",", "pulsemaps", ",", "gcd_file", ",", "events_max", ")", ":", "makedirs", "(", "dirname", "(", "output_file", ")", ",", "exist_ok", "=", "True", ")", "if", "gcd_file", "is", "None", ":"...
Run minimal icetray chain with GraphNeT module.
[ "Run", "minimal", "icetray", "chain", "with", "GraphNeT", "module", "." ]
[ "\"\"\"Run minimal icetray chain with GraphNeT module.\"\"\"", "# Make sure output directory exists", "# Get GCD file", "# Get all input I3-files", "# Run graphnet module in tray" ]
[ { "param": "input_files", "type": null }, { "param": "output_file", "type": null }, { "param": "key", "type": null }, { "param": "pulsemaps", "type": null }, { "param": "gcd_file", "type": null }, { "param": "events_max", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_files", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_file", "type": null, "docstring": null, "docstr...
45b07f7057b6dcc347b9dde6b6c7219bf7595351
BozianuLeon/graphnet
src/graphnet/plots/utils.py
[ "Apache-2.0" ]
Python
add_pid_and_interaction
<not_specific>
def add_pid_and_interaction(db, df): """Adds particle and interaction ID from database `db` to dataframe `df`.""" events = df["event_no"] with sqlite3.connect(db) as con: query = ( "select event_no, pid, interaction_type from truth where event_no in %s" % str(tuple(events)) ...
Adds particle and interaction ID from database `db` to dataframe `df`.
Adds particle and interaction ID from database `db` to dataframe `df`.
[ "Adds", "particle", "and", "interaction", "ID", "from", "database", "`", "db", "`", "to", "dataframe", "`", "df", "`", "." ]
def add_pid_and_interaction(db, df): events = df["event_no"] with sqlite3.connect(db) as con: query = ( "select event_no, pid, interaction_type from truth where event_no in %s" % str(tuple(events)) ) data = ( pd.read_sql(query, con) .sort_v...
[ "def", "add_pid_and_interaction", "(", "db", ",", "df", ")", ":", "events", "=", "df", "[", "\"event_no\"", "]", "with", "sqlite3", ".", "connect", "(", "db", ")", "as", "con", ":", "query", "=", "(", "\"select event_no, pid, interaction_type from truth where ev...
Adds particle and interaction ID from database `db` to dataframe `df`.
[ "Adds", "particle", "and", "interaction", "ID", "from", "database", "`", "db", "`", "to", "dataframe", "`", "df", "`", "." ]
[ "\"\"\"Adds particle and interaction ID from database `db` to dataframe `df`.\"\"\"" ]
[ { "param": "db", "type": null }, { "param": "df", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "db", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], ...
45b07f7057b6dcc347b9dde6b6c7219bf7595351
BozianuLeon/graphnet
src/graphnet/plots/utils.py
[ "Apache-2.0" ]
Python
calculate_width_error
<not_specific>
def calculate_width_error(diff): """Calculate the uncertainty on the estimated width from the 68-interpercentile range.""" N = len(diff) x_16 = abs( diff - np.percentile(diff, 16, interpolation="nearest") ).argmin() x_84 = abs( diff - np.percentile(diff, 84, interpolation="nearest") ...
Calculate the uncertainty on the estimated width from the 68-interpercentile range.
Calculate the uncertainty on the estimated width from the 68-interpercentile range.
[ "Calculate", "the", "uncertainty", "on", "the", "estimated", "width", "from", "the", "68", "-", "interpercentile", "range", "." ]
def calculate_width_error(diff): N = len(diff) x_16 = abs( diff - np.percentile(diff, 16, interpolation="nearest") ).argmin() x_84 = abs( diff - np.percentile(diff, 84, interpolation="nearest") ).argmin() if len(diff) > 0: error_width = np.sqrt( (1 / empirical...
[ "def", "calculate_width_error", "(", "diff", ")", ":", "N", "=", "len", "(", "diff", ")", "x_16", "=", "abs", "(", "diff", "-", "np", ".", "percentile", "(", "diff", ",", "16", ",", "interpolation", "=", "\"nearest\"", ")", ")", ".", "argmin", "(", ...
Calculate the uncertainty on the estimated width from the 68-interpercentile range.
[ "Calculate", "the", "uncertainty", "on", "the", "estimated", "width", "from", "the", "68", "-", "interpercentile", "range", "." ]
[ "\"\"\"Calculate the uncertainty on the estimated width from the 68-interpercentile range.\"\"\"" ]
[ { "param": "diff", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "diff", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
45b07f7057b6dcc347b9dde6b6c7219bf7595351
BozianuLeon/graphnet
src/graphnet/plots/utils.py
[ "Apache-2.0" ]
Python
check_for_retro
bool
def check_for_retro(data: pd.DataFrame) -> bool: """Check whether `data` contains a column with a name containing "retro".""" columns = data.columns is_retro = False for column in columns: if "retro" in column: is_retro = True break return is_retro
Check whether `data` contains a column with a name containing "retro".
Check whether `data` contains a column with a name containing "retro".
[ "Check", "whether", "`", "data", "`", "contains", "a", "column", "with", "a", "name", "containing", "\"", "retro", "\"", "." ]
def check_for_retro(data: pd.DataFrame) -> bool: columns = data.columns is_retro = False for column in columns: if "retro" in column: is_retro = True break return is_retro
[ "def", "check_for_retro", "(", "data", ":", "pd", ".", "DataFrame", ")", "->", "bool", ":", "columns", "=", "data", ".", "columns", "is_retro", "=", "False", "for", "column", "in", "columns", ":", "if", "\"retro\"", "in", "column", ":", "is_retro", "=", ...
Check whether `data` contains a column with a name containing "retro".
[ "Check", "whether", "`", "data", "`", "contains", "a", "column", "with", "a", "name", "containing", "\"", "retro", "\"", "." ]
[ "\"\"\"Check whether `data` contains a column with a name containing \"retro\".\"\"\"" ]
[ { "param": "data", "type": "pd.DataFrame" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "pd.DataFrame", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
45b07f7057b6dcc347b9dde6b6c7219bf7595351
BozianuLeon/graphnet
src/graphnet/plots/utils.py
[ "Apache-2.0" ]
Python
PlotWidth
<not_specific>
def PlotWidth(key_limits, biases): """Plot reconstruction resoltion (width) for DynEdge vs. RetroReco.""" key_limits = key_limits["width"] if "retro" in biases.keys(): contains_retro = True else: contains_retro = False for key in biases["dynedge"].keys(): fig, ax = plt.subpl...
Plot reconstruction resoltion (width) for DynEdge vs. RetroReco.
Plot reconstruction resoltion (width) for DynEdge vs.
[ "Plot", "reconstruction", "resoltion", "(", "width", ")", "for", "DynEdge", "vs", "." ]
def PlotWidth(key_limits, biases): key_limits = key_limits["width"] if "retro" in biases.keys(): contains_retro = True else: contains_retro = False for key in biases["dynedge"].keys(): fig, ax = plt.subplots(2, 3, figsize=(11.69, 8.27)) fig.suptitle("dynedge: %s" % key, s...
[ "def", "PlotWidth", "(", "key_limits", ",", "biases", ")", ":", "key_limits", "=", "key_limits", "[", "\"width\"", "]", "if", "\"retro\"", "in", "biases", ".", "keys", "(", ")", ":", "contains_retro", "=", "True", "else", ":", "contains_retro", "=", "False...
Plot reconstruction resoltion (width) for DynEdge vs. RetroReco.
[ "Plot", "reconstruction", "resoltion", "(", "width", ")", "for", "DynEdge", "vs", ".", "RetroReco", "." ]
[ "\"\"\"Plot reconstruction resoltion (width) for DynEdge vs. RetroReco.\"\"\"" ]
[ { "param": "key_limits", "type": null }, { "param": "biases", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "key_limits", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "biases", "type": null, "docstring": null, "docstring_to...
45b07f7057b6dcc347b9dde6b6c7219bf7595351
BozianuLeon/graphnet
src/graphnet/plots/utils.py
[ "Apache-2.0" ]
Python
PlotRelativeImprovement
<not_specific>
def PlotRelativeImprovement(key_limits, biases): """Plot relative improvement of DynEdge vs. RetroReco.""" key_limits = key_limits["rel_imp"] for key in biases["dynedge"].keys(): fig, ax = plt.subplots(2, 3, figsize=(11.69, 8.27)) fig.suptitle("dynedge: %s" % key, size=30) pid_count ...
Plot relative improvement of DynEdge vs. RetroReco.
Plot relative improvement of DynEdge vs.
[ "Plot", "relative", "improvement", "of", "DynEdge", "vs", "." ]
def PlotRelativeImprovement(key_limits, biases): key_limits = key_limits["rel_imp"] for key in biases["dynedge"].keys(): fig, ax = plt.subplots(2, 3, figsize=(11.69, 8.27)) fig.suptitle("dynedge: %s" % key, size=30) pid_count = 0 for pid in biases["dynedge"][key].keys(): ...
[ "def", "PlotRelativeImprovement", "(", "key_limits", ",", "biases", ")", ":", "key_limits", "=", "key_limits", "[", "\"rel_imp\"", "]", "for", "key", "in", "biases", "[", "\"dynedge\"", "]", ".", "keys", "(", ")", ":", "fig", ",", "ax", "=", "plt", ".", ...
Plot relative improvement of DynEdge vs. RetroReco.
[ "Plot", "relative", "improvement", "of", "DynEdge", "vs", ".", "RetroReco", "." ]
[ "\"\"\"Plot relative improvement of DynEdge vs. RetroReco.\"\"\"" ]
[ { "param": "key_limits", "type": null }, { "param": "biases", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "key_limits", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "biases", "type": null, "docstring": null, "docstring_to...
697ae1677de1f3bb5d2f53076b6bdc9f4d464681
BozianuLeon/graphnet
src/graphnet/models/task/task.py
[ "Apache-2.0" ]
Python
_validate_and_set_transforms
null
def _validate_and_set_transforms( self, transform_prediction_and_target: Union[Callable, None], transform_target: Union[Callable, None], transform_inference: Union[Callable, None], transform_support: Union[Callable, None], ): """Assert that a valid combination of tran...
Assert that a valid combination of transformation arguments are passed and update the corresponding functions
Assert that a valid combination of transformation arguments are passed and update the corresponding functions
[ "Assert", "that", "a", "valid", "combination", "of", "transformation", "arguments", "are", "passed", "and", "update", "the", "corresponding", "functions" ]
def _validate_and_set_transforms( self, transform_prediction_and_target: Union[Callable, None], transform_target: Union[Callable, None], transform_inference: Union[Callable, None], transform_support: Union[Callable, None], ): assert not ( (transform_predic...
[ "def", "_validate_and_set_transforms", "(", "self", ",", "transform_prediction_and_target", ":", "Union", "[", "Callable", ",", "None", "]", ",", "transform_target", ":", "Union", "[", "Callable", ",", "None", "]", ",", "transform_inference", ":", "Union", "[", ...
Assert that a valid combination of transformation arguments are passed and update the corresponding functions
[ "Assert", "that", "a", "valid", "combination", "of", "transformation", "arguments", "are", "passed", "and", "update", "the", "corresponding", "functions" ]
[ "\"\"\"Assert that a valid combination of transformation arguments are passed and update the corresponding functions\"\"\"", "# Checks", "# Add feature dimension before inference transformation to make it match the dimensions of a standard prediction. Remove it again before comparison. Temporary", "# Set tran...
[ { "param": "self", "type": null }, { "param": "transform_prediction_and_target", "type": "Union[Callable, None]" }, { "param": "transform_target", "type": "Union[Callable, None]" }, { "param": "transform_inference", "type": "Union[Callable, None]" }, { "param": "t...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "transform_prediction_and_target", "type": "Union[Callable, None]", ...
42ba5a8cff373f7c504fa163f58cf6739216c839
BozianuLeon/graphnet
src/graphnet/data/i3extractor.py
[ "Apache-2.0" ]
Python
muon_stopped
<not_specific>
def muon_stopped(truth, borders, horizontal_pad=100.0, vertical_pad=100.0): """ Calculates where a simulated muon stops and if this is inside the detectors fiducial volume. IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z. ...
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume. IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z. This is analogoues to the neutrinos whose interaction vertex is saved under the sa...
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume. IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z. This is analogoues to the neutrinos whose interaction vertex is saved under the same name.
[ "Calculates", "where", "a", "simulated", "muon", "stops", "and", "if", "this", "is", "inside", "the", "detectors", "fiducial", "volume", ".", "IMPORTANT", ":", "The", "final", "position", "of", "the", "muon", "is", "saved", "in", "truth", "extractor", "/", ...
def muon_stopped(truth, borders, horizontal_pad=100.0, vertical_pad=100.0): border = mpath.Path(borders[0]) start_pos = np.array( [truth["position_x"], truth["position_y"], truth["position_z"]] ) travel_vec = -1 * np.array( [ truth["track_length"] * np.cos(truth["...
[ "def", "muon_stopped", "(", "truth", ",", "borders", ",", "horizontal_pad", "=", "100.0", ",", "vertical_pad", "=", "100.0", ")", ":", "border", "=", "mpath", ".", "Path", "(", "borders", "[", "0", "]", ")", "start_pos", "=", "np", ".", "array", "(", ...
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
[ "Calculates", "where", "a", "simulated", "muon", "stops", "and", "if", "this", "is", "inside", "the", "detectors", "fiducial", "volume", "." ]
[ "\"\"\"\n Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.\n IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z.\n This is analogoues to the neutrinos whose interaction vertex is save...
[ { "param": "truth", "type": null }, { "param": "borders", "type": null }, { "param": "horizontal_pad", "type": null }, { "param": "vertical_pad", "type": null } ]
{ "returns": [ { "docstring": "dictionary (dict) : containing the x,y,z co-ordinates of final muon position and contained boolean (0 or 1)", "docstring_tokens": [ "dictionary", "(", "dict", ")", ":", "containing", "the", "x", "y",...
a16a8546c30fc22f2c06edff19769d5c5095d634
BozianuLeon/graphnet
src/graphnet/components/pool.py
[ "Apache-2.0" ]
Python
sum_pool_and_distribute
Tensor
def sum_pool_and_distribute( tensor: Tensor, cluster_index: LongTensor, batch: Optional[LongTensor] = None, ) -> Tensor: """Sum-pool values across the cluster, and distribute the individual nodes.""" if batch is None: batch = torch.zeros(tensor.size(dim=0)).long() tensor_pooled, _ = sum_...
Sum-pool values across the cluster, and distribute the individual nodes.
Sum-pool values across the cluster, and distribute the individual nodes.
[ "Sum", "-", "pool", "values", "across", "the", "cluster", "and", "distribute", "the", "individual", "nodes", "." ]
def sum_pool_and_distribute( tensor: Tensor, cluster_index: LongTensor, batch: Optional[LongTensor] = None, ) -> Tensor: if batch is None: batch = torch.zeros(tensor.size(dim=0)).long() tensor_pooled, _ = sum_pool_x(cluster_index, tensor, batch) inv, _ = consecutive_cluster(cluster_index...
[ "def", "sum_pool_and_distribute", "(", "tensor", ":", "Tensor", ",", "cluster_index", ":", "LongTensor", ",", "batch", ":", "Optional", "[", "LongTensor", "]", "=", "None", ",", ")", "->", "Tensor", ":", "if", "batch", "is", "None", ":", "batch", "=", "t...
Sum-pool values across the cluster, and distribute the individual nodes.
[ "Sum", "-", "pool", "values", "across", "the", "cluster", "and", "distribute", "the", "individual", "nodes", "." ]
[ "\"\"\"Sum-pool values across the cluster, and distribute the individual nodes.\"\"\"" ]
[ { "param": "tensor", "type": "Tensor" }, { "param": "cluster_index", "type": "LongTensor" }, { "param": "batch", "type": "Optional[LongTensor]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tensor", "type": "Tensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cluster_index", "type": "LongTensor", "docstring": null, ...
a16a8546c30fc22f2c06edff19769d5c5095d634
BozianuLeon/graphnet
src/graphnet/components/pool.py
[ "Apache-2.0" ]
Python
_group_identical
LongTensor
def _group_identical( tensor: Tensor, batch: Optional[LongTensor] = None ) -> LongTensor: """Group rows in `tensor` that are identical Args: tensor (Tensor): Tensor of shape [N, F] batch (Optional[LongTensor], optional): Batch indices, to only group identical rows within batches...
Group rows in `tensor` that are identical Args: tensor (Tensor): Tensor of shape [N, F] batch (Optional[LongTensor], optional): Batch indices, to only group identical rows within batches. Defaults to None. Returns: Tensor: List of group indices, from 0 to num. groups - 1, a...
Group rows in `tensor` that are identical
[ "Group", "rows", "in", "`", "tensor", "`", "that", "are", "identical" ]
def _group_identical( tensor: Tensor, batch: Optional[LongTensor] = None ) -> LongTensor: if batch is not None: tensor = tensor.cat((tensor, batch.unsqueeze(dim=1)), dim=1) return torch.unique(tensor, return_inverse=True, dim=0)[1]
[ "def", "_group_identical", "(", "tensor", ":", "Tensor", ",", "batch", ":", "Optional", "[", "LongTensor", "]", "=", "None", ")", "->", "LongTensor", ":", "if", "batch", "is", "not", "None", ":", "tensor", "=", "tensor", ".", "cat", "(", "(", "tensor",...
Group rows in `tensor` that are identical
[ "Group", "rows", "in", "`", "tensor", "`", "that", "are", "identical" ]
[ "\"\"\"Group rows in `tensor` that are identical\n\n Args:\n tensor (Tensor): Tensor of shape [N, F]\n batch (Optional[LongTensor], optional): Batch indices, to only group\n identical rows within batches. Defaults to None.\n\n Returns:\n Tensor: List of group indices, from 0 to...
[ { "param": "tensor", "type": "Tensor" }, { "param": "batch", "type": "Optional[LongTensor]" } ]
{ "returns": [ { "docstring": "List of group indices, from 0 to num. groups - 1, assigning all\nidentical rows to the same group.", "docstring_tokens": [ "List", "of", "group", "indices", "from", "0", "to", "num", ".", "gr...
a16a8546c30fc22f2c06edff19769d5c5095d634
BozianuLeon/graphnet
src/graphnet/components/pool.py
[ "Apache-2.0" ]
Python
group_by
LongTensor
def group_by(data: Data, keys: List[str]) -> LongTensor: """Group nodes in `data` that have identical values of `keys`. This grouping is done with in each event in case of batching. This allows for, e.g., assigning the same index to all pulses on the same PMT or DOM in the same event. This can be used ...
Group nodes in `data` that have identical values of `keys`. This grouping is done with in each event in case of batching. This allows for, e.g., assigning the same index to all pulses on the same PMT or DOM in the same event. This can be used for coarsening graphs, e.g., from pulse- level to DOM-level ...
Group nodes in `data` that have identical values of `keys`. This grouping is done with in each event in case of batching. This allows for, e.g., assigning the same index to all pulses on the same PMT or DOM in the same event. This can be used for coarsening graphs, e.g., from pulse level to DOM-level by aggregating fea...
[ "Group", "nodes", "in", "`", "data", "`", "that", "have", "identical", "values", "of", "`", "keys", "`", ".", "This", "grouping", "is", "done", "with", "in", "each", "event", "in", "case", "of", "batching", ".", "This", "allows", "for", "e", ".", "g"...
def group_by(data: Data, keys: List[str]) -> LongTensor: features = [getattr(data, key) for key in keys] tensor = torch.stack(features).T batch = getattr(tensor, "batch", None) index = _group_identical(tensor, batch) return index
[ "def", "group_by", "(", "data", ":", "Data", ",", "keys", ":", "List", "[", "str", "]", ")", "->", "LongTensor", ":", "features", "=", "[", "getattr", "(", "data", ",", "key", ")", "for", "key", "in", "keys", "]", "tensor", "=", "torch", ".", "st...
Group nodes in `data` that have identical values of `keys`.
[ "Group", "nodes", "in", "`", "data", "`", "that", "have", "identical", "values", "of", "`", "keys", "`", "." ]
[ "\"\"\"Group nodes in `data` that have identical values of `keys`.\n\n This grouping is done with in each event in case of batching. This allows\n for, e.g., assigning the same index to all pulses on the same PMT or DOM in\n the same event. This can be used for coarsening graphs, e.g., from pulse-\n lev...
[ { "param": "data", "type": "Data" }, { "param": "keys", "type": "List[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "Data", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "keys", "type": "List[str]", "docstring": null, "docstring_t...
a16a8546c30fc22f2c06edff19769d5c5095d634
BozianuLeon/graphnet
src/graphnet/components/pool.py
[ "Apache-2.0" ]
Python
sum_pool
<not_specific>
def sum_pool(cluster, data, transform=None): r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *sum* o...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *sum* of features of all nodes within the same clust...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *sum* of features of all nodes within the same cluster, node positions a...
[ "r", "\"", "\"", "\"", "Pools", "and", "coarsens", "a", "graph", "given", "by", "the", ":", "class", ":", "`", "torch_geometric", ".", "data", ".", "Data", "`", "object", "according", "to", "the", "clustering", "defined", "in", ":", "attr", ":", "`", ...
def sum_pool(cluster, data, transform=None): cluster, perm = consecutive_cluster(cluster) x = None if data.x is None else _sum_pool_x(cluster, data.x) index, attr = pool_edge(cluster, data.edge_index, data.edge_attr) batch = None if data.batch is None else pool_batch(perm, data.batch) pos = None if ...
[ "def", "sum_pool", "(", "cluster", ",", "data", ",", "transform", "=", "None", ")", ":", "cluster", ",", "perm", "=", "consecutive_cluster", "(", "cluster", ")", "x", "=", "None", "if", "data", ".", "x", "is", "None", "else", "_sum_pool_x", "(", "clust...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`.
[ "r", "\"", "\"", "\"", "Pools", "and", "coarsens", "a", "graph", "given", "by", "the", ":", "class", ":", "`", "torch_geometric", ".", "data", ".", "Data", "`", "object", "according", "to", "the", "clustering", "defined", "in", ":", "attr", ":", "`", ...
[ "r\"\"\"Pools and coarsens a graph given by the\n :class:`torch_geometric.data.Data` object according to the clustering\n defined in :attr:`cluster`.\n All nodes within the same cluster will be represented as one node.\n Final node features are defined by the *sum* of features of all nodes\n within t...
[ { "param": "cluster", "type": null }, { "param": "data", "type": null }, { "param": "transform", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster", "type": null, "docstring": "Cluster vector :math:`\\mathbf{c} \\in \\{ 0,\n\\ldots, N - 1 \\}^N`, which assigns each node to a specific cluster.", "docstring_tokens": [ "Cluster", "vector", ":...
a16a8546c30fc22f2c06edff19769d5c5095d634
BozianuLeon/graphnet
src/graphnet/components/pool.py
[ "Apache-2.0" ]
Python
std_pool
<not_specific>
def std_pool(cluster, data, transform=None): r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *std* o...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *std* of features of all nodes within the same clust...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`. All nodes within the same cluster will be represented as one node. Final node features are defined by the *std* of features of all nodes within the same cluster, node positions a...
[ "r", "\"", "\"", "\"", "Pools", "and", "coarsens", "a", "graph", "given", "by", "the", ":", "class", ":", "`", "torch_geometric", ".", "data", ".", "Data", "`", "object", "according", "to", "the", "clustering", "defined", "in", ":", "attr", ":", "`", ...
def std_pool(cluster, data, transform=None): cluster, perm = consecutive_cluster(cluster) x = None if data.x is None else _std_pool_x(cluster, data.x) index, attr = pool_edge(cluster, data.edge_index, data.edge_attr) batch = None if data.batch is None else pool_batch(perm, data.batch) pos = None if ...
[ "def", "std_pool", "(", "cluster", ",", "data", ",", "transform", "=", "None", ")", ":", "cluster", ",", "perm", "=", "consecutive_cluster", "(", "cluster", ")", "x", "=", "None", "if", "data", ".", "x", "is", "None", "else", "_std_pool_x", "(", "clust...
r"""Pools and coarsens a graph given by the :class:`torch_geometric.data.Data` object according to the clustering defined in :attr:`cluster`.
[ "r", "\"", "\"", "\"", "Pools", "and", "coarsens", "a", "graph", "given", "by", "the", ":", "class", ":", "`", "torch_geometric", ".", "data", ".", "Data", "`", "object", "according", "to", "the", "clustering", "defined", "in", ":", "attr", ":", "`", ...
[ "r\"\"\"Pools and coarsens a graph given by the\n :class:`torch_geometric.data.Data` object according to the clustering\n defined in :attr:`cluster`.\n All nodes within the same cluster will be represented as one node.\n Final node features are defined by the *std* of features of all nodes\n within t...
[ { "param": "cluster", "type": null }, { "param": "data", "type": null }, { "param": "transform", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cluster", "type": null, "docstring": "Cluster vector :math:`\\mathbf{c} \\in \\{ 0,\n\\ldots, N - 1 \\}^N`, which assigns each node to a specific cluster.", "docstring_tokens": [ "Cluster", "vector", ":...
5980dee5fda952de5079f94ab087ebef4d2059c6
BozianuLeon/graphnet
src/graphnet/utilities/imports.py
[ "Apache-2.0" ]
Python
requires_icecube
<not_specific>
def requires_icecube(test_function): """Decorator for only exposing function if `icecube` module is present.""" def wrapper(*args, **kwargs): if has_icecube_package(): return test_function(*args, **kwargs) else: logger.info( f"Function `{test_function.__n...
Decorator for only exposing function if `icecube` module is present.
Decorator for only exposing function if `icecube` module is present.
[ "Decorator", "for", "only", "exposing", "function", "if", "`", "icecube", "`", "module", "is", "present", "." ]
def requires_icecube(test_function): def wrapper(*args, **kwargs): if has_icecube_package(): return test_function(*args, **kwargs) else: logger.info( f"Function `{test_function.__name__}` not used since `icecube` isn't available." ) ret...
[ "def", "requires_icecube", "(", "test_function", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "if", "has_icecube_package", "(", ")", ":", "return", "test_function", "(", "*", "args", ",", "**", "kwargs", ")", "else", ":", ...
Decorator for only exposing function if `icecube` module is present.
[ "Decorator", "for", "only", "exposing", "function", "if", "`", "icecube", "`", "module", "is", "present", "." ]
[ "\"\"\"Decorator for only exposing function if `icecube` module is present.\"\"\"" ]
[ { "param": "test_function", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "test_function", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71a00d6533f8202e1f3b01bfd85c232391d42fd2
mosaicrown/freya-fs
mixslice.py
[ "Apache-2.0" ]
Python
encrypt
null
def encrypt(data, path, key, iv, threads=None, padder=None): """Creates a MixSlice from plaintext data. Args: data (bytestr): The data to encrypt (multiple of MACRO_SIZE). key (bytestr): The key used for AES encryption (16 bytes long). iv (bytestr): The iv used for A...
Creates a MixSlice from plaintext data. Args: data (bytestr): The data to encrypt (multiple of MACRO_SIZE). key (bytestr): The key used for AES encryption (16 bytes long). iv (bytestr): The iv used for AES encryption (16 bytes long). threads (int): The number of ...
Creates a MixSlice from plaintext data.
[ "Creates", "a", "MixSlice", "from", "plaintext", "data", "." ]
def encrypt(data, path, key, iv, threads=None, padder=None): padder = padder or _Padder(blocksize=MixSlice.MACRO_SIZE) padded_data = padder.pad(data) fragments = _mix_and_slice(data=padded_data, key=key, iv=iv, threads=threads) fragments = [_BytesIO(f) ...
[ "def", "encrypt", "(", "data", ",", "path", ",", "key", ",", "iv", ",", "threads", "=", "None", ",", "padder", "=", "None", ")", ":", "padder", "=", "padder", "or", "_Padder", "(", "blocksize", "=", "MixSlice", ".", "MACRO_SIZE", ")", "padded_data", ...
Creates a MixSlice from plaintext data.
[ "Creates", "a", "MixSlice", "from", "plaintext", "data", "." ]
[ "\"\"\"Creates a MixSlice from plaintext data.\n\n Args:\n data (bytestr): The data to encrypt (multiple of MACRO_SIZE).\n key (bytestr): The key used for AES encryption (16 bytes long).\n iv (bytestr): The iv used for AES encryption (16 bytes long).\n threads (int...
[ { "param": "data", "type": null }, { "param": "path", "type": null }, { "param": "key", "type": null }, { "param": "iv", "type": null }, { "param": "threads", "type": null }, { "param": "padder", "type": null } ]
{ "returns": [ { "docstring": "A new MixSlice that holds the encrypted fragments.", "docstring_tokens": [ "A", "new", "MixSlice", "that", "holds", "the", "encrypted", "fragments", "." ], "type": null } ], "rais...
9a10c9b55327ba51836cef874e8ba9fb270e4770
fir3storm/Dagon
thirdparty/blake/blake_wrapper.py
[ "MIT" ]
Python
addsalt
null
def addsalt(self, salt): """ adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if hashbitlen=224 or 256, then salt will be 16 bytes if hashbitlen=384 or 512, then sa...
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if hashbitlen=224 or 256, then salt will be 16 bytes if hashbitlen=384 or 512, then salt will be 32 bytes
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if hashbitlen=224 or 256, then salt will be 16 bytes if hashbitlen=384 or 512, then salt will be 32 bytes
[ "adds", "a", "salt", "to", "the", "hash", "function", "(", "OPTIONAL", ")", "should", "be", "called", "AFTER", "Init", "and", "BEFORE", "update", "salt", ":", "a", "bytestring", "length", "determined", "by", "hashbitlen", ".", "if", "hashbitlen", "=", "224...
def addsalt(self, salt): if self.init != 1: raise Exception('addsalt() not called after init() and before update()') saltsize = 16 if self.hashbitlen in [224, 256] else 32 if len(salt) != saltsize: raise Exception('incorrect salt length') ret = LIB.AddSalt(self.st...
[ "def", "addsalt", "(", "self", ",", "salt", ")", ":", "if", "self", ".", "init", "!=", "1", ":", "raise", "Exception", "(", "'addsalt() not called after init() and before update()'", ")", "saltsize", "=", "16", "if", "self", ".", "hashbitlen", "in", "[", "22...
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen.
[ "adds", "a", "salt", "to", "the", "hash", "function", "(", "OPTIONAL", ")", "should", "be", "called", "AFTER", "Init", "and", "BEFORE", "update", "salt", ":", "a", "bytestring", "length", "determined", "by", "hashbitlen", "." ]
[ "\"\"\" adds a salt to the hash function (OPTIONAL)\n should be called AFTER Init, and BEFORE update\n salt: a bytestring, length determined by hashbitlen.\n if hashbitlen=224 or 256, then salt will be 16 bytes\n if hashbitlen=384 or 512, then salt will be 32 bytes\n...
[ { "param": "self", "type": null }, { "param": "salt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens": [...
9a10c9b55327ba51836cef874e8ba9fb270e4770
fir3storm/Dagon
thirdparty/blake/blake_wrapper.py
[ "MIT" ]
Python
update
<not_specific>
def update(self, data): """ update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (b...
update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (bytestring)
update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (bytestring)
[ "update", "the", "state", "with", "new", "data", "storing", "excess", "data", "as", "necessary", ".", "may", "be", "called", "multiple", "times", "and", "if", "a", "call", "sends", "less", "than", "a", "full", "block", "in", "size", "the", "leftover", "i...
def update(self, data): self.init = 2 datalen = len(data ) *8 if not datalen: return ret = LIB.Update(self.state, data, datalen) if ret: raise Exception('Update() ret = %d', ret)
[ "def", "update", "(", "self", ",", "data", ")", ":", "self", ".", "init", "=", "2", "datalen", "=", "len", "(", "data", ")", "*", "8", "if", "not", "datalen", ":", "return", "ret", "=", "LIB", ".", "Update", "(", "self", ".", "state", ",", "dat...
update the state with new data, storing excess data as necessary.
[ "update", "the", "state", "with", "new", "data", "storing", "excess", "data", "as", "necessary", "." ]
[ "\"\"\" update the state with new data, storing excess data\n as necessary. may be called multiple times and if a\n call sends less than a full block in size, the leftover\n is cached and will be consumed in the next call\n data: data to be hashed (bytestring)\n ...
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
9a10c9b55327ba51836cef874e8ba9fb270e4770
fir3storm/Dagon
thirdparty/blake/blake_wrapper.py
[ "MIT" ]
Python
final
<not_specific>
def final(self, data=b''): """ finalize the hash -- pad and hash remaining data returns hashval, the digest """ if data: self.update(data) hashval = c_buffer(int(self. hashbitlen /8)) ret = LIB.Final(self.state, hashval) if ret: raise ...
finalize the hash -- pad and hash remaining data returns hashval, the digest
finalize the hash -- pad and hash remaining data returns hashval, the digest
[ "finalize", "the", "hash", "--", "pad", "and", "hash", "remaining", "data", "returns", "hashval", "the", "digest" ]
def final(self, data=b''): if data: self.update(data) hashval = c_buffer(int(self. hashbitlen /8)) ret = LIB.Final(self.state, hashval) if ret: raise Exception('Final() ret = %d', ret) return hashval.raw
[ "def", "final", "(", "self", ",", "data", "=", "b''", ")", ":", "if", "data", ":", "self", ".", "update", "(", "data", ")", "hashval", "=", "c_buffer", "(", "int", "(", "self", ".", "hashbitlen", "/", "8", ")", ")", "ret", "=", "LIB", ".", "Fin...
finalize the hash -- pad and hash remaining data returns hashval, the digest
[ "finalize", "the", "hash", "--", "pad", "and", "hash", "remaining", "data", "returns", "hashval", "the", "digest" ]
[ "\"\"\" finalize the hash -- pad and hash remaining data\n returns hashval, the digest\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
9a10c9b55327ba51836cef874e8ba9fb270e4770
fir3storm/Dagon
thirdparty/blake/blake_wrapper.py
[ "MIT" ]
Python
BLAKE_func
<not_specific>
def BLAKE_func(hashbitlen, data, databitlen): """ all-in-one function hashbitlen must be one of 224, 256, 384, 512 data data to be hashed (bytestring) databitlen length of data to be hashed in *bits* returns digest value (bytestring) """ return BLAKE(hashbitlen)....
all-in-one function hashbitlen must be one of 224, 256, 384, 512 data data to be hashed (bytestring) databitlen length of data to be hashed in *bits* returns digest value (bytestring)
all-in-one function hashbitlen must be one of 224, 256, 384, 512 data data to be hashed (bytestring) databitlen length of data to be hashed in *bits returns digest value (bytestring)
[ "all", "-", "in", "-", "one", "function", "hashbitlen", "must", "be", "one", "of", "224", "256", "384", "512", "data", "data", "to", "be", "hashed", "(", "bytestring", ")", "databitlen", "length", "of", "data", "to", "be", "hashed", "in", "*", "bits", ...
def BLAKE_func(hashbitlen, data, databitlen): return BLAKE(hashbitlen).final(data)
[ "def", "BLAKE_func", "(", "hashbitlen", ",", "data", ",", "databitlen", ")", ":", "return", "BLAKE", "(", "hashbitlen", ")", ".", "final", "(", "data", ")" ]
all-in-one function hashbitlen must be one of 224, 256, 384, 512 data data to be hashed (bytestring) databitlen length of data to be hashed in *bits returns digest value (bytestring)
[ "all", "-", "in", "-", "one", "function", "hashbitlen", "must", "be", "one", "of", "224", "256", "384", "512", "data", "data", "to", "be", "hashed", "(", "bytestring", ")", "databitlen", "length", "of", "data", "to", "be", "hashed", "in", "*", "bits", ...
[ "\"\"\" all-in-one function\n hashbitlen must be one of 224, 256, 384, 512\n data data to be hashed (bytestring)\n databitlen length of data to be hashed in *bits*\n returns digest value (bytestring)\n \"\"\"" ]
[ { "param": "hashbitlen", "type": null }, { "param": "data", "type": null }, { "param": "databitlen", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hashbitlen", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_toke...
00075e486092ce9ed384f993921fe787a4c6d311
fir3storm/Dagon
bin/attacks/bruteforce/bf_attack.py
[ "MIT" ]
Python
bruteforce_main
null
def bruteforce_main(verf_hash, algorithm=None, wordlist=None, salt=None, placement=None, all_algs=False, posx="", use_hex=False, verbose=False, batch=False, rounds=10): """ Main function to be used for bruteforcing a hash """ wordlist_created = False if wordlist is None: ...
Main function to be used for bruteforcing a hash
Main function to be used for bruteforcing a hash
[ "Main", "function", "to", "be", "used", "for", "bruteforcing", "a", "hash" ]
def bruteforce_main(verf_hash, algorithm=None, wordlist=None, salt=None, placement=None, all_algs=False, posx="", use_hex=False, verbose=False, batch=False, rounds=10): wordlist_created = False if wordlist is None: create_dir("bf-dicts", verbose=verbose) for item in os.listdi...
[ "def", "bruteforce_main", "(", "verf_hash", ",", "algorithm", "=", "None", ",", "wordlist", "=", "None", ",", "salt", "=", "None", ",", "placement", "=", "None", ",", "all_algs", "=", "False", ",", "posx", "=", "\"\"", ",", "use_hex", "=", "False", ","...
Main function to be used for bruteforcing a hash
[ "Main", "function", "to", "be", "used", "for", "bruteforcing", "a", "hash" ]
[ "\"\"\"\n Main function to be used for bruteforcing a hash\n \"\"\"" ]
[ { "param": "verf_hash", "type": null }, { "param": "algorithm", "type": null }, { "param": "wordlist", "type": null }, { "param": "salt", "type": null }, { "param": "placement", "type": null }, { "param": "all_algs", "type": null }, { "para...
{ "returns": [], "raises": [], "params": [ { "identifier": "verf_hash", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "algorithm", "type": null, "docstring": null, "docstring_...
2ac02f7405766168b23b070ef427cc733875bfb8
fir3storm/Dagon
thirdparty/blake/blake.py
[ "MIT" ]
Python
addsalt
null
def addsalt(self, salt): """ adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if not of sufficient length, the bytestring will be assumed to be a big endi...
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if not of sufficient length, the bytestring will be assumed to be a big endian number and pre...
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen. if not of sufficient length, the bytestring will be assumed to be a big endian number and prefixed with an appropriate number of null bytes, and if too large, only the low ord...
[ "adds", "a", "salt", "to", "the", "hash", "function", "(", "OPTIONAL", ")", "should", "be", "called", "AFTER", "Init", "and", "BEFORE", "update", "salt", ":", "a", "bytestring", "length", "determined", "by", "hashbitlen", ".", "if", "not", "of", "sufficien...
def addsalt(self, salt): if self.state != 1: raise Exception('addsalt() not called after init() and before update()') saltsize = self.WORDBYTES * 4 if len(salt) < saltsize: salt = (chr(0) * (saltsize - len(salt)) + salt) else: salt = salt[-saltsize:] ...
[ "def", "addsalt", "(", "self", ",", "salt", ")", ":", "if", "self", ".", "state", "!=", "1", ":", "raise", "Exception", "(", "'addsalt() not called after init() and before update()'", ")", "saltsize", "=", "self", ".", "WORDBYTES", "*", "4", "if", "len", "("...
adds a salt to the hash function (OPTIONAL) should be called AFTER Init, and BEFORE update salt: a bytestring, length determined by hashbitlen.
[ "adds", "a", "salt", "to", "the", "hash", "function", "(", "OPTIONAL", ")", "should", "be", "called", "AFTER", "Init", "and", "BEFORE", "update", "salt", ":", "a", "bytestring", "length", "determined", "by", "hashbitlen", "." ]
[ "\"\"\" adds a salt to the hash function (OPTIONAL)\n should be called AFTER Init, and BEFORE update\n salt: a bytestring, length determined by hashbitlen.\n if not of sufficient length, the bytestring\n will be assumed to be a big endian number and\n ...
[ { "param": "self", "type": null }, { "param": "salt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens": [...
2ac02f7405766168b23b070ef427cc733875bfb8
fir3storm/Dagon
thirdparty/blake/blake.py
[ "MIT" ]
Python
update
<not_specific>
def update(self, data): """ update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (b...
update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (bytestring)
update the state with new data, storing excess data as necessary. may be called multiple times and if a call sends less than a full block in size, the leftover is cached and will be consumed in the next call data: data to be hashed (bytestring)
[ "update", "the", "state", "with", "new", "data", "storing", "excess", "data", "as", "necessary", ".", "may", "be", "called", "multiple", "times", "and", "if", "a", "call", "sends", "less", "than", "a", "full", "block", "in", "size", "the", "leftover", "i...
def update(self, data): self.state = 2 BLKBYTES = self.BLKBYTES BLKBITS = self.BLKBITS datalen = len(data) if not datalen: return if type(data) == type(u''): data = data.encode('UTF-8') left = len(self.cache) fill = BLKBYTES - left ...
[ "def", "update", "(", "self", ",", "data", ")", ":", "self", ".", "state", "=", "2", "BLKBYTES", "=", "self", ".", "BLKBYTES", "BLKBITS", "=", "self", ".", "BLKBITS", "datalen", "=", "len", "(", "data", ")", "if", "not", "datalen", ":", "return", "...
update the state with new data, storing excess data as necessary.
[ "update", "the", "state", "with", "new", "data", "storing", "excess", "data", "as", "necessary", "." ]
[ "\"\"\" update the state with new data, storing excess data\n as necessary. may be called multiple times and if a\n call sends less than a full block in size, the leftover\n is cached and will be consumed in the next call\n data: data to be hashed (bytestring)\n ...
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
2ac02f7405766168b23b070ef427cc733875bfb8
fir3storm/Dagon
thirdparty/blake/blake.py
[ "MIT" ]
Python
final
<not_specific>
def final(self, data=''): """ finalize the hash -- pad and hash remaining data returns hashval, the digest """ if self.state == 3: # we have already finalized so simply return the # previously calculated/stored hash value return self.hash ...
finalize the hash -- pad and hash remaining data returns hashval, the digest
finalize the hash -- pad and hash remaining data returns hashval, the digest
[ "finalize", "the", "hash", "--", "pad", "and", "hash", "remaining", "data", "returns", "hashval", "the", "digest" ]
def final(self, data=''): if self.state == 3: return self.hash if data: self.update(data) ZZ = b'\x00' ZO = b'\x01' OZ = b'\x80' OO = b'\x81' PADDING = OZ + ZZ * 128 tt = self.t + (len(self.cache) << 3) if self.BLKBYTES ==...
[ "def", "final", "(", "self", ",", "data", "=", "''", ")", ":", "if", "self", ".", "state", "==", "3", ":", "return", "self", ".", "hash", "if", "data", ":", "self", ".", "update", "(", "data", ")", "ZZ", "=", "b'\\x00'", "ZO", "=", "b'\\x01'", ...
finalize the hash -- pad and hash remaining data returns hashval, the digest
[ "finalize", "the", "hash", "--", "pad", "and", "hash", "remaining", "data", "returns", "hashval", "the", "digest" ]
[ "\"\"\" finalize the hash -- pad and hash remaining data\n returns hashval, the digest\n \"\"\"", "# we have already finalized so simply return the", "# previously calculated/stored hash value", "# pre-formatted padding data", "# copy nb. bits hash in total as a 64-bit BE word", "# copy ...
[ { "param": "self", "type": null }, { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [...
2ac02f7405766168b23b070ef427cc733875bfb8
fir3storm/Dagon
thirdparty/blake/blake.py
[ "MIT" ]
Python
_int2fourByte
<not_specific>
def _int2fourByte(self, x): # see also long2byt() below """ convert a number to a 4-byte string, high order truncation possible (in Python x could be a BIGNUM) """ return struct.pack('!L', x)
convert a number to a 4-byte string, high order truncation possible (in Python x could be a BIGNUM)
convert a number to a 4-byte string, high order truncation possible (in Python x could be a BIGNUM)
[ "convert", "a", "number", "to", "a", "4", "-", "byte", "string", "high", "order", "truncation", "possible", "(", "in", "Python", "x", "could", "be", "a", "BIGNUM", ")" ]
def _int2fourByte(self, x): return struct.pack('!L', x)
[ "def", "_int2fourByte", "(", "self", ",", "x", ")", ":", "return", "struct", ".", "pack", "(", "'!L'", ",", "x", ")" ]
convert a number to a 4-byte string, high order truncation possible (in Python x could be a BIGNUM)
[ "convert", "a", "number", "to", "a", "4", "-", "byte", "string", "high", "order", "truncation", "possible", "(", "in", "Python", "x", "could", "be", "a", "BIGNUM", ")" ]
[ "# see also long2byt() below", "\"\"\" convert a number to a 4-byte string, high order\n truncation possible (in Python x could be a BIGNUM)\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], ...
2778bcd051477f2564b5c398a0a39cb418cbb99e
fir3storm/Dagon
bin/generators/__init__.py
[ "MIT" ]
Python
hash_file_generator
<not_specific>
def hash_file_generator(self): """ Parse a given file for anything that matches the hashes in the hash type regex dict. Possible that this will pull random bytes of data from the files. """ matched_hashes = set() keys = [k for k in bin.verify_hashes.verify.H...
Parse a given file for anything that matches the hashes in the hash type regex dict. Possible that this will pull random bytes of data from the files.
Parse a given file for anything that matches the hashes in the hash type regex dict. Possible that this will pull random bytes of data from the files.
[ "Parse", "a", "given", "file", "for", "anything", "that", "matches", "the", "hashes", "in", "the", "hash", "type", "regex", "dict", ".", "Possible", "that", "this", "will", "pull", "random", "bytes", "of", "data", "from", "the", "files", "." ]
def hash_file_generator(self): matched_hashes = set() keys = [k for k in bin.verify_hashes.verify.HASH_TYPE_REGEX.iterkeys()] with open(self.words) as wordlist: for item in wordlist.readlines(): for s in item.split(" "): for k in keys: ...
[ "def", "hash_file_generator", "(", "self", ")", ":", "matched_hashes", "=", "set", "(", ")", "keys", "=", "[", "k", "for", "k", "in", "bin", ".", "verify_hashes", ".", "verify", ".", "HASH_TYPE_REGEX", ".", "iterkeys", "(", ")", "]", "with", "open", "(...
Parse a given file for anything that matches the hashes in the hash type regex dict.
[ "Parse", "a", "given", "file", "for", "anything", "that", "matches", "the", "hashes", "in", "the", "hash", "type", "regex", "dict", "." ]
[ "\"\"\"\n Parse a given file for anything that matches the hashes in the\n hash type regex dict. Possible that this will pull random bytes\n of data from the files.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
blowfish
<not_specific>
def blowfish(string, **placeholder): """ Create a blowfish hash using bcrypt > :param string: string to generate a Blowfish hash from > :return: Blowfish hash Example: >>> blowfish("test") $2b$12$fSX/dvlx3dJGkGYKSbBbLOTOhzqj8xQ2krOtu2QkHNeJiYTC0B/ji """ if type(stri...
Create a blowfish hash using bcrypt > :param string: string to generate a Blowfish hash from > :return: Blowfish hash Example: >>> blowfish("test") $2b$12$fSX/dvlx3dJGkGYKSbBbLOTOhzqj8xQ2krOtu2QkHNeJiYTC0B/ji
Create a blowfish hash using bcrypt > :param string: string to generate a Blowfish hash from > :return: Blowfish hash
[ "Create", "a", "blowfish", "hash", "using", "bcrypt", ">", ":", "param", "string", ":", "string", "to", "generate", "a", "Blowfish", "hash", "from", ">", ":", "return", ":", "Blowfish", "hash" ]
def blowfish(string, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) return bcrypt.hashpw(str(string), bcrypt.gensalt())
[ "def", "blowfish", "(", "string", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", "force_encoding", "(", "string", ")", "return", "bcrypt", ".", "hashpw", "(", "str...
Create a blowfish hash using bcrypt > :param string: string to generate a Blowfish hash from > :return: Blowfish hash
[ "Create", "a", "blowfish", "hash", "using", "bcrypt", ">", ":", "param", "string", ":", "string", "to", "generate", "a", "Blowfish", "hash", "from", ">", ":", "return", ":", "Blowfish", "hash" ]
[ "\"\"\"\n Create a blowfish hash using bcrypt\n\n > :param string: string to generate a Blowfish hash from\n > :return: Blowfish hash\n\n Example:\n >>> blowfish(\"test\")\n $2b$12$fSX/dvlx3dJGkGYKSbBbLOTOhzqj8xQ2krOtu2QkHNeJiYTC0B/ji\n \"\"\"" ]
[ { "param": "string", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": ">>> ...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
postgres
<not_specific>
def postgres(string, salt=None, **placeholder): """ Create a PostgreSQL hash, if no salt is provided, salt will be created > :param string: string to be hashed > :return: a PostgreSQL hash Example: >>> postrges("test", "testing") md55d6685f9c56cdd04d635c7cbed612db3 """ ...
Create a PostgreSQL hash, if no salt is provided, salt will be created > :param string: string to be hashed > :return: a PostgreSQL hash Example: >>> postrges("test", "testing") md55d6685f9c56cdd04d635c7cbed612db3
Create a PostgreSQL hash, if no salt is provided, salt will be created > :param string: string to be hashed > :return: a PostgreSQL hash
[ "Create", "a", "PostgreSQL", "hash", "if", "no", "salt", "is", "provided", "salt", "will", "be", "created", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "PostgreSQL", "hash" ]
def postgres(string, salt=None, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is None: salt = lib.settings.random_salt_generator(use_string=True)[0] obj = hashlib.md5() obj.update(string + salt) data = obj.hexdigest() return "md5...
[ "def", "postgres", "(", "string", ",", "salt", "=", "None", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", "force_encoding", "(", "string", ")", "if", "salt", "i...
Create a PostgreSQL hash, if no salt is provided, salt will be created > :param string: string to be hashed > :return: a PostgreSQL hash
[ "Create", "a", "PostgreSQL", "hash", "if", "no", "salt", "is", "provided", "salt", "will", "be", "created", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "PostgreSQL", "hash" ]
[ "\"\"\"\n Create a PostgreSQL hash, if no salt is provided, salt will be created\n\n > :param string: string to be hashed\n > :return: a PostgreSQL hash\n\n Example:\n >>> postrges(\"test\", \"testing\")\n md55d6685f9c56cdd04d635c7cbed612db3\n \"\"\"" ]
[ { "param": "string", "type": null }, { "param": "salt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
mssql_2000
<not_specific>
def mssql_2000(string, salt=None, **placeholder): """ Create a MsSQL 2000 hash from a given string, if no salt is given, random salt will be generated > :param string: the string to hash > :return: a MsSQL 2000 hash Example >>> mssql_2000("testpass", salt="testsalt") 0x0100...
Create a MsSQL 2000 hash from a given string, if no salt is given, random salt will be generated > :param string: the string to hash > :return: a MsSQL 2000 hash Example >>> mssql_2000("testpass", salt="testsalt") 0x01007465737473616C74C74B43A2862ECC89C7F94E02583583377F03977A1...
Create a MsSQL 2000 hash from a given string, if no salt is given, random salt will be generated > :param string: the string to hash > :return: a MsSQL 2000 hash
[ "Create", "a", "MsSQL", "2000", "hash", "from", "a", "given", "string", "if", "no", "salt", "is", "given", "random", "salt", "will", "be", "generated", ">", ":", "param", "string", ":", "the", "string", "to", "hash", ">", ":", "return", ":", "a", "Ms...
def mssql_2000(string, salt=None, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) obj1 = hashlib.sha1() obj2 = hashlib.sha1() if salt is None: salt = lib.settings.random_salt_generator(use_string=True)[0] crypt_salt = salt.encode("hex") da...
[ "def", "mssql_2000", "(", "string", ",", "salt", "=", "None", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", "force_encoding", "(", "string", ")", "obj1", "=", "...
Create a MsSQL 2000 hash from a given string, if no salt is given, random salt will be generated > :param string: the string to hash > :return: a MsSQL 2000 hash
[ "Create", "a", "MsSQL", "2000", "hash", "from", "a", "given", "string", "if", "no", "salt", "is", "given", "random", "salt", "will", "be", "generated", ">", ":", "param", "string", ":", "the", "string", "to", "hash", ">", ":", "return", ":", "a", "Ms...
[ "\"\"\"\n Create a MsSQL 2000 hash from a given string, if no salt is given, random salt will be generated\n\n > :param string: the string to hash\n > :return: a MsSQL 2000 hash\n\n Example\n >>> mssql_2000(\"testpass\", salt=\"testsalt\")\n 0x01007465737473616C74C74B43A2862ECC89C7...
[ { "param": "string", "type": null }, { "param": "salt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...
3fc45551ccbedd19219046b0736995d0d5f7661a
fir3storm/Dagon
lib/algorithms/hashing_algs.py
[ "MIT" ]
Python
mssql_2005
<not_specific>
def mssql_2005(string, salt=None, **placeholder): """ Create an MsSQL 2005 hash, if not salt is given, salt will be created > :param string: string to be hashed > :return: a MsSQL 2005 hash Example: >>> mssql_2005("test", salt="testing") 0x010074657374696e673f0414438c1b692d...
Create an MsSQL 2005 hash, if not salt is given, salt will be created > :param string: string to be hashed > :return: a MsSQL 2005 hash Example: >>> mssql_2005("test", salt="testing") 0x010074657374696e673f0414438c1b692da8be7a1211a76d314ea0210f
Create an MsSQL 2005 hash, if not salt is given, salt will be created > :param string: string to be hashed > :return: a MsSQL 2005 hash
[ "Create", "an", "MsSQL", "2005", "hash", "if", "not", "salt", "is", "given", "salt", "will", "be", "created", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "MsSQL", "2005", "hash" ]
def mssql_2005(string, salt=None, **placeholder): if type(string) is unicode: string = lib.settings.force_encoding(string) if salt is None: salt = lib.settings.random_salt_generator(use_string=True)[0] data_string = "".join(map(lambda s: ("%s\0" if ord(s) < 256 else "%s") % s.encode("utf8"),...
[ "def", "mssql_2005", "(", "string", ",", "salt", "=", "None", ",", "**", "placeholder", ")", ":", "if", "type", "(", "string", ")", "is", "unicode", ":", "string", "=", "lib", ".", "settings", ".", "force_encoding", "(", "string", ")", "if", "salt", ...
Create an MsSQL 2005 hash, if not salt is given, salt will be created > :param string: string to be hashed > :return: a MsSQL 2005 hash
[ "Create", "an", "MsSQL", "2005", "hash", "if", "not", "salt", "is", "given", "salt", "will", "be", "created", ">", ":", "param", "string", ":", "string", "to", "be", "hashed", ">", ":", "return", ":", "a", "MsSQL", "2005", "hash" ]
[ "\"\"\"\n Create an MsSQL 2005 hash, if not salt is given, salt will be created\n\n > :param string: string to be hashed\n > :return: a MsSQL 2005 hash\n\n Example:\n >>> mssql_2005(\"test\", salt=\"testing\")\n 0x010074657374696e673f0414438c1b692da8be7a1211a76d314ea0210f\n \"\"...
[ { "param": "string", "type": null }, { "param": "salt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "salt", "type": null, "docstring": null, "docstring_tokens":...