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 |
|---|---|---|---|---|---|---|---|---|---|
6628fb6a5b9f76e328f52135a975d79a01c2d724b422f33e2f5376727844a992 | def find_fst_cmmnval_index(l0, l1, **kwargs):
'\n l0 = [[2, 0], [1, 2], [0, 0]]\n l1 = [[3, 0], [2, 0], [1, 2], [0, 0]]\n find_fst_cmmnval_index(l0,l1,reverse=True)\n (0,1)\n l0 = [1,2,33,4]\n l1 = [11,22,33]\n find_fst_cmmnval_index(l0,l1)\n (2,2)\n ... | l0 = [[2, 0], [1, 2], [0, 0]]
l1 = [[3, 0], [2, 0], [1, 2], [0, 0]]
find_fst_cmmnval_index(l0,l1,reverse=True)
(0,1)
l0 = [1,2,33,4]
l1 = [11,22,33]
find_fst_cmmnval_index(l0,l1)
(2,2) | elist/elist.py | find_fst_cmmnval_index | ihgazni2/elist | 0 | python | def find_fst_cmmnval_index(l0, l1, **kwargs):
'\n l0 = [[2, 0], [1, 2], [0, 0]]\n l1 = [[3, 0], [2, 0], [1, 2], [0, 0]]\n find_fst_cmmnval_index(l0,l1,reverse=True)\n (0,1)\n l0 = [1,2,33,4]\n l1 = [11,22,33]\n find_fst_cmmnval_index(l0,l1)\n (2,2)\n ... | def find_fst_cmmnval_index(l0, l1, **kwargs):
'\n l0 = [[2, 0], [1, 2], [0, 0]]\n l1 = [[3, 0], [2, 0], [1, 2], [0, 0]]\n find_fst_cmmnval_index(l0,l1,reverse=True)\n (0,1)\n l0 = [1,2,33,4]\n l1 = [11,22,33]\n find_fst_cmmnval_index(l0,l1)\n (2,2)\n ... |
4b60a6a57c0dd58227587a8f0e1991298b4fa952d2e43244a775e3c0b29d9966 | def get_children_handler(self, *args):
"\n list's children list is self\n "
return self.pdata | list's children list is self | elist/elist.py | get_children_handler | ihgazni2/elist | 0 | python | def get_children_handler(self, *args):
"\n \n "
return self.pdata | def get_children_handler(self, *args):
"\n \n "
return self.pdata<|docstring|>list's children list is self<|endoftext|> |
a749adf3d8c5282260b44cc5c2183efc4de72527781f9c56efb71086147cd41b | def parent_handler(self, lcache, i, *args):
'\n _update_pdesc_sons_info\n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
return pdesc | _update_pdesc_sons_info | elist/elist.py | parent_handler | ihgazni2/elist | 0 | python | def parent_handler(self, lcache, i, *args):
'\n \n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
return pdesc | def parent_handler(self, lcache, i, *args):
'\n \n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
return pdesc<|docstring|>_update_pdesc_sons_info<|endoftext|> |
e0c943ab375f08f6e428aefb517c81588b1a8fad2c6071e52b8144240f912371 | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... | _creat_child_desc
update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path | elist/elist.py | child_begin_handler | ihgazni2/elist | 0 | python | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... |
cee7d029299142b7ff3125c0cc0d647e64446a355b356398bdee54c21830b2dc | def leaf_handler(self, *args):
'#leaf child handler'
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) | #leaf child handler | elist/elist.py | leaf_handler | ihgazni2/elist | 0 | python | def leaf_handler(self, *args):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) | def leaf_handler(self, *args):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path']))<|docstring|>#leaf child handler<|endoftext|> |
a9aa91ada29d313e0d277f5f2c180a87ac871ff99809ef73292167f00f8572c5 | def non_leaf_handler(self, lcache):
'#nonleaf child handler'
desc = self.leaf
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcache.ndesc.append(desc) | #nonleaf child handler | elist/elist.py | non_leaf_handler | ihgazni2/elist | 0 | python | def non_leaf_handler(self, lcache):
desc = self.leaf
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcache.ndesc.append(desc) | def non_leaf_handler(self, lcache):
desc = self.leaf
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcache.ndesc.append(desc)<|docstring|>#nonleaf child handler<|endoftext|> |
45e9f4a2ddae939f3c0977cc02d4b10194ad40217b22c9d69f78a060d4d9056e | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... | _upgrade_breadth_info
update breadth, breadth_path, and add desc to desc_level | elist/elist.py | child_end_handler | ihgazni2/elist | 0 | python | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... |
4b60a6a57c0dd58227587a8f0e1991298b4fa952d2e43244a775e3c0b29d9966 | def get_children_handler(self, *args):
"\n list's children list is self\n "
return self.pdata | list's children list is self | elist/elist.py | get_children_handler | ihgazni2/elist | 0 | python | def get_children_handler(self, *args):
"\n \n "
return self.pdata | def get_children_handler(self, *args):
"\n \n "
return self.pdata<|docstring|>list's children list is self<|endoftext|> |
79fd8445287f292890c03b9c2a25053b934e19c0c0f9f2c603750d149c610299 | def parent_handler(self, lcache, i, *args):
'\n _update_pdesc_sons_info\n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
pdesc['leaf_descendant_paths'] = []
pdesc['non_leaf_descendant_paths'] = []
... | _update_pdesc_sons_info | elist/elist.py | parent_handler | ihgazni2/elist | 0 | python | def parent_handler(self, lcache, i, *args):
'\n \n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
pdesc['leaf_descendant_paths'] = []
pdesc['non_leaf_descendant_paths'] = []
return pdesc | def parent_handler(self, lcache, i, *args):
'\n \n '
pdesc = lcache.desc[i]
pdesc['sons_count'] = self.sibs_len
pdesc['leaf_son_paths'] = []
pdesc['non_leaf_son_paths'] = []
pdesc['leaf_descendant_paths'] = []
pdesc['non_leaf_descendant_paths'] = []
return pdesc<|docstr... |
e0c943ab375f08f6e428aefb517c81588b1a8fad2c6071e52b8144240f912371 | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... | _creat_child_desc
update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path | elist/elist.py | child_begin_handler | ihgazni2/elist | 0 | python | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... | def child_begin_handler(self, scache, *args):
'\n _creat_child_desc\n update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path\n '
pdesc = self.pdesc
depth = scache.depth
sib_seq = self.sib_seq
sibs_len = self.sibs_len
pdesc_l... |
e02e04f62ef53b6d3c1cb7928a226e1b656684ebba1a167e83aedd38d2724d5d | def leaf_handler(self, *args):
'#leaf child handler'
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path'])) | #leaf child handler | elist/elist.py | leaf_handler | ihgazni2/elist | 0 | python | def leaf_handler(self, *args):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path'])) | def leaf_handler(self, *args):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = True
desc['sons_count'] = 0
pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path']))<|docstring|>#leaf child handler<|endoftext|> |
c9a82955431e6792a8ae6bb9497fdc0e2eda92e07c53267e40a146b10cf1bc80 | def non_leaf_handler(self, lcache):
'#nonleaf child handler'
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcac... | #nonleaf child handler | elist/elist.py | non_leaf_handler | ihgazni2/elist | 0 | python | def non_leaf_handler(self, lcache):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcache.ndesc.append(desc) | def non_leaf_handler(self, lcache):
desc = self.desc
pdesc = self.pdesc
desc['leaf'] = False
pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path']))
pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
lcache.ndata.append(self.data)
lcache.ndesc.append(desc)<|d... |
45e9f4a2ddae939f3c0977cc02d4b10194ad40217b22c9d69f78a060d4d9056e | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... | _upgrade_breadth_info
update breadth, breadth_path, and add desc to desc_level | elist/elist.py | child_end_handler | ihgazni2/elist | 0 | python | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... | def child_end_handler(self, scache):
'\n _upgrade_breadth_info\n update breadth, breadth_path, and add desc to desc_level\n '
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth)... |
4726cfe703e6b9fe47eca72916180cbb64abd9fe52c83f9ab7a132b3c38fead6 | def build_tree(stix_objects, log):
'\n Build a multi-root tree using the stix_objects input\n :param stix_objects: list of stix objects\n :param log:\n :return: multi-root tree\n '
tree = None
for obj in stix_objects:
if ((obj['type'] != 'relationship') and (obj['type'] != 'sighting')... | Build a multi-root tree using the stix_objects input
:param stix_objects: list of stix objects
:param log:
:return: multi-root tree | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | build_tree | rudimeyer/resilient-community-apps | 1 | python | def build_tree(stix_objects, log):
'\n Build a multi-root tree using the stix_objects input\n :param stix_objects: list of stix objects\n :param log:\n :return: multi-root tree\n '
tree = None
for obj in stix_objects:
if ((obj['type'] != 'relationship') and (obj['type'] != 'sighting')... | def build_tree(stix_objects, log):
'\n Build a multi-root tree using the stix_objects input\n :param stix_objects: list of stix objects\n :param log:\n :return: multi-root tree\n '
tree = None
for obj in stix_objects:
if ((obj['type'] != 'relationship') and (obj['type'] != 'sighting')... |
c55100c6939b12a72dc3c9784f716d7ff9f9645bcb95428ca04f26b9ff94b2d3 | def handle_relations(stix_objects, tree, log):
'\n Handle stix2 relation objects given in the stix_objects input\n :param stix_objects: list of stix2 objects\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
found_relationship = False
for obj in stix_objects:
if ... | Handle stix2 relation objects given in the stix_objects input
:param stix_objects: list of stix2 objects
:param tree: multi-root tree to build
:param log:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | handle_relations | rudimeyer/resilient-community-apps | 1 | python | def handle_relations(stix_objects, tree, log):
'\n Handle stix2 relation objects given in the stix_objects input\n :param stix_objects: list of stix2 objects\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
found_relationship = False
for obj in stix_objects:
if ... | def handle_relations(stix_objects, tree, log):
'\n Handle stix2 relation objects given in the stix_objects input\n :param stix_objects: list of stix2 objects\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
found_relationship = False
for obj in stix_objects:
if ... |
41e30e11760c58c61834e4d4226eee8c21f9ce8dccc544de49b98d819703b74b | def get_sight_ref_created_by(stix_objects, obj, log):
'\n Get the stix2 object (from stix_objects) that creates the sighting_of object\n :param stix_objects: stix2 object list\n :param obj: stix2 object\n :param log:\n :return: stix2 object id for sight_ref_created_by\n '
sight_ref_created_by ... | Get the stix2 object (from stix_objects) that creates the sighting_of object
:param stix_objects: stix2 object list
:param obj: stix2 object
:param log:
:return: stix2 object id for sight_ref_created_by | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | get_sight_ref_created_by | rudimeyer/resilient-community-apps | 1 | python | def get_sight_ref_created_by(stix_objects, obj, log):
'\n Get the stix2 object (from stix_objects) that creates the sighting_of object\n :param stix_objects: stix2 object list\n :param obj: stix2 object\n :param log:\n :return: stix2 object id for sight_ref_created_by\n '
sight_ref_created_by ... | def get_sight_ref_created_by(stix_objects, obj, log):
'\n Get the stix2 object (from stix_objects) that creates the sighting_of object\n :param stix_objects: stix2 object list\n :param obj: stix2 object\n :param log:\n :return: stix2 object id for sight_ref_created_by\n '
sight_ref_created_by ... |
2f03846771c05bb8d08c12c9d35648d337267d2680794ae6e3034ca8a9ef8d47 | def handle_sightings(stix_objects, tree, log):
'\n Handle all the sightings within the stix_objects input\n :param stix_objects: stix2 object list\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
for obj in stix_objects:
if (obj['type'] == 'sighting'):
n... | Handle all the sightings within the stix_objects input
:param stix_objects: stix2 object list
:param tree: multi-root tree to build
:param log:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | handle_sightings | rudimeyer/resilient-community-apps | 1 | python | def handle_sightings(stix_objects, tree, log):
'\n Handle all the sightings within the stix_objects input\n :param stix_objects: stix2 object list\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
for obj in stix_objects:
if (obj['type'] == 'sighting'):
n... | def handle_sightings(stix_objects, tree, log):
'\n Handle all the sightings within the stix_objects input\n :param stix_objects: stix2 object list\n :param tree: multi-root tree to build\n :param log:\n :return:\n '
for obj in stix_objects:
if (obj['type'] == 'sighting'):
n... |
1ecd29c241cf687e0698abdbd155e6d05db33e72ac3c99dbad6318333ef267aa | def extract_object(stix_objects, multi_root_tree, object_id, log):
'\n For a given object id, look for the node from the multi-root tree. If found, return a copy of it.\n If not found, look for the stix object from the stix_objects list, and creat a node for it. Return the node.\n :param stix_objects: stix... | For a given object id, look for the node from the multi-root tree. If found, return a copy of it.
If not found, look for the stix object from the stix_objects list, and creat a node for it. Return the node.
:param stix_objects: stix object list
:param multi_root_tree: the multi-root tree
:param object_id: object id
:pa... | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | extract_object | rudimeyer/resilient-community-apps | 1 | python | def extract_object(stix_objects, multi_root_tree, object_id, log):
'\n For a given object id, look for the node from the multi-root tree. If found, return a copy of it.\n If not found, look for the stix object from the stix_objects list, and creat a node for it. Return the node.\n :param stix_objects: stix... | def extract_object(stix_objects, multi_root_tree, object_id, log):
'\n For a given object id, look for the node from the multi-root tree. If found, return a copy of it.\n If not found, look for the stix object from the stix_objects list, and creat a node for it. Return the node.\n :param stix_objects: stix... |
59a0a8f7bec04d1b9212d667918a014dc4fda8ea7d4355bfc28223eb773acf83 | def get_html(stix, log):
'\n Generate a html string for a stix bundle. Use a structure similar to a\n folder tree to represent the stix bundle.\n :param stix:\n :param log:\n :return:\n '
from .relation_visitor import RelationVisitor
objects = stix['objects']
stix_tree = build_tree(obj... | Generate a html string for a stix bundle. Use a structure similar to a
folder tree to represent the stix bundle.
:param stix:
:param log:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | get_html | rudimeyer/resilient-community-apps | 1 | python | def get_html(stix, log):
'\n Generate a html string for a stix bundle. Use a structure similar to a\n folder tree to represent the stix bundle.\n :param stix:\n :param log:\n :return:\n '
from .relation_visitor import RelationVisitor
objects = stix['objects']
stix_tree = build_tree(obj... | def get_html(stix, log):
'\n Generate a html string for a stix bundle. Use a structure similar to a\n folder tree to represent the stix bundle.\n :param stix:\n :param log:\n :return:\n '
from .relation_visitor import RelationVisitor
objects = stix['objects']
stix_tree = build_tree(obj... |
8780ae59813459e73c9dac3088ccf33ea4d42bfdeec7029df5dec63445a94679 | def accept(self, visitor):
'\n Accept a visitor\n :param visitor:\n :return:\n '
for root in self.roots:
should_continue = root.accept(visitor)
if (not should_continue):
break | Accept a visitor
:param visitor:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | accept | rudimeyer/resilient-community-apps | 1 | python | def accept(self, visitor):
'\n Accept a visitor\n :param visitor:\n :return:\n '
for root in self.roots:
should_continue = root.accept(visitor)
if (not should_continue):
break | def accept(self, visitor):
'\n Accept a visitor\n :param visitor:\n :return:\n '
for root in self.roots:
should_continue = root.accept(visitor)
if (not should_continue):
break<|docstring|>Accept a visitor
:param visitor:
:return:<|endoftext|> |
a0a32c2b5c105175c7ce83f8d83e4b310dca4f8cfdcce72eb81b3c3ed4f6e827 | def add_root(self, node):
'\n # Add the input node to the root list\n :param node:\n :return:\n '
node.is_root = True
self.roots.append(node) | # Add the input node to the root list
:param node:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | add_root | rudimeyer/resilient-community-apps | 1 | python | def add_root(self, node):
'\n # Add the input node to the root list\n :param node:\n :return:\n '
node.is_root = True
self.roots.append(node) | def add_root(self, node):
'\n # Add the input node to the root list\n :param node:\n :return:\n '
node.is_root = True
self.roots.append(node)<|docstring|># Add the input node to the root list
:param node:
:return:<|endoftext|> |
1581cfc4e3d06ef0917538339f37ded8d68c68c7d89ddca1c34fca6ec4260ee1 | def remove_root(self, node):
'\n Remove a root from the root list\n :param node:\n :return:\n '
self.roots.remove(node) | Remove a root from the root list
:param node:
:return: | fn_qradar_advisor/fn_qradar_advisor/lib/stix_tree.py | remove_root | rudimeyer/resilient-community-apps | 1 | python | def remove_root(self, node):
'\n Remove a root from the root list\n :param node:\n :return:\n '
self.roots.remove(node) | def remove_root(self, node):
'\n Remove a root from the root list\n :param node:\n :return:\n '
self.roots.remove(node)<|docstring|>Remove a root from the root list
:param node:
:return:<|endoftext|> |
98aa6b7b41c4393099e60d1d556859ca67b0010081b34e8f664fd21f55443118 | def total_supply(self, token):
'\n Gets the total token supply from the BSCSCAN API\n '
url = f'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress={token}&apikey={self.API_KEY}'
data = requests.get(url)
data = data.json()
if (data['status'] == '1'):
ret... | Gets the total token supply from the BSCSCAN API | src/bscscan.py | total_supply | Midnight-Analytics/cryptocurrency | 1 | python | def total_supply(self, token):
'\n \n '
url = f'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress={token}&apikey={self.API_KEY}'
data = requests.get(url)
data = data.json()
if (data['status'] == '1'):
return data['result']
else:
return 'Bad... | def total_supply(self, token):
'\n \n '
url = f'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress={token}&apikey={self.API_KEY}'
data = requests.get(url)
data = data.json()
if (data['status'] == '1'):
return data['result']
else:
return 'Bad... |
f2cec430eff949b00d84ecb6a3729ed3907810c001e1b10f35334ee6d6e75442 | def get_socials(self, token):
'\n Hits the BscScan website for the corresponding token and returns the social media links for the target token \n '
url = f'https://bscscan.com/token/{token}'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
try:
ul_socials = ... | Hits the BscScan website for the corresponding token and returns the social media links for the target token | src/bscscan.py | get_socials | Midnight-Analytics/cryptocurrency | 1 | python | def get_socials(self, token):
'\n \n '
url = f'https://bscscan.com/token/{token}'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
try:
ul_socials = soup.find(class_='list-inline mb-0')
links = []
socials = {'token': token, 'socials': links}... | def get_socials(self, token):
'\n \n '
url = f'https://bscscan.com/token/{token}'
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
try:
ul_socials = soup.find(class_='list-inline mb-0')
links = []
socials = {'token': token, 'socials': links}... |
94a188ccfb4106e8c91710056e81938142eccb871b2bf39fbd909da0bd506f9e | async def run_client(client: Jenny) -> None:
'A basic encrypted chat application using nio.\n '
(await client.login())
async def after_first_sync():
print('Awaiting sync')
(await client.synced.wait())
for admin in config.admins:
client.trust_devices(admin)
for hoo... | A basic encrypted chat application using nio. | dors.py | run_client | Polsaker/dors-matrix | 2 | python | async def run_client(client: Jenny) -> None:
'\n '
(await client.login())
async def after_first_sync():
print('Awaiting sync')
(await client.synced.wait())
for admin in config.admins:
client.trust_devices(admin)
for hook in client.startup_hooks:
try:
... | async def run_client(client: Jenny) -> None:
'\n '
(await client.login())
async def after_first_sync():
print('Awaiting sync')
(await client.synced.wait())
for admin in config.admins:
client.trust_devices(admin)
for hook in client.startup_hooks:
try:
... |
42dbf626f279c39f59fc88b840a567b6382e93fc5e48fb9d4b4a40cca07f703f | async def login(self, *args, **kwargs) -> None:
'Log in either using the global variables or (if possible) using the\n session details file.\n '
if (os.path.exists('credentials.json') and os.path.isfile('credentials.json')):
try:
with open('credentials.json', 'r') as f:
... | Log in either using the global variables or (if possible) using the
session details file. | dors.py | login | Polsaker/dors-matrix | 2 | python | async def login(self, *args, **kwargs) -> None:
'Log in either using the global variables or (if possible) using the\n session details file.\n '
if (os.path.exists('credentials.json') and os.path.isfile('credentials.json')):
try:
with open('credentials.json', 'r') as f:
... | async def login(self, *args, **kwargs) -> None:
'Log in either using the global variables or (if possible) using the\n session details file.\n '
if (os.path.exists('credentials.json') and os.path.isfile('credentials.json')):
try:
with open('credentials.json', 'r') as f:
... |
63a9b0f0bba89b9bcadc5add22115ecd514a9f414d51c9cfb1ffee67a9b65437 | def trust_devices(self, user_id: str, device_list: Optional[str]=None) -> None:
'Trusts the devices of a user.\n\n If no device_list is provided, all of the users devices are trusted. If\n one is provided, only the devices with IDs in that list are trusted.\n\n Arguments:\n user_id {... | Trusts the devices of a user.
If no device_list is provided, all of the users devices are trusted. If
one is provided, only the devices with IDs in that list are trusted.
Arguments:
user_id {str} -- the user ID whose devices should be trusted.
Keyword Arguments:
device_list {Optional[str]} -- The full list o... | dors.py | trust_devices | Polsaker/dors-matrix | 2 | python | def trust_devices(self, user_id: str, device_list: Optional[str]=None) -> None:
'Trusts the devices of a user.\n\n If no device_list is provided, all of the users devices are trusted. If\n one is provided, only the devices with IDs in that list are trusted.\n\n Arguments:\n user_id {... | def trust_devices(self, user_id: str, device_list: Optional[str]=None) -> None:
'Trusts the devices of a user.\n\n If no device_list is provided, all of the users devices are trusted. If\n one is provided, only the devices with IDs in that list are trusted.\n\n Arguments:\n user_id {... |
e3bf023db526498c77743fa2d47bdca6f617a8e46b351380607800664dc07337 | async def cb_autojoin_room(self, room: MatrixRoom, event: InviteEvent):
'Callback to automatically joins a Matrix room on invite.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {InviteEvent} -- Provided by nio\n '
(await self.join(room.room_id)) | Callback to automatically joins a Matrix room on invite.
Arguments:
room {MatrixRoom} -- Provided by nio
event {InviteEvent} -- Provided by nio | dors.py | cb_autojoin_room | Polsaker/dors-matrix | 2 | python | async def cb_autojoin_room(self, room: MatrixRoom, event: InviteEvent):
'Callback to automatically joins a Matrix room on invite.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {InviteEvent} -- Provided by nio\n '
(await self.join(room.room_id)) | async def cb_autojoin_room(self, room: MatrixRoom, event: InviteEvent):
'Callback to automatically joins a Matrix room on invite.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {InviteEvent} -- Provided by nio\n '
(await self.join(room.room_id))<|docstring|>Cal... |
45c31a7dcf8179ba3ff03834ab2f83da91144c1fab839b2c769355abe5ea0ce3 | async def on_message(self, room: MatrixRoom, event: RoomMessageText):
'Callback to print all received messages to stdout.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {RoomMessageText} -- Provided by nio\n '
if event.decrypted:
encrypted_symbol = '🛡 ... | Callback to print all received messages to stdout.
Arguments:
room {MatrixRoom} -- Provided by nio
event {RoomMessageText} -- Provided by nio | dors.py | on_message | Polsaker/dors-matrix | 2 | python | async def on_message(self, room: MatrixRoom, event: RoomMessageText):
'Callback to print all received messages to stdout.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {RoomMessageText} -- Provided by nio\n '
if event.decrypted:
encrypted_symbol = '🛡 ... | async def on_message(self, room: MatrixRoom, event: RoomMessageText):
'Callback to print all received messages to stdout.\n\n Arguments:\n room {MatrixRoom} -- Provided by nio\n event {RoomMessageText} -- Provided by nio\n '
if event.decrypted:
encrypted_symbol = '🛡 ... |
aa8402f76743182571b726f19eca82693b15677597665e1a7aae3125eff891a3 | async def message(self, target, message, p_html=False, message_type='m.notice'):
' Compatibility layer for porting IRC modules '
message = str(message)
if (('\x02' in message) or ('\x03' in message) or ('\x1f' in message) or ('\x1d' in message) or p_html):
if (not p_html):
message = html... | Compatibility layer for porting IRC modules | dors.py | message | Polsaker/dors-matrix | 2 | python | async def message(self, target, message, p_html=False, message_type='m.notice'):
' '
message = str(message)
if (('\x02' in message) or ('\x03' in message) or ('\x1f' in message) or ('\x1d' in message) or p_html):
if (not p_html):
message = html.escape(message)
message = re.sub('... | async def message(self, target, message, p_html=False, message_type='m.notice'):
' '
message = str(message)
if (('\x02' in message) or ('\x03' in message) or ('\x1f' in message) or ('\x1d' in message) or p_html):
if (not p_html):
message = html.escape(message)
message = re.sub('... |
c360e7c1155f99f1ad7425899e45329869a3a035b82b38b8211a20a723b08b20 | async def say(self, message):
' Dummy definition (wrapped) ' | Dummy definition (wrapped) | dors.py | say | Polsaker/dors-matrix | 2 | python | async def say(self, message):
' ' | async def say(self, message):
' '<|docstring|>Dummy definition (wrapped)<|endoftext|> |
88eb066161c35a79272b01434c0d588588c7a84ee70d819ff698f6b25a15e0df | async def reply(self, message):
' Dummy definition (wrapped) ' | Dummy definition (wrapped) | dors.py | reply | Polsaker/dors-matrix | 2 | python | async def reply(self, message):
' ' | async def reply(self, message):
' '<|docstring|>Dummy definition (wrapped)<|endoftext|> |
052ddd5df5c61e9af60078ca43ede12f31f67bc7bc9eca1650257cd7b881ee8f | def wrapper(self, room: MatrixRoom, event: RoomMessageFormatted):
' we wrap ourselves before passing to modules '
class BotWrapper(object):
def __init__(self, bot: Jenny):
self._bot: Jenny = bot
async def w_message(self, message: str):
(await self._bot.message(room.roo... | we wrap ourselves before passing to modules | dors.py | wrapper | Polsaker/dors-matrix | 2 | python | def wrapper(self, room: MatrixRoom, event: RoomMessageFormatted):
' '
class BotWrapper(object):
def __init__(self, bot: Jenny):
self._bot: Jenny = bot
async def w_message(self, message: str):
(await self._bot.message(room.room_id, message))
async def w_reply(... | def wrapper(self, room: MatrixRoom, event: RoomMessageFormatted):
' '
class BotWrapper(object):
def __init__(self, bot: Jenny):
self._bot: Jenny = bot
async def w_message(self, message: str):
(await self._bot.message(room.room_id, message))
async def w_reply(... |
c6a0e1b553ccdb2919d4f03fdbafddc731a2825b292d079ba732c42ea421ccea | @staticmethod
def __write_details_to_disk(resp: LoginResponse) -> None:
'Writes login details to disk so that we can restore our session later\n without logging in again and creating a new device ID.\n\n Arguments:\n resp {LoginResponse} -- the successful client login response.\n '
... | Writes login details to disk so that we can restore our session later
without logging in again and creating a new device ID.
Arguments:
resp {LoginResponse} -- the successful client login response. | dors.py | __write_details_to_disk | Polsaker/dors-matrix | 2 | python | @staticmethod
def __write_details_to_disk(resp: LoginResponse) -> None:
'Writes login details to disk so that we can restore our session later\n without logging in again and creating a new device ID.\n\n Arguments:\n resp {LoginResponse} -- the successful client login response.\n '
... | @staticmethod
def __write_details_to_disk(resp: LoginResponse) -> None:
'Writes login details to disk so that we can restore our session later\n without logging in again and creating a new device ID.\n\n Arguments:\n resp {LoginResponse} -- the successful client login response.\n '
... |
cad4e8d958dc4c2aacc337ba207124eca2afe7df21fa7888972038a908c0227b | def get_path(dataset):
'\n Get the path to the data file.\n Parameters\n ----------\n dataset : str\n The name of the dataset. See ``geopandas.datasets.available`` for\n all options.\n '
if (dataset in _available_shp):
return os.path.abspath(os.path.join(_module_path, 'shape... | Get the path to the data file.
Parameters
----------
dataset : str
The name of the dataset. See ``geopandas.datasets.available`` for
all options. | nzpermits/datasets/__init__.py | get_path | mullenkamp/nz-rma-permits | 0 | python | def get_path(dataset):
'\n Get the path to the data file.\n Parameters\n ----------\n dataset : str\n The name of the dataset. See ``geopandas.datasets.available`` for\n all options.\n '
if (dataset in _available_shp):
return os.path.abspath(os.path.join(_module_path, 'shape... | def get_path(dataset):
'\n Get the path to the data file.\n Parameters\n ----------\n dataset : str\n The name of the dataset. See ``geopandas.datasets.available`` for\n all options.\n '
if (dataset in _available_shp):
return os.path.abspath(os.path.join(_module_path, 'shape... |
30498016f87ea83842fbf79ee31c00250784a8a631ae3ad2e9b4b40d4d11b19c | def normalize_chunk(output: npt.NDArray, ints: npt.NDArray, lengths: npt.NDArray, scale_fn):
'this operation is in-place: the data is a buffer, output may be the same as ints'
scale = scale_fn(ints, axis=0)
scale[(scale == 0)] = np.nan
output[...] = (ints / scale) | this operation is in-place: the data is a buffer, output may be the same as ints | msi_zarr_analysis/preprocessing/normalize.py | normalize_chunk | maxime915/msi_zarr_analysis | 0 | python | def normalize_chunk(output: npt.NDArray, ints: npt.NDArray, lengths: npt.NDArray, scale_fn):
scale = scale_fn(ints, axis=0)
scale[(scale == 0)] = np.nan
output[...] = (ints / scale) | def normalize_chunk(output: npt.NDArray, ints: npt.NDArray, lengths: npt.NDArray, scale_fn):
scale = scale_fn(ints, axis=0)
scale[(scale == 0)] = np.nan
output[...] = (ints / scale)<|docstring|>this operation is in-place: the data is a buffer, output may be the same as ints<|endoftext|> |
71a340c9bfa44e80475c9a276f54552cb7bc8606799839878e74bb0cb43d0755 | def createIcnnClosure(inputDim, shapeTuple, lossChoices, Quad=None):
'\n :param shapeTuple: tuple which determines network architecture. 0-th element \n is number of nodes per dense hidden layer (width); 1st element is number of\n dense hidden layers (depth). \n \n :param model_losses: a set of losse... | :param shapeTuple: tuple which determines network architecture. 0-th element
is number of nodes per dense hidden layer (width); 1st element is number of
dense hidden layers (depth).
:param model_losses: a set of losses for the model
:return: the compiled model | src/IcnnClosure.py | createIcnnClosure | ScSteffen/neuralEntropyComparison | 1 | python | def createIcnnClosure(inputDim, shapeTuple, lossChoices, Quad=None):
'\n :param shapeTuple: tuple which determines network architecture. 0-th element \n is number of nodes per dense hidden layer (width); 1st element is number of\n dense hidden layers (depth). \n \n :param model_losses: a set of losse... | def createIcnnClosure(inputDim, shapeTuple, lossChoices, Quad=None):
'\n :param shapeTuple: tuple which determines network architecture. 0-th element \n is number of nodes per dense hidden layer (width); 1st element is number of\n dense hidden layers (depth). \n \n :param model_losses: a set of losse... |
aae768d7786a36966600e688ca57f036b8e0db250a97b8a36d60e88824cd25e2 | def convexLayer(layerInput_z: Tensor, netInput_x: Tensor, layerIdx=0) -> Tensor:
"\n WAP 14/4/21: Is this python? I've never used : for binding variable type to argument\n or -> assignment opearator. These Cpp shortcuts work?\n "
weightedNonNegSum_z = keras.layers.Dense(layerDim, kernel_co... | WAP 14/4/21: Is this python? I've never used : for binding variable type to argument
or -> assignment opearator. These Cpp shortcuts work? | src/IcnnClosure.py | convexLayer | ScSteffen/neuralEntropyComparison | 1 | python | def convexLayer(layerInput_z: Tensor, netInput_x: Tensor, layerIdx=0) -> Tensor:
"\n WAP 14/4/21: Is this python? I've never used : for binding variable type to argument\n or -> assignment opearator. These Cpp shortcuts work?\n "
weightedNonNegSum_z = keras.layers.Dense(layerDim, kernel_co... | def convexLayer(layerInput_z: Tensor, netInput_x: Tensor, layerIdx=0) -> Tensor:
"\n WAP 14/4/21: Is this python? I've never used : for binding variable type to argument\n or -> assignment opearator. These Cpp shortcuts work?\n "
weightedNonNegSum_z = keras.layers.Dense(layerDim, kernel_co... |
754a4489b574d92923721e355818169e3eec4f18aabbffa8d5a9482d1426929d | def call(self, x, training=False):
'\n Defines the sobolev execution\n '
with tf.GradientTape() as grad_tape:
grad_tape.watch(x)
h = self.coreModel(x)
alpha = grad_tape.gradient(h, x)
return [h, alpha, alpha] | Defines the sobolev execution | src/IcnnClosure.py | call | ScSteffen/neuralEntropyComparison | 1 | python | def call(self, x, training=False):
'\n \n '
with tf.GradientTape() as grad_tape:
grad_tape.watch(x)
h = self.coreModel(x)
alpha = grad_tape.gradient(h, x)
return [h, alpha, alpha] | def call(self, x, training=False):
'\n \n '
with tf.GradientTape() as grad_tape:
grad_tape.watch(x)
h = self.coreModel(x)
alpha = grad_tape.gradient(h, x)
return [h, alpha, alpha]<|docstring|>Defines the sobolev execution<|endoftext|> |
6567799e503d8e742ba8aaf239b787cfd349620ff5ac9ac8d1a3d1784da8f567 | def reconstruct_alpha(self, alpha):
'\n brief: Reconstructs alpha_0 and then concats alpha_0 to alpha_1,... , from alpha1,...\n Only works for maxwell Boltzmann entropy so far.\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x... | brief: Reconstructs alpha_0 and then concats alpha_0 to alpha_1,... , from alpha1,...
Only works for maxwell Boltzmann entropy so far.
nS = batchSize
N = basisSize
nq = number of quadPts
input: alpha, dims = (nS x N-1)
m , dims = (N x nq)
w , dims = nq
returns alpha_complete = [alpha_0,alp... | src/IcnnClosure.py | reconstruct_alpha | ScSteffen/neuralEntropyComparison | 1 | python | def reconstruct_alpha(self, alpha):
'\n brief: Reconstructs alpha_0 and then concats alpha_0 to alpha_1,... , from alpha1,...\n Only works for maxwell Boltzmann entropy so far.\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x... | def reconstruct_alpha(self, alpha):
'\n brief: Reconstructs alpha_0 and then concats alpha_0 to alpha_1,... , from alpha1,...\n Only works for maxwell Boltzmann entropy so far.\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x... |
ac66ba0b6857db235b7a70c1ef1db56b3385248a2a28286570b3380588474caf | def reconstruct_u(self, alpha):
"\n brief: reconstructs u from alpha\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x N)\n m , dims = (N x nq)\n w , dims = nq\n returns u = <m*eta_*'(alpha*m)>, dim = ... | brief: reconstructs u from alpha
nS = batchSize
N = basisSize
nq = number of quadPts
input: alpha, dims = (nS x N)
m , dims = (N x nq)
w , dims = nq
returns u = <m*eta_*'(alpha*m)>, dim = (nS x N) | src/IcnnClosure.py | reconstruct_u | ScSteffen/neuralEntropyComparison | 1 | python | def reconstruct_u(self, alpha):
"\n brief: reconstructs u from alpha\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x N)\n m , dims = (N x nq)\n w , dims = nq\n returns u = <m*eta_*'(alpha*m)>, dim = ... | def reconstruct_u(self, alpha):
"\n brief: reconstructs u from alpha\n nS = batchSize\n N = basisSize\n nq = number of quadPts\n\n input: alpha, dims = (nS x N)\n m , dims = (N x nq)\n w , dims = nq\n returns u = <m*eta_*'(alpha*m)>, dim = ... |
d0d763bd07834a5e7da917653cf093185ee604d807fad5133695d99050302d16 | def __init__(self, project_id, user_id, service, extra_target_data=None):
'Initialization of Policy Authority class.\n\n Validates whether a test role can perform a policy action by querying\n ``oslo.policy`` with necessary test data.\n\n If a policy file does not exist, checks whether the poli... | Initialization of Policy Authority class.
Validates whether a test role can perform a policy action by querying
``oslo.policy`` with necessary test data.
If a policy file does not exist, checks whether the policy file is
registered as a namespace under "oslo.policy.policies". Nova, for
example, doesn't use a policy f... | patrole_tempest_plugin/policy_authority.py | __init__ | Vegasq/patrole | 0 | python | def __init__(self, project_id, user_id, service, extra_target_data=None):
'Initialization of Policy Authority class.\n\n Validates whether a test role can perform a policy action by querying\n ``oslo.policy`` with necessary test data.\n\n If a policy file does not exist, checks whether the poli... | def __init__(self, project_id, user_id, service, extra_target_data=None):
'Initialization of Policy Authority class.\n\n Validates whether a test role can perform a policy action by querying\n ``oslo.policy`` with necessary test data.\n\n If a policy file does not exist, checks whether the poli... |
d323a8f263e95b6688fbed9c2fb6fd99500cf7eef718c46c44b957863b7cb122 | @classmethod
def validate_service(cls, service):
'Validate whether the service passed to ``__init__`` exists.'
service = (service.lower().strip() if service else None)
if (not hasattr(cls, 'available_services')):
admin_mgr = clients.Manager(credentials.get_configured_admin_credentials())
ser... | Validate whether the service passed to ``__init__`` exists. | patrole_tempest_plugin/policy_authority.py | validate_service | Vegasq/patrole | 0 | python | @classmethod
def validate_service(cls, service):
service = (service.lower().strip() if service else None)
if (not hasattr(cls, 'available_services')):
admin_mgr = clients.Manager(credentials.get_configured_admin_credentials())
services_client = (admin_mgr.identity_services_v3_client if CONF... | @classmethod
def validate_service(cls, service):
service = (service.lower().strip() if service else None)
if (not hasattr(cls, 'available_services')):
admin_mgr = clients.Manager(credentials.get_configured_admin_credentials())
services_client = (admin_mgr.identity_services_v3_client if CONF... |
f34ce76e7045b954f1ca3b7a3d75cee508b12e4162a48681b93f2ce4bcdc2c0a | @classmethod
def discover_policy_files(cls):
'Dynamically discover the policy file for each service in\n ``cls.available_services``. Pick all candidate paths found\n out of the potential paths in ``[patrole] custom_policy_files``.\n '
if (not hasattr(cls, 'policy_files')):
cls.polic... | Dynamically discover the policy file for each service in
``cls.available_services``. Pick all candidate paths found
out of the potential paths in ``[patrole] custom_policy_files``. | patrole_tempest_plugin/policy_authority.py | discover_policy_files | Vegasq/patrole | 0 | python | @classmethod
def discover_policy_files(cls):
'Dynamically discover the policy file for each service in\n ``cls.available_services``. Pick all candidate paths found\n out of the potential paths in ``[patrole] custom_policy_files``.\n '
if (not hasattr(cls, 'policy_files')):
cls.polic... | @classmethod
def discover_policy_files(cls):
'Dynamically discover the policy file for each service in\n ``cls.available_services``. Pick all candidate paths found\n out of the potential paths in ``[patrole] custom_policy_files``.\n '
if (not hasattr(cls, 'policy_files')):
cls.polic... |
10e4556747e7851166612bae85577ec6490cc862e5c57cf9dae7e21dca4c807c | def allowed(self, rule_name, role):
'Checks if a given rule in a policy is allowed with given role.\n\n :param string rule_name: Policy name to pass to``oslo.policy``.\n :param string role: Role to validate for authorization.\n :raises RbacParsingException: If ``rule_name`` does not exist in th... | Checks if a given rule in a policy is allowed with given role.
:param string rule_name: Policy name to pass to``oslo.policy``.
:param string role: Role to validate for authorization.
:raises RbacParsingException: If ``rule_name`` does not exist in the
cloud (in policy file or among registered in-code policy defaul... | patrole_tempest_plugin/policy_authority.py | allowed | Vegasq/patrole | 0 | python | def allowed(self, rule_name, role):
'Checks if a given rule in a policy is allowed with given role.\n\n :param string rule_name: Policy name to pass to``oslo.policy``.\n :param string role: Role to validate for authorization.\n :raises RbacParsingException: If ``rule_name`` does not exist in th... | def allowed(self, rule_name, role):
'Checks if a given rule in a policy is allowed with given role.\n\n :param string rule_name: Policy name to pass to``oslo.policy``.\n :param string role: Role to validate for authorization.\n :raises RbacParsingException: If ``rule_name`` does not exist in th... |
562706eb1af4b5ba877c42bacb1c4e473f20a076b6ebcf465291d01da199181f | def _is_admin_context(self, role):
'Checks whether a role has admin context.\n\n If context_is_admin is contained in the policy file, then checks\n whether the given role is contained in context_is_admin. If it is not\n in the policy file, then default to context_is_admin: admin.\n '
... | Checks whether a role has admin context.
If context_is_admin is contained in the policy file, then checks
whether the given role is contained in context_is_admin. If it is not
in the policy file, then default to context_is_admin: admin. | patrole_tempest_plugin/policy_authority.py | _is_admin_context | Vegasq/patrole | 0 | python | def _is_admin_context(self, role):
'Checks whether a role has admin context.\n\n If context_is_admin is contained in the policy file, then checks\n whether the given role is contained in context_is_admin. If it is not\n in the policy file, then default to context_is_admin: admin.\n '
... | def _is_admin_context(self, role):
'Checks whether a role has admin context.\n\n If context_is_admin is contained in the policy file, then checks\n whether the given role is contained in context_is_admin. If it is not\n in the policy file, then default to context_is_admin: admin.\n '
... |
0f2d095eafee647e7a25a8a05688dfadc706f7f5229063341c3c62c1c29fc5c2 | def _allowed(self, access, apply_rule, is_admin=False):
'Checks if a given rule in a policy is allowed with given ``access``.\n\n :param dict access: Dictionary from ``_get_access_token``.\n :param string apply_rule: Rule to be checked using ``oslo.policy``.\n :param bool is_admin: Whether admi... | Checks if a given rule in a policy is allowed with given ``access``.
:param dict access: Dictionary from ``_get_access_token``.
:param string apply_rule: Rule to be checked using ``oslo.policy``.
:param bool is_admin: Whether admin context is used. | patrole_tempest_plugin/policy_authority.py | _allowed | Vegasq/patrole | 0 | python | def _allowed(self, access, apply_rule, is_admin=False):
'Checks if a given rule in a policy is allowed with given ``access``.\n\n :param dict access: Dictionary from ``_get_access_token``.\n :param string apply_rule: Rule to be checked using ``oslo.policy``.\n :param bool is_admin: Whether admi... | def _allowed(self, access, apply_rule, is_admin=False):
'Checks if a given rule in a policy is allowed with given ``access``.\n\n :param dict access: Dictionary from ``_get_access_token``.\n :param string apply_rule: Rule to be checked using ``oslo.policy``.\n :param bool is_admin: Whether admi... |
cea29626eab1471fcbfdfc580d613ed1ecea3da798ad71e54595f7292953ff2a | def allPossibleFBT(self, N):
'\n :type N: int\n :rtype: List[TreeNode]\n '
if ((N % 2) == 0):
return []
if (N not in self.__memo):
result = []
for i in xrange(N):
for left in self.allPossibleFBT(i):
for right in self.allPossibleFBT(((N... | :type N: int
:rtype: List[TreeNode] | Python/all-possible-full-binary-trees.py | allPossibleFBT | cshu/LeetCode | 9 | python | def allPossibleFBT(self, N):
'\n :type N: int\n :rtype: List[TreeNode]\n '
if ((N % 2) == 0):
return []
if (N not in self.__memo):
result = []
for i in xrange(N):
for left in self.allPossibleFBT(i):
for right in self.allPossibleFBT(((N... | def allPossibleFBT(self, N):
'\n :type N: int\n :rtype: List[TreeNode]\n '
if ((N % 2) == 0):
return []
if (N not in self.__memo):
result = []
for i in xrange(N):
for left in self.allPossibleFBT(i):
for right in self.allPossibleFBT(((N... |
f310c6621a288a6ff7b4a372b7120f39881a3dfffa893ebb034e846af8fe6eb0 | def dumps(data, *args, **kwargs):
'Dump data to json'
def handler(obj):
'handle unsupported types converters'
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (... | Dump data to json | zoom/charts/pivot.py | dumps | murtazahassaniq21/zoom | 8 | python | def dumps(data, *args, **kwargs):
def handler(obj):
'handle unsupported types converters'
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (type(obj), repr(obj... | def dumps(data, *args, **kwargs):
def handler(obj):
'handle unsupported types converters'
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (type(obj), repr(obj... |
5a13be1fe31508f602b2b09d7e479c9323af8a17c74a60922250fb8b6b0e53c9 | def handler(obj):
'handle unsupported types converters'
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (type(obj), repr(obj)))) | handle unsupported types converters | zoom/charts/pivot.py | handler | murtazahassaniq21/zoom | 8 | python | def handler(obj):
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (type(obj), repr(obj)))) | def handler(obj):
if isinstance(obj, Decimal):
return str(obj)
else:
msg = 'Object of type %s with value %s is not JSON serializable.'
raise TypeError((msg % (type(obj), repr(obj))))<|docstring|>handle unsupported types converters<|endoftext|> |
358f17ee3d883257e8a343842b318daa68a183e978f097e1f5b1ecab76b9ade1 | def prepare_data(self, data):
' Prepare the data for the pivottable library.'
if hasattr(data, 'cursor'):
fields = list((col[0] for col in data.cursor.description))
records = list(data)
data = [dict(zip(fields, row)) for row in records]
for _dict in data:
for (k, v) i... | Prepare the data for the pivottable library. | zoom/charts/pivot.py | prepare_data | murtazahassaniq21/zoom | 8 | python | def prepare_data(self, data):
' '
if hasattr(data, 'cursor'):
fields = list((col[0] for col in data.cursor.description))
records = list(data)
data = [dict(zip(fields, row)) for row in records]
for _dict in data:
for (k, v) in _dict.items():
if (v is No... | def prepare_data(self, data):
' '
if hasattr(data, 'cursor'):
fields = list((col[0] for col in data.cursor.description))
records = list(data)
data = [dict(zip(fields, row)) for row in records]
for _dict in data:
for (k, v) in _dict.items():
if (v is No... |
7a51bcbe5878c0d35fb25dc4e288f9ed9eca127adb264c7ba929adfdd743330f | def format(self, chart):
'Format a Chart'
zoom.requires('pivot-table')
return (zoom.Component(("<div class='pivot-table' id='%s'></div>" % chart.selector)) + zoom.DynamicComponent.format(self, chart=chart)) | Format a Chart | zoom/charts/pivot.py | format | murtazahassaniq21/zoom | 8 | python | def format(self, chart):
zoom.requires('pivot-table')
return (zoom.Component(("<div class='pivot-table' id='%s'></div>" % chart.selector)) + zoom.DynamicComponent.format(self, chart=chart)) | def format(self, chart):
zoom.requires('pivot-table')
return (zoom.Component(("<div class='pivot-table' id='%s'></div>" % chart.selector)) + zoom.DynamicComponent.format(self, chart=chart))<|docstring|>Format a Chart<|endoftext|> |
fd6ef0d9e2f3848c75950eb0560531356779cc55e1eda7eb800886e207e5d1e9 | def _url(endpoint: str) -> str:
'Build a URL based on API configuration.'
return ('%s%s' % (api_url(), endpoint)) | Build a URL based on API configuration. | src/vplan/client/client.py | _url | pronovic/vplan | 0 | python | def _url(endpoint: str) -> str:
return ('%s%s' % (api_url(), endpoint)) | def _url(endpoint: str) -> str:
return ('%s%s' % (api_url(), endpoint))<|docstring|>Build a URL based on API configuration.<|endoftext|> |
53fa7621e44c4fd43419c80292de518cfac1ece55ebcf989c4d07e02a027f113 | def _account(endpoint: str='') -> str:
'Build an account URL based on API configuration'
return _url(('/account%s' % endpoint)) | Build an account URL based on API configuration | src/vplan/client/client.py | _account | pronovic/vplan | 0 | python | def _account(endpoint: str=) -> str:
return _url(('/account%s' % endpoint)) | def _account(endpoint: str=) -> str:
return _url(('/account%s' % endpoint))<|docstring|>Build an account URL based on API configuration<|endoftext|> |
824b8d370791c806e6ff1910010a8b7b610f863e797e3fca571649da4f56806b | def _plan(endpoint: str='') -> str:
'Build a plan URL based on API configuration'
return _url(('/plan%s' % endpoint)) | Build a plan URL based on API configuration | src/vplan/client/client.py | _plan | pronovic/vplan | 0 | python | def _plan(endpoint: str=) -> str:
return _url(('/plan%s' % endpoint)) | def _plan(endpoint: str=) -> str:
return _url(('/plan%s' % endpoint))<|docstring|>Build a plan URL based on API configuration<|endoftext|> |
9984a71242cb350511c00499830dab353f0ca66ba1e353cc3d8be5f885ede891 | def _raise_for_status(response: Response) -> None:
'Check response status, raising ClickException for errors'
try:
response.raise_for_status()
except HTTPError as e:
raise click.ClickException(('%s' % e)) from e | Check response status, raising ClickException for errors | src/vplan/client/client.py | _raise_for_status | pronovic/vplan | 0 | python | def _raise_for_status(response: Response) -> None:
try:
response.raise_for_status()
except HTTPError as e:
raise click.ClickException(('%s' % e)) from e | def _raise_for_status(response: Response) -> None:
try:
response.raise_for_status()
except HTTPError as e:
raise click.ClickException(('%s' % e)) from e<|docstring|>Check response status, raising ClickException for errors<|endoftext|> |
188fb875ab0a1efe0f099139531cc8d021206ef1d232c43c94708e7c044a1ef5 | def retrieve_health() -> bool:
'Check whether the API server is healthy.'
url = _url('/health')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return True
except:
return False | Check whether the API server is healthy. | src/vplan/client/client.py | retrieve_health | pronovic/vplan | 0 | python | def retrieve_health() -> bool:
url = _url('/health')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return True
except:
return False | def retrieve_health() -> bool:
url = _url('/health')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return True
except:
return False<|docstring|>Check whether the API server is healthy.<|endoftext|> |
12d0d63c677239119b6cb17ac7f5e010b0dd35b414b7768f0161b59e9f0bdee4 | def retrieve_version() -> Optional[Version]:
'Retrieve version information from the API server.'
url = _url('/version')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return Version.parse_raw(response.text)
except:
return None | Retrieve version information from the API server. | src/vplan/client/client.py | retrieve_version | pronovic/vplan | 0 | python | def retrieve_version() -> Optional[Version]:
url = _url('/version')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return Version.parse_raw(response.text)
except:
return None | def retrieve_version() -> Optional[Version]:
url = _url('/version')
try:
response = requests.get(url=url, timeout=1)
response.raise_for_status()
return Version.parse_raw(response.text)
except:
return None<|docstring|>Retrieve version information from the API server.<|end... |
e131d98c640529beacc7d0c7f7272a13cd61efff9afa3d6e4c72992addc0ae70 | def retrieve_account() -> Optional[Account]:
'Retrieve account information stored in the plan engine.'
url = _account()
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Account.parse_raw(response.text) | Retrieve account information stored in the plan engine. | src/vplan/client/client.py | retrieve_account | pronovic/vplan | 0 | python | def retrieve_account() -> Optional[Account]:
url = _account()
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Account.parse_raw(response.text) | def retrieve_account() -> Optional[Account]:
url = _account()
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Account.parse_raw(response.text)<|docstring|>Retrieve account information stored in the plan engine.<|endoftext... |
6746c2e28647a5dc7c62c8f3bb83476392204ee3c9a1d584719d6c7635fe607a | def create_or_replace_account(account: Account) -> None:
'Create or replace account information stored in the plan engine.'
url = _account()
response = requests.post(url=url, data=account.json())
_raise_for_status(response) | Create or replace account information stored in the plan engine. | src/vplan/client/client.py | create_or_replace_account | pronovic/vplan | 0 | python | def create_or_replace_account(account: Account) -> None:
url = _account()
response = requests.post(url=url, data=account.json())
_raise_for_status(response) | def create_or_replace_account(account: Account) -> None:
url = _account()
response = requests.post(url=url, data=account.json())
_raise_for_status(response)<|docstring|>Create or replace account information stored in the plan engine.<|endoftext|> |
c66150fa30c142d601b6f19b48b6aa827cd635478eb9b7990168a59905d54ada | def delete_account() -> None:
'Delete account information stored in the plan engine.'
url = _account()
response = requests.delete(url=url)
_raise_for_status(response) | Delete account information stored in the plan engine. | src/vplan/client/client.py | delete_account | pronovic/vplan | 0 | python | def delete_account() -> None:
url = _account()
response = requests.delete(url=url)
_raise_for_status(response) | def delete_account() -> None:
url = _account()
response = requests.delete(url=url)
_raise_for_status(response)<|docstring|>Delete account information stored in the plan engine.<|endoftext|> |
6605adf80c1f470de51eb0f58957d042acabc3f7d6c86c762f9cd13838f2d23a | def retrieve_all_plans() -> List[str]:
'Return the names of all plans stored in the plan engine.'
url = _plan()
response = requests.get(url=url)
_raise_for_status(response)
plans: List[str] = json.loads(response.text)
return plans | Return the names of all plans stored in the plan engine. | src/vplan/client/client.py | retrieve_all_plans | pronovic/vplan | 0 | python | def retrieve_all_plans() -> List[str]:
url = _plan()
response = requests.get(url=url)
_raise_for_status(response)
plans: List[str] = json.loads(response.text)
return plans | def retrieve_all_plans() -> List[str]:
url = _plan()
response = requests.get(url=url)
_raise_for_status(response)
plans: List[str] = json.loads(response.text)
return plans<|docstring|>Return the names of all plans stored in the plan engine.<|endoftext|> |
76f0cf3c4f98d78d1ef8c2f1bda57e519572d823f3c436dc87a78b12e2c7daa0 | def retrieve_plan(plan_name: str) -> Optional[PlanSchema]:
'Return the plan definition stored in the plan engine.'
url = _plan(('/%s' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return PlanSchema.parse_raw(respo... | Return the plan definition stored in the plan engine. | src/vplan/client/client.py | retrieve_plan | pronovic/vplan | 0 | python | def retrieve_plan(plan_name: str) -> Optional[PlanSchema]:
url = _plan(('/%s' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return PlanSchema.parse_raw(response.text) | def retrieve_plan(plan_name: str) -> Optional[PlanSchema]:
url = _plan(('/%s' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return PlanSchema.parse_raw(response.text)<|docstring|>Return the plan definition stored... |
feef6f093682f77fe28f0bdef5cb3d36b1a73d7e0558a6b39d25033cd0e5db3d | def create_plan(schema: PlanSchema) -> None:
'Create a plan in the plan engine.'
url = _plan()
response = requests.post(url=url, data=schema.json())
_raise_for_status(response) | Create a plan in the plan engine. | src/vplan/client/client.py | create_plan | pronovic/vplan | 0 | python | def create_plan(schema: PlanSchema) -> None:
url = _plan()
response = requests.post(url=url, data=schema.json())
_raise_for_status(response) | def create_plan(schema: PlanSchema) -> None:
url = _plan()
response = requests.post(url=url, data=schema.json())
_raise_for_status(response)<|docstring|>Create a plan in the plan engine.<|endoftext|> |
0e815c1c7b0cc52bda9ba6e3516f10b5bebd13d9547b36eca72c7dd204634adb | def update_plan(schema: PlanSchema) -> None:
'Update an existing plan in the plan engine.'
url = _plan()
response = requests.put(url=url, data=schema.json())
_raise_for_status(response) | Update an existing plan in the plan engine. | src/vplan/client/client.py | update_plan | pronovic/vplan | 0 | python | def update_plan(schema: PlanSchema) -> None:
url = _plan()
response = requests.put(url=url, data=schema.json())
_raise_for_status(response) | def update_plan(schema: PlanSchema) -> None:
url = _plan()
response = requests.put(url=url, data=schema.json())
_raise_for_status(response)<|docstring|>Update an existing plan in the plan engine.<|endoftext|> |
3cded9126fcb587262067ca13fc3768a372d6fe66678d555057f782440f3c324 | def delete_plan(plan_name: str) -> None:
'Delete a plan stored in the plan engine.'
url = _plan(('/%s' % plan_name))
response = requests.delete(url=url)
_raise_for_status(response) | Delete a plan stored in the plan engine. | src/vplan/client/client.py | delete_plan | pronovic/vplan | 0 | python | def delete_plan(plan_name: str) -> None:
url = _plan(('/%s' % plan_name))
response = requests.delete(url=url)
_raise_for_status(response) | def delete_plan(plan_name: str) -> None:
url = _plan(('/%s' % plan_name))
response = requests.delete(url=url)
_raise_for_status(response)<|docstring|>Delete a plan stored in the plan engine.<|endoftext|> |
57e8e58f9b52f323b161dfcdaccafb929d3c5a583345a8b9f683544e03312737 | def retrieve_plan_status(plan_name: str) -> Optional[Status]:
'Return the enabled/disabled status of a plan in the plan engine.'
url = _plan(('/%s/status' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Statu... | Return the enabled/disabled status of a plan in the plan engine. | src/vplan/client/client.py | retrieve_plan_status | pronovic/vplan | 0 | python | def retrieve_plan_status(plan_name: str) -> Optional[Status]:
url = _plan(('/%s/status' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Status.parse_raw(response.text) | def retrieve_plan_status(plan_name: str) -> Optional[Status]:
url = _plan(('/%s/status' % plan_name))
response = requests.get(url=url)
if (response.status_code == 404):
return None
_raise_for_status(response)
return Status.parse_raw(response.text)<|docstring|>Return the enabled/disabled... |
f32c7869364cce4f60960c4128a1722eecdf4a48fe7fc2648f0fb085eef55a4e | def update_plan_status(plan_name: str, status: Status) -> None:
'Set the enabled/disabled status of a plan in the plan engine.'
url = _plan(('/%s/status' % plan_name))
response = requests.put(url=url, data=status.json())
_raise_for_status(response) | Set the enabled/disabled status of a plan in the plan engine. | src/vplan/client/client.py | update_plan_status | pronovic/vplan | 0 | python | def update_plan_status(plan_name: str, status: Status) -> None:
url = _plan(('/%s/status' % plan_name))
response = requests.put(url=url, data=status.json())
_raise_for_status(response) | def update_plan_status(plan_name: str, status: Status) -> None:
url = _plan(('/%s/status' % plan_name))
response = requests.put(url=url, data=status.json())
_raise_for_status(response)<|docstring|>Set the enabled/disabled status of a plan in the plan engine.<|endoftext|> |
9d21dbb23ebb67b39a97d77c8609d601d69c6fd2e485c476119011871cfd788d | def refresh_plan(plan_name: str) -> None:
'Refresh the plan rules in the SmartThings infrastructure.'
url = _plan(('/%s/refresh' % plan_name))
response = requests.post(url=url)
_raise_for_status(response) | Refresh the plan rules in the SmartThings infrastructure. | src/vplan/client/client.py | refresh_plan | pronovic/vplan | 0 | python | def refresh_plan(plan_name: str) -> None:
url = _plan(('/%s/refresh' % plan_name))
response = requests.post(url=url)
_raise_for_status(response) | def refresh_plan(plan_name: str) -> None:
url = _plan(('/%s/refresh' % plan_name))
response = requests.post(url=url)
_raise_for_status(response)<|docstring|>Refresh the plan rules in the SmartThings infrastructure.<|endoftext|> |
5d2c6d13bafddb095a86678c8871af875ea46156d29b276c942d34da35ae1fdd | def toggle_group(plan_name: str, group_name: str, toggles: int, delay_sec: int) -> None:
'Test a device group that is part of a plan.'
url = _plan(('/%s/test/group/%s' % (plan_name, group_name)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=params)
_... | Test a device group that is part of a plan. | src/vplan/client/client.py | toggle_group | pronovic/vplan | 0 | python | def toggle_group(plan_name: str, group_name: str, toggles: int, delay_sec: int) -> None:
url = _plan(('/%s/test/group/%s' % (plan_name, group_name)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=params)
_raise_for_status(response) | def toggle_group(plan_name: str, group_name: str, toggles: int, delay_sec: int) -> None:
url = _plan(('/%s/test/group/%s' % (plan_name, group_name)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=params)
_raise_for_status(response)<|docstring|>Test a... |
d84d2e001e3dc34c1f49783a8568bcdaa81d40676cbd0443cb2e0e9bbfbef99f | def toggle_device(plan_name: str, room: str, device: str, toggles: int, delay_sec: int) -> None:
'Test a device that is part of a plan.'
url = _plan(('/%s/test/device/%s/%s' % (plan_name, room, device)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=param... | Test a device that is part of a plan. | src/vplan/client/client.py | toggle_device | pronovic/vplan | 0 | python | def toggle_device(plan_name: str, room: str, device: str, toggles: int, delay_sec: int) -> None:
url = _plan(('/%s/test/device/%s/%s' % (plan_name, room, device)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=params)
_raise_for_status(response) | def toggle_device(plan_name: str, room: str, device: str, toggles: int, delay_sec: int) -> None:
url = _plan(('/%s/test/device/%s/%s' % (plan_name, room, device)))
params = {'toggles': toggles, 'delay_sec': delay_sec}
response = requests.post(url=url, params=params)
_raise_for_status(response)<|doc... |
a7e60c097224e38e85e22476b287b1ddacc9b694cd1db2227a3ad2ea3d6e1a80 | def turn_on_group(plan_name: str, group_name: str) -> None:
'Turn on a device group that is part of a plan.'
url = _plan(('/%s/on/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response) | Turn on a device group that is part of a plan. | src/vplan/client/client.py | turn_on_group | pronovic/vplan | 0 | python | def turn_on_group(plan_name: str, group_name: str) -> None:
url = _plan(('/%s/on/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response) | def turn_on_group(plan_name: str, group_name: str) -> None:
url = _plan(('/%s/on/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response)<|docstring|>Turn on a device group that is part of a plan.<|endoftext|> |
e89883a36d4d54032e26fc3e1d51f918d813ea3f1625510ceb7cec3ac6f7e570 | def turn_on_device(plan_name: str, room: str, device: str) -> None:
'Turn on a device that is part of a plan.'
url = _plan(('/%s/on/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response) | Turn on a device that is part of a plan. | src/vplan/client/client.py | turn_on_device | pronovic/vplan | 0 | python | def turn_on_device(plan_name: str, room: str, device: str) -> None:
url = _plan(('/%s/on/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response) | def turn_on_device(plan_name: str, room: str, device: str) -> None:
url = _plan(('/%s/on/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response)<|docstring|>Turn on a device that is part of a plan.<|endoftext|> |
1d015ba17e5b35e3c35a0bc6a53a5de45f0d49d4c62f7f3c215cf651a52603e9 | def turn_off_group(plan_name: str, group_name: str) -> None:
'Turn off a device group that is part of a plan.'
url = _plan(('/%s/off/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response) | Turn off a device group that is part of a plan. | src/vplan/client/client.py | turn_off_group | pronovic/vplan | 0 | python | def turn_off_group(plan_name: str, group_name: str) -> None:
url = _plan(('/%s/off/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response) | def turn_off_group(plan_name: str, group_name: str) -> None:
url = _plan(('/%s/off/group/%s' % (plan_name, group_name)))
response = requests.post(url=url)
_raise_for_status(response)<|docstring|>Turn off a device group that is part of a plan.<|endoftext|> |
311bc447854713921d0df78ed56e02a328abe31d99e7847be4638b7887363e2c | def turn_off_device(plan_name: str, room: str, device: str) -> None:
'Turn off a device that is part of a plan.'
url = _plan(('/%s/off/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response) | Turn off a device that is part of a plan. | src/vplan/client/client.py | turn_off_device | pronovic/vplan | 0 | python | def turn_off_device(plan_name: str, room: str, device: str) -> None:
url = _plan(('/%s/off/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response) | def turn_off_device(plan_name: str, room: str, device: str) -> None:
url = _plan(('/%s/off/device/%s/%s' % (plan_name, room, device)))
response = requests.post(url=url)
_raise_for_status(response)<|docstring|>Turn off a device that is part of a plan.<|endoftext|> |
5f75a8f62ca3ad5d134c3e5cedaf7c5967549a7b733bf3796f452975344300bb | async def func_birth(self):
"\n kev1 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,25,56,7,8,96,10,10,20,23,24,25,56,7,8,96,10,10,20,23,24,25,56... | kev1 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
,25,56,7,8,96,10,10,20,23,24,25,56,7,8,96,10,10,20,23,24,25,56,7,8,96,10,10,20,23,24,25,56]
kev2 = [1,2,3,4,5,6,7,8,9,10,11... | Models/PowerPlantsLoad/dummy_data/kw_daten/model.py | func_birth | schmocker/Pyjamas | 2 | python | async def func_birth(self):
"\n kev1 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,25,56,7,8,96,10,10,20,23,24,25,56,7,8,96,10,10,20,23,24,25,56... | async def func_birth(self):
"\n kev1 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32\n ,25,56,7,8,96,10,10,20,23,24,25,56,7,8,96,10,10,20,23,24,25,56... |
51085c363fcfcb04a535e8ce572e91443e399fd4212f465af058199e3e3fb357 | def get_camera_config(config_path):
'\n 获取相机参数\n '
with open(config_path, 'r') as f:
config_data = yaml.safe_load(f)
cx = config_data['camera']['cx']
cy = config_data['camera']['cy']
fx = config_data['camera']['fx']
fy = config_data['camera']['fy']
h = confi... | 获取相机参数 | node/traffic_count_10_28_node_successd.py | get_camera_config | wyf94/traffic_count | 0 | python | def get_camera_config(config_path):
'\n \n '
with open(config_path, 'r') as f:
config_data = yaml.safe_load(f)
cx = config_data['camera']['cx']
cy = config_data['camera']['cy']
fx = config_data['camera']['fx']
fy = config_data['camera']['fy']
h = config_data... | def get_camera_config(config_path):
'\n \n '
with open(config_path, 'r') as f:
config_data = yaml.safe_load(f)
cx = config_data['camera']['cx']
cy = config_data['camera']['cy']
fx = config_data['camera']['fx']
fy = config_data['camera']['fy']
h = config_data... |
333ae98b912fcdd92b1210a4e4551738a2084adc0104a5b6262349faaa261bf2 | @redis
def test_redis_origin(sdc_builder, sdc_executor, redis):
'Test for Redis origin stage. We do so by starting the pipeline first which ensures the required Redis channel\n is created and then we publish data to wiretap. The pipeline looks like:\n\n redis_consumer >> wiretap\n '
raw_dict = dict... | Test for Redis origin stage. We do so by starting the pipeline first which ensures the required Redis channel
is created and then we publish data to wiretap. The pipeline looks like:
redis_consumer >> wiretap | stage/test_redis_stages.py | test_redis_origin | streamsets/datacollector-tests | 14 | python | @redis
def test_redis_origin(sdc_builder, sdc_executor, redis):
'Test for Redis origin stage. We do so by starting the pipeline first which ensures the required Redis channel\n is created and then we publish data to wiretap. The pipeline looks like:\n\n redis_consumer >> wiretap\n '
raw_dict = dict... | @redis
def test_redis_origin(sdc_builder, sdc_executor, redis):
'Test for Redis origin stage. We do so by starting the pipeline first which ensures the required Redis channel\n is created and then we publish data to wiretap. The pipeline looks like:\n\n redis_consumer >> wiretap\n '
raw_dict = dict... |
2fb67d96020e13d2ed9062b0ec495ec5e8176434d4c816c0d04c2c67705fd11b | @redis
def test_redis_destination(sdc_builder, sdc_executor, redis):
'Test for Redis destination stage. The pipeline looks like:\n\n dev_raw_data_source >> redis_destination\n '
redis_key = get_random_string(string.ascii_letters, 10)
raw_dict = dict(city=redis_key, coordinates=dict(latitude='37.75... | Test for Redis destination stage. The pipeline looks like:
dev_raw_data_source >> redis_destination | stage/test_redis_stages.py | test_redis_destination | streamsets/datacollector-tests | 14 | python | @redis
def test_redis_destination(sdc_builder, sdc_executor, redis):
'Test for Redis destination stage. The pipeline looks like:\n\n dev_raw_data_source >> redis_destination\n '
redis_key = get_random_string(string.ascii_letters, 10)
raw_dict = dict(city=redis_key, coordinates=dict(latitude='37.75... | @redis
def test_redis_destination(sdc_builder, sdc_executor, redis):
'Test for Redis destination stage. The pipeline looks like:\n\n dev_raw_data_source >> redis_destination\n '
redis_key = get_random_string(string.ascii_letters, 10)
raw_dict = dict(city=redis_key, coordinates=dict(latitude='37.75... |
33d4bd1e72c2ee49a79e51b82e806953f236ff1255e20c31d427cab1cd09694e | @redis
def test_redis_lookup_processor(sdc_builder, sdc_executor, redis):
'Test for Redis Lookup Processor. We do so by putting data in Redis first and then have the Redis Lookup\n processor look for it. The pipeline looks like:\n\n dev_raw_data_source >> redis_lookup_processor >> trash\n '
redis_k... | Test for Redis Lookup Processor. We do so by putting data in Redis first and then have the Redis Lookup
processor look for it. The pipeline looks like:
dev_raw_data_source >> redis_lookup_processor >> trash | stage/test_redis_stages.py | test_redis_lookup_processor | streamsets/datacollector-tests | 14 | python | @redis
def test_redis_lookup_processor(sdc_builder, sdc_executor, redis):
'Test for Redis Lookup Processor. We do so by putting data in Redis first and then have the Redis Lookup\n processor look for it. The pipeline looks like:\n\n dev_raw_data_source >> redis_lookup_processor >> trash\n '
redis_k... | @redis
def test_redis_lookup_processor(sdc_builder, sdc_executor, redis):
'Test for Redis Lookup Processor. We do so by putting data in Redis first and then have the Redis Lookup\n processor look for it. The pipeline looks like:\n\n dev_raw_data_source >> redis_lookup_processor >> trash\n '
redis_k... |
f492d97711e16b523c0c660f680275379ee7e1f14796f5345ce11f88a2e8b8e9 | def load_features(path, data_format):
' Function to load (preprocessed) features from disk\n\n Args:\n :param path: the path where the features are stored\n :param data_format: the format in which the features are stored\n :return: tuple of (features, duration)\n '
if (data_forma... | Function to load (preprocessed) features from disk
Args:
:param path: the path where the features are stored
:param data_format: the format in which the features are stored
:return: tuple of (features, duration) | open_seq2seq/data/speech2text/speech_utils.py | load_features | innerNULL/OpenSeq2Seq | 1 | python | def load_features(path, data_format):
' Function to load (preprocessed) features from disk\n\n Args:\n :param path: the path where the features are stored\n :param data_format: the format in which the features are stored\n :return: tuple of (features, duration)\n '
if (data_forma... | def load_features(path, data_format):
' Function to load (preprocessed) features from disk\n\n Args:\n :param path: the path where the features are stored\n :param data_format: the format in which the features are stored\n :return: tuple of (features, duration)\n '
if (data_forma... |
6e61f4ef87a50b151a18db81cf9e6cb06f076bb9b3cc1e7fe51197bb106b1bae | def save_features(features, duration, path, data_format, verbose=False):
" Function to save (preprocessed) features to disk\n\n Args:\n :param features: features\n :param duration: metadata: duration in seconds of audio file\n :param path: path to store the data\... | Function to save (preprocessed) features to disk
Args:
:param features: features
:param duration: metadata: duration in seconds of audio file
:param path: path to store the data
:param data_format: format to store the data in ('npy',
'npz',
'hdf... | open_seq2seq/data/speech2text/speech_utils.py | save_features | innerNULL/OpenSeq2Seq | 1 | python | def save_features(features, duration, path, data_format, verbose=False):
" Function to save (preprocessed) features to disk\n\n Args:\n :param features: features\n :param duration: metadata: duration in seconds of audio file\n :param path: path to store the data\... | def save_features(features, duration, path, data_format, verbose=False):
" Function to save (preprocessed) features to disk\n\n Args:\n :param features: features\n :param duration: metadata: duration in seconds of audio file\n :param path: path to store the data\... |
5e517ba04379aecac8b581eb8d7d12dc1c56603d509eda4856c12db760315509 | def get_preprocessed_data_path(filename, params):
' Function to convert the audio path into the path to the preprocessed\n version of this audio\n Args:\n :param filename: WAVE filename\n :param params: dictionary containing preprocessing parameters\n :return: path to new file (w... | Function to convert the audio path into the path to the preprocessed
version of this audio
Args:
:param filename: WAVE filename
:param params: dictionary containing preprocessing parameters
:return: path to new file (without extension). The path is
generated from the relevant preproce... | open_seq2seq/data/speech2text/speech_utils.py | get_preprocessed_data_path | innerNULL/OpenSeq2Seq | 1 | python | def get_preprocessed_data_path(filename, params):
' Function to convert the audio path into the path to the preprocessed\n version of this audio\n Args:\n :param filename: WAVE filename\n :param params: dictionary containing preprocessing parameters\n :return: path to new file (w... | def get_preprocessed_data_path(filename, params):
' Function to convert the audio path into the path to the preprocessed\n version of this audio\n Args:\n :param filename: WAVE filename\n :param params: dictionary containing preprocessing parameters\n :return: path to new file (w... |
a69fc5a32c4202f74b87f79cdd0299a896bf9f15287827d5c3ffd06e10704df4 | def get_speech_features_from_file(filename, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None, cache_features=False, cache_format='hdf5', cache_regenerate=False, params={}):
"Function to get a numpy array of features, from an audio file.\n if params['c... | Function to get a numpy array of features, from an audio file.
if params['cache_features']==True, try load preprocessed data from
disk, or store after preprocesseng.
else, perform preprocessing on-the-fly.
Args:
filename (string): WAVE filename.
num_features (int): number of speech features in fr... | open_seq2seq/data/speech2text/speech_utils.py | get_speech_features_from_file | innerNULL/OpenSeq2Seq | 1 | python | def get_speech_features_from_file(filename, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None, cache_features=False, cache_format='hdf5', cache_regenerate=False, params={}):
"Function to get a numpy array of features, from an audio file.\n if params['c... | def get_speech_features_from_file(filename, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None, cache_features=False, cache_format='hdf5', cache_regenerate=False, params={}):
"Function to get a numpy array of features, from an audio file.\n if params['c... |
eebf84e48cf125a5f7ed517aec0426494b91d51c504798d74f74df848bca7e0f | def normalize_signal(signal):
'\n Normalize float32 signal to [-1, 1] range\n '
return (signal / np.max(np.abs(signal))) | Normalize float32 signal to [-1, 1] range | open_seq2seq/data/speech2text/speech_utils.py | normalize_signal | innerNULL/OpenSeq2Seq | 1 | python | def normalize_signal(signal):
'\n \n '
return (signal / np.max(np.abs(signal))) | def normalize_signal(signal):
'\n \n '
return (signal / np.max(np.abs(signal)))<|docstring|>Normalize float32 signal to [-1, 1] range<|endoftext|> |
b8a04a76cb0fd90d76904326f3f3e2be82f270b55c33884d4faed183131a030b | def augment_audio_signal(signal, sample_freq, augmentation):
'Function that performs audio signal augmentation.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (float): frames per second.\n augmentation (dict): dictionary of augmentation parameters. See\n :func:`g... | Function that performs audio signal augmentation.
Args:
signal (np.array): np.array containing raw audio signal.
sample_freq (float): frames per second.
augmentation (dict): dictionary of augmentation parameters. See
:func:`get_speech_features_from_file` for specification and example.
Returns:
np.array: ... | open_seq2seq/data/speech2text/speech_utils.py | augment_audio_signal | innerNULL/OpenSeq2Seq | 1 | python | def augment_audio_signal(signal, sample_freq, augmentation):
'Function that performs audio signal augmentation.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (float): frames per second.\n augmentation (dict): dictionary of augmentation parameters. See\n :func:`g... | def augment_audio_signal(signal, sample_freq, augmentation):
'Function that performs audio signal augmentation.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (float): frames per second.\n augmentation (dict): dictionary of augmentation parameters. See\n :func:`g... |
f11cd57b344b3bb043cc3e64b0f3ae7f46554bd079fad2e0330a911d84831287 | def get_speech_features(signal, sample_freq, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None):
"Function to convert raw audio signal to numpy array of features.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (flo... | Function to convert raw audio signal to numpy array of features.
Args:
signal (np.array): np.array containing raw audio signal.
sample_freq (float): frames per second.
num_features (int): number of speech features in frequency domain.
pad_to (int): if specified, the length will be padded to become divisible
... | open_seq2seq/data/speech2text/speech_utils.py | get_speech_features | innerNULL/OpenSeq2Seq | 1 | python | def get_speech_features(signal, sample_freq, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None):
"Function to convert raw audio signal to numpy array of features.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (flo... | def get_speech_features(signal, sample_freq, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None):
"Function to convert raw audio signal to numpy array of features.\n\n Args:\n signal (np.array): np.array containing raw audio signal.\n sample_freq (flo... |
6a0f80794009208754a6a409075f9f56d2120768c3584525d84c8a935495f624 | def fix_kv(text):
' Helper function to shorten length of filenames to get around\n filesystem path length limitations'
text = str(text)
text = text.replace('time_stretch_ratio', 'tsr').replace('noise_level_min', 'nlmin').replace('noise_level_max', 'nlmax').replace('add_derivatives', 'd').replace('add_sec... | Helper function to shorten length of filenames to get around
filesystem path length limitations | open_seq2seq/data/speech2text/speech_utils.py | fix_kv | innerNULL/OpenSeq2Seq | 1 | python | def fix_kv(text):
' Helper function to shorten length of filenames to get around\n filesystem path length limitations'
text = str(text)
text = text.replace('time_stretch_ratio', 'tsr').replace('noise_level_min', 'nlmin').replace('noise_level_max', 'nlmax').replace('add_derivatives', 'd').replace('add_sec... | def fix_kv(text):
' Helper function to shorten length of filenames to get around\n filesystem path length limitations'
text = str(text)
text = text.replace('time_stretch_ratio', 'tsr').replace('noise_level_min', 'nlmin').replace('noise_level_max', 'nlmax').replace('add_derivatives', 'd').replace('add_sec... |
2d833f50038ca9b25b4db12324d8901006d58b727ed696bf4efebb5fd0c75cbb | def max_bar_width(data: Dict[(str, float)], width: int) -> int:
'Caluclate the maximum width of a bar based on the longest label.'
return (width - max(list(map(len, data.keys())))) | Caluclate the maximum width of a bar based on the longest label. | piltdown/bar_chart.py | max_bar_width | EvansWinner/piltdown | 0 | python | def max_bar_width(data: Dict[(str, float)], width: int) -> int:
return (width - max(list(map(len, data.keys())))) | def max_bar_width(data: Dict[(str, float)], width: int) -> int:
return (width - max(list(map(len, data.keys()))))<|docstring|>Caluclate the maximum width of a bar based on the longest label.<|endoftext|> |
61029521dcb52a8fda93a63317af061ace7c7fa7c3bf22b12c665ef87cb4011e | def make_line(label: str, value: float, line_break: bool, key_labels: str) -> str:
'Make a single line of the bar chart.'
return 'This is just a stub.' | Make a single line of the bar chart. | piltdown/bar_chart.py | make_line | EvansWinner/piltdown | 0 | python | def make_line(label: str, value: float, line_break: bool, key_labels: str) -> str:
return 'This is just a stub.' | def make_line(label: str, value: float, line_break: bool, key_labels: str) -> str:
return 'This is just a stub.'<|docstring|>Make a single line of the bar chart.<|endoftext|> |
e6522316e91597bce7b90980c6cbb383413251d75b306ff8d1fac35204e65c72 | def bar_chart(data: Dict[(str, float)], width: int, line_breaks: bool=False, key_labels: str=lit.DEFAULT_LABELS) -> str:
'Create a bar chart.\n\n Return a bar plot given a dict of {"label":value} pairs and max line\n width.\n '
ret: str = ''
for (line, value) in data.items():
ret += make_li... | Create a bar chart.
Return a bar plot given a dict of {"label":value} pairs and max line
width. | piltdown/bar_chart.py | bar_chart | EvansWinner/piltdown | 0 | python | def bar_chart(data: Dict[(str, float)], width: int, line_breaks: bool=False, key_labels: str=lit.DEFAULT_LABELS) -> str:
'Create a bar chart.\n\n Return a bar plot given a dict of {"label":value} pairs and max line\n width.\n '
ret: str =
for (line, value) in data.items():
ret += make_line... | def bar_chart(data: Dict[(str, float)], width: int, line_breaks: bool=False, key_labels: str=lit.DEFAULT_LABELS) -> str:
'Create a bar chart.\n\n Return a bar plot given a dict of {"label":value} pairs and max line\n width.\n '
ret: str =
for (line, value) in data.items():
ret += make_line... |
9ef69652d70a0f9b6733a5f7f7eb64f8fa7b15c0c63d68fa91949bb5ad4b9053 | def str2bool(v):
'\n used to create special type for argparse\n '
return (v.lower() in ('yes', 'true', 't', '1')) | used to create special type for argparse | python/numpy/timings/timing.py | str2bool | hvanhovell/weld | 0 | python | def str2bool(v):
'\n \n '
return (v.lower() in ('yes', 'true', 't', '1')) | def str2bool(v):
'\n \n '
return (v.lower() in ('yes', 'true', 't', '1'))<|docstring|>used to create special type for argparse<|endoftext|> |
a9540b84c675137812bbb06be36e867558a05d0f77cc827f4e2919403ac99cae | def binary_loop(lib):
'\n lib = np or wn.\n '
np.random.seed(1)
arrays = []
expr = ''
for i in range(args.num_operands):
arrays.append(lib.array(np.random.rand(args.num_els)))
expr += ' arrays[{i}] '.format(i=str(i))
if (i != (args.num_operands - 1)):
expr +... | lib = np or wn. | python/numpy/timings/timing.py | binary_loop | hvanhovell/weld | 0 | python | def binary_loop(lib):
'\n \n '
np.random.seed(1)
arrays = []
expr =
for i in range(args.num_operands):
arrays.append(lib.array(np.random.rand(args.num_els)))
expr += ' arrays[{i}] '.format(i=str(i))
if (i != (args.num_operands - 1)):
expr += args.binary_op
... | def binary_loop(lib):
'\n \n '
np.random.seed(1)
arrays = []
expr =
for i in range(args.num_operands):
arrays.append(lib.array(np.random.rand(args.num_els)))
expr += ' arrays[{i}] '.format(i=str(i))
if (i != (args.num_operands - 1)):
expr += args.binary_op
... |
5a08d1bc079a236e57397d92cd6366bc949476acc65fa85ff878c273a6209d1c | def unary_loop(lib, inplace=False):
'\n lib = np or wn.\n TODO: Does it make sense to construct cases like np.sqrt(np.sqrt(x)) etc?\n '
np.random.seed(1)
arr = lib.array(np.random.rand(args.num_els))
start = time.time()
op = UNARY_OPS[args.unary_op]
for i in range(args.num_reps):
... | lib = np or wn.
TODO: Does it make sense to construct cases like np.sqrt(np.sqrt(x)) etc? | python/numpy/timings/timing.py | unary_loop | hvanhovell/weld | 0 | python | def unary_loop(lib, inplace=False):
'\n lib = np or wn.\n TODO: Does it make sense to construct cases like np.sqrt(np.sqrt(x)) etc?\n '
np.random.seed(1)
arr = lib.array(np.random.rand(args.num_els))
start = time.time()
op = UNARY_OPS[args.unary_op]
for i in range(args.num_reps):
... | def unary_loop(lib, inplace=False):
'\n lib = np or wn.\n TODO: Does it make sense to construct cases like np.sqrt(np.sqrt(x)) etc?\n '
np.random.seed(1)
arr = lib.array(np.random.rand(args.num_els))
start = time.time()
op = UNARY_OPS[args.unary_op]
for i in range(args.num_reps):
... |
145fd20999e820a26b5fb0cfc0b2f1435b242aa028bda9fa870f980bda6cdf2c | def blackscholes(use_weld):
'\n All inputs are float32 NumPy arrays.\n\n price: stock price at time 0.\n strike: strike price\n t: time to maturity in trading years.\n vol: volatility of the stock.\n rate: continuously compounded risk-free rate\n\n Returns: call and put of each stock as a vecto... | All inputs are float32 NumPy arrays.
price: stock price at time 0.
strike: strike price
t: time to maturity in trading years.
vol: volatility of the stock.
rate: continuously compounded risk-free rate
Returns: call and put of each stock as a vector
Order of operations in terms of usage:
+, *, sqrt, log, /, -, erf, ... | python/numpy/timings/timing.py | blackscholes | hvanhovell/weld | 0 | python | def blackscholes(use_weld):
'\n All inputs are float32 NumPy arrays.\n\n price: stock price at time 0.\n strike: strike price\n t: time to maturity in trading years.\n vol: volatility of the stock.\n rate: continuously compounded risk-free rate\n\n Returns: call and put of each stock as a vecto... | def blackscholes(use_weld):
'\n All inputs are float32 NumPy arrays.\n\n price: stock price at time 0.\n strike: strike price\n t: time to maturity in trading years.\n vol: volatility of the stock.\n rate: continuously compounded risk-free rate\n\n Returns: call and put of each stock as a vecto... |
aff3f5b8e1ab6fd7878f79a02d3ae5af97a6997c760fdd67560fb1bb68ff6063 | def test_reload_configuration(testbed_devices, conn_graph_facts):
'\n @summary: This test case is to reload the configuration and check platform status\n '
ans_host = testbed_devices['dut']
interfaces = conn_graph_facts['device_conn']
asic_type = ans_host.facts['asic_type']
logging.info('Reloa... | @summary: This test case is to reload the configuration and check platform status | tests/platform/test_reload_config.py | test_reload_configuration | skshih/sonic-mgmt | 0 | python | def test_reload_configuration(testbed_devices, conn_graph_facts):
'\n \n '
ans_host = testbed_devices['dut']
interfaces = conn_graph_facts['device_conn']
asic_type = ans_host.facts['asic_type']
logging.info('Reload configuration')
ans_host.command('sudo config reload -y')
logging.info(... | def test_reload_configuration(testbed_devices, conn_graph_facts):
'\n \n '
ans_host = testbed_devices['dut']
interfaces = conn_graph_facts['device_conn']
asic_type = ans_host.facts['asic_type']
logging.info('Reload configuration')
ans_host.command('sudo config reload -y')
logging.info(... |
270fb4ad0686b305f1315107d39151a02e2eb6fec8177b4b9c22163329764352 | def __init__(self, bot: Red):
'Init.'
super().__init__()
self.bot = bot
self.config = Config.get_conf(self, identifier=IDENTIFIER, force_registration=True)
default_global = {}
default_guild = {'channel_id': None, 'messages': []}
self.config.register_global(**default_global)
self.config.r... | Init. | discordgram/dicsordgram.py | __init__ | smlbiobot/SML-Cogs-v3 | 5 | python | def __init__(self, bot: Red):
super().__init__()
self.bot = bot
self.config = Config.get_conf(self, identifier=IDENTIFIER, force_registration=True)
default_global = {}
default_guild = {'channel_id': None, 'messages': []}
self.config.register_global(**default_global)
self.config.register... | def __init__(self, bot: Red):
super().__init__()
self.bot = bot
self.config = Config.get_conf(self, identifier=IDENTIFIER, force_registration=True)
default_global = {}
default_guild = {'channel_id': None, 'messages': []}
self.config.register_global(**default_global)
self.config.register... |
687518c86d4097a7e2b8b9753dd97d60343b23f47b307b25045d6c04c57b5023 | @checks.mod_or_permissions()
@commands.group()
async def discordgramset(self, ctx):
'Discordgram setttings.'
pass | Discordgram setttings. | discordgram/dicsordgram.py | discordgramset | smlbiobot/SML-Cogs-v3 | 5 | python | @checks.mod_or_permissions()
@commands.group()
async def discordgramset(self, ctx):
pass | @checks.mod_or_permissions()
@commands.group()
async def discordgramset(self, ctx):
pass<|docstring|>Discordgram setttings.<|endoftext|> |
233f95234a96cbe166bd6948f95f261be3dc47e5f8949f7b8374f196cc4b5baf | @checks.mod_or_permissions()
@discordgramset.command(name='channel')
async def discordgramset_channel(self, ctx):
'Set channel.'
guild = ctx.guild
channel = ctx.channel
channel_id = (await self.config.guild(guild).channel_id())
if (channel_id is not None):
previous_channel = self.bot.get_cha... | Set channel. | discordgram/dicsordgram.py | discordgramset_channel | smlbiobot/SML-Cogs-v3 | 5 | python | @checks.mod_or_permissions()
@discordgramset.command(name='channel')
async def discordgramset_channel(self, ctx):
guild = ctx.guild
channel = ctx.channel
channel_id = (await self.config.guild(guild).channel_id())
if (channel_id is not None):
previous_channel = self.bot.get_channel(channel_i... | @checks.mod_or_permissions()
@discordgramset.command(name='channel')
async def discordgramset_channel(self, ctx):
guild = ctx.guild
channel = ctx.channel
channel_id = (await self.config.guild(guild).channel_id())
if (channel_id is not None):
previous_channel = self.bot.get_channel(channel_i... |
47798193118877d4d430556d44ec8caf91b454be49a90112fbe10d1a6686348d | @commands.guild_only()
@commands.Cog.listener(name='on_message')
async def on_message(self, message: discord.Message):
'Monitor activity if messages posted in Discordgram channel.'
guild = message.guild
if (guild is None):
return
channel = message.channel
channel_id = (await self.config.guil... | Monitor activity if messages posted in Discordgram channel. | discordgram/dicsordgram.py | on_message | smlbiobot/SML-Cogs-v3 | 5 | python | @commands.guild_only()
@commands.Cog.listener(name='on_message')
async def on_message(self, message: discord.Message):
guild = message.guild
if (guild is None):
return
channel = message.channel
channel_id = (await self.config.guild(guild).channel_id())
if (channel_id is None):
r... | @commands.guild_only()
@commands.Cog.listener(name='on_message')
async def on_message(self, message: discord.Message):
guild = message.guild
if (guild is None):
return
channel = message.channel
channel_id = (await self.config.guild(guild).channel_id())
if (channel_id is None):
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.