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 |
|---|---|---|---|---|---|---|---|---|---|
f41efd5ee87e3064155e1f3dc1f32a0d45ae8e06951f7312b7dec1af73f03664 | def proportional_char(self, action):
'Specifies proportional characters. When turned on, the character spacing set\n with charSpacing.\n\n Args:\n action: Turn proportional characters on or off.\n Returns:\n None\n Raises:\n RuntimeError: Invalid action.\... | Specifies proportional characters. When turned on, the character spacing set
with charSpacing.
Args:
action: Turn proportional characters on or off.
Returns:
None
Raises:
RuntimeError: Invalid action. | brotherprint/brotherprint.py | proportional_char | HSRNetwork/python-brotherprint | 0 | python | def proportional_char(self, action):
'Specifies proportional characters. When turned on, the character spacing set\n with charSpacing.\n\n Args:\n action: Turn proportional characters on or off.\n Returns:\n None\n Raises:\n RuntimeError: Invalid action.\... | def proportional_char(self, action):
'Specifies proportional characters. When turned on, the character spacing set\n with charSpacing.\n\n Args:\n action: Turn proportional characters on or off.\n Returns:\n None\n Raises:\n RuntimeError: Invalid action.\... |
00df59cea282abda81d732987dfbf3313a54cb5dd65f33b8ef1c34df3822611e | def char_spacing(self, dots):
'Specifes character spacing in dots.\n\n Args:\n dots: the character spacing you desire, in dots\n Returns:\n None\n Raises:\n RuntimeError: Invalid dot amount.\n '
if (dots in range(0, 127)):
self.send(((chr(27) ... | Specifes character spacing in dots.
Args:
dots: the character spacing you desire, in dots
Returns:
None
Raises:
RuntimeError: Invalid dot amount. | brotherprint/brotherprint.py | char_spacing | HSRNetwork/python-brotherprint | 0 | python | def char_spacing(self, dots):
'Specifes character spacing in dots.\n\n Args:\n dots: the character spacing you desire, in dots\n Returns:\n None\n Raises:\n RuntimeError: Invalid dot amount.\n '
if (dots in range(0, 127)):
self.send(((chr(27) ... | def char_spacing(self, dots):
'Specifes character spacing in dots.\n\n Args:\n dots: the character spacing you desire, in dots\n Returns:\n None\n Raises:\n RuntimeError: Invalid dot amount.\n '
if (dots in range(0, 127)):
self.send(((chr(27) ... |
77bd3e1404219d6ce852ce0a5a57f26700511b8c983ef42df785b62ec641861d | def barcode(self, data, format, characters='off', height=48, width='small', parentheses='on', ratio='3:1', equalize='off', rss_symbol='rss14std', horiz_char_rss=2):
"Print a standard barcode in the specified format\n\n Args:\n data: the barcode data\n format: the barcode type you want. ... | Print a standard barcode in the specified format
Args:
data: the barcode data
format: the barcode type you want. Choose between code39, itf, ean8/upca, upce, codabar, code128, gs1-128, rss
characters: Whether you want characters below the bar code. 'off' or 'on'
height: Height, in dots.
width: widt... | brotherprint/brotherprint.py | barcode | HSRNetwork/python-brotherprint | 0 | python | def barcode(self, data, format, characters='off', height=48, width='small', parentheses='on', ratio='3:1', equalize='off', rss_symbol='rss14std', horiz_char_rss=2):
"Print a standard barcode in the specified format\n\n Args:\n data: the barcode data\n format: the barcode type you want. ... | def barcode(self, data, format, characters='off', height=48, width='small', parentheses='on', ratio='3:1', equalize='off', rss_symbol='rss14std', horiz_char_rss=2):
"Print a standard barcode in the specified format\n\n Args:\n data: the barcode data\n format: the barcode type you want. ... |
09e9be3f2001a0109e909db2cea01ef4a6b6a53f76758eb29c5886bfb97b0f8f | def template_print(self):
'Print the page\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send('^FF') | Print the page
Args:
None
Returns:
None
Raises:
None | brotherprint/brotherprint.py | template_print | HSRNetwork/python-brotherprint | 0 | python | def template_print(self):
'Print the page\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send('^FF') | def template_print(self):
'Print the page\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send('^FF')<|docstring|>Print the page
Args:
None
Returns:
None
Raises:
None<|endoftext|> |
7ff567a98e97bf49a781780316fc01e4fe3cf297fd518f314a5260964d1403b2 | def choose_template(self, template):
'Choose a template\n\n Args:\n template: String, choose which template you would like.\n Returns:\n None\n Raises:\n None\n '
self.send('^TS0{:02d}'.format(int(template))) | Choose a template
Args:
template: String, choose which template you would like.
Returns:
None
Raises:
None | brotherprint/brotherprint.py | choose_template | HSRNetwork/python-brotherprint | 0 | python | def choose_template(self, template):
'Choose a template\n\n Args:\n template: String, choose which template you would like.\n Returns:\n None\n Raises:\n None\n '
self.send('^TS0{:02d}'.format(int(template))) | def choose_template(self, template):
'Choose a template\n\n Args:\n template: String, choose which template you would like.\n Returns:\n None\n Raises:\n None\n '
self.send('^TS0{:02d}'.format(int(template)))<|docstring|>Choose a template
Args:
t... |
9fe27ec1807769be8b76e8ceec5148e397ad98848948114af06e32704ae16755 | def machine_op(self, operation):
'Perform machine operations\n\n Args:\n operations: which operation you would like\n Returns:\n None\n Raises:\n RuntimeError: Invalid operation\n '
operations = {'feed2start': 1, 'feedone': 2, 'cut': 3}
if (operat... | Perform machine operations
Args:
operations: which operation you would like
Returns:
None
Raises:
RuntimeError: Invalid operation | brotherprint/brotherprint.py | machine_op | HSRNetwork/python-brotherprint | 0 | python | def machine_op(self, operation):
'Perform machine operations\n\n Args:\n operations: which operation you would like\n Returns:\n None\n Raises:\n RuntimeError: Invalid operation\n '
operations = {'feed2start': 1, 'feedone': 2, 'cut': 3}
if (operat... | def machine_op(self, operation):
'Perform machine operations\n\n Args:\n operations: which operation you would like\n Returns:\n None\n Raises:\n RuntimeError: Invalid operation\n '
operations = {'feed2start': 1, 'feedone': 2, 'cut': 3}
if (operat... |
a1afa129c2e6869b1c41e05428e8945e40f2f1c5a325dc23226bcef657ea6519 | def template_init(self):
'Initialize command for template mode\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send(((chr(94) + chr(73)) + chr(73))) | Initialize command for template mode
Args:
None
Returns:
None
Raises:
None | brotherprint/brotherprint.py | template_init | HSRNetwork/python-brotherprint | 0 | python | def template_init(self):
'Initialize command for template mode\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send(((chr(94) + chr(73)) + chr(73))) | def template_init(self):
'Initialize command for template mode\n\n Args:\n None\n Returns:\n None\n Raises:\n None\n '
self.send(((chr(94) + chr(73)) + chr(73)))<|docstring|>Initialize command for template mode
Args:
None
Returns:
None
Raises... |
00159242ed23e8b402214e110ba80db936469759187d9eab0c5a848a47af64fe | def print_start_trigger(self, type):
'Set print start trigger.\n\n Args:\n type: The type of trigger you desire.\n Returns:\n None\n Raises:\n RuntimeError: Invalid type.\n '
types = {'recieved': 1, 'filled': 2, 'num_recieved': 3}
if (type in type... | Set print start trigger.
Args:
type: The type of trigger you desire.
Returns:
None
Raises:
RuntimeError: Invalid type. | brotherprint/brotherprint.py | print_start_trigger | HSRNetwork/python-brotherprint | 0 | python | def print_start_trigger(self, type):
'Set print start trigger.\n\n Args:\n type: The type of trigger you desire.\n Returns:\n None\n Raises:\n RuntimeError: Invalid type.\n '
types = {'recieved': 1, 'filled': 2, 'num_recieved': 3}
if (type in type... | def print_start_trigger(self, type):
'Set print start trigger.\n\n Args:\n type: The type of trigger you desire.\n Returns:\n None\n Raises:\n RuntimeError: Invalid type.\n '
types = {'recieved': 1, 'filled': 2, 'num_recieved': 3}
if (type in type... |
6190b23f1c46f939c92ef72e70974a24dc9548fbcfb60b633432081a2c1caa1a | def print_start_command(self, command):
'Set print command\n\n Args:\n command: the type of command you desire.\n Returns:\n None\n Raises:\n RuntimeError: Command too long.\n '
size = len(command)
if (size > 20):
raise RuntimeError('Comma... | Set print command
Args:
command: the type of command you desire.
Returns:
None
Raises:
RuntimeError: Command too long. | brotherprint/brotherprint.py | print_start_command | HSRNetwork/python-brotherprint | 0 | python | def print_start_command(self, command):
'Set print command\n\n Args:\n command: the type of command you desire.\n Returns:\n None\n Raises:\n RuntimeError: Command too long.\n '
size = len(command)
if (size > 20):
raise RuntimeError('Comma... | def print_start_command(self, command):
'Set print command\n\n Args:\n command: the type of command you desire.\n Returns:\n None\n Raises:\n RuntimeError: Command too long.\n '
size = len(command)
if (size > 20):
raise RuntimeError('Comma... |
ac464a77eceb6f920ff8f25e8f2e8749654f3f0b7424fe18af8d7a73506e723d | def received_char_count(self, count):
'Set recieved char count limit\n\n Args:\n count: the amount of received characters you want to stop at.\n Returns:\n None\n Raises:\n None\n '
n1 = (count // 100)
n2 = ((count - (n1 * 100)) // 10)
n3 = (c... | Set recieved char count limit
Args:
count: the amount of received characters you want to stop at.
Returns:
None
Raises:
None | brotherprint/brotherprint.py | received_char_count | HSRNetwork/python-brotherprint | 0 | python | def received_char_count(self, count):
'Set recieved char count limit\n\n Args:\n count: the amount of received characters you want to stop at.\n Returns:\n None\n Raises:\n None\n '
n1 = (count // 100)
n2 = ((count - (n1 * 100)) // 10)
n3 = (c... | def received_char_count(self, count):
'Set recieved char count limit\n\n Args:\n count: the amount of received characters you want to stop at.\n Returns:\n None\n Raises:\n None\n '
n1 = (count // 100)
n2 = ((count - (n1 * 100)) // 10)
n3 = (c... |
ef1abac62320bc7f8fd1f26916b4dd02c0bf3f880ead5bc6a26f588c6f5283d8 | def select_delim(self, delim):
'Select desired delimeter\n\n Args:\n delim: The delimeter character you want.\n Returns:\n None\n Raises:\n RuntimeError: Delimeter too long.\n '
size = len(delim)
if (size > 20):
raise RuntimeError('Delimet... | Select desired delimeter
Args:
delim: The delimeter character you want.
Returns:
None
Raises:
RuntimeError: Delimeter too long. | brotherprint/brotherprint.py | select_delim | HSRNetwork/python-brotherprint | 0 | python | def select_delim(self, delim):
'Select desired delimeter\n\n Args:\n delim: The delimeter character you want.\n Returns:\n None\n Raises:\n RuntimeError: Delimeter too long.\n '
size = len(delim)
if (size > 20):
raise RuntimeError('Delimet... | def select_delim(self, delim):
'Select desired delimeter\n\n Args:\n delim: The delimeter character you want.\n Returns:\n None\n Raises:\n RuntimeError: Delimeter too long.\n '
size = len(delim)
if (size > 20):
raise RuntimeError('Delimet... |
3647e443017e834ec757ccfdd5ae5adff7472fdc5e9c353e41ac59ea3110750d | def select_obj_by_name(self, name):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send((('^ON' + name) + chr(0))) | Select an object
Args:
name: the name of the object you want to select
Returns:
None
Raises:
None | brotherprint/brotherprint.py | select_obj_by_name | HSRNetwork/python-brotherprint | 0 | python | def select_obj_by_name(self, name):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send((('^ON' + name) + chr(0))) | def select_obj_by_name(self, name):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send((('^ON' + name) + chr(0)))<|docstring|>Select an object
Args:
name: the name of the... |
4acb6ce5d9800df8ee85a5fe57c1c00dd49459caff64b0608bda9f6b50eb9d1b | def select_obj_by_id(self, id):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send(('^OS' + id)) | Select an object
Args:
name: the name of the object you want to select
Returns:
None
Raises:
None | brotherprint/brotherprint.py | select_obj_by_id | HSRNetwork/python-brotherprint | 0 | python | def select_obj_by_id(self, id):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send(('^OS' + id)) | def select_obj_by_id(self, id):
'Select an object\n\n Args:\n name: the name of the object you want to select\n Returns:\n None\n Raises:\n None\n '
self.send(('^OS' + id))<|docstring|>Select an object
Args:
name: the name of the object you want ... |
4fe16c1b7a52509b7766bbce6e5dfa9133ca113c5afeaed45337169e5f0e319a | def insert_into_obj(self, data):
'Insert text into selected object.\n\n Args:\n data: The data you want to insert.\n Returns:\n None\n Raises:\n None\n '
if (not data):
data = ''
if isinstance(data, six.text_type):
data = data.enco... | Insert text into selected object.
Args:
data: The data you want to insert.
Returns:
None
Raises:
None | brotherprint/brotherprint.py | insert_into_obj | HSRNetwork/python-brotherprint | 0 | python | def insert_into_obj(self, data):
'Insert text into selected object.\n\n Args:\n data: The data you want to insert.\n Returns:\n None\n Raises:\n None\n '
if (not data):
data =
if isinstance(data, six.text_type):
data = data.encode... | def insert_into_obj(self, data):
'Insert text into selected object.\n\n Args:\n data: The data you want to insert.\n Returns:\n None\n Raises:\n None\n '
if (not data):
data =
if isinstance(data, six.text_type):
data = data.encode... |
765f0d4926db5089eaf6d9bf0dd6ef4dda88ca8f4c38e2a466d4990827b8e387 | def select_name_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n name: the name of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... | Combines selection and data insertion into one function
Args:
name: the name of the object you want to insert into
data: the data you want to insert
Returns:
None
Raises:
None | brotherprint/brotherprint.py | select_name_and_insert | HSRNetwork/python-brotherprint | 0 | python | def select_name_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n name: the name of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... | def select_name_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n name: the name of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... |
f96ae510a9d45464226ae2fdbcd43ea66134ae1346dffa8f8850c2e07e9edfc9 | def select_id_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n id: the starting id of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... | Combines selection and data insertion into one function
Args:
id: the starting id of the object you want to insert into
data: the data you want to insert
Returns:
None
Raises:
None | brotherprint/brotherprint.py | select_id_and_insert | HSRNetwork/python-brotherprint | 0 | python | def select_id_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n id: the starting id of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... | def select_id_and_insert(self, id, data):
'Combines selection and data insertion into one function\n\n Args:\n id: the starting id of the object you want to insert into\n data: the data you want to insert\n Returns:\n None\n Raises:\n None\n '
... |
643632e545ed2b0baed9bdc89f5e4033ddf9574e6cafdb02985bc4caf13de4b8 | def reset_cutter(self):
'Sets the cutter to the default, which is to cut after every label\n\n Returns:\n None\n '
auto_cut = '1'
auto_cut_after_label_number = '01'
cut_at_end = '1'
self.send(((('^CO' + auto_cut) + auto_cut_after_label_number) + cut_at_end)) | Sets the cutter to the default, which is to cut after every label
Returns:
None | brotherprint/brotherprint.py | reset_cutter | HSRNetwork/python-brotherprint | 0 | python | def reset_cutter(self):
'Sets the cutter to the default, which is to cut after every label\n\n Returns:\n None\n '
auto_cut = '1'
auto_cut_after_label_number = '01'
cut_at_end = '1'
self.send(((('^CO' + auto_cut) + auto_cut_after_label_number) + cut_at_end)) | def reset_cutter(self):
'Sets the cutter to the default, which is to cut after every label\n\n Returns:\n None\n '
auto_cut = '1'
auto_cut_after_label_number = '01'
cut_at_end = '1'
self.send(((('^CO' + auto_cut) + auto_cut_after_label_number) + cut_at_end))<|docstring|>Sets... |
77ffbcb978a8a1b1b354fbadc30fdf20022a51544f063f578435002fd4b8d2db | def set_number_of_copies(self, copies):
'Set the number of copies. Number must be between 1-999\n \n Args:\n Number of copies\n Returns:\n None\n Raises:\n RuntimeError: Invalid number\n '
try:
copies = int(copies)
except:
... | Set the number of copies. Number must be between 1-999
Args:
Number of copies
Returns:
None
Raises:
RuntimeError: Invalid number | brotherprint/brotherprint.py | set_number_of_copies | HSRNetwork/python-brotherprint | 0 | python | def set_number_of_copies(self, copies):
'Set the number of copies. Number must be between 1-999\n \n Args:\n Number of copies\n Returns:\n None\n Raises:\n RuntimeError: Invalid number\n '
try:
copies = int(copies)
except:
... | def set_number_of_copies(self, copies):
'Set the number of copies. Number must be between 1-999\n \n Args:\n Number of copies\n Returns:\n None\n Raises:\n RuntimeError: Invalid number\n '
try:
copies = int(copies)
except:
... |
9a09a3d7aa264bd859048e8dfa762bbb2ad99b895c71b3d57ed4426b09ad6459 | def select_priority_print_option(self, action):
' Default is 0 - Priority to print speed. Set to 1 for priority to print quality.\n Required for QL-720NW and barcodes.\n Args:\n action: on or off.\n Returns:\n None\n Raises:\n RuntimeError( on ... | Default is 0 - Priority to print speed. Set to 1 for priority to print quality.
Required for QL-720NW and barcodes.
Args:
action: on or off.
Returns:
None
Raises:
RuntimeError( on or off not selected) | brotherprint/brotherprint.py | select_priority_print_option | HSRNetwork/python-brotherprint | 0 | python | def select_priority_print_option(self, action):
' Default is 0 - Priority to print speed. Set to 1 for priority to print quality.\n Required for QL-720NW and barcodes.\n Args:\n action: on or off.\n Returns:\n None\n Raises:\n RuntimeError( on ... | def select_priority_print_option(self, action):
' Default is 0 - Priority to print speed. Set to 1 for priority to print quality.\n Required for QL-720NW and barcodes.\n Args:\n action: on or off.\n Returns:\n None\n Raises:\n RuntimeError( on ... |
0d4caafec1479f44f74261f19f50a9591ef67e0a36fb1b56a6cc891f2858af6e | def event_prop_invoker(self: Component, prop_name):
'Creates a function that invokes event handler stored in given property of given component.\n\n Resulting function reads property on every invocation, so it remains valid after the property is changed.\n\n :param self: component instance\n :param prop_nam... | Creates a function that invokes event handler stored in given property of given component.
Resulting function reads property on every invocation, so it remains valid after the property is changed.
:param self: component instance
:param prop_name: name of a property containing event handler
:return: the function, as d... | turbosnake/_utils.py | event_prop_invoker | AlexeyBond/turbosnake | 2 | python | def event_prop_invoker(self: Component, prop_name):
'Creates a function that invokes event handler stored in given property of given component.\n\n Resulting function reads property on every invocation, so it remains valid after the property is changed.\n\n :param self: component instance\n :param prop_nam... | def event_prop_invoker(self: Component, prop_name):
'Creates a function that invokes event handler stored in given property of given component.\n\n Resulting function reads property on every invocation, so it remains valid after the property is changed.\n\n :param self: component instance\n :param prop_nam... |
75e4bf620fedbf9acdc1830df56c836fdd07d0082d72059523b3a7c8edc57138 | def component(component_class: Type[Component]):
"Decorator that uses signature of decorated function to create a component inserter for given component type.\n\n Usage:\n\n @component(MyComponent)\n def my_component(*, prop1: int, prop2: Optional[str], prop3 = 'foo', **_):\n ...\n\n Purpose of t... | Decorator that uses signature of decorated function to create a component inserter for given component type.
Usage:
@component(MyComponent)
def my_component(*, prop1: int, prop2: Optional[str], prop3 = 'foo', **_):
...
Purpose of this decorator is to (unlike plain call of component_inserter)
- provide property ... | turbosnake/_utils.py | component | AlexeyBond/turbosnake | 2 | python | def component(component_class: Type[Component]):
"Decorator that uses signature of decorated function to create a component inserter for given component type.\n\n Usage:\n\n @component(MyComponent)\n def my_component(*, prop1: int, prop2: Optional[str], prop3 = 'foo', **_):\n ...\n\n Purpose of t... | def component(component_class: Type[Component]):
"Decorator that uses signature of decorated function to create a component inserter for given component type.\n\n Usage:\n\n @component(MyComponent)\n def my_component(*, prop1: int, prop2: Optional[str], prop3 = 'foo', **_):\n ...\n\n Purpose of t... |
d565a7caf06da613af40507c3c79936eab7d5ec977f018c088390dd0d6d30770 | def get_component_class(class_or_inserter: Union[(Callable, Type[Component])]):
'Returns component class for provided component inserter function.\n\n When component class is provided as first argument - returns it.\n '
if (isclass(class_or_inserter) and issubclass(class_or_inserter, Component)):
... | Returns component class for provided component inserter function.
When component class is provided as first argument - returns it. | turbosnake/_utils.py | get_component_class | AlexeyBond/turbosnake | 2 | python | def get_component_class(class_or_inserter: Union[(Callable, Type[Component])]):
'Returns component class for provided component inserter function.\n\n When component class is provided as first argument - returns it.\n '
if (isclass(class_or_inserter) and issubclass(class_or_inserter, Component)):
... | def get_component_class(class_or_inserter: Union[(Callable, Type[Component])]):
'Returns component class for provided component inserter function.\n\n When component class is provided as first argument - returns it.\n '
if (isclass(class_or_inserter) and issubclass(class_or_inserter, Component)):
... |
98f5043428eb9b9cbfcd1f3529f032196ecd8588a1b5ce8308c0f8fce8ea7231 | def get_organization_name(self, organization_access):
'\n Get field for Serializer Method.\n\n Add the organization name on organization accesses directly, to avoid nesting an\n additional object just for one string.\n '
return organization_access.organization.name | Get field for Serializer Method.
Add the organization name on organization accesses directly, to avoid nesting an
additional object just for one string. | src/backend/marsha/core/serializers/account.py | get_organization_name | marin-leonard/marsha | 64 | python | def get_organization_name(self, organization_access):
'\n Get field for Serializer Method.\n\n Add the organization name on organization accesses directly, to avoid nesting an\n additional object just for one string.\n '
return organization_access.organization.name | def get_organization_name(self, organization_access):
'\n Get field for Serializer Method.\n\n Add the organization name on organization accesses directly, to avoid nesting an\n additional object just for one string.\n '
return organization_access.organization.name<|docstring|>Get fi... |
2f4488c28eac188cca5514c51beca4964de8bf411ca7a563788ad74a612d2c04 | def forward_encoder(self, src_tokens, src_lengths, device_encoder, cls_input=None, return_all_hiddens=False, **unused):
"\n Args:\n src_tokens (LongTensor): tokens in the source language of shape\n `(batch, src_len)`\n src_lengths (torch.LongTensor): lengths of each source sentence of\n ... | Args:
src_tokens (LongTensor): tokens in the source language of shape
`(batch, src_len)`
src_lengths (torch.LongTensor): lengths of each source sentence of
shape `(batch)`
return_all_hiddens (bool, optional): also return all of the
intermediate hidden states (default: False).
Return... | models/bart_utils.py | forward_encoder | tanyuqian/progressive-generation | 69 | python | def forward_encoder(self, src_tokens, src_lengths, device_encoder, cls_input=None, return_all_hiddens=False, **unused):
"\n Args:\n src_tokens (LongTensor): tokens in the source language of shape\n `(batch, src_len)`\n src_lengths (torch.LongTensor): lengths of each source sentence of\n ... | def forward_encoder(self, src_tokens, src_lengths, device_encoder, cls_input=None, return_all_hiddens=False, **unused):
"\n Args:\n src_tokens (LongTensor): tokens in the source language of shape\n `(batch, src_len)`\n src_lengths (torch.LongTensor): lengths of each source sentence of\n ... |
f6f1f180f6baa23e14d1fc685802296837cc14ad988c064a7f9877ae0caf7014 | def forward_decoder(self, prev_output_tokens, device_decoder, encoder_out=None, incremental_state=None, features_only=False, **extra_args):
"\n Args:\n prev_output_tokens (LongTensor): previous decoder outputs of shape\n `(batch, tgt_len)`, for teacher forcing\n encoder_out (Tensor, opti... | Args:
prev_output_tokens (LongTensor): previous decoder outputs of shape
`(batch, tgt_len)`, for teacher forcing
encoder_out (Tensor, optional): output from the encoder, used for
encoder-side attention
incremental_state (dict): dictionary used for storing state during
:ref:`Increment... | models/bart_utils.py | forward_decoder | tanyuqian/progressive-generation | 69 | python | def forward_decoder(self, prev_output_tokens, device_decoder, encoder_out=None, incremental_state=None, features_only=False, **extra_args):
"\n Args:\n prev_output_tokens (LongTensor): previous decoder outputs of shape\n `(batch, tgt_len)`, for teacher forcing\n encoder_out (Tensor, opti... | def forward_decoder(self, prev_output_tokens, device_decoder, encoder_out=None, incremental_state=None, features_only=False, **extra_args):
"\n Args:\n prev_output_tokens (LongTensor): previous decoder outputs of shape\n `(batch, tgt_len)`, for teacher forcing\n encoder_out (Tensor, opti... |
ba8be0ba3290b79ac7c4546a740b0f323b105423c369b2d738671e4cb3062f24 | def predictions_process(model_loader, sample_decoder, prediction_decoder):
'Continuously query queue for new prediction jobs and execute them.'
model = model_loader()
while True:
batch_elements = db.lrange(PREDICTION_QUEUE, 0, (BATCH_SIZE - 1))
(batch, x_ids) = _build_batch(batch_elements, s... | Continuously query queue for new prediction jobs and execute them. | scooter/model_server.py | predictions_process | sorenlind/scooter | 0 | python | def predictions_process(model_loader, sample_decoder, prediction_decoder):
model = model_loader()
while True:
batch_elements = db.lrange(PREDICTION_QUEUE, 0, (BATCH_SIZE - 1))
(batch, x_ids) = _build_batch(batch_elements, sample_decoder)
if (not x_ids):
time.sleep(SERVER... | def predictions_process(model_loader, sample_decoder, prediction_decoder):
model = model_loader()
while True:
batch_elements = db.lrange(PREDICTION_QUEUE, 0, (BATCH_SIZE - 1))
(batch, x_ids) = _build_batch(batch_elements, sample_decoder)
if (not x_ids):
time.sleep(SERVER... |
52e3701c1e991203ce510dc10dd3ba21a70e4d687b5c9d03a47dac365de3cc28 | def setUp(self):
'\n Sets up the test fixture for the RTKDesignElectric class.\n '
engine = create_engine('sqlite:////tmp/TestDB.rtk', echo=False)
session = scoped_session(sessionmaker())
session.remove()
session.configure(bind=engine, autoflush=False, expire_on_commit=False)
self.... | Sets up the test fixture for the RTKDesignElectric class. | tests/_dao/TestRTKDesignElectric.py | setUp | rakhimov/rtk | 0 | python | def setUp(self):
'\n \n '
engine = create_engine('sqlite:////tmp/TestDB.rtk', echo=False)
session = scoped_session(sessionmaker())
session.remove()
session.configure(bind=engine, autoflush=False, expire_on_commit=False)
self.DUT = session.query(RTKDesignElectric).first()
self.D... | def setUp(self):
'\n \n '
engine = create_engine('sqlite:////tmp/TestDB.rtk', echo=False)
session = scoped_session(sessionmaker())
session.remove()
session.configure(bind=engine, autoflush=False, expire_on_commit=False)
self.DUT = session.query(RTKDesignElectric).first()
self.D... |
6e56665857a284041885f2dd44f8904680c0a3e460a08146516fc306a9773f33 | @attr(all=True, unit=True)
def test00_rtkdesignelectric_create(self):
'\n (TestRTKDesignElectric) __init__ should create an RTKDesignElectric model.\n '
self.assertTrue(isinstance(self.DUT, RTKDesignElectric))
self.assertEqual(self.DUT.__tablename__, 'rtk_design_electric')
self.assertEqual... | (TestRTKDesignElectric) __init__ should create an RTKDesignElectric model. | tests/_dao/TestRTKDesignElectric.py | test00_rtkdesignelectric_create | rakhimov/rtk | 0 | python | @attr(all=True, unit=True)
def test00_rtkdesignelectric_create(self):
'\n \n '
self.assertTrue(isinstance(self.DUT, RTKDesignElectric))
self.assertEqual(self.DUT.__tablename__, 'rtk_design_electric')
self.assertEqual(self.DUT.hardware_id, 1)
self.assertEqual(self.DUT.application_id, 0)... | @attr(all=True, unit=True)
def test00_rtkdesignelectric_create(self):
'\n \n '
self.assertTrue(isinstance(self.DUT, RTKDesignElectric))
self.assertEqual(self.DUT.__tablename__, 'rtk_design_electric')
self.assertEqual(self.DUT.hardware_id, 1)
self.assertEqual(self.DUT.application_id, 0)... |
1e69b0e30896d89c782f8b50cad1d2ca279ddb6c36a6d09c3b422024809a0fe2 | @attr(all=True, unit=True)
def test01_get_attributes(self):
'\n (TestRTKDesignElectric) get_attributes should return a tuple of attribute values.\n '
self.assertEqual(self.DUT.get_attributes(), self._attributes) | (TestRTKDesignElectric) get_attributes should return a tuple of attribute values. | tests/_dao/TestRTKDesignElectric.py | test01_get_attributes | rakhimov/rtk | 0 | python | @attr(all=True, unit=True)
def test01_get_attributes(self):
'\n \n '
self.assertEqual(self.DUT.get_attributes(), self._attributes) | @attr(all=True, unit=True)
def test01_get_attributes(self):
'\n \n '
self.assertEqual(self.DUT.get_attributes(), self._attributes)<|docstring|>(TestRTKDesignElectric) get_attributes should return a tuple of attribute values.<|endoftext|> |
c94c328e9fa94a3e6c00a640e08a14bf960c127976adae741907501ca861b329 | @attr(all=True, unit=True)
def test02a_set_attributes(self):
'\n (TestRTKDesignElectric) set_attributes should return a zero error code on success\n '
(_error_code, _msg) = self.DUT.set_attributes(self._attributes)
self.assertEqual(_error_code, 0)
self.assertEqual(_msg, 'RTK SUCCESS: Updat... | (TestRTKDesignElectric) set_attributes should return a zero error code on success | tests/_dao/TestRTKDesignElectric.py | test02a_set_attributes | rakhimov/rtk | 0 | python | @attr(all=True, unit=True)
def test02a_set_attributes(self):
'\n \n '
(_error_code, _msg) = self.DUT.set_attributes(self._attributes)
self.assertEqual(_error_code, 0)
self.assertEqual(_msg, 'RTK SUCCESS: Updating RTKDesignElectric {0:d} attributes.'.format(self.DUT.hardware_id)) | @attr(all=True, unit=True)
def test02a_set_attributes(self):
'\n \n '
(_error_code, _msg) = self.DUT.set_attributes(self._attributes)
self.assertEqual(_error_code, 0)
self.assertEqual(_msg, 'RTK SUCCESS: Updating RTKDesignElectric {0:d} attributes.'.format(self.DUT.hardware_id))<|docstring... |
ee87b8efae09d4deb762023870ce1aa4e8411c0c4a3f2037c6985d09bc3d60a5 | @attr(all=True, unit=True)
def test02b_set_attributes_wrong_type(self):
'\n (TestRTKDesignElectric) set_attributes should return a 10 error code when passed the wrong type\n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0, 1, 0, 0... | (TestRTKDesignElectric) set_attributes should return a 10 error code when passed the wrong type | tests/_dao/TestRTKDesignElectric.py | test02b_set_attributes_wrong_type | rakhimov/rtk | 0 | python | @attr(all=True, unit=True)
def test02b_set_attributes_wrong_type(self):
'\n \n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0, 1, 0, 0.0, 0.0, 0.0, 'Reason', 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 'zero.zero', 0.0,... | @attr(all=True, unit=True)
def test02b_set_attributes_wrong_type(self):
'\n \n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0, 1, 0, 0.0, 0.0, 0.0, 'Reason', 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 'zero.zero', 0.0,... |
eca47ad107189510b68aba1aa99ca453efe10113b9dcc3003d4383efb62aaf3b | @attr(all=True, unit=True)
def test02c_set_attributes_too_few_passed(self):
'\n (TestRTKDesignElectric) set_attributes should return a 40 error code when passed too few attributes\n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0,... | (TestRTKDesignElectric) set_attributes should return a 40 error code when passed too few attributes | tests/_dao/TestRTKDesignElectric.py | test02c_set_attributes_too_few_passed | rakhimov/rtk | 0 | python | @attr(all=True, unit=True)
def test02c_set_attributes_too_few_passed(self):
'\n \n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0, 1, 0, 0.0, 0.0, 0.0, 'Reason', 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0... | @attr(all=True, unit=True)
def test02c_set_attributes_too_few_passed(self):
'\n \n '
_attributes = (1, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.0, 1, 0, 0.0, 0.0, 0.0, 'Reason', 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0... |
c46235005f4e72a44401c41548df9c03453cc37e9b232f01530aa2ec5a4e528f | def rename_phenotype_id(phenotype_id, all_phenotypes):
" For some reason, there are a subset of biomarker, continuous, and prescription\n phentoypes that don't match between the manifest and the phenotype MatrixTable. This\n function manually converts these phenotypes to ensure that mapping is successful.\n ... | For some reason, there are a subset of biomarker, continuous, and prescription
phentoypes that don't match between the manifest and the phenotype MatrixTable. This
function manually converts these phenotypes to ensure that mapping is successful. | heritability/rhemc_load_pheno.py | rename_phenotype_id | eatkinson/UKBB-Diverse-pops | 3 | python | def rename_phenotype_id(phenotype_id, all_phenotypes):
" For some reason, there are a subset of biomarker, continuous, and prescription\n phentoypes that don't match between the manifest and the phenotype MatrixTable. This\n function manually converts these phenotypes to ensure that mapping is successful.\n ... | def rename_phenotype_id(phenotype_id, all_phenotypes):
" For some reason, there are a subset of biomarker, continuous, and prescription\n phentoypes that don't match between the manifest and the phenotype MatrixTable. This\n function manually converts these phenotypes to ensure that mapping is successful.\n ... |
d7bdffb56d25146d04954f6bfb8ff063046648b49e1088afb79cc31c26e89b8c | def generate_indiv_pheno_file(phenotype_id, checkpoint, log, random=False):
' Create individual phenotype file. This does not merge with the fam file.\n\n Parameters\n ----------\n phenotype_id: `str`\n Phenotype_id to generate file from.\n\n checkpoint: `bool`\n If True, will checkpoint the pheno... | Create individual phenotype file. This does not merge with the fam file.
Parameters
----------
phenotype_id: `str`
Phenotype_id to generate file from.
checkpoint: `bool`
If True, will checkpoint the phenotype MatrixTable on import. Argument is
passed to _read_pheno_data() which checkpoints the phenotype mt if a custo... | heritability/rhemc_load_pheno.py | generate_indiv_pheno_file | eatkinson/UKBB-Diverse-pops | 3 | python | def generate_indiv_pheno_file(phenotype_id, checkpoint, log, random=False):
' Create individual phenotype file. This does not merge with the fam file.\n\n Parameters\n ----------\n phenotype_id: `str`\n Phenotype_id to generate file from.\n\n checkpoint: `bool`\n If True, will checkpoint the pheno... | def generate_indiv_pheno_file(phenotype_id, checkpoint, log, random=False):
' Create individual phenotype file. This does not merge with the fam file.\n\n Parameters\n ----------\n phenotype_id: `str`\n Phenotype_id to generate file from.\n\n checkpoint: `bool`\n If True, will checkpoint the pheno... |
ac8d6fa2c51b6a3ce41cd7817c40f6602ceefa915c4b28fc92f1c85978f641fa | def generate_final_pheno_file(phenotype_id, ancestries, checkpoint, override_check, log=False, random=False):
' Generate a single phenotype file for each of a set of ancestries. These are in the proper\n format for RHEmc. Fam files must exist for this to work, so if they do not exist\n use generate_geno_annot... | Generate a single phenotype file for each of a set of ancestries. These are in the proper
format for RHEmc. Fam files must exist for this to work, so if they do not exist
use generate_geno_annot_split. | heritability/rhemc_load_pheno.py | generate_final_pheno_file | eatkinson/UKBB-Diverse-pops | 3 | python | def generate_final_pheno_file(phenotype_id, ancestries, checkpoint, override_check, log=False, random=False):
' Generate a single phenotype file for each of a set of ancestries. These are in the proper\n format for RHEmc. Fam files must exist for this to work, so if they do not exist\n use generate_geno_annot... | def generate_final_pheno_file(phenotype_id, ancestries, checkpoint, override_check, log=False, random=False):
' Generate a single phenotype file for each of a set of ancestries. These are in the proper\n format for RHEmc. Fam files must exist for this to work, so if they do not exist\n use generate_geno_annot... |
0ca2872b39baaa5071c8bb499bc0ac97b2eb65d8f6dcc2865ce40f6521920307 | def format_saige_phenotype(phenotype_id, anc, log):
' Imports a Saige phenotype flat file as a HailTable and formats to a similar schema\n as generate_indiv_pheno_file.\n '
saige_file = (((SAIGE_PHENO_LOC + anc) + '/') + convert_pheno_id_to_potential_saige(phenotype_id))
tab = hl.import_table(saige_fi... | Imports a Saige phenotype flat file as a HailTable and formats to a similar schema
as generate_indiv_pheno_file. | heritability/rhemc_load_pheno.py | format_saige_phenotype | eatkinson/UKBB-Diverse-pops | 3 | python | def format_saige_phenotype(phenotype_id, anc, log):
' Imports a Saige phenotype flat file as a HailTable and formats to a similar schema\n as generate_indiv_pheno_file.\n '
saige_file = (((SAIGE_PHENO_LOC + anc) + '/') + convert_pheno_id_to_potential_saige(phenotype_id))
tab = hl.import_table(saige_fi... | def format_saige_phenotype(phenotype_id, anc, log):
' Imports a Saige phenotype flat file as a HailTable and formats to a similar schema\n as generate_indiv_pheno_file.\n '
saige_file = (((SAIGE_PHENO_LOC + anc) + '/') + convert_pheno_id_to_potential_saige(phenotype_id))
tab = hl.import_table(saige_fi... |
e6936b7782c508e0da8d097764163532f6c317594c3c56a997b6f510affe78c3 | def convert_saige_to_rhemc(phenotype_id, ancestries, checkpoint, override_check, log=False):
' Converts a pre-existing filtered phenotype flat file (constructed for Saige)\n to the proper format for RHEmc. The results are uploaded in the usual format dictated\n by `get_pheno_split_names`, allowing for use by ... | Converts a pre-existing filtered phenotype flat file (constructed for Saige)
to the proper format for RHEmc. The results are uploaded in the usual format dictated
by `get_pheno_split_names`, allowing for use by ancestry-level workers. | heritability/rhemc_load_pheno.py | convert_saige_to_rhemc | eatkinson/UKBB-Diverse-pops | 3 | python | def convert_saige_to_rhemc(phenotype_id, ancestries, checkpoint, override_check, log=False):
' Converts a pre-existing filtered phenotype flat file (constructed for Saige)\n to the proper format for RHEmc. The results are uploaded in the usual format dictated\n by `get_pheno_split_names`, allowing for use by ... | def convert_saige_to_rhemc(phenotype_id, ancestries, checkpoint, override_check, log=False):
' Converts a pre-existing filtered phenotype flat file (constructed for Saige)\n to the proper format for RHEmc. The results are uploaded in the usual format dictated\n by `get_pheno_split_names`, allowing for use by ... |
ef7987420e9925f49661417d441c3ad114a172071e68b2932d312230bb0677a9 | def _join_pheno_with_famfile(famfile_this, pheno_tab):
'\n Helper function to join an ancestry-specific famfile with a phenotype ht.\n '
famfile_this = famfile_this.add_index('idx').key_by('IID')
famfile_pheno = famfile_this.join(pheno_tab, how='left')
famfile_pheno = famfile_pheno.key_by('idx').o... | Helper function to join an ancestry-specific famfile with a phenotype ht. | heritability/rhemc_load_pheno.py | _join_pheno_with_famfile | eatkinson/UKBB-Diverse-pops | 3 | python | def _join_pheno_with_famfile(famfile_this, pheno_tab):
'\n \n '
famfile_this = famfile_this.add_index('idx').key_by('IID')
famfile_pheno = famfile_this.join(pheno_tab, how='left')
famfile_pheno = famfile_pheno.key_by('idx').order_by('idx').drop('idx')
return famfile_pheno | def _join_pheno_with_famfile(famfile_this, pheno_tab):
'\n \n '
famfile_this = famfile_this.add_index('idx').key_by('IID')
famfile_pheno = famfile_this.join(pheno_tab, how='left')
famfile_pheno = famfile_pheno.key_by('idx').order_by('idx').drop('idx')
return famfile_pheno<|docstring|>Helper fu... |
26ee017f74c94ee1892f867405cf50cb64032479dcd71d1f386b238b99d5f416 | def filter_and_normalize(adata, make_var_names_unique=True, min_genes=200, min_cells=None, n_genes_by_counts=2500, percent_mito=10, percent_ig=50, hvg_batch_key=None, ig_regex_pattern='IG[HKL][VDJ][1-9].+|TR[ABDG][VDJ][1-9]', target_sum=None, n_top_genes=None, normalization_flavor='cell_ranger', log=True, scale_max_val... | performs quality filtering and normalization of 10x Genomics count data
Args:
-----
adata (anndata.AnnData): AnnData object containing gene count data.
make_var_names_unique (bool): If ``True``, ``adata.var_names_make_unique()`` will be called
before filtering and normalization. Defaul... | scab/pp.py | filter_and_normalize | briney/scab | 0 | python | def filter_and_normalize(adata, make_var_names_unique=True, min_genes=200, min_cells=None, n_genes_by_counts=2500, percent_mito=10, percent_ig=50, hvg_batch_key=None, ig_regex_pattern='IG[HKL][VDJ][1-9].+|TR[ABDG][VDJ][1-9]', target_sum=None, n_top_genes=None, normalization_flavor='cell_ranger', log=True, scale_max_val... | def filter_and_normalize(adata, make_var_names_unique=True, min_genes=200, min_cells=None, n_genes_by_counts=2500, percent_mito=10, percent_ig=50, hvg_batch_key=None, ig_regex_pattern='IG[HKL][VDJ][1-9].+|TR[ABDG][VDJ][1-9]', target_sum=None, n_top_genes=None, normalization_flavor='cell_ranger', log=True, scale_max_val... |
d9fd535727953ad16a2f3db6a4062dc9dc28483aebd9eb2f162e2f09b0b1b10b | def predict_doublets(adata, verbose=True):
'\n Predicts doublets using scrublet.\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n\n Returns:\n --------\n\n ... | Predicts doublets using scrublet.
Args:
-----
adata (anndata.AnnData): AnnData object containing gene count data.
verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.
Returns:
--------
Returns an anndata.AnnData object with doublet predictions found at ``adata.obs.predict... | scab/pp.py | predict_doublets | briney/scab | 0 | python | def predict_doublets(adata, verbose=True):
'\n Predicts doublets using scrublet.\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n\n Returns:\n --------\n\n ... | def predict_doublets(adata, verbose=True):
'\n Predicts doublets using scrublet.\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n\n Returns:\n --------\n\n ... |
ce09a98db6c5e25dcc3764f9fbc1b03f2f8e7677d7fc75edf27deefdce8955c1 | def remove_doublets(adata, verbose=True):
'\n Removes doublets (doublet identification performed using scrublet).\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n... | Removes doublets (doublet identification performed using scrublet).
Args:
-----
adata (anndata.AnnData): AnnData object containing gene count data.
verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.
Returns:
--------
Returns an anndata.AnnData object without droplets id... | scab/pp.py | remove_doublets | briney/scab | 0 | python | def remove_doublets(adata, verbose=True):
'\n Removes doublets (doublet identification performed using scrublet).\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n... | def remove_doublets(adata, verbose=True):
'\n Removes doublets (doublet identification performed using scrublet).\n\n Args:\n -----\n\n adata (anndata.AnnData): AnnData object containing gene count data.\n\n verbose (bool): If ``True``, progress updates will be printed. Default is ``True``.\n... |
0cb810c9ed5449618dd9885284236935cc949f2bbbc6086d7d3b41c3ad513304 | @staticmethod
def _preprocess_data(expr, scaler_type='robust', thresh_filter=0.1):
' Centers expression data based on a specified data scaler algorithm\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_features, n_samples]\n scaler_type (str): Scaler to normalized features... | Centers expression data based on a specified data scaler algorithm
Args:
expr (pandas DataFrame obj): pandas DataFrame of [n_features, n_samples]
scaler_type (str): Scaler to normalized features/samples by:
standard | robust | minmax | quant
thresh_filter (float): Prior to normalization remove feat... | enricher/enrich.py | _preprocess_data | JEstabrook/regulon-enrichment | 0 | python | @staticmethod
def _preprocess_data(expr, scaler_type='robust', thresh_filter=0.1):
' Centers expression data based on a specified data scaler algorithm\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_features, n_samples]\n scaler_type (str): Scaler to normalized features... | @staticmethod
def _preprocess_data(expr, scaler_type='robust', thresh_filter=0.1):
' Centers expression data based on a specified data scaler algorithm\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_features, n_samples]\n scaler_type (str): Scaler to normalized features... |
0e3dac1776e0697a79601ab1807408682c467dd3457b06e6de7d152ba9459cbf | @staticmethod
def _prune_regulon(expr, regulon, regulon_size):
" Prunes regulon with secondary interactions that do not meet\n the necessary number of downstream interactions metric {regulon_size}\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_samples, n_features]\n ... | Prunes regulon with secondary interactions that do not meet
the necessary number of downstream interactions metric {regulon_size}
Args:
expr (pandas DataFrame obj): pandas DataFrame of [n_samples, n_features]
regulon (:obj: `pandas DataFrame`) : pandas DataFrame containing weight
interactions betwe... | enricher/enrich.py | _prune_regulon | JEstabrook/regulon-enrichment | 0 | python | @staticmethod
def _prune_regulon(expr, regulon, regulon_size):
" Prunes regulon with secondary interactions that do not meet\n the necessary number of downstream interactions metric {regulon_size}\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_samples, n_features]\n ... | @staticmethod
def _prune_regulon(expr, regulon, regulon_size):
" Prunes regulon with secondary interactions that do not meet\n the necessary number of downstream interactions metric {regulon_size}\n\n Args:\n expr (pandas DataFrame obj): pandas DataFrame of [n_samples, n_features]\n ... |
a6e0dd091ba8dfbe5b9421fc61bea229f9b2e391ed9e3a8632dcbbad40fcef53 | @staticmethod
def _structure_weights(regulator, pruned_regulon, f_statistics, r_frame, p_frame):
' Calculates weights associated with regulators. Weights are the summation of\n the F-statistic and absolute spearman correlation coefficient. The weight\n retains the sign of the spearman correlat... | Calculates weights associated with regulators. Weights are the summation of
the F-statistic and absolute spearman correlation coefficient. The weight
retains the sign of the spearman correlation coefficient.
Args:
regulator (str): A feature to assign weights to downstream interactions
pruned_regulon (:... | enricher/enrich.py | _structure_weights | JEstabrook/regulon-enrichment | 0 | python | @staticmethod
def _structure_weights(regulator, pruned_regulon, f_statistics, r_frame, p_frame):
' Calculates weights associated with regulators. Weights are the summation of\n the F-statistic and absolute spearman correlation coefficient. The weight\n retains the sign of the spearman correlat... | @staticmethod
def _structure_weights(regulator, pruned_regulon, f_statistics, r_frame, p_frame):
' Calculates weights associated with regulators. Weights are the summation of\n the F-statistic and absolute spearman correlation coefficient. The weight\n retains the sign of the spearman correlat... |
aa6b38b8deabfa0b6c774a6cdffdc6f97b0ea01f491208967cf9b7325deaaf0b | def scale(self, scaler_type='robust', thresh_filter=0.1):
' Fit and scale expression data based on a specified data scaler algorithm\n\n Args:\n scaler_type (str): Scaler to normalized features/samples by:\n standard | robust | minmax | quant\n thresh_filter (float): Prio... | Fit and scale expression data based on a specified data scaler algorithm
Args:
scaler_type (str): Scaler to normalized features/samples by:
standard | robust | minmax | quant
thresh_filter (float): Prior to normalization remove features that do not have
the mean unit of a feature (i.e. 1 tpm) i... | enricher/enrich.py | scale | JEstabrook/regulon-enrichment | 0 | python | def scale(self, scaler_type='robust', thresh_filter=0.1):
' Fit and scale expression data based on a specified data scaler algorithm\n\n Args:\n scaler_type (str): Scaler to normalized features/samples by:\n standard | robust | minmax | quant\n thresh_filter (float): Prio... | def scale(self, scaler_type='robust', thresh_filter=0.1):
' Fit and scale expression data based on a specified data scaler algorithm\n\n Args:\n scaler_type (str): Scaler to normalized features/samples by:\n standard | robust | minmax | quant\n thresh_filter (float): Prio... |
d62d9a4513f33aa81a7ec82511faabb55b8b8fb6e5f6fee45879e28a9d3c21d1 | def assign_weights(self):
'\n Generate normalized likelihood weights and assigns those weights to the absolute gene\n expression signature\n '
if (not self.scaled):
warnings.warn('Assigning interaction weights without scaling dataset!')
(pruned_regulon, sub_expr) = self._pru... | Generate normalized likelihood weights and assigns those weights to the absolute gene
expression signature | enricher/enrich.py | assign_weights | JEstabrook/regulon-enrichment | 0 | python | def assign_weights(self):
'\n Generate normalized likelihood weights and assigns those weights to the absolute gene\n expression signature\n '
if (not self.scaled):
warnings.warn('Assigning interaction weights without scaling dataset!')
(pruned_regulon, sub_expr) = self._pru... | def assign_weights(self):
'\n Generate normalized likelihood weights and assigns those weights to the absolute gene\n expression signature\n '
if (not self.scaled):
warnings.warn('Assigning interaction weights without scaling dataset!')
(pruned_regulon, sub_expr) = self._pru... |
4e02622fe992ea051e4176b8ae8dfd934e3ebddf1b53a06f84b6578f917e2250 | def calculate_enrichment(self):
'\n Subset and generate regulator activity scores based on rank ordering of up-regulated\n and down-regulated targets\n\n '
if (self.regulon_weights is None):
raise TypeError('`regulon_weights` must be assigned prior to enrichment calculation, fou... | Subset and generate regulator activity scores based on rank ordering of up-regulated
and down-regulated targets | enricher/enrich.py | calculate_enrichment | JEstabrook/regulon-enrichment | 0 | python | def calculate_enrichment(self):
'\n Subset and generate regulator activity scores based on rank ordering of up-regulated\n and down-regulated targets\n\n '
if (self.regulon_weights is None):
raise TypeError('`regulon_weights` must be assigned prior to enrichment calculation, fou... | def calculate_enrichment(self):
'\n Subset and generate regulator activity scores based on rank ordering of up-regulated\n and down-regulated targets\n\n '
if (self.regulon_weights is None):
raise TypeError('`regulon_weights` must be assigned prior to enrichment calculation, fou... |
a969ae916815d080fc4759cdd3034218019c48bb0f02c149ba14756dcfb6f39b | def blend(sz, sigma=0.5, mu=0.0):
'\n Gaussian blending\n '
(zz, yy, xx) = np.meshgrid(np.linspace((- 1), 1, sz[0], dtype=np.float32), np.linspace((- 1), 1, sz[1], dtype=np.float32), np.linspace((- 1), 1, sz[2], dtype=np.float32), indexing='ij')
dd = np.sqrt((((zz * zz) + (yy * yy)) + (xx * xx)))
... | Gaussian blending | torch_connectomics/utils/net/misc.py | blend | charlotte12l/pytorch_connectomics | 5 | python | def blend(sz, sigma=0.5, mu=0.0):
'\n \n '
(zz, yy, xx) = np.meshgrid(np.linspace((- 1), 1, sz[0], dtype=np.float32), np.linspace((- 1), 1, sz[1], dtype=np.float32), np.linspace((- 1), 1, sz[2], dtype=np.float32), indexing='ij')
dd = np.sqrt((((zz * zz) + (yy * yy)) + (xx * xx)))
ww = (0.0001 + np... | def blend(sz, sigma=0.5, mu=0.0):
'\n \n '
(zz, yy, xx) = np.meshgrid(np.linspace((- 1), 1, sz[0], dtype=np.float32), np.linspace((- 1), 1, sz[1], dtype=np.float32), np.linspace((- 1), 1, sz[2], dtype=np.float32), indexing='ij')
dd = np.sqrt((((zz * zz) + (yy * yy)) + (xx * xx)))
ww = (0.0001 + np... |
652bbb86d6e8cb96cfaee8abe7f243f30cf4615320039356f03c55c47dde20e8 | def get_provider(self, name: str) -> st.Provider:
'\n Get the pulumi provider with the given name\n '
api = ProviderAPI(name, self.registry.get_provider(('pulumi/' + name)), self)
self._providers.add(name)
return api | Get the pulumi provider with the given name | statey/ext/pulumi/provider_api.py | get_provider | cfeenstra67/statey | 4 | python | def get_provider(self, name: str) -> st.Provider:
'\n \n '
api = ProviderAPI(name, self.registry.get_provider(('pulumi/' + name)), self)
self._providers.add(name)
return api | def get_provider(self, name: str) -> st.Provider:
'\n \n '
api = ProviderAPI(name, self.registry.get_provider(('pulumi/' + name)), self)
self._providers.add(name)
return api<|docstring|>Get the pulumi provider with the given name<|endoftext|> |
53029294947cb96ad2a6907d7c1f276538718af26aa3a999041fa43302f54ae6 | @contextmanager
def get_cloned_git_path(repo, branch='master'):
'Create a temp dir to clone a git repo into.\n\n The HEAD of the specified branch is cloned into a temp dir.\n\n This method yields the path to the temporary directory. Once the `with`\n block has been exited, the entire tree under `tmpdir` is... | Create a temp dir to clone a git repo into.
The HEAD of the specified branch is cloned into a temp dir.
This method yields the path to the temporary directory. Once the `with`
block has been exited, the entire tree under `tmpdir` is removed. | src/mist/api/helpers.py | get_cloned_git_path | vladimir-ilyashenko/mist.api | 0 | python | @contextmanager
def get_cloned_git_path(repo, branch='master'):
'Create a temp dir to clone a git repo into.\n\n The HEAD of the specified branch is cloned into a temp dir.\n\n This method yields the path to the temporary directory. Once the `with`\n block has been exited, the entire tree under `tmpdir` is... | @contextmanager
def get_cloned_git_path(repo, branch='master'):
'Create a temp dir to clone a git repo into.\n\n The HEAD of the specified branch is cloned into a temp dir.\n\n This method yields the path to the temporary directory. Once the `with`\n block has been exited, the entire tree under `tmpdir` is... |
9bfd29902dd7514d84101ce405e9cda3f5d7ee2aa5e9bd2598f96a2b81c8ce99 | @contextmanager
def get_temp_file(content, dir=None):
"Creates a temporary file on disk and saves 'content' in it.\n\n It is meant to be used like this:\n with get_temp_file(my_string) as file_path:\n do_stuff(file_path)\n\n Once the with block is exited, the file is always deleted, even if an\n ... | Creates a temporary file on disk and saves 'content' in it.
It is meant to be used like this:
with get_temp_file(my_string) as file_path:
do_stuff(file_path)
Once the with block is exited, the file is always deleted, even if an
exception has been raised. | src/mist/api/helpers.py | get_temp_file | vladimir-ilyashenko/mist.api | 0 | python | @contextmanager
def get_temp_file(content, dir=None):
"Creates a temporary file on disk and saves 'content' in it.\n\n It is meant to be used like this:\n with get_temp_file(my_string) as file_path:\n do_stuff(file_path)\n\n Once the with block is exited, the file is always deleted, even if an\n ... | @contextmanager
def get_temp_file(content, dir=None):
"Creates a temporary file on disk and saves 'content' in it.\n\n It is meant to be used like this:\n with get_temp_file(my_string) as file_path:\n do_stuff(file_path)\n\n Once the with block is exited, the file is always deleted, even if an\n ... |
14f3f882590790466cbd4cbc94b9d8ed08df4406043ae34b1b9167c0a37da647 | def is_email_valid(email):
'E-mail address validator.\n\n Ensure the e-mail is a valid expression and the provider is not banned.\n\n '
match = re.match('^[\\w\\.-]+@([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)+$', email)
return (match and (''.join(match.groups()) not in config.BANNED_EMAIL_PROVIDERS)) | E-mail address validator.
Ensure the e-mail is a valid expression and the provider is not banned. | src/mist/api/helpers.py | is_email_valid | vladimir-ilyashenko/mist.api | 0 | python | def is_email_valid(email):
'E-mail address validator.\n\n Ensure the e-mail is a valid expression and the provider is not banned.\n\n '
match = re.match('^[\\w\\.-]+@([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)+$', email)
return (match and (.join(match.groups()) not in config.BANNED_EMAIL_PROVIDERS)) | def is_email_valid(email):
'E-mail address validator.\n\n Ensure the e-mail is a valid expression and the provider is not banned.\n\n '
match = re.match('^[\\w\\.-]+@([a-zA-Z0-9-]+)(\\.[a-zA-Z0-9-]+)+$', email)
return (match and (.join(match.groups()) not in config.BANNED_EMAIL_PROVIDERS))<|docstring|... |
bf1239601f083284c5b21895afa40f5d2cf80735bb168a3c6b7c80ff665bd43f | def params_from_request(request):
'Get the parameters dict from request.\n\n Searches if there is a json payload or http parameters and returns\n the dict.\n\n '
try:
params = request.json_body
except:
params = request.params
return (params or {}) | Get the parameters dict from request.
Searches if there is a json payload or http parameters and returns
the dict. | src/mist/api/helpers.py | params_from_request | vladimir-ilyashenko/mist.api | 0 | python | def params_from_request(request):
'Get the parameters dict from request.\n\n Searches if there is a json payload or http parameters and returns\n the dict.\n\n '
try:
params = request.json_body
except:
params = request.params
return (params or {}) | def params_from_request(request):
'Get the parameters dict from request.\n\n Searches if there is a json payload or http parameters and returns\n the dict.\n\n '
try:
params = request.json_body
except:
params = request.params
return (params or {})<|docstring|>Get the parameters ... |
ad94ec99ec5c3f82c29db303b83ccc047192828cf18e85066001bf3fa07b8b3f | def get_auth_header(user):
'The value created here is added as an "Authorization" header in HTTP\n requests towards the hosted mist core service.\n '
return user.mist_api_token | The value created here is added as an "Authorization" header in HTTP
requests towards the hosted mist core service. | src/mist/api/helpers.py | get_auth_header | vladimir-ilyashenko/mist.api | 0 | python | def get_auth_header(user):
'The value created here is added as an "Authorization" header in HTTP\n requests towards the hosted mist core service.\n '
return user.mist_api_token | def get_auth_header(user):
'The value created here is added as an "Authorization" header in HTTP\n requests towards the hosted mist core service.\n '
return user.mist_api_token<|docstring|>The value created here is added as an "Authorization" header in HTTP
requests towards the hosted mist core service.<|... |
9bcd76c5d23ae52683b99489eef71219b8523fb96754a17c5446b19ce21b23b7 | def parse_os_release(os_release):
'\n Extract os name and version from the output of `cat /etc/*release`\n '
os = ''
os_version = ''
os_release = os_release.replace('"', '')
distro = ''
lines = os_release.split('\n')
for line in lines:
if ('clearos' in line.lower()):
... | Extract os name and version from the output of `cat /etc/*release` | src/mist/api/helpers.py | parse_os_release | vladimir-ilyashenko/mist.api | 0 | python | def parse_os_release(os_release):
'\n \n '
os =
os_version =
os_release = os_release.replace('"', )
distro =
lines = os_release.split('\n')
for line in lines:
if ('clearos' in line.lower()):
distro = line
os = 'clearos'
os_version = line.p... | def parse_os_release(os_release):
'\n \n '
os =
os_version =
os_release = os_release.replace('"', )
distro =
lines = os_release.split('\n')
for line in lines:
if ('clearos' in line.lower()):
distro = line
os = 'clearos'
os_version = line.p... |
1e0f1bc0c546784dc8c343a1c96dc455127d94161b1d2cb7afb8dcf554f0a395 | def dirty_cow(os, os_version, kernel_version):
'\n Compares the current version to the vulnerable ones and returns\n True if vulnerable, False if safe, None if not matched with\n anything.\n '
min_patched_version = '3.2.0'
vulnerables = {'ubuntu': {'16.10': '4.8.0-26.28', '16.04': '4.4.0-45.66',... | Compares the current version to the vulnerable ones and returns
True if vulnerable, False if safe, None if not matched with
anything. | src/mist/api/helpers.py | dirty_cow | vladimir-ilyashenko/mist.api | 0 | python | def dirty_cow(os, os_version, kernel_version):
'\n Compares the current version to the vulnerable ones and returns\n True if vulnerable, False if safe, None if not matched with\n anything.\n '
min_patched_version = '3.2.0'
vulnerables = {'ubuntu': {'16.10': '4.8.0-26.28', '16.04': '4.4.0-45.66',... | def dirty_cow(os, os_version, kernel_version):
'\n Compares the current version to the vulnerable ones and returns\n True if vulnerable, False if safe, None if not matched with\n anything.\n '
min_patched_version = '3.2.0'
vulnerables = {'ubuntu': {'16.10': '4.8.0-26.28', '16.04': '4.4.0-45.66',... |
36302bc2a6eefb6826da7bd3d64ce35f0c1f5bfa84b2a827b6597471bc3f7243 | def sanitize_host(host):
'Return the hostname or ip address out of a URL'
for prefix in ['https://', 'http://']:
host = host.replace(prefix, '')
host = host.split('/')[0]
host = host.split(':')[0]
return host | Return the hostname or ip address out of a URL | src/mist/api/helpers.py | sanitize_host | vladimir-ilyashenko/mist.api | 0 | python | def sanitize_host(host):
for prefix in ['https://', 'http://']:
host = host.replace(prefix, )
host = host.split('/')[0]
host = host.split(':')[0]
return host | def sanitize_host(host):
for prefix in ['https://', 'http://']:
host = host.replace(prefix, )
host = host.split('/')[0]
host = host.split(':')[0]
return host<|docstring|>Return the hostname or ip address out of a URL<|endoftext|> |
288b75b64f70652bf67f2dd1ba287a268de37bfe2e735edfdccbba2cb93003ac | def extract_port(url):
'Returns the port number out of a url'
for prefix in ['http://', 'https://']:
if (prefix in url):
url = url.replace(prefix, '')
break
else:
prefix = ''
url = url.split('/')[0]
url = url.split(':')
if (len(url) > 1):
return in... | Returns the port number out of a url | src/mist/api/helpers.py | extract_port | vladimir-ilyashenko/mist.api | 0 | python | def extract_port(url):
for prefix in ['http://', 'https://']:
if (prefix in url):
url = url.replace(prefix, )
break
else:
prefix =
url = url.split('/')[0]
url = url.split(':')
if (len(url) > 1):
return int(url[1])
elif (prefix == 'https://'):... | def extract_port(url):
for prefix in ['http://', 'https://']:
if (prefix in url):
url = url.replace(prefix, )
break
else:
prefix =
url = url.split('/')[0]
url = url.split(':')
if (len(url) > 1):
return int(url[1])
elif (prefix == 'https://'):... |
89854149e073a45fe40d8f128fa369ce964236e035494443a73607679fedde4d | def extract_params(url):
'Extracts the trailing params beyond the port number out of a url'
for prefix in ['http://', 'https://']:
url = url.replace(prefix, '')
params = url.split('/')[1:]
params = '/'.join(params)
return params | Extracts the trailing params beyond the port number out of a url | src/mist/api/helpers.py | extract_params | vladimir-ilyashenko/mist.api | 0 | python | def extract_params(url):
for prefix in ['http://', 'https://']:
url = url.replace(prefix, )
params = url.split('/')[1:]
params = '/'.join(params)
return params | def extract_params(url):
for prefix in ['http://', 'https://']:
url = url.replace(prefix, )
params = url.split('/')[1:]
params = '/'.join(params)
return params<|docstring|>Extracts the trailing params beyond the port number out of a url<|endoftext|> |
686b6e7977eb9c42715b8007a99a89b40aeb1860f907ded5ca447d2a8c46965e | def extract_prefix(url, prefixes=['http://', 'https://']):
'Extracts the (http, https) prefix out of a given url'
try:
return [prefix for prefix in prefixes if (prefix in url)][0]
except IndexError:
return '' | Extracts the (http, https) prefix out of a given url | src/mist/api/helpers.py | extract_prefix | vladimir-ilyashenko/mist.api | 0 | python | def extract_prefix(url, prefixes=['http://', 'https://']):
try:
return [prefix for prefix in prefixes if (prefix in url)][0]
except IndexError:
return | def extract_prefix(url, prefixes=['http://', 'https://']):
try:
return [prefix for prefix in prefixes if (prefix in url)][0]
except IndexError:
return <|docstring|>Extracts the (http, https) prefix out of a given url<|endoftext|> |
e2d7964de5a0a1f4d5aa6a7427dd8b4963400ecad59fb4c711cb76b6161129b8 | def check_host(host, allow_localhost=config.ALLOW_CONNECT_LOCALHOST, allow_inaddr_any=False):
'Check if a given host is a valid DNS name or IPv4 address'
try:
ipaddr = socket.gethostbyname(host)
except UnicodeEncodeError:
raise MistError('Please provide a valid DNS name')
except socket.g... | Check if a given host is a valid DNS name or IPv4 address | src/mist/api/helpers.py | check_host | vladimir-ilyashenko/mist.api | 0 | python | def check_host(host, allow_localhost=config.ALLOW_CONNECT_LOCALHOST, allow_inaddr_any=False):
try:
ipaddr = socket.gethostbyname(host)
except UnicodeEncodeError:
raise MistError('Please provide a valid DNS name')
except socket.gaierror:
raise MistError(("Not a valid IP address o... | def check_host(host, allow_localhost=config.ALLOW_CONNECT_LOCALHOST, allow_inaddr_any=False):
try:
ipaddr = socket.gethostbyname(host)
except UnicodeEncodeError:
raise MistError('Please provide a valid DNS name')
except socket.gaierror:
raise MistError(("Not a valid IP address o... |
70e9dec726a15ebb27cc71aba0c102fa6f433720d7ab42b810ddc48fd0bbe6a1 | def get_datetime(timestamp):
'Parse several representations of time into a datetime object'
if isinstance(timestamp, datetime.datetime):
return timestamp
elif isinstance(timestamp, (int, float)):
try:
return datetime.datetime.fromtimestamp(timestamp)
except ValueError:
... | Parse several representations of time into a datetime object | src/mist/api/helpers.py | get_datetime | vladimir-ilyashenko/mist.api | 0 | python | def get_datetime(timestamp):
if isinstance(timestamp, datetime.datetime):
return timestamp
elif isinstance(timestamp, (int, float)):
try:
return datetime.datetime.fromtimestamp(timestamp)
except ValueError:
pass
try:
return datetime.dateti... | def get_datetime(timestamp):
if isinstance(timestamp, datetime.datetime):
return timestamp
elif isinstance(timestamp, (int, float)):
try:
return datetime.datetime.fromtimestamp(timestamp)
except ValueError:
pass
try:
return datetime.dateti... |
8b84a3243babfa535f0d2bf74af8ab92bcc8925566e714b36ff9b5c465a6937f | def random_string(length=5, punc=False):
'\n Generate a random string. Default length is set to 5 characters.\n When punc=True, the string will also contain punctuation apart\n from letters and digits\n '
_chars = (string.letters + string.digits)
_chars += (string.punctuation if punc else '')
... | Generate a random string. Default length is set to 5 characters.
When punc=True, the string will also contain punctuation apart
from letters and digits | src/mist/api/helpers.py | random_string | vladimir-ilyashenko/mist.api | 0 | python | def random_string(length=5, punc=False):
'\n Generate a random string. Default length is set to 5 characters.\n When punc=True, the string will also contain punctuation apart\n from letters and digits\n '
_chars = (string.letters + string.digits)
_chars += (string.punctuation if punc else )
... | def random_string(length=5, punc=False):
'\n Generate a random string. Default length is set to 5 characters.\n When punc=True, the string will also contain punctuation apart\n from letters and digits\n '
_chars = (string.letters + string.digits)
_chars += (string.punctuation if punc else )
... |
93804c3718f905de3f28f17c9db4cda5389da9d76ed8a18ca677e06272d3ab8a | def rename_kwargs(kwargs, old_key, new_key):
'Given a `kwargs` dict rename `old_key` to `new_key`'
if (old_key in kwargs):
if (new_key not in kwargs):
log.warning("Got param '%s' when expecting '%s', transforming.", old_key, new_key)
kwargs[new_key] = kwargs.pop(old_key)
... | Given a `kwargs` dict rename `old_key` to `new_key` | src/mist/api/helpers.py | rename_kwargs | vladimir-ilyashenko/mist.api | 0 | python | def rename_kwargs(kwargs, old_key, new_key):
if (old_key in kwargs):
if (new_key not in kwargs):
log.warning("Got param '%s' when expecting '%s', transforming.", old_key, new_key)
kwargs[new_key] = kwargs.pop(old_key)
else:
log.warning("Got both param '%s' an... | def rename_kwargs(kwargs, old_key, new_key):
if (old_key in kwargs):
if (new_key not in kwargs):
log.warning("Got param '%s' when expecting '%s', transforming.", old_key, new_key)
kwargs[new_key] = kwargs.pop(old_key)
else:
log.warning("Got both param '%s' an... |
e13ebd46c2547aa0c90a4e3a4ae55f97e43c75fff14b22f993dcc6584fdec9a2 | def ip_from_request(request):
'Extract IP address from HTTP Request headers.'
return (request.environ.get('HTTP_X_REAL_IP') or request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR') or '0.0.0.0').split(',')[0].strip() | Extract IP address from HTTP Request headers. | src/mist/api/helpers.py | ip_from_request | vladimir-ilyashenko/mist.api | 0 | python | def ip_from_request(request):
return (request.environ.get('HTTP_X_REAL_IP') or request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR') or '0.0.0.0').split(',')[0].strip() | def ip_from_request(request):
return (request.environ.get('HTTP_X_REAL_IP') or request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR') or '0.0.0.0').split(',')[0].strip()<|docstring|>Extract IP address from HTTP Request headers.<|endoftext|> |
5f32be5fe2f384219a60220c74624ca91ca6bae459d51eeeead93f28fb2201c1 | def send_email(subject, body, recipients, sender=None, bcc=None, attempts=3, html_body=None):
"Send email.\n\n subject: email's subject\n body: email's body\n recipients: an email address as a string or an iterable of email addresses\n sender: the email address of the sender. default value taken from co... | Send email.
subject: email's subject
body: email's body
recipients: an email address as a string or an iterable of email addresses
sender: the email address of the sender. default value taken from config | src/mist/api/helpers.py | send_email | vladimir-ilyashenko/mist.api | 0 | python | def send_email(subject, body, recipients, sender=None, bcc=None, attempts=3, html_body=None):
"Send email.\n\n subject: email's subject\n body: email's body\n recipients: an email address as a string or an iterable of email addresses\n sender: the email address of the sender. default value taken from co... | def send_email(subject, body, recipients, sender=None, bcc=None, attempts=3, html_body=None):
"Send email.\n\n subject: email's subject\n body: email's body\n recipients: an email address as a string or an iterable of email addresses\n sender: the email address of the sender. default value taken from co... |
6fcce376a2708f883b8da3bf925fab7363ab5832a128c288b2c676a736e5186c | def ts_to_str(timestamp):
'Return a timestamp as a nicely formated datetime string.'
try:
date = datetime.datetime.fromtimestamp(timestamp)
date_string = date.strftime('%d/%m/%Y %H:%M %Z')
return date_string
except:
return None | Return a timestamp as a nicely formated datetime string. | src/mist/api/helpers.py | ts_to_str | vladimir-ilyashenko/mist.api | 0 | python | def ts_to_str(timestamp):
try:
date = datetime.datetime.fromtimestamp(timestamp)
date_string = date.strftime('%d/%m/%Y %H:%M %Z')
return date_string
except:
return None | def ts_to_str(timestamp):
try:
date = datetime.datetime.fromtimestamp(timestamp)
date_string = date.strftime('%d/%m/%Y %H:%M %Z')
return date_string
except:
return None<|docstring|>Return a timestamp as a nicely formated datetime string.<|endoftext|> |
874a38d78703f83226afe9030edbbeced17e90976618c51f5dd3d4dde265f577 | def iso_to_seconds(iso):
'Attempt to transform a time representation into seconds.'
return get_datetime(iso).strftime('%s') | Attempt to transform a time representation into seconds. | src/mist/api/helpers.py | iso_to_seconds | vladimir-ilyashenko/mist.api | 0 | python | def iso_to_seconds(iso):
return get_datetime(iso).strftime('%s') | def iso_to_seconds(iso):
return get_datetime(iso).strftime('%s')<|docstring|>Attempt to transform a time representation into seconds.<|endoftext|> |
cefc2ea08fda0aa23cd3474e6908c23720607e609c312a4335d8a45d158f7891 | def encrypt(plaintext, key=config.SECRET, key_salt='', no_iv=False):
'Encrypt shit the right way'
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if isinstance(plaintext, string_types):
plaintext = plaintext.encode('utf-8')
pa... | Encrypt shit the right way | src/mist/api/helpers.py | encrypt | vladimir-ilyashenko/mist.api | 0 | python | def encrypt(plaintext, key=config.SECRET, key_salt=, no_iv=False):
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if isinstance(plaintext, string_types):
plaintext = plaintext.encode('utf-8')
padlen = (AES.block_size - (len(... | def encrypt(plaintext, key=config.SECRET, key_salt=, no_iv=False):
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if isinstance(plaintext, string_types):
plaintext = plaintext.encode('utf-8')
padlen = (AES.block_size - (len(... |
d66639667835c72600d99bfaf6b69487fcaa410183015e59637f3bc816669ba5 | def decrypt(ciphertext, key=config.SECRET, key_salt='', no_iv=False):
'Decrypt shit the right way'
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if (len(ciphertext) % AES.block_size):
raise Exception()
try:
ciphertex... | Decrypt shit the right way | src/mist/api/helpers.py | decrypt | vladimir-ilyashenko/mist.api | 0 | python | def decrypt(ciphertext, key=config.SECRET, key_salt=, no_iv=False):
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if (len(ciphertext) % AES.block_size):
raise Exception()
try:
ciphertext = codecs.decode(ciphertext, ... | def decrypt(ciphertext, key=config.SECRET, key_salt=, no_iv=False):
key = SHA256.new((key + key_salt).encode()).digest()
if (len(key) not in AES.key_size):
raise Exception()
if (len(ciphertext) % AES.block_size):
raise Exception()
try:
ciphertext = codecs.decode(ciphertext, ... |
82190f620376de413a35500640a8911d4b1228ceff89bff277f09edb83d171d8 | def logging_view_decorator(func):
"Decorator that logs a view function's request and response."
def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated an... | Decorator that logs a view function's request and response. | src/mist/api/helpers.py | logging_view_decorator | vladimir-ilyashenko/mist.api | 0 | python | def logging_view_decorator(func):
def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated and the request along with its error response\n will be ... | def logging_view_decorator(func):
def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated and the request along with its error response\n will be ... |
400958d3259fc902cd6ff635ed3b2ff759e2cf616887639ad3f310fcf7f579d0 | def view_config(*args, **kwargs):
"Override pyramid's view_config to log API requests and responses."
return pyramid_view_config(*args, decorator=logging_view_decorator, **kwargs) | Override pyramid's view_config to log API requests and responses. | src/mist/api/helpers.py | view_config | vladimir-ilyashenko/mist.api | 0 | python | def view_config(*args, **kwargs):
return pyramid_view_config(*args, decorator=logging_view_decorator, **kwargs) | def view_config(*args, **kwargs):
return pyramid_view_config(*args, decorator=logging_view_decorator, **kwargs)<|docstring|>Override pyramid's view_config to log API requests and responses.<|endoftext|> |
4ac9ab08e6a7b266549df25ef53015aa133b51f97d94aee01333772c6b360206 | def es_client(asynchronous=False):
'Returns an initialized Elasticsearch client.'
if (not asynchronous):
return Elasticsearch(config.ELASTICSEARCH['elastic_host'], port=config.ELASTICSEARCH['elastic_port'], http_auth=(config.ELASTICSEARCH['elastic_username'], config.ELASTICSEARCH['elastic_password']), u... | Returns an initialized Elasticsearch client. | src/mist/api/helpers.py | es_client | vladimir-ilyashenko/mist.api | 0 | python | def es_client(asynchronous=False):
if (not asynchronous):
return Elasticsearch(config.ELASTICSEARCH['elastic_host'], port=config.ELASTICSEARCH['elastic_port'], http_auth=(config.ELASTICSEARCH['elastic_username'], config.ELASTICSEARCH['elastic_password']), use_ssl=config.ELASTICSEARCH['elastic_use_ssl']... | def es_client(asynchronous=False):
if (not asynchronous):
return Elasticsearch(config.ELASTICSEARCH['elastic_host'], port=config.ELASTICSEARCH['elastic_port'], http_auth=(config.ELASTICSEARCH['elastic_username'], config.ELASTICSEARCH['elastic_password']), use_ssl=config.ELASTICSEARCH['elastic_use_ssl']... |
cefebc5b1901491fe5b5ddac1377a0dba24dd112bef08f2bbffa8ffc480bcba0 | def get_file(url, filename, update=True):
"Get file from url and store it to directory relative to src/mist/api\n\n If update is True, then a download will be attempted even if the file\n already exists.\n\n This function only raises an exception if the file doesn't exist and cannot\n be fetched.\n "... | Get file from url and store it to directory relative to src/mist/api
If update is True, then a download will be attempted even if the file
already exists.
This function only raises an exception if the file doesn't exist and cannot
be fetched. | src/mist/api/helpers.py | get_file | vladimir-ilyashenko/mist.api | 0 | python | def get_file(url, filename, update=True):
"Get file from url and store it to directory relative to src/mist/api\n\n If update is True, then a download will be attempted even if the file\n already exists.\n\n This function only raises an exception if the file doesn't exist and cannot\n be fetched.\n "... | def get_file(url, filename, update=True):
"Get file from url and store it to directory relative to src/mist/api\n\n If update is True, then a download will be attempted even if the file\n already exists.\n\n This function only raises an exception if the file doesn't exist and cannot\n be fetched.\n "... |
e76ed68645974e5db683d24ef4adc64c00ee1c99b33a091324554751abc5422e | def maybe_submit_cloud_task(cloud, task_name):
'Decide whether a task should be submitted to celery\n\n This method helps us prevent submitting new celery tasks, which are\n guaranteed to return/exit immediately without performing any actual\n actions.\n\n For instance, such cases include async tasks fo... | Decide whether a task should be submitted to celery
This method helps us prevent submitting new celery tasks, which are
guaranteed to return/exit immediately without performing any actual
actions.
For instance, such cases include async tasks for listing DNS zones
for clouds that have no DNS support or DNS is temporar... | src/mist/api/helpers.py | maybe_submit_cloud_task | vladimir-ilyashenko/mist.api | 0 | python | def maybe_submit_cloud_task(cloud, task_name):
'Decide whether a task should be submitted to celery\n\n This method helps us prevent submitting new celery tasks, which are\n guaranteed to return/exit immediately without performing any actual\n actions.\n\n For instance, such cases include async tasks fo... | def maybe_submit_cloud_task(cloud, task_name):
'Decide whether a task should be submitted to celery\n\n This method helps us prevent submitting new celery tasks, which are\n guaranteed to return/exit immediately without performing any actual\n actions.\n\n For instance, such cases include async tasks fo... |
1ce4d995e5cf1783344bec10c9638be13a2c92350eb5b44883a07186fc15414b | def is_resource_missing(obj):
'Return True if either resource or its parent is missing or has been\n deleted. Note that `obj` is meant to be a subclass of me.Document.'
try:
if getattr(obj, 'deleted', None):
return True
if getattr(obj, 'missing_since', None):
return Tr... | Return True if either resource or its parent is missing or has been
deleted. Note that `obj` is meant to be a subclass of me.Document. | src/mist/api/helpers.py | is_resource_missing | vladimir-ilyashenko/mist.api | 0 | python | def is_resource_missing(obj):
'Return True if either resource or its parent is missing or has been\n deleted. Note that `obj` is meant to be a subclass of me.Document.'
try:
if getattr(obj, 'deleted', None):
return True
if getattr(obj, 'missing_since', None):
return Tr... | def is_resource_missing(obj):
'Return True if either resource or its parent is missing or has been\n deleted. Note that `obj` is meant to be a subclass of me.Document.'
try:
if getattr(obj, 'deleted', None):
return True
if getattr(obj, 'missing_since', None):
return Tr... |
2909401a012c973efae7a27818a8669e6fa3a23cf94f4d6f6b4750e69fd383ca | def convert_to_timedelta(time_val):
"\n Receives a time_val param. time_val should be either an integer,\n or a relative delta in the following format:\n '_s', '_m', '_h', '_d', '_mo', for seconds, minutes, hours, days\n months respectively. Returns a timedelta object if right param is\n given, else ... | Receives a time_val param. time_val should be either an integer,
or a relative delta in the following format:
'_s', '_m', '_h', '_d', '_mo', for seconds, minutes, hours, days
months respectively. Returns a timedelta object if right param is
given, else None | src/mist/api/helpers.py | convert_to_timedelta | vladimir-ilyashenko/mist.api | 0 | python | def convert_to_timedelta(time_val):
"\n Receives a time_val param. time_val should be either an integer,\n or a relative delta in the following format:\n '_s', '_m', '_h', '_d', '_mo', for seconds, minutes, hours, days\n months respectively. Returns a timedelta object if right param is\n given, else ... | def convert_to_timedelta(time_val):
"\n Receives a time_val param. time_val should be either an integer,\n or a relative delta in the following format:\n '_s', '_m', '_h', '_d', '_mo', for seconds, minutes, hours, days\n months respectively. Returns a timedelta object if right param is\n given, else ... |
f81d5ea4c8fcc48e141d7823f613fc8940f3de86e52d5957c418cc7a16456a5b | def __init__(self, stdout=True, stderr=True, func=None, pass_through=True):
'Starts to capture sys.stdout/sys.stderr'
self.func = func
self.pass_through = pass_through
self.buff = []
self.streams = {}
if stdout:
self.streams['stdout'] = sys.stdout
if stderr:
self.streams['std... | Starts to capture sys.stdout/sys.stderr | src/mist/api/helpers.py | __init__ | vladimir-ilyashenko/mist.api | 0 | python | def __init__(self, stdout=True, stderr=True, func=None, pass_through=True):
self.func = func
self.pass_through = pass_through
self.buff = []
self.streams = {}
if stdout:
self.streams['stdout'] = sys.stdout
if stderr:
self.streams['stderr'] = sys.stderr
class Stream(obje... | def __init__(self, stdout=True, stderr=True, func=None, pass_through=True):
self.func = func
self.pass_through = pass_through
self.buff = []
self.streams = {}
if stdout:
self.streams['stdout'] = sys.stdout
if stderr:
self.streams['stderr'] = sys.stderr
class Stream(obje... |
d69c308c8a1334391ce9e5a6299f938d614adc469f868f8c7c2597229550c336 | def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated and the request along with its error response\n will be handled there.\n\n '
if (not hasattr(... | Call view function and log API request and its response.
If an exception is raised inside a view, then the exception handler
view will be activated and the request along with its error response
will be handled there. | src/mist/api/helpers.py | logging_view | vladimir-ilyashenko/mist.api | 0 | python | def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated and the request along with its error response\n will be handled there.\n\n '
if (not hasattr(... | def logging_view(context, request):
'Call view function and log API request and its response.\n\n If an exception is raised inside a view, then the exception handler\n view will be activated and the request along with its error response\n will be handled there.\n\n '
if (not hasattr(... |
0d0bce4edc9f7b19b73c55e600b56649ba33e187faf9bf07ba16e38cd2d4d367 | def mk_req(self, url, **kwargs):
'Update kwargs with authentication credentials.'
kwargs.update({'auth_username': config.ELASTICSEARCH['elastic_username'], 'auth_password': config.ELASTICSEARCH['elastic_password'], 'validate_cert': config.ELASTICSEARCH['elastic_verify_certs'], 'ca_certs': None})
for param i... | Update kwargs with authentication credentials. | src/mist/api/helpers.py | mk_req | vladimir-ilyashenko/mist.api | 0 | python | def mk_req(self, url, **kwargs):
kwargs.update({'auth_username': config.ELASTICSEARCH['elastic_username'], 'auth_password': config.ELASTICSEARCH['elastic_password'], 'validate_cert': config.ELASTICSEARCH['elastic_verify_certs'], 'ca_certs': None})
for param in ('connect_timeout', 'request_timeout'):
... | def mk_req(self, url, **kwargs):
kwargs.update({'auth_username': config.ELASTICSEARCH['elastic_username'], 'auth_password': config.ELASTICSEARCH['elastic_password'], 'validate_cert': config.ELASTICSEARCH['elastic_verify_certs'], 'ca_certs': None})
for param in ('connect_timeout', 'request_timeout'):
... |
cd21338b813141b89afba72fd8eaf4dd8cabbd8956fcae57681a661a9df124ad | def se(sigma, cls):
' \n Squared exponential covariance function\n '
return gauss.gpse((0.0, (sigma ** 2), cls), dim=2) | Squared exponential covariance function | pygeons/main/gpnetwork.py | se | treverhines/PyGeoNS | 10 | python | def se(sigma, cls):
' \n \n '
return gauss.gpse((0.0, (sigma ** 2), cls), dim=2) | def se(sigma, cls):
' \n \n '
return gauss.gpse((0.0, (sigma ** 2), cls), dim=2)<|docstring|>Squared exponential covariance function<|endoftext|> |
cdec0d8fe8d3f28660c2ab688daa4a6353742e6b3892029267cda3b0b2cead57 | def exp(sigma, cls):
' \n Exponential covariance function\n '
return gauss.gpexp((0.0, (sigma ** 2), cls), dim=2) | Exponential covariance function | pygeons/main/gpnetwork.py | exp | treverhines/PyGeoNS | 10 | python | def exp(sigma, cls):
' \n \n '
return gauss.gpexp((0.0, (sigma ** 2), cls), dim=2) | def exp(sigma, cls):
' \n \n '
return gauss.gpexp((0.0, (sigma ** 2), cls), dim=2)<|docstring|>Exponential covariance function<|endoftext|> |
fcd806a7b3a9b183eaddcb4bf4d13d5cebc92de495922d68a2d03b6cd1c6d8a0 | def mat32(sigma, cls):
' \n Matern covariance function with nu=3/2\n '
return gauss.gpiso(rbf.basis.mat32, (0.0, (sigma ** 2), cls), dim=2) | Matern covariance function with nu=3/2 | pygeons/main/gpnetwork.py | mat32 | treverhines/PyGeoNS | 10 | python | def mat32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.mat32, (0.0, (sigma ** 2), cls), dim=2) | def mat32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.mat32, (0.0, (sigma ** 2), cls), dim=2)<|docstring|>Matern covariance function with nu=3/2<|endoftext|> |
e0af0660396411960d1f3c05c0977e8a0b3c3e33586a7bb6aed8e6b7b0fff9bd | def mat52(sigma, cls):
' \n Matern space covariance function with nu=5/2\n '
return gauss.gpiso(rbf.basis.mat52, (0.0, (sigma ** 2), cls), dim=2) | Matern space covariance function with nu=5/2 | pygeons/main/gpnetwork.py | mat52 | treverhines/PyGeoNS | 10 | python | def mat52(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.mat52, (0.0, (sigma ** 2), cls), dim=2) | def mat52(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.mat52, (0.0, (sigma ** 2), cls), dim=2)<|docstring|>Matern space covariance function with nu=5/2<|endoftext|> |
d3422722c8b4e506d53fbecd28297f47813d304114dc605bf31eb01baabf42ba | def wen32(sigma, cls):
' \n Wendland space covariance function\n '
return gauss.gpiso(rbf.basis.wen32, (0.0, (sigma ** 2), cls), dim=2) | Wendland space covariance function | pygeons/main/gpnetwork.py | wen32 | treverhines/PyGeoNS | 10 | python | def wen32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.wen32, (0.0, (sigma ** 2), cls), dim=2) | def wen32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.wen32, (0.0, (sigma ** 2), cls), dim=2)<|docstring|>Wendland space covariance function<|endoftext|> |
95a6052d4b2e903c81f7052bf9d2fc0e580480cf2e9472be0c7619f5bd94dd81 | def spwen32(sigma, cls):
' \n Sparse Wendland space covariance function \n '
return gauss.gpiso(rbf.basis.spwen32, (0.0, (sigma ** 2), cls), dim=2) | Sparse Wendland space covariance function | pygeons/main/gpnetwork.py | spwen32 | treverhines/PyGeoNS | 10 | python | def spwen32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.spwen32, (0.0, (sigma ** 2), cls), dim=2) | def spwen32(sigma, cls):
' \n \n '
return gauss.gpiso(rbf.basis.spwen32, (0.0, (sigma ** 2), cls), dim=2)<|docstring|>Sparse Wendland space covariance function<|endoftext|> |
e73c66f4ff15b46973e1f491bcd82fbe5a8dd44e3d8d1ddd56507a78ccaa9a4f | @set_units(['mm', 'yr', 'km'])
def se_se(sigma, cts, cls):
' \n Squared exponential for temporal and spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n '
tgp = gpstation.se(... | Squared exponential for temporal and spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | se_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def se_se(sigma, cts, cls):
' \n Squared exponential for temporal and spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n '
tgp = gpstation.se(... | @set_units(['mm', 'yr', 'km'])
def se_se(sigma, cts, cls):
' \n Squared exponential for temporal and spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n '
tgp = gpstation.se(... |
d4fd361c42b894e5a4be33bb1cbbd2dd0ceeb4f8ae2c7029b3873da78428c6a8 | @set_units(['mm', 'yr', 'km'])
def exp_se(sigma, cts, cls):
' \n Exponetial for temporal covariance. Squared exponential for spatial\n covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n... | Exponetial for temporal covariance. Squared exponential for spatial
covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | exp_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def exp_se(sigma, cts, cls):
' \n Exponetial for temporal covariance. Squared exponential for spatial\n covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n... | @set_units(['mm', 'yr', 'km'])
def exp_se(sigma, cts, cls):
' \n Exponetial for temporal covariance. Squared exponential for spatial\n covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristic length-scale\n... |
25c22c5077a31ad55e4d4e08cf3af6bf8d1a301b6700ba231bd7fddc582ca095 | @set_units(['mm', 'yr', 'km'])
def wen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | 1-D C2 Wendland function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | wen11_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def wen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | @set_units(['mm', 'yr', 'km'])
def wen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... |
c3c393a57d5df274fc38e5fce580b3267bf72f4cf7cf3d4fde3a0d91ca55820a | @set_units(['mm', 'yr', 'km'])
def wen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | 1-D C4 Wendland function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | wen12_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def wen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | @set_units(['mm', 'yr', 'km'])
def wen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... |
42a2ce7897b041624858733a6ecebe8794de9040d0e3aa2b93f63e4fbdbdc6b9 | @set_units(['mm', 'yr', 'km'])
def spwen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... | 1-D C2 Wendland function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | spwen11_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def spwen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... | @set_units(['mm', 'yr', 'km'])
def spwen11_se(sigma, cts, cls):
' \n 1-D C2 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... |
a5cea8b85e317b16054eaa45e1086da2890152f317c5bc44b25cab89b9904418 | @set_units(['mm', 'yr', 'km'])
def spwen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... | 1-D C4 Wendland function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | spwen12_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def spwen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... | @set_units(['mm', 'yr', 'km'])
def spwen12_se(sigma, cts, cls):
' \n 1-D C4 Wendland function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteris... |
0f9cc4bb0123ae05507d1b474202c078293257bcfca56d042f91f0c290344f67 | @set_units(['mm/yr^0.5', '1/yr', 'km'])
def fogm_se(sigma, fc, cls):
' \n First-order Gauss-Markov for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5] : Standard deviation of forcing term\n fc [1/yr] : Cutoff frequency\n cls [km] : Characte... | First-order Gauss-Markov for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm/yr^0.5] : Standard deviation of forcing term
fc [1/yr] : Cutoff frequency
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | fogm_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm/yr^0.5', '1/yr', 'km'])
def fogm_se(sigma, fc, cls):
' \n First-order Gauss-Markov for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5] : Standard deviation of forcing term\n fc [1/yr] : Cutoff frequency\n cls [km] : Characte... | @set_units(['mm/yr^0.5', '1/yr', 'km'])
def fogm_se(sigma, fc, cls):
' \n First-order Gauss-Markov for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5] : Standard deviation of forcing term\n fc [1/yr] : Cutoff frequency\n cls [km] : Characte... |
1b4747f16232dd13e5c750f7e5b45e4bae64116d387980e24e78a5fbf9a96c7f | @set_units(['mm/yr^0.5', 'mjd', 'km'])
def bm_se(sigma, t0, cls):
' \n Brownian motion for temporal covariance. Squared exponential for\n spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5]: Standard deviation of forcing term\n t0 [mjd] : Start time\n cls [km] : Characteristic length-scale\... | Brownian motion for temporal covariance. Squared exponential for
spatial covariance.
Parameters
----------
sigma [mm/yr^0.5]: Standard deviation of forcing term
t0 [mjd] : Start time
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | bm_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm/yr^0.5', 'mjd', 'km'])
def bm_se(sigma, t0, cls):
' \n Brownian motion for temporal covariance. Squared exponential for\n spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5]: Standard deviation of forcing term\n t0 [mjd] : Start time\n cls [km] : Characteristic length-scale\... | @set_units(['mm/yr^0.5', 'mjd', 'km'])
def bm_se(sigma, t0, cls):
' \n Brownian motion for temporal covariance. Squared exponential for\n spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^0.5]: Standard deviation of forcing term\n t0 [mjd] : Start time\n cls [km] : Characteristic length-scale\... |
806522e96be75e2448a4738b3491def78f9508fed648e112c74f1c41b2795771 | @set_units(['mm/yr^1.5', 'mjd', 'km'])
def ibm_se(sigma, t0, cls):
' \n Integrated Brownian motion for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^1.5] : Standard deviation of forcing term\n fc [mjd] : Cutoff frequency\n cls [km] : Character... | Integrated Brownian motion for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm/yr^1.5] : Standard deviation of forcing term
fc [mjd] : Cutoff frequency
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | ibm_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm/yr^1.5', 'mjd', 'km'])
def ibm_se(sigma, t0, cls):
' \n Integrated Brownian motion for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^1.5] : Standard deviation of forcing term\n fc [mjd] : Cutoff frequency\n cls [km] : Character... | @set_units(['mm/yr^1.5', 'mjd', 'km'])
def ibm_se(sigma, t0, cls):
' \n Integrated Brownian motion for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm/yr^1.5] : Standard deviation of forcing term\n fc [mjd] : Cutoff frequency\n cls [km] : Character... |
a20997223b226931e3e5bf00a735c9c9b2a4bb5ad74e3b3f9d7fd8e1a307bc57 | @set_units(['mm', 'yr', 'km'])
def mat32_se(sigma, cts, cls):
' \n Matern (nu=3/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | Matern (nu=3/2) function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | mat32_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def mat32_se(sigma, cts, cls):
' \n Matern (nu=3/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | @set_units(['mm', 'yr', 'km'])
def mat32_se(sigma, cts, cls):
' \n Matern (nu=3/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... |
543e3f3a45d0eb5dece740970b5a3c976518dab52b13a3346780ab60dd0ed167 | @set_units(['mm', 'yr', 'km'])
def mat52_se(sigma, cts, cls):
' \n Matern (nu=5/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | Matern (nu=5/2) function for temporal covariance. Squared
exponential for spatial covariance.
Parameters
----------
sigma [mm] : Standard deviation of displacements
cts [yr] : Characteristic time-scale
cls [km] : Characteristic length-scale | pygeons/main/gpnetwork.py | mat52_se | treverhines/PyGeoNS | 10 | python | @set_units(['mm', 'yr', 'km'])
def mat52_se(sigma, cts, cls):
' \n Matern (nu=5/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... | @set_units(['mm', 'yr', 'km'])
def mat52_se(sigma, cts, cls):
' \n Matern (nu=5/2) function for temporal covariance. Squared\n exponential for spatial covariance.\n \n Parameters\n ----------\n sigma [mm] : Standard deviation of displacements\n cts [yr] : Characteristic time-scale\n cls [km] : Characteristi... |
080d6313dfeabb90ac6823b27c125b66a38974ac3f0f85bcda9e0fb69ab6fa24 | def solve(self, level):
'\n Static function that solves a particular level.\n\n Keyword arguments:\n level -- instance of Level that is going to be solved.\n '
if (not isinstance(level, Level)):
raise TypeError("'level' must be an instance of Level.")
counter_initial_valu... | Static function that solves a particular level.
Keyword arguments:
level -- instance of Level that is going to be solved. | Solver.py | solve | ogabrielp/calculator-the-game-solver | 1 | python | def solve(self, level):
'\n Static function that solves a particular level.\n\n Keyword arguments:\n level -- instance of Level that is going to be solved.\n '
if (not isinstance(level, Level)):
raise TypeError("'level' must be an instance of Level.")
counter_initial_valu... | def solve(self, level):
'\n Static function that solves a particular level.\n\n Keyword arguments:\n level -- instance of Level that is going to be solved.\n '
if (not isinstance(level, Level)):
raise TypeError("'level' must be an instance of Level.")
counter_initial_valu... |
5050da6d7f2e71739b33bd74ebe1af713c7e5e3284a79e2af27fb46b1121e7e1 | def sequence_works(self, sequence):
'\n Tries a particular sequence of operations.\n '
self.calculator.clear()
sequence = [int(digit) for digit in sequence]
level = self.calculator.get_level()
for digit in sequence:
button = level.get_button_at(digit)
self.calculator.pe... | Tries a particular sequence of operations. | Solver.py | sequence_works | ogabrielp/calculator-the-game-solver | 1 | python | def sequence_works(self, sequence):
'\n \n '
self.calculator.clear()
sequence = [int(digit) for digit in sequence]
level = self.calculator.get_level()
for digit in sequence:
button = level.get_button_at(digit)
self.calculator.perform_operation(button)
current_va... | def sequence_works(self, sequence):
'\n \n '
self.calculator.clear()
sequence = [int(digit) for digit in sequence]
level = self.calculator.get_level()
for digit in sequence:
button = level.get_button_at(digit)
self.calculator.perform_operation(button)
current_va... |
29df084ec371d5e12c2e8b9cfd13e4780f1644e0627d63f69b50509ace2c3621 | def check_cluster_config_passes(node, check_type, additional_flags=None):
'\n Runs check cluster config cmd on node and returns True if the check passes.\n Otherwise returns False\n\n Args:\n node: a whitebox object to run check_cluster_config on\n check_type (str): name of the check_cluster_conf... | Runs check cluster config cmd on node and returns True if the check passes.
Otherwise returns False
Args:
node: a whitebox object to run check_cluster_config on
check_type (str): name of the check_cluster_config check to run
eg "all", "dns"
additional_args (list of str): additional arguments ... | qalib/preflight.py | check_cluster_config_passes | Datera/datera-automation-toolkit | 0 | python | def check_cluster_config_passes(node, check_type, additional_flags=None):
'\n Runs check cluster config cmd on node and returns True if the check passes.\n Otherwise returns False\n\n Args:\n node: a whitebox object to run check_cluster_config on\n check_type (str): name of the check_cluster_conf... | def check_cluster_config_passes(node, check_type, additional_flags=None):
'\n Runs check cluster config cmd on node and returns True if the check passes.\n Otherwise returns False\n\n Args:\n node: a whitebox object to run check_cluster_config on\n check_type (str): name of the check_cluster_conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.