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 |
|---|---|---|---|---|---|---|---|---|---|
1983e37af70d8fc444ba6ac2e2b09676b6ecd438730eb6ac549eb49d46ee346c | def preorder_print(self, start, traversal):
'\n Prints the nodes using a preorder traversal.\n '
if start:
traversal += (str(start.value) + '-')
traversal = self.preorder_print(start.left, traversal)
traversal = self.preorder_print(start.right, traversal)
return travers... | Prints the nodes using a preorder traversal. | containers/BinaryTree.py | preorder_print | vbopardi/Week8Containers | 0 | python | def preorder_print(self, start, traversal):
'\n \n '
if start:
traversal += (str(start.value) + '-')
traversal = self.preorder_print(start.left, traversal)
traversal = self.preorder_print(start.right, traversal)
return traversal | def preorder_print(self, start, traversal):
'\n \n '
if start:
traversal += (str(start.value) + '-')
traversal = self.preorder_print(start.left, traversal)
traversal = self.preorder_print(start.right, traversal)
return traversal<|docstring|>Prints the nodes using a preo... |
d606df99a43109b57fdb3d68b0e905c47b4349dad16b90ad62ecfdea1cc66983 | def inorder_print(self, start, traversal):
'\n Prints the nodes using a inorder traversal.\n '
if start:
traversal = self.inorder_print(start.left, traversal)
traversal += (str(start.value) + '-')
traversal = self.inorder_print(start.right, traversal)
return traversal | Prints the nodes using a inorder traversal. | containers/BinaryTree.py | inorder_print | vbopardi/Week8Containers | 0 | python | def inorder_print(self, start, traversal):
'\n \n '
if start:
traversal = self.inorder_print(start.left, traversal)
traversal += (str(start.value) + '-')
traversal = self.inorder_print(start.right, traversal)
return traversal | def inorder_print(self, start, traversal):
'\n \n '
if start:
traversal = self.inorder_print(start.left, traversal)
traversal += (str(start.value) + '-')
traversal = self.inorder_print(start.right, traversal)
return traversal<|docstring|>Prints the nodes using a inorder... |
1017d917397cfccc7e32bfdcd79edd750948430950e53a00bcb116989155bca3 | def postorder_print(self, start, traversal):
'\n Prints the nodes using a postorder traversal.\n '
if start:
traversal = self.postorder_print(start.left, traversal)
traversal = self.postorder_print(start.right, traversal)
traversal += (str(start.value) + '-')
return tra... | Prints the nodes using a postorder traversal. | containers/BinaryTree.py | postorder_print | vbopardi/Week8Containers | 0 | python | def postorder_print(self, start, traversal):
'\n \n '
if start:
traversal = self.postorder_print(start.left, traversal)
traversal = self.postorder_print(start.right, traversal)
traversal += (str(start.value) + '-')
return traversal | def postorder_print(self, start, traversal):
'\n \n '
if start:
traversal = self.postorder_print(start.left, traversal)
traversal = self.postorder_print(start.right, traversal)
traversal += (str(start.value) + '-')
return traversal<|docstring|>Prints the nodes using a p... |
2c092957bef3bfbee51f6eba9006927a481a7471f4cc37789534dce4b3c36434 | def to_list(self, traversal_type):
'\n This function is similar to the print_tree function,\n but instead of printing the tree,\n it returns the contents of the tree as a list.\n\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if (travers... | This function is similar to the print_tree function,
but instead of printing the tree,
it returns the contents of the tree as a list.
FIXME:
Implement this function by modifying the _print functions above. | containers/BinaryTree.py | to_list | vbopardi/Week8Containers | 0 | python | def to_list(self, traversal_type):
'\n This function is similar to the print_tree function,\n but instead of printing the tree,\n it returns the contents of the tree as a list.\n\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if (travers... | def to_list(self, traversal_type):
'\n This function is similar to the print_tree function,\n but instead of printing the tree,\n it returns the contents of the tree as a list.\n\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if (travers... |
abb28bdd89117a042dd08d3c051c2945c0acad5af7ec353158c98b2e7faee828 | def preorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal.append(start.value)
traversal = self.preorder(start.left, traversal)
traversal = self.preorder(start.right, traversal)
retu... | FIXME:
Implement this function by modifying the _print functions above. | containers/BinaryTree.py | preorder | vbopardi/Week8Containers | 0 | python | def preorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal.append(start.value)
traversal = self.preorder(start.left, traversal)
traversal = self.preorder(start.right, traversal)
retu... | def preorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal.append(start.value)
traversal = self.preorder(start.left, traversal)
traversal = self.preorder(start.right, traversal)
retu... |
12aa408d85e6bd43bb0ade9e5b579738962b429f4d9b2b29a88e6e82814b3a55 | def inorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.inorder(start.left, traversal)
traversal.append(start.value)
traversal = self.inorder(start.right, traversal)
return ... | FIXME:
Implement this function by modifying the _print functions above. | containers/BinaryTree.py | inorder | vbopardi/Week8Containers | 0 | python | def inorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.inorder(start.left, traversal)
traversal.append(start.value)
traversal = self.inorder(start.right, traversal)
return ... | def inorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.inorder(start.left, traversal)
traversal.append(start.value)
traversal = self.inorder(start.right, traversal)
return ... |
92fe47bb116b84679cd371c77d96e7926a4f982fdef1d028c74902001ed8197a | def postorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.postorder(start.left, traversal)
traversal = self.postorder(start.right, traversal)
traversal.append(start.value)
r... | FIXME:
Implement this function by modifying the _print functions above. | containers/BinaryTree.py | postorder | vbopardi/Week8Containers | 0 | python | def postorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.postorder(start.left, traversal)
traversal = self.postorder(start.right, traversal)
traversal.append(start.value)
r... | def postorder(self, start, traversal):
'\n FIXME:\n Implement this function by modifying the _print functions above.\n '
if start:
traversal = self.postorder(start.left, traversal)
traversal = self.postorder(start.right, traversal)
traversal.append(start.value)
r... |
72818589dfbe60ffe3a6b970b5beead6c5badcbd010027b38e423216ad46df43 | def __len__(self):
'\n Returns the number of elements contained in the tree.\n Recall that `tree.__len__()` will desugar to `size(len)`.\n '
return BinaryTree.__len__helper(self.root) | Returns the number of elements contained in the tree.
Recall that `tree.__len__()` will desugar to `size(len)`. | containers/BinaryTree.py | __len__ | vbopardi/Week8Containers | 0 | python | def __len__(self):
'\n Returns the number of elements contained in the tree.\n Recall that `tree.__len__()` will desugar to `size(len)`.\n '
return BinaryTree.__len__helper(self.root) | def __len__(self):
'\n Returns the number of elements contained in the tree.\n Recall that `tree.__len__()` will desugar to `size(len)`.\n '
return BinaryTree.__len__helper(self.root)<|docstring|>Returns the number of elements contained in the tree.
Recall that `tree.__len__()` will desugar... |
2647cd6b0cf491361d453e233b6e5f4de79b6b7fc1f2a2405902998995230a66 | @staticmethod
def __len__helper(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n add 1 for the current node;\n return the sum of these three steps\n '
if (not node):
return 0
length = 1
if node.left:
length += ... | FIXME:
Implement this function.
HINT:
The pseudocode is:
add 1 for the current node;
return the sum of these three steps | containers/BinaryTree.py | __len__helper | vbopardi/Week8Containers | 0 | python | @staticmethod
def __len__helper(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n add 1 for the current node;\n return the sum of these three steps\n '
if (not node):
return 0
length = 1
if node.left:
length += ... | @staticmethod
def __len__helper(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n add 1 for the current node;\n return the sum of these three steps\n '
if (not node):
return 0
length = 1
if node.left:
length += ... |
fee45e88cb5c960b76bd98672f0403b81b40106e108ed63c59143a45faebb87d | def height(self):
'\n Returns the height of the tree.\n\n FIXME:\n Implement this function.\n\n HINT:\n See how the __len__ method calls its helper staticmethod.\n '
return BinaryTree._height(self.root) | Returns the height of the tree.
FIXME:
Implement this function.
HINT:
See how the __len__ method calls its helper staticmethod. | containers/BinaryTree.py | height | vbopardi/Week8Containers | 0 | python | def height(self):
'\n Returns the height of the tree.\n\n FIXME:\n Implement this function.\n\n HINT:\n See how the __len__ method calls its helper staticmethod.\n '
return BinaryTree._height(self.root) | def height(self):
'\n Returns the height of the tree.\n\n FIXME:\n Implement this function.\n\n HINT:\n See how the __len__ method calls its helper staticmethod.\n '
return BinaryTree._height(self.root)<|docstring|>Returns the height of the tree.
FIXME:
Implement this ... |
2f083861d837de503db33e40eeaf6fc737af197c4731e48133903340deaae6f0 | @staticmethod
def _height(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n if a left child exists, calculate the _height of the left child;\n if a right child exists, calculate the _height of the right child;\n '
if (not node):
... | FIXME:
Implement this function.
HINT:
The pseudocode is:
if a left child exists, calculate the _height of the left child;
if a right child exists, calculate the _height of the right child; | containers/BinaryTree.py | _height | vbopardi/Week8Containers | 0 | python | @staticmethod
def _height(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n if a left child exists, calculate the _height of the left child;\n if a right child exists, calculate the _height of the right child;\n '
if (not node):
... | @staticmethod
def _height(node):
'\n FIXME:\n Implement this function.\n\n HINT:\n The pseudocode is:\n if a left child exists, calculate the _height of the left child;\n if a right child exists, calculate the _height of the right child;\n '
if (not node):
... |
c6e2b6aa29414ee9927616c0df6f5b5fbca2b936d1cb71b30a04bad7f578a090 | def register_visualisation(self, widget, module, label='Visualisation', glue=None):
'\n called from notebook\n\n if module_class is None and module_id is None:\n raise ValueError("One and only one of \'module_class\' and \'module_id\' args must be defined")\n if not(module_class is N... | called from notebook
if module_class is None and module_id is None:
raise ValueError("One and only one of 'module_class' and 'module_id' args must be defined")
if not(module_class is None or module_id is None):
raise ValueError("One and only one of 'module_class' and 'module_id' args must be defined") | widgets/progressivis_nb_widgets/nbwidgets/psboard.py | register_visualisation | jdfekete/progressivis | 51 | python | def register_visualisation(self, widget, module, label='Visualisation', glue=None):
'\n called from notebook\n\n if module_class is None and module_id is None:\n raise ValueError("One and only one of \'module_class\' and \'module_id\' args must be defined")\n if not(module_class is N... | def register_visualisation(self, widget, module, label='Visualisation', glue=None):
'\n called from notebook\n\n if module_class is None and module_id is None:\n raise ValueError("One and only one of \'module_class\' and \'module_id\' args must be defined")\n if not(module_class is N... |
5bf54f3770c0964a1ed8be38b305175aa43b848ad6528c789cb82394aa9ac451 | @log_start_end(log=logger)
def sec_filings(ticker: str, num: int, export: str):
'Display SEC filings for a given stock ticker. [Source: Market Watch]\n\n Parameters\n ----------\n ticker : str\n Stock ticker\n num : int\n Number of ratings to display\n export : str\n Export dataf... | Display SEC filings for a given stock ticker. [Source: Market Watch]
Parameters
----------
ticker : str
Stock ticker
num : int
Number of ratings to display
export : str
Export dataframe data to csv,json,xlsx file | openbb_terminal/stocks/due_diligence/marketwatch_view.py | sec_filings | jmaslek/OpenBBTerminal | 255 | python | @log_start_end(log=logger)
def sec_filings(ticker: str, num: int, export: str):
'Display SEC filings for a given stock ticker. [Source: Market Watch]\n\n Parameters\n ----------\n ticker : str\n Stock ticker\n num : int\n Number of ratings to display\n export : str\n Export dataf... | @log_start_end(log=logger)
def sec_filings(ticker: str, num: int, export: str):
'Display SEC filings for a given stock ticker. [Source: Market Watch]\n\n Parameters\n ----------\n ticker : str\n Stock ticker\n num : int\n Number of ratings to display\n export : str\n Export dataf... |
181d0a07cfa6ec91870822c7ae19c99a6bda9ebe6075f9b9606a095cbc4cf70b | def __init__(self):
'\n Construct a PikaStack object.\n '
self.elements = [] | Construct a PikaStack object. | pikapy/stack.py | __init__ | DanyGLewin/pykachu | 0 | python | def __init__(self):
'\n \n '
self.elements = [] | def __init__(self):
'\n \n '
self.elements = []<|docstring|>Construct a PikaStack object.<|endoftext|> |
ce798bcc98c1690df750b31bcb5c1bc3282c9b53a48c62950dfae7e2f661713d | def ADD(self):
'\n Add the top two elements on the stack.\n\n Adds the top two elements on the stack and pushes the result back onto \n the stack.\n \n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result push... | Add the top two elements on the stack.
Adds the top two elements on the stack and pushes the result back onto
the stack.
Error handling:
If the stack is empty, nothing happens.
If the stack only has a single element, the result pushed to the top of
the stack is equal to the current top. | pikapy/stack.py | ADD | DanyGLewin/pykachu | 0 | python | def ADD(self):
'\n Add the top two elements on the stack.\n\n Adds the top two elements on the stack and pushes the result back onto \n the stack.\n \n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result push... | def ADD(self):
'\n Add the top two elements on the stack.\n\n Adds the top two elements on the stack and pushes the result back onto \n the stack.\n \n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result push... |
24c3a20b40cf38fd98e56e54521d63c9d84aed41afd2279b03a8339f237f415b | def SUB(self):
'\n Subtracts the top two elements.\n \n Subtracts the first element on the stack from the second element and\n pushes the result back onto the stack.\n\n Error Handling:\n If the stack is empty, nothing happens.\n If the stack only has a single elemen... | Subtracts the top two elements.
Subtracts the first element on the stack from the second element and
pushes the result back onto the stack.
Error Handling:
If the stack is empty, nothing happens.
If the stack only has a single element, the result pushed to the top of
the stack is -top | pikapy/stack.py | SUB | DanyGLewin/pykachu | 0 | python | def SUB(self):
'\n Subtracts the top two elements.\n \n Subtracts the first element on the stack from the second element and\n pushes the result back onto the stack.\n\n Error Handling:\n If the stack is empty, nothing happens.\n If the stack only has a single elemen... | def SUB(self):
'\n Subtracts the top two elements.\n \n Subtracts the first element on the stack from the second element and\n pushes the result back onto the stack.\n\n Error Handling:\n If the stack is empty, nothing happens.\n If the stack only has a single elemen... |
9b44dece80f19697c75610b74f1ca1da63ceeb399d303b93b750a640e19159ce | def MULT(self):
'\n Multiplies the top two elements on the stack.\n\n Multiplies the top two elements on the stack and pushes the result back\n onto the stack.\n\n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result... | Multiplies the top two elements on the stack.
Multiplies the top two elements on the stack and pushes the result back
onto the stack.
Error handling:
If the stack is empty, nothing happens.
If the stack only has a single element, the result pushed to the top of
the stack is 0 | pikapy/stack.py | MULT | DanyGLewin/pykachu | 0 | python | def MULT(self):
'\n Multiplies the top two elements on the stack.\n\n Multiplies the top two elements on the stack and pushes the result back\n onto the stack.\n\n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result... | def MULT(self):
'\n Multiplies the top two elements on the stack.\n\n Multiplies the top two elements on the stack and pushes the result back\n onto the stack.\n\n Error handling:\n If the stack is empty, nothing happens.\n If the stack only has a single element, the result... |
1ddd14d5e21d52f6e285f68dc8f1547d698066a90650d16ea338fe0af5573c5c | def DIV(self):
'\n Divides the top two elements on the stack\n\n Divides the second element on the stack by the first element on the stack,\n and pushes the result back on top of the stack.\n \n Error Handling:\n If the stack is empty, nothing happens.\n If the stack... | Divides the top two elements on the stack
Divides the second element on the stack by the first element on the stack,
and pushes the result back on top of the stack.
Error Handling:
If the stack is empty, nothing happens.
If the stack only has a single element, the result pushed to the top of
the stack is 0
If the di... | pikapy/stack.py | DIV | DanyGLewin/pykachu | 0 | python | def DIV(self):
'\n Divides the top two elements on the stack\n\n Divides the second element on the stack by the first element on the stack,\n and pushes the result back on top of the stack.\n \n Error Handling:\n If the stack is empty, nothing happens.\n If the stack... | def DIV(self):
'\n Divides the top two elements on the stack\n\n Divides the second element on the stack by the first element on the stack,\n and pushes the result back on top of the stack.\n \n Error Handling:\n If the stack is empty, nothing happens.\n If the stack... |
e8d97ae3edda708ffb4ece3661262fd9efb251ac792a1299891bdf389f9dda14 | def RAND(self):
'\n Returns a random number between 1 and the top element on the stack (inclusive).\n\n Error Hnadling:\n If stack is empty, push 0 to the top of the stack.\n If top of the stack is negative, push 0 to the top of the stack.\n :return:\n '
if (self.PEEK()... | Returns a random number between 1 and the top element on the stack (inclusive).
Error Hnadling:
If stack is empty, push 0 to the top of the stack.
If top of the stack is negative, push 0 to the top of the stack.
:return: | pikapy/stack.py | RAND | DanyGLewin/pykachu | 0 | python | def RAND(self):
'\n Returns a random number between 1 and the top element on the stack (inclusive).\n\n Error Hnadling:\n If stack is empty, push 0 to the top of the stack.\n If top of the stack is negative, push 0 to the top of the stack.\n :return:\n '
if (self.PEEK()... | def RAND(self):
'\n Returns a random number between 1 and the top element on the stack (inclusive).\n\n Error Hnadling:\n If stack is empty, push 0 to the top of the stack.\n If top of the stack is negative, push 0 to the top of the stack.\n :return:\n '
if (self.PEEK()... |
5d1c66cd85ad1b3822527c8b3a9d99791c433c303071dd242db21f23131010ca | def POP(self):
'\n Pops and returns the top element from the stack.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements.pop()
else:
return 0 | Pops and returns the top element from the stack.
Error Handling:
If the stack is empty 0 is returned. | pikapy/stack.py | POP | DanyGLewin/pykachu | 0 | python | def POP(self):
'\n Pops and returns the top element from the stack.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements.pop()
else:
return 0 | def POP(self):
'\n Pops and returns the top element from the stack.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements.pop()
else:
return 0<|docstring|>Pops and returns the top element from the stack.
Error ... |
57732ba933094a17de5a17fc6aca692d4edffed2fe63102bc0438d340410eb59 | def PUSH(self, element):
'\n Pushes an element to the top of the stack.\n\n Arguments:\n element -> The element to push on the top of the stack.\n '
self.elements.append(element) | Pushes an element to the top of the stack.
Arguments:
element -> The element to push on the top of the stack. | pikapy/stack.py | PUSH | DanyGLewin/pykachu | 0 | python | def PUSH(self, element):
'\n Pushes an element to the top of the stack.\n\n Arguments:\n element -> The element to push on the top of the stack.\n '
self.elements.append(element) | def PUSH(self, element):
'\n Pushes an element to the top of the stack.\n\n Arguments:\n element -> The element to push on the top of the stack.\n '
self.elements.append(element)<|docstring|>Pushes an element to the top of the stack.
Arguments:
element -> The element to push on the ... |
bc8cca12cf75b88f66d12a05a71fe7cda284581a3a4400ae655f28cd74d054ca | def PEEK(self):
'\n Returns the top element from the stack without removing it.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements[(- 1)]
else:
return 0 | Returns the top element from the stack without removing it.
Error Handling:
If the stack is empty 0 is returned. | pikapy/stack.py | PEEK | DanyGLewin/pykachu | 0 | python | def PEEK(self):
'\n Returns the top element from the stack without removing it.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements[(- 1)]
else:
return 0 | def PEEK(self):
'\n Returns the top element from the stack without removing it.\n\n Error Handling:\n If the stack is empty 0 is returned.\n '
if len(self.elements):
return self.elements[(- 1)]
else:
return 0<|docstring|>Returns the top element from the stack with... |
9ad2841e366c992bd8dd5ffc5f88a2d40452e8282386569ab401314b917b4186 | def EMPTY(self):
'\n Returns True if the stack is empty, false otherwise.\n '
return (len(self.elements) == 0) | Returns True if the stack is empty, false otherwise. | pikapy/stack.py | EMPTY | DanyGLewin/pykachu | 0 | python | def EMPTY(self):
'\n \n '
return (len(self.elements) == 0) | def EMPTY(self):
'\n \n '
return (len(self.elements) == 0)<|docstring|>Returns True if the stack is empty, false otherwise.<|endoftext|> |
6591f3908b89a3ccd93bc04c0c35103b3bc7ced51d7ef05f6a21f83d9953ec9b | def __str__(self):
'Defines the string representation of the PikaStack object.'
return str(self.elements) | Defines the string representation of the PikaStack object. | pikapy/stack.py | __str__ | DanyGLewin/pykachu | 0 | python | def __str__(self):
return str(self.elements) | def __str__(self):
return str(self.elements)<|docstring|>Defines the string representation of the PikaStack object.<|endoftext|> |
0ff3a1079dfaf808f564582ced0c9a271e4ded4b889085e438b299b3ea3da061 | def delete(self, request, username):
" The current user is able to unfollow another user's profile. "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
... | The current user is able to unfollow another user's profile. | authors/apps/profiles/views.py | delete | Tittoh/blog-API | 1 | python | def delete(self, request, username):
" "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
follower.unfollow(followed)
serializer = self.serializer... | def delete(self, request, username):
" "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
follower.unfollow(followed)
serializer = self.serializer... |
863be5c0eec284eab9d2c4138b1509c7aacc0fc5f9df5fb88f88b9f407b5090a | def post(self, request, username):
" The current user is able to follow another user's profile. "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
if (... | The current user is able to follow another user's profile. | authors/apps/profiles/views.py | post | Tittoh/blog-API | 1 | python | def post(self, request, username):
" "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
if (follower.pk is followed.pk):
raise serializers.Val... | def post(self, request, username):
" "
follower = request.user.profile
try:
followed = Profile.objects.get(user__username=username)
except Profile.DoesNotExist:
raise NotFound('The user with this profile does not exist')
if (follower.pk is followed.pk):
raise serializers.Val... |
ff94a347a80e8333bab3d8b53b619e850f02d708f82d3de48c962217446351e2 | def __init__(self, ical, account, href=None, local_tz=None, default_tz=None, start=None, end=None, color=None, readonly=False, unicode_symbols=True, etag=None):
"\n :param ical: the icalendar VEVENT this event is based on\n :type ical: str or icalendar.cal.EVent\n :param account: the account/ca... | :param ical: the icalendar VEVENT this event is based on
:type ical: str or icalendar.cal.EVent
:param account: the account/calendar this event belongs to
:type account: str
:param href: the href of the event, treated like a UID
:type href: str
:param local_tz: the local timezone the user wants event's times
... | khal/khalendar/event.py | __init__ | untitaker/khal | 0 | python | def __init__(self, ical, account, href=None, local_tz=None, default_tz=None, start=None, end=None, color=None, readonly=False, unicode_symbols=True, etag=None):
"\n :param ical: the icalendar VEVENT this event is based on\n :type ical: str or icalendar.cal.EVent\n :param account: the account/ca... | def __init__(self, ical, account, href=None, local_tz=None, default_tz=None, start=None, end=None, color=None, readonly=False, unicode_symbols=True, etag=None):
"\n :param ical: the icalendar VEVENT this event is based on\n :type ical: str or icalendar.cal.EVent\n :param account: the account/ca... |
5bb2ed7564bb67813a63ccd7df940889dc0740a3ded23d85063249ac5e165a8d | def _compact_datetime(self, day, timeformat='%M:%H'):
'compact description of this event\n\n TODO: explain day param\n\n :param day:\n :type day: datetime.date\n\n :return: compact description of Event\n :rtype: unicode()\n '
start = datetime.datetime.combine(day, datet... | compact description of this event
TODO: explain day param
:param day:
:type day: datetime.date
:return: compact description of Event
:rtype: unicode() | khal/khalendar/event.py | _compact_datetime | untitaker/khal | 0 | python | def _compact_datetime(self, day, timeformat='%M:%H'):
'compact description of this event\n\n TODO: explain day param\n\n :param day:\n :type day: datetime.date\n\n :return: compact description of Event\n :rtype: unicode()\n '
start = datetime.datetime.combine(day, datet... | def _compact_datetime(self, day, timeformat='%M:%H'):
'compact description of this event\n\n TODO: explain day param\n\n :param day:\n :type day: datetime.date\n\n :return: compact description of Event\n :rtype: unicode()\n '
start = datetime.datetime.combine(day, datet... |
bb4ed6c1c0a6a9fa1b28fe73e910921ab22836ae8c2f65f8c05e3558b79fcdff | def _create_calendar(self):
'\n create the calendar\n\n :returns: calendar\n :rtype: icalendar.Calendar()\n '
calendar = icalendar.Calendar()
calendar.add('version', '2.0')
calendar.add('prodid', '-//CALENDARSERVER.ORG//NONSGML Version 1//EN')
return calendar | create the calendar
:returns: calendar
:rtype: icalendar.Calendar() | khal/khalendar/event.py | _create_calendar | untitaker/khal | 0 | python | def _create_calendar(self):
'\n create the calendar\n\n :returns: calendar\n :rtype: icalendar.Calendar()\n '
calendar = icalendar.Calendar()
calendar.add('version', '2.0')
calendar.add('prodid', '-//CALENDARSERVER.ORG//NONSGML Version 1//EN')
return calendar | def _create_calendar(self):
'\n create the calendar\n\n :returns: calendar\n :rtype: icalendar.Calendar()\n '
calendar = icalendar.Calendar()
calendar.add('version', '2.0')
calendar.add('prodid', '-//CALENDARSERVER.ORG//NONSGML Version 1//EN')
return calendar<|docstring|>... |
f439fd0cbc66beb320817b3697861d2932cc06be45ef42f87122a676955e041e | def _create_timezone(self, tz):
'\n create an icalendar timezone from a pytz.tzinfo\n\n :param tz: the timezone\n :type tz: pytz.tzinfo\n :returns: timezone information set\n :rtype: icalendar.Timezone()\n '
timezone = icalendar.Timezone()
timezone.add('TZID', tz)
... | create an icalendar timezone from a pytz.tzinfo
:param tz: the timezone
:type tz: pytz.tzinfo
:returns: timezone information set
:rtype: icalendar.Timezone() | khal/khalendar/event.py | _create_timezone | untitaker/khal | 0 | python | def _create_timezone(self, tz):
'\n create an icalendar timezone from a pytz.tzinfo\n\n :param tz: the timezone\n :type tz: pytz.tzinfo\n :returns: timezone information set\n :rtype: icalendar.Timezone()\n '
timezone = icalendar.Timezone()
timezone.add('TZID', tz)
... | def _create_timezone(self, tz):
'\n create an icalendar timezone from a pytz.tzinfo\n\n :param tz: the timezone\n :type tz: pytz.tzinfo\n :returns: timezone information set\n :rtype: icalendar.Timezone()\n '
timezone = icalendar.Timezone()
timezone.add('TZID', tz)
... |
b2509600de27be080d637463cadd9b8b34776d110ad1a87ab45cd59b7edafc28 | def on_freeze(self):
'\n What happens if the position doesnt change for 5 minutes\n '
self.client.freeze()
self.status = 'frozen'
self.status_sign.emit('frozen')
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.freezetimer.start() | What happens if the position doesnt change for 5 minutes | spaghettiqueue/logparser.py | on_freeze | giorgioshine/SpaghettiQueue | 9 | python | def on_freeze(self):
'\n \n '
self.client.freeze()
self.status = 'frozen'
self.status_sign.emit('frozen')
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.freezetimer.start() | def on_freeze(self):
'\n \n '
self.client.freeze()
self.status = 'frozen'
self.status_sign.emit('frozen')
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.freezetimer.start()<|docstring|>What happens if the position doesnt change for 5 minutes<|endof... |
b8bd53b8538f2cd9c6bde9139b82e7d9e4844eec168f85daa16983f733093e56 | def stop(self):
'\n Prevents timer thread from running after closing the gui\n '
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.status = 'stopped' | Prevents timer thread from running after closing the gui | spaghettiqueue/logparser.py | stop | giorgioshine/SpaghettiQueue | 9 | python | def stop(self):
'\n \n '
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.status = 'stopped' | def stop(self):
'\n \n '
self.freezetimer.cancel()
self.freezetimer = Timer(300, self.on_freeze)
self.status = 'stopped'<|docstring|>Prevents timer thread from running after closing the gui<|endoftext|> |
2bbb9909085aa9fb208afe5eff7d37888aac7c8880511f8f782e2a5316558e5e | def get_args():
' Method to get all commandline arguments for training '
parser = argparse.ArgumentParser(description='PyTorch Higgs Training')
parser.add_argument('--epochs', default=20, type=int, metavar='N', help='Total number of epochs to run')
parser.add_argument('--batch_size', default=128, type=i... | Method to get all commandline arguments for training | args_util.py | get_args | cspradli/HiggsID | 0 | python | def get_args():
' '
parser = argparse.ArgumentParser(description='PyTorch Higgs Training')
parser.add_argument('--epochs', default=20, type=int, metavar='N', help='Total number of epochs to run')
parser.add_argument('--batch_size', default=128, type=int, metavar='N', help='training batch size')
par... | def get_args():
' '
parser = argparse.ArgumentParser(description='PyTorch Higgs Training')
parser.add_argument('--epochs', default=20, type=int, metavar='N', help='Total number of epochs to run')
parser.add_argument('--batch_size', default=128, type=int, metavar='N', help='training batch size')
par... |
8700efabc25faaee61d6ef74ec2acd486aec151335128fba7465fb05b52e2656 | @mock_http_response(responses.GET, '/sapi/v1/bswap/liquidityOps', mock_item, 200)
def test_bswap_liquidity():
'Tests the API endpoint to get liquidity operation (add/remove) records.'
client = Client(key, secret)
response = client.bswap_liquidity_operation_record()
response.should.equal(mock_item) | Tests the API endpoint to get liquidity operation (add/remove) records. | tests/spot/bswap/test_bswap_liquidity_operation_record.py | test_bswap_liquidity | SenthilVikram/binance-connector-python | 512 | python | @mock_http_response(responses.GET, '/sapi/v1/bswap/liquidityOps', mock_item, 200)
def test_bswap_liquidity():
client = Client(key, secret)
response = client.bswap_liquidity_operation_record()
response.should.equal(mock_item) | @mock_http_response(responses.GET, '/sapi/v1/bswap/liquidityOps', mock_item, 200)
def test_bswap_liquidity():
client = Client(key, secret)
response = client.bswap_liquidity_operation_record()
response.should.equal(mock_item)<|docstring|>Tests the API endpoint to get liquidity operation (add/remove) rec... |
9e53ffcd2fe5631938da38ad9246f8ab047eee5e94a812d011cac288325c56c8 | def __init__(self, xml_file=None):
'\n Given a well formed XML file (xml_file), read it and turn it into\n a big string.\n '
self.__name = ''
self.__namespace = None
self.__include_header_files = []
self.__includes = []
self.__include_enum_files = []
self.__include_array... | Given a well formed XML file (xml_file), read it and turn it into
a big string. | Autocoders/Python/src/fprime_ac/parsers/XmlArrayParser.py | __init__ | shubham-shahh/fprime | 9,182 | python | def __init__(self, xml_file=None):
'\n Given a well formed XML file (xml_file), read it and turn it into\n a big string.\n '
self.__name =
self.__namespace = None
self.__include_header_files = []
self.__includes = []
self.__include_enum_files = []
self.__include_array_f... | def __init__(self, xml_file=None):
'\n Given a well formed XML file (xml_file), read it and turn it into\n a big string.\n '
self.__name =
self.__namespace = None
self.__include_header_files = []
self.__includes = []
self.__include_enum_files = []
self.__include_array_f... |
00b6f01da9794160bac7003efd7f3f4b6a1d40b022fabddca988727c9a87bd02 | def test_wigner_bell1_su2parity():
'wigner: testing the SU2 parity of the first Bell state.\n '
psi = bell_state('00')
steps = 25
theta = np.tile(np.linspace(0, np.pi, steps), 2).reshape(2, steps)
phi = np.tile(np.linspace(0, (2 * np.pi), steps), 2).reshape(2, steps)
slicearray = ['l', 'l']
... | wigner: testing the SU2 parity of the first Bell state. | qutip/tests/test_wigner.py | test_wigner_bell1_su2parity | paniash/qutip | 1 | python | def test_wigner_bell1_su2parity():
'\n '
psi = bell_state('00')
steps = 25
theta = np.tile(np.linspace(0, np.pi, steps), 2).reshape(2, steps)
phi = np.tile(np.linspace(0, (2 * np.pi), steps), 2).reshape(2, steps)
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t i... | def test_wigner_bell1_su2parity():
'\n '
psi = bell_state('00')
steps = 25
theta = np.tile(np.linspace(0, np.pi, steps), 2).reshape(2, steps)
phi = np.tile(np.linspace(0, (2 * np.pi), steps), 2).reshape(2, steps)
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t i... |
39cb2d58227db2fc778bf2e821b5173de5b33a57a5864dcf91f655bf9c695907 | @pytest.mark.slow
def test_wigner_bell4_su2parity():
'wigner: testing the SU2 parity of the fourth Bell state.\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in range(steps):
wigner_analyt... | wigner: testing the SU2 parity of the fourth Bell state. | qutip/tests/test_wigner.py | test_wigner_bell4_su2parity | paniash/qutip | 1 | python | @pytest.mark.slow
def test_wigner_bell4_su2parity():
'\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in range(steps):
wigner_analyt[(t, p)] = (- 0.5)
wigner_theo = wigner_transform(ps... | @pytest.mark.slow
def test_wigner_bell4_su2parity():
'\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in range(steps):
wigner_analyt[(t, p)] = (- 0.5)
wigner_theo = wigner_transform(ps... |
a9100673b9616cef13a375fd67b2a6595f9097d71dd4d37aeadb3c2499b58a14 | @pytest.mark.slow
def test_wigner_bell4_fullparity():
'wigner: testing the parity of the fourth Bell state using the parity of\n the full space.\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in ra... | wigner: testing the parity of the fourth Bell state using the parity of
the full space. | qutip/tests/test_wigner.py | test_wigner_bell4_fullparity | paniash/qutip | 1 | python | @pytest.mark.slow
def test_wigner_bell4_fullparity():
'wigner: testing the parity of the fourth Bell state using the parity of\n the full space.\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in ra... | @pytest.mark.slow
def test_wigner_bell4_fullparity():
'wigner: testing the parity of the fourth Bell state using the parity of\n the full space.\n '
psi = bell_state('11')
steps = 25
slicearray = ['l', 'l']
wigner_analyt = np.zeros((steps, steps))
for t in range(steps):
for p in ra... |
19e2bcb55367a9bd7eb37ac4ee0cc52b334c9fb87a421a30468abd297476b4c6 | def test_parity():
'wigner: testing the parity function.\n '
j = 0.5
assert_(((_parity(2, j)[(0, 0)] - ((1 - np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(0, 1)] < 1e-11))
assert_(((_parity(2, j)[(1, 1)] - ((1 + np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(1, 0)] < 1e-11)) | wigner: testing the parity function. | qutip/tests/test_wigner.py | test_parity | paniash/qutip | 1 | python | def test_parity():
'\n '
j = 0.5
assert_(((_parity(2, j)[(0, 0)] - ((1 - np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(0, 1)] < 1e-11))
assert_(((_parity(2, j)[(1, 1)] - ((1 + np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(1, 0)] < 1e-11)) | def test_parity():
'\n '
j = 0.5
assert_(((_parity(2, j)[(0, 0)] - ((1 - np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(0, 1)] < 1e-11))
assert_(((_parity(2, j)[(1, 1)] - ((1 + np.sqrt(3)) / 2.0)) < 1e-11))
assert_((_parity(2, j)[(1, 0)] < 1e-11))<|docstring|>wigner: testing the parity... |
9defae4855e02f5e418ffc3764b3e91280855b3cd7742a7586c54b2e614dc5d6 | @pytest.mark.slow
def test_wigner_pure_su2():
'wigner: testing the SU2 wigner transformation of a pure state.\n '
psi = ket([1])
steps = 25
theta = np.linspace(0, np.pi, steps)
phi = np.linspace(0, (2 * np.pi), steps)
theta = theta[(None, :)]
phi = phi[(None, :)]
slicearray = ['l']
... | wigner: testing the SU2 wigner transformation of a pure state. | qutip/tests/test_wigner.py | test_wigner_pure_su2 | paniash/qutip | 1 | python | @pytest.mark.slow
def test_wigner_pure_su2():
'\n '
psi = ket([1])
steps = 25
theta = np.linspace(0, np.pi, steps)
phi = np.linspace(0, (2 * np.pi), steps)
theta = theta[(None, :)]
phi = phi[(None, :)]
slicearray = ['l']
wigner_analyt = np.zeros((steps, steps))
for t in range(... | @pytest.mark.slow
def test_wigner_pure_su2():
'\n '
psi = ket([1])
steps = 25
theta = np.linspace(0, np.pi, steps)
phi = np.linspace(0, (2 * np.pi), steps)
theta = theta[(None, :)]
phi = phi[(None, :)]
slicearray = ['l']
wigner_analyt = np.zeros((steps, steps))
for t in range(... |
1b0badf03735be85cc462315b54941fe05a1afdf17fa0601b3f3d5e38ed3a5c2 | @pytest.mark.slow
def test_wigner_ghz_su2parity():
'wigner: testing the SU2 wigner transformation of the GHZ state.\n '
psi = ((ket([0, 0, 0]) + ket([1, 1, 1])) / np.sqrt(2))
steps = 25
N = 3
theta = np.tile(np.linspace(0, np.pi, steps), N).reshape(N, steps)
phi = np.tile(np.linspace(0, (2 * ... | wigner: testing the SU2 wigner transformation of the GHZ state. | qutip/tests/test_wigner.py | test_wigner_ghz_su2parity | paniash/qutip | 1 | python | @pytest.mark.slow
def test_wigner_ghz_su2parity():
'\n '
psi = ((ket([0, 0, 0]) + ket([1, 1, 1])) / np.sqrt(2))
steps = 25
N = 3
theta = np.tile(np.linspace(0, np.pi, steps), N).reshape(N, steps)
phi = np.tile(np.linspace(0, (2 * np.pi), steps), N).reshape(N, steps)
slicearray = ['l', 'l'... | @pytest.mark.slow
def test_wigner_ghz_su2parity():
'\n '
psi = ((ket([0, 0, 0]) + ket([1, 1, 1])) / np.sqrt(2))
steps = 25
N = 3
theta = np.tile(np.linspace(0, np.pi, steps), N).reshape(N, steps)
phi = np.tile(np.linspace(0, (2 * np.pi), steps), N).reshape(N, steps)
slicearray = ['l', 'l'... |
9f69b8d4172efd0e9c5d1ab46159c4376aeaaf6fcaef062a0b7dfdf15b9c05a6 | @pytest.mark.slow
def test_angle_slicing():
'wigner: tests angle slicing.\n '
psi1 = bell_state('00')
psi2 = bell_state('01')
psi3 = bell_state('10')
psi4 = bell_state('11')
steps = 25
j = 0.5
wigner1 = wigner_transform(psi1, j, False, steps, ['l', 'l'])
wigner2 = wigner_transform... | wigner: tests angle slicing. | qutip/tests/test_wigner.py | test_angle_slicing | paniash/qutip | 1 | python | @pytest.mark.slow
def test_angle_slicing():
'\n '
psi1 = bell_state('00')
psi2 = bell_state('01')
psi3 = bell_state('10')
psi4 = bell_state('11')
steps = 25
j = 0.5
wigner1 = wigner_transform(psi1, j, False, steps, ['l', 'l'])
wigner2 = wigner_transform(psi2, j, False, steps, ['l'... | @pytest.mark.slow
def test_angle_slicing():
'\n '
psi1 = bell_state('00')
psi2 = bell_state('01')
psi3 = bell_state('10')
psi4 = bell_state('11')
steps = 25
j = 0.5
wigner1 = wigner_transform(psi1, j, False, steps, ['l', 'l'])
wigner2 = wigner_transform(psi2, j, False, steps, ['l'... |
1fd2d9909ee070a17dd58a67be3133008dfcbdf86a1e0d09d07dfcad12613107 | def test_wigner_coherent():
'wigner: test wigner function calculation for coherent states'
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 20
beta = (rand() + (rand() * 1j))
... | wigner: test wigner function calculation for coherent states | qutip/tests/test_wigner.py | test_wigner_coherent | paniash/qutip | 1 | python | def test_wigner_coherent():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 20
beta = (rand() + (rand() * 1j))
psi = coherent(N, beta)
W_qutip = wigner(psi, xvec, yvec... | def test_wigner_coherent():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 20
beta = (rand() + (rand() * 1j))
psi = coherent(N, beta)
W_qutip = wigner(psi, xvec, yvec... |
fa528df9243fd37ea48bbcd44d85242ab6e12b730d1b72f52a8bf87c3f7d2b17 | def test_wigner_fock():
'wigner: test wigner function calculation for Fock states'
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in [2, 3, 4, 5, 6]:
psi = fo... | wigner: test wigner function calculation for Fock states | qutip/tests/test_wigner.py | test_wigner_fock | paniash/qutip | 1 | python | def test_wigner_fock():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in [2, 3, 4, 5, 6]:
psi = fock(N, n)
W_qutip = wigner(psi, xvec, yvec, g=2)
... | def test_wigner_fock():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
a = (X + (1j * Y))
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in [2, 3, 4, 5, 6]:
psi = fock(N, n)
W_qutip = wigner(psi, xvec, yvec, g=2)
... |
b184a9513d1795bcc584c73bdf4786536142aaafac0e57fbd7082eb4b2812a61 | def test_wigner_compare_methods_dm():
'wigner: compare wigner methods for random density matrices'
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
rho = rand_dm(N, (0.5... | wigner: compare wigner methods for random density matrices | qutip/tests/test_wigner.py | test_wigner_compare_methods_dm | paniash/qutip | 1 | python | def test_wigner_compare_methods_dm():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
rho = rand_dm(N, (0.5 + (rand() / 2)))
W_qutip1 = wigner(rho, xvec, yvec,... | def test_wigner_compare_methods_dm():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
rho = rand_dm(N, (0.5 + (rand() / 2)))
W_qutip1 = wigner(rho, xvec, yvec,... |
29de5f54a3aa61e56c7aded20b07674176fc8687906778f865786e926146d1e9 | def test_wigner_compare_methods_ket():
'wigner: compare wigner methods for random state vectors'
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
psi = rand_ket(N, (0.5 ... | wigner: compare wigner methods for random state vectors | qutip/tests/test_wigner.py | test_wigner_compare_methods_ket | paniash/qutip | 1 | python | def test_wigner_compare_methods_ket():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
psi = rand_ket(N, (0.5 + (rand() / 2)))
W_qutip1 = wigner(psi, xvec, yve... | def test_wigner_compare_methods_ket():
xvec = np.linspace((- 5.0), 5.0, 100)
yvec = xvec
(X, Y) = np.meshgrid(xvec, yvec)
dx = (xvec[1] - xvec[0])
dy = (yvec[1] - yvec[0])
N = 15
for n in range(10):
psi = rand_ket(N, (0.5 + (rand() / 2)))
W_qutip1 = wigner(psi, xvec, yve... |
b64733efe2b1ebfe714e24f0d5fda95788d87082755802cbd2fabff4d2aada5b | def test_wigner_fft_comparse_ket():
'Wigner: Compare Wigner fft and iterative for rand. ket'
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_ket(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
... | Wigner: Compare Wigner fft and iterative for rand. ket | qutip/tests/test_wigner.py | test_wigner_fft_comparse_ket | paniash/qutip | 1 | python | def test_wigner_fft_comparse_ket():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_ket(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
Wdiff = abs((W - Wfft))
assert_equal((np.sum(a... | def test_wigner_fft_comparse_ket():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_ket(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
Wdiff = abs((W - Wfft))
assert_equal((np.sum(a... |
b0e6d1725251197356376368b89fd2974f4dea0b8ca4f8ace7a723cf015cae1b | def test_wigner_fft_comparse_dm():
'Wigner: Compare Wigner fft and iterative for rand. dm'
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
W... | Wigner: Compare Wigner fft and iterative for rand. dm | qutip/tests/test_wigner.py | test_wigner_fft_comparse_dm | paniash/qutip | 1 | python | def test_wigner_fft_comparse_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
Wdiff = abs((W - Wfft))
assert_equal((np.sum(abs... | def test_wigner_fft_comparse_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
(Wfft, yvec) = wigner(rho, xvec, xvec, method='fft')
W = wigner(rho, xvec, yvec, method='iterative')
Wdiff = abs((W - Wfft))
assert_equal((np.sum(abs... |
39dac2d741704324c91a9de016b327bb4f9ae7bc304dc87e76f559039400b0ac | def test_wigner_clenshaw_iter_dm():
'Wigner: Compare Wigner clenshaw and iterative for rand. dm'
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw')
W = wigner(rho, xvec, xvec, method='iterative')
... | Wigner: Compare Wigner clenshaw and iterative for rand. dm | qutip/tests/test_wigner.py | test_wigner_clenshaw_iter_dm | paniash/qutip | 1 | python | def test_wigner_clenshaw_iter_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw')
W = wigner(rho, xvec, xvec, method='iterative')
Wdiff = abs((W - Wclen))
assert_equal((np.sum(abs... | def test_wigner_clenshaw_iter_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw')
W = wigner(rho, xvec, xvec, method='iterative')
Wdiff = abs((W - Wclen))
assert_equal((np.sum(abs... |
d21900ea85edc634c4b428003c9ac69be886a0927a47764d1f429f232162ab3a | def test_wigner_clenshaw_sp_iter_dm():
'Wigner: Compare Wigner sparse clenshaw and iterative for rand. dm'
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw', sparse=True)
W = wigner(rho, xvec, xvec, me... | Wigner: Compare Wigner sparse clenshaw and iterative for rand. dm | qutip/tests/test_wigner.py | test_wigner_clenshaw_sp_iter_dm | paniash/qutip | 1 | python | def test_wigner_clenshaw_sp_iter_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw', sparse=True)
W = wigner(rho, xvec, xvec, method='iterative')
Wdiff = abs((W - Wclen))
assert_e... | def test_wigner_clenshaw_sp_iter_dm():
N = 20
xvec = np.linspace((- 10), 10, 128)
for i in range(3):
rho = rand_dm(N)
Wclen = wigner(rho, xvec, xvec, method='clenshaw', sparse=True)
W = wigner(rho, xvec, xvec, method='iterative')
Wdiff = abs((W - Wclen))
assert_e... |
e8ce82f1dd46ed1b7dc17667a3974cd89efb6d7ab50bea51625b7bcf701bac30 | def _get_datetime(element):
'Converts an element to a Python datetime.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding datatime.\n '
assert isinstance(element, pd.Timestamp)
return element.to_pydatetime() | Converts an element to a Python datetime.
Args:
element: A dataframe element; must be a Timestamp.
Returns:
The corresponding datatime. | purplequery/bq_types.py | _get_datetime | mark-velez/purplequery | 13 | python | def _get_datetime(element):
'Converts an element to a Python datetime.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding datatime.\n '
assert isinstance(element, pd.Timestamp)
return element.to_pydatetime() | def _get_datetime(element):
'Converts an element to a Python datetime.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding datatime.\n '
assert isinstance(element, pd.Timestamp)
return element.to_pydatetime()<|docstring|>Converts an element ... |
bde1e8e55e6ae598b0faac5d10d76fcfb6f619941047eb89cac210478bc60aa2 | def _get_date(timestamp):
'Converts an element to a Python date.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding date.\n '
assert isinstance(timestamp, pd.Timestamp)
return timestamp.to_pydatetime().date() | Converts an element to a Python date.
Args:
element: A dataframe element; must be a Timestamp.
Returns:
The corresponding date. | purplequery/bq_types.py | _get_date | mark-velez/purplequery | 13 | python | def _get_date(timestamp):
'Converts an element to a Python date.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding date.\n '
assert isinstance(timestamp, pd.Timestamp)
return timestamp.to_pydatetime().date() | def _get_date(timestamp):
'Converts an element to a Python date.\n\n Args:\n element: A dataframe element; must be a Timestamp.\n\n Returns:\n The corresponding date.\n '
assert isinstance(timestamp, pd.Timestamp)
return timestamp.to_pydatetime().date()<|docstring|>Converts an element... |
cb5fdc774eef8dece8b724e6ce1712ed04548b006964f713beecfcdd41e922df | def _get_str(s):
"Converts an element to a Python string.\n\n Python 2 and Python 3 have different sets of string-related types, and different rules for\n conversion between those types. The short version is, Python 2 has str and unicode, and strs\n are valid unicode values; Python 3 has str and bytes, an... | Converts an element to a Python string.
Python 2 and Python 3 have different sets of string-related types, and different rules for
conversion between those types. The short version is, Python 2 has str and unicode, and strs
are valid unicode values; Python 3 has str and bytes, and there is no implicit conversion
betw... | purplequery/bq_types.py | _get_str | mark-velez/purplequery | 13 | python | def _get_str(s):
"Converts an element to a Python string.\n\n Python 2 and Python 3 have different sets of string-related types, and different rules for\n conversion between those types. The short version is, Python 2 has str and unicode, and strs\n are valid unicode values; Python 3 has str and bytes, an... | def _get_str(s):
"Converts an element to a Python string.\n\n Python 2 and Python 3 have different sets of string-related types, and different rules for\n conversion between those types. The short version is, Python 2 has str and unicode, and strs\n are valid unicode values; Python 3 has str and bytes, an... |
29f09e52b290db67a291aec68b2ec7900728d162e52e53c5ee0411fb01cdcfa4 | def _coerce_names(names):
"Coerce a set of field names. Names agree if equal or if one is None.\n\n This function is called in the context of coercing STRUCT types like\n STRUCT<a INTEGER, b> with STRUCT(1 as a, 7). In that case, it would be called twice, one for\n the first column (to merge the two 'a's... | Coerce a set of field names. Names agree if equal or if one is None.
This function is called in the context of coercing STRUCT types like
STRUCT<a INTEGER, b> with STRUCT(1 as a, 7). In that case, it would be called twice, one for
the first column (to merge the two 'a's into 'a') and once for the second column (to m... | purplequery/bq_types.py | _coerce_names | mark-velez/purplequery | 13 | python | def _coerce_names(names):
"Coerce a set of field names. Names agree if equal or if one is None.\n\n This function is called in the context of coercing STRUCT types like\n STRUCT<a INTEGER, b> with STRUCT(1 as a, 7). In that case, it would be called twice, one for\n the first column (to merge the two 'a's... | def _coerce_names(names):
"Coerce a set of field names. Names agree if equal or if one is None.\n\n This function is called in the context of coercing STRUCT types like\n STRUCT<a INTEGER, b> with STRUCT(1 as a, 7). In that case, it would be called twice, one for\n the first column (to merge the two 'a's... |
9e179b6aa5af58b7c93d2a4608e0d2cf67a4b8999ef6eb9a579d9c903a0bd543 | def _coerce_structs(struct_types):
"Coerce a sequence of struct types into one.\n\n Struct types are merged field-by-field. If the number of fields is different, they don't match.\n Two fields are merged by merging the names (see _coerce_names) and the types (recursively).\n\n Args:\n struct_types:... | Coerce a sequence of struct types into one.
Struct types are merged field-by-field. If the number of fields is different, they don't match.
Two fields are merged by merging the names (see _coerce_names) and the types (recursively).
Args:
struct_types: a sequence of struct types.
Raises:
ValueError: if the ty... | purplequery/bq_types.py | _coerce_structs | mark-velez/purplequery | 13 | python | def _coerce_structs(struct_types):
"Coerce a sequence of struct types into one.\n\n Struct types are merged field-by-field. If the number of fields is different, they don't match.\n Two fields are merged by merging the names (see _coerce_names) and the types (recursively).\n\n Args:\n struct_types:... | def _coerce_structs(struct_types):
"Coerce a sequence of struct types into one.\n\n Struct types are merged field-by-field. If the number of fields is different, they don't match.\n Two fields are merged by merging the names (see _coerce_names) and the types (recursively).\n\n Args:\n struct_types:... |
c47df2f19e277f6c18329bc6ed31ef3c43c752bd3704f28a3abf1da007b51227 | def implicitly_coerce(*types):
'Given some number of types, return their common supertype, if any.\n All given types must be implicitly coercible to a common supertype.\n Specifically, INT64 and NUMERIC coerce to FLOAT, and STRING coerces to DATE or TIMESTAMP.\n All other conversions must be specified expl... | Given some number of types, return their common supertype, if any.
All given types must be implicitly coercible to a common supertype.
Specifically, INT64 and NUMERIC coerce to FLOAT, and STRING coerces to DATE or TIMESTAMP.
All other conversions must be specified explicitly.
See: https://cloud.google.com/bigquery/doc... | purplequery/bq_types.py | implicitly_coerce | mark-velez/purplequery | 13 | python | def implicitly_coerce(*types):
'Given some number of types, return their common supertype, if any.\n All given types must be implicitly coercible to a common supertype.\n Specifically, INT64 and NUMERIC coerce to FLOAT, and STRING coerces to DATE or TIMESTAMP.\n All other conversions must be specified expl... | def implicitly_coerce(*types):
'Given some number of types, return their common supertype, if any.\n All given types must be implicitly coercible to a common supertype.\n Specifically, INT64 and NUMERIC coerce to FLOAT, and STRING coerces to DATE or TIMESTAMP.\n All other conversions must be specified expl... |
8732fbd71ea3a7a9b64fefee82647d89cd739d9acd70edd7ebdf7e6acc0020c5 | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n 'object' dtype, meaning NumPy will not try to interpret the type and will leave it\n as a Python object.\n\n Subclasses may override this function to return a more specific NumPy dtype.\n "
... | Converts this BigQuery type to a NumPy dtype.
Returns:
'object' dtype, meaning NumPy will not try to interpret the type and will leave it
as a Python object.
Subclasses may override this function to return a more specific NumPy dtype. | purplequery/bq_types.py | to_dtype | mark-velez/purplequery | 13 | python | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n 'object' dtype, meaning NumPy will not try to interpret the type and will leave it\n as a Python object.\n\n Subclasses may override this function to return a more specific NumPy dtype.\n "
... | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n 'object' dtype, meaning NumPy will not try to interpret the type and will leave it\n as a Python object.\n\n Subclasses may override this function to return a more specific NumPy dtype.\n "
... |
869d76368f732d472e7240661416a2a1ee4c46ee66cae258998c5939b762ee21 | @classmethod
def from_schema_field(cls, field):
'Converts from a BigQuery SchemaField object to a BQType subclass.\n\n This is a factory function, that constructs an object of the appropriate child class.\n\n Args:\n field: A BigQuery SchemaField object, the google cloud bigquery Python API... | Converts from a BigQuery SchemaField object to a BQType subclass.
This is a factory function, that constructs an object of the appropriate child class.
Args:
field: A BigQuery SchemaField object, the google cloud bigquery Python API
representation of a column type.
Returns:
An instance of a BQType subcla... | purplequery/bq_types.py | from_schema_field | mark-velez/purplequery | 13 | python | @classmethod
def from_schema_field(cls, field):
'Converts from a BigQuery SchemaField object to a BQType subclass.\n\n This is a factory function, that constructs an object of the appropriate child class.\n\n Args:\n field: A BigQuery SchemaField object, the google cloud bigquery Python API... | @classmethod
def from_schema_field(cls, field):
'Converts from a BigQuery SchemaField object to a BQType subclass.\n\n This is a factory function, that constructs an object of the appropriate child class.\n\n Args:\n field: A BigQuery SchemaField object, the google cloud bigquery Python API... |
8bb4a90e6bb4167333bdbb667782f22cd930abae1df9fcfcf63076b8ef1e0e56 | @abstractmethod
def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n Returns:\n ... | Converts this type to a BigQuery SchemaField.
Args:
name: The name of the column. This class represents a type; SchemaField represents
a column, so it includes the type and also the name of the column.
Returns:
A SchemaField object corresponding to a column containing this class' type.
This abstract meth... | purplequery/bq_types.py | to_schema_field | mark-velez/purplequery | 13 | python | @abstractmethod
def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n Returns:\n ... | @abstractmethod
def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n Returns:\n ... |
8bf0e145ac0425702d6e5755ee80d697949f4023c97352c9d9de01d12ee2fbd4 | @abstractmethod
def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Return... | Converts a pandas Series element to a Python type corresponding to this BigQuery type.
Args:
element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64
rather than a Python type like int.
Returns:
The element's value, cast to a corresponding Python type. | purplequery/bq_types.py | convert | mark-velez/purplequery | 13 | python | @abstractmethod
def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Return... | @abstractmethod
def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Return... |
46276d72653ded34bde24ec0fa88001d515ccb6eb64c6a595d6d5bb68e743ed6 | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n A NumPy dtype corresponding to this BigQuery type (e.g. np.dtype('int64') for INTEGER)\n "
return np.dtype(_BQ_SCALAR_TYPE_TO_NUMPY_TYPE[self]) | Converts this BigQuery type to a NumPy dtype.
Returns:
A NumPy dtype corresponding to this BigQuery type (e.g. np.dtype('int64') for INTEGER) | purplequery/bq_types.py | to_dtype | mark-velez/purplequery | 13 | python | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n A NumPy dtype corresponding to this BigQuery type (e.g. np.dtype('int64') for INTEGER)\n "
return np.dtype(_BQ_SCALAR_TYPE_TO_NUMPY_TYPE[self]) | def to_dtype(self):
"Converts this BigQuery type to a NumPy dtype.\n\n Returns:\n A NumPy dtype corresponding to this BigQuery type (e.g. np.dtype('int64') for INTEGER)\n "
return np.dtype(_BQ_SCALAR_TYPE_TO_NUMPY_TYPE[self])<|docstring|>Converts this BigQuery type to a NumPy dtype.
Ret... |
e2bfd521eb8f21f9b67e8b8c9f2570e5248b6f675b74d9d6759ce37b75752447 | @classmethod
def from_string(cls, typename):
'Reads this type from a string representation.\n\n A Factory method constructing an instance of BQScalarType corresponding to typename.\n The reason for not just using the inherited Enum constructor is to allow Standard BigQuery\n typenames to be ali... | Reads this type from a string representation.
A Factory method constructing an instance of BQScalarType corresponding to typename.
The reason for not just using the inherited Enum constructor is to allow Standard BigQuery
typenames to be aliases for Legacy typenames.
Args:
typename: A BigQuery type name, either L... | purplequery/bq_types.py | from_string | mark-velez/purplequery | 13 | python | @classmethod
def from_string(cls, typename):
'Reads this type from a string representation.\n\n A Factory method constructing an instance of BQScalarType corresponding to typename.\n The reason for not just using the inherited Enum constructor is to allow Standard BigQuery\n typenames to be ali... | @classmethod
def from_string(cls, typename):
'Reads this type from a string representation.\n\n A Factory method constructing an instance of BQScalarType corresponding to typename.\n The reason for not just using the inherited Enum constructor is to allow Standard BigQuery\n typenames to be ali... |
db462ecf758b511a6a79ea0ef6d9179fa1c85bc3151d77318ea226c9eb269d05 | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | Converts this type to a BigQuery SchemaField.
Args:
name: The name of the column. This class represents a type; SchemaField represents
a column, so it includes the type and also the name of the column.
Returns:
A SchemaField object corresponding to a column containing this class' type. | purplequery/bq_types.py | to_schema_field | mark-velez/purplequery | 13 | python | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... |
e927201fd0d70ddf7621d97792a50f0a2a1c358827587f1b43621cb4a685e070 | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... | Converts a pandas Series element to a Python type corresponding to this BigQuery type.
Args:
element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64
rather than a Python type like int.
Returns:
The element's value, cast to a corresponding Python type. | purplequery/bq_types.py | convert | mark-velez/purplequery | 13 | python | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... |
c333837a81b63c7113e95f28a31a924e09467885f9ee4c47aca8e21e7da2ac7f | def __new__(cls, fields, types):
'Ensures that there is only one instance of BQStruct per component type.\n\n Args:\n fields: A list of optional string field names\n types: A list of optional types.\n\n Returns:\n A singleton Struct type object containing the provided ... | Ensures that there is only one instance of BQStruct per component type.
Args:
fields: A list of optional string field names
types: A list of optional types.
Returns:
A singleton Struct type object containing the provided type_ | purplequery/bq_types.py | __new__ | mark-velez/purplequery | 13 | python | def __new__(cls, fields, types):
'Ensures that there is only one instance of BQStruct per component type.\n\n Args:\n fields: A list of optional string field names\n types: A list of optional types.\n\n Returns:\n A singleton Struct type object containing the provided ... | def __new__(cls, fields, types):
'Ensures that there is only one instance of BQStruct per component type.\n\n Args:\n fields: A list of optional string field names\n types: A list of optional types.\n\n Returns:\n A singleton Struct type object containing the provided ... |
ef5378c1ce8571ee8f141054e567abe9ac82d4c083262ab005c630881ee3c1c0 | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | Converts this type to a BigQuery SchemaField.
Args:
name: The name of the column. This class represents a type; SchemaField represents
a column, so it includes the type and also the name of the column.
Returns:
A SchemaField object corresponding to a column containing this class' type. | purplequery/bq_types.py | to_schema_field | mark-velez/purplequery | 13 | python | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... |
aa3c9d2fb95ed63c6f286dcd58375110f3fe1c1b8c0b4f4092d8995b6b73d458 | def __new__(cls, type_):
'Ensures that there is only one instance of BQArray per component type.\n\n Args:\n type: A scalar type object.\n\n Returns:\n A singleton Array type object containing the provided type_\n '
if (type_ not in cls._ARRAY_TYPE_OBJECTS):
ar... | Ensures that there is only one instance of BQArray per component type.
Args:
type: A scalar type object.
Returns:
A singleton Array type object containing the provided type_ | purplequery/bq_types.py | __new__ | mark-velez/purplequery | 13 | python | def __new__(cls, type_):
'Ensures that there is only one instance of BQArray per component type.\n\n Args:\n type: A scalar type object.\n\n Returns:\n A singleton Array type object containing the provided type_\n '
if (type_ not in cls._ARRAY_TYPE_OBJECTS):
ar... | def __new__(cls, type_):
'Ensures that there is only one instance of BQArray per component type.\n\n Args:\n type: A scalar type object.\n\n Returns:\n A singleton Array type object containing the provided type_\n '
if (type_ not in cls._ARRAY_TYPE_OBJECTS):
ar... |
ba62d4d49d8158a45e8097e9a594fa2fac2ee5ee64383a6c7c744a0cfcf90049 | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | Converts this type to a BigQuery SchemaField.
Args:
name: The name of the column. This class represents a type; SchemaField represents
a column, so it includes the type and also the name of the column.
Returns:
A SchemaField object corresponding to a column containing this class' type. | purplequery/bq_types.py | to_schema_field | mark-velez/purplequery | 13 | python | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... | def to_schema_field(self, name):
"Converts this type to a BigQuery SchemaField.\n\n Args:\n name: The name of the column. This class represents a type; SchemaField represents\n a column, so it includes the type and also the name of the column.\n\n Returns:\n A SchemaF... |
b13d0da07b04efbbf46b12933bd5ca4d02c873a333cf5a91e4b5e8e26e538247 | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... | Converts a pandas Series element to a Python type corresponding to this BigQuery type.
Args:
element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64
rather than a Python type like int.
Returns:
The element's value, cast to a corresponding Python type. | purplequery/bq_types.py | convert | mark-velez/purplequery | 13 | python | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... | def convert(self, element):
"Converts a pandas Series element to a Python type corresponding to this BigQuery type.\n\n Args:\n element: One cell of a Pandas DataFrame or Series. Will have numpy types like np.int64\n rather than a Python type like int.\n\n Returns:\n ... |
09419861c7f8d1a5908ab32368fe0927e34a7e458d0e81e8ed00befc8ba50759 | @property
def series(self):
'Returns just the column of data.'
return self._series | Returns just the column of data. | purplequery/bq_types.py | series | mark-velez/purplequery | 13 | python | @property
def series(self):
return self._series | @property
def series(self):
return self._series<|docstring|>Returns just the column of data.<|endoftext|> |
aefa02ce05f9a7cfc57ce227b355f98e3d716818f4216275adc1f9ffe0f7598f | @property
def type_(self):
'Returns just the type of the data.'
return self._type | Returns just the type of the data. | purplequery/bq_types.py | type_ | mark-velez/purplequery | 13 | python | @property
def type_(self):
return self._type | @property
def type_(self):
return self._type<|docstring|>Returns just the type of the data.<|endoftext|> |
d3d218098dbe7c435cdd14c2ec4a1fbb3cd688c350ac54514415c533f531b6a3 | @property
def dataframe(self):
'Returns the column of data cast to a one-column table.'
return pd.DataFrame(self.series) | Returns the column of data cast to a one-column table. | purplequery/bq_types.py | dataframe | mark-velez/purplequery | 13 | python | @property
def dataframe(self):
return pd.DataFrame(self.series) | @property
def dataframe(self):
return pd.DataFrame(self.series)<|docstring|>Returns the column of data cast to a one-column table.<|endoftext|> |
051e1697466daf9b00818c3ab98d0138c81a5c9c745a01cea7c4f7afc71b5abc | @property
def types(self):
'Returns the data type cast to a one-element list.'
return [self.type_] | Returns the data type cast to a one-element list. | purplequery/bq_types.py | types | mark-velez/purplequery | 13 | python | @property
def types(self):
return [self.type_] | @property
def types(self):
return [self.type_]<|docstring|>Returns the data type cast to a one-element list.<|endoftext|> |
4da8df884a02f6e9254761305af66d00d7bd446eaaf65232111699b622ce76d8 | def to_list(self):
'Returns the column as a list of Python-typed objects.'
return [self.type_.convert(element) for element in self.series] | Returns the column as a list of Python-typed objects. | purplequery/bq_types.py | to_list | mark-velez/purplequery | 13 | python | def to_list(self):
return [self.type_.convert(element) for element in self.series] | def to_list(self):
return [self.type_.convert(element) for element in self.series]<|docstring|>Returns the column as a list of Python-typed objects.<|endoftext|> |
7c2732e81757907e4c610f18e42df33a15aadf994dca9f4b7253be16c97e4eb7 | @property
def dataframe(self):
"Returns the underlying DataFrame.\n\n This is a property so that it's immutable.\n\n Returns:\n The actual tabular data.\n "
return self._dataframe | Returns the underlying DataFrame.
This is a property so that it's immutable.
Returns:
The actual tabular data. | purplequery/bq_types.py | dataframe | mark-velez/purplequery | 13 | python | @property
def dataframe(self):
"Returns the underlying DataFrame.\n\n This is a property so that it's immutable.\n\n Returns:\n The actual tabular data.\n "
return self._dataframe | @property
def dataframe(self):
"Returns the underlying DataFrame.\n\n This is a property so that it's immutable.\n\n Returns:\n The actual tabular data.\n "
return self._dataframe<|docstring|>Returns the underlying DataFrame.
This is a property so that it's immutable.
Returns:
... |
1d170eeed407181132a6d34afa4b03451fdb5f7d6703a0a6a81e2367778286d1 | @property
def types(self):
"Returns the data types, in the same order as the table's columns."
return self._types | Returns the data types, in the same order as the table's columns. | purplequery/bq_types.py | types | mark-velez/purplequery | 13 | python | @property
def types(self):
return self._types | @property
def types(self):
return self._types<|docstring|>Returns the data types, in the same order as the table's columns.<|endoftext|> |
54a4c845fb36f600ff5b3afa324b86a796b65d7c94c6f089c4b4de07c80c8cb7 | def to_bq_schema(self):
"Returns a BigQuery schema (list of schema fields) matching this object's types."
return [type_.to_schema_field(name) for (name, type_) in zip(self.dataframe.columns, self.types)] | Returns a BigQuery schema (list of schema fields) matching this object's types. | purplequery/bq_types.py | to_bq_schema | mark-velez/purplequery | 13 | python | def to_bq_schema(self):
return [type_.to_schema_field(name) for (name, type_) in zip(self.dataframe.columns, self.types)] | def to_bq_schema(self):
return [type_.to_schema_field(name) for (name, type_) in zip(self.dataframe.columns, self.types)]<|docstring|>Returns a BigQuery schema (list of schema fields) matching this object's types.<|endoftext|> |
031934e413055d1d5c0a5de73405f21bd0e09204aea87338e30d7caa3e78c4d1 | def to_list_of_lists(self):
'Returns the data as a list of rows, each row a list of Python-typed objects.'
rows = []
for (unused_index, row) in self.dataframe.iterrows():
rows.append([type_.convert(element) for (element, type_) in zip(list(row), self.types)])
return rows | Returns the data as a list of rows, each row a list of Python-typed objects. | purplequery/bq_types.py | to_list_of_lists | mark-velez/purplequery | 13 | python | def to_list_of_lists(self):
rows = []
for (unused_index, row) in self.dataframe.iterrows():
rows.append([type_.convert(element) for (element, type_) in zip(list(row), self.types)])
return rows | def to_list_of_lists(self):
rows = []
for (unused_index, row) in self.dataframe.iterrows():
rows.append([type_.convert(element) for (element, type_) in zip(list(row), self.types)])
return rows<|docstring|>Returns the data as a list of rows, each row a list of Python-typed objects.<|endoftext|> |
e34792f137f5ff58bd468eba96dbaee529bd1090dd3f36f5bc5cfe64b0e2f116 | def __init__(self, default_db, sql):
"Constructor.\n\n Args:\n default_db (str): Default database's name.\n sql (str): One sql text.\n\n "
self.sql = sql
self.default_db = default_db | Constructor.
Args:
default_db (str): Default database's name.
sql (str): One sql text. | sqlextractor/SqlExtractor.py | __init__ | StefanLim0/mysql-er | 8 | python | def __init__(self, default_db, sql):
"Constructor.\n\n Args:\n default_db (str): Default database's name.\n sql (str): One sql text.\n\n "
self.sql = sql
self.default_db = default_db | def __init__(self, default_db, sql):
"Constructor.\n\n Args:\n default_db (str): Default database's name.\n sql (str): One sql text.\n\n "
self.sql = sql
self.default_db = default_db<|docstring|>Constructor.
Args:
default_db (str): Default database's name.
sql (str):... |
8b5f11f19830731e1690c15ed7b5171b34c1ec4d0362ebd323237fe5c79386ea | def get_sqls(self):
"This function extracts sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
return [] | This function extracts sqls.
Returns:
A list of :class:`SQL`. For example:
[SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')] | sqlextractor/SqlExtractor.py | get_sqls | StefanLim0/mysql-er | 8 | python | def get_sqls(self):
"This function extracts sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
return [] | def get_sqls(self):
"This function extracts sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
return []<|docstring|>This function extracts sqls.
Returns:
A ... |
c028352f37e2bba15bd4fbfb7a9d2df3bca1753916065046e6976f4601555a14 | def __init__(self, path):
'Constructor.\n\n Args:\n path (str): File path.\n\n '
self.path = path | Constructor.
Args:
path (str): File path. | sqlextractor/SqlExtractor.py | __init__ | StefanLim0/mysql-er | 8 | python | def __init__(self, path):
'Constructor.\n\n Args:\n path (str): File path.\n\n '
self.path = path | def __init__(self, path):
'Constructor.\n\n Args:\n path (str): File path.\n\n '
self.path = path<|docstring|>Constructor.
Args:
path (str): File path.<|endoftext|> |
d979a745fb91416d1a187917f22444cd65ea3a625b27af9cfad0ebf15c7f73e5 | def get_sqls(self):
"This function extracts sqls from the text file.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
with codecs.open(self.path, 'r', 'utf-8') as ... | This function extracts sqls from the text file.
Returns:
A list of :class:`SQL`. For example:
[SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')] | sqlextractor/SqlExtractor.py | get_sqls | StefanLim0/mysql-er | 8 | python | def get_sqls(self):
"This function extracts sqls from the text file.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
with codecs.open(self.path, 'r', 'utf-8') as f:... | def get_sqls(self):
"This function extracts sqls from the text file.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
with codecs.open(self.path, 'r', 'utf-8') as f:... |
b7dc386c3ee6ba99da9bcd79d38d2c201f95cef3d90c569c6131227b8f899684 | def __init__(self, dir, encoding='utf-8'):
'Constructor.\n\n Args:\n dir (str): directory path.\n\n Kwargs:\n encoding (str): file encoding type, e.g., *utf-8*\n\n '
self.dir = dir
self.encoding = encoding | Constructor.
Args:
dir (str): directory path.
Kwargs:
encoding (str): file encoding type, e.g., *utf-8* | sqlextractor/SqlExtractor.py | __init__ | StefanLim0/mysql-er | 8 | python | def __init__(self, dir, encoding='utf-8'):
'Constructor.\n\n Args:\n dir (str): directory path.\n\n Kwargs:\n encoding (str): file encoding type, e.g., *utf-8*\n\n '
self.dir = dir
self.encoding = encoding | def __init__(self, dir, encoding='utf-8'):
'Constructor.\n\n Args:\n dir (str): directory path.\n\n Kwargs:\n encoding (str): file encoding type, e.g., *utf-8*\n\n '
self.dir = dir
self.encoding = encoding<|docstring|>Constructor.
Args:
dir (str): directory path.... |
8da4aa55ca039fd48b51d8c08c8d9c33038bd80679cde6238f6688443bb01566 | def get_sqls(self):
"This function extracts sqls from the java files with mybatis sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
sqls = []
for (root, d... | This function extracts sqls from the java files with mybatis sqls.
Returns:
A list of :class:`SQL`. For example:
[SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')] | sqlextractor/SqlExtractor.py | get_sqls | StefanLim0/mysql-er | 8 | python | def get_sqls(self):
"This function extracts sqls from the java files with mybatis sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
sqls = []
for (root, dir... | def get_sqls(self):
"This function extracts sqls from the java files with mybatis sqls.\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
sqls = []
for (root, dir... |
2aea7a148ca596e961fa4be4c2dc0b2e4d329194b63ba7bf3b52c2b449e9976a | def __init__(self, log_path):
'Constructor.\n\n Args:\n log_path (str): mysql general log file path.\n\n '
self.log_path = log_path | Constructor.
Args:
log_path (str): mysql general log file path. | sqlextractor/SqlExtractor.py | __init__ | StefanLim0/mysql-er | 8 | python | def __init__(self, log_path):
'Constructor.\n\n Args:\n log_path (str): mysql general log file path.\n\n '
self.log_path = log_path | def __init__(self, log_path):
'Constructor.\n\n Args:\n log_path (str): mysql general log file path.\n\n '
self.log_path = log_path<|docstring|>Constructor.
Args:
log_path (str): mysql general log file path.<|endoftext|> |
36bba749ea01bb8ad83a6b2a066f0464464a507d917115cfc762e10c0ef88291 | def get_sqls(self):
"This function extracts sqls from mysql general log file.\n\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
general_log = open(self.log_path)
... | This function extracts sqls from mysql general log file.
Returns:
A list of :class:`SQL`. For example:
[SQL('', u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')] | sqlextractor/SqlExtractor.py | get_sqls | StefanLim0/mysql-er | 8 | python | def get_sqls(self):
"This function extracts sqls from mysql general log file.\n\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
general_log = open(self.log_path)
... | def get_sqls(self):
"This function extracts sqls from mysql general log file.\n\n\n Returns:\n A list of :class:`SQL`. For example:\n [SQL(, u'select a.id, b.name from db.ac a join db.bc b on a.id=b.id or a.id=b.iid where a.cnt > 10')]\n\n "
general_log = open(self.log_path)
... |
096fb0ed7032c759166ab34b21f9b6a4fc3f8ac12c3864efab7203a7b478af6d | def is_anagram(s, t):
'\n Using an hash table, no sorting necessary. We iterate on the the two\n strings only, the time complexity is 2N -> N, but you need memory for\n the hash table.\n\n Returns true or false\n '
ht = {}
if ((s is None) or (t is None) or (len(s) != len(t))):... | Using an hash table, no sorting necessary. We iterate on the the two
strings only, the time complexity is 2N -> N, but you need memory for
the hash table.
Returns true or false | anagram.py | is_anagram | gl051/unit-test-demo | 0 | python | def is_anagram(s, t):
'\n Using an hash table, no sorting necessary. We iterate on the the two\n strings only, the time complexity is 2N -> N, but you need memory for\n the hash table.\n\n Returns true or false\n '
ht = {}
if ((s is None) or (t is None) or (len(s) != len(t))):... | def is_anagram(s, t):
'\n Using an hash table, no sorting necessary. We iterate on the the two\n strings only, the time complexity is 2N -> N, but you need memory for\n the hash table.\n\n Returns true or false\n '
ht = {}
if ((s is None) or (t is None) or (len(s) != len(t))):... |
fcaef34e9cb398667e48bb9e9b562a447737a37f141e3ca0d96f6c701e7381b2 | def __init__(self):
'Classify Tool'
self.label = '3 Finding Centers and Classification Tool'
self.description = 'Find Centers and Classify for HiSpatialCluster.'
self.canRunInBackground = True
self.cntr_addr = ''
self.cls_addr = '' | Classify Tool | tool_clswithcntr.py | __init__ | lopp2005/HiSpatialCluster | 32 | python | def __init__(self):
self.label = '3 Finding Centers and Classification Tool'
self.description = 'Find Centers and Classify for HiSpatialCluster.'
self.canRunInBackground = True
self.cntr_addr =
self.cls_addr = | def __init__(self):
self.label = '3 Finding Centers and Classification Tool'
self.description = 'Find Centers and Classify for HiSpatialCluster.'
self.canRunInBackground = True
self.cntr_addr =
self.cls_addr = <|docstring|>Classify Tool<|endoftext|> |
97b0c2cb0daaa2403efd6de0ee18d58e98d0a01affb71894c1720006df19a844 | def getParameterInfo(self):
'Define parameter definitions'
paraminput = Parameter(displayName='Input Points', name='in_points', datatype='DEFeatureClass', parameterType='Required', direction='Input')
paraminput.filter.list = ['Point']
paramidfield = Parameter(displayName='Identifier Field', name='id_fie... | Define parameter definitions | tool_clswithcntr.py | getParameterInfo | lopp2005/HiSpatialCluster | 32 | python | def getParameterInfo(self):
paraminput = Parameter(displayName='Input Points', name='in_points', datatype='DEFeatureClass', parameterType='Required', direction='Input')
paraminput.filter.list = ['Point']
paramidfield = Parameter(displayName='Identifier Field', name='id_field', datatype='Field', paramet... | def getParameterInfo(self):
paraminput = Parameter(displayName='Input Points', name='in_points', datatype='DEFeatureClass', parameterType='Required', direction='Input')
paraminput.filter.list = ['Point']
paramidfield = Parameter(displayName='Identifier Field', name='id_field', datatype='Field', paramet... |
043c2ac87cf9983ea4de3170b83baf58675c6dff59b3a0d7b1ea99b75cbba825 | def register_plugin(collectd):
'Bind plugin hooks to collectd and viceversa'
config = Config.instance()
log_handler = CollectdLogHandler(collectd=collectd, config=config)
ROOT_LOGGER.addHandler(log_handler)
ROOT_LOGGER.setLevel(logging.DEBUG)
instance = Plugin(collectd=collectd, config=config)
... | Bind plugin hooks to collectd and viceversa | collectd_openstack/gnocchi/plugin.py | register_plugin | ChameleonCloud/collectd-ceilometer-plugin | 0 | python | def register_plugin(collectd):
config = Config.instance()
log_handler = CollectdLogHandler(collectd=collectd, config=config)
ROOT_LOGGER.addHandler(log_handler)
ROOT_LOGGER.setLevel(logging.DEBUG)
instance = Plugin(collectd=collectd, config=config)
collectd.register_init(instance.init)
... | def register_plugin(collectd):
config = Config.instance()
log_handler = CollectdLogHandler(collectd=collectd, config=config)
ROOT_LOGGER.addHandler(log_handler)
ROOT_LOGGER.setLevel(logging.DEBUG)
instance = Plugin(collectd=collectd, config=config)
collectd.register_init(instance.init)
... |
e12f29709a7d9c396fa055ca6d682fc8bbb38b37ce1f33b38178e9db90446b66 | def config(self, cfg):
'Configuration callback\n\n @param cfg configuration node provided by collectd\n '
self._config.read(cfg) | Configuration callback
@param cfg configuration node provided by collectd | collectd_openstack/gnocchi/plugin.py | config | ChameleonCloud/collectd-ceilometer-plugin | 0 | python | def config(self, cfg):
'Configuration callback\n\n @param cfg configuration node provided by collectd\n '
self._config.read(cfg) | def config(self, cfg):
'Configuration callback\n\n @param cfg configuration node provided by collectd\n '
self._config.read(cfg)<|docstring|>Configuration callback
@param cfg configuration node provided by collectd<|endoftext|> |
84e9d0dc7c4c164bdc290cf4aa9ea1a9e73c2a8e41d3342dbe45ae4a860d6604 | def init(self):
'Initialization callback'
collectd.info('Initializing the collectd OpenStack python plugin')
self._meters = MeterStorage(collectd=collectd) | Initialization callback | collectd_openstack/gnocchi/plugin.py | init | ChameleonCloud/collectd-ceilometer-plugin | 0 | python | def init(self):
collectd.info('Initializing the collectd OpenStack python plugin')
self._meters = MeterStorage(collectd=collectd) | def init(self):
collectd.info('Initializing the collectd OpenStack python plugin')
self._meters = MeterStorage(collectd=collectd)<|docstring|>Initialization callback<|endoftext|> |
d39787e409874eef359b04a3cdcd7c767c7bc2eaadc99fbffa0503da21eb89f1 | def write(self, vl, data=None):
'Collectd write callback'
self._writer.write(vl, data) | Collectd write callback | collectd_openstack/gnocchi/plugin.py | write | ChameleonCloud/collectd-ceilometer-plugin | 0 | python | def write(self, vl, data=None):
self._writer.write(vl, data) | def write(self, vl, data=None):
self._writer.write(vl, data)<|docstring|>Collectd write callback<|endoftext|> |
573f2fda9b657da9b9ca2eb28904508e9f3558e9bd2fcb67f6d14e10a5b99658 | def shutdown(self):
'Shutdown callback'
LOGGER.info('SHUTDOWN')
self._writer.flush() | Shutdown callback | collectd_openstack/gnocchi/plugin.py | shutdown | ChameleonCloud/collectd-ceilometer-plugin | 0 | python | def shutdown(self):
LOGGER.info('SHUTDOWN')
self._writer.flush() | def shutdown(self):
LOGGER.info('SHUTDOWN')
self._writer.flush()<|docstring|>Shutdown callback<|endoftext|> |
14406d859f77d4961dfdc2c8025081debf8e5c42ed4d0a5f266949de247ebed6 | def filter_away_extreme_slopes(input_data, slope_col, max_slope, filter_width=0):
'\n Filter away everywhere where slope is over max_slope, plus surrounding entries\n :type input_data: numpy.ndarray\n :type slope_col: int or slice or list[int]\n :type max_slope: float\n :type filter_width: int\n :... | Filter away everywhere where slope is over max_slope, plus surrounding entries
:type input_data: numpy.ndarray
:type slope_col: int or slice or list[int]
:type max_slope: float
:type filter_width: int
:return: | ModelPredictiveControl/prune_output_matrices.py | filter_away_extreme_slopes | EWannerberg/AutomaticHeuristicGeneration | 0 | python | def filter_away_extreme_slopes(input_data, slope_col, max_slope, filter_width=0):
'\n Filter away everywhere where slope is over max_slope, plus surrounding entries\n :type input_data: numpy.ndarray\n :type slope_col: int or slice or list[int]\n :type max_slope: float\n :type filter_width: int\n :... | def filter_away_extreme_slopes(input_data, slope_col, max_slope, filter_width=0):
'\n Filter away everywhere where slope is over max_slope, plus surrounding entries\n :type input_data: numpy.ndarray\n :type slope_col: int or slice or list[int]\n :type max_slope: float\n :type filter_width: int\n :... |
efe4de9c8c58bbfc92baeea323f6336ea02164075b2e33e2b8ba054788749f7f | @callback
def _create_abort_data(flow_id: str, handler: str, reason: str, description_placeholders: Optional[Dict]=None) -> Dict[(str, Any)]:
'Return the definition of an external step for the user to take.'
return {'type': RESULT_TYPE_ABORT, 'flow_id': flow_id, 'handler': handler, 'reason': reason, 'descriptio... | Return the definition of an external step for the user to take. | homeassistant/data_entry_flow.py | _create_abort_data | mockersf/home-assistant | 23 | python | @callback
def _create_abort_data(flow_id: str, handler: str, reason: str, description_placeholders: Optional[Dict]=None) -> Dict[(str, Any)]:
return {'type': RESULT_TYPE_ABORT, 'flow_id': flow_id, 'handler': handler, 'reason': reason, 'description_placeholders': description_placeholders} | @callback
def _create_abort_data(flow_id: str, handler: str, reason: str, description_placeholders: Optional[Dict]=None) -> Dict[(str, Any)]:
return {'type': RESULT_TYPE_ABORT, 'flow_id': flow_id, 'handler': handler, 'reason': reason, 'description_placeholders': description_placeholders}<|docstring|>Return the... |
fc6b1bf0892aa1de70b4e7486dcd26f7a730dd8c2a9e6c821918bb7a89ab3cbe | def __init__(self, reason: str, description_placeholders: Optional[Dict]=None):
'Initialize an abort flow exception.'
super().__init__(f'Flow aborted: {reason}')
self.reason = reason
self.description_placeholders = description_placeholders | Initialize an abort flow exception. | homeassistant/data_entry_flow.py | __init__ | mockersf/home-assistant | 23 | python | def __init__(self, reason: str, description_placeholders: Optional[Dict]=None):
super().__init__(f'Flow aborted: {reason}')
self.reason = reason
self.description_placeholders = description_placeholders | def __init__(self, reason: str, description_placeholders: Optional[Dict]=None):
super().__init__(f'Flow aborted: {reason}')
self.reason = reason
self.description_placeholders = description_placeholders<|docstring|>Initialize an abort flow exception.<|endoftext|> |
9fa342b976bcca5bde7d7a03c3fbd2e817f5c0e8b9ea76a98b4830b021471f85 | def __init__(self, hass: HomeAssistant, async_create_flow: Callable, async_finish_flow: Callable) -> None:
'Initialize the flow manager.'
self.hass = hass
self._progress: Dict[(str, Any)] = {}
self._async_create_flow = async_create_flow
self._async_finish_flow = async_finish_flow | Initialize the flow manager. | homeassistant/data_entry_flow.py | __init__ | mockersf/home-assistant | 23 | python | def __init__(self, hass: HomeAssistant, async_create_flow: Callable, async_finish_flow: Callable) -> None:
self.hass = hass
self._progress: Dict[(str, Any)] = {}
self._async_create_flow = async_create_flow
self._async_finish_flow = async_finish_flow | def __init__(self, hass: HomeAssistant, async_create_flow: Callable, async_finish_flow: Callable) -> None:
self.hass = hass
self._progress: Dict[(str, Any)] = {}
self._async_create_flow = async_create_flow
self._async_finish_flow = async_finish_flow<|docstring|>Initialize the flow manager.<|endofte... |
9838b985c459dfaaf8b3cededca4aee3fe0375adceb88b2296ea23994591dbff | @callback
def async_progress(self) -> List[Dict]:
'Return the flows in progress.'
return [{'flow_id': flow.flow_id, 'handler': flow.handler, 'context': flow.context} for flow in self._progress.values()] | Return the flows in progress. | homeassistant/data_entry_flow.py | async_progress | mockersf/home-assistant | 23 | python | @callback
def async_progress(self) -> List[Dict]:
return [{'flow_id': flow.flow_id, 'handler': flow.handler, 'context': flow.context} for flow in self._progress.values()] | @callback
def async_progress(self) -> List[Dict]:
return [{'flow_id': flow.flow_id, 'handler': flow.handler, 'context': flow.context} for flow in self._progress.values()]<|docstring|>Return the flows in progress.<|endoftext|> |
d6a8b9ae828d7ed515ae538919630ca8ad84098b63cc8e8c0dc5ce78e328305f | async def async_init(self, handler: str, *, context: Optional[Dict]=None, data: Any=None) -> Any:
'Start a configuration flow.'
if (context is None):
context = {}
flow = (await self._async_create_flow(handler, context=context, data=data))
flow.hass = self.hass
flow.handler = handler
flow... | Start a configuration flow. | homeassistant/data_entry_flow.py | async_init | mockersf/home-assistant | 23 | python | async def async_init(self, handler: str, *, context: Optional[Dict]=None, data: Any=None) -> Any:
if (context is None):
context = {}
flow = (await self._async_create_flow(handler, context=context, data=data))
flow.hass = self.hass
flow.handler = handler
flow.flow_id = uuid.uuid4().hex
... | async def async_init(self, handler: str, *, context: Optional[Dict]=None, data: Any=None) -> Any:
if (context is None):
context = {}
flow = (await self._async_create_flow(handler, context=context, data=data))
flow.hass = self.hass
flow.handler = handler
flow.flow_id = uuid.uuid4().hex
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.