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
0f10c39ba20dd7d39f634713eacd4b65944ed3fe
shadim/eg-01-python-jwt
ds_helper.py
[ "MIT" ]
Python
create_private_key_temp_file
<not_specific>
def create_private_key_temp_file(cls, file_suffix): """ create temp file and write into private key string in :param file_suffix: :return: """ tmp_file = tempfile.NamedTemporaryFile(mode='w+b', suffix=file_suffix) f = open(tmp_file.name, "w+") f.write(DSC...
create temp file and write into private key string in :param file_suffix: :return:
create temp file and write into private key string in
[ "create", "temp", "file", "and", "write", "into", "private", "key", "string", "in" ]
def create_private_key_temp_file(cls, file_suffix): tmp_file = tempfile.NamedTemporaryFile(mode='w+b', suffix=file_suffix) f = open(tmp_file.name, "w+") f.write(DSConfig.private_key()) f.close() return tmp_file
[ "def", "create_private_key_temp_file", "(", "cls", ",", "file_suffix", ")", ":", "tmp_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'w+b'", ",", "suffix", "=", "file_suffix", ")", "f", "=", "open", "(", "tmp_file", ".", "name", ",", ...
create temp file and write into private key string in
[ "create", "temp", "file", "and", "write", "into", "private", "key", "string", "in" ]
[ "\"\"\"\n create temp file and write into private key string in\n\n :param file_suffix:\n :return:\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "file_suffix", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
413b03149e23f3816c70601c10640d44e8f81900
Kalpavrikshika/Exercism-tests
pangram/pangram.py
[ "Apache-2.0" ]
Python
is_pangram
<not_specific>
def is_pangram(sentence): """Check whether 'str' contains ALL of the chars in set'""" set = 'abcdefghijklmnopqrstuvwxyz' sentence = sentence.lower() for c in set: if c not in sentence: return False else: return True
Check whether 'str' contains ALL of the chars in set
Check whether 'str' contains ALL of the chars in set
[ "Check", "whether", "'", "str", "'", "contains", "ALL", "of", "the", "chars", "in", "set" ]
def is_pangram(sentence): set = 'abcdefghijklmnopqrstuvwxyz' sentence = sentence.lower() for c in set: if c not in sentence: return False else: return True
[ "def", "is_pangram", "(", "sentence", ")", ":", "set", "=", "'abcdefghijklmnopqrstuvwxyz'", "sentence", "=", "sentence", ".", "lower", "(", ")", "for", "c", "in", "set", ":", "if", "c", "not", "in", "sentence", ":", "return", "False", "else", ":", "retur...
Check whether 'str' contains ALL of the chars in set
[ "Check", "whether", "'", "str", "'", "contains", "ALL", "of", "the", "chars", "in", "set" ]
[ "\"\"\"Check whether 'str' contains ALL of the chars in set'\"\"\"" ]
[ { "param": "sentence", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sentence", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7be585f967a01d8768e3beeaf91539ddcee09162
Kalpavrikshika/Exercism-tests
isogram/isogram.py
[ "Apache-2.0" ]
Python
is_isogram
<not_specific>
def is_isogram(string): '''if the length of the string if the same as the unique elements in the string(set(string) is an isogram''' if type(string) != str: raise TypeError ('Argument not a string') elif string == "": return True elif (string, str) and len(string) != 0: s...
if the length of the string if the same as the unique elements in the string(set(string) is an isogram
if the length of the string if the same as the unique elements in the string(set(string) is an isogram
[ "if", "the", "length", "of", "the", "string", "if", "the", "same", "as", "the", "unique", "elements", "in", "the", "string", "(", "set", "(", "string", ")", "is", "an", "isogram" ]
def is_isogram(string): if type(string) != str: raise TypeError ('Argument not a string') elif string == "": return True elif (string, str) and len(string) != 0: string = string.lower() if "-" in string: string_new=string.replace('-', '') if len(string...
[ "def", "is_isogram", "(", "string", ")", ":", "if", "type", "(", "string", ")", "!=", "str", ":", "raise", "TypeError", "(", "'Argument not a string'", ")", "elif", "string", "==", "\"\"", ":", "return", "True", "elif", "(", "string", ",", "str", ")", ...
if the length of the string if the same as the unique elements in the string(set(string) is an isogram
[ "if", "the", "length", "of", "the", "string", "if", "the", "same", "as", "the", "unique", "elements", "in", "the", "string", "(", "set", "(", "string", ")", "is", "an", "isogram" ]
[ "'''if the length of the string if the same as the\n unique elements in the string(set(string)\n is an isogram'''" ]
[ { "param": "string", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
436c9b36fb9dfef047a910335943ac3ca05b37e8
mfkiwl/Bedrock
soc/picorv32/common/localBusAddressMap.py
[ "RSA-MD" ]
Python
gen_addrmap
<not_specific>
def gen_addrmap(regmap): """ Collect all addresses as keys to the addrmap dict. Values are the names. """ addrmap = dict() for key, item in regmap.items(): if "base_addr" in item: addr = item["base_addr"] aw = item["addr_width"] addri = int(str(addr), 0) ...
Collect all addresses as keys to the addrmap dict. Values are the names.
Collect all addresses as keys to the addrmap dict. Values are the names.
[ "Collect", "all", "addresses", "as", "keys", "to", "the", "addrmap", "dict", ".", "Values", "are", "the", "names", "." ]
def gen_addrmap(regmap): addrmap = dict() for key, item in regmap.items(): if "base_addr" in item: addr = item["base_addr"] aw = item["addr_width"] addri = int(str(addr), 0) if addri in addrmap: raise ValueError("Double assigned localbus ad...
[ "def", "gen_addrmap", "(", "regmap", ")", ":", "addrmap", "=", "dict", "(", ")", "for", "key", ",", "item", "in", "regmap", ".", "items", "(", ")", ":", "if", "\"base_addr\"", "in", "item", ":", "addr", "=", "item", "[", "\"base_addr\"", "]", "aw", ...
Collect all addresses as keys to the addrmap dict.
[ "Collect", "all", "addresses", "as", "keys", "to", "the", "addrmap", "dict", "." ]
[ "\"\"\"\n Collect all addresses as keys to the addrmap dict. Values are the names.\n \"\"\"", "# cutoff array generation if length > 32." ]
[ { "param": "regmap", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "regmap", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
436c9b36fb9dfef047a910335943ac3ca05b37e8
mfkiwl/Bedrock
soc/picorv32/common/localBusAddressMap.py
[ "RSA-MD" ]
Python
write_addrmap
null
def write_addrmap(addrmap, ifname, ofname): """ Iterate through all sorted keys of the addrmap dict and genereate #define strings """ hf = """// Automatically generated register map of the local bus // Source: {0} // Generated: {1} """.format(os.path.abspath(ifname), datetime.datetime.now().strftime...
Iterate through all sorted keys of the addrmap dict and genereate #define strings
Iterate through all sorted keys of the addrmap dict and genereate #define strings
[ "Iterate", "through", "all", "sorted", "keys", "of", "the", "addrmap", "dict", "and", "genereate", "#define", "strings" ]
def write_addrmap(addrmap, ifname, ofname): hf = """// Automatically generated register map of the local bus // Source: {0} // Generated: {1} """.format(os.path.abspath(ifname), datetime.datetime.now().strftime("%D, %T")) header = ofname.replace('.', '_').upper() hf += "#ifndef " + header + "\n" hf +...
[ "def", "write_addrmap", "(", "addrmap", ",", "ifname", ",", "ofname", ")", ":", "hf", "=", "\"\"\"// Automatically generated register map of the local bus\n// Source: {0}\n// Generated: {1}\n\n\"\"\"", ".", "format", "(", "os", ".", "path", ".", "abspath", "(", "ifname...
Iterate through all sorted keys of the addrmap dict and genereate #define strings
[ "Iterate", "through", "all", "sorted", "keys", "of", "the", "addrmap", "dict", "and", "genereate", "#define", "strings" ]
[ "\"\"\"\n Iterate through all sorted keys of the addrmap dict and genereate #define strings\n \"\"\"" ]
[ { "param": "addrmap", "type": null }, { "param": "ifname", "type": null }, { "param": "ofname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "addrmap", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ifname", "type": null, "docstring": null, "docstring_token...
8c3116ac5be9ebc79001ea75f02456dcc20c72f5
mfkiwl/Bedrock
badger/tests/packetgen.py
[ "RSA-MD" ]
Python
read_lb_pack
<not_specific>
def read_lb_pack(fname): ''' Kind of special purpose lines of hex-encoded bytes, doesn't matter how many bytes per line multiple bytes per line are interpreted as big-endian (network byte order) ''' d = b"" with open(fname, "r") as fd: for line in fd.read().split("\n"): if li...
Kind of special purpose lines of hex-encoded bytes, doesn't matter how many bytes per line multiple bytes per line are interpreted as big-endian (network byte order)
Kind of special purpose lines of hex-encoded bytes, doesn't matter how many bytes per line multiple bytes per line are interpreted as big-endian (network byte order)
[ "Kind", "of", "special", "purpose", "lines", "of", "hex", "-", "encoded", "bytes", "doesn", "'", "t", "matter", "how", "many", "bytes", "per", "line", "multiple", "bytes", "per", "line", "are", "interpreted", "as", "big", "-", "endian", "(", "network", "...
def read_lb_pack(fname): d = b"" with open(fname, "r") as fd: for line in fd.read().split("\n"): if line == "": continue ll = int(len(line)/2) xx = [int(line[ix*2:ix*2+2], 16) for ix in range(ll)] d += bytes(xx) return d
[ "def", "read_lb_pack", "(", "fname", ")", ":", "d", "=", "b\"\"", "with", "open", "(", "fname", ",", "\"r\"", ")", "as", "fd", ":", "for", "line", "in", "fd", ".", "read", "(", ")", ".", "split", "(", "\"\\n\"", ")", ":", "if", "line", "==", "\...
Kind of special purpose lines of hex-encoded bytes, doesn't matter how many bytes per line multiple bytes per line are interpreted as big-endian (network byte order)
[ "Kind", "of", "special", "purpose", "lines", "of", "hex", "-", "encoded", "bytes", "doesn", "'", "t", "matter", "how", "many", "bytes", "per", "line", "multiple", "bytes", "per", "line", "are", "interpreted", "as", "big", "-", "endian", "(", "network", "...
[ "''' Kind of special purpose\n lines of hex-encoded bytes, doesn't matter how many bytes per line\n multiple bytes per line are interpreted as big-endian (network byte order)\n '''" ]
[ { "param": "fname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fb32fa0996b264c255d762ef5b1610f6f92e9f8d
mfkiwl/Bedrock
build-tools/merge_json.py
[ "RSA-MD" ]
Python
merge_with_quit_on_collision
<not_specific>
def merge_with_quit_on_collision(*args): ''' The idea is not to write performant code, but correct code (Which I couldn't find) ''' args, = args final = {} for f in args: with open(f, 'r') as json_file: json_dict = json.load(json_file) if type(json_dict) is not di...
The idea is not to write performant code, but correct code (Which I couldn't find)
The idea is not to write performant code, but correct code (Which I couldn't find)
[ "The", "idea", "is", "not", "to", "write", "performant", "code", "but", "correct", "code", "(", "Which", "I", "couldn", "'", "t", "find", ")" ]
def merge_with_quit_on_collision(*args): args, = args final = {} for f in args: with open(f, 'r') as json_file: json_dict = json.load(json_file) if type(json_dict) is not dict: exit('file {} isnt a json dictionary'.format(f)) for k in json_dict: ...
[ "def", "merge_with_quit_on_collision", "(", "*", "args", ")", ":", "args", ",", "=", "args", "final", "=", "{", "}", "for", "f", "in", "args", ":", "with", "open", "(", "f", ",", "'r'", ")", "as", "json_file", ":", "json_dict", "=", "json", ".", "l...
The idea is not to write performant code, but correct code (Which I couldn't find)
[ "The", "idea", "is", "not", "to", "write", "performant", "code", "but", "correct", "code", "(", "Which", "I", "couldn", "'", "t", "find", ")" ]
[ "'''\n The idea is not to write performant code, but correct code (Which I couldn't find)\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
fb32fa0996b264c255d762ef5b1610f6f92e9f8d
mfkiwl/Bedrock
build-tools/merge_json.py
[ "RSA-MD" ]
Python
expand_arrays
null
def expand_arrays(json_dict, aw_threshold=2, verbose=False): ''' Expand register array to individual per-element registers for arrays of address width <= aw_threshold ''' names = [k for k in json_dict if 'addr_width' in json_dict[k] and 0 < json_dict[k]['addr_width'] <= aw_threshold] for name in nam...
Expand register array to individual per-element registers for arrays of address width <= aw_threshold
Expand register array to individual per-element registers for arrays of address width <= aw_threshold
[ "Expand", "register", "array", "to", "individual", "per", "-", "element", "registers", "for", "arrays", "of", "address", "width", "<", "=", "aw_threshold" ]
def expand_arrays(json_dict, aw_threshold=2, verbose=False): names = [k for k in json_dict if 'addr_width' in json_dict[k] and 0 < json_dict[k]['addr_width'] <= aw_threshold] for name in names: k_expansion = {} if verbose: print(name) print(json_dict[name]) for ix...
[ "def", "expand_arrays", "(", "json_dict", ",", "aw_threshold", "=", "2", ",", "verbose", "=", "False", ")", ":", "names", "=", "[", "k", "for", "k", "in", "json_dict", "if", "'addr_width'", "in", "json_dict", "[", "k", "]", "and", "0", "<", "json_dict"...
Expand register array to individual per-element registers for arrays of address width <= aw_threshold
[ "Expand", "register", "array", "to", "individual", "per", "-", "element", "registers", "for", "arrays", "of", "address", "width", "<", "=", "aw_threshold" ]
[ "''' Expand register array to individual per-element registers for arrays of\n address width <= aw_threshold\n '''" ]
[ { "param": "json_dict", "type": null }, { "param": "aw_threshold", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "json_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "aw_threshold", "type": null, "docstring": null, "docstri...
fb32fa0996b264c255d762ef5b1610f6f92e9f8d
mfkiwl/Bedrock
build-tools/merge_json.py
[ "RSA-MD" ]
Python
split_digaree
null
def split_digaree(json_dict, verbose=False): ''' Special-case to separate out quench-detection parameters from detuning ''' k_expansion = {} names = [k for k in json_dict if 'piezo_sf_consts' in k] for name in names: if json_dict[name]['addr_width'] != 3: print("split_digaree is ...
Special-case to separate out quench-detection parameters from detuning
Special-case to separate out quench-detection parameters from detuning
[ "Special", "-", "case", "to", "separate", "out", "quench", "-", "detection", "parameters", "from", "detuning" ]
def split_digaree(json_dict, verbose=False): k_expansion = {} names = [k for k in json_dict if 'piezo_sf_consts' in k] for name in names: if json_dict[name]['addr_width'] != 3: print("split_digaree is confused") continue element_name = name[:-15] + "quench_sf_consts" ...
[ "def", "split_digaree", "(", "json_dict", ",", "verbose", "=", "False", ")", ":", "k_expansion", "=", "{", "}", "names", "=", "[", "k", "for", "k", "in", "json_dict", "if", "'piezo_sf_consts'", "in", "k", "]", "for", "name", "in", "names", ":", "if", ...
Special-case to separate out quench-detection parameters from detuning
[ "Special", "-", "case", "to", "separate", "out", "quench", "-", "detection", "parameters", "from", "detuning" ]
[ "''' Special-case to separate out quench-detection parameters from detuning\n '''" ]
[ { "param": "json_dict", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "json_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "verbose", "type": null, "docstring": null, "docstring_to...
32f19c146830b56d814f73847b51703905f76821
mfkiwl/Bedrock
projects/oscope/software/ltc_setup_litex_client.py
[ "RSA-MD" ]
Python
autoIdelay
null
def autoIdelay(r, VAL=1): ''' testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01 ''' # approximately center the idelay first setIdelay(r, 16) # decrement until the channels break for i in range(32): val0 = r.regs.lvds_data_pee...
testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01
testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01
[ "testpattern", "must", "be", "0x01", "bitslips", "must", "have", "been", "carried", "out", "already", "such", "that", "data_peek", "reads", "0x01" ]
def autoIdelay(r, VAL=1): setIdelay(r, 16) for i in range(32): val0 = r.regs.lvds_data_peek0.read() val1 = r.regs.lvds_data_peek2.read() if val0 != VAL or val1 != VAL: break r.regs.lvds_idelay_dec.write(1) minValue = r.regs.lvds_idelay_value.read() for i in ra...
[ "def", "autoIdelay", "(", "r", ",", "VAL", "=", "1", ")", ":", "setIdelay", "(", "r", ",", "16", ")", "for", "i", "in", "range", "(", "32", ")", ":", "val0", "=", "r", ".", "regs", ".", "lvds_data_peek0", ".", "read", "(", ")", "val1", "=", "...
testpattern must be 0x01 bitslips must have been carried out already such that data_peek reads 0x01
[ "testpattern", "must", "be", "0x01", "bitslips", "must", "have", "been", "carried", "out", "already", "such", "that", "data_peek", "reads", "0x01" ]
[ "'''\n testpattern must be 0x01\n bitslips must have been carried out already such that\n data_peek reads 0x01\n '''", "# approximately center the idelay first", "# decrement until the channels break", "# step back up a little", "# increment until the channels break", "# set idelay to the swee...
[ { "param": "r", "type": null }, { "param": "VAL", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "r", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "VAL", "type": null, "docstring": null, "docstring_tokens": [], ...
32f19c146830b56d814f73847b51703905f76821
mfkiwl/Bedrock
projects/oscope/software/ltc_setup_litex_client.py
[ "RSA-MD" ]
Python
autoBitslip
<not_specific>
def autoBitslip(r): ''' resets IDELAY to the middle, fires bitslips until the frame signal reads 0xF0 ''' setIdelay(r, 16) for i in range(8): val = r.regs.lvds_frame_peek.read() print(bin(val)) if val == 0xF0: print("autoBitslip(): aligned after", i) ...
resets IDELAY to the middle, fires bitslips until the frame signal reads 0xF0
resets IDELAY to the middle, fires bitslips until the frame signal reads 0xF0
[ "resets", "IDELAY", "to", "the", "middle", "fires", "bitslips", "until", "the", "frame", "signal", "reads", "0xF0" ]
def autoBitslip(r): setIdelay(r, 16) for i in range(8): val = r.regs.lvds_frame_peek.read() print(bin(val)) if val == 0xF0: print("autoBitslip(): aligned after", i) return r.regs.lvds_bitslip_csr.write(1) raise RuntimeError("autoBitslip(): failed align...
[ "def", "autoBitslip", "(", "r", ")", ":", "setIdelay", "(", "r", ",", "16", ")", "for", "i", "in", "range", "(", "8", ")", ":", "val", "=", "r", ".", "regs", ".", "lvds_frame_peek", ".", "read", "(", ")", "print", "(", "bin", "(", "val", ")", ...
resets IDELAY to the middle, fires bitslips until the frame signal reads 0xF0
[ "resets", "IDELAY", "to", "the", "middle", "fires", "bitslips", "until", "the", "frame", "signal", "reads", "0xF0" ]
[ "'''\n resets IDELAY to the middle,\n fires bitslips until the frame signal reads 0xF0\n '''" ]
[ { "param": "r", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "r", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c5627988d6e07f669bdc12c196b8baf3e87c9e2d
mfkiwl/Bedrock
projects/oscope/common/merge_json.py
[ "RSA-MD" ]
Python
merge_with_quit_on_collision
<not_specific>
def merge_with_quit_on_collision(*args): ''' The idea is not to write performant code, but correct code (Which I couldn't find) ''' args, = args final = {} for f in args: with open(f, 'r') as json_file: json_dict = json.load(json_file) if type(json_dict) is not di...
The idea is not to write performant code, but correct code (Which I couldn't find)
The idea is not to write performant code, but correct code (Which I couldn't find)
[ "The", "idea", "is", "not", "to", "write", "performant", "code", "but", "correct", "code", "(", "Which", "I", "couldn", "'", "t", "find", ")" ]
def merge_with_quit_on_collision(*args): args, = args final = {} for f in args: with open(f, 'r') as json_file: json_dict = json.load(json_file) if type(json_dict) is not dict: exit('file {} isnt a json dictionary'.fmt(f)) for k in json_dict: ...
[ "def", "merge_with_quit_on_collision", "(", "*", "args", ")", ":", "args", ",", "=", "args", "final", "=", "{", "}", "for", "f", "in", "args", ":", "with", "open", "(", "f", ",", "'r'", ")", "as", "json_file", ":", "json_dict", "=", "json", ".", "l...
The idea is not to write performant code, but correct code (Which I couldn't find)
[ "The", "idea", "is", "not", "to", "write", "performant", "code", "but", "correct", "code", "(", "Which", "I", "couldn", "'", "t", "find", ")" ]
[ "'''\n The idea is not to write performant code, but correct code (Which I couldn't find)\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c9a200de1bb94c9627b4c9f124fd3aa915d0e2a2
mfkiwl/Bedrock
dsp/banyan_ch_find.py
[ "RSA-MD" ]
Python
banyan_ch_find
<not_specific>
def banyan_ch_find(mask): ''' mask: 0xa9 = 0b10101001 This means channels 7, 5, 3 and 0 are set This means lower is 0b1001 and upper is 0b1010 ''' mw = 8 state = list(map(lambda y: (y, mask >> y & 1), range(mw))) ch_count = sum(x[1] for x in state) # print("banyan_ch_find", mask, ch_coun...
mask: 0xa9 = 0b10101001 This means channels 7, 5, 3 and 0 are set This means lower is 0b1001 and upper is 0b1010
0xa9 = 0b10101001 This means channels 7, 5, 3 and 0 are set This means lower is 0b1001 and upper is 0b1010
[ "0xa9", "=", "0b10101001", "This", "means", "channels", "7", "5", "3", "and", "0", "are", "set", "This", "means", "lower", "is", "0b1001", "and", "upper", "is", "0b1010" ]
def banyan_ch_find(mask): mw = 8 state = list(map(lambda y: (y, mask >> y & 1), range(mw))) ch_count = sum(x[1] for x in state) if ch_count in [1, 2, 4, 8]: return banyan_layer_permute(state) else: return []
[ "def", "banyan_ch_find", "(", "mask", ")", ":", "mw", "=", "8", "state", "=", "list", "(", "map", "(", "lambda", "y", ":", "(", "y", ",", "mask", ">>", "y", "&", "1", ")", ",", "range", "(", "mw", ")", ")", ")", "ch_count", "=", "sum", "(", ...
mask: 0xa9 = 0b10101001 This means channels 7, 5, 3 and 0 are set This means lower is 0b1001 and upper is 0b1010
[ "mask", ":", "0xa9", "=", "0b10101001", "This", "means", "channels", "7", "5", "3", "and", "0", "are", "set", "This", "means", "lower", "is", "0b1001", "and", "upper", "is", "0b1010" ]
[ "'''\n mask: 0xa9 = 0b10101001 This means channels 7, 5, 3 and 0 are set\n This means lower is 0b1001 and upper is 0b1010\n '''", "# print(\"banyan_ch_find\", mask, ch_count)" ]
[ { "param": "mask", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mask", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6e7075d511820adb4ce150eee74fed2ff1633fec
mfkiwl/Bedrock
projects/common/leep/ca.py
[ "RSA-MD" ]
Python
wait_for_acq
<not_specific>
def wait_for_acq(self, toggle_tag=False, tag=False, timeout=5.0, instance=[]): """Wait for next waveform acquisition to complete. If tag=True, then wait for the next acquisition which includes the side-effects of all preceding register writes """ if tag or toggle_tag: ...
Wait for next waveform acquisition to complete. If tag=True, then wait for the next acquisition which includes the side-effects of all preceding register writes
Wait for next waveform acquisition to complete. If tag=True, then wait for the next acquisition which includes the side-effects of all preceding register writes
[ "Wait", "for", "next", "waveform", "acquisition", "to", "complete", ".", "If", "tag", "=", "True", "then", "wait", "for", "the", "next", "acquisition", "which", "includes", "the", "side", "-", "effects", "of", "all", "preceding", "register", "writes" ]
def wait_for_acq(self, toggle_tag=False, tag=False, timeout=5.0, instance=[]): if tag or toggle_tag: self.pv_write('dsp_tag', 'increment', 1, instance=instance) T = self.pv_read('dsp_tag', 'readback') _log.debug('Acquire T=%d toggle=%s tag=%s', T, toggle_tag, tag) if self._S ...
[ "def", "wait_for_acq", "(", "self", ",", "toggle_tag", "=", "False", ",", "tag", "=", "False", ",", "timeout", "=", "5.0", ",", "instance", "=", "[", "]", ")", ":", "if", "tag", "or", "toggle_tag", ":", "self", ".", "pv_write", "(", "'dsp_tag'", ",",...
Wait for next waveform acquisition to complete.
[ "Wait", "for", "next", "waveform", "acquisition", "to", "complete", "." ]
[ "\"\"\"Wait for next waveform acquisition to complete.\n If tag=True, then wait for the next acquisition which includes the\n side-effects of all preceding register writes\n \"\"\"", "# since we need to return the whole thing anyway,", "# monitor the slow data _waveform_.", "# wait for, a...
[ { "param": "self", "type": null }, { "param": "toggle_tag", "type": null }, { "param": "tag", "type": null }, { "param": "timeout", "type": null }, { "param": "instance", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "toggle_tag", "type": null, "docstring": null, "docstring_toke...
4de7bcfb1cca8f12c67a7e0c6b1403e8db25a8f4
mfkiwl/Bedrock
badger/lbus_access.py
[ "RSA-MD" ]
Python
_exchange
<not_specific>
def _exchange(self, addrs, values=None, drop_reply=False, burst=False): """Exchange a single low level message """ if not burst: msg = numpy.zeros(2+2*len(addrs), dtype=be32) else: msg = numpy.zeros(2+2+len(addrs), dtype=be32) msg[0] = random.randint(0, ...
Exchange a single low level message
Exchange a single low level message
[ "Exchange", "a", "single", "low", "level", "message" ]
def _exchange(self, addrs, values=None, drop_reply=False, burst=False): if not burst: msg = numpy.zeros(2+2*len(addrs), dtype=be32) else: msg = numpy.zeros(2+2+len(addrs), dtype=be32) msg[0] = random.randint(0, 0xffffffff) msg[1] = msg[0] ^ 0xffffffff if n...
[ "def", "_exchange", "(", "self", ",", "addrs", ",", "values", "=", "None", ",", "drop_reply", "=", "False", ",", "burst", "=", "False", ")", ":", "if", "not", "burst", ":", "msg", "=", "numpy", ".", "zeros", "(", "2", "+", "2", "*", "len", "(", ...
Exchange a single low level message
[ "Exchange", "a", "single", "low", "level", "message" ]
[ "\"\"\"Exchange a single low level message\n \"\"\"", "# print(\"%s Recv (%d) %s\", src, len(reply), binascii.hexlify(reply))" ]
[ { "param": "self", "type": null }, { "param": "addrs", "type": null }, { "param": "values", "type": null }, { "param": "drop_reply", "type": null }, { "param": "burst", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrs", "type": null, "docstring": null, "docstring_tokens": ...
4de7bcfb1cca8f12c67a7e0c6b1403e8db25a8f4
mfkiwl/Bedrock
badger/lbus_access.py
[ "RSA-MD" ]
Python
exchange
<not_specific>
def exchange(self, addrs, values=None, drop_reply=False): """Accepts a list of address and values (None to read). Returns a numpy.ndarray in the same order. """ addrs = list(addrs) consec = False # Check for consecutive addresses if burst mode available if self.b...
Accepts a list of address and values (None to read). Returns a numpy.ndarray in the same order.
Accepts a list of address and values (None to read). Returns a numpy.ndarray in the same order.
[ "Accepts", "a", "list", "of", "address", "and", "values", "(", "None", "to", "read", ")", ".", "Returns", "a", "numpy", ".", "ndarray", "in", "the", "same", "order", "." ]
def exchange(self, addrs, values=None, drop_reply=False): addrs = list(addrs) consec = False if self.burst_avail and len(addrs) > 1 and (addrs == list(range(addrs[0], addrs[-1]+1))): consec = True if values is None: values = [None]*len(addrs) else: ...
[ "def", "exchange", "(", "self", ",", "addrs", ",", "values", "=", "None", ",", "drop_reply", "=", "False", ")", ":", "addrs", "=", "list", "(", "addrs", ")", "consec", "=", "False", "if", "self", ".", "burst_avail", "and", "len", "(", "addrs", ")", ...
Accepts a list of address and values (None to read).
[ "Accepts", "a", "list", "of", "address", "and", "values", "(", "None", "to", "read", ")", "." ]
[ "\"\"\"Accepts a list of address and values (None to read).\n Returns a numpy.ndarray in the same order.\n \"\"\"", "# Check for consecutive addresses if burst mode available" ]
[ { "param": "self", "type": null }, { "param": "addrs", "type": null }, { "param": "values", "type": null }, { "param": "drop_reply", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrs", "type": null, "docstring": null, "docstring_tokens": ...
834e86fd70878e7f422f9bb5c54bbe6272910782
mfkiwl/Bedrock
projects/test_marble_family/scan_vcxo.py
[ "RSA-MD" ]
Python
measure_1
<not_specific>
def measure_1(chip, v, dac=2, pause=1.1, repeat=1, gps=False, verbose=False): ''' v should be between 0 and 65535 freq_count gateware module configured to update every 1.0737 s ''' prefix_map = {1: 0x10000, 2: 0x20000} if dac in prefix_map: v |= prefix_map[dac] else: print("I...
v should be between 0 and 65535 freq_count gateware module configured to update every 1.0737 s
v should be between 0 and 65535 freq_count gateware module configured to update every 1.0737 s
[ "v", "should", "be", "between", "0", "and", "65535", "freq_count", "gateware", "module", "configured", "to", "update", "every", "1", ".", "0737", "s" ]
def measure_1(chip, v, dac=2, pause=1.1, repeat=1, gps=False, verbose=False): prefix_map = {1: 0x10000, 2: 0x20000} if dac in prefix_map: v |= prefix_map[dac] else: print("Invalid DAC choice") exit(1) if gps: pause = 0.3 * pause chip.exchange([327692, 327689], [0, v])...
[ "def", "measure_1", "(", "chip", ",", "v", ",", "dac", "=", "2", ",", "pause", "=", "1.1", ",", "repeat", "=", "1", ",", "gps", "=", "False", ",", "verbose", "=", "False", ")", ":", "prefix_map", "=", "{", "1", ":", "0x10000", ",", "2", ":", ...
v should be between 0 and 65535 freq_count gateware module configured to update every 1.0737 s
[ "v", "should", "be", "between", "0", "and", "65535", "freq_count", "gateware", "module", "configured", "to", "update", "every", "1", ".", "0737", "s" ]
[ "'''\n v should be between 0 and 65535\n freq_count gateware module configured to update every 1.0737 s\n '''", "# pps_config, wr_dac" ]
[ { "param": "chip", "type": null }, { "param": "v", "type": null }, { "param": "dac", "type": null }, { "param": "pause", "type": null }, { "param": "repeat", "type": null }, { "param": "gps", "type": null }, { "param": "verbose", "type"...
{ "returns": [], "raises": [], "params": [ { "identifier": "chip", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], ...
9463c2e50b93b724e54727de57d2fbf91f0ee25e
mfkiwl/Bedrock
build-tools/clean_gtkw.py
[ "RSA-MD" ]
Python
clean_line
<not_specific>
def clean_line(line): ''' returns a cleaned up version of l ''' if any((line.startswith(p) for p in BAD_PREFIXES)): return '' # do not allow absolute path to the .vcd file m = match(r'\[dumpfile\] "(.*)"', line) if m: # replace by filename only return '[dumpfile] "{:}"\n'.for...
returns a cleaned up version of l
returns a cleaned up version of l
[ "returns", "a", "cleaned", "up", "version", "of", "l" ]
def clean_line(line): if any((line.startswith(p) for p in BAD_PREFIXES)): return '' m = match(r'\[dumpfile\] "(.*)"', line) if m: return '[dumpfile] "{:}"\n'.format(basename(m.group(1))) return line
[ "def", "clean_line", "(", "line", ")", ":", "if", "any", "(", "(", "line", ".", "startswith", "(", "p", ")", "for", "p", "in", "BAD_PREFIXES", ")", ")", ":", "return", "''", "m", "=", "match", "(", "r'\\[dumpfile\\] \"(.*)\"'", ",", "line", ")", "if"...
returns a cleaned up version of l
[ "returns", "a", "cleaned", "up", "version", "of", "l" ]
[ "''' returns a cleaned up version of l '''", "# do not allow absolute path to the .vcd file", "# replace by filename only" ]
[ { "param": "line", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "line", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9463c2e50b93b724e54727de57d2fbf91f0ee25e
mfkiwl/Bedrock
build-tools/clean_gtkw.py
[ "RSA-MD" ]
Python
clean_gtkw_file
<not_specific>
def clean_gtkw_file(fName, overwrite=False): ''' returns True if .gtkw file is dirty ''' with open(fName, 'r') as f: lines = f.readlines() dirty_flag = False for i, l in enumerate(lines[:N_LINES]): cl = clean_line(l) if cl != l: # print(l, "-->", cl) dirt...
returns True if .gtkw file is dirty
returns True if .gtkw file is dirty
[ "returns", "True", "if", ".", "gtkw", "file", "is", "dirty" ]
def clean_gtkw_file(fName, overwrite=False): with open(fName, 'r') as f: lines = f.readlines() dirty_flag = False for i, l in enumerate(lines[:N_LINES]): cl = clean_line(l) if cl != l: dirty_flag = True lines[i] = cl if dirty_flag and overwrite: pr...
[ "def", "clean_gtkw_file", "(", "fName", ",", "overwrite", "=", "False", ")", ":", "with", "open", "(", "fName", ",", "'r'", ")", "as", "f", ":", "lines", "=", "f", ".", "readlines", "(", ")", "dirty_flag", "=", "False", "for", "i", ",", "l", "in", ...
returns True if .gtkw file is dirty
[ "returns", "True", "if", ".", "gtkw", "file", "is", "dirty" ]
[ "''' returns True if .gtkw file is dirty '''", "# print(l, \"-->\", cl)" ]
[ { "param": "fName", "type": null }, { "param": "overwrite", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fName", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "overwrite", "type": null, "docstring": null, "docstring_toke...
6afc2f142ebed93bd72707f4ae216e01f7adbbd2
mfkiwl/Bedrock
dsp/tb_pycheck.py
[ "RSA-MD" ]
Python
fraction_to_ph_acc
<not_specific>
def fraction_to_ph_acc(rational_fraction, bits_h=20, bits_l=12): ''' Converts a rational fraction [num/den] to what is needed by dsp/ph_acc.v The function determines the fixed point phase step that an FGPA phase generator rotates by every clock cycle (of the sampling clock). The rotation is impleme...
Converts a rational fraction [num/den] to what is needed by dsp/ph_acc.v The function determines the fixed point phase step that an FGPA phase generator rotates by every clock cycle (of the sampling clock). The rotation is implemented as an adder. The frequency being generated is a `rational_fract...
Converts a rational fraction [num/den] to what is needed by dsp/ph_acc.v The function determines the fixed point phase step that an FGPA phase generator rotates by every clock cycle (of the sampling clock). The rotation is implemented as an adder. The frequency being generated is a `rational_fraction` of the ADC clock ...
[ "Converts", "a", "rational", "fraction", "[", "num", "/", "den", "]", "to", "what", "is", "needed", "by", "dsp", "/", "ph_acc", ".", "v", "The", "function", "determines", "the", "fixed", "point", "phase", "step", "that", "an", "FGPA", "phase", "generator...
def fraction_to_ph_acc(rational_fraction, bits_h=20, bits_l=12): coarse_fs, fine_fs = 2**bits_h, 2**bits_l num, den = rational_fraction step_h = int(coarse_fs * num / den) residue_coarse = (num * coarse_fs) % den acc_multiplier = int(fine_fs / den) step_l = residue_coarse * acc_multiplier mo...
[ "def", "fraction_to_ph_acc", "(", "rational_fraction", ",", "bits_h", "=", "20", ",", "bits_l", "=", "12", ")", ":", "coarse_fs", ",", "fine_fs", "=", "2", "**", "bits_h", ",", "2", "**", "bits_l", "num", ",", "den", "=", "rational_fraction", "step_h", "...
Converts a rational fraction [num/den] to what is needed by dsp/ph_acc.v The function determines the fixed point phase step that an FGPA phase generator rotates by every clock cycle (of the sampling clock).
[ "Converts", "a", "rational", "fraction", "[", "num", "/", "den", "]", "to", "what", "is", "needed", "by", "dsp", "/", "ph_acc", ".", "v", "The", "function", "determines", "the", "fixed", "point", "phase", "step", "that", "an", "FGPA", "phase", "generator...
[ "'''\n Converts a rational fraction [num/den] to what is needed by dsp/ph_acc.v\n\n The function determines the fixed point phase step that an FGPA phase\n generator rotates by every clock cycle (of the sampling clock). The\n rotation is implemented as an adder. The frequency being generated is a\n `...
[ { "param": "rational_fraction", "type": null }, { "param": "bits_h", "type": null }, { "param": "bits_l", "type": null } ]
{ "returns": [ { "docstring": ":return step_h: Coarse representation of the `rational_fraction`", "docstring_tokens": [ ":", "return", "step_h", ":", "Coarse", "representation", "of", "the", "`", "rational_fraction", ...
bbf51475a910fd26b18c999a774e1eda926228d3
mfkiwl/Bedrock
build-tools/newad.py
[ "RSA-MD" ]
Python
make_decoder_inner
null
def make_decoder_inner(inst, mod, p): ''' Constructs a decoder for a port p. p: is an instance of Port ''' # print '// make_decoder',inst,mod,a if p.direction != 'output': # print '// make_decoder instance=%s name=%s'%(inst,a[5]) clk_prefix = p.clk_domain cd_index_str = '...
Constructs a decoder for a port p. p: is an instance of Port
Constructs a decoder for a port p. p: is an instance of Port
[ "Constructs", "a", "decoder", "for", "a", "port", "p", ".", "p", ":", "is", "an", "instance", "of", "Port" ]
def make_decoder_inner(inst, mod, p): if p.direction != 'output': clk_prefix = p.clk_domain cd_index_str = '' if p.cd_indexed and p.cd_index is not None: cd_index_str = '[%d]' % p.cd_index key = use_ram_key(p.module, p.name) if inst is None: sig_name =...
[ "def", "make_decoder_inner", "(", "inst", ",", "mod", ",", "p", ")", ":", "if", "p", ".", "direction", "!=", "'output'", ":", "clk_prefix", "=", "p", ".", "clk_domain", "cd_index_str", "=", "''", "if", "p", ".", "cd_indexed", "and", "p", ".", "cd_index...
Constructs a decoder for a port p. p: is an instance of Port
[ "Constructs", "a", "decoder", "for", "a", "port", "p", ".", "p", ":", "is", "an", "instance", "of", "Port" ]
[ "'''\n Constructs a decoder for a port p.\n p: is an instance of Port\n '''", "# print '// make_decoder',inst,mod,a", "# print '// make_decoder instance=%s name=%s'%(inst,a[5])", "# print '// checking use_ram for key '+key", "# print '// ***** use_ram %s %s'%(key,use_ram[key]), addr_range,", "# a...
[ { "param": "inst", "type": null }, { "param": "mod", "type": null }, { "param": "p", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inst", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mod", "type": null, "docstring": null, "docstring_tokens": []...
bbf51475a910fd26b18c999a774e1eda926228d3
mfkiwl/Bedrock
build-tools/newad.py
[ "RSA-MD" ]
Python
print_instance_ports
null
def print_instance_ports(inst, mod, gvar, gcnt, fd): ''' Print the port assignments for the instantiation of a module. At the same time, append to the self_ports and decodes strings, so the variables mapped to the ports can get adequately defined. ''' instance_ports = port_lists[mod] if fd: ...
Print the port assignments for the instantiation of a module. At the same time, append to the self_ports and decodes strings, so the variables mapped to the ports can get adequately defined.
Print the port assignments for the instantiation of a module. At the same time, append to the self_ports and decodes strings, so the variables mapped to the ports can get adequately defined.
[ "Print", "the", "port", "assignments", "for", "the", "instantiation", "of", "a", "module", ".", "At", "the", "same", "time", "append", "to", "the", "self_ports", "and", "decodes", "strings", "so", "the", "variables", "mapped", "to", "the", "ports", "can", ...
def print_instance_ports(inst, mod, gvar, gcnt, fd): instance_ports = port_lists[mod] if fd: this_list = [one_port(inst, p.name, gvar) for p in instance_ports] if this_list: tail = ' ' + ',\\\n\t'.join(this_list) else: tail = '' fd.write('`define AUTOMATIC...
[ "def", "print_instance_ports", "(", "inst", ",", "mod", ",", "gvar", ",", "gcnt", ",", "fd", ")", ":", "instance_ports", "=", "port_lists", "[", "mod", "]", "if", "fd", ":", "this_list", "=", "[", "one_port", "(", "inst", ",", "p", ".", "name", ",", ...
Print the port assignments for the instantiation of a module.
[ "Print", "the", "port", "assignments", "for", "the", "instantiation", "of", "a", "module", "." ]
[ "'''\n Print the port assignments for the instantiation of a module.\n At the same time, append to the self_ports and decodes strings,\n so the variables mapped to the ports can get adequately defined.\n '''", "# 'list comprehension' for the port list itself", "# now construct the self_ports and de...
[ { "param": "inst", "type": null }, { "param": "mod", "type": null }, { "param": "gvar", "type": null }, { "param": "gcnt", "type": null }, { "param": "fd", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inst", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mod", "type": null, "docstring": null, "docstring_tokens": []...
bbf51475a910fd26b18c999a774e1eda926228d3
mfkiwl/Bedrock
build-tools/newad.py
[ "RSA-MD" ]
Python
parse_vfile
<not_specific>
def parse_vfile(stack, fin, fd, dlist, clk_domain, cd_indexed, try_sv=True): ''' Given a filename, parse Verilog: (a) looking for module instantiations marked automatic, for which we need to generate port assignments. When such an instantiation is found, recurse. (b) looking for input/output por...
Given a filename, parse Verilog: (a) looking for module instantiations marked automatic, for which we need to generate port assignments. When such an instantiation is found, recurse. (b) looking for input/output ports labeled 'external'. Record them in the port_lists dictionary for this module....
Given a filename, parse Verilog: (a) looking for module instantiations marked automatic, for which we need to generate port assignments. When such an instantiation is found, recurse. (b) looking for input/output ports labeled 'external'. Record them in the port_lists dictionary for this module.
[ "Given", "a", "filename", "parse", "Verilog", ":", "(", "a", ")", "looking", "for", "module", "instantiations", "marked", "automatic", "for", "which", "we", "need", "to", "generate", "port", "assignments", ".", "When", "such", "an", "instantiation", "is", "f...
def parse_vfile(stack, fin, fd, dlist, clk_domain, cd_indexed, try_sv=True): fin_sv = splitext(fin)[0] + '.sv' searchpath = dirname(fin) fname = basename(fin) fname_sv = basename(fin_sv) fsearch = [fname, fname_sv] if try_sv else [fname] found = False for fn in fsearch: if isfile(fn)...
[ "def", "parse_vfile", "(", "stack", ",", "fin", ",", "fd", ",", "dlist", ",", "clk_domain", ",", "cd_indexed", ",", "try_sv", "=", "True", ")", ":", "fin_sv", "=", "splitext", "(", "fin", ")", "[", "0", "]", "+", "'.sv'", "searchpath", "=", "dirname"...
Given a filename, parse Verilog: (a) looking for module instantiations marked automatic, for which we need to generate port assignments.
[ "Given", "a", "filename", "parse", "Verilog", ":", "(", "a", ")", "looking", "for", "module", "instantiations", "marked", "automatic", "for", "which", "we", "need", "to", "generate", "port", "assignments", "." ]
[ "'''\n Given a filename, parse Verilog:\n (a) looking for module instantiations marked automatic,\n for which we need to generate port assignments.\n When such an instantiation is found, recurse.\n (b) looking for input/output ports labeled 'external'.\n Record them in the port_lists dictionary fo...
[ { "param": "stack", "type": null }, { "param": "fin", "type": null }, { "param": "fd", "type": null }, { "param": "dlist", "type": null }, { "param": "clk_domain", "type": null }, { "param": "cd_indexed", "type": null }, { "param": "try_sv"...
{ "returns": [], "raises": [], "params": [ { "identifier": "stack", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fin", "type": null, "docstring": null, "docstring_tokens": [...
bbf51475a910fd26b18c999a774e1eda926228d3
mfkiwl/Bedrock
build-tools/newad.py
[ "RSA-MD" ]
Python
generate_mirror
<not_specific>
def generate_mirror(dw, mirror_n): ''' Generates a dpram which mirrors the register values being written into the automatically generated addresses. dw, aw: data/address width of the ram mirror_base: mirror_n: A unique identifier for the mirror dpram ''' # HACK: HARD coding clk_prefix to...
Generates a dpram which mirrors the register values being written into the automatically generated addresses. dw, aw: data/address width of the ram mirror_base: mirror_n: A unique identifier for the mirror dpram
Generates a dpram which mirrors the register values being written into the automatically generated addresses. dw, aw: data/address width of the ram mirror_base: mirror_n: A unique identifier for the mirror dpram
[ "Generates", "a", "dpram", "which", "mirrors", "the", "register", "values", "being", "written", "into", "the", "automatically", "generated", "addresses", ".", "dw", "aw", ":", "data", "/", "address", "width", "of", "the", "ram", "mirror_base", ":", "mirror_n",...
def generate_mirror(dw, mirror_n): cp = 'lb' mirror_strobe = 'wire [%d:0] mirror_out_%d;'\ 'wire mirror_write_%d = %s_write &(`ADDR_HIT_MIRROR);\\\n' %\ (dw-1, mirror_n, mirror_n, cp) dpram_a = '.clka(%s_clk), .addra(%s_addr[`MIRROR_WIDTH-1:0]), '\ '.din...
[ "def", "generate_mirror", "(", "dw", ",", "mirror_n", ")", ":", "cp", "=", "'lb'", "mirror_strobe", "=", "'wire [%d:0] mirror_out_%d;'", "'wire mirror_write_%d = %s_write &(`ADDR_HIT_MIRROR);\\\\\\n'", "%", "(", "dw", "-", "1", ",", "mirror_n", ",", "mirror_n", ",", ...
Generates a dpram which mirrors the register values being written into the automatically generated addresses.
[ "Generates", "a", "dpram", "which", "mirrors", "the", "register", "values", "being", "written", "into", "the", "automatically", "generated", "addresses", "." ]
[ "'''\n Generates a dpram which mirrors the register values being written into the\n automatically generated addresses.\n dw, aw: data/address width of the ram\n mirror_base:\n mirror_n: A unique identifier for the mirror dpram\n '''", "# HACK: HARD coding clk_prefix to be 'lb'" ]
[ { "param": "dw", "type": null }, { "param": "mirror_n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dw", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mirror_n", "type": null, "docstring": null, "docstring_tokens":...
bbf51475a910fd26b18c999a774e1eda926228d3
mfkiwl/Bedrock
build-tools/newad.py
[ "RSA-MD" ]
Python
address_allocation
<not_specific>
def address_allocation(fd, hierarchy, names, address, low_res=False, gen_mirror=False, plot_map=False): ''' NOTE: The whole hierarchy thing is currently being bypassed TO...
NOTE: The whole hierarchy thing is currently being bypassed TODO: Possibly remove hierarchy from here, or even make it optional hierarchy: Index into g_hierarchy (current hierarchy level) names: All signal names that belong in the current hierarchy address: for current index in g_hierarchy deno...
The whole hierarchy thing is currently being bypassed TODO: Possibly remove hierarchy from here, or even make it optional hierarchy: Index into g_hierarchy (current hierarchy level) names: All signal names that belong in the current hierarchy address: for current index in g_hierarchy denoted with variable 'hierarchy' 1...
[ "The", "whole", "hierarchy", "thing", "is", "currently", "being", "bypassed", "TODO", ":", "Possibly", "remove", "hierarchy", "from", "here", "or", "even", "make", "it", "optional", "hierarchy", ":", "Index", "into", "g_hierarchy", "(", "current", "hierarchy", ...
def address_allocation(fd, hierarchy, names, address, low_res=False, gen_mirror=False, plot_map=False): if hierarchy == len(g_hierarchy): return generate_addresses(fd, na...
[ "def", "address_allocation", "(", "fd", ",", "hierarchy", ",", "names", ",", "address", ",", "low_res", "=", "False", ",", "gen_mirror", "=", "False", ",", "plot_map", "=", "False", ")", ":", "if", "hierarchy", "==", "len", "(", "g_hierarchy", ")", ":", ...
NOTE: The whole hierarchy thing is currently being bypassed TODO: Possibly remove hierarchy from here, or even make it optional hierarchy: Index into g_hierarchy (current hierarchy level) names: All signal names that belong in the current hierarchy address: for current index in g_hierarchy denoted with variable 'hierar...
[ "NOTE", ":", "The", "whole", "hierarchy", "thing", "is", "currently", "being", "bypassed", "TODO", ":", "Possibly", "remove", "hierarchy", "from", "here", "or", "even", "make", "it", "optional", "hierarchy", ":", "Index", "into", "g_hierarchy", "(", "current",...
[ "'''\n NOTE: The whole hierarchy thing is currently being bypassed\n TODO: Possibly remove hierarchy from here, or even make it optional\n hierarchy: Index into g_hierarchy (current hierarchy level)\n names: All signal names that belong in the current hierarchy\n address:\n for current index in g_...
[ { "param": "fd", "type": null }, { "param": "hierarchy", "type": null }, { "param": "names", "type": null }, { "param": "address", "type": null }, { "param": "low_res", "type": null }, { "param": "gen_mirror", "type": null }, { "param": "pl...
{ "returns": [], "raises": [], "params": [ { "identifier": "fd", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hierarchy", "type": null, "docstring": null, "docstring_tokens"...
76e52e04187f04912e87fbc6119bbe78d106a9a8
mfkiwl/Bedrock
soc/picorv32/common/boot_load.py
[ "RSA-MD" ]
Python
read_verilog_hex
<not_specific>
def read_verilog_hex(fName): ''' Read a verilog .hex file with 32 bit words. Returns a bytearray with the data, ready to be flashed into picoRV32 memory ''' binBuffer = bytearray(2**16 * 4) currentWordAddr = 0 with open(fName) as f: for hexLine in f: hexLine = hexLine...
Read a verilog .hex file with 32 bit words. Returns a bytearray with the data, ready to be flashed into picoRV32 memory
Read a verilog .hex file with 32 bit words. Returns a bytearray with the data, ready to be flashed into picoRV32 memory
[ "Read", "a", "verilog", ".", "hex", "file", "with", "32", "bit", "words", ".", "Returns", "a", "bytearray", "with", "the", "data", "ready", "to", "be", "flashed", "into", "picoRV32", "memory" ]
def read_verilog_hex(fName): binBuffer = bytearray(2**16 * 4) currentWordAddr = 0 with open(fName) as f: for hexLine in f: hexLine = hexLine.strip() if hexLine.startswith('\\'): continue if hexLine.startswith('@'): currentWordAddr =...
[ "def", "read_verilog_hex", "(", "fName", ")", ":", "binBuffer", "=", "bytearray", "(", "2", "**", "16", "*", "4", ")", "currentWordAddr", "=", "0", "with", "open", "(", "fName", ")", "as", "f", ":", "for", "hexLine", "in", "f", ":", "hexLine", "=", ...
Read a verilog .hex file with 32 bit words.
[ "Read", "a", "verilog", ".", "hex", "file", "with", "32", "bit", "words", "." ]
[ "'''\n Read a verilog .hex file with 32 bit words.\n Returns a bytearray with the data, ready to be flashed into\n picoRV32 memory\n '''" ]
[ { "param": "fName", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fName", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
76e52e04187f04912e87fbc6119bbe78d106a9a8
mfkiwl/Bedrock
soc/picorv32/common/boot_load.py
[ "RSA-MD" ]
Python
bootload
null
def bootload(bin_buffer, ser_port, baud_rate, byte_offset, reset_rts, reset_soft=True): ''' connects to serial bootloader and uploads the byteArray `bin_buffer` to the picoRV32 memory at offset `byte_offset` (in bytes). Any content of `bin_buffer` before that offset is ignored (preserve...
connects to serial bootloader and uploads the byteArray `bin_buffer` to the picoRV32 memory at offset `byte_offset` (in bytes). Any content of `bin_buffer` before that offset is ignored (preserve bootloader code).
connects to serial bootloader and uploads the byteArray `bin_buffer` to the picoRV32 memory at offset `byte_offset` (in bytes). Any content of `bin_buffer` before that offset is ignored (preserve bootloader code).
[ "connects", "to", "serial", "bootloader", "and", "uploads", "the", "byteArray", "`", "bin_buffer", "`", "to", "the", "picoRV32", "memory", "at", "offset", "`", "byte_offset", "`", "(", "in", "bytes", ")", ".", "Any", "content", "of", "`", "bin_buffer", "`"...
def bootload(bin_buffer, ser_port, baud_rate, byte_offset, reset_rts, reset_soft=True): s = serial.Serial(ser_port, baud_rate, timeout=5, xonxoff=False, rtscts=False, dsrdtr=False) bin_buffer = bin_buffer[byte_offset:] print('Push reset ... ', end='') s.flush() if ...
[ "def", "bootload", "(", "bin_buffer", ",", "ser_port", ",", "baud_rate", ",", "byte_offset", ",", "reset_rts", ",", "reset_soft", "=", "True", ")", ":", "s", "=", "serial", ".", "Serial", "(", "ser_port", ",", "baud_rate", ",", "timeout", "=", "5", ",", ...
connects to serial bootloader and uploads the byteArray `bin_buffer` to the picoRV32 memory at offset `byte_offset` (in bytes).
[ "connects", "to", "serial", "bootloader", "and", "uploads", "the", "byteArray", "`", "bin_buffer", "`", "to", "the", "picoRV32", "memory", "at", "offset", "`", "byte_offset", "`", "(", "in", "bytes", ")", "." ]
[ "'''\n connects to serial bootloader and uploads the byteArray `bin_buffer`\n to the picoRV32 memory at offset `byte_offset` (in bytes).\n Any content of `bin_buffer` before that offset is ignored\n (preserve bootloader code).\n '''", "# Try a remote reset", "# Wait for `ok\\n` from the bootloade...
[ { "param": "bin_buffer", "type": null }, { "param": "ser_port", "type": null }, { "param": "baud_rate", "type": null }, { "param": "byte_offset", "type": null }, { "param": "reset_rts", "type": null }, { "param": "reset_soft", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bin_buffer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ser_port", "type": null, "docstring": null, "docstring_...
b5075a0326da459a0685b1d6a7688015ece41ee8
mfkiwl/Bedrock
projects/oscope/marblemini/remap_gen.py
[ "RSA-MD" ]
Python
fmc_name_mangle
<not_specific>
def fmc_name_mangle(name): ''' This function mangles the FMC names that respect the standard to names that don't for the sake of currently solving the problem. TODO: Fixing above requires modifying meta-xdc.py? ''' return name.replace('LA0', 'LA').replace('LA', 'LA_').replace('_CC', '')
This function mangles the FMC names that respect the standard to names that don't for the sake of currently solving the problem. TODO: Fixing above requires modifying meta-xdc.py?
This function mangles the FMC names that respect the standard to names that don't for the sake of currently solving the problem.
[ "This", "function", "mangles", "the", "FMC", "names", "that", "respect", "the", "standard", "to", "names", "that", "don", "'", "t", "for", "the", "sake", "of", "currently", "solving", "the", "problem", "." ]
def fmc_name_mangle(name): return name.replace('LA0', 'LA').replace('LA', 'LA_').replace('_CC', '')
[ "def", "fmc_name_mangle", "(", "name", ")", ":", "return", "name", ".", "replace", "(", "'LA0'", ",", "'LA'", ")", ".", "replace", "(", "'LA'", ",", "'LA_'", ")", ".", "replace", "(", "'_CC'", ",", "''", ")" ]
This function mangles the FMC names that respect the standard to names that don't for the sake of currently solving the problem.
[ "This", "function", "mangles", "the", "FMC", "names", "that", "respect", "the", "standard", "to", "names", "that", "don", "'", "t", "for", "the", "sake", "of", "currently", "solving", "the", "problem", "." ]
[ "'''\n This function mangles the FMC names that respect the standard to\n names that don't for the sake of currently solving the problem.\n TODO: Fixing above requires modifying meta-xdc.py?\n '''" ]
[ { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d6a968a0f289e19f65e5d011f01c1b44fa0e42f2
ZedThree/tokamesh
tokamesh/triangle/__init__.py
[ "MIT" ]
Python
run_triangle
<not_specific>
def run_triangle(outer_boundary=None, inner_boundary=None, void_markers=None, max_area=None): """ A Python interface for the 'Triangle' C-code which is packaged with Tokamesh. :param outer_boundary: :param inner_boundary: :param void_markers: :param max_area: :return: """ # first c...
A Python interface for the 'Triangle' C-code which is packaged with Tokamesh. :param outer_boundary: :param inner_boundary: :param void_markers: :param max_area: :return:
A Python interface for the 'Triangle' C-code which is packaged with Tokamesh.
[ "A", "Python", "interface", "for", "the", "'", "Triangle", "'", "C", "-", "code", "which", "is", "packaged", "with", "Tokamesh", "." ]
def run_triangle(outer_boundary=None, inner_boundary=None, void_markers=None, max_area=None): if not isfile(triangle_dir + 'triangle'): print(' # triangle executable not found - attempting compile from source') if not isfile(triangle_dir + 'triangle.c'): raise FileNotFoundError('source c...
[ "def", "run_triangle", "(", "outer_boundary", "=", "None", ",", "inner_boundary", "=", "None", ",", "void_markers", "=", "None", ",", "max_area", "=", "None", ")", ":", "if", "not", "isfile", "(", "triangle_dir", "+", "'triangle'", ")", ":", "print", "(", ...
A Python interface for the 'Triangle' C-code which is packaged with Tokamesh.
[ "A", "Python", "interface", "for", "the", "'", "Triangle", "'", "C", "-", "code", "which", "is", "packaged", "with", "Tokamesh", "." ]
[ "\"\"\"\n A Python interface for the 'Triangle' C-code which is packaged with Tokamesh.\n\n :param outer_boundary:\n :param inner_boundary:\n :param void_markers:\n :param max_area:\n :return:\n \"\"\"", "# first check to see if the triangle executable exists in the given location", "# if n...
[ { "param": "outer_boundary", "type": null }, { "param": "inner_boundary", "type": null }, { "param": "void_markers", "type": null }, { "param": "max_area", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "outer_boundary", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": nu...
74fb9c8bcd16a55340bd27db1275bbaa5da31368
RobotCodeLab/MaktubCIServer
CIServer.py
[ "MIT" ]
Python
shell_source
null
def shell_source(script, ccwd): """Sometime you want to emulate the action of "source" in bash, settings some environment variables. Here is a way to do it.""" import subprocess, os pipe = subprocess.Popen(". %s; env" % script, stdout=subprocess.PIPE, cwd=ccwd, shell=True, encoding='utf-8') output =...
Sometime you want to emulate the action of "source" in bash, settings some environment variables. Here is a way to do it.
Sometime you want to emulate the action of "source" in bash, settings some environment variables. Here is a way to do it.
[ "Sometime", "you", "want", "to", "emulate", "the", "action", "of", "\"", "source", "\"", "in", "bash", "settings", "some", "environment", "variables", ".", "Here", "is", "a", "way", "to", "do", "it", "." ]
def shell_source(script, ccwd): import subprocess, os pipe = subprocess.Popen(". %s; env" % script, stdout=subprocess.PIPE, cwd=ccwd, shell=True, encoding='utf-8') output = pipe.communicate()[0] env = dict((line.split("=", 1) for line in output.splitlines())) os.environ.update(env)
[ "def", "shell_source", "(", "script", ",", "ccwd", ")", ":", "import", "subprocess", ",", "os", "pipe", "=", "subprocess", ".", "Popen", "(", "\". %s; env\"", "%", "script", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "cwd", "=", "ccwd", ",", "...
Sometime you want to emulate the action of "source" in bash, settings some environment variables.
[ "Sometime", "you", "want", "to", "emulate", "the", "action", "of", "\"", "source", "\"", "in", "bash", "settings", "some", "environment", "variables", "." ]
[ "\"\"\"Sometime you want to emulate the action of \"source\" in bash,\n settings some environment variables. Here is a way to do it.\"\"\"" ]
[ { "param": "script", "type": null }, { "param": "ccwd", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "script", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ccwd", "type": null, "docstring": null, "docstring_tokens":...
056753b8b645ca7276cc88a1d2f67a97d85c272a
robdmc/norma
norma/collector.py
[ "MIT" ]
Python
ingest
null
def ingest(self, data, weights=None, labels=None): """ data: any object that can be passed to dataframe constructor labels: optional list of names for variables. """
data: any object that can be passed to dataframe constructor labels: optional list of names for variables.
any object that can be passed to dataframe constructor labels: optional list of names for variables.
[ "any", "object", "that", "can", "be", "passed", "to", "dataframe", "constructor", "labels", ":", "optional", "list", "of", "names", "for", "variables", "." ]
def ingest(self, data, weights=None, labels=None):
[ "def", "ingest", "(", "self", ",", "data", ",", "weights", "=", "None", ",", "labels", "=", "None", ")", ":" ]
data: any object that can be passed to dataframe constructor labels: optional list of names for variables.
[ "data", ":", "any", "object", "that", "can", "be", "passed", "to", "dataframe", "constructor", "labels", ":", "optional", "list", "of", "names", "for", "variables", "." ]
[ "\"\"\"\n data: any object that can be passed to dataframe constructor\n labels: optional list of names for variables.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null }, { "param": "weights", "type": null }, { "param": "labels", "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": [...
53d7a64ceefffd3bb81e4c3b01ec02702fb08808
robdmc/norma
norma/joint_normal.py
[ "MIT" ]
Python
_compute_permutation_matrix
<not_specific>
def _compute_permutation_matrix(initial_index, final_index): """ Compute the permutation matrix that takes initial_index to final_index initial_index: an iterable of indices for the initial unpermuted elements (must contain all integers in range(len(initial_index)) final_index: an ite...
Compute the permutation matrix that takes initial_index to final_index initial_index: an iterable of indices for the initial unpermuted elements (must contain all integers in range(len(initial_index)) final_index: an iterable of indices for the initial permuted elements ...
Compute the permutation matrix that takes initial_index to final_index initial_index: an iterable of indices for the initial unpermuted elements (must contain all integers in range(len(initial_index)) final_index: an iterable of indices for the initial permuted elements (must contain all integers in range(len(final_ind...
[ "Compute", "the", "permutation", "matrix", "that", "takes", "initial_index", "to", "final_index", "initial_index", ":", "an", "iterable", "of", "indices", "for", "the", "initial", "unpermuted", "elements", "(", "must", "contain", "all", "integers", "in", "range", ...
def _compute_permutation_matrix(initial_index, final_index): permutation_matrix = np.matrix(np.zeros((len(initial_index), len(initial_index)))) for final, initial in zip(final_index, initial_index): permutation_matrix[initial, final] = 1 return permutation_matrix
[ "def", "_compute_permutation_matrix", "(", "initial_index", ",", "final_index", ")", ":", "permutation_matrix", "=", "np", ".", "matrix", "(", "np", ".", "zeros", "(", "(", "len", "(", "initial_index", ")", ",", "len", "(", "initial_index", ")", ")", ")", ...
Compute the permutation matrix that takes initial_index to final_index initial_index: an iterable of indices for the initial unpermuted elements (must contain all integers in range(len(initial_index)) final_index: an iterable of indices for the initial permuted elements (must contain all integers in range(len(final_ind...
[ "Compute", "the", "permutation", "matrix", "that", "takes", "initial_index", "to", "final_index", "initial_index", ":", "an", "iterable", "of", "indices", "for", "the", "initial", "unpermuted", "elements", "(", "must", "contain", "all", "integers", "in", "range", ...
[ "\"\"\"\n Compute the permutation matrix that takes initial_index to final_index\n initial_index: an iterable of indices for the initial unpermuted elements\n (must contain all integers in range(len(initial_index))\n final_index: an iterable of indices for the initial permuted elements\n ...
[ { "param": "initial_index", "type": null }, { "param": "final_index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "initial_index", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "final_index", "type": null, "docstring": null, "docs...
ea1cec8c62ed22394375fdfacfff5b9679d97620
robdmc/norma
norma/joint_normal2.py
[ "MIT" ]
Python
marginal
null
def marginal(self, labels: List[str]): """ Compute the marginal distribution of the specified variables. Args: labels: The variable names for which you want the marginal distribution. Returns: Another normal object with the marginal mean and covariance "...
Compute the marginal distribution of the specified variables. Args: labels: The variable names for which you want the marginal distribution. Returns: Another normal object with the marginal mean and covariance
Compute the marginal distribution of the specified variables.
[ "Compute", "the", "marginal", "distribution", "of", "the", "specified", "variables", "." ]
def marginal(self, labels: List[str]):
[ "def", "marginal", "(", "self", ",", "labels", ":", "List", "[", "str", "]", ")", ":" ]
Compute the marginal distribution of the specified variables.
[ "Compute", "the", "marginal", "distribution", "of", "the", "specified", "variables", "." ]
[ "\"\"\"\n Compute the marginal distribution of the specified variables.\n\n Args:\n labels: The variable names for which you want the marginal distribution.\n\n Returns:\n Another normal object with the marginal mean and covariance\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "labels", "type": "List[str]" } ]
{ "returns": [ { "docstring": "Another normal object with the marginal mean and covariance", "docstring_tokens": [ "Another", "normal", "object", "with", "the", "marginal", "mean", "and", "covariance" ], "type": null ...
ea1cec8c62ed22394375fdfacfff5b9679d97620
robdmc/norma
norma/joint_normal2.py
[ "MIT" ]
Python
where
null
def where(self, conditions: Union[Dict, pd.Series]): """ Compute the normal distribution resulting from conditioning on the specified variables. Args: conditions: A dictionary or pandas series specifying the conditions. Returns: A...
Compute the normal distribution resulting from conditioning on the specified variables. Args: conditions: A dictionary or pandas series specifying the conditions. Returns: Another normal object with the conditional mean and covariance ...
Compute the normal distribution resulting from conditioning on the specified variables.
[ "Compute", "the", "normal", "distribution", "resulting", "from", "conditioning", "on", "the", "specified", "variables", "." ]
def where(self, conditions: Union[Dict, pd.Series]):
[ "def", "where", "(", "self", ",", "conditions", ":", "Union", "[", "Dict", ",", "pd", ".", "Series", "]", ")", ":" ]
Compute the normal distribution resulting from conditioning on the specified variables.
[ "Compute", "the", "normal", "distribution", "resulting", "from", "conditioning", "on", "the", "specified", "variables", "." ]
[ "\"\"\"\n Compute the normal distribution resulting from conditioning on the\n specified variables.\n\n Args:\n conditions: A dictionary or pandas series specifying the\n conditions.\n\n Returns:\n Another normal object with the conditional me...
[ { "param": "self", "type": null }, { "param": "conditions", "type": "Union[Dict, pd.Series]" } ]
{ "returns": [ { "docstring": "Another normal object with the conditional mean and covariance", "docstring_tokens": [ "Another", "normal", "object", "with", "the", "conditional", "mean", "and", "covariance" ], "type": ...
ea1cec8c62ed22394375fdfacfff5b9679d97620
robdmc/norma
norma/joint_normal2.py
[ "MIT" ]
Python
prob
null
def prob(self, location: Union[np.ndarray, pd.Series]): """ Compute the probability density at a particular location. Args: location: The location at which to compute the density """
Compute the probability density at a particular location. Args: location: The location at which to compute the density
Compute the probability density at a particular location.
[ "Compute", "the", "probability", "density", "at", "a", "particular", "location", "." ]
def prob(self, location: Union[np.ndarray, pd.Series]):
[ "def", "prob", "(", "self", ",", "location", ":", "Union", "[", "np", ".", "ndarray", ",", "pd", ".", "Series", "]", ")", ":" ]
Compute the probability density at a particular location.
[ "Compute", "the", "probability", "density", "at", "a", "particular", "location", "." ]
[ "\"\"\"\n Compute the probability density at a particular location.\n Args:\n location: The location at which to compute the density\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "location", "type": "Union[np.ndarray, pd.Series]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "location", "type": "Union[np.ndarray, pd.Series]", "docstring": "Th...
ea1cec8c62ed22394375fdfacfff5b9679d97620
robdmc/norma
norma/joint_normal2.py
[ "MIT" ]
Python
log_prob
null
def log_prob(self, location: Union[np.ndarray, pd.Series]): """ Compute the log probability density at a particular location. Args: location: The location at which to compute the log density """
Compute the log probability density at a particular location. Args: location: The location at which to compute the log density
Compute the log probability density at a particular location.
[ "Compute", "the", "log", "probability", "density", "at", "a", "particular", "location", "." ]
def log_prob(self, location: Union[np.ndarray, pd.Series]):
[ "def", "log_prob", "(", "self", ",", "location", ":", "Union", "[", "np", ".", "ndarray", ",", "pd", ".", "Series", "]", ")", ":" ]
Compute the log probability density at a particular location.
[ "Compute", "the", "log", "probability", "density", "at", "a", "particular", "location", "." ]
[ "\"\"\"\n Compute the log probability density at a particular location.\n Args:\n location: The location at which to compute the log density\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "location", "type": "Union[np.ndarray, pd.Series]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "location", "type": "Union[np.ndarray, pd.Series]", "docstring": "Th...
ea1cec8c62ed22394375fdfacfff5b9679d97620
robdmc/norma
norma/joint_normal2.py
[ "MIT" ]
Python
observe
null
def observe( self, observations: Union[np.ndarray, pd.Series, pd.DataFrame, Dict], return_residuals: bool = False ): """ Add observations to the distribution. This allows for creating a normal object with a specified prior mean/covariance. Adding observa...
Add observations to the distribution. This allows for creating a normal object with a specified prior mean/covariance. Adding observations will update the mean and covariance on this Normal object to account for the new data. Args: DO_THIS Returns: Re...
Add observations to the distribution. This allows for creating a normal object with a specified prior mean/covariance. Adding observations will update the mean and covariance on this Normal object to account for the new data. Residuals
[ "Add", "observations", "to", "the", "distribution", ".", "This", "allows", "for", "creating", "a", "normal", "object", "with", "a", "specified", "prior", "mean", "/", "covariance", ".", "Adding", "observations", "will", "update", "the", "mean", "and", "covaria...
def observe( self, observations: Union[np.ndarray, pd.Series, pd.DataFrame, Dict], return_residuals: bool = False ): self.bust_the_cache()
[ "def", "observe", "(", "self", ",", "observations", ":", "Union", "[", "np", ".", "ndarray", ",", "pd", ".", "Series", ",", "pd", ".", "DataFrame", ",", "Dict", "]", ",", "return_residuals", ":", "bool", "=", "False", ")", ":", "self", ".", "bust_the...
Add observations to the distribution.
[ "Add", "observations", "to", "the", "distribution", "." ]
[ "\"\"\"\n Add observations to the distribution. This allows for creating a normal object\n with a specified prior mean/covariance. Adding observations will update the mean\n and covariance on this Normal object to account for the new data.\n\n Args:\n DO_THIS\n\n Retu...
[ { "param": "self", "type": null }, { "param": "observations", "type": "Union[np.ndarray, pd.Series, pd.DataFrame, Dict]" }, { "param": "return_residuals", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "observations", "type": "Union[np.ndarray, pd.Series, pd.DataFrame, Dict]"...
f5c19c59bfbc5c35d866da9af2b0d950d7e247e1
Edinburgh-Genome-Foundry/CAB
backend/app/views/base.py
[ "MIT" ]
Python
post
<not_specific>
def post(self, request, format=None): """A view to report the progress to the user.""" data = self.serialize(request) job = django_rq.get_queue("default").fetch_job(data.job_id) if job is None: return Response(dict(success=False, error="Unknown job ID.")) job_status =...
A view to report the progress to the user.
A view to report the progress to the user.
[ "A", "view", "to", "report", "the", "progress", "to", "the", "user", "." ]
def post(self, request, format=None): data = self.serialize(request) job = django_rq.get_queue("default").fetch_job(data.job_id) if job is None: return Response(dict(success=False, error="Unknown job ID.")) job_status = job.get_status() success, error = True, "" ...
[ "def", "post", "(", "self", ",", "request", ",", "format", "=", "None", ")", ":", "data", "=", "self", ".", "serialize", "(", "request", ")", "job", "=", "django_rq", ".", "get_queue", "(", "\"default\"", ")", ".", "fetch_job", "(", "data", ".", "job...
A view to report the progress to the user.
[ "A", "view", "to", "report", "the", "progress", "to", "the", "user", "." ]
[ "\"\"\"A view to report the progress to the user.\"\"\"", "# print (job.__dict__)" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "format", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
7a5d41db0b84ea0561a91030ba64b4cd6284d934
semiversus/python-durand
durand/adapters/base.py
[ "MIT" ]
Python
bind
null
def bind(self, subscriptions: Dict[int, Callable]): """ Use subscription dictionary to distribute CAN messages to the according callback :param subscriptions: dictionary for with COB ID as key and callback as value """
Use subscription dictionary to distribute CAN messages to the according callback :param subscriptions: dictionary for with COB ID as key and callback as value
Use subscription dictionary to distribute CAN messages to the according callback
[ "Use", "subscription", "dictionary", "to", "distribute", "CAN", "messages", "to", "the", "according", "callback" ]
def bind(self, subscriptions: Dict[int, Callable]):
[ "def", "bind", "(", "self", ",", "subscriptions", ":", "Dict", "[", "int", ",", "Callable", "]", ")", ":" ]
Use subscription dictionary to distribute CAN messages to the according callback
[ "Use", "subscription", "dictionary", "to", "distribute", "CAN", "messages", "to", "the", "according", "callback" ]
[ "\"\"\" Use subscription dictionary to distribute CAN messages\n to the according callback\n\n :param subscriptions: dictionary for with COB ID as key and callback as\n value\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "subscriptions", "type": "Dict[int, Callable]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "subscriptions", "type": "Dict[int, Callable]", "docstring": "dictio...
7a5d41db0b84ea0561a91030ba64b4cd6284d934
semiversus/python-durand
durand/adapters/base.py
[ "MIT" ]
Python
send
null
def send(self, cob_id: int, msg: bytes): """ sending a CAN message to the adapter :param cob_id: CAN arbitration id :param msg: CAN data bytes """
sending a CAN message to the adapter :param cob_id: CAN arbitration id :param msg: CAN data bytes
sending a CAN message to the adapter
[ "sending", "a", "CAN", "message", "to", "the", "adapter" ]
def send(self, cob_id: int, msg: bytes):
[ "def", "send", "(", "self", ",", "cob_id", ":", "int", ",", "msg", ":", "bytes", ")", ":" ]
sending a CAN message to the adapter
[ "sending", "a", "CAN", "message", "to", "the", "adapter" ]
[ "\"\"\" sending a CAN message to the adapter\n :param cob_id: CAN arbitration id\n :param msg: CAN data bytes\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "cob_id", "type": "int" }, { "param": "msg", "type": "bytes" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cob_id", "type": "int", "docstring": "CAN arbitration id", "d...
6581d3ca6895f2fe44370613688f4e7ccf2f4b0f
olekhov/meshconverter
pgumosru/utils.py
[ "Unlicense" ]
Python
my_get_post
<not_specific>
def my_get_post(f,url, **kwargs): """ Try to GET or POST up to maxtries times. If it fails - raise the exception. Used to counter bogus pgu.mos.ru responses. Some times it does not work for the first (and second) connection. """ maxtries=5 attempt=0 havedata=False #print("request:",ur...
Try to GET or POST up to maxtries times. If it fails - raise the exception. Used to counter bogus pgu.mos.ru responses. Some times it does not work for the first (and second) connection.
Try to GET or POST up to maxtries times. If it fails - raise the exception. Used to counter bogus pgu.mos.ru responses. Some times it does not work for the first (and second) connection.
[ "Try", "to", "GET", "or", "POST", "up", "to", "maxtries", "times", ".", "If", "it", "fails", "-", "raise", "the", "exception", ".", "Used", "to", "counter", "bogus", "pgu", ".", "mos", ".", "ru", "responses", ".", "Some", "times", "it", "does", "not"...
def my_get_post(f,url, **kwargs): maxtries=5 attempt=0 havedata=False while attempt<maxtries: try: r=f(url,allow_redirects=False, **kwargs) return r except Exception as e: print(e) attempt+=1 raise "Can not connect"
[ "def", "my_get_post", "(", "f", ",", "url", ",", "**", "kwargs", ")", ":", "maxtries", "=", "5", "attempt", "=", "0", "havedata", "=", "False", "while", "attempt", "<", "maxtries", ":", "try", ":", "r", "=", "f", "(", "url", ",", "allow_redirects", ...
Try to GET or POST up to maxtries times.
[ "Try", "to", "GET", "or", "POST", "up", "to", "maxtries", "times", "." ]
[ "\"\"\" Try to GET or POST up to maxtries times. \n If it fails - raise the exception.\n\n Used to counter bogus pgu.mos.ru responses. \n Some times it does not work for the first (and second) connection. \"\"\"", "#print(\"request:\",url)" ]
[ { "param": "f", "type": null }, { "param": "url", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": [], ...
eec84805ba196c19ddab6bc200fa148e8f5296b1
ampledata/netatmoaprs
netatmoaprs/util.py
[ "Apache-2.0" ]
Python
c2f
<not_specific>
def c2f(t): """ Converts Celsius Temperature to Fahrenheit Temperature. """ return t * float(1.8000) + float(32.00)
Converts Celsius Temperature to Fahrenheit Temperature.
Converts Celsius Temperature to Fahrenheit Temperature.
[ "Converts", "Celsius", "Temperature", "to", "Fahrenheit", "Temperature", "." ]
def c2f(t): return t * float(1.8000) + float(32.00)
[ "def", "c2f", "(", "t", ")", ":", "return", "t", "*", "float", "(", "1.8000", ")", "+", "float", "(", "32.00", ")" ]
Converts Celsius Temperature to Fahrenheit Temperature.
[ "Converts", "Celsius", "Temperature", "to", "Fahrenheit", "Temperature", "." ]
[ "\"\"\"\n Converts Celsius Temperature to Fahrenheit Temperature.\n \"\"\"" ]
[ { "param": "t", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4aeea4d332e94bef193ffc30327a65d906edf3d6
ampledata/netatmoaprs
netatmoaprs/cmd.py
[ "Apache-2.0" ]
Python
cli
null
def cli(): """Command Line interface for APRS.""" parser = argparse.ArgumentParser() parser.add_argument( '-c', '--callsign', help='callsign', required=True ) parser.add_argument( '-p', '--passcode', help='passcode', required=True ) parser.add_argument( '-u', '--ssi...
Command Line interface for APRS.
Command Line interface for APRS.
[ "Command", "Line", "interface", "for", "APRS", "." ]
def cli(): parser = argparse.ArgumentParser() parser.add_argument( '-c', '--callsign', help='callsign', required=True ) parser.add_argument( '-p', '--passcode', help='passcode', required=True ) parser.add_argument( '-u', '--ssid', help='ssid', default='1' ) parser...
[ "def", "cli", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'-c'", ",", "'--callsign'", ",", "help", "=", "'callsign'", ",", "required", "=", "True", ")", "parser", ".", "add_argument", "(...
Command Line interface for APRS.
[ "Command", "Line", "interface", "for", "APRS", "." ]
[ "\"\"\"Command Line interface for APRS.\"\"\"", "# Netatmo API Params" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e303bafa026fca07c629f29113f2a45edec3780b
sidharthgurbani/tf-faster-rcnn
lib/model/train_val.py
[ "MIT" ]
Python
filter_roidb
<not_specific>
def filter_roidb(roidb): """Remove roidb entries that have no usable RoIs.""" def is_valid(entry): # Valid images have: # (1) At least one foreground RoI OR # (2) At least one background RoI overlaps = entry['max_overlaps'] # find boxes with sufficient overlap fg_inds = np.where(overlap...
Remove roidb entries that have no usable RoIs.
Remove roidb entries that have no usable RoIs.
[ "Remove", "roidb", "entries", "that", "have", "no", "usable", "RoIs", "." ]
def filter_roidb(roidb): def is_valid(entry): overlaps = entry['max_overlaps'] fg_inds = np.where(overlaps >= cfg.TRAIN.FG_THRESH)[0] bg_inds = np.where((overlaps < cfg.TRAIN.BG_THRESH_HI) & (overlaps >= cfg.TRAIN.BG_THRESH_LO))[0] valid = len(fg_inds) > 0 or len(bg_inds) > 0 ...
[ "def", "filter_roidb", "(", "roidb", ")", ":", "def", "is_valid", "(", "entry", ")", ":", "overlaps", "=", "entry", "[", "'max_overlaps'", "]", "fg_inds", "=", "np", ".", "where", "(", "overlaps", ">=", "cfg", ".", "TRAIN", ".", "FG_THRESH", ")", "[", ...
Remove roidb entries that have no usable RoIs.
[ "Remove", "roidb", "entries", "that", "have", "no", "usable", "RoIs", "." ]
[ "\"\"\"Remove roidb entries that have no usable RoIs.\"\"\"", "# Valid images have:", "# (1) At least one foreground RoI OR", "# (2) At least one background RoI", "# find boxes with sufficient overlap", "# Select background RoIs as those within [BG_THRESH_LO, BG_THRESH_HI)", "# image is only valid i...
[ { "param": "roidb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "roidb", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e303bafa026fca07c629f29113f2a45edec3780b
sidharthgurbani/tf-faster-rcnn
lib/model/train_val.py
[ "MIT" ]
Python
train_net
null
def train_net(network, imdb, roidb, valroidb, output_dir, tb_dir, pretrained_model=None, max_iters=40000): """Train a Faster R-CNN network.""" roidb = filter_roidb(roidb) valroidb = filter_roidb(valroidb) tfconfig = tf.ConfigProto(allow_soft_placement=True) tfconfig.gpu_options.al...
Train a Faster R-CNN network.
Train a Faster R-CNN network.
[ "Train", "a", "Faster", "R", "-", "CNN", "network", "." ]
def train_net(network, imdb, roidb, valroidb, output_dir, tb_dir, pretrained_model=None, max_iters=40000): roidb = filter_roidb(roidb) valroidb = filter_roidb(valroidb) tfconfig = tf.ConfigProto(allow_soft_placement=True) tfconfig.gpu_options.allow_growth = True with tf.Session(con...
[ "def", "train_net", "(", "network", ",", "imdb", ",", "roidb", ",", "valroidb", ",", "output_dir", ",", "tb_dir", ",", "pretrained_model", "=", "None", ",", "max_iters", "=", "40000", ")", ":", "roidb", "=", "filter_roidb", "(", "roidb", ")", "valroidb", ...
Train a Faster R-CNN network.
[ "Train", "a", "Faster", "R", "-", "CNN", "network", "." ]
[ "\"\"\"Train a Faster R-CNN network.\"\"\"" ]
[ { "param": "network", "type": null }, { "param": "imdb", "type": null }, { "param": "roidb", "type": null }, { "param": "valroidb", "type": null }, { "param": "output_dir", "type": null }, { "param": "tb_dir", "type": null }, { "param": "pr...
{ "returns": [], "raises": [], "params": [ { "identifier": "network", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imdb", "type": null, "docstring": null, "docstring_tokens"...
dbe5cbc5308c64f7bf7166276ab8bee8c35a391a
sidharthgurbani/tf-faster-rcnn
lib/roi_data_layer/layer.py
[ "MIT" ]
Python
_get_next_minibatch
<not_specific>
def _get_next_minibatch(self): """Return the blobs to be used for the next minibatch. If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a separate process and made available through self._blob_queue. """ db_inds = self._get_next_minibatch_inds() minibatch_db = [self._roidb[i] fo...
Return the blobs to be used for the next minibatch. If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a separate process and made available through self._blob_queue.
Return the blobs to be used for the next minibatch. If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a separate process and made available through self._blob_queue.
[ "Return", "the", "blobs", "to", "be", "used", "for", "the", "next", "minibatch", ".", "If", "cfg", ".", "TRAIN", ".", "USE_PREFETCH", "is", "True", "then", "blobs", "will", "be", "computed", "in", "a", "separate", "process", "and", "made", "available", "...
def _get_next_minibatch(self): db_inds = self._get_next_minibatch_inds() minibatch_db = [self._roidb[i] for i in db_inds] return get_minibatch(minibatch_db, self._num_classes)
[ "def", "_get_next_minibatch", "(", "self", ")", ":", "db_inds", "=", "self", ".", "_get_next_minibatch_inds", "(", ")", "minibatch_db", "=", "[", "self", ".", "_roidb", "[", "i", "]", "for", "i", "in", "db_inds", "]", "return", "get_minibatch", "(", "minib...
Return the blobs to be used for the next minibatch.
[ "Return", "the", "blobs", "to", "be", "used", "for", "the", "next", "minibatch", "." ]
[ "\"\"\"Return the blobs to be used for the next minibatch.\n\n If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a\n separate process and made available through self._blob_queue.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f5949220d027f37c9fb824b7151ec096bb650fb8
sidharthgurbani/tf-faster-rcnn
lib/model/nms_wrapper.py
[ "MIT" ]
Python
nms
<not_specific>
def nms(dets, thresh, force_cpu=False): """Dispatch to either CPU or GPU NMS implementations.""" if dets.shape[0] == 0: return [] if cfg.USE_GPU_NMS and not force_cpu: return gpu_nms(dets, thresh, device_id=0) else: return cpu_nms(dets, thresh)
Dispatch to either CPU or GPU NMS implementations.
Dispatch to either CPU or GPU NMS implementations.
[ "Dispatch", "to", "either", "CPU", "or", "GPU", "NMS", "implementations", "." ]
def nms(dets, thresh, force_cpu=False): if dets.shape[0] == 0: return [] if cfg.USE_GPU_NMS and not force_cpu: return gpu_nms(dets, thresh, device_id=0) else: return cpu_nms(dets, thresh)
[ "def", "nms", "(", "dets", ",", "thresh", ",", "force_cpu", "=", "False", ")", ":", "if", "dets", ".", "shape", "[", "0", "]", "==", "0", ":", "return", "[", "]", "if", "cfg", ".", "USE_GPU_NMS", "and", "not", "force_cpu", ":", "return", "gpu_nms",...
Dispatch to either CPU or GPU NMS implementations.
[ "Dispatch", "to", "either", "CPU", "or", "GPU", "NMS", "implementations", "." ]
[ "\"\"\"Dispatch to either CPU or GPU NMS implementations.\"\"\"" ]
[ { "param": "dets", "type": null }, { "param": "thresh", "type": null }, { "param": "force_cpu", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dets", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "thresh", "type": null, "docstring": null, "docstring_tokens":...
f77a28e542c0da4e8421795cb2d9e8dd22653f0e
sidharthgurbani/tf-faster-rcnn
lib/layer_utils/proposal_target_layer.py
[ "MIT" ]
Python
proposal_target_layer
<not_specific>
def proposal_target_layer(rpn_rois, rpn_scores, gt_boxes, _num_classes): """ Assign object detection proposals to ground-truth targets. Produces proposal classification labels and bounding-box regression targets. """ # Proposal ROIs (0, x1, y1, x2, y2) coming from RPN # (i.e., rpn.proposal_layer.ProposalLa...
Assign object detection proposals to ground-truth targets. Produces proposal classification labels and bounding-box regression targets.
Assign object detection proposals to ground-truth targets. Produces proposal classification labels and bounding-box regression targets.
[ "Assign", "object", "detection", "proposals", "to", "ground", "-", "truth", "targets", ".", "Produces", "proposal", "classification", "labels", "and", "bounding", "-", "box", "regression", "targets", "." ]
def proposal_target_layer(rpn_rois, rpn_scores, gt_boxes, _num_classes): all_rois = rpn_rois all_scores = rpn_scores if cfg.TRAIN.USE_GT: zeros = np.zeros((gt_boxes.shape[0], 1), dtype=gt_boxes.dtype) all_rois = np.vstack( (all_rois, np.hstack((zeros, gt_boxes[:, :-1]))) ) all_scores = np.vs...
[ "def", "proposal_target_layer", "(", "rpn_rois", ",", "rpn_scores", ",", "gt_boxes", ",", "_num_classes", ")", ":", "all_rois", "=", "rpn_rois", "all_scores", "=", "rpn_scores", "if", "cfg", ".", "TRAIN", ".", "USE_GT", ":", "zeros", "=", "np", ".", "zeros",...
Assign object detection proposals to ground-truth targets.
[ "Assign", "object", "detection", "proposals", "to", "ground", "-", "truth", "targets", "." ]
[ "\"\"\"\n Assign object detection proposals to ground-truth targets. Produces proposal\n classification labels and bounding-box regression targets.\n \"\"\"", "# Proposal ROIs (0, x1, y1, x2, y2) coming from RPN", "# (i.e., rpn.proposal_layer.ProposalLayer), or any other source", "# Include ground-truth bo...
[ { "param": "rpn_rois", "type": null }, { "param": "rpn_scores", "type": null }, { "param": "gt_boxes", "type": null }, { "param": "_num_classes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rpn_rois", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rpn_scores", "type": null, "docstring": null, "docstring_...
f77a28e542c0da4e8421795cb2d9e8dd22653f0e
sidharthgurbani/tf-faster-rcnn
lib/layer_utils/proposal_target_layer.py
[ "MIT" ]
Python
_sample_rois
<not_specific>
def _sample_rois(all_rois, all_scores, gt_boxes, fg_rois_per_image, rois_per_image, num_classes): """Generate a random sample of RoIs comprising foreground and background examples. """ # overlaps: (rois x gt_boxes) overlaps = bbox_overlaps( np.ascontiguousarray(all_rois[:, 1:5], dtype=np.float), np.as...
Generate a random sample of RoIs comprising foreground and background examples.
Generate a random sample of RoIs comprising foreground and background examples.
[ "Generate", "a", "random", "sample", "of", "RoIs", "comprising", "foreground", "and", "background", "examples", "." ]
def _sample_rois(all_rois, all_scores, gt_boxes, fg_rois_per_image, rois_per_image, num_classes): overlaps = bbox_overlaps( np.ascontiguousarray(all_rois[:, 1:5], dtype=np.float), np.ascontiguousarray(gt_boxes[:, :4], dtype=np.float)) gt_assignment = overlaps.argmax(axis=1) max_overlaps = overlaps.max(axi...
[ "def", "_sample_rois", "(", "all_rois", ",", "all_scores", ",", "gt_boxes", ",", "fg_rois_per_image", ",", "rois_per_image", ",", "num_classes", ")", ":", "overlaps", "=", "bbox_overlaps", "(", "np", ".", "ascontiguousarray", "(", "all_rois", "[", ":", ",", "1...
Generate a random sample of RoIs comprising foreground and background examples.
[ "Generate", "a", "random", "sample", "of", "RoIs", "comprising", "foreground", "and", "background", "examples", "." ]
[ "\"\"\"Generate a random sample of RoIs comprising foreground and background\n examples.\n \"\"\"", "# overlaps: (rois x gt_boxes)", "# Select foreground RoIs as those with >= FG_THRESH overlap", "# Guard against the case when an image has fewer than fg_rois_per_image", "# Select background RoIs as those ...
[ { "param": "all_rois", "type": null }, { "param": "all_scores", "type": null }, { "param": "gt_boxes", "type": null }, { "param": "fg_rois_per_image", "type": null }, { "param": "rois_per_image", "type": null }, { "param": "num_classes", "type": nu...
{ "returns": [], "raises": [], "params": [ { "identifier": "all_rois", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "all_scores", "type": null, "docstring": null, "docstring_...
44b52e2e7b7e172e289ea07b94dd839a1ee5030b
sidharthgurbani/tf-faster-rcnn
lib/nets/mobilenet_v1.py
[ "MIT" ]
Python
separable_conv2d_same
<not_specific>
def separable_conv2d_same(inputs, kernel_size, stride, rate=1, scope=None): """Strided 2-D separable convolution with 'SAME' padding. Args: inputs: A 4-D tensor of size [batch, height_in, width_in, channels]. kernel_size: An int with the kernel_size of the filters. stride: An integer, the output stride....
Strided 2-D separable convolution with 'SAME' padding. Args: inputs: A 4-D tensor of size [batch, height_in, width_in, channels]. kernel_size: An int with the kernel_size of the filters. stride: An integer, the output stride. rate: An integer, rate for atrous convolution. scope: Scope. Returns: ...
Strided 2-D separable convolution with 'SAME' padding.
[ "Strided", "2", "-", "D", "separable", "convolution", "with", "'", "SAME", "'", "padding", "." ]
def separable_conv2d_same(inputs, kernel_size, stride, rate=1, scope=None): if stride == 1: return slim.separable_conv2d(inputs, None, kernel_size, depth_multiplier=1, stride=1, rate=rate, padding='SAME', scope=scope) else: kernel_size_eff...
[ "def", "separable_conv2d_same", "(", "inputs", ",", "kernel_size", ",", "stride", ",", "rate", "=", "1", ",", "scope", "=", "None", ")", ":", "if", "stride", "==", "1", ":", "return", "slim", ".", "separable_conv2d", "(", "inputs", ",", "None", ",", "k...
Strided 2-D separable convolution with 'SAME' padding.
[ "Strided", "2", "-", "D", "separable", "convolution", "with", "'", "SAME", "'", "padding", "." ]
[ "\"\"\"Strided 2-D separable convolution with 'SAME' padding.\n Args:\n inputs: A 4-D tensor of size [batch, height_in, width_in, channels].\n kernel_size: An int with the kernel_size of the filters.\n stride: An integer, the output stride.\n rate: An integer, rate for atrous convolution.\n scope: S...
[ { "param": "inputs", "type": null }, { "param": "kernel_size", "type": null }, { "param": "stride", "type": null }, { "param": "rate", "type": null }, { "param": "scope", "type": null } ]
{ "returns": [ { "docstring": "A 4-D tensor of size [batch, height_out, width_out, channels] with\nthe convolution output.", "docstring_tokens": [ "A", "4", "-", "D", "tensor", "of", "size", "[", "batch", "height_out", ...
44b52e2e7b7e172e289ea07b94dd839a1ee5030b
sidharthgurbani/tf-faster-rcnn
lib/nets/mobilenet_v1.py
[ "MIT" ]
Python
mobilenet_v1_base
<not_specific>
def mobilenet_v1_base(inputs, conv_defs, starting_layer=0, min_depth=8, depth_multiplier=1.0, output_stride=None, reuse=None, scope=None): """Mobilenet v1. Constr...
Mobilenet v1. Constructs a Mobilenet v1 network from inputs to the given final endpoint. Args: inputs: a tensor of shape [batch_size, height, width, channels]. starting_layer: specifies the current starting layer. For region proposal network it is 0, for region classification it is 12 by default. ...
Mobilenet v1. Constructs a Mobilenet v1 network from inputs to the given final endpoint.
[ "Mobilenet", "v1", ".", "Constructs", "a", "Mobilenet", "v1", "network", "from", "inputs", "to", "the", "given", "final", "endpoint", "." ]
def mobilenet_v1_base(inputs, conv_defs, starting_layer=0, min_depth=8, depth_multiplier=1.0, output_stride=None, reuse=None, scope=None): depth = lambda d: max(int...
[ "def", "mobilenet_v1_base", "(", "inputs", ",", "conv_defs", ",", "starting_layer", "=", "0", ",", "min_depth", "=", "8", ",", "depth_multiplier", "=", "1.0", ",", "output_stride", "=", "None", ",", "reuse", "=", "None", ",", "scope", "=", "None", ")", "...
Mobilenet v1.
[ "Mobilenet", "v1", "." ]
[ "\"\"\"Mobilenet v1.\n Constructs a Mobilenet v1 network from inputs to the given final endpoint.\n Args:\n inputs: a tensor of shape [batch_size, height, width, channels].\n starting_layer: specifies the current starting layer. For region proposal \n network it is 0, for region classification it is 12...
[ { "param": "inputs", "type": null }, { "param": "conv_defs", "type": null }, { "param": "starting_layer", "type": null }, { "param": "min_depth", "type": null }, { "param": "depth_multiplier", "type": null }, { "param": "output_stride", "type": nul...
{ "returns": [ { "docstring": "output tensor corresponding to the final_endpoint.", "docstring_tokens": [ "output", "tensor", "corresponding", "to", "the", "final_endpoint", "." ], "type": "tensor_out" } ], "raises": [ { ...
fd5ca4bb9d87157c6e0b9061e1b7d4391ffd5c91
sidharthgurbani/tf-faster-rcnn
lib/datasets/ds_utils.py
[ "MIT" ]
Python
unique_boxes
<not_specific>
def unique_boxes(boxes, scale=1.0): """Return indices of unique boxes.""" v = np.array([1, 1e3, 1e6, 1e9]) hashes = np.round(boxes * scale).dot(v) _, index = np.unique(hashes, return_index=True) return np.sort(index)
Return indices of unique boxes.
Return indices of unique boxes.
[ "Return", "indices", "of", "unique", "boxes", "." ]
def unique_boxes(boxes, scale=1.0): v = np.array([1, 1e3, 1e6, 1e9]) hashes = np.round(boxes * scale).dot(v) _, index = np.unique(hashes, return_index=True) return np.sort(index)
[ "def", "unique_boxes", "(", "boxes", ",", "scale", "=", "1.0", ")", ":", "v", "=", "np", ".", "array", "(", "[", "1", ",", "1e3", ",", "1e6", ",", "1e9", "]", ")", "hashes", "=", "np", ".", "round", "(", "boxes", "*", "scale", ")", ".", "dot"...
Return indices of unique boxes.
[ "Return", "indices", "of", "unique", "boxes", "." ]
[ "\"\"\"Return indices of unique boxes.\"\"\"" ]
[ { "param": "boxes", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "boxes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scale", "type": null, "docstring": null, "docstring_tokens":...
fd5ca4bb9d87157c6e0b9061e1b7d4391ffd5c91
sidharthgurbani/tf-faster-rcnn
lib/datasets/ds_utils.py
[ "MIT" ]
Python
validate_boxes
null
def validate_boxes(boxes, width=0, height=0): """Check that a set of boxes are valid.""" x1 = boxes[:, 0] y1 = boxes[:, 1] x2 = boxes[:, 2] y2 = boxes[:, 3] assert (x1 >= 0).all() assert (y1 >= 0).all() assert (x2 >= x1).all() assert (y2 >= y1).all() assert (x2 < width).all() assert (y2 < height)....
Check that a set of boxes are valid.
Check that a set of boxes are valid.
[ "Check", "that", "a", "set", "of", "boxes", "are", "valid", "." ]
def validate_boxes(boxes, width=0, height=0): x1 = boxes[:, 0] y1 = boxes[:, 1] x2 = boxes[:, 2] y2 = boxes[:, 3] assert (x1 >= 0).all() assert (y1 >= 0).all() assert (x2 >= x1).all() assert (y2 >= y1).all() assert (x2 < width).all() assert (y2 < height).all()
[ "def", "validate_boxes", "(", "boxes", ",", "width", "=", "0", ",", "height", "=", "0", ")", ":", "x1", "=", "boxes", "[", ":", ",", "0", "]", "y1", "=", "boxes", "[", ":", ",", "1", "]", "x2", "=", "boxes", "[", ":", ",", "2", "]", "y2", ...
Check that a set of boxes are valid.
[ "Check", "that", "a", "set", "of", "boxes", "are", "valid", "." ]
[ "\"\"\"Check that a set of boxes are valid.\"\"\"" ]
[ { "param": "boxes", "type": null }, { "param": "width", "type": null }, { "param": "height", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "boxes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": null, "docstring": null, "docstring_tokens":...
0a7a6e7315c286bd49ee6ccb6f8f8b40e2762f00
sidharthgurbani/tf-faster-rcnn
lib/roi_data_layer/roidb.py
[ "MIT" ]
Python
prepare_roidb
null
def prepare_roidb(imdb): """Enrich the imdb's roidb by adding some derived quantities that are useful for training. This function precomputes the maximum overlap, taken over ground-truth boxes, between each ROI and each ground-truth box. The class with maximum overlap is also recorded. """ roidb = imdb.ro...
Enrich the imdb's roidb by adding some derived quantities that are useful for training. This function precomputes the maximum overlap, taken over ground-truth boxes, between each ROI and each ground-truth box. The class with maximum overlap is also recorded.
Enrich the imdb's roidb by adding some derived quantities that are useful for training. This function precomputes the maximum overlap, taken over ground-truth boxes, between each ROI and each ground-truth box. The class with maximum overlap is also recorded.
[ "Enrich", "the", "imdb", "'", "s", "roidb", "by", "adding", "some", "derived", "quantities", "that", "are", "useful", "for", "training", ".", "This", "function", "precomputes", "the", "maximum", "overlap", "taken", "over", "ground", "-", "truth", "boxes", "b...
def prepare_roidb(imdb): roidb = imdb.roidb if not (imdb.name.startswith('coco')): sizes = [PIL.Image.open(imdb.image_path_at(i)).size for i in range(imdb.num_images)] for i in range(len(imdb.image_index)): roidb[i]['image'] = imdb.image_path_at(i) if not (imdb.name.startswith('coco')): ...
[ "def", "prepare_roidb", "(", "imdb", ")", ":", "roidb", "=", "imdb", ".", "roidb", "if", "not", "(", "imdb", ".", "name", ".", "startswith", "(", "'coco'", ")", ")", ":", "sizes", "=", "[", "PIL", ".", "Image", ".", "open", "(", "imdb", ".", "ima...
Enrich the imdb's roidb by adding some derived quantities that are useful for training.
[ "Enrich", "the", "imdb", "'", "s", "roidb", "by", "adding", "some", "derived", "quantities", "that", "are", "useful", "for", "training", "." ]
[ "\"\"\"Enrich the imdb's roidb by adding some derived quantities that\n are useful for training. This function precomputes the maximum\n overlap, taken over ground-truth boxes, between each ROI and\n each ground-truth box. The class with maximum overlap is also\n recorded.\n \"\"\"", "# need gt_overlaps as a...
[ { "param": "imdb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "imdb", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
22ab5735f024df701b8c789b6590b8fd16c9ff0b
sidharthgurbani/tf-faster-rcnn
lib/layer_utils/anchor_target_layer.py
[ "MIT" ]
Python
anchor_target_layer
<not_specific>
def anchor_target_layer(rpn_cls_score, gt_boxes, im_info, _feat_stride, all_anchors, num_anchors): """Same as the anchor target layer in original Fast/er RCNN """ A = num_anchors total_anchors = all_anchors.shape[0] K = total_anchors / num_anchors # allow boxes to sit over the edge by a small amount _allow...
Same as the anchor target layer in original Fast/er RCNN
Same as the anchor target layer in original Fast/er RCNN
[ "Same", "as", "the", "anchor", "target", "layer", "in", "original", "Fast", "/", "er", "RCNN" ]
def anchor_target_layer(rpn_cls_score, gt_boxes, im_info, _feat_stride, all_anchors, num_anchors): A = num_anchors total_anchors = all_anchors.shape[0] K = total_anchors / num_anchors _allowed_border = 0 height, width = rpn_cls_score.shape[1:3] inds_inside = np.where( (all_anchors[:, 0] >= -_allowed_bor...
[ "def", "anchor_target_layer", "(", "rpn_cls_score", ",", "gt_boxes", ",", "im_info", ",", "_feat_stride", ",", "all_anchors", ",", "num_anchors", ")", ":", "A", "=", "num_anchors", "total_anchors", "=", "all_anchors", ".", "shape", "[", "0", "]", "K", "=", "...
Same as the anchor target layer in original Fast/er RCNN
[ "Same", "as", "the", "anchor", "target", "layer", "in", "original", "Fast", "/", "er", "RCNN" ]
[ "\"\"\"Same as the anchor target layer in original Fast/er RCNN \"\"\"", "# allow boxes to sit over the edge by a small amount", "# map of shape (..., H, W)", "# only keep anchors inside the image", "# width", "# height", "# keep only inside anchors", "# label: 1 is positive, 0 is negative, -1 is dont...
[ { "param": "rpn_cls_score", "type": null }, { "param": "gt_boxes", "type": null }, { "param": "im_info", "type": null }, { "param": "_feat_stride", "type": null }, { "param": "all_anchors", "type": null }, { "param": "num_anchors", "type": null }...
{ "returns": [], "raises": [], "params": [ { "identifier": "rpn_cls_score", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gt_boxes", "type": null, "docstring": null, "docstri...
abcbcaec16884ac766db0cef5daf0386223fa72f
EagleShot/arxiv-sanity-preserver
serve.py
[ "MIT" ]
Python
query_db
<not_specific>
def query_db(query, args=(), one=False): """Queries the database and returns a list of dictionaries.""" cur = g.db.execute(query, args) rv = cur.fetchall() return (rv[0] if rv else None) if one else rv
Queries the database and returns a list of dictionaries.
Queries the database and returns a list of dictionaries.
[ "Queries", "the", "database", "and", "returns", "a", "list", "of", "dictionaries", "." ]
def query_db(query, args=(), one=False): cur = g.db.execute(query, args) rv = cur.fetchall() return (rv[0] if rv else None) if one else rv
[ "def", "query_db", "(", "query", ",", "args", "=", "(", ")", ",", "one", "=", "False", ")", ":", "cur", "=", "g", ".", "db", ".", "execute", "(", "query", ",", "args", ")", "rv", "=", "cur", ".", "fetchall", "(", ")", "return", "(", "rv", "["...
Queries the database and returns a list of dictionaries.
[ "Queries", "the", "database", "and", "returns", "a", "list", "of", "dictionaries", "." ]
[ "\"\"\"Queries the database and returns a list of dictionaries.\"\"\"" ]
[ { "param": "query", "type": null }, { "param": "args", "type": null }, { "param": "one", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "query", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": ...
abcbcaec16884ac766db0cef5daf0386223fa72f
EagleShot/arxiv-sanity-preserver
serve.py
[ "MIT" ]
Python
discuss
<not_specific>
def discuss(): """ return discussion related to a paper """ pid = request.args.get("id", "") # paper id of paper we wish to discuss papers = [db[pid]] if pid in db else [] # fetch the comments comms_cursor = comments.find({"pid": pid}).sort( [("time_posted", pymongo.DESCENDING)] ) ...
return discussion related to a paper
return discussion related to a paper
[ "return", "discussion", "related", "to", "a", "paper" ]
def discuss(): pid = request.args.get("id", "") papers = [db[pid]] if pid in db else [] comms_cursor = comments.find({"pid": pid}).sort( [("time_posted", pymongo.DESCENDING)] ) comms = list(comms_cursor) for c in comms: c["_id"] = str(c["_id"]) tag_counts = [] for c in ...
[ "def", "discuss", "(", ")", ":", "pid", "=", "request", ".", "args", ".", "get", "(", "\"id\"", ",", "\"\"", ")", "papers", "=", "[", "db", "[", "pid", "]", "]", "if", "pid", "in", "db", "else", "[", "]", "comms_cursor", "=", "comments", ".", "...
return discussion related to a paper
[ "return", "discussion", "related", "to", "a", "paper" ]
[ "\"\"\" return discussion related to a paper \"\"\"", "# paper id of paper we wish to discuss", "# fetch the comments", "# have to convert these to strs from ObjectId, and backwards later http://api.mongodb.com/python/current/tutorial.html", "# fetch the counts for all tags", "# and render" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
abcbcaec16884ac766db0cef5daf0386223fa72f
EagleShot/arxiv-sanity-preserver
serve.py
[ "MIT" ]
Python
recommend
<not_specific>
def recommend(): """ return user's svm sorted list """ ttstr = request.args.get("timefilter", "week") # default is week vstr = request.args.get("vfilter", "all") # default is all (no filter) legend = {"day": 1, "3days": 3, "week": 7, "month": 30, "year": 365} tt = legend.get(ttstr, None) paper...
return user's svm sorted list
return user's svm sorted list
[ "return", "user", "'", "s", "svm", "sorted", "list" ]
def recommend(): ttstr = request.args.get("timefilter", "week") vstr = request.args.get("vfilter", "all") legend = {"day": 1, "3days": 3, "week": 7, "month": 30, "year": 365} tt = legend.get(ttstr, None) papers = papers_from_svm(recent_days=tt) papers = papers_filter_version(papers, vstr) ...
[ "def", "recommend", "(", ")", ":", "ttstr", "=", "request", ".", "args", ".", "get", "(", "\"timefilter\"", ",", "\"week\"", ")", "vstr", "=", "request", ".", "args", ".", "get", "(", "\"vfilter\"", ",", "\"all\"", ")", "legend", "=", "{", "\"day\"", ...
return user's svm sorted list
[ "return", "user", "'", "s", "svm", "sorted", "list" ]
[ "\"\"\" return user's svm sorted list \"\"\"", "# default is week", "# default is all (no filter)" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
abcbcaec16884ac766db0cef5daf0386223fa72f
EagleShot/arxiv-sanity-preserver
serve.py
[ "MIT" ]
Python
comment
<not_specific>
def comment(): """ user wants to post a comment """ anon = int(request.form["anon"]) if g.user and (not anon): username = get_username(session["user_id"]) else: # generate a unique username if user wants to be anon, or user not logged in. username = "anon-%s-%s" % (str(int(time....
user wants to post a comment
user wants to post a comment
[ "user", "wants", "to", "post", "a", "comment" ]
def comment(): anon = int(request.form["anon"]) if g.user and (not anon): username = get_username(session["user_id"]) else: username = "anon-%s-%s" % (str(int(time.time())), str(randrange(1000))) try: pid = request.form["pid"] if not pid in db: raise Exception...
[ "def", "comment", "(", ")", ":", "anon", "=", "int", "(", "request", ".", "form", "[", "\"anon\"", "]", ")", "if", "g", ".", "user", "and", "(", "not", "anon", ")", ":", "username", "=", "get_username", "(", "session", "[", "\"user_id\"", "]", ")",...
user wants to post a comment
[ "user", "wants", "to", "post", "a", "comment" ]
[ "\"\"\" user wants to post a comment \"\"\"", "# generate a unique username if user wants to be anon, or user not logged in.", "# process the raw pid and validate it, etc", "# most recent version of this paper", "# create the entry", "# raw pid with no version, for search convenience", "# version as int...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
abcbcaec16884ac766db0cef5daf0386223fa72f
EagleShot/arxiv-sanity-preserver
serve.py
[ "MIT" ]
Python
review
<not_specific>
def review(): """ user wants to toggle a paper in his library """ # make sure user is logged in if not g.user: # fail... (not logged in). JS should prevent from us getting here. return "NO" idvv = request.form["pid"] # includes version if not isvalidid(idvv): print("paper ...
user wants to toggle a paper in his library
user wants to toggle a paper in his library
[ "user", "wants", "to", "toggle", "a", "paper", "in", "his", "library" ]
def review(): if not g.user: return "NO" idvv = request.form["pid"] if not isvalidid(idvv): print("paper id: " + idvv) print("bad paper") return "NO" pid = strip_version(idvv) if not pid in db: return "NO" uid = session["user_id"] record = quer...
[ "def", "review", "(", ")", ":", "if", "not", "g", ".", "user", ":", "return", "\"NO\"", "idvv", "=", "request", ".", "form", "[", "\"pid\"", "]", "if", "not", "isvalidid", "(", "idvv", ")", ":", "print", "(", "\"paper id: \"", "+", "idvv", ")", "pr...
user wants to toggle a paper in his library
[ "user", "wants", "to", "toggle", "a", "paper", "in", "his", "library" ]
[ "\"\"\" user wants to toggle a paper in his library \"\"\"", "# make sure user is logged in", "# fail... (not logged in). JS should prevent from us getting here.", "# includes version", "# fail, malformed id. weird.", "# we don't know this paper. wat", "# id of logged in user", "# check this user alre...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a1f9a3c2832953c6b6127e4aec146f4657a3ca41
jarq6c/NWM_RouteLinks
scripts/make_csv.py
[ "MIT" ]
Python
make_csv
None
def make_csv( idir: str, odir: str ) -> None: """Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters ---------- idir: str Input directory containing Routelink files. odir: str Output directory to save CSV files. Returns ...
Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters ---------- idir: str Input directory containing Routelink files. odir: str Output directory to save CSV files. Returns ------- None
Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters str Input directory containing Routelink files. odir: str Output directory to save CSV files. Returns None
[ "Process", "a", "directory", "of", "NetCDF", "RouteLink", "files", "to", "their", "CSV", "equivalents", ".", "Parameters", "str", "Input", "directory", "containing", "Routelink", "files", ".", "odir", ":", "str", "Output", "directory", "to", "save", "CSV", "fi...
def make_csv( idir: str, odir: str ) -> None: file_list = Path(idir).glob("*.nc") odir = Path(odir) odir.mkdir(exist_ok=True, parents=True) for ifile in file_list: ds = xr.open_dataset(ifile) df = ds.to_dataframe() no_gage = b' ' df = df[df.gages...
[ "def", "make_csv", "(", "idir", ":", "str", ",", "odir", ":", "str", ")", "->", "None", ":", "file_list", "=", "Path", "(", "idir", ")", ".", "glob", "(", "\"*.nc\"", ")", "odir", "=", "Path", "(", "odir", ")", "odir", ".", "mkdir", "(", "exist_o...
Process a directory of NetCDF RouteLink files to their CSV equivalents.
[ "Process", "a", "directory", "of", "NetCDF", "RouteLink", "files", "to", "their", "CSV", "equivalents", "." ]
[ "\"\"\"Process a directory of NetCDF RouteLink files to their CSV equivalents.\n \n Parameters\n ----------\n idir: str\n Input directory containing Routelink files.\n odir: str\n Output directory to save CSV files.\n \n Returns\n -------\n None\n \"\"\"", "# Get li...
[ { "param": "idir", "type": "str" }, { "param": "odir", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idir", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "odir", "type": "str", "docstring": null, "docstring_tokens":...
265c1852aa517519923a9242af9072b1b8831cdc
jarq6c/NWM_RouteLinks
scripts/make_hdf.py
[ "MIT" ]
Python
make_hdf
None
def make_hdf( idir: str, ofile: str ) -> None: """Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters ---------- idir: str Input directory containing Routelink files in CSV format. ofile: str Output HDF5 file to store pandas.DataFrame ...
Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters ---------- idir: str Input directory containing Routelink files in CSV format. ofile: str Output HDF5 file to store pandas.DataFrame Returns ------- None
Process a directory of NetCDF RouteLink files to their CSV equivalents. Parameters str Input directory containing Routelink files in CSV format. ofile: str Output HDF5 file to store pandas.DataFrame Returns None
[ "Process", "a", "directory", "of", "NetCDF", "RouteLink", "files", "to", "their", "CSV", "equivalents", ".", "Parameters", "str", "Input", "directory", "containing", "Routelink", "files", "in", "CSV", "format", ".", "ofile", ":", "str", "Output", "HDF5", "file...
def make_hdf( idir: str, ofile: str ) -> None: file_list = Path(idir).glob("*.csv") dfs = [] for ifile in file_list: df = pd.read_csv(ifile, comment="#", dtype={"usgs_site_code": str}, parse_dates=["time"]) dfs.append(df) data = pd.concat(dfs, ignore_index=True) ...
[ "def", "make_hdf", "(", "idir", ":", "str", ",", "ofile", ":", "str", ")", "->", "None", ":", "file_list", "=", "Path", "(", "idir", ")", ".", "glob", "(", "\"*.csv\"", ")", "dfs", "=", "[", "]", "for", "ifile", "in", "file_list", ":", "df", "=",...
Process a directory of NetCDF RouteLink files to their CSV equivalents.
[ "Process", "a", "directory", "of", "NetCDF", "RouteLink", "files", "to", "their", "CSV", "equivalents", "." ]
[ "\"\"\"Process a directory of NetCDF RouteLink files to their CSV equivalents.\n \n Parameters\n ----------\n idir: str\n Input directory containing Routelink files in CSV format.\n ofile: str\n Output HDF5 file to store pandas.DataFrame\n \n Returns\n -------\n None\n ...
[ { "param": "idir", "type": "str" }, { "param": "ofile", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "idir", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ofile", "type": "str", "docstring": null, "docstring_tokens"...
7a344f7c545b9fd79c664f8ce4d7db3b8ca2b1f5
jarq6c/NWM_RouteLinks
scripts/retrieve_netcdf_files.py
[ "MIT" ]
Python
retrieve
None
def retrieve( files: str, output: str ) -> None: """Download a list of files to an output directory. Parameters ---------- files: str List of file URLs, one per line. output: str Download directory where all files will be saved. Returns ------- N...
Download a list of files to an output directory. Parameters ---------- files: str List of file URLs, one per line. output: str Download directory where all files will be saved. Returns ------- None
Download a list of files to an output directory. Parameters str List of file URLs, one per line. output: str Download directory where all files will be saved. Returns None
[ "Download", "a", "list", "of", "files", "to", "an", "output", "directory", ".", "Parameters", "str", "List", "of", "file", "URLs", "one", "per", "line", ".", "output", ":", "str", "Download", "directory", "where", "all", "files", "will", "be", "saved", "...
def retrieve( files: str, output: str ) -> None: with Path(files).open('r') as fi: urls = [line.strip() for line in fi] odir = Path(output) odir.mkdir(exist_ok=True, parents=True) for url in urls: ofile = odir / url.split("/")[-1] download(url, ofile)
[ "def", "retrieve", "(", "files", ":", "str", ",", "output", ":", "str", ")", "->", "None", ":", "with", "Path", "(", "files", ")", ".", "open", "(", "'r'", ")", "as", "fi", ":", "urls", "=", "[", "line", ".", "strip", "(", ")", "for", "line", ...
Download a list of files to an output directory.
[ "Download", "a", "list", "of", "files", "to", "an", "output", "directory", "." ]
[ "\"\"\"Download a list of files to an output directory.\n \n Parameters\n ----------\n files: str\n List of file URLs, one per line.\n output: str\n Download directory where all files will be saved.\n \n Returns\n -------\n None\n \"\"\"", "# Get list of URLs", "#...
[ { "param": "files", "type": "str" }, { "param": "output", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "files", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output", "type": "str", "docstring": null, "docstring_token...
00e272391b743c58e801dc43c3f3b924687cf498
mhanus/GOAT
parameters_processing.py
[ "MIT" ]
Python
load_algebraic_solver_parameters
<not_specific>
def load_algebraic_solver_parameters(algebraic_solver_params_file): """ Load PETSC / SLEPc parameters from file. :param str algebraic_solver_params_file: Path to the file with the parameters. :return: String that can be processed by Dolfin's parameters system. :rtype: str """ alg_solver_args = "" if...
Load PETSC / SLEPc parameters from file. :param str algebraic_solver_params_file: Path to the file with the parameters. :return: String that can be processed by Dolfin's parameters system. :rtype: str
Load PETSC / SLEPc parameters from file.
[ "Load", "PETSC", "/", "SLEPc", "parameters", "from", "file", "." ]
def load_algebraic_solver_parameters(algebraic_solver_params_file): alg_solver_args = "" if algebraic_solver_params_file: try: with open (algebraic_solver_params_file, "r") as algebraic_solver_params_file: for l in algebraic_solver_params_file: s = l.strip().split('#')[0] if s:...
[ "def", "load_algebraic_solver_parameters", "(", "algebraic_solver_params_file", ")", ":", "alg_solver_args", "=", "\"\"", "if", "algebraic_solver_params_file", ":", "try", ":", "with", "open", "(", "algebraic_solver_params_file", ",", "\"r\"", ")", "as", "algebraic_solver...
Load PETSC / SLEPc parameters from file.
[ "Load", "PETSC", "/", "SLEPc", "parameters", "from", "file", "." ]
[ "\"\"\"\n Load PETSC / SLEPc parameters from file.\n\n :param str algebraic_solver_params_file: Path to the file with the parameters.\n :return: String that can be processed by Dolfin's parameters system.\n :rtype: str\n \"\"\"" ]
[ { "param": "algebraic_solver_params_file", "type": null } ]
{ "returns": [ { "docstring": "String that can be processed by Dolfin's parameters system.", "docstring_tokens": [ "String", "that", "can", "be", "processed", "by", "Dolfin", "'", "s", "parameters", "system", ...
00e272391b743c58e801dc43c3f3b924687cf498
mhanus/GOAT
parameters_processing.py
[ "MIT" ]
Python
load_olver_parameters
<not_specific>
def load_olver_parameters(solver_params_file): """ Load coupled solver parameters from file. :param str solver_params_file: Path to the file with the parameters. :return: String that can be processed by Dolfin's parameters system. :rtype: str """ cpl_solver_args = "" if solver_params_file: try: ...
Load coupled solver parameters from file. :param str solver_params_file: Path to the file with the parameters. :return: String that can be processed by Dolfin's parameters system. :rtype: str
Load coupled solver parameters from file.
[ "Load", "coupled", "solver", "parameters", "from", "file", "." ]
def load_olver_parameters(solver_params_file): cpl_solver_args = "" if solver_params_file: try: with open (solver_params_file, "r") as coupled_solver_params_file: modules = deque() for l in coupled_solver_params_file: s = l.strip().split('#')[0] if s: for i,...
[ "def", "load_olver_parameters", "(", "solver_params_file", ")", ":", "cpl_solver_args", "=", "\"\"", "if", "solver_params_file", ":", "try", ":", "with", "open", "(", "solver_params_file", ",", "\"r\"", ")", "as", "coupled_solver_params_file", ":", "modules", "=", ...
Load coupled solver parameters from file.
[ "Load", "coupled", "solver", "parameters", "from", "file", "." ]
[ "\"\"\"\n Load coupled solver parameters from file.\n\n :param str solver_params_file: Path to the file with the parameters.\n :return: String that can be processed by Dolfin's parameters system.\n :rtype: str\n \"\"\"", "# Find submodule level", "# Get module name", "# Add it to the appropriate level i...
[ { "param": "solver_params_file", "type": null } ]
{ "returns": [ { "docstring": "String that can be processed by Dolfin's parameters system.", "docstring_tokens": [ "String", "that", "can", "be", "processed", "by", "Dolfin", "'", "s", "parameters", "system", ...
d8823d76968705120af86abb82cc0db3e9657245
mhanus/GOAT
problem_data.py
[ "MIT" ]
Python
parse_axial_data
<not_specific>
def parse_axial_data(self, lines): """ Parse data defining axial layers. :param list lines: list of lines to be parsed :return: index of the last processed line """ for li, line in enumerate(lines): if line.startswith('*'): continue data = line.replace(',', ' ').replace(';'...
Parse data defining axial layers. :param list lines: list of lines to be parsed :return: index of the last processed line
Parse data defining axial layers.
[ "Parse", "data", "defining", "axial", "layers", "." ]
def parse_axial_data(self, lines): for li, line in enumerate(lines): if line.startswith('*'): continue data = line.replace(',', ' ').replace(';', ' ').split() if len(data) != 3: continue try: data[0:2] = map(float, data[0:2]) data[2] = int(data[2]) excep...
[ "def", "parse_axial_data", "(", "self", ",", "lines", ")", ":", "for", "li", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "line", ".", "startswith", "(", "'*'", ")", ":", "continue", "data", "=", "line", ".", "replace", "(", "','", ...
Parse data defining axial layers.
[ "Parse", "data", "defining", "axial", "layers", "." ]
[ "\"\"\"\n Parse data defining axial layers.\n\n :param list lines: list of lines to be parsed\n :return: index of the last processed line\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "lines", "type": null } ]
{ "returns": [ { "docstring": "index of the last processed line", "docstring_tokens": [ "index", "of", "the", "last", "processed", "line" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type":...
f6ee601ce39b7f09abf9e5d93460777b5fe8cf21
mhanus/GOAT
flux_modules/flux_module.py
[ "MIT" ]
Python
coo_rep_on_zero
<not_specific>
def coo_rep_on_zero(A, rows_glob=None, cols_glob=None, vals_glob=None, sym=False): """ COO representation of matrix A on rank 0. :return: rank 0: rows, cols, vals rank 1,2,... : None, None, None :rtype: (ndarray, ndarray, ndarray) """ timer = Timer("COO representation") # noinspe...
COO representation of matrix A on rank 0. :return: rank 0: rows, cols, vals rank 1,2,... : None, None, None :rtype: (ndarray, ndarray, ndarray)
COO representation of matrix A on rank 0.
[ "COO", "representation", "of", "matrix", "A", "on", "rank", "0", "." ]
def coo_rep_on_zero(A, rows_glob=None, cols_glob=None, vals_glob=None, sym=False): timer = Timer("COO representation") try: Acomp = PETScMatrix() A.copy().compressed(Acomp) except: Acomp = A COO = backend_ext_module.COO(Acomp) return __coo_rep_on_zero_internal(COO, rows_glob, cols_glob, vals_...
[ "def", "coo_rep_on_zero", "(", "A", ",", "rows_glob", "=", "None", ",", "cols_glob", "=", "None", ",", "vals_glob", "=", "None", ",", "sym", "=", "False", ")", ":", "timer", "=", "Timer", "(", "\"COO representation\"", ")", "try", ":", "Acomp", "=", "P...
COO representation of matrix A on rank 0.
[ "COO", "representation", "of", "matrix", "A", "on", "rank", "0", "." ]
[ "\"\"\" COO representation of matrix A on rank 0.\n\n :return:\n rank 0: rows, cols, vals\n rank 1,2,... : None, None, None\n :rtype: (ndarray, ndarray, ndarray)\n \"\"\"", "# noinspection PyBroadException", "# DOLFIN 1.4+", "# Don't compress" ]
[ { "param": "A", "type": null }, { "param": "rows_glob", "type": null }, { "param": "cols_glob", "type": null }, { "param": "vals_glob", "type": null }, { "param": "sym", "type": null } ]
{ "returns": [ { "docstring": "rank 0: rows, cols, vals\nrank 1,2,...", "docstring_tokens": [ "rank", "0", ":", "rows", "cols", "vals", "rank", "1", "2", "..." ], "type": "(ndarray, ndarray, ndarray)" ...
f6ee601ce39b7f09abf9e5d93460777b5fe8cf21
mhanus/GOAT
flux_modules/flux_module.py
[ "MIT" ]
Python
solve
null
def solve(self, it=0): """ Pick the appropriate solver for current problem (eigen/fixed-source) and solve the problem (i.e., update solution vector and possibly the eigenvalue ). """ self.assemble_algebraic_system() self.save_algebraic_system(it) if self.eigenproblem: self.solve_k...
Pick the appropriate solver for current problem (eigen/fixed-source) and solve the problem (i.e., update solution vector and possibly the eigenvalue ).
Pick the appropriate solver for current problem (eigen/fixed-source) and solve the problem .
[ "Pick", "the", "appropriate", "solver", "for", "current", "problem", "(", "eigen", "/", "fixed", "-", "source", ")", "and", "solve", "the", "problem", "." ]
def solve(self, it=0): self.assemble_algebraic_system() self.save_algebraic_system(it) if self.eigenproblem: self.solve_keff(it) else: self.solve_fixed_source(it) self.up_to_date = {k : False for k in self.up_to_date.iterkeys()}
[ "def", "solve", "(", "self", ",", "it", "=", "0", ")", ":", "self", ".", "assemble_algebraic_system", "(", ")", "self", ".", "save_algebraic_system", "(", "it", ")", "if", "self", ".", "eigenproblem", ":", "self", ".", "solve_keff", "(", "it", ")", "el...
Pick the appropriate solver for current problem (eigen/fixed-source) and solve the problem (i.e., update solution vector and possibly the eigenvalue ).
[ "Pick", "the", "appropriate", "solver", "for", "current", "problem", "(", "eigen", "/", "fixed", "-", "source", ")", "and", "solve", "the", "problem", "(", "i", ".", "e", ".", "update", "solution", "vector", "and", "possibly", "the", "eigenvalue", ")", "...
[ "\"\"\"\n Pick the appropriate solver for current problem (eigen/fixed-source) and solve the problem (i.e., update solution\n vector and possibly the eigenvalue\n ).\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "it", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "it", "type": null, "docstring": null, "docstring_tokens": [],...
f6ee601ce39b7f09abf9e5d93460777b5fe8cf21
mhanus/GOAT
flux_modules/flux_module.py
[ "MIT" ]
Python
calculate_cell_reaction_rate
<not_specific>
def calculate_cell_reaction_rate(self, reaction_xs, rr_vect=None, return_xs_arrays=False): """ Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation. Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh. :param str ...
Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation. Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh. :param str reaction_xs: Reaction cross-section id. :param ndarray rr_vect: (optional) Output vector. If n...
Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation. Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.
[ "Calculates", "cell", "-", "integrated", "reaction", "rate", "and", "optionally", "returns", "the", "xs", "'", "s", "needed", "for", "the", "calculation", ".", "Note", "that", "the", "array", "is", "ordered", "by", "the", "associated", "DG", "(", "0", ")",...
def calculate_cell_reaction_rate(self, reaction_xs, rr_vect=None, return_xs_arrays=False): if reaction_xs not in self.PD.used_xs: warning("Attempted to calculate cell-wise reaction rate for reaction without loaded cross-section (skipping).") return if self.verb > 1: print0(self.print_prefix + "Calcu...
[ "def", "calculate_cell_reaction_rate", "(", "self", ",", "reaction_xs", ",", "rr_vect", "=", "None", ",", "return_xs_arrays", "=", "False", ")", ":", "if", "reaction_xs", "not", "in", "self", ".", "PD", ".", "used_xs", ":", "warning", "(", "\"Attempted to calc...
Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.
[ "Calculates", "cell", "-", "integrated", "reaction", "rate", "and", "optionally", "returns", "the", "xs", "'", "s", "needed", "for", "the", "calculation", "." ]
[ "\"\"\"\n Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.\n\n Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.\n\n :param str reaction_xs: Reaction cross-section id.\n :param ndarray rr_vect: (optional) Ou...
[ { "param": "self", "type": null }, { "param": "reaction_xs", "type": null }, { "param": "rr_vect", "type": null }, { "param": "return_xs_arrays", "type": null } ]
{ "returns": [ { "docstring": "List with xs value arrays for each group if `return_xs_arrays == True`, None otherwise", "docstring_tokens": [ "List", "with", "xs", "value", "arrays", "for", "each", "group", "if", "`", ...
0eb3e57b974ea10b20aacc68e7a76f61761515f3
mhanus/GOAT
discretization_modules/generic_discretization.py
[ "MIT" ]
Python
__create_cell_dof_mapping
null
def __create_cell_dof_mapping(self, dofmap): """ Generate cell -> dof mapping for all cells of current partition. Note: in DG(0) space, there is one dof per element and no ghost cells. :param GenericDofMap dofmap: DG(0) dofmap """ if self.verb > 2: print0("Constructing cell -> dof mapping") ...
Generate cell -> dof mapping for all cells of current partition. Note: in DG(0) space, there is one dof per element and no ghost cells. :param GenericDofMap dofmap: DG(0) dofmap
Generate cell -> dof mapping for all cells of current partition. Note: in DG(0) space, there is one dof per element and no ghost cells.
[ "Generate", "cell", "-", ">", "dof", "mapping", "for", "all", "cells", "of", "current", "partition", ".", "Note", ":", "in", "DG", "(", "0", ")", "space", "there", "is", "one", "dof", "per", "element", "and", "no", "ghost", "cells", "." ]
def __create_cell_dof_mapping(self, dofmap): if self.verb > 2: print0("Constructing cell -> dof mapping") timer = Timer("DD: Cell->dof construction") code = \ ''' #include <dolfin/mesh/Cell.h> namespace dolfin { void fill_in(Array<int>& local_cell_dof_map, const Mesh& mesh, con...
[ "def", "__create_cell_dof_mapping", "(", "self", ",", "dofmap", ")", ":", "if", "self", ".", "verb", ">", "2", ":", "print0", "(", "\"Constructing cell -> dof mapping\"", ")", "timer", "=", "Timer", "(", "\"DD: Cell->dof construction\"", ")", "code", "=", "'''\n...
Generate cell -> dof mapping for all cells of current partition.
[ "Generate", "cell", "-", ">", "dof", "mapping", "for", "all", "cells", "of", "current", "partition", "." ]
[ "\"\"\"\n Generate cell -> dof mapping for all cells of current partition.\n Note: in DG(0) space, there is one dof per element and no ghost cells.\n\n :param GenericDofMap dofmap: DG(0) dofmap\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dofmap", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dofmap", "type": null, "docstring": null, "docstring_tokens":...
0eb3e57b974ea10b20aacc68e7a76f61761515f3
mhanus/GOAT
discretization_modules/generic_discretization.py
[ "MIT" ]
Python
__create_cell_layers_mapping
null
def __create_cell_layers_mapping(self): """ Generate a cell -> axial layer mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh. """ if self.verb > 2: print0("Constructing cell -> layer mapping") timer = Timer("DD:...
Generate a cell -> axial layer mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh.
Generate a cell -> axial layer mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh.
[ "Generate", "a", "cell", "-", ">", "axial", "layer", "mapping", "for", "all", "cells", "of", "current", "partition", ".", "Note", "that", "keys", "are", "ordered", "by", "the", "associated", "DG", "(", "0", ")", "dof", "not", "by", "the", "cell", "inde...
def __create_cell_layers_mapping(self): if self.verb > 2: print0("Constructing cell -> layer mapping") timer = Timer("DD: Cell->layer construction") code = \ ''' #include <dolfin/mesh/Cell.h> namespace dolfin { void fill_in(Array<int>& local_cell_layers, co...
[ "def", "__create_cell_layers_mapping", "(", "self", ")", ":", "if", "self", ".", "verb", ">", "2", ":", "print0", "(", "\"Constructing cell -> layer mapping\"", ")", "timer", "=", "Timer", "(", "\"DD: Cell->layer construction\"", ")", "code", "=", "'''\n #inclu...
Generate a cell -> axial layer mapping for all cells of current partition.
[ "Generate", "a", "cell", "-", ">", "axial", "layer", "mapping", "for", "all", "cells", "of", "current", "partition", "." ]
[ "\"\"\"\n Generate a cell -> axial layer mapping for all cells of current partition. Note that keys are ordered by the\n associated DG(0) dof, not by the cell index in the mesh.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0eb3e57b974ea10b20aacc68e7a76f61761515f3
mhanus/GOAT
discretization_modules/generic_discretization.py
[ "MIT" ]
Python
__create_cell_vol_mapping
null
def __create_cell_vol_mapping(self): """ Generate cell -> volume mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh. This map is required for calculating various densities from total region integrals (like cell power den...
Generate cell -> volume mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh. This map is required for calculating various densities from total region integrals (like cell power densities from cell-integrated powers). ...
Generate cell -> volume mapping for all cells of current partition. Note that keys are ordered by the associated DG(0) dof, not by the cell index in the mesh. This map is required for calculating various densities from total region integrals (like cell power densities from cell-integrated powers).
[ "Generate", "cell", "-", ">", "volume", "mapping", "for", "all", "cells", "of", "current", "partition", ".", "Note", "that", "keys", "are", "ordered", "by", "the", "associated", "DG", "(", "0", ")", "dof", "not", "by", "the", "cell", "index", "in", "th...
def __create_cell_vol_mapping(self): if self.verb > 2: print0("Constructing cell -> volume mapping") timer = Timer("DD: Cell->vol construction") code = \ ''' #include <dolfin/mesh/Cell.h> namespace dolfin { void fill_in(Array<double>& cell_vols, const Mesh& mesh, const Array<in...
[ "def", "__create_cell_vol_mapping", "(", "self", ")", ":", "if", "self", ".", "verb", ">", "2", ":", "print0", "(", "\"Constructing cell -> volume mapping\"", ")", "timer", "=", "Timer", "(", "\"DD: Cell->vol construction\"", ")", "code", "=", "'''\n #include <...
Generate cell -> volume mapping for all cells of current partition.
[ "Generate", "cell", "-", ">", "volume", "mapping", "for", "all", "cells", "of", "current", "partition", "." ]
[ "\"\"\"\n Generate cell -> volume mapping for all cells of current partition. Note that keys are ordered by the\n associated DG(0) dof, not by the cell index in the mesh.\n\n This map is required for calculating various densities from total region integrals (like cell power densities from\n cell-integra...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
87eb99a3ea5b7cbf967b890f2c7337b7bfda64c4
OmidSaj/HyDRA
utils/UtilLibs_W.py
[ "MIT" ]
Python
delta
<not_specific>
def delta(feat, N): """Compute delta features from a feature vector sequence. :param feat: A numpy array of size (NUMFRAMES by number of features) containing features. Each row holds 1 feature vector. :param N: For each frame, calculate delta features based on preceding and following N frames :returns: ...
Compute delta features from a feature vector sequence. :param feat: A numpy array of size (NUMFRAMES by number of features) containing features. Each row holds 1 feature vector. :param N: For each frame, calculate delta features based on preceding and following N frames :returns: A numpy array of size (NUMF...
Compute delta features from a feature vector sequence.
[ "Compute", "delta", "features", "from", "a", "feature", "vector", "sequence", "." ]
def delta(feat, N): if N < 1: raise ValueError('N must be an integer >= 1') NUMFRAMES = len(feat) denominator = 2 * sum([i**2 for i in range(1, N+1)]) delta_feat = np.empty_like(feat) padded = np.pad(feat, ((N, N), (0, 0)), mode='edge') for t in range(NUMFRAMES): delta_feat[t]...
[ "def", "delta", "(", "feat", ",", "N", ")", ":", "if", "N", "<", "1", ":", "raise", "ValueError", "(", "'N must be an integer >= 1'", ")", "NUMFRAMES", "=", "len", "(", "feat", ")", "denominator", "=", "2", "*", "sum", "(", "[", "i", "**", "2", "fo...
Compute delta features from a feature vector sequence.
[ "Compute", "delta", "features", "from", "a", "feature", "vector", "sequence", "." ]
[ "\"\"\"Compute delta features from a feature vector sequence.\n :param feat: A numpy array of size (NUMFRAMES by number of features) containing features. Each row holds 1 feature vector.\n :param N: For each frame, calculate delta features based on preceding and following N frames\n :returns: A numpy array...
[ { "param": "feat", "type": null }, { "param": "N", "type": null } ]
{ "returns": [ { "docstring": "A numpy array of size (NUMFRAMES by number of features) containing delta features. Each row holds 1 delta feature vector.", "docstring_tokens": [ "A", "numpy", "array", "of", "size", "(", "NUMFRAMES", "by", ...
f94d34b859be64e1026e17312ad31dfc63872678
zjohn77/corpus4classify
corpus4classify/bbcnews/__init__.py
[ "MIT" ]
Python
extract_data
<not_specific>
def extract_data(): '''Go to the dir holding all the data; index the sub-dir names; pack all files in each sub-dir into a list. Finally, put the lists in a dict keyed by the sub-dir names. ''' folders = DATA_LOC.iterdir() return {folder.stem: __files2list(folder.iterdir()) for folder in folders}
Go to the dir holding all the data; index the sub-dir names; pack all files in each sub-dir into a list. Finally, put the lists in a dict keyed by the sub-dir names.
Go to the dir holding all the data; index the sub-dir names; pack all files in each sub-dir into a list. Finally, put the lists in a dict keyed by the sub-dir names.
[ "Go", "to", "the", "dir", "holding", "all", "the", "data", ";", "index", "the", "sub", "-", "dir", "names", ";", "pack", "all", "files", "in", "each", "sub", "-", "dir", "into", "a", "list", ".", "Finally", "put", "the", "lists", "in", "a", "dict",...
def extract_data(): folders = DATA_LOC.iterdir() return {folder.stem: __files2list(folder.iterdir()) for folder in folders}
[ "def", "extract_data", "(", ")", ":", "folders", "=", "DATA_LOC", ".", "iterdir", "(", ")", "return", "{", "folder", ".", "stem", ":", "__files2list", "(", "folder", ".", "iterdir", "(", ")", ")", "for", "folder", "in", "folders", "}" ]
Go to the dir holding all the data; index the sub-dir names; pack all files in each sub-dir into a list.
[ "Go", "to", "the", "dir", "holding", "all", "the", "data", ";", "index", "the", "sub", "-", "dir", "names", ";", "pack", "all", "files", "in", "each", "sub", "-", "dir", "into", "a", "list", "." ]
[ "'''Go to the dir holding all the data; index the sub-dir names; pack all files in each sub-dir\n into a list. Finally, put the lists in a dict keyed by the sub-dir names.\n '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
56e7230306bdf7c5db66916de8c633e0e3806dd4
putupradnya/streamlit-app
streamlit_bokeh_events/__init__.py
[ "MIT" ]
Python
streamlit_bokeh_events
<not_specific>
def streamlit_bokeh_events(bokeh_plot=None, events="", key=None, debounce_time=1000, refresh_on_update=True, override_height=None): """Returns event dict Keyword arguments: bokeh_plot -- Bokeh figure object (default None) events -- Comma separated list of events dispatched by bokeh eg. "event1,event2,e...
Returns event dict Keyword arguments: bokeh_plot -- Bokeh figure object (default None) events -- Comma separated list of events dispatched by bokeh eg. "event1,event2,event3" (default "") debounce_time -- Time in ms to wait before dispatching latest event (default 1000) refresh_on_update -- Should ...
Returns event dict Keyword arguments: bokeh_plot -- Bokeh figure object (default None) events -- Comma separated list of events dispatched by bokeh eg.
[ "Returns", "event", "dict", "Keyword", "arguments", ":", "bokeh_plot", "--", "Bokeh", "figure", "object", "(", "default", "None", ")", "events", "--", "Comma", "separated", "list", "of", "events", "dispatched", "by", "bokeh", "eg", "." ]
def streamlit_bokeh_events(bokeh_plot=None, events="", key=None, debounce_time=1000, refresh_on_update=True, override_height=None): if key is None: raise ValueError("key can not be None.") div_id = "".join(choices(ascii_letters, k=16)) fig_dict = json_item(bokeh_plot, div_id) json_figure = json....
[ "def", "streamlit_bokeh_events", "(", "bokeh_plot", "=", "None", ",", "events", "=", "\"\"", ",", "key", "=", "None", ",", "debounce_time", "=", "1000", ",", "refresh_on_update", "=", "True", ",", "override_height", "=", "None", ")", ":", "if", "key", "is"...
Returns event dict Keyword arguments: bokeh_plot -- Bokeh figure object (default None) events -- Comma separated list of events dispatched by bokeh eg.
[ "Returns", "event", "dict", "Keyword", "arguments", ":", "bokeh_plot", "--", "Bokeh", "figure", "object", "(", "default", "None", ")", "events", "--", "Comma", "separated", "list", "of", "events", "dispatched", "by", "bokeh", "eg", "." ]
[ "\"\"\"Returns event dict\n\n Keyword arguments:\n bokeh_plot -- Bokeh figure object (default None)\n events -- Comma separated list of events dispatched by bokeh eg. \"event1,event2,event3\" (default \"\")\n debounce_time -- Time in ms to wait before dispatching latest event (default 1000)\n refresh...
[ { "param": "bokeh_plot", "type": null }, { "param": "events", "type": null }, { "param": "key", "type": null }, { "param": "debounce_time", "type": null }, { "param": "refresh_on_update", "type": null }, { "param": "override_height", "type": null ...
{ "returns": [], "raises": [], "params": [ { "identifier": "bokeh_plot", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "events", "type": null, "docstring": null, "docstring_to...
7278defc133641fd4947a99d0eb202afc43085f9
hepengli/matrpo
matrpo/trainer/matrpo.py
[ "MIT" ]
Python
make_env
<not_specific>
def make_env(self, scenario_id, seed, logger_dir, reward_scale, info_keywords, mpi_rank=0, subrank=0): """ Create a wrapped, monitored gym.Env for safety. """ scenario = scenarios.load('{}.py'.format(scenario_id)).Scenario() if not hasattr(scenario, 'post_step'): scenario.post_st...
Create a wrapped, monitored gym.Env for safety.
Create a wrapped, monitored gym.Env for safety.
[ "Create", "a", "wrapped", "monitored", "gym", ".", "Env", "for", "safety", "." ]
def make_env(self, scenario_id, seed, logger_dir, reward_scale, info_keywords, mpi_rank=0, subrank=0): scenario = scenarios.load('{}.py'.format(scenario_id)).Scenario() if not hasattr(scenario, 'post_step'): scenario.post_step = None world = scenario.make_world() env_dict = { ...
[ "def", "make_env", "(", "self", ",", "scenario_id", ",", "seed", ",", "logger_dir", ",", "reward_scale", ",", "info_keywords", ",", "mpi_rank", "=", "0", ",", "subrank", "=", "0", ")", ":", "scenario", "=", "scenarios", ".", "load", "(", "'{}.py'", ".", ...
Create a wrapped, monitored gym.Env for safety.
[ "Create", "a", "wrapped", "monitored", "gym", ".", "Env", "for", "safety", "." ]
[ "\"\"\"\n Create a wrapped, monitored gym.Env for safety.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "scenario_id", "type": null }, { "param": "seed", "type": null }, { "param": "logger_dir", "type": null }, { "param": "reward_scale", "type": null }, { "param": "info_keywords", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scenario_id", "type": null, "docstring": null, "docstring_tok...
7278defc133641fd4947a99d0eb202afc43085f9
hepengli/matrpo
matrpo/trainer/matrpo.py
[ "MIT" ]
Python
make_vec_env
<not_specific>
def make_vec_env(self, scenario_id, seed, num_env, logger_dir, reward_scale, force_dummy, info_keywords): """ Create a wrapped, monitored SubprocVecEnv for Atari and MuJoCo. """ mpi_rank = MPI.COMM_WORLD.Get_rank() if MPI else 0 seed = seed + 10000 * mpi_rank if seed is not None ...
Create a wrapped, monitored SubprocVecEnv for Atari and MuJoCo.
Create a wrapped, monitored SubprocVecEnv for Atari and MuJoCo.
[ "Create", "a", "wrapped", "monitored", "SubprocVecEnv", "for", "Atari", "and", "MuJoCo", "." ]
def make_vec_env(self, scenario_id, seed, num_env, logger_dir, reward_scale, force_dummy, info_keywords): mpi_rank = MPI.COMM_WORLD.Get_rank() if MPI else 0 seed = seed + 10000 * mpi_rank if seed is not None else None def make_thunk(rank, initializer=None): return lambda: self.make_e...
[ "def", "make_vec_env", "(", "self", ",", "scenario_id", ",", "seed", ",", "num_env", ",", "logger_dir", ",", "reward_scale", ",", "force_dummy", ",", "info_keywords", ")", ":", "mpi_rank", "=", "MPI", ".", "COMM_WORLD", ".", "Get_rank", "(", ")", "if", "MP...
Create a wrapped, monitored SubprocVecEnv for Atari and MuJoCo.
[ "Create", "a", "wrapped", "monitored", "SubprocVecEnv", "for", "Atari", "and", "MuJoCo", "." ]
[ "\"\"\"\n Create a wrapped, monitored SubprocVecEnv for Atari and MuJoCo.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "scenario_id", "type": null }, { "param": "seed", "type": null }, { "param": "num_env", "type": null }, { "param": "logger_dir", "type": null }, { "param": "reward_scale", "type": null }, { "par...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scenario_id", "type": null, "docstring": null, "docstring_tok...
efe72673b8cb0e6e1c5b839340208fb34ba32985
theGeoFis/pyBinSim
pybinsim/osc_receiver.py
[ "MIT" ]
Python
handle_soundevent
null
def handle_soundevent(self, identifier, *args): """ Handler for playlist control -- OSC message contains event id, a command and additional info (i.e. channel). Possible commands are: start: start soundevent; additional info (necessary) channel number sto...
Handler for playlist control -- OSC message contains event id, a command and additional info (i.e. channel). Possible commands are: start: start soundevent; additional info (necessary) channel number stop: stop soundevent; pause: pause soundevent; ...
Handler for playlist control OSC message contains event id, a command and additional info .
[ "Handler", "for", "playlist", "control", "OSC", "message", "contains", "event", "id", "a", "command", "and", "additional", "info", "." ]
def handle_soundevent(self, identifier, *args): assert identifier == "/pyBinSimSoundevent" self.log.info("soundevent: {}".format(args)) for data in args: self.soundevent_data.append(data) self.soundevent = True
[ "def", "handle_soundevent", "(", "self", ",", "identifier", ",", "*", "args", ")", ":", "assert", "identifier", "==", "\"/pyBinSimSoundevent\"", "self", ".", "log", ".", "info", "(", "\"soundevent: {}\"", ".", "format", "(", "args", ")", ")", "for", "data", ...
Handler for playlist control OSC message contains event id, a command and additional info (i.e.
[ "Handler", "for", "playlist", "control", "OSC", "message", "contains", "event", "id", "a", "command", "and", "additional", "info", "(", "i", ".", "e", "." ]
[ "\"\"\" Handler for playlist control\n \n --\n OSC message contains event id, a command and additional info (i.e. channel).\n Possible commands are:\n start: start soundevent; additional info (necessary) channel number\n stop: stop soundevent;\n pause: pa...
[ { "param": "self", "type": null }, { "param": "identifier", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "identifier", "type": null, "docstring": null, "docstring_toke...
efe72673b8cb0e6e1c5b839340208fb34ba32985
theGeoFis/pyBinSim
pybinsim/osc_receiver.py
[ "MIT" ]
Python
start_listening
null
def start_listening(self): """Start osc receiver in background Thread""" self.log.info("Serving on {}".format(self.server.server_address)) osc_thread = threading.Thread(target=self.server.serve_forever) osc_thread.daemon = True osc_thread.start()
Start osc receiver in background Thread
Start osc receiver in background Thread
[ "Start", "osc", "receiver", "in", "background", "Thread" ]
def start_listening(self): self.log.info("Serving on {}".format(self.server.server_address)) osc_thread = threading.Thread(target=self.server.serve_forever) osc_thread.daemon = True osc_thread.start()
[ "def", "start_listening", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "\"Serving on {}\"", ".", "format", "(", "self", ".", "server", ".", "server_address", ")", ")", "osc_thread", "=", "threading", ".", "Thread", "(", "target", "=", "se...
Start osc receiver in background Thread
[ "Start", "osc", "receiver", "in", "background", "Thread" ]
[ "\"\"\"Start osc receiver in background Thread\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
50732f1bffdbe75a60c28010084d0258e8e4c9ea
theGeoFis/pyBinSim
pybinsim/soundhandling.py
[ "MIT" ]
Python
read_sound_files
null
def read_sound_files(self, sound_file_list): """load all files for the audio installation""" sound_file_list = str.split(sound_file_list, '#') self.soundFileList = sound_file_list self.log.info("Audio Files: {}".format(str(self.soundFileList))) for sound in self.soundFileList: ...
load all files for the audio installation
load all files for the audio installation
[ "load", "all", "files", "for", "the", "audio", "installation" ]
def read_sound_files(self, sound_file_list): sound_file_list = str.split(sound_file_list, '#') self.soundFileList = sound_file_list self.log.info("Audio Files: {}".format(str(self.soundFileList))) for sound in self.soundFileList: self.log.info('Loading new sound file') ...
[ "def", "read_sound_files", "(", "self", ",", "sound_file_list", ")", ":", "sound_file_list", "=", "str", ".", "split", "(", "sound_file_list", ",", "'#'", ")", "self", ".", "soundFileList", "=", "sound_file_list", "self", ".", "log", ".", "info", "(", "\"Aud...
load all files for the audio installation
[ "load", "all", "files", "for", "the", "audio", "installation" ]
[ "\"\"\"load all files for the audio installation\"\"\"", "#get id and type of soundfile", "# free data", "#collect SoundEvent in dictionary" ]
[ { "param": "self", "type": null }, { "param": "sound_file_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sound_file_list", "type": null, "docstring": null, "docstring...
cfc28775481580bfd77178b2ea38e3cb15c7e17e
theGeoFis/pyBinSim
pybinsim/spark_fun.py
[ "MIT" ]
Python
parse_sensor_reading
<not_specific>
def parse_sensor_reading(sensor_reading): """ Parses sensor reading and returns list of floats. :param sensor_reading: List of sender readings, e.g. from read_all() split into lines. :return: List of floats with sensor values. Empty list if parsing failed. """ if len(sensor_reading) == 0: ...
Parses sensor reading and returns list of floats. :param sensor_reading: List of sender readings, e.g. from read_all() split into lines. :return: List of floats with sensor values. Empty list if parsing failed.
Parses sensor reading and returns list of floats.
[ "Parses", "sensor", "reading", "and", "returns", "list", "of", "floats", "." ]
def parse_sensor_reading(sensor_reading): if len(sensor_reading) == 0: return [] line = get_intact_reading(sensor_reading) if not line: return [] result_list = get_float_values(line) return result_list
[ "def", "parse_sensor_reading", "(", "sensor_reading", ")", ":", "if", "len", "(", "sensor_reading", ")", "==", "0", ":", "return", "[", "]", "line", "=", "get_intact_reading", "(", "sensor_reading", ")", "if", "not", "line", ":", "return", "[", "]", "resul...
Parses sensor reading and returns list of floats.
[ "Parses", "sensor", "reading", "and", "returns", "list", "of", "floats", "." ]
[ "\"\"\"\n Parses sensor reading and returns list of floats.\n :param sensor_reading: List of sender readings, e.g. from read_all() split into lines.\n :return: List of floats with sensor values. Empty list if parsing failed.\n \"\"\"" ]
[ { "param": "sensor_reading", "type": null } ]
{ "returns": [ { "docstring": "List of floats with sensor values. Empty list if parsing failed.", "docstring_tokens": [ "List", "of", "floats", "with", "sensor", "values", ".", "Empty", "list", "if", "parsing", ...
83059a50404a37c1cbee2679c9f09454ce599753
theGeoFis/pyBinSim
pybinsim/utility.py
[ "MIT" ]
Python
total_size
<not_specific>
def total_size(o, handlers={}, verbose=False): """ Returns the approximate memory footprint an object and all of its contents. Automatically finds the contents of the following builtin containers and their subclasses: tuple, list, deque, dict, set and frozenset. To search other containers, add handler...
Returns the approximate memory footprint an object and all of its contents. Automatically finds the contents of the following builtin containers and their subclasses: tuple, list, deque, dict, set and frozenset. To search other containers, add handlers to iterate over their contents: handlers = ...
Returns the approximate memory footprint an object and all of its contents. Automatically finds the contents of the following builtin containers and their subclasses: tuple, list, deque, dict, set and frozenset. To search other containers, add handlers to iterate over their contents.
[ "Returns", "the", "approximate", "memory", "footprint", "an", "object", "and", "all", "of", "its", "contents", ".", "Automatically", "finds", "the", "contents", "of", "the", "following", "builtin", "containers", "and", "their", "subclasses", ":", "tuple", "list"...
def total_size(o, handlers={}, verbose=False): def dict_handler(d): return chain.from_iterable(d.items()) all_handlers = {tuple: iter, list: iter, deque: iter, dict: dict_handler, set: iter, frozenset: iter, ...
[ "def", "total_size", "(", "o", ",", "handlers", "=", "{", "}", ",", "verbose", "=", "False", ")", ":", "def", "dict_handler", "(", "d", ")", ":", "return", "chain", ".", "from_iterable", "(", "d", ".", "items", "(", ")", ")", "all_handlers", "=", "...
Returns the approximate memory footprint an object and all of its contents.
[ "Returns", "the", "approximate", "memory", "footprint", "an", "object", "and", "all", "of", "its", "contents", "." ]
[ "\"\"\" Returns the approximate memory footprint an object and all of its contents.\n\n Automatically finds the contents of the following builtin containers and\n their subclasses: tuple, list, deque, dict, set and frozenset.\n To search other containers, add handlers to iterate over their contents:\n\n ...
[ { "param": "o", "type": null }, { "param": "handlers", "type": null }, { "param": "verbose", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "o", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handlers", "type": null, "docstring": null, "docstring_tokens": ...
ec838ad20cd31bcdf67c87cd4b719f928c2da86d
znqi/discordware
discordware/user.py
[ "MIT" ]
Python
send_message
null
def send_message( self, channel_id: int, content: str, embeds: Type['Embed'] = [], tts: Optional[bool] = False, timestamp: Optional[datetime.datetime] = None ): """ Send a message on a given channel id """ if isinstance(embeds, Embe...
Send a message on a given channel id
Send a message on a given channel id
[ "Send", "a", "message", "on", "a", "given", "channel", "id" ]
def send_message( self, channel_id: int, content: str, embeds: Type['Embed'] = [], tts: Optional[bool] = False, timestamp: Optional[datetime.datetime] = None ): if isinstance(embeds, Embed): embeds = embeds() elif isinstance(embeds, list...
[ "def", "send_message", "(", "self", ",", "channel_id", ":", "int", ",", "content", ":", "str", ",", "embeds", ":", "Type", "[", "'Embed'", "]", "=", "[", "]", ",", "tts", ":", "Optional", "[", "bool", "]", "=", "False", ",", "timestamp", ":", "Opti...
Send a message on a given channel id
[ "Send", "a", "message", "on", "a", "given", "channel", "id" ]
[ "\"\"\"\n Send a message on a given channel id\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "channel_id", "type": "int" }, { "param": "content", "type": "str" }, { "param": "embeds", "type": "Type['Embed']" }, { "param": "tts", "type": "Optional[bool]" }, { "param": "timestamp", "type": "Optio...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "channel_id", "type": "int", "docstring": null, "docstring_tok...
170548376cd9c406c140147da64d03734a06c291
znqi/discordware
discordware/token.py
[ "MIT" ]
Python
__get_tokens
null
def __get_tokens(self): """ Get the token from the given leveldb. """ for filepath in pathlib.Path(self.path).glob("**/*"): # TODO: GET all files from the given directory file = str(filepath.absolute()) filename = os.path.basename(file) if...
Get the token from the given leveldb.
Get the token from the given leveldb.
[ "Get", "the", "token", "from", "the", "given", "leveldb", "." ]
def __get_tokens(self): for filepath in pathlib.Path(self.path).glob("**/*"): file = str(filepath.absolute()) filename = os.path.basename(file) if not filename.endswith(".log") and not filename.endswith(".ldb"): continue for line in [ ...
[ "def", "__get_tokens", "(", "self", ")", ":", "for", "filepath", "in", "pathlib", ".", "Path", "(", "self", ".", "path", ")", ".", "glob", "(", "\"**/*\"", ")", ":", "file", "=", "str", "(", "filepath", ".", "absolute", "(", ")", ")", "filename", "...
Get the token from the given leveldb.
[ "Get", "the", "token", "from", "the", "given", "leveldb", "." ]
[ "\"\"\"\n Get the token from the given leveldb.\n \"\"\"", "# TODO: GET all files from the given directory", "# TODO: Extract the file and get the token." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2a2d2b76631df9c6b0408721c71d210a7d47ef67
gavinbarrett/SL_Engine
src/lexer.py
[ "MIT" ]
Python
lexify
<not_specific>
def lexify(self, args): ''' Pass each expression through the lexify_exp function ''' # normalize input string by newlines args = args.split('\n') # filter out any empty strings args = list(filter(bool, args)) # append operators to the output output = [] fo...
Pass each expression through the lexify_exp function
Pass each expression through the lexify_exp function
[ "Pass", "each", "expression", "through", "the", "lexify_exp", "function" ]
def lexify(self, args): args = args.split('\n') args = list(filter(bool, args)) output = [] for arg in args: output += self.lexify_exp(arg) return output
[ "def", "lexify", "(", "self", ",", "args", ")", ":", "args", "=", "args", ".", "split", "(", "'\\n'", ")", "args", "=", "list", "(", "filter", "(", "bool", ",", "args", ")", ")", "output", "=", "[", "]", "for", "arg", "in", "args", ":", "output...
Pass each expression through the lexify_exp function
[ "Pass", "each", "expression", "through", "the", "lexify_exp", "function" ]
[ "''' Pass each expression through the lexify_exp function '''", "# normalize input string by newlines", "# filter out any empty strings", "# append operators to the output" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
2a2d2b76631df9c6b0408721c71d210a7d47ef67
gavinbarrett/SL_Engine
src/lexer.py
[ "MIT" ]
Python
process_op
null
def process_op(self, operator): ''' process operators into the postfix expression ''' # if the stack is not empty, remove the top element if self.op_stack: prev_op = self.op_stack.pop() # if stack operator has lower precedence, add both to the stack if self.ge...
process operators into the postfix expression
process operators into the postfix expression
[ "process", "operators", "into", "the", "postfix", "expression" ]
def process_op(self, operator): if self.op_stack: prev_op = self.op_stack.pop() if self.get_precedence(prev_op) <= self.get_precedence(operator): self.op_stack.append(prev_op) self.op_stack.append(operator) else: self.postfix.ap...
[ "def", "process_op", "(", "self", ",", "operator", ")", ":", "if", "self", ".", "op_stack", ":", "prev_op", "=", "self", ".", "op_stack", ".", "pop", "(", ")", "if", "self", ".", "get_precedence", "(", "prev_op", ")", "<=", "self", ".", "get_precedence...
process operators into the postfix expression
[ "process", "operators", "into", "the", "postfix", "expression" ]
[ "''' process operators into the postfix expression '''", "# if the stack is not empty, remove the top element", "# if stack operator has lower precedence, add both to the stack", "# otherwise, append the stack operator to output and push op to stack", "# otherwise, add operator to stack" ]
[ { "param": "self", "type": null }, { "param": "operator", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "operator", "type": null, "docstring": null, "docstring_tokens...
2a2d2b76631df9c6b0408721c71d210a7d47ef67
gavinbarrett/SL_Engine
src/lexer.py
[ "MIT" ]
Python
pop_stack
<not_specific>
def pop_stack(self): ''' pop the remainder of the stack to the output queue ''' output = [] # while stack isn't empty, remove it and add to the output while self.op_stack: operator = self.op_stack.pop() self.postfix.append(operator) # append the operator l...
pop the remainder of the stack to the output queue
pop the remainder of the stack to the output queue
[ "pop", "the", "remainder", "of", "the", "stack", "to", "the", "output", "queue" ]
def pop_stack(self): output = [] while self.op_stack: operator = self.op_stack.pop() self.postfix.append(operator) output += self.postfix self.postfix = [] return output
[ "def", "pop_stack", "(", "self", ")", ":", "output", "=", "[", "]", "while", "self", ".", "op_stack", ":", "operator", "=", "self", ".", "op_stack", ".", "pop", "(", ")", "self", ".", "postfix", ".", "append", "(", "operator", ")", "output", "+=", ...
pop the remainder of the stack to the output queue
[ "pop", "the", "remainder", "of", "the", "stack", "to", "the", "output", "queue" ]
[ "''' pop the remainder of the stack to the output queue '''", "# while stack isn't empty, remove it and add to the output", "# append the operator lists", "# erase postfix state" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
adf2aa18ac54159339bc8cc2c85b1094446982ce
gavinbarrett/SL_Engine
src/newLexer.py
[ "MIT" ]
Python
lexify
<not_specific>
def lexify(self, args): ''' Pass each expression through the lexify_exp function ''' # normalize input string by newlines args = args.split('\n') # filter out any empty strings args = list(filter(bool, args)) # append operators to the output output = [] for arg in args: output += self.lexify_exp(arg)...
Pass each expression through the lexify_exp function
Pass each expression through the lexify_exp function
[ "Pass", "each", "expression", "through", "the", "lexify_exp", "function" ]
def lexify(self, args): args = args.split('\n') args = list(filter(bool, args)) output = [] for arg in args: output += self.lexify_exp(arg) return output
[ "def", "lexify", "(", "self", ",", "args", ")", ":", "args", "=", "args", ".", "split", "(", "'\\n'", ")", "args", "=", "list", "(", "filter", "(", "bool", ",", "args", ")", ")", "output", "=", "[", "]", "for", "arg", "in", "args", ":", "output...
Pass each expression through the lexify_exp function
[ "Pass", "each", "expression", "through", "the", "lexify_exp", "function" ]
[ "''' Pass each expression through the lexify_exp function '''", "# normalize input string by newlines", "# filter out any empty strings", "# append operators to the output" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
adf2aa18ac54159339bc8cc2c85b1094446982ce
gavinbarrett/SL_Engine
src/newLexer.py
[ "MIT" ]
Python
process_op
null
def process_op(self, operator): ''' process operators into the postfix expression ''' # if the stack is not empty, remove the top element if self.op_stack: prev_op = self.op_stack.pop() # if stack operator has lower precedence, add both to the stack if self.get_precedence(prev_op) < self.get_precedence(o...
process operators into the postfix expression
process operators into the postfix expression
[ "process", "operators", "into", "the", "postfix", "expression" ]
def process_op(self, operator): if self.op_stack: prev_op = self.op_stack.pop() if self.get_precedence(prev_op) < self.get_precedence(operator): self.op_stack.append(prev_op) self.op_stack.append(operator) else: self.postfix.append(prev_op) self.op_stack.append(operator) else: self.op_st...
[ "def", "process_op", "(", "self", ",", "operator", ")", ":", "if", "self", ".", "op_stack", ":", "prev_op", "=", "self", ".", "op_stack", ".", "pop", "(", ")", "if", "self", ".", "get_precedence", "(", "prev_op", ")", "<", "self", ".", "get_precedence"...
process operators into the postfix expression
[ "process", "operators", "into", "the", "postfix", "expression" ]
[ "''' process operators into the postfix expression '''", "# if the stack is not empty, remove the top element", "# if stack operator has lower precedence, add both to the stack", "# otherwise, append the stack operator to output and push op to stack", "# otherwise, add operator to stack" ]
[ { "param": "self", "type": null }, { "param": "operator", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "operator", "type": null, "docstring": null, "docstring_tokens...
adf2aa18ac54159339bc8cc2c85b1094446982ce
gavinbarrett/SL_Engine
src/newLexer.py
[ "MIT" ]
Python
pop_stack
<not_specific>
def pop_stack(self): ''' pop the remainder of the stack to the output queue ''' output = [] # while stack isn't empty, remove it and add to the output while self.op_stack: operator = self.op_stack.pop() self.postfix.append(operator) # append the operator lists output += self.postfix # erase postfix ...
pop the remainder of the stack to the output queue
pop the remainder of the stack to the output queue
[ "pop", "the", "remainder", "of", "the", "stack", "to", "the", "output", "queue" ]
def pop_stack(self): output = [] while self.op_stack: operator = self.op_stack.pop() self.postfix.append(operator) output += self.postfix self.postfix = [] return output
[ "def", "pop_stack", "(", "self", ")", ":", "output", "=", "[", "]", "while", "self", ".", "op_stack", ":", "operator", "=", "self", ".", "op_stack", ".", "pop", "(", ")", "self", ".", "postfix", ".", "append", "(", "operator", ")", "output", "+=", ...
pop the remainder of the stack to the output queue
[ "pop", "the", "remainder", "of", "the", "stack", "to", "the", "output", "queue" ]
[ "''' pop the remainder of the stack to the output queue '''", "# while stack isn't empty, remove it and add to the output", "# append the operator lists", "# erase postfix state" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
511664e12b8cd6e6bb4dde2d58d22bf16a193736
gavinbarrett/SL_Engine
server.py
[ "MIT" ]
Python
respond
<not_specific>
def respond(data): ''' select correct function from parser interface ''' p = parser.Parser() if data[-2] == ' ': data = data[:-2] return p.get_validity(data)
select correct function from parser interface
select correct function from parser interface
[ "select", "correct", "function", "from", "parser", "interface" ]
def respond(data): p = parser.Parser() if data[-2] == ' ': data = data[:-2] return p.get_validity(data)
[ "def", "respond", "(", "data", ")", ":", "p", "=", "parser", ".", "Parser", "(", ")", "if", "data", "[", "-", "2", "]", "==", "' '", ":", "data", "=", "data", "[", ":", "-", "2", "]", "return", "p", ".", "get_validity", "(", "data", ")" ]
select correct function from parser interface
[ "select", "correct", "function", "from", "parser", "interface" ]
[ "''' select correct function from parser interface '''" ]
[ { "param": "data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
511664e12b8cd6e6bb4dde2d58d22bf16a193736
gavinbarrett/SL_Engine
server.py
[ "MIT" ]
Python
valid_req
<not_specific>
def valid_req(): ''' return the validity of deriving a conclusion from a set of formulae ''' # decode formulae formulae = request.data.decode('UTF-8') # parse the formulae and return the truth matrices return jsonify(respond(formulae))
return the validity of deriving a conclusion from a set of formulae
return the validity of deriving a conclusion from a set of formulae
[ "return", "the", "validity", "of", "deriving", "a", "conclusion", "from", "a", "set", "of", "formulae" ]
def valid_req(): formulae = request.data.decode('UTF-8') return jsonify(respond(formulae))
[ "def", "valid_req", "(", ")", ":", "formulae", "=", "request", ".", "data", ".", "decode", "(", "'UTF-8'", ")", "return", "jsonify", "(", "respond", "(", "formulae", ")", ")" ]
return the validity of deriving a conclusion from a set of formulae
[ "return", "the", "validity", "of", "deriving", "a", "conclusion", "from", "a", "set", "of", "formulae" ]
[ "''' return the validity of deriving a conclusion from a set of formulae '''", "# decode formulae", "# parse the formulae and return the truth matrices" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
clear_parser
null
def clear_parser(self): ''' Return the parser to its initialized state ''' self.tree_stack.clear() self.set.clear() self.seen.clear()
Return the parser to its initialized state
Return the parser to its initialized state
[ "Return", "the", "parser", "to", "its", "initialized", "state" ]
def clear_parser(self): self.tree_stack.clear() self.set.clear() self.seen.clear()
[ "def", "clear_parser", "(", "self", ")", ":", "self", ".", "tree_stack", ".", "clear", "(", ")", "self", ".", "set", ".", "clear", "(", ")", "self", ".", "seen", ".", "clear", "(", ")" ]
Return the parser to its initialized state
[ "Return", "the", "parser", "to", "its", "initialized", "state" ]
[ "''' Return the parser to its initialized state '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
determine_truth
<not_specific>
def determine_truth(self, x, y, rootname): ''' Determine the truth value of the formula using binary functions ''' if rootname == '^': return self.and_val(x, y) elif rootname == 'v': return self.or_val(x, y) elif rootname == '->': return self.cond_val(...
Determine the truth value of the formula using binary functions
Determine the truth value of the formula using binary functions
[ "Determine", "the", "truth", "value", "of", "the", "formula", "using", "binary", "functions" ]
def determine_truth(self, x, y, rootname): if rootname == '^': return self.and_val(x, y) elif rootname == 'v': return self.or_val(x, y) elif rootname == '->': return self.cond_val(x, y) elif rootname == '<->': return self.bicond_val(x, y)
[ "def", "determine_truth", "(", "self", ",", "x", ",", "y", ",", "rootname", ")", ":", "if", "rootname", "==", "'^'", ":", "return", "self", ".", "and_val", "(", "x", ",", "y", ")", "elif", "rootname", "==", "'v'", ":", "return", "self", ".", "or_va...
Determine the truth value of the formula using binary functions
[ "Determine", "the", "truth", "value", "of", "the", "formula", "using", "binary", "functions" ]
[ "''' Determine the truth value of the formula using binary functions '''" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null }, { "param": "y", "type": null }, { "param": "rootname", "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": [], ...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
addValue
null
def addValue(self, value): ''' Add the top level truth values in order to determine validity ''' self.validStack += value # add value to the stack if len(self.validStack) == (2**len(self.dist)): self.vStack.append(self.validStack) self.validStack = []
Add the top level truth values in order to determine validity
Add the top level truth values in order to determine validity
[ "Add", "the", "top", "level", "truth", "values", "in", "order", "to", "determine", "validity" ]
def addValue(self, value): self.validStack += value if len(self.validStack) == (2**len(self.dist)): self.vStack.append(self.validStack) self.validStack = []
[ "def", "addValue", "(", "self", ",", "value", ")", ":", "self", ".", "validStack", "+=", "value", "if", "len", "(", "self", ".", "validStack", ")", "==", "(", "2", "**", "len", "(", "self", ".", "dist", ")", ")", ":", "self", ".", "vStack", ".", ...
Add the top level truth values in order to determine validity
[ "Add", "the", "top", "level", "truth", "values", "in", "order", "to", "determine", "validity" ]
[ "''' Add the top level truth values in order to determine validity '''", "# add value to the stack" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
insert_unary_value
<not_specific>
def insert_unary_value(self, truth_value, root): ''' Add the negation of the truth value to the root's evaluation stack ''' #FIXME: make sure correct values are inserted truth_value = root.right.eval_stack[0] #truth_value = root.root negated_value = self.neg(truth_value) ...
Add the negation of the truth value to the root's evaluation stack
Add the negation of the truth value to the root's evaluation stack
[ "Add", "the", "negation", "of", "the", "truth", "value", "to", "the", "root", "'", "s", "evaluation", "stack" ]
def insert_unary_value(self, truth_value, root): truth_value = root.right.eval_stack[0] negated_value = self.neg(truth_value) root.eval_stack.append(negated_value) return negated_value
[ "def", "insert_unary_value", "(", "self", ",", "truth_value", ",", "root", ")", ":", "truth_value", "=", "root", ".", "right", ".", "eval_stack", "[", "0", "]", "negated_value", "=", "self", ".", "neg", "(", "truth_value", ")", "root", ".", "eval_stack", ...
Add the negation of the truth value to the root's evaluation stack
[ "Add", "the", "negation", "of", "the", "truth", "value", "to", "the", "root", "'", "s", "evaluation", "stack" ]
[ "''' Add the negation of the truth value to the root's evaluation stack '''", "#FIXME: make sure correct values are inserted", "#truth_value = root.root" ]
[ { "param": "self", "type": null }, { "param": "truth_value", "type": null }, { "param": "root", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "truth_value", "type": null, "docstring": null, "docstring_tok...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
insert_binary_value
<not_specific>
def insert_binary_value(self, truth_value, root): ''' Add the binary computation of the truth value to the root's evaluation stack ''' left_arg = root.left.eval_stack[0] right_arg = root.right.eval_stack[0] truth_value = self.determine_truth(left_arg, right_arg, root.name) root.e...
Add the binary computation of the truth value to the root's evaluation stack
Add the binary computation of the truth value to the root's evaluation stack
[ "Add", "the", "binary", "computation", "of", "the", "truth", "value", "to", "the", "root", "'", "s", "evaluation", "stack" ]
def insert_binary_value(self, truth_value, root): left_arg = root.left.eval_stack[0] right_arg = root.right.eval_stack[0] truth_value = self.determine_truth(left_arg, right_arg, root.name) root.eval_stack.append(truth_value) return truth_value
[ "def", "insert_binary_value", "(", "self", ",", "truth_value", ",", "root", ")", ":", "left_arg", "=", "root", ".", "left", ".", "eval_stack", "[", "0", "]", "right_arg", "=", "root", ".", "right", ".", "eval_stack", "[", "0", "]", "truth_value", "=", ...
Add the binary computation of the truth value to the root's evaluation stack
[ "Add", "the", "binary", "computation", "of", "the", "truth", "value", "to", "the", "root", "'", "s", "evaluation", "stack" ]
[ "''' Add the binary computation of the truth value to the root's evaluation stack '''" ]
[ { "param": "self", "type": null }, { "param": "truth_value", "type": null }, { "param": "root", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "truth_value", "type": null, "docstring": null, "docstring_tok...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
evaluate
null
def evaluate(self, root): ''' Compute the parent node's truth value from its children ''' truth_value = None # insert a truth value for an atomic sentence if root.name in self.lexer.terms: truth_value = self.insert_term_value(truth_value, root) # compute the negation ...
Compute the parent node's truth value from its children
Compute the parent node's truth value from its children
[ "Compute", "the", "parent", "node", "'", "s", "truth", "value", "from", "its", "children" ]
def evaluate(self, root): truth_value = None if root.name in self.lexer.terms: truth_value = self.insert_term_value(truth_value, root) elif root.name == '~': truth_value = self.insert_unary_value(truth_value, root) elif root.name in self.lexer.binary_op: ...
[ "def", "evaluate", "(", "self", ",", "root", ")", ":", "truth_value", "=", "None", "if", "root", ".", "name", "in", "self", ".", "lexer", ".", "terms", ":", "truth_value", "=", "self", ".", "insert_term_value", "(", "truth_value", ",", "root", ")", "el...
Compute the parent node's truth value from its children
[ "Compute", "the", "parent", "node", "'", "s", "truth", "value", "from", "its", "children" ]
[ "''' Compute the parent node's truth value from its children '''", "# insert a truth value for an atomic sentence", "# compute the negation of an expression", "# compute the output of a binary function", "# if token is the root of the tree, save truth value" ]
[ { "param": "self", "type": null }, { "param": "root", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "root", "type": null, "docstring": null, "docstring_tokens": [...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
generate_truth_assign
<not_specific>
def generate_truth_assign(self, t, expression): ''' Generate the initial truth assignments for each term ''' tmpExp = [] # create an empty dictionary to store seen terms char_map = defaultdict(lambda: None) for character in expression: # if the term hasn't been seen ...
Generate the initial truth assignments for each term
Generate the initial truth assignments for each term
[ "Generate", "the", "initial", "truth", "assignments", "for", "each", "term" ]
def generate_truth_assign(self, t, expression): tmpExp = [] char_map = defaultdict(lambda: None) for character in expression: if char_map[character] == None: next_char = t[0] t = t[1:] char_map[character] = next_char tmp...
[ "def", "generate_truth_assign", "(", "self", ",", "t", ",", "expression", ")", ":", "tmpExp", "=", "[", "]", "char_map", "=", "defaultdict", "(", "lambda", ":", "None", ")", "for", "character", "in", "expression", ":", "if", "char_map", "[", "character", ...
Generate the initial truth assignments for each term
[ "Generate", "the", "initial", "truth", "assignments", "for", "each", "term" ]
[ "''' Generate the initial truth assignments for each term '''", "# create an empty dictionary to store seen terms", "# if the term hasn't been seen", "# pop the head character off and", "# update character map with seen char", "# add character to temporary exp", "# otherwise, if the term has been seen",...
[ { "param": "self", "type": null }, { "param": "t", "type": null }, { "param": "expression", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], ...
a5924b0c36b5ba633e7767ea924c60f86d736aeb
gavinbarrett/SL_Engine
src/parser.py
[ "MIT" ]
Python
strip_terms
<not_specific>
def strip_terms(self, exp): ''' Return a list of used terms along with the same list without duplicates ''' # filter out all propositional variables terms = list(filter(lambda x: True if x in self.alpha else False, list(exp))) # make a list of terms void of duplicates distinct = ...
Return a list of used terms along with the same list without duplicates
Return a list of used terms along with the same list without duplicates
[ "Return", "a", "list", "of", "used", "terms", "along", "with", "the", "same", "list", "without", "duplicates" ]
def strip_terms(self, exp): terms = list(filter(lambda x: True if x in self.alpha else False, list(exp))) distinct = list(dict.fromkeys(terms)) return terms, distinct
[ "def", "strip_terms", "(", "self", ",", "exp", ")", ":", "terms", "=", "list", "(", "filter", "(", "lambda", "x", ":", "True", "if", "x", "in", "self", ".", "alpha", "else", "False", ",", "list", "(", "exp", ")", ")", ")", "distinct", "=", "list"...
Return a list of used terms along with the same list without duplicates
[ "Return", "a", "list", "of", "used", "terms", "along", "with", "the", "same", "list", "without", "duplicates" ]
[ "''' Return a list of used terms along with the same list without duplicates '''", "# filter out all propositional variables", "# make a list of terms void of duplicates" ]
[ { "param": "self", "type": null }, { "param": "exp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exp", "type": null, "docstring": null, "docstring_tokens": []...