body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
cc9f5b22a85db5d7c0e6c3cdcc05e8b05b4010910c8ebf4c26bfbdd1c1eb8eb0
def compute_spatial_density(fname, typeID, time, nbins, idir, wpos=[], all_steps=False, den=False): ' Compute spatial density distribution of given atom type ' time_steps = dsec.extract_all_sections(fname, 'ITEM: TIMESTEP') atoms_all_t = dsec.extract_all_sections(fname, 'ITEM: ATOMS') box_all_t = dsec.e...
Compute spatial density distribution of given atom type
postprocessing/compute_type_densities.py
compute_spatial_density
Dynamical-Systems-Laboratory/IPMCsMD
2
python
def compute_spatial_density(fname, typeID, time, nbins, idir, wpos=[], all_steps=False, den=False): ' ' time_steps = dsec.extract_all_sections(fname, 'ITEM: TIMESTEP') atoms_all_t = dsec.extract_all_sections(fname, 'ITEM: ATOMS') box_all_t = dsec.extract_all_sections(fname, 'ITEM: BOX') if (idir ==...
def compute_spatial_density(fname, typeID, time, nbins, idir, wpos=[], all_steps=False, den=False): ' ' time_steps = dsec.extract_all_sections(fname, 'ITEM: TIMESTEP') atoms_all_t = dsec.extract_all_sections(fname, 'ITEM: ATOMS') box_all_t = dsec.extract_all_sections(fname, 'ITEM: BOX') if (idir ==...
6ec06165a1d24dbeacb303b6f50159c2700c61132af51bdcedf614a8df9b80b2
def calc(self, LEDs, PDs, blockingObj, reflectingObj): ' Calcute the CIR.\n \n Parameters\n ----------\n LEDs: list\n List of LEDs. But, currently supports 1 LED.\n PDs: list\n List of PDs. Currently supports 1 PD.\n blockingObj: list\n List...
Calcute the CIR. Parameters ---------- LEDs: list List of LEDs. But, currently supports 1 LED. PDs: list List of PDs. Currently supports 1 PD. blockingObj: list List of blocking objects. reflectingObj: list List of reflecting objects, for example a room. The naming is due to we might need a genera...
owcsimpy/cir/spheremodelcir.py
calc
ardimasp/owcsimpy
0
python
def calc(self, LEDs, PDs, blockingObj, reflectingObj): ' Calcute the CIR.\n \n Parameters\n ----------\n LEDs: list\n List of LEDs. But, currently supports 1 LED.\n PDs: list\n List of PDs. Currently supports 1 PD.\n blockingObj: list\n List...
def calc(self, LEDs, PDs, blockingObj, reflectingObj): ' Calcute the CIR.\n \n Parameters\n ----------\n LEDs: list\n List of LEDs. But, currently supports 1 LED.\n PDs: list\n List of PDs. Currently supports 1 PD.\n blockingObj: list\n List...
f011020a877a25656d6b649f5cf1a31c7ef3a0accf7c1bb57904171090b52683
def plot_histogram(data, number_to_keep=False, legend=None, options=None): "Plot a histogram of data.\n\n Args:\n data (list or dict): This is either a list of dictionaries or a single\n dict containing the values to represent (ex {'001': 130})\n number_to_keep (int): DEPRECATED the numb...
Plot a histogram of data. Args: data (list or dict): This is either a list of dictionaries or a single dict containing the values to represent (ex {'001': 130}) number_to_keep (int): DEPRECATED the number of terms to plot and rest is made into a single bar called other values legend(list): ...
qiskit/tools/visualization/_counts_visualization.py
plot_histogram
kifumi/qiskit-terra
1
python
def plot_histogram(data, number_to_keep=False, legend=None, options=None): "Plot a histogram of data.\n\n Args:\n data (list or dict): This is either a list of dictionaries or a single\n dict containing the values to represent (ex {'001': 130})\n number_to_keep (int): DEPRECATED the numb...
def plot_histogram(data, number_to_keep=False, legend=None, options=None): "Plot a histogram of data.\n\n Args:\n data (list or dict): This is either a list of dictionaries or a single\n dict containing the values to represent (ex {'001': 130})\n number_to_keep (int): DEPRECATED the numb...
53758fc6e70d62ca62d1208fc186334940d2511faab0ded2e78b014749fe5136
def train_model(dataDirName, overwrite=False, numTrainBatches=500000, minZ=0.0, maxZ=0.0, redshifting=False, chkpt_path=None): ' Train model. Unzip and overwrite exisiting training set if overwrite is True' trainingSet = os.path.join(dataDirName, 'training_set.zip') extractedFolder = os.path.join(dataDirNa...
Train model. Unzip and overwrite exisiting training set if overwrite is True
astrodash/deep_learning_multilayer.py
train_model
FoxFortino/adfox
0
python
def train_model(dataDirName, overwrite=False, numTrainBatches=500000, minZ=0.0, maxZ=0.0, redshifting=False, chkpt_path=None): ' ' trainingSet = os.path.join(dataDirName, 'training_set.zip') extractedFolder = os.path.join(dataDirName, 'training_set') if (os.path.exists(extractedFolder) and overwrite): ...
def train_model(dataDirName, overwrite=False, numTrainBatches=500000, minZ=0.0, maxZ=0.0, redshifting=False, chkpt_path=None): ' ' trainingSet = os.path.join(dataDirName, 'training_set.zip') extractedFolder = os.path.join(dataDirName, 'training_set') if (os.path.exists(extractedFolder) and overwrite): ...
6962ac70f346b18c31ac131418745d672308bed5cf8f306495aac5f191caa826
def yesno(question): '\n Ask a yes/no question. No default, we want to avoid mistakes as\n much as possible. Repeat the question until we receive a valid\n answer.\n ' while True: try: prompt = '{} [yn] '.format(question) answer = input(prompt) except EOFError...
Ask a yes/no question. No default, we want to avoid mistakes as much as possible. Repeat the question until we receive a valid answer.
openr/py/openr/cli/utils/utils.py
yesno
akshshar/openr
6
python
def yesno(question): '\n Ask a yes/no question. No default, we want to avoid mistakes as\n much as possible. Repeat the question until we receive a valid\n answer.\n ' while True: try: prompt = '{} [yn] '.format(question) answer = input(prompt) except EOFError...
def yesno(question): '\n Ask a yes/no question. No default, we want to avoid mistakes as\n much as possible. Repeat the question until we receive a valid\n answer.\n ' while True: try: prompt = '{} [yn] '.format(question) answer = input(prompt) except EOFError...
17b4027cdf28825ba8408ea0c5973aeb8e9144e30003f4926ed06d25969cd17f
def json_dumps(data): '\n Gives consistent formatting for JSON dumps for our CLI\n\n :param data: python dictionary object\n\n :return: json encoded string\n ' return json.dumps(data, sort_keys=True, indent=2, ensure_ascii=False)
Gives consistent formatting for JSON dumps for our CLI :param data: python dictionary object :return: json encoded string
openr/py/openr/cli/utils/utils.py
json_dumps
akshshar/openr
6
python
def json_dumps(data): '\n Gives consistent formatting for JSON dumps for our CLI\n\n :param data: python dictionary object\n\n :return: json encoded string\n ' return json.dumps(data, sort_keys=True, indent=2, ensure_ascii=False)
def json_dumps(data): '\n Gives consistent formatting for JSON dumps for our CLI\n\n :param data: python dictionary object\n\n :return: json encoded string\n ' return json.dumps(data, sort_keys=True, indent=2, ensure_ascii=False)<|docstring|>Gives consistent formatting for JSON dumps for our CLI :p...
9352c9743ae8b23a5a0b883d569a097f0c6bbf505112d53e0dc889cb016e455a
def time_since(timestamp): '\n :param timestamp: in seconds since unix time\n\n :returns: difference between now and the timestamp, in a human-friendly,\n condensed format\n\n Example format:\n\n time_since(10000)\n >>> 112d11h\n\n :rtype: datetime.timedelta\n ' time_since_epoc...
:param timestamp: in seconds since unix time :returns: difference between now and the timestamp, in a human-friendly, condensed format Example format: time_since(10000) >>> 112d11h :rtype: datetime.timedelta
openr/py/openr/cli/utils/utils.py
time_since
akshshar/openr
6
python
def time_since(timestamp): '\n :param timestamp: in seconds since unix time\n\n :returns: difference between now and the timestamp, in a human-friendly,\n condensed format\n\n Example format:\n\n time_since(10000)\n >>> 112d11h\n\n :rtype: datetime.timedelta\n ' time_since_epoc...
def time_since(timestamp): '\n :param timestamp: in seconds since unix time\n\n :returns: difference between now and the timestamp, in a human-friendly,\n condensed format\n\n Example format:\n\n time_since(10000)\n >>> 112d11h\n\n :rtype: datetime.timedelta\n ' time_since_epoc...
e6b509056a3a6c632190c9a79b8c4681ce3aafdc4e841261102f814b727f4fd4
def get_fib_agent_client(host, port, timeout_ms, client_id=platform_types.FibClient.OPENR, service=FibService): '\n Get thrift client for talking to Fib thrift service\n\n :param host: thrift server name or ip\n :param port: thrift server port\n\n :returns: The thrift client\n :rtype: FibService.Clie...
Get thrift client for talking to Fib thrift service :param host: thrift server name or ip :param port: thrift server port :returns: The thrift client :rtype: FibService.Client
openr/py/openr/cli/utils/utils.py
get_fib_agent_client
akshshar/openr
6
python
def get_fib_agent_client(host, port, timeout_ms, client_id=platform_types.FibClient.OPENR, service=FibService): '\n Get thrift client for talking to Fib thrift service\n\n :param host: thrift server name or ip\n :param port: thrift server port\n\n :returns: The thrift client\n :rtype: FibService.Clie...
def get_fib_agent_client(host, port, timeout_ms, client_id=platform_types.FibClient.OPENR, service=FibService): '\n Get thrift client for talking to Fib thrift service\n\n :param host: thrift server name or ip\n :param port: thrift server port\n\n :returns: The thrift client\n :rtype: FibService.Clie...
beb2105a15f2971480b9daa8e569b434835fb3454c09f08f306dd457bb1f3482
def get_connected_node_name(host, lm_cmd_port): ' get the identity of the connected node by querying link monitor' client = LMClient(zmq.Context(), 'tcp://{}:{}'.format(host, lm_cmd_port)) try: return client.get_identity() except zmq.error.Again: return host
get the identity of the connected node by querying link monitor
openr/py/openr/cli/utils/utils.py
get_connected_node_name
akshshar/openr
6
python
def get_connected_node_name(host, lm_cmd_port): ' ' client = LMClient(zmq.Context(), 'tcp://{}:{}'.format(host, lm_cmd_port)) try: return client.get_identity() except zmq.error.Again: return host
def get_connected_node_name(host, lm_cmd_port): ' ' client = LMClient(zmq.Context(), 'tcp://{}:{}'.format(host, lm_cmd_port)) try: return client.get_identity() except zmq.error.Again: return host<|docstring|>get the identity of the connected node by querying link monitor<|endoftext|>
96ccd7c2a5392050ccb46dff34743d663c124804dea67a4e2122b62cb3c5e695
def parse_nodes(host, nodes, lm_cmd_port): ' parse nodes from user input\n\n :return set: the set of nodes\n ' if (not nodes): nodes = get_connected_node_name(host, lm_cmd_port) nodes = set(nodes.strip().split(',')) return nodes
parse nodes from user input :return set: the set of nodes
openr/py/openr/cli/utils/utils.py
parse_nodes
akshshar/openr
6
python
def parse_nodes(host, nodes, lm_cmd_port): ' parse nodes from user input\n\n :return set: the set of nodes\n ' if (not nodes): nodes = get_connected_node_name(host, lm_cmd_port) nodes = set(nodes.strip().split(',')) return nodes
def parse_nodes(host, nodes, lm_cmd_port): ' parse nodes from user input\n\n :return set: the set of nodes\n ' if (not nodes): nodes = get_connected_node_name(host, lm_cmd_port) nodes = set(nodes.strip().split(',')) return nodes<|docstring|>parse nodes from user input :return set: the...
a40943a34306e7f3b91cc92a53efd2614c71d63d5db75f14e5622b366e8731c6
def sprint_addr(addr): ' binary ip addr -> string ' family = (socket.AF_INET if (len(addr) == 4) else socket.AF_INET6) return socket.inet_ntop(family, addr)
binary ip addr -> string
openr/py/openr/cli/utils/utils.py
sprint_addr
akshshar/openr
6
python
def sprint_addr(addr): ' ' family = (socket.AF_INET if (len(addr) == 4) else socket.AF_INET6) return socket.inet_ntop(family, addr)
def sprint_addr(addr): ' ' family = (socket.AF_INET if (len(addr) == 4) else socket.AF_INET6) return socket.inet_ntop(family, addr)<|docstring|>binary ip addr -> string<|endoftext|>
0d5d9872ed4f224e135de998950449f0867549e6e4a0eef0fd136d091f3321eb
def sprint_prefix(prefix): '\n :param prefix: ip_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n ' return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)
:param prefix: ip_types.IpPrefix representing an CIDR network :returns: string representation of prefix (CIDR network) :rtype: str or unicode
openr/py/openr/cli/utils/utils.py
sprint_prefix
akshshar/openr
6
python
def sprint_prefix(prefix): '\n :param prefix: ip_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n ' return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)
def sprint_prefix(prefix): '\n :param prefix: ip_types.IpPrefix representing an CIDR network\n\n :returns: string representation of prefix (CIDR network)\n :rtype: str or unicode\n ' return '{}/{}'.format(sprint_addr(prefix.prefixAddress.addr), prefix.prefixLength)<|docstring|>:param prefix: ip_type...
fdef193dace92046778c998a7bde21222dc4d3dd18cf2ca00a04a39421a0ef2e
def sprint_prefix_type(prefix_type): '\n :param prefix: lsdb_types.PrefixType\n ' return lsdb_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)
:param prefix: lsdb_types.PrefixType
openr/py/openr/cli/utils/utils.py
sprint_prefix_type
akshshar/openr
6
python
def sprint_prefix_type(prefix_type): '\n \n ' return lsdb_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)
def sprint_prefix_type(prefix_type): '\n \n ' return lsdb_types.PrefixType._VALUES_TO_NAMES.get(prefix_type, None)<|docstring|>:param prefix: lsdb_types.PrefixType<|endoftext|>
1176e2abdcea4b2116ec40da7680cf86ea71609aca235c96c3ab00c55feb6189
def sprint_prefixes_db_full(prefix_db, loopback_only=False): ' given serialized prefixes output an array of lines\n representing those prefixes. IPV6 prefixes come before IPV4 prefixes.\n\n :prefix_db lsdb_types.PrefixDatabase: prefix database\n :loopback_only : is only loopback address exp...
given serialized prefixes output an array of lines representing those prefixes. IPV6 prefixes come before IPV4 prefixes. :prefix_db lsdb_types.PrefixDatabase: prefix database :loopback_only : is only loopback address expected :return [str]: the array of prefix strings
openr/py/openr/cli/utils/utils.py
sprint_prefixes_db_full
akshshar/openr
6
python
def sprint_prefixes_db_full(prefix_db, loopback_only=False): ' given serialized prefixes output an array of lines\n representing those prefixes. IPV6 prefixes come before IPV4 prefixes.\n\n :prefix_db lsdb_types.PrefixDatabase: prefix database\n :loopback_only : is only loopback address exp...
def sprint_prefixes_db_full(prefix_db, loopback_only=False): ' given serialized prefixes output an array of lines\n representing those prefixes. IPV6 prefixes come before IPV4 prefixes.\n\n :prefix_db lsdb_types.PrefixDatabase: prefix database\n :loopback_only : is only loopback address exp...
6c3dc3855be11316ec57e712851cfcdc081c12a2452f87eeb92178826e286f4e
def ip_str_to_addr(addr_str): '\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: ip_types.BinaryAddress\n ' try: addr = socket.inet_pton(socket.AF_INET, addr_str) return ip_types.BinaryAddress(addr=addr) except socket.erro...
:param addr_str: ip address in string representation :returns: thrift struct BinaryAddress :rtype: ip_types.BinaryAddress
openr/py/openr/cli/utils/utils.py
ip_str_to_addr
akshshar/openr
6
python
def ip_str_to_addr(addr_str): '\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: ip_types.BinaryAddress\n ' try: addr = socket.inet_pton(socket.AF_INET, addr_str) return ip_types.BinaryAddress(addr=addr) except socket.erro...
def ip_str_to_addr(addr_str): '\n :param addr_str: ip address in string representation\n\n :returns: thrift struct BinaryAddress\n :rtype: ip_types.BinaryAddress\n ' try: addr = socket.inet_pton(socket.AF_INET, addr_str) return ip_types.BinaryAddress(addr=addr) except socket.erro...
cc74dcdeafda6d7feba31e8f343c8ef86b601ae3b17ddc27c4e9f7349d34dcf5
def ip_str_to_prefix(prefix_str): '\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: ip_types.IpPrefix\n ' (ip_str, ip_len_str) = prefix_str.split('/') return ip_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(i...
:param prefix_str: string representing a prefix (CIDR network) :returns: thrift struct IpPrefix :rtype: ip_types.IpPrefix
openr/py/openr/cli/utils/utils.py
ip_str_to_prefix
akshshar/openr
6
python
def ip_str_to_prefix(prefix_str): '\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: ip_types.IpPrefix\n ' (ip_str, ip_len_str) = prefix_str.split('/') return ip_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(i...
def ip_str_to_prefix(prefix_str): '\n :param prefix_str: string representing a prefix (CIDR network)\n\n :returns: thrift struct IpPrefix\n :rtype: ip_types.IpPrefix\n ' (ip_str, ip_len_str) = prefix_str.split('/') return ip_types.IpPrefix(prefixAddress=ip_str_to_addr(ip_str), prefixLength=int(i...
4efc1c1f4d41e83cf99a085f05c54c6bd4403c0024a74f77e58579e1e289b3af
def alloc_prefix_to_loopback_ip_str(prefix): '\n :param prefix: IpPrefix representing an allocation prefix (CIDR network)\n\n :returns: Loopback IP corresponding to allocation prefix\n :rtype: string\n ' ip_addr = prefix.prefixAddress.addr print(ip_addr) if (prefix.prefixLength != 128): ...
:param prefix: IpPrefix representing an allocation prefix (CIDR network) :returns: Loopback IP corresponding to allocation prefix :rtype: string
openr/py/openr/cli/utils/utils.py
alloc_prefix_to_loopback_ip_str
akshshar/openr
6
python
def alloc_prefix_to_loopback_ip_str(prefix): '\n :param prefix: IpPrefix representing an allocation prefix (CIDR network)\n\n :returns: Loopback IP corresponding to allocation prefix\n :rtype: string\n ' ip_addr = prefix.prefixAddress.addr print(ip_addr) if (prefix.prefixLength != 128): ...
def alloc_prefix_to_loopback_ip_str(prefix): '\n :param prefix: IpPrefix representing an allocation prefix (CIDR network)\n\n :returns: Loopback IP corresponding to allocation prefix\n :rtype: string\n ' ip_addr = prefix.prefixAddress.addr print(ip_addr) if (prefix.prefixLength != 128): ...
0d2d7745fb1a3bfa8de49d8239c798837c7f165a1e66b07ce021c85bceaf6aaf
def print_prefixes_table(resp, nodes, iter_func): ' print prefixes ' def _parse_prefixes(rows, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) rows.append(["{}'s prefixes".format(prefix_db....
print prefixes
openr/py/openr/cli/utils/utils.py
print_prefixes_table
akshshar/openr
6
python
def print_prefixes_table(resp, nodes, iter_func): ' ' def _parse_prefixes(rows, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) rows.append(["{}'s prefixes".format(prefix_db.thisNodeName),...
def print_prefixes_table(resp, nodes, iter_func): ' ' def _parse_prefixes(rows, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) rows.append(["{}'s prefixes".format(prefix_db.thisNodeName),...
54773f312f76cadcd0d78793a531be15b1757a0c1410f21a490c376280397012
def thrift_to_dict(thrift_inst, update_func=None): ' convert thrift instance into a dict in strings\n\n :param thrift_inst: a thrift instance\n :param update_func: transformation function to update dict value of\n thrift object. It is optional.\n\n :return dict: dict ...
convert thrift instance into a dict in strings :param thrift_inst: a thrift instance :param update_func: transformation function to update dict value of thrift object. It is optional. :return dict: dict with attributes as key, value in strings
openr/py/openr/cli/utils/utils.py
thrift_to_dict
akshshar/openr
6
python
def thrift_to_dict(thrift_inst, update_func=None): ' convert thrift instance into a dict in strings\n\n :param thrift_inst: a thrift instance\n :param update_func: transformation function to update dict value of\n thrift object. It is optional.\n\n :return dict: dict ...
def thrift_to_dict(thrift_inst, update_func=None): ' convert thrift instance into a dict in strings\n\n :param thrift_inst: a thrift instance\n :param update_func: transformation function to update dict value of\n thrift object. It is optional.\n\n :return dict: dict ...
c7f12d145edf93c074433cfe494c9168df3733e76b579041fa7083fea34dac8e
def prefix_entry_to_dict(prefix_entry): ' convert prefixEntry from thrift instance into a dict in strings ' def _update(prefix_entry_dict, prefix_entry): prefix_entry_dict.update({'prefix': sprint_prefix(prefix_entry.prefix)}) return thrift_to_dict(prefix_entry, _update)
convert prefixEntry from thrift instance into a dict in strings
openr/py/openr/cli/utils/utils.py
prefix_entry_to_dict
akshshar/openr
6
python
def prefix_entry_to_dict(prefix_entry): ' ' def _update(prefix_entry_dict, prefix_entry): prefix_entry_dict.update({'prefix': sprint_prefix(prefix_entry.prefix)}) return thrift_to_dict(prefix_entry, _update)
def prefix_entry_to_dict(prefix_entry): ' ' def _update(prefix_entry_dict, prefix_entry): prefix_entry_dict.update({'prefix': sprint_prefix(prefix_entry.prefix)}) return thrift_to_dict(prefix_entry, _update)<|docstring|>convert prefixEntry from thrift instance into a dict in strings<|endoftext|>
82f9a49ba6370325df6f9854bef78480037bd4ed5843ab5e6f3179f034c3a1bd
def print_prefixes_json(resp, nodes, iter_func): ' print prefixes in json ' def _parse_prefixes(prefixes_map, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) prefixEntries = map(prefix_entr...
print prefixes in json
openr/py/openr/cli/utils/utils.py
print_prefixes_json
akshshar/openr
6
python
def print_prefixes_json(resp, nodes, iter_func): ' ' def _parse_prefixes(prefixes_map, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) prefixEntries = map(prefix_entry_to_dict, prefix_db.p...
def print_prefixes_json(resp, nodes, iter_func): ' ' def _parse_prefixes(prefixes_map, prefix_db): if isinstance(prefix_db, kv_store_types.Value): prefix_db = deserialize_thrift_object(prefix_db.value, lsdb_types.PrefixDatabase) prefixEntries = map(prefix_entry_to_dict, prefix_db.p...
52aa9a021d29b05ac964de1baffe13ebc370c4fcd68b93ef8d4e89182489ca0c
def update_global_adj_db(global_adj_db, adj_db): ' update the global adj map based on publication from single node\n\n :param global_adj_map map(node, AdjacencyDatabase)\n the map for all adjacencies in the network - to be updated\n :param adj_db lsdb_types.AdjacencyDatabase: publication fr...
update the global adj map based on publication from single node :param global_adj_map map(node, AdjacencyDatabase) the map for all adjacencies in the network - to be updated :param adj_db lsdb_types.AdjacencyDatabase: publication from single node
openr/py/openr/cli/utils/utils.py
update_global_adj_db
akshshar/openr
6
python
def update_global_adj_db(global_adj_db, adj_db): ' update the global adj map based on publication from single node\n\n :param global_adj_map map(node, AdjacencyDatabase)\n the map for all adjacencies in the network - to be updated\n :param adj_db lsdb_types.AdjacencyDatabase: publication fr...
def update_global_adj_db(global_adj_db, adj_db): ' update the global adj map based on publication from single node\n\n :param global_adj_map map(node, AdjacencyDatabase)\n the map for all adjacencies in the network - to be updated\n :param adj_db lsdb_types.AdjacencyDatabase: publication fr...
b783b76e6565e69a64997e2249c6cd5297cd591f7b6439a77086a567e5298a70
def build_global_adj_db(resp): ' build a map of all adjacencies in the network. this is used\n for bi-directional validation\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, AdjacencyDatabase): the global\n adj map, devices name mapped to devic...
build a map of all adjacencies in the network. this is used for bi-directional validation :param resp kv_store_types.Publication: the parsed publication :return map(node, AdjacencyDatabase): the global adj map, devices name mapped to devices it connects to, and properties of that connection
openr/py/openr/cli/utils/utils.py
build_global_adj_db
akshshar/openr
6
python
def build_global_adj_db(resp): ' build a map of all adjacencies in the network. this is used\n for bi-directional validation\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, AdjacencyDatabase): the global\n adj map, devices name mapped to devic...
def build_global_adj_db(resp): ' build a map of all adjacencies in the network. this is used\n for bi-directional validation\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, AdjacencyDatabase): the global\n adj map, devices name mapped to devic...
cfc120036338f996861964cd4ed5f63fd3a14f9ab2de4869f2966d5add8fe5f1
def build_global_prefix_db(resp): ' build a map of all prefixes in the network. this is used\n for checking for changes in topology\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, set([prefix])): the global prefix map,\n prefixes mapped to the...
build a map of all prefixes in the network. this is used for checking for changes in topology :param resp kv_store_types.Publication: the parsed publication :return map(node, set([prefix])): the global prefix map, prefixes mapped to the node
openr/py/openr/cli/utils/utils.py
build_global_prefix_db
akshshar/openr
6
python
def build_global_prefix_db(resp): ' build a map of all prefixes in the network. this is used\n for checking for changes in topology\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, set([prefix])): the global prefix map,\n prefixes mapped to the...
def build_global_prefix_db(resp): ' build a map of all prefixes in the network. this is used\n for checking for changes in topology\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map(node, set([prefix])): the global prefix map,\n prefixes mapped to the...
46afc4754226d29ae1c7620697b11756de43a4aa3ad93856270e740910d347e4
def build_global_interface_db(resp): '\n build a map<node-name, InterfaceDatabase.bunch> which is used for tracking\n changes in interface database of node\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map<node, InterfaceDatabase.bunch>\n ' global_intf_db = {} ...
build a map<node-name, InterfaceDatabase.bunch> which is used for tracking changes in interface database of node :param resp kv_store_types.Publication: the parsed publication :return map<node, InterfaceDatabase.bunch>
openr/py/openr/cli/utils/utils.py
build_global_interface_db
akshshar/openr
6
python
def build_global_interface_db(resp): '\n build a map<node-name, InterfaceDatabase.bunch> which is used for tracking\n changes in interface database of node\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map<node, InterfaceDatabase.bunch>\n ' global_intf_db = {} ...
def build_global_interface_db(resp): '\n build a map<node-name, InterfaceDatabase.bunch> which is used for tracking\n changes in interface database of node\n\n :param resp kv_store_types.Publication: the parsed publication\n\n :return map<node, InterfaceDatabase.bunch>\n ' global_intf_db = {} ...
dee9544d24c10fc70fef3d3490a2c9531bb08c5c6943140223177249e88bf051
def dump_adj_db_full(global_adj_db, adj_db, bidir): ' given an adjacency database, dump neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :param adj_db l...
given an adjacency database, dump neighbors. Use the global adj database to validate bi-dir adjacencies :param global_adj_db map(str, AdjacencyDatabase): map of node names to their adjacent node names :param adj_db lsdb_types.AdjacencyDatabase: latest from kv store :param bidir bool: only dump bidir adjacencie...
openr/py/openr/cli/utils/utils.py
dump_adj_db_full
akshshar/openr
6
python
def dump_adj_db_full(global_adj_db, adj_db, bidir): ' given an adjacency database, dump neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :param adj_db l...
def dump_adj_db_full(global_adj_db, adj_db, bidir): ' given an adjacency database, dump neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :param adj_db l...
01806873ae45a7c4f6e42d9bd63f84205fef1585a667a89f1d3051149d40cbbc
def adj_to_dict(adj): ' convert adjacency from thrift instance into a dict in strings ' def _update(adj_dict, adj): adj_dict.update({'nextHopV6': sprint_addr(adj.nextHopV6.addr), 'nextHopV4': sprint_addr(adj.nextHopV4.addr)}) return thrift_to_dict(adj, _update)
convert adjacency from thrift instance into a dict in strings
openr/py/openr/cli/utils/utils.py
adj_to_dict
akshshar/openr
6
python
def adj_to_dict(adj): ' ' def _update(adj_dict, adj): adj_dict.update({'nextHopV6': sprint_addr(adj.nextHopV6.addr), 'nextHopV4': sprint_addr(adj.nextHopV4.addr)}) return thrift_to_dict(adj, _update)
def adj_to_dict(adj): ' ' def _update(adj_dict, adj): adj_dict.update({'nextHopV6': sprint_addr(adj.nextHopV6.addr), 'nextHopV4': sprint_addr(adj.nextHopV4.addr)}) return thrift_to_dict(adj, _update)<|docstring|>convert adjacency from thrift instance into a dict in strings<|endoftext|>
da60eeb87f05165124646c199c55f0022d65f1665f1ec70fedf871e3e07cd706
def adj_db_to_dict(adjs_map, adj_dbs, adj_db, bidir, version): ' convert adj db to dict ' (node_label, is_overloaded, adjacencies) = dump_adj_db_full(adj_dbs, adj_db, bidir) if (not adjacencies): return adjacencies = map(adj_to_dict, adjacencies) adjs_map[adj_db.thisNodeName] = {'node_label'...
convert adj db to dict
openr/py/openr/cli/utils/utils.py
adj_db_to_dict
akshshar/openr
6
python
def adj_db_to_dict(adjs_map, adj_dbs, adj_db, bidir, version): ' ' (node_label, is_overloaded, adjacencies) = dump_adj_db_full(adj_dbs, adj_db, bidir) if (not adjacencies): return adjacencies = map(adj_to_dict, adjacencies) adjs_map[adj_db.thisNodeName] = {'node_label': node_label, 'overloa...
def adj_db_to_dict(adjs_map, adj_dbs, adj_db, bidir, version): ' ' (node_label, is_overloaded, adjacencies) = dump_adj_db_full(adj_dbs, adj_db, bidir) if (not adjacencies): return adjacencies = map(adj_to_dict, adjacencies) adjs_map[adj_db.thisNodeName] = {'node_label': node_label, 'overloa...
dc68dc9b759c413381148ff6aea7b11fc4125f5b273157576d6e2959d830e5f7
def adj_dbs_to_dict(resp, nodes, bidir, iter_func): ' get parsed adjacency db\n\n :param resp kv_store_types.Publication, or decision_types.adjDbs\n :param nodes set: the set of the nodes to print prefixes for\n :param bidir bool: only dump bidirectional adjacencies\n\n :return map(node,...
get parsed adjacency db :param resp kv_store_types.Publication, or decision_types.adjDbs :param nodes set: the set of the nodes to print prefixes for :param bidir bool: only dump bidirectional adjacencies :return map(node, map(adjacency_keys, (adjacency_values)): the parsed adjacency DB in a map with keys and val...
openr/py/openr/cli/utils/utils.py
adj_dbs_to_dict
akshshar/openr
6
python
def adj_dbs_to_dict(resp, nodes, bidir, iter_func): ' get parsed adjacency db\n\n :param resp kv_store_types.Publication, or decision_types.adjDbs\n :param nodes set: the set of the nodes to print prefixes for\n :param bidir bool: only dump bidirectional adjacencies\n\n :return map(node,...
def adj_dbs_to_dict(resp, nodes, bidir, iter_func): ' get parsed adjacency db\n\n :param resp kv_store_types.Publication, or decision_types.adjDbs\n :param nodes set: the set of the nodes to print prefixes for\n :param bidir bool: only dump bidirectional adjacencies\n\n :return map(node,...
f068df205def2cc7a2351a58f5ee2dbf901f58aafe85ffac87c8f7220dc47225
def print_adjs_json(adjs_map): ' print adjacencies in json\n\n :param adjacencies as list of dict\n ' print(json_dumps(adjs_map))
print adjacencies in json :param adjacencies as list of dict
openr/py/openr/cli/utils/utils.py
print_adjs_json
akshshar/openr
6
python
def print_adjs_json(adjs_map): ' print adjacencies in json\n\n :param adjacencies as list of dict\n ' print(json_dumps(adjs_map))
def print_adjs_json(adjs_map): ' print adjacencies in json\n\n :param adjacencies as list of dict\n ' print(json_dumps(adjs_map))<|docstring|>print adjacencies in json :param adjacencies as list of dict<|endoftext|>
dfc33238aa4322decebac22c30c3304efd6082b5bae815db16a70aa59fa8ea37
def print_adjs_table(adjs_map, enable_color): ' print adjacencies\n\n :param adjacencies as list of dict\n ' column_labels = ['Neighbor', 'Local Interface', 'Remote Interface', 'Metric', 'Weight', 'Adj Label', 'NextHop-v4', 'NextHop-v6', 'Uptime'] output = [] for (node, val) in sorted(adjs_map...
print adjacencies :param adjacencies as list of dict
openr/py/openr/cli/utils/utils.py
print_adjs_table
akshshar/openr
6
python
def print_adjs_table(adjs_map, enable_color): ' print adjacencies\n\n :param adjacencies as list of dict\n ' column_labels = ['Neighbor', 'Local Interface', 'Remote Interface', 'Metric', 'Weight', 'Adj Label', 'NextHop-v4', 'NextHop-v6', 'Uptime'] output = [] for (node, val) in sorted(adjs_map...
def print_adjs_table(adjs_map, enable_color): ' print adjacencies\n\n :param adjacencies as list of dict\n ' column_labels = ['Neighbor', 'Local Interface', 'Remote Interface', 'Metric', 'Weight', 'Adj Label', 'NextHop-v4', 'NextHop-v6', 'Uptime'] output = [] for (node, val) in sorted(adjs_map...
6d52640abf0dbd4109dc6dbe421ebe4cc693a8bb9ba4124b34cab57f3824adf0
def sprint_adj_db_full(global_adj_db, adj_db, bidir): ' given serialized adjacency database, print neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :par...
given serialized adjacency database, print neighbors. Use the global adj database to validate bi-dir adjacencies :param global_adj_db map(str, AdjacencyDatabase): map of node names to their adjacent node names :param adj_db lsdb_types.AdjacencyDatabase: latest from kv store :param bidir bool: only print bidir ...
openr/py/openr/cli/utils/utils.py
sprint_adj_db_full
akshshar/openr
6
python
def sprint_adj_db_full(global_adj_db, adj_db, bidir): ' given serialized adjacency database, print neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :par...
def sprint_adj_db_full(global_adj_db, adj_db, bidir): ' given serialized adjacency database, print neighbors. Use the\n global adj database to validate bi-dir adjacencies\n\n :param global_adj_db map(str, AdjacencyDatabase):\n map of node names to their adjacent node names\n :par...
212c3921d4c17674c38a2e6e7b96245aa457202f71a66204a1f3e8bb0dc0f509
def interface_db_to_dict(value): '\n Convert a thrift::Value representation of InterfaceDatabase to bunch\n object\n ' def _parse_intf_info(info): return bunch.Bunch(**{'isUp': info.isUp, 'ifIndex': info.ifIndex, 'v4Addrs': [sprint_addr(v.addr) for v in info.v4Addrs], 'v6Addrs': [sprint_addr(v...
Convert a thrift::Value representation of InterfaceDatabase to bunch object
openr/py/openr/cli/utils/utils.py
interface_db_to_dict
akshshar/openr
6
python
def interface_db_to_dict(value): '\n Convert a thrift::Value representation of InterfaceDatabase to bunch\n object\n ' def _parse_intf_info(info): return bunch.Bunch(**{'isUp': info.isUp, 'ifIndex': info.ifIndex, 'v4Addrs': [sprint_addr(v.addr) for v in info.v4Addrs], 'v6Addrs': [sprint_addr(v...
def interface_db_to_dict(value): '\n Convert a thrift::Value representation of InterfaceDatabase to bunch\n object\n ' def _parse_intf_info(info): return bunch.Bunch(**{'isUp': info.isUp, 'ifIndex': info.ifIndex, 'v4Addrs': [sprint_addr(v.addr) for v in info.v4Addrs], 'v6Addrs': [sprint_addr(v...
79a80b4dcf996ba9c1c00f02c7792dba45f89102b5e6b56aaf35a14437e96cad
def interface_dbs_to_dict(publication, nodes, iter_func): ' get parsed interface dbs\n\n :param publication kv_store_types.Publication\n :param nodes set: the set of the nodes to filter interfaces for\n\n :return map(node, InterfaceDatabase.bunch): the parsed\n adjacency DB in a map ...
get parsed interface dbs :param publication kv_store_types.Publication :param nodes set: the set of the nodes to filter interfaces for :return map(node, InterfaceDatabase.bunch): the parsed adjacency DB in a map with keys and values in strings
openr/py/openr/cli/utils/utils.py
interface_dbs_to_dict
akshshar/openr
6
python
def interface_dbs_to_dict(publication, nodes, iter_func): ' get parsed interface dbs\n\n :param publication kv_store_types.Publication\n :param nodes set: the set of the nodes to filter interfaces for\n\n :return map(node, InterfaceDatabase.bunch): the parsed\n adjacency DB in a map ...
def interface_dbs_to_dict(publication, nodes, iter_func): ' get parsed interface dbs\n\n :param publication kv_store_types.Publication\n :param nodes set: the set of the nodes to filter interfaces for\n\n :return map(node, InterfaceDatabase.bunch): the parsed\n adjacency DB in a map ...
774d5ebed0690e5061639e302dfc60c626c7d3052535a87475f92739cac15de3
def sprint_interface_table(intf_db, print_all): '\n @param intf_db: InterfaceDatabase.bunch\n ' columns = ['Interface', 'Status', 'ifIndex', 'Addresses'] rows = [] for (intf_name, intf) in sorted(intf_db.interfaces.items()): if (not (intf.isUp or print_all)): continue s...
@param intf_db: InterfaceDatabase.bunch
openr/py/openr/cli/utils/utils.py
sprint_interface_table
akshshar/openr
6
python
def sprint_interface_table(intf_db, print_all): '\n \n ' columns = ['Interface', 'Status', 'ifIndex', 'Addresses'] rows = [] for (intf_name, intf) in sorted(intf_db.interfaces.items()): if (not (intf.isUp or print_all)): continue status = ('UP' if intf.isUp else 'DOWN')...
def sprint_interface_table(intf_db, print_all): '\n \n ' columns = ['Interface', 'Status', 'ifIndex', 'Addresses'] rows = [] for (intf_name, intf) in sorted(intf_db.interfaces.items()): if (not (intf.isUp or print_all)): continue status = ('UP' if intf.isUp else 'DOWN')...
7cd1f3da49e677c8d571016edd1572fab621b56ead80298c2663a23cd9ac7d74
def print_interfaces_table(intf_map, print_all): '\n @param intf_db: map<node-name, InterfaceDatabase.bunch>\n ' lines = [] for intf_db in sorted(intf_map.values(), key=(lambda x: x.thisNodeName)): lines.append("> {}'s interfaces".format(intf_db.thisNodeName)) lines.append(sprint_inter...
@param intf_db: map<node-name, InterfaceDatabase.bunch>
openr/py/openr/cli/utils/utils.py
print_interfaces_table
akshshar/openr
6
python
def print_interfaces_table(intf_map, print_all): '\n \n ' lines = [] for intf_db in sorted(intf_map.values(), key=(lambda x: x.thisNodeName)): lines.append("> {}'s interfaces".format(intf_db.thisNodeName)) lines.append(sprint_interface_table(intf_db, print_all)) lines.append() ...
def print_interfaces_table(intf_map, print_all): '\n \n ' lines = [] for intf_db in sorted(intf_map.values(), key=(lambda x: x.thisNodeName)): lines.append("> {}'s interfaces".format(intf_db.thisNodeName)) lines.append(sprint_interface_table(intf_db, print_all)) lines.append() ...
b5b0bea1a2aebe44a4c82c5a98cefd8d4bdae741ba582d4639f630b10439c195
def print_routes_table(route_db): ' print the the routes from Decision/Fib module ' route_strs = [] for route in sorted(route_db.routes, key=(lambda x: x.prefix.prefixAddress.addr)): prefix_str = sprint_prefix(route.prefix) paths_str = '\n'.join(['via {}@{} metric {}'.format(sprint_addr(path...
print the the routes from Decision/Fib module
openr/py/openr/cli/utils/utils.py
print_routes_table
akshshar/openr
6
python
def print_routes_table(route_db): ' ' route_strs = [] for route in sorted(route_db.routes, key=(lambda x: x.prefix.prefixAddress.addr)): prefix_str = sprint_prefix(route.prefix) paths_str = '\n'.join(['via {}@{} metric {}'.format(sprint_addr(path.nextHop.addr), path.ifName, path.metric) for...
def print_routes_table(route_db): ' ' route_strs = [] for route in sorted(route_db.routes, key=(lambda x: x.prefix.prefixAddress.addr)): prefix_str = sprint_prefix(route.prefix) paths_str = '\n'.join(['via {}@{} metric {}'.format(sprint_addr(path.nextHop.addr), path.ifName, path.metric) for...
73383065aac3d472d7d7f33741ef4d8ec5d732f7fb9b511d8a50c2a6003b7434
def path_to_dict(path): ' convert path from thrift instance into a dict in strings ' def _update(path_dict, path): path_dict.update({'nextHop': sprint_addr(path.nextHop.addr)}) return thrift_to_dict(path, _update)
convert path from thrift instance into a dict in strings
openr/py/openr/cli/utils/utils.py
path_to_dict
akshshar/openr
6
python
def path_to_dict(path): ' ' def _update(path_dict, path): path_dict.update({'nextHop': sprint_addr(path.nextHop.addr)}) return thrift_to_dict(path, _update)
def path_to_dict(path): ' ' def _update(path_dict, path): path_dict.update({'nextHop': sprint_addr(path.nextHop.addr)}) return thrift_to_dict(path, _update)<|docstring|>convert path from thrift instance into a dict in strings<|endoftext|>
63e63750a96c3cd73a8c2f212a69ad5b48b49ef2c2a729c62af5fe1d78eb71e2
def route_to_dict(route): ' convert route from thrift instance into a dict in strings ' def _update(route_dict, route): route_dict.update({'prefix': sprint_prefix(route.prefix), 'paths': map(path_to_dict, route.paths)}) return thrift_to_dict(route, _update)
convert route from thrift instance into a dict in strings
openr/py/openr/cli/utils/utils.py
route_to_dict
akshshar/openr
6
python
def route_to_dict(route): ' ' def _update(route_dict, route): route_dict.update({'prefix': sprint_prefix(route.prefix), 'paths': map(path_to_dict, route.paths)}) return thrift_to_dict(route, _update)
def route_to_dict(route): ' ' def _update(route_dict, route): route_dict.update({'prefix': sprint_prefix(route.prefix), 'paths': map(path_to_dict, route.paths)}) return thrift_to_dict(route, _update)<|docstring|>convert route from thrift instance into a dict in strings<|endoftext|>
3ac41c1f57c0a9483ab9c3bdd2121bc576c30fedbc534fbb632ee6e88d14ccbf
def route_db_to_dict(route_db): ' convert route from thrift instance into a dict in strings ' return {'routes': map(route_to_dict, route_db.routes)}
convert route from thrift instance into a dict in strings
openr/py/openr/cli/utils/utils.py
route_db_to_dict
akshshar/openr
6
python
def route_db_to_dict(route_db): ' ' return {'routes': map(route_to_dict, route_db.routes)}
def route_db_to_dict(route_db): ' ' return {'routes': map(route_to_dict, route_db.routes)}<|docstring|>convert route from thrift instance into a dict in strings<|endoftext|>
bd28bf6088060da3257d64a13885ec3f2c4d970d44e07f316fec0383bc20d7fb
def find_adj_list_deltas(old_adj_list, new_adj_list): ' given the old adj list and the new one for some node, return\n change list.\n\n :param old_adj_list [Adjacency]: old adjacency list\n :param new_adj_list [Adjacency]: new adjacency list\n\n :return [(str, Adjacency, Adjacency)]: lis...
given the old adj list and the new one for some node, return change list. :param old_adj_list [Adjacency]: old adjacency list :param new_adj_list [Adjacency]: new adjacency list :return [(str, Adjacency, Adjacency)]: list of tuples of (changeType, oldAdjacency, newAdjacency) in the case where an adjacency is ...
openr/py/openr/cli/utils/utils.py
find_adj_list_deltas
akshshar/openr
6
python
def find_adj_list_deltas(old_adj_list, new_adj_list): ' given the old adj list and the new one for some node, return\n change list.\n\n :param old_adj_list [Adjacency]: old adjacency list\n :param new_adj_list [Adjacency]: new adjacency list\n\n :return [(str, Adjacency, Adjacency)]: lis...
def find_adj_list_deltas(old_adj_list, new_adj_list): ' given the old adj list and the new one for some node, return\n change list.\n\n :param old_adj_list [Adjacency]: old adjacency list\n :param new_adj_list [Adjacency]: new adjacency list\n\n :return [(str, Adjacency, Adjacency)]: lis...
b3f98b7c643025b8e1294c8975414ad9c3ff08f0fd734909f6d820ba7fb772d7
def adjacency_to_dict(adjacency): ' convert adjacency from thrift instance into a dict in strings\n\n :param adjacency as a thrift instance: adjacency\n\n :return dict: dict with adjacency attributes as key, value in strings\n ' adj_dict = copy.copy(adjacency).__dict__ adj_dict.update({'nex...
convert adjacency from thrift instance into a dict in strings :param adjacency as a thrift instance: adjacency :return dict: dict with adjacency attributes as key, value in strings
openr/py/openr/cli/utils/utils.py
adjacency_to_dict
akshshar/openr
6
python
def adjacency_to_dict(adjacency): ' convert adjacency from thrift instance into a dict in strings\n\n :param adjacency as a thrift instance: adjacency\n\n :return dict: dict with adjacency attributes as key, value in strings\n ' adj_dict = copy.copy(adjacency).__dict__ adj_dict.update({'nex...
def adjacency_to_dict(adjacency): ' convert adjacency from thrift instance into a dict in strings\n\n :param adjacency as a thrift instance: adjacency\n\n :return dict: dict with adjacency attributes as key, value in strings\n ' adj_dict = copy.copy(adjacency).__dict__ adj_dict.update({'nex...
4eba7a47a17bc23b241d6d6129cb313e6889bfdfced645911fc3faafec15ed28
def sprint_adj_delta(old_adj, new_adj): ' given old and new adjacency, create a list of strings that summarize\n changes. If oldAdj is None, this function prints all attridutes of\n newAdj\n\n :param oldAdj Adjacency: can be None\n :param newAdj Adjacency: new\n\n :return str: tab...
given old and new adjacency, create a list of strings that summarize changes. If oldAdj is None, this function prints all attridutes of newAdj :param oldAdj Adjacency: can be None :param newAdj Adjacency: new :return str: table summarizing the change
openr/py/openr/cli/utils/utils.py
sprint_adj_delta
akshshar/openr
6
python
def sprint_adj_delta(old_adj, new_adj): ' given old and new adjacency, create a list of strings that summarize\n changes. If oldAdj is None, this function prints all attridutes of\n newAdj\n\n :param oldAdj Adjacency: can be None\n :param newAdj Adjacency: new\n\n :return str: tab...
def sprint_adj_delta(old_adj, new_adj): ' given old and new adjacency, create a list of strings that summarize\n changes. If oldAdj is None, this function prints all attridutes of\n newAdj\n\n :param oldAdj Adjacency: can be None\n :param newAdj Adjacency: new\n\n :return str: tab...
bbdca15f2cfc5e97bad18eb877778e83cae48cb9edc3480a078976748492cae6
def sprint_pub_update(global_publication_db, key, value): '\n store new version and originatorId for a key in the global_publication_db\n return a string summarizing any changes in a publication from kv store\n ' rows = [] (old_version, old_originator_id) = global_publication_db.get(key, (None, Non...
store new version and originatorId for a key in the global_publication_db return a string summarizing any changes in a publication from kv store
openr/py/openr/cli/utils/utils.py
sprint_pub_update
akshshar/openr
6
python
def sprint_pub_update(global_publication_db, key, value): '\n store new version and originatorId for a key in the global_publication_db\n return a string summarizing any changes in a publication from kv store\n ' rows = [] (old_version, old_originator_id) = global_publication_db.get(key, (None, Non...
def sprint_pub_update(global_publication_db, key, value): '\n store new version and originatorId for a key in the global_publication_db\n return a string summarizing any changes in a publication from kv store\n ' rows = [] (old_version, old_originator_id) = global_publication_db.get(key, (None, Non...
5e18a0df70af49da9e86f8c8c0d3c8ef58230a7621da5c5285c9fa48d9b8e462
def update_global_prefix_db(global_prefix_db, prefix_db): ' update the global prefix map with a single publication\n\n :param global_prefix_map map(node, set([str])): map of all prefixes\n in the network\n :param prefix_db lsdb_types.PrefixDatabase: publication from single\n node...
update the global prefix map with a single publication :param global_prefix_map map(node, set([str])): map of all prefixes in the network :param prefix_db lsdb_types.PrefixDatabase: publication from single node
openr/py/openr/cli/utils/utils.py
update_global_prefix_db
akshshar/openr
6
python
def update_global_prefix_db(global_prefix_db, prefix_db): ' update the global prefix map with a single publication\n\n :param global_prefix_map map(node, set([str])): map of all prefixes\n in the network\n :param prefix_db lsdb_types.PrefixDatabase: publication from single\n node...
def update_global_prefix_db(global_prefix_db, prefix_db): ' update the global prefix map with a single publication\n\n :param global_prefix_map map(node, set([str])): map of all prefixes\n in the network\n :param prefix_db lsdb_types.PrefixDatabase: publication from single\n node...
d225c514724ca0b77f0ddadd3f76e5745ea8f07b842a2a2570b3bf7752aff2da
def sprint_adj_db_delta(new_adj_db, old_adj_db): ' given serialized adjacency database, print neighbors delta as\n compared to the supplied global state\n\n :param new_adj_db lsdb_types.AdjacencyDatabase: latest from kv store\n :param old_adj_db lsdb_types.AdjacencyDatabase: last one we had...
given serialized adjacency database, print neighbors delta as compared to the supplied global state :param new_adj_db lsdb_types.AdjacencyDatabase: latest from kv store :param old_adj_db lsdb_types.AdjacencyDatabase: last one we had :return [str]: list of string to be printed
openr/py/openr/cli/utils/utils.py
sprint_adj_db_delta
akshshar/openr
6
python
def sprint_adj_db_delta(new_adj_db, old_adj_db): ' given serialized adjacency database, print neighbors delta as\n compared to the supplied global state\n\n :param new_adj_db lsdb_types.AdjacencyDatabase: latest from kv store\n :param old_adj_db lsdb_types.AdjacencyDatabase: last one we had...
def sprint_adj_db_delta(new_adj_db, old_adj_db): ' given serialized adjacency database, print neighbors delta as\n compared to the supplied global state\n\n :param new_adj_db lsdb_types.AdjacencyDatabase: latest from kv store\n :param old_adj_db lsdb_types.AdjacencyDatabase: last one we had...
ed04ca8125f168908bc648fe78ab9c651a5eec976c9968c2c14835004f67622f
def sprint_interface_db_delta(new_intf_db, old_intf_db): '\n Print delta between new and old interface db\n\n @param new_intf_db: InterfaceDatabase.bunch\n @param old_intf_db: InterfaceDatabase.bunch\n ' assert (new_intf_db is not None) assert (old_intf_db is not None) new_intfs = set(new_in...
Print delta between new and old interface db @param new_intf_db: InterfaceDatabase.bunch @param old_intf_db: InterfaceDatabase.bunch
openr/py/openr/cli/utils/utils.py
sprint_interface_db_delta
akshshar/openr
6
python
def sprint_interface_db_delta(new_intf_db, old_intf_db): '\n Print delta between new and old interface db\n\n @param new_intf_db: InterfaceDatabase.bunch\n @param old_intf_db: InterfaceDatabase.bunch\n ' assert (new_intf_db is not None) assert (old_intf_db is not None) new_intfs = set(new_in...
def sprint_interface_db_delta(new_intf_db, old_intf_db): '\n Print delta between new and old interface db\n\n @param new_intf_db: InterfaceDatabase.bunch\n @param old_intf_db: InterfaceDatabase.bunch\n ' assert (new_intf_db is not None) assert (old_intf_db is not None) new_intfs = set(new_in...
5d742f9379151499e5cc527247e6ce9734a3dc91870866c420571d4cb0e964ba
def sprint_prefixes_db_delta(global_prefixes_db, prefix_db): ' given serialzied prefixes for a single node, output the delta\n between those prefixes and global prefixes snapshot\n\n :global_prefixes_db map(node, set([str])): global prefixes\n :prefix_db lsdb_types.PrefixDatabase: latest fr...
given serialzied prefixes for a single node, output the delta between those prefixes and global prefixes snapshot :global_prefixes_db map(node, set([str])): global prefixes :prefix_db lsdb_types.PrefixDatabase: latest from kv store :return [str]: the array of prefix strings
openr/py/openr/cli/utils/utils.py
sprint_prefixes_db_delta
akshshar/openr
6
python
def sprint_prefixes_db_delta(global_prefixes_db, prefix_db): ' given serialzied prefixes for a single node, output the delta\n between those prefixes and global prefixes snapshot\n\n :global_prefixes_db map(node, set([str])): global prefixes\n :prefix_db lsdb_types.PrefixDatabase: latest fr...
def sprint_prefixes_db_delta(global_prefixes_db, prefix_db): ' given serialzied prefixes for a single node, output the delta\n between those prefixes and global prefixes snapshot\n\n :global_prefixes_db map(node, set([str])): global prefixes\n :prefix_db lsdb_types.PrefixDatabase: latest fr...
7eee90aa259b6dfde2abd83dda9c112349b0427a669206622b833d67b5b7eb09
@property def update_fun(self, pred, gt): 'Calculate the metric scores in every iteration and update :attr:`record`.\n\n Args:\n pred (torch.Tensor): The prediction tensor.\n gt (torch.Tensor): The ground-truth tensor.\n ' pass
Calculate the metric scores in every iteration and update :attr:`record`. Args: pred (torch.Tensor): The prediction tensor. gt (torch.Tensor): The ground-truth tensor.
LibMTL/metrics.py
update_fun
median-research-group/LibMTL
83
python
@property def update_fun(self, pred, gt): 'Calculate the metric scores in every iteration and update :attr:`record`.\n\n Args:\n pred (torch.Tensor): The prediction tensor.\n gt (torch.Tensor): The ground-truth tensor.\n ' pass
@property def update_fun(self, pred, gt): 'Calculate the metric scores in every iteration and update :attr:`record`.\n\n Args:\n pred (torch.Tensor): The prediction tensor.\n gt (torch.Tensor): The ground-truth tensor.\n ' pass<|docstring|>Calculate the metric scores in every...
4aeebca67c99954869e7676c72106561ed45325ba877938de424f54347c5d757
@property def score_fun(self): 'Calculate the final score (when an epoch ends).\n\n Return:\n list: A list of metric scores.\n ' pass
Calculate the final score (when an epoch ends). Return: list: A list of metric scores.
LibMTL/metrics.py
score_fun
median-research-group/LibMTL
83
python
@property def score_fun(self): 'Calculate the final score (when an epoch ends).\n\n Return:\n list: A list of metric scores.\n ' pass
@property def score_fun(self): 'Calculate the final score (when an epoch ends).\n\n Return:\n list: A list of metric scores.\n ' pass<|docstring|>Calculate the final score (when an epoch ends). Return: list: A list of metric scores.<|endoftext|>
ec803f46891f882734683aeade814ca11786430d9f5970717e973cc4f93e5e9e
def reinit(self): 'Reset :attr:`record` and :attr:`bs` (when an epoch ends).\n ' self.record = [] self.bs = []
Reset :attr:`record` and :attr:`bs` (when an epoch ends).
LibMTL/metrics.py
reinit
median-research-group/LibMTL
83
python
def reinit(self): '\n ' self.record = [] self.bs = []
def reinit(self): '\n ' self.record = [] self.bs = []<|docstring|>Reset :attr:`record` and :attr:`bs` (when an epoch ends).<|endoftext|>
7422e09871cc93d9cf8d92ac5e7f371343ce3ae8b6dfa9c8f6ef5e55d83cff07
def main(): 'Start execution of the script' MiscUtil.PrintInfo(('\n%s (RDK v%s; %s): Starting...\n' % (ScriptName, rdBase.rdkitVersion, time.asctime()))) (WallClockTime, ProcessorTime) = MiscUtil.GetWallClockAndProcessorTime() RetrieveOptions() ProcessOptions() PerformSearch() MiscUtil.Print...
Start execution of the script
ddt/mayachemtools/bin/RDKitSearchSMARTS.py
main
hassanmohsin/ligandnet2
2
python
def main(): MiscUtil.PrintInfo(('\n%s (RDK v%s; %s): Starting...\n' % (ScriptName, rdBase.rdkitVersion, time.asctime()))) (WallClockTime, ProcessorTime) = MiscUtil.GetWallClockAndProcessorTime() RetrieveOptions() ProcessOptions() PerformSearch() MiscUtil.PrintInfo(('\n%s: Done...\n' % Scrip...
def main(): MiscUtil.PrintInfo(('\n%s (RDK v%s; %s): Starting...\n' % (ScriptName, rdBase.rdkitVersion, time.asctime()))) (WallClockTime, ProcessorTime) = MiscUtil.GetWallClockAndProcessorTime() RetrieveOptions() ProcessOptions() PerformSearch() MiscUtil.PrintInfo(('\n%s: Done...\n' % Scrip...
0c69cce426c90c2d9d6a1509f7e8c47a21b0c1cbb85e1320471a8c600731833f
def PerformSearch(): 'Perform search using specified SMARTS pattern.' Infile = OptionsInfo['Infile'] Outfile = OptionsInfo['Outfile'] CountMode = OptionsInfo['CountMode'] NegateMatch = OptionsInfo['NegateMatch'] UseChirality = OptionsInfo['UseChirality'] PatternMol = Chem.MolFromSmarts(Optio...
Perform search using specified SMARTS pattern.
ddt/mayachemtools/bin/RDKitSearchSMARTS.py
PerformSearch
hassanmohsin/ligandnet2
2
python
def PerformSearch(): Infile = OptionsInfo['Infile'] Outfile = OptionsInfo['Outfile'] CountMode = OptionsInfo['CountMode'] NegateMatch = OptionsInfo['NegateMatch'] UseChirality = OptionsInfo['UseChirality'] PatternMol = Chem.MolFromSmarts(OptionsInfo['Pattern']) MiscUtil.PrintInfo(('\nPr...
def PerformSearch(): Infile = OptionsInfo['Infile'] Outfile = OptionsInfo['Outfile'] CountMode = OptionsInfo['CountMode'] NegateMatch = OptionsInfo['NegateMatch'] UseChirality = OptionsInfo['UseChirality'] PatternMol = Chem.MolFromSmarts(OptionsInfo['Pattern']) MiscUtil.PrintInfo(('\nPr...
d48c9dd079e7377b95d723d434a61da64d1be9768ba64cceb7fe050abc69d43e
def ProcessOptions(): 'Process and validate command line arguments and options' MiscUtil.PrintInfo('Processing options...') ValidateOptions() OptionsInfo['Infile'] = Options['--infile'] OptionsInfo['InfileParams'] = MiscUtil.ProcessOptionInfileParameters('--infileParams', Options['--infileParams'], ...
Process and validate command line arguments and options
ddt/mayachemtools/bin/RDKitSearchSMARTS.py
ProcessOptions
hassanmohsin/ligandnet2
2
python
def ProcessOptions(): MiscUtil.PrintInfo('Processing options...') ValidateOptions() OptionsInfo['Infile'] = Options['--infile'] OptionsInfo['InfileParams'] = MiscUtil.ProcessOptionInfileParameters('--infileParams', Options['--infileParams'], Options['--infile']) OptionsInfo['Outfile'] = Options...
def ProcessOptions(): MiscUtil.PrintInfo('Processing options...') ValidateOptions() OptionsInfo['Infile'] = Options['--infile'] OptionsInfo['InfileParams'] = MiscUtil.ProcessOptionInfileParameters('--infileParams', Options['--infileParams'], Options['--infile']) OptionsInfo['Outfile'] = Options...
ef69323ac03db10cbe860826c1f8fe709f18c30bf610246c9a2baaea7b4293be
def RetrieveOptions(): 'Retrieve command line arguments and options' global Options Options = docopt(_docoptUsage_) WorkingDir = Options['--workingdir'] if WorkingDir: os.chdir(WorkingDir) if (('--examples' in Options) and Options['--examples']): MiscUtil.PrintInfo(MiscUtil.GetEx...
Retrieve command line arguments and options
ddt/mayachemtools/bin/RDKitSearchSMARTS.py
RetrieveOptions
hassanmohsin/ligandnet2
2
python
def RetrieveOptions(): global Options Options = docopt(_docoptUsage_) WorkingDir = Options['--workingdir'] if WorkingDir: os.chdir(WorkingDir) if (('--examples' in Options) and Options['--examples']): MiscUtil.PrintInfo(MiscUtil.GetExamplesTextFromDocOptText(_docoptUsage_)) ...
def RetrieveOptions(): global Options Options = docopt(_docoptUsage_) WorkingDir = Options['--workingdir'] if WorkingDir: os.chdir(WorkingDir) if (('--examples' in Options) and Options['--examples']): MiscUtil.PrintInfo(MiscUtil.GetExamplesTextFromDocOptText(_docoptUsage_)) ...
b6e9c7c8c515d7196c4fdb3e6405cf17945db7e3b09a1cfda330abe3a6180f1e
def ValidateOptions(): 'Validate option values' MiscUtil.ValidateOptionFilePath('-i, --infile', Options['--infile']) MiscUtil.ValidateOptionFileExt('-i, --infile', Options['--infile'], 'sdf sd smi txt csv tsv') if Options['--outfile']: MiscUtil.ValidateOptionFileExt('-o, --outfile', Options['--o...
Validate option values
ddt/mayachemtools/bin/RDKitSearchSMARTS.py
ValidateOptions
hassanmohsin/ligandnet2
2
python
def ValidateOptions(): MiscUtil.ValidateOptionFilePath('-i, --infile', Options['--infile']) MiscUtil.ValidateOptionFileExt('-i, --infile', Options['--infile'], 'sdf sd smi txt csv tsv') if Options['--outfile']: MiscUtil.ValidateOptionFileExt('-o, --outfile', Options['--outfile'], 'sdf sd smi') ...
def ValidateOptions(): MiscUtil.ValidateOptionFilePath('-i, --infile', Options['--infile']) MiscUtil.ValidateOptionFileExt('-i, --infile', Options['--infile'], 'sdf sd smi txt csv tsv') if Options['--outfile']: MiscUtil.ValidateOptionFileExt('-o, --outfile', Options['--outfile'], 'sdf sd smi') ...
451b37726d426d42a4dc3e9bc35673e88254f2fafe1f292c6b6bcd8ab88e41e0
def split_ranks(N_ranks, N, include_all=False): '\n Divide the ranks into chunks, attempting to have `N` ranks\n in each chunk. This removes the master (0) rank, such\n that `N_ranks - 1` ranks are available to be grouped\n\n Parameters\n ----------\n N_ranks : int\n the total number of ran...
Divide the ranks into chunks, attempting to have `N` ranks in each chunk. This removes the master (0) rank, such that `N_ranks - 1` ranks are available to be grouped Parameters ---------- N_ranks : int the total number of ranks available N : int the desired number of ranks per worker include_all : bool, option...
py/obiwan/batch/mpi_task_manager.py
split_ranks
adematti/obiwan
0
python
def split_ranks(N_ranks, N, include_all=False): '\n Divide the ranks into chunks, attempting to have `N` ranks\n in each chunk. This removes the master (0) rank, such\n that `N_ranks - 1` ranks are available to be grouped\n\n Parameters\n ----------\n N_ranks : int\n the total number of ran...
def split_ranks(N_ranks, N, include_all=False): '\n Divide the ranks into chunks, attempting to have `N` ranks\n in each chunk. This removes the master (0) rank, such\n that `N_ranks - 1` ranks are available to be grouped\n\n Parameters\n ----------\n N_ranks : int\n the total number of ran...
668f3476c567ab73079b76e20c7b003cf53e7d3d355f15370b0b92904da81a11
def enum(*sequential, **named): '\n Enumeration values to serve as status tags passed\n between processes\n ' enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums)
Enumeration values to serve as status tags passed between processes
py/obiwan/batch/mpi_task_manager.py
enum
adematti/obiwan
0
python
def enum(*sequential, **named): '\n Enumeration values to serve as status tags passed\n between processes\n ' enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums)
def enum(*sequential, **named): '\n Enumeration values to serve as status tags passed\n between processes\n ' enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums)<|docstring|>Enumeration values to serve as status tags passed between processes<|endoftext|>
6cffce4e2e30af3f1a6cd144ec9910894922a52f835eeef6a9b16eb74150dc25
@staticmethod def enable(func): '\n Decorator to attach the current MPI communicator to the input\n keyword arguments of ``func``, via the ``comm`` keyword.\n ' import functools @functools.wraps(func) def wrapped(*args, **kwargs): kwargs.setdefault('comm', None) if ...
Decorator to attach the current MPI communicator to the input keyword arguments of ``func``, via the ``comm`` keyword.
py/obiwan/batch/mpi_task_manager.py
enable
adematti/obiwan
0
python
@staticmethod def enable(func): '\n Decorator to attach the current MPI communicator to the input\n keyword arguments of ``func``, via the ``comm`` keyword.\n ' import functools @functools.wraps(func) def wrapped(*args, **kwargs): kwargs.setdefault('comm', None) if ...
@staticmethod def enable(func): '\n Decorator to attach the current MPI communicator to the input\n keyword arguments of ``func``, via the ``comm`` keyword.\n ' import functools @functools.wraps(func) def wrapped(*args, **kwargs): kwargs.setdefault('comm', None) if ...
7418a9c0867e0c283b29c7a1da6a10a7aaec9ff69e4ece08c845f990ab2f4b91
@classmethod @contextmanager def enter(cls, comm): '\n Enters a context where the current default MPI communicator is modified to the\n argument `comm`. After leaving the context manager the communicator is restored.\n\n Example:\n\n .. code:: python\n\n with CurrentMPIComm.en...
Enters a context where the current default MPI communicator is modified to the argument `comm`. After leaving the context manager the communicator is restored. Example: .. code:: python with CurrentMPIComm.enter(comm): cat = UniformCatalog(...) is identical to .. code:: python cat = UniformCatalog...
py/obiwan/batch/mpi_task_manager.py
enter
adematti/obiwan
0
python
@classmethod @contextmanager def enter(cls, comm): '\n Enters a context where the current default MPI communicator is modified to the\n argument `comm`. After leaving the context manager the communicator is restored.\n\n Example:\n\n .. code:: python\n\n with CurrentMPIComm.en...
@classmethod @contextmanager def enter(cls, comm): '\n Enters a context where the current default MPI communicator is modified to the\n argument `comm`. After leaving the context manager the communicator is restored.\n\n Example:\n\n .. code:: python\n\n with CurrentMPIComm.en...
952d297dd44b3b13bf6dad7adb8de97e5ef2e37b65097486fb715f38c3b80760
@classmethod def push(cls, comm): 'Switch to a new current default MPI communicator.' cls._stack.append(comm) if (comm.rank == 0): cls.logger.info('Entering a current communicator of size %d', comm.size) cls._stack[(- 1)].barrier()
Switch to a new current default MPI communicator.
py/obiwan/batch/mpi_task_manager.py
push
adematti/obiwan
0
python
@classmethod def push(cls, comm): cls._stack.append(comm) if (comm.rank == 0): cls.logger.info('Entering a current communicator of size %d', comm.size) cls._stack[(- 1)].barrier()
@classmethod def push(cls, comm): cls._stack.append(comm) if (comm.rank == 0): cls.logger.info('Entering a current communicator of size %d', comm.size) cls._stack[(- 1)].barrier()<|docstring|>Switch to a new current default MPI communicator.<|endoftext|>
8daad08e2505f45b2b7a15bb2a20c98932d8ca05a7ca2f0ebbe306051b896956
@classmethod def pop(cls): 'Restore to the previous current default MPI communicator.' comm = cls._stack[(- 1)] if (comm.rank == 0): cls.logger.info('Leaving current communicator of size %d', comm.size) cls._stack[(- 1)].barrier() cls._stack.pop() comm = cls._stack[(- 1)] if (comm.ra...
Restore to the previous current default MPI communicator.
py/obiwan/batch/mpi_task_manager.py
pop
adematti/obiwan
0
python
@classmethod def pop(cls): comm = cls._stack[(- 1)] if (comm.rank == 0): cls.logger.info('Leaving current communicator of size %d', comm.size) cls._stack[(- 1)].barrier() cls._stack.pop() comm = cls._stack[(- 1)] if (comm.rank == 0): cls.logger.info('Restored current communi...
@classmethod def pop(cls): comm = cls._stack[(- 1)] if (comm.rank == 0): cls.logger.info('Leaving current communicator of size %d', comm.size) cls._stack[(- 1)].barrier() cls._stack.pop() comm = cls._stack[(- 1)] if (comm.rank == 0): cls.logger.info('Restored current communi...
873a329e490f7c9e9fba3d47119a3de226b066946a660662ae8a0ce67d2b7470
@classmethod def get(cls): '\n Get the default current MPI communicator. The initial value is ``MPI.COMM_WORLD``.\n ' return cls._stack[(- 1)]
Get the default current MPI communicator. The initial value is ``MPI.COMM_WORLD``.
py/obiwan/batch/mpi_task_manager.py
get
adematti/obiwan
0
python
@classmethod def get(cls): '\n \n ' return cls._stack[(- 1)]
@classmethod def get(cls): '\n \n ' return cls._stack[(- 1)]<|docstring|>Get the default current MPI communicator. The initial value is ``MPI.COMM_WORLD``.<|endoftext|>
760f7ff375272852e669a29b8d8c6f421b07e7b8c1abb4010f737f2a596dfd84
@classmethod def set(cls, comm): '\n Set the current MPI communicator to the input value.\n ' warnings.warn('CurrentMPIComm.set is deprecated. Use `with CurrentMPIComm.enter(comm):` instead') cls._stack[(- 1)].barrier() cls._stack[(- 1)] = comm cls._stack[(- 1)].barrier()
Set the current MPI communicator to the input value.
py/obiwan/batch/mpi_task_manager.py
set
adematti/obiwan
0
python
@classmethod def set(cls, comm): '\n \n ' warnings.warn('CurrentMPIComm.set is deprecated. Use `with CurrentMPIComm.enter(comm):` instead') cls._stack[(- 1)].barrier() cls._stack[(- 1)] = comm cls._stack[(- 1)].barrier()
@classmethod def set(cls, comm): '\n \n ' warnings.warn('CurrentMPIComm.set is deprecated. Use `with CurrentMPIComm.enter(comm):` instead') cls._stack[(- 1)].barrier() cls._stack[(- 1)] = comm cls._stack[(- 1)].barrier()<|docstring|>Set the current MPI communicator to the input value.<...
f339920c765c8f70b2561e654b4f323176b078f8ac3d385c0a568186d3c6ee9a
@CurrentMPIComm.enable def __init__(self, cpus_per_task=1, comm=None, debug=False, use_all_cpus=False): '\n Init MPITaskManager.\n\n Parameters\n ----------\n cpus_per_task : int, optional\n the desired number of ranks assigned to compute\n each task\n comm :...
Init MPITaskManager. Parameters ---------- cpus_per_task : int, optional the desired number of ranks assigned to compute each task comm : MPI communicator, optional the global communicator that will be split so each worker has a subset of CPUs available; default is COMM_WORLD debug : bool, optional ...
py/obiwan/batch/mpi_task_manager.py
__init__
adematti/obiwan
0
python
@CurrentMPIComm.enable def __init__(self, cpus_per_task=1, comm=None, debug=False, use_all_cpus=False): '\n Init MPITaskManager.\n\n Parameters\n ----------\n cpus_per_task : int, optional\n the desired number of ranks assigned to compute\n each task\n comm :...
@CurrentMPIComm.enable def __init__(self, cpus_per_task=1, comm=None, debug=False, use_all_cpus=False): '\n Init MPITaskManager.\n\n Parameters\n ----------\n cpus_per_task : int, optional\n the desired number of ranks assigned to compute\n each task\n comm :...
d7a37a8c20b46539c61465deb18492ffec2ebdc3ac02b21b555624b62fe3604f
def __enter__(self): '\n Split the base communicator such that each task gets allocated\n the specified number of cpus to perform the task with.\n ' chain_ranks = [] color = 0 total_ranks = 0 nworkers = 0 for (i, ranks) in split_ranks(self.size, self.cpus_per_task, include_a...
Split the base communicator such that each task gets allocated the specified number of cpus to perform the task with.
py/obiwan/batch/mpi_task_manager.py
__enter__
adematti/obiwan
0
python
def __enter__(self): '\n Split the base communicator such that each task gets allocated\n the specified number of cpus to perform the task with.\n ' chain_ranks = [] color = 0 total_ranks = 0 nworkers = 0 for (i, ranks) in split_ranks(self.size, self.cpus_per_task, include_a...
def __enter__(self): '\n Split the base communicator such that each task gets allocated\n the specified number of cpus to perform the task with.\n ' chain_ranks = [] color = 0 total_ranks = 0 nworkers = 0 for (i, ranks) in split_ranks(self.size, self.cpus_per_task, include_a...
f66229df293e1dd37a9a776af661712fc828cb3371b65a431681bbde39a4ab4e
def is_root(self): '\n Is the current process the root process?\n\n Root is responsible for distributing the tasks to the other available ranks\n ' return (self.rank == 0)
Is the current process the root process? Root is responsible for distributing the tasks to the other available ranks
py/obiwan/batch/mpi_task_manager.py
is_root
adematti/obiwan
0
python
def is_root(self): '\n Is the current process the root process?\n\n Root is responsible for distributing the tasks to the other available ranks\n ' return (self.rank == 0)
def is_root(self): '\n Is the current process the root process?\n\n Root is responsible for distributing the tasks to the other available ranks\n ' return (self.rank == 0)<|docstring|>Is the current process the root process? Root is responsible for distributing the tasks to the other avail...
376cd05ede00ae74b95cbfbc4ab029c3eb1f84faa27f820ad21dd7a6b5eb571b
def is_worker(self): '\n Is the current process a valid worker?\n\n Workers wait for instructions from the master\n ' try: return self._valid_worker except: raise ValueError('workers are only defined when inside the ``with TaskManager()`` context')
Is the current process a valid worker? Workers wait for instructions from the master
py/obiwan/batch/mpi_task_manager.py
is_worker
adematti/obiwan
0
python
def is_worker(self): '\n Is the current process a valid worker?\n\n Workers wait for instructions from the master\n ' try: return self._valid_worker except: raise ValueError('workers are only defined when inside the ``with TaskManager()`` context')
def is_worker(self): '\n Is the current process a valid worker?\n\n Workers wait for instructions from the master\n ' try: return self._valid_worker except: raise ValueError('workers are only defined when inside the ``with TaskManager()`` context')<|docstring|>Is the cur...
eee9adacf9248785040447d87863ab8284ec8e4cb91a08bf0265eb7ac8b9434f
def _get_tasks(self): 'Internal generator that yields the next available task from a worker.' if self.is_root(): raise RuntimeError('Root rank mistakenly told to await tasks') if (self.comm.rank == 0): args = (self.rank, MPI.Get_processor_name(), self.comm.size) self.logger.debug('wo...
Internal generator that yields the next available task from a worker.
py/obiwan/batch/mpi_task_manager.py
_get_tasks
adematti/obiwan
0
python
def _get_tasks(self): if self.is_root(): raise RuntimeError('Root rank mistakenly told to await tasks') if (self.comm.rank == 0): args = (self.rank, MPI.Get_processor_name(), self.comm.size) self.logger.debug('worker master rank is %d on %s with %d processes available', *args) w...
def _get_tasks(self): if self.is_root(): raise RuntimeError('Root rank mistakenly told to await tasks') if (self.comm.rank == 0): args = (self.rank, MPI.Get_processor_name(), self.comm.size) self.logger.debug('worker master rank is %d on %s with %d processes available', *args) w...
c1fe26b45aa12d1946cd9fab148be99a25f0f00f62e8752d7be4f7aa6eed39c8
def _distribute_tasks(self, tasks): 'Internal function that distributes the tasks from the root to the workers.' if (not self.is_root()): raise ValueError('only the root rank should distribute the tasks') ntasks = len(tasks) task_index = 0 closed_workers = 0 args = (self.workers, ntasks)...
Internal function that distributes the tasks from the root to the workers.
py/obiwan/batch/mpi_task_manager.py
_distribute_tasks
adematti/obiwan
0
python
def _distribute_tasks(self, tasks): if (not self.is_root()): raise ValueError('only the root rank should distribute the tasks') ntasks = len(tasks) task_index = 0 closed_workers = 0 args = (self.workers, ntasks) self.logger.debug('master starting with %d worker(s) with %d total task...
def _distribute_tasks(self, tasks): if (not self.is_root()): raise ValueError('only the root rank should distribute the tasks') ntasks = len(tasks) task_index = 0 closed_workers = 0 args = (self.workers, ntasks) self.logger.debug('master starting with %d worker(s) with %d total task...
dd8c87c07e1fe76905c70a296d937ee172ab19b40b41a2098a800421d67a1106
def iterate(self, tasks): '\n Iterate through a series of tasks in parallel.\n\n Notes\n -----\n This is a collective operation and should be called by\n all ranks.\n\n Parameters\n ----------\n tasks : iterable\n An iterable of `task` items that wi...
Iterate through a series of tasks in parallel. Notes ----- This is a collective operation and should be called by all ranks. Parameters ---------- tasks : iterable An iterable of `task` items that will be yielded in parallel across all ranks. Yields ------- task : The individual items of `tasks`, iterate...
py/obiwan/batch/mpi_task_manager.py
iterate
adematti/obiwan
0
python
def iterate(self, tasks): '\n Iterate through a series of tasks in parallel.\n\n Notes\n -----\n This is a collective operation and should be called by\n all ranks.\n\n Parameters\n ----------\n tasks : iterable\n An iterable of `task` items that wi...
def iterate(self, tasks): '\n Iterate through a series of tasks in parallel.\n\n Notes\n -----\n This is a collective operation and should be called by\n all ranks.\n\n Parameters\n ----------\n tasks : iterable\n An iterable of `task` items that wi...
402d6dbfdc28cb6f34426175b90b1bddf88b943dc3de7a08349ca4312ea26e1b
def map(self, function, tasks): '\n Apply a function to all of the values in a list and return the list of results.\n\n If ``tasks`` contains tuples, the arguments are passed to\n ``function`` using the ``*args`` syntax.\n\n Notes\n -----\n This is a collective operation an...
Apply a function to all of the values in a list and return the list of results. If ``tasks`` contains tuples, the arguments are passed to ``function`` using the ``*args`` syntax. Notes ----- This is a collective operation and should be called by all ranks. Parameters ---------- function : callable The function t...
py/obiwan/batch/mpi_task_manager.py
map
adematti/obiwan
0
python
def map(self, function, tasks): '\n Apply a function to all of the values in a list and return the list of results.\n\n If ``tasks`` contains tuples, the arguments are passed to\n ``function`` using the ``*args`` syntax.\n\n Notes\n -----\n This is a collective operation an...
def map(self, function, tasks): '\n Apply a function to all of the values in a list and return the list of results.\n\n If ``tasks`` contains tuples, the arguments are passed to\n ``function`` using the ``*args`` syntax.\n\n Notes\n -----\n This is a collective operation an...
b755391230413280c2042a9dd85c9b695eba3e49192c6805342f52b0939999e5
def __exit__(self, exc_type, exc_value, exc_traceback): 'Exit gracefully by closing and freeing the MPI-related variables.' if (exc_value is not None): trace = ''.join(traceback.format_exception(exc_type, exc_value, exc_traceback, limit=5)) self.logger.error('an exception has occurred on rank %d...
Exit gracefully by closing and freeing the MPI-related variables.
py/obiwan/batch/mpi_task_manager.py
__exit__
adematti/obiwan
0
python
def __exit__(self, exc_type, exc_value, exc_traceback): if (exc_value is not None): trace = .join(traceback.format_exception(exc_type, exc_value, exc_traceback, limit=5)) self.logger.error('an exception has occurred on rank %d:\n%s', self.rank, trace) os._exit(1) self.logger.debug('...
def __exit__(self, exc_type, exc_value, exc_traceback): if (exc_value is not None): trace = .join(traceback.format_exception(exc_type, exc_value, exc_traceback, limit=5)) self.logger.error('an exception has occurred on rank %d:\n%s', self.rank, trace) os._exit(1) self.logger.debug('...
3fbdfca56034b69fb19744c46faecabc45a58e826dd89454fa01f56bf7dc225a
def make_migrations_for_accounts(organizations) -> None: '\n Creates migrations for the following account use cases:\n - move an account\n - - when the remote parent ou exists - ACCOUNT_MOVE\n - - when the remote parent ou does not exist - ACCOUNT_MOVE_WITH_NON_EXISTENT_PARENT_OU\n :param organ...
Creates migrations for the following account use cases: - move an account - - when the remote parent ou exists - ACCOUNT_MOVE - - when the remote parent ou does not exist - ACCOUNT_MOVE_WITH_NON_EXISTENT_PARENT_OU :param organizations: :return:
aws_organized/aws_organized.py
make_migrations_for_accounts
zuliya/aws-organized
0
python
def make_migrations_for_accounts(organizations) -> None: '\n Creates migrations for the following account use cases:\n - move an account\n - - when the remote parent ou exists - ACCOUNT_MOVE\n - - when the remote parent ou does not exist - ACCOUNT_MOVE_WITH_NON_EXISTENT_PARENT_OU\n :param organ...
def make_migrations_for_accounts(organizations) -> None: '\n Creates migrations for the following account use cases:\n - move an account\n - - when the remote parent ou exists - ACCOUNT_MOVE\n - - when the remote parent ou does not exist - ACCOUNT_MOVE_WITH_NON_EXISTENT_PARENT_OU\n :param organ...
8fbd60fee24f5d3aafaf01f7ecf998309d9caf291ebdeb84d89777b43f434c1e
def make_migrations_for_organizational_units(organizations) -> None: '\n Creates migrations for the following OU use cases:\n - add an ou\n - - where the remote parent exists - OU_CREATE\n - - where the remote parent does not exist yet - OU_CREATE_WITH_NON_EXISTENT_PARENT_OU\n - rename an ou\...
Creates migrations for the following OU use cases: - add an ou - - where the remote parent exists - OU_CREATE - - where the remote parent does not exist yet - OU_CREATE_WITH_NON_EXISTENT_PARENT_OU - rename an ou - - where the remote ou existed already - OU_RENAME Does not support the following OU use cases: ...
aws_organized/aws_organized.py
make_migrations_for_organizational_units
zuliya/aws-organized
0
python
def make_migrations_for_organizational_units(organizations) -> None: '\n Creates migrations for the following OU use cases:\n - add an ou\n - - where the remote parent exists - OU_CREATE\n - - where the remote parent does not exist yet - OU_CREATE_WITH_NON_EXISTENT_PARENT_OU\n - rename an ou\...
def make_migrations_for_organizational_units(organizations) -> None: '\n Creates migrations for the following OU use cases:\n - add an ou\n - - where the remote parent exists - OU_CREATE\n - - where the remote parent does not exist yet - OU_CREATE_WITH_NON_EXISTENT_PARENT_OU\n - rename an ou\...
bb6be35f9445af90afe198f90957a640c54cf21ded34b1477ff71fe1d84a02bf
def __init__(self, host: str, concurrent_job_limit: int=0) -> None: 'Initialize a JobSubmitter instance.\n\n Args:\n host: URL of the master node through which the jobs will be submitted.\n concurrent_job_limit: Maximum number of jubs that can be submitted to a cluster\n ...
Initialize a JobSubmitter instance. Args: host: URL of the master node through which the jobs will be submitted. concurrent_job_limit: Maximum number of jubs that can be submitted to a cluster at a given time. ``0`` (default) means unlimited.
jobsubmitter/jobsubmitter.py
__init__
kim-lab/jobsubmitter
3
python
def __init__(self, host: str, concurrent_job_limit: int=0) -> None: 'Initialize a JobSubmitter instance.\n\n Args:\n host: URL of the master node through which the jobs will be submitted.\n concurrent_job_limit: Maximum number of jubs that can be submitted to a cluster\n ...
def __init__(self, host: str, concurrent_job_limit: int=0) -> None: 'Initialize a JobSubmitter instance.\n\n Args:\n host: URL of the master node through which the jobs will be submitted.\n concurrent_job_limit: Maximum number of jubs that can be submitted to a cluster\n ...
e4795cac5a1239e68d85aec42b1d3e76c89adda558de7c06f9cac7400a0e6283
@staticmethod def get_stdout_log(working_dir: Path, job_id: str, job_idx: int) -> Path: 'Generate complete filename of the STDOUT log file.\n\n Args:\n working_dir: Full path to the directory from which the jobs are submitted.\n job_id: Folder in which job logs are stored.\n ...
Generate complete filename of the STDOUT log file. Args: working_dir: Full path to the directory from which the jobs are submitted. job_id: Folder in which job logs are stored. job_idx: The index of the particular job.
jobsubmitter/jobsubmitter.py
get_stdout_log
kim-lab/jobsubmitter
3
python
@staticmethod def get_stdout_log(working_dir: Path, job_id: str, job_idx: int) -> Path: 'Generate complete filename of the STDOUT log file.\n\n Args:\n working_dir: Full path to the directory from which the jobs are submitted.\n job_id: Folder in which job logs are stored.\n ...
@staticmethod def get_stdout_log(working_dir: Path, job_id: str, job_idx: int) -> Path: 'Generate complete filename of the STDOUT log file.\n\n Args:\n working_dir: Full path to the directory from which the jobs are submitted.\n job_id: Folder in which job logs are stored.\n ...
d3c5c97d1547b53e9c9e1fda474db8a89472179310fdf465b114571970a32ff3
@staticmethod def get_stderr_log(working_dir: Path, job_id: str, job_idx: int) -> Path: 'Generate complete filename of the STDERR log file.' return working_dir.joinpath(job_id).joinpath(f'{job_idx}.err')
Generate complete filename of the STDERR log file.
jobsubmitter/jobsubmitter.py
get_stderr_log
kim-lab/jobsubmitter
3
python
@staticmethod def get_stderr_log(working_dir: Path, job_id: str, job_idx: int) -> Path: return working_dir.joinpath(job_id).joinpath(f'{job_idx}.err')
@staticmethod def get_stderr_log(working_dir: Path, job_id: str, job_idx: int) -> Path: return working_dir.joinpath(job_id).joinpath(f'{job_idx}.err')<|docstring|>Generate complete filename of the STDERR log file.<|endoftext|>
69f1839c565d0914444f9fa563235d418cc99db001d98c492e4e1a2839b0e548
@contextmanager def connect(self): 'Open connection to head node.' self._connect() (yield) self._disconnect()
Open connection to head node.
jobsubmitter/jobsubmitter.py
connect
kim-lab/jobsubmitter
3
python
@contextmanager def connect(self): self._connect() (yield) self._disconnect()
@contextmanager def connect(self): self._connect() (yield) self._disconnect()<|docstring|>Open connection to head node.<|endoftext|>
6f204a3a6516d1cd3741b1afdff376932bce0180b0081e63611af2b5900a8301
def _disconnect(self): 'Close connection to head node.' self.ssh.close() self.ssh = None atexit.unregister(self._disconnect)
Close connection to head node.
jobsubmitter/jobsubmitter.py
_disconnect
kim-lab/jobsubmitter
3
python
def _disconnect(self): self.ssh.close() self.ssh = None atexit.unregister(self._disconnect)
def _disconnect(self): self.ssh.close() self.ssh = None atexit.unregister(self._disconnect)<|docstring|>Close connection to head node.<|endoftext|>
f56eb8030f38133305e5171ea5df71998e37ba79e62b85577456b3b288a8b36c
def submit(self, df: pd.DataFrame, job_opts: JobOpts, deplay=0.02, progressbar=True): 'Sumit jobs to the cluster.\n\n You have to establish a connection first (explicit is better than implicit).\n\n Examples:\n >>> with js.connect():\n ... js.submit([(0, \'echo "Hello world!"...
Sumit jobs to the cluster. You have to establish a connection first (explicit is better than implicit). Examples: >>> with js.connect(): ... js.submit([(0, 'echo "Hello world!"), (1, 'echo "Goodbye world!"')]
jobsubmitter/jobsubmitter.py
submit
kim-lab/jobsubmitter
3
python
def submit(self, df: pd.DataFrame, job_opts: JobOpts, deplay=0.02, progressbar=True): 'Sumit jobs to the cluster.\n\n You have to establish a connection first (explicit is better than implicit).\n\n Examples:\n >>> with js.connect():\n ... js.submit([(0, \'echo "Hello world!"...
def submit(self, df: pd.DataFrame, job_opts: JobOpts, deplay=0.02, progressbar=True): 'Sumit jobs to the cluster.\n\n You have to establish a connection first (explicit is better than implicit).\n\n Examples:\n >>> with js.connect():\n ... js.submit([(0, \'echo "Hello world!"...
0bba3d1cb1a1f2a3c11838edfe836f5fbe1c925147ef8a374ffcb709d3e8b988
def _local_worker(self, row, job_opts) -> str: '\n\n TODO: This should return the id of the job running on the cluster.\n ' stdout_log = self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index) stderr_log = self.get_stderr_log(job_opts.working_dir, job_opts.job_id, row.Index) ...
TODO: This should return the id of the job running on the cluster.
jobsubmitter/jobsubmitter.py
_local_worker
kim-lab/jobsubmitter
3
python
def _local_worker(self, row, job_opts) -> str: '\n\n \n ' stdout_log = self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index) stderr_log = self.get_stderr_log(job_opts.working_dir, job_opts.job_id, row.Index) with stdout_log.open('w') as stdout, stderr_log.open('w') as stder...
def _local_worker(self, row, job_opts) -> str: '\n\n \n ' stdout_log = self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index) stderr_log = self.get_stderr_log(job_opts.working_dir, job_opts.job_id, row.Index) with stdout_log.open('w') as stdout, stderr_log.open('w') as stder...
cb95e6a5833858b86ec33be0198ce96ac662ad2640d6ef8279fe7dc4009dde07
def _remote_worker(self, row, job_opts) -> str: '\n\n TODO: This should return the id of the job running on the cluster.\n ' env = {**job_opts.env, 'SYSTEM_COMMAND': row.system_command, 'STDOUT_LOG': self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index), 'STDERR_LOG': self.get_stde...
TODO: This should return the id of the job running on the cluster.
jobsubmitter/jobsubmitter.py
_remote_worker
kim-lab/jobsubmitter
3
python
def _remote_worker(self, row, job_opts) -> str: '\n\n \n ' env = {**job_opts.env, 'SYSTEM_COMMAND': row.system_command, 'STDOUT_LOG': self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index), 'STDERR_LOG': self.get_stderr_log(job_opts.working_dir, job_opts.job_id, row.Index)} job_...
def _remote_worker(self, row, job_opts) -> str: '\n\n \n ' env = {**job_opts.env, 'SYSTEM_COMMAND': row.system_command, 'STDOUT_LOG': self.get_stdout_log(job_opts.working_dir, job_opts.job_id, row.Index), 'STDERR_LOG': self.get_stderr_log(job_opts.working_dir, job_opts.job_id, row.Index)} job_...
014b5a8ecb103eb5f715507d1da7b8c224291bcc54d6176e1f24e777692a989e
def _respect_concurrent_job_limit(self, job_idx: int) -> None: 'Limit the number of jobs running simultaneously.' STEP_SIZE = 50 DELAY = 120 if (self.concurrent_job_limit and (((job_idx + 1) % STEP_SIZE) == 0)): while ((self.num_submitted_jobs + STEP_SIZE) > self.concurrent_job_limit): ...
Limit the number of jobs running simultaneously.
jobsubmitter/jobsubmitter.py
_respect_concurrent_job_limit
kim-lab/jobsubmitter
3
python
def _respect_concurrent_job_limit(self, job_idx: int) -> None: STEP_SIZE = 50 DELAY = 120 if (self.concurrent_job_limit and (((job_idx + 1) % STEP_SIZE) == 0)): while ((self.num_submitted_jobs + STEP_SIZE) > self.concurrent_job_limit): logger.info("'concurrent_job_limit' reached! Sl...
def _respect_concurrent_job_limit(self, job_idx: int) -> None: STEP_SIZE = 50 DELAY = 120 if (self.concurrent_job_limit and (((job_idx + 1) % STEP_SIZE) == 0)): while ((self.num_submitted_jobs + STEP_SIZE) > self.concurrent_job_limit): logger.info("'concurrent_job_limit' reached! Sl...
6665c722d23d55cecd493615f744a07d0f8d073e288ae777b1cad2f74f1dede3
def job_status(self, df: pd.DataFrame, job_opts: JobOpts, progressbar=True): 'Read the status and results of each submitted job.\n\n Notes:\n - Multithrading does not make it faster :(.\n ' os.listdir(job_opts.working_dir.joinpath(job_opts.job_id)) results = [self._read_results(row,...
Read the status and results of each submitted job. Notes: - Multithrading does not make it faster :(.
jobsubmitter/jobsubmitter.py
job_status
kim-lab/jobsubmitter
3
python
def job_status(self, df: pd.DataFrame, job_opts: JobOpts, progressbar=True): 'Read the status and results of each submitted job.\n\n Notes:\n - Multithrading does not make it faster :(.\n ' os.listdir(job_opts.working_dir.joinpath(job_opts.job_id)) results = [self._read_results(row,...
def job_status(self, df: pd.DataFrame, job_opts: JobOpts, progressbar=True): 'Read the status and results of each submitted job.\n\n Notes:\n - Multithrading does not make it faster :(.\n ' os.listdir(job_opts.working_dir.joinpath(job_opts.job_id)) results = [self._read_results(row,...
dd6e04d3aa0a9f049f773ed649c1668098b56e093e17174f2fecda81723a0b60
@property def num_submitted_jobs(self) -> int: 'Count the number of *submitted* jobs by the current user.' if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | wc -l' stdout = execute_remotely(self.ssh, system_command) try: num_submit...
Count the number of *submitted* jobs by the current user.
jobsubmitter/jobsubmitter.py
num_submitted_jobs
kim-lab/jobsubmitter
3
python
@property def num_submitted_jobs(self) -> int: if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | wc -l' stdout = execute_remotely(self.ssh, system_command) try: num_submitted_jobs = int(stdout) except ValueError: num_s...
@property def num_submitted_jobs(self) -> int: if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | wc -l' stdout = execute_remotely(self.ssh, system_command) try: num_submitted_jobs = int(stdout) except ValueError: num_s...
8c5a42264e257dc05ea12d3f3be7ba3965acf2f4349dcc3fddbb1f9d069fb0f9
@property def num_running_jobs(self) -> int: 'Count the number of *running* jobs by the current user.' if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | grep -i " r " | wc -l' stdout = execute_remotely(self.ssh, system_command) logger.deb...
Count the number of *running* jobs by the current user.
jobsubmitter/jobsubmitter.py
num_running_jobs
kim-lab/jobsubmitter
3
python
@property def num_running_jobs(self) -> int: if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | grep -i " r " | wc -l' stdout = execute_remotely(self.ssh, system_command) logger.debug(stdout) num_running_jobs = int(stdout) return ...
@property def num_running_jobs(self) -> int: if (self.host_opts.scheme == 'local'): return None system_command = 'qstat -u "$USER" | grep "$USER" | grep -i " r " | wc -l' stdout = execute_remotely(self.ssh, system_command) logger.debug(stdout) num_running_jobs = int(stdout) return ...
a1243ea0a200adf7313c550e70025b363852b947c631381aec7f60bb4b35c8dc
def __init__(self, kernel_type='linear', C=1.0, gamma=5.0): "\n :param kernel_type: Kernel type to use in training.\n 'linear' use linear kernel function.\n 'quadratic' use quadratic kernel function.\n 'gaussian' use gaussian kernel functio...
:param kernel_type: Kernel type to use in training. 'linear' use linear kernel function. 'quadratic' use quadratic kernel function. 'gaussian' use gaussian kernel function :param C: Value of regularization parameter C :param gamma: parameter for gaussian kernel or Polynom...
Ridge/kernel_ridge/kernel_ridge.py
__init__
Alvin1king/Machine-Learning-
0
python
def __init__(self, kernel_type='linear', C=1.0, gamma=5.0): "\n :param kernel_type: Kernel type to use in training.\n 'linear' use linear kernel function.\n 'quadratic' use quadratic kernel function.\n 'gaussian' use gaussian kernel functio...
def __init__(self, kernel_type='linear', C=1.0, gamma=5.0): "\n :param kernel_type: Kernel type to use in training.\n 'linear' use linear kernel function.\n 'quadratic' use quadratic kernel function.\n 'gaussian' use gaussian kernel functio...
83547565c4089cc0f207c671b04b1197df8376e6c5a48db1445883b5a266ae72
def compute_kernel_matrix(self, X1, X2): '\n compute kernel matrix (gram matrix) give two input matrix\n ' n1 = X1.shape[0] n2 = X2.shape[0] K = np.zeros((n1, n2)) for i in range(n1): for j in range(n2): K[(i, j)] = self.kernel(X1[i], X2[j]) return K
compute kernel matrix (gram matrix) give two input matrix
Ridge/kernel_ridge/kernel_ridge.py
compute_kernel_matrix
Alvin1king/Machine-Learning-
0
python
def compute_kernel_matrix(self, X1, X2): '\n \n ' n1 = X1.shape[0] n2 = X2.shape[0] K = np.zeros((n1, n2)) for i in range(n1): for j in range(n2): K[(i, j)] = self.kernel(X1[i], X2[j]) return K
def compute_kernel_matrix(self, X1, X2): '\n \n ' n1 = X1.shape[0] n2 = X2.shape[0] K = np.zeros((n1, n2)) for i in range(n1): for j in range(n2): K[(i, j)] = self.kernel(X1[i], X2[j]) return K<|docstring|>compute kernel matrix (gram matrix) give two input matri...
2b627e7055bd6a547b8d69ea862c0fe4cdff85f92a3d99fbc17bd94a97825c96
def fit(self, X, y): '\n training KRR\n :param X: training X\n :param y: training y\n :return: alpha vector, see document TODO\n ' K = self.compute_kernel_matrix(X, X) self.alphas = sp.dot(inv((K + (self.C * np.eye(np.shape(K)[0])))), y.transpose()) return self.alphas
training KRR :param X: training X :param y: training y :return: alpha vector, see document TODO
Ridge/kernel_ridge/kernel_ridge.py
fit
Alvin1king/Machine-Learning-
0
python
def fit(self, X, y): '\n training KRR\n :param X: training X\n :param y: training y\n :return: alpha vector, see document TODO\n ' K = self.compute_kernel_matrix(X, X) self.alphas = sp.dot(inv((K + (self.C * np.eye(np.shape(K)[0])))), y.transpose()) return self.alphas
def fit(self, X, y): '\n training KRR\n :param X: training X\n :param y: training y\n :return: alpha vector, see document TODO\n ' K = self.compute_kernel_matrix(X, X) self.alphas = sp.dot(inv((K + (self.C * np.eye(np.shape(K)[0])))), y.transpose()) return self.alphas<...
05ff58a84472780e435edc10e6705dc68442bfbe62d72fceba6bcb1bbec3dceb
def predict(self, x_train, x_test): '\n\n :param x_train: DxNtr array of Ntr train data points\n with D features\n :param x_test: DxNte array of Nte test data points\n with D features\n :return: y_test, D2xNte array\n ' k = self.compute_...
:param x_train: DxNtr array of Ntr train data points with D features :param x_test: DxNte array of Nte test data points with D features :return: y_test, D2xNte array
Ridge/kernel_ridge/kernel_ridge.py
predict
Alvin1king/Machine-Learning-
0
python
def predict(self, x_train, x_test): '\n\n :param x_train: DxNtr array of Ntr train data points\n with D features\n :param x_test: DxNte array of Nte test data points\n with D features\n :return: y_test, D2xNte array\n ' k = self.compute_...
def predict(self, x_train, x_test): '\n\n :param x_train: DxNtr array of Ntr train data points\n with D features\n :param x_test: DxNte array of Nte test data points\n with D features\n :return: y_test, D2xNte array\n ' k = self.compute_...
737e057afb91dcfc26c10213bcd1fd47e9cb02369decf5c60f88cd6d4604803e
def estimated_autocorrelation(x): '\n http://stackoverflow.com/q/14297012/190597\n http://en.wikipedia.org/wiki/Autocorrelation#Estimation\n ' n = len(x) variance = x.var() x = (x - x.mean()) r = np.correlate(x, x, mode='full')[(- n):] result = (r / (variance * np.arange(n, 0, (- 1)))) ...
http://stackoverflow.com/q/14297012/190597 http://en.wikipedia.org/wiki/Autocorrelation#Estimation
stannetflow/evaluation/correlation.py
estimated_autocorrelation
ShengzheXu/stan
2
python
def estimated_autocorrelation(x): '\n http://stackoverflow.com/q/14297012/190597\n http://en.wikipedia.org/wiki/Autocorrelation#Estimation\n ' n = len(x) variance = x.var() x = (x - x.mean()) r = np.correlate(x, x, mode='full')[(- n):] result = (r / (variance * np.arange(n, 0, (- 1)))) ...
def estimated_autocorrelation(x): '\n http://stackoverflow.com/q/14297012/190597\n http://en.wikipedia.org/wiki/Autocorrelation#Estimation\n ' n = len(x) variance = x.var() x = (x - x.mean()) r = np.correlate(x, x, mode='full')[(- n):] result = (r / (variance * np.arange(n, 0, (- 1)))) ...
21009332639cd573795952c168d1f5ab34c1dcb1d47e7538c5171b5d7ad32fca
def get_delegated_services(account_id: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetDelegatedServicesResult: '\n Get a list the AWS services for which the specified account is a delegated administrator\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi...
Get a list the AWS services for which the specified account is a delegated administrator ## Example Usage ```python import pulumi import pulumi_aws as aws example = aws.organizations.get_delegated_services(account_id="AWS ACCOUNT ID") ``` :param str account_id: The account ID number of a delegated administrator ac...
sdk/python/pulumi_aws/organizations/get_delegated_services.py
get_delegated_services
dmelo/pulumi-aws
260
python
def get_delegated_services(account_id: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetDelegatedServicesResult: '\n Get a list the AWS services for which the specified account is a delegated administrator\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi...
def get_delegated_services(account_id: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetDelegatedServicesResult: '\n Get a list the AWS services for which the specified account is a delegated administrator\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi...
f3048e275110d65dfd3f98a9e0860f3bd30ac137dae8edd9cb67bc1b7e737cda
@_utilities.lift_output_func(get_delegated_services) def get_delegated_services_output(account_id: Optional[pulumi.Input[str]]=None, opts: Optional[pulumi.InvokeOptions]=None) -> pulumi.Output[GetDelegatedServicesResult]: '\n Get a list the AWS services for which the specified account is a delegated administrato...
Get a list the AWS services for which the specified account is a delegated administrator ## Example Usage ```python import pulumi import pulumi_aws as aws example = aws.organizations.get_delegated_services(account_id="AWS ACCOUNT ID") ``` :param str account_id: The account ID number of a delegated administrator ac...
sdk/python/pulumi_aws/organizations/get_delegated_services.py
get_delegated_services_output
dmelo/pulumi-aws
260
python
@_utilities.lift_output_func(get_delegated_services) def get_delegated_services_output(account_id: Optional[pulumi.Input[str]]=None, opts: Optional[pulumi.InvokeOptions]=None) -> pulumi.Output[GetDelegatedServicesResult]: '\n Get a list the AWS services for which the specified account is a delegated administrato...
@_utilities.lift_output_func(get_delegated_services) def get_delegated_services_output(account_id: Optional[pulumi.Input[str]]=None, opts: Optional[pulumi.InvokeOptions]=None) -> pulumi.Output[GetDelegatedServicesResult]: '\n Get a list the AWS services for which the specified account is a delegated administrato...
bd0014c5110c403ce189c81fad3f318ffb9b718a7893022dc8c586693b080263
@property @pulumi.getter(name='delegatedServices') def delegated_services(self) -> Sequence['outputs.GetDelegatedServicesDelegatedServiceResult']: '\n The services for which the account is a delegated administrator, which have the following attributes:\n ' return pulumi.get(self, 'delegated_servic...
The services for which the account is a delegated administrator, which have the following attributes:
sdk/python/pulumi_aws/organizations/get_delegated_services.py
delegated_services
dmelo/pulumi-aws
260
python
@property @pulumi.getter(name='delegatedServices') def delegated_services(self) -> Sequence['outputs.GetDelegatedServicesDelegatedServiceResult']: '\n \n ' return pulumi.get(self, 'delegated_services')
@property @pulumi.getter(name='delegatedServices') def delegated_services(self) -> Sequence['outputs.GetDelegatedServicesDelegatedServiceResult']: '\n \n ' return pulumi.get(self, 'delegated_services')<|docstring|>The services for which the account is a delegated administrator, which have the foll...
bcf5b51a327014088b63f706e1dc3987198031e1f0241bd10b06cf4dd5bcb53c
@property @pulumi.getter def id(self) -> str: '\n The provider-assigned unique ID for this managed resource.\n ' return pulumi.get(self, 'id')
The provider-assigned unique ID for this managed resource.
sdk/python/pulumi_aws/organizations/get_delegated_services.py
id
dmelo/pulumi-aws
260
python
@property @pulumi.getter def id(self) -> str: '\n \n ' return pulumi.get(self, 'id')
@property @pulumi.getter def id(self) -> str: '\n \n ' return pulumi.get(self, 'id')<|docstring|>The provider-assigned unique ID for this managed resource.<|endoftext|>
3935b76b3f7a8132afae53041b655574775c2e47e05202ae9d47e49c91463227
def adjust_event_hours(self, hourdelta=int): '\n Adjust the hour in a calendar event by (n) hours.\n Create a time() property for both the event begin and \n event end, with corrected hour stamps according to hourdelta\n parameter. The instance attribute will be accessible through\n ...
Adjust the hour in a calendar event by (n) hours. Create a time() property for both the event begin and event end, with corrected hour stamps according to hourdelta parameter. The instance attribute will be accessible through self.begin.time and self.end.time.
source/schedule.py
adjust_event_hours
gustavakerstrom99/RobBotTheRobot
0
python
def adjust_event_hours(self, hourdelta=int): '\n Adjust the hour in a calendar event by (n) hours.\n Create a time() property for both the event begin and \n event end, with corrected hour stamps according to hourdelta\n parameter. The instance attribute will be accessible through\n ...
def adjust_event_hours(self, hourdelta=int): '\n Adjust the hour in a calendar event by (n) hours.\n Create a time() property for both the event begin and \n event end, with corrected hour stamps according to hourdelta\n parameter. The instance attribute will be accessible through\n ...
29222c897e26d14af894e5421298c0345fe5875210c2c29c93a2afd1a1fd3968
def set_calendar(self): '\n Get data from the timeedit servers containing the\n curriculum for class IoT19 2 weeks ahead. This callable\n will refresh the .ics Calendar object.\n ' try: calendar = ics.Calendar(urlopen(self._url).read().decode()) except ValueError: ...
Get data from the timeedit servers containing the curriculum for class IoT19 2 weeks ahead. This callable will refresh the .ics Calendar object.
source/schedule.py
set_calendar
gustavakerstrom99/RobBotTheRobot
0
python
def set_calendar(self): '\n Get data from the timeedit servers containing the\n curriculum for class IoT19 2 weeks ahead. This callable\n will refresh the .ics Calendar object.\n ' try: calendar = ics.Calendar(urlopen(self._url).read().decode()) except ValueError: ...
def set_calendar(self): '\n Get data from the timeedit servers containing the\n curriculum for class IoT19 2 weeks ahead. This callable\n will refresh the .ics Calendar object.\n ' try: calendar = ics.Calendar(urlopen(self._url).read().decode()) except ValueError: ...
fdf7793c0616133b8013bae136cd01d289fe5e2862d84979da2a0bd94d5de4d7
def truncate_event_name(self): '\n Truncate sensitive name data in events, containing the\n name of the teacher holding the class. This will reduce\n the privacy issue of storing names in log files.\n ' for event in self.curriculum: event.name = f"{event.name.split(',')[0]},{...
Truncate sensitive name data in events, containing the name of the teacher holding the class. This will reduce the privacy issue of storing names in log files.
source/schedule.py
truncate_event_name
gustavakerstrom99/RobBotTheRobot
0
python
def truncate_event_name(self): '\n Truncate sensitive name data in events, containing the\n name of the teacher holding the class. This will reduce\n the privacy issue of storing names in log files.\n ' for event in self.curriculum: event.name = f"{event.name.split(',')[0]},{...
def truncate_event_name(self): '\n Truncate sensitive name data in events, containing the\n name of the teacher holding the class. This will reduce\n the privacy issue of storing names in log files.\n ' for event in self.curriculum: event.name = f"{event.name.split(',')[0]},{...
7452c4d8f4ba673d23849f36cf6a28a8fd59e53019135e9798b92563d8c73c72
@property def todays_lessons(self): '\n Iterate through the lessons of today, return these in a friendly\n string with properties such as start and end time with locations.\n ' output = [] if len(self.todays_events): for event in self.todays_events: name = event.name...
Iterate through the lessons of today, return these in a friendly string with properties such as start and end time with locations.
source/schedule.py
todays_lessons
gustavakerstrom99/RobBotTheRobot
0
python
@property def todays_lessons(self): '\n Iterate through the lessons of today, return these in a friendly\n string with properties such as start and end time with locations.\n ' output = [] if len(self.todays_events): for event in self.todays_events: name = event.name...
@property def todays_lessons(self): '\n Iterate through the lessons of today, return these in a friendly\n string with properties such as start and end time with locations.\n ' output = [] if len(self.todays_events): for event in self.todays_events: name = event.name...