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 |
|---|---|---|---|---|---|---|---|---|---|
e5036776ca59387c210c6692554bc5b593349c442d6a76856cf9296bc58560d5 | def visitNode(self, p):
'Init any settings found in node p.'
p = p.copy()
munge = g.app.config.munge
(kind, name, val) = self.parseHeadline(p.h)
kind = munge(kind)
isNone = (val in ('None', 'none', '', None))
if (kind is None):
pass
elif (kind == 'settings'):
pass
eli... | Init any settings found in node p. | leo/core/leoConfig.py | visitNode | thomasbuttler/leo-editor | 1,550 | python | def visitNode(self, p):
p = p.copy()
munge = g.app.config.munge
(kind, name, val) = self.parseHeadline(p.h)
kind = munge(kind)
isNone = (val in ('None', 'none', , None))
if (kind is None):
pass
elif (kind == 'settings'):
pass
elif ((kind in self.basic_types) and isNo... | def visitNode(self, p):
p = p.copy()
munge = g.app.config.munge
(kind, name, val) = self.parseHeadline(p.h)
kind = munge(kind)
isNone = (val in ('None', 'none', , None))
if (kind is None):
pass
elif (kind == 'settings'):
pass
elif ((kind in self.basic_types) and isNo... |
ed5ac1724061799024a56cb1b43be0ce03b7806e0b6d4141c73d25cc7b6724b0 | def filter_features(dataset):
'\n POSTag filtering of noun, adjective, verb and adverb.\n '
filtered_dataset = []
label_tags = []
for entry in dataset:
valid_tokens = []
for (n, tag) in enumerate(entry['features']['tags']):
if (tag in ['NOUN', 'ADJ', 'VERB', 'ADV']):
... | POSTag filtering of noun, adjective, verb and adverb. | 1_count_ml.py | filter_features | Giovani-Merlin/PMI_ATE | 0 | python | def filter_features(dataset):
'\n \n '
filtered_dataset = []
label_tags = []
for entry in dataset:
valid_tokens = []
for (n, tag) in enumerate(entry['features']['tags']):
if (tag in ['NOUN', 'ADJ', 'VERB', 'ADV']):
valid_tokens.append(n)
if (... | def filter_features(dataset):
'\n \n '
filtered_dataset = []
label_tags = []
for entry in dataset:
valid_tokens = []
for (n, tag) in enumerate(entry['features']['tags']):
if (tag in ['NOUN', 'ADJ', 'VERB', 'ADV']):
valid_tokens.append(n)
if (... |
108cfdbc6f1e55c8bc5ddd31ab58b36bfde23ca075eefb0c181ed94e83ea083a | def _get_helper(trainer, num_inputs, num_targets, helper_name=None):
'\n :param trainer:\n :param num_inputs:\n :param num_targets:\n :param helper_name: Generally a helper will be determined from number of inputs and targets. However may want to supply your own in some instances.\n\n If a helper_nam... | :param trainer:
:param num_inputs:
:param num_targets:
:param helper_name: Generally a helper will be determined from number of inputs and targets. However may want to supply your own in some instances.
If a helper_name is specified then num_inputs and num_targets are ignored.
:return: | pywick/modules/module_trainer.py | _get_helper | achaiah/pywick | 408 | python | def _get_helper(trainer, num_inputs, num_targets, helper_name=None):
'\n :param trainer:\n :param num_inputs:\n :param num_targets:\n :param helper_name: Generally a helper will be determined from number of inputs and targets. However may want to supply your own in some instances.\n\n If a helper_nam... | def _get_helper(trainer, num_inputs, num_targets, helper_name=None):
'\n :param trainer:\n :param num_inputs:\n :param num_targets:\n :param helper_name: Generally a helper will be determined from number of inputs and targets. However may want to supply your own in some instances.\n\n If a helper_nam... |
c47d5a0a86ef94188eda25589038781b8ed11490361fff18d06d48a88a8a6460 | def __init__(self, model, cuda_devices=None):
'\n ModelTrainer for high-level training of Pytorch models\n\n Major Parts\n -----------\n - optimizer(s)\n - criterion(s)\n - loss_multipliers (to handle multiple losses)\n - named_helpers\n - preconditions\n ... | ModelTrainer for high-level training of Pytorch models
Major Parts
-----------
- optimizer(s)
- criterion(s)
- loss_multipliers (to handle multiple losses)
- named_helpers
- preconditions
- postconditions
- regularizers
- initializers
- constraints
- metrics
- callbacks | pywick/modules/module_trainer.py | __init__ | achaiah/pywick | 408 | python | def __init__(self, model, cuda_devices=None):
'\n ModelTrainer for high-level training of Pytorch models\n\n Major Parts\n -----------\n - optimizer(s)\n - criterion(s)\n - loss_multipliers (to handle multiple losses)\n - named_helpers\n - preconditions\n ... | def __init__(self, model, cuda_devices=None):
'\n ModelTrainer for high-level training of Pytorch models\n\n Major Parts\n -----------\n - optimizer(s)\n - criterion(s)\n - loss_multipliers (to handle multiple losses)\n - named_helpers\n - preconditions\n ... |
2466b5784f15bd4f36693428a1b5f5132fd6698aa4913e75c93e994fcb83a6ee | def compile(self, optimizer, criterion, loss_multipliers=None, named_helpers=None, preconditions=None, postconditions=None, callbacks=None, regularizers=None, initializers=None, constraints=None, metrics=None, transforms=None):
'\n :param optimizer: the optimizer to use for learning\n :param criterion... | :param optimizer: the optimizer to use for learning
:param criterion: the criterion to use for calculating loss
:param loss_multipliers: (type: list) A way to provide preset loss multipliers for multi-loss criterions
:param named_helpers: (type: dict) A way to provide custom handler for loss calculation and forward pas... | pywick/modules/module_trainer.py | compile | achaiah/pywick | 408 | python | def compile(self, optimizer, criterion, loss_multipliers=None, named_helpers=None, preconditions=None, postconditions=None, callbacks=None, regularizers=None, initializers=None, constraints=None, metrics=None, transforms=None):
'\n :param optimizer: the optimizer to use for learning\n :param criterion... | def compile(self, optimizer, criterion, loss_multipliers=None, named_helpers=None, preconditions=None, postconditions=None, callbacks=None, regularizers=None, initializers=None, constraints=None, metrics=None, transforms=None):
'\n :param optimizer: the optimizer to use for learning\n :param criterion... |
ec06384d757c682b20e58c4f56ec864c2247033819dee255264ab69acc935c71 | def fit(self, inputs, targets=None, val_data=None, initial_epoch=0, num_epoch=100, batch_size=32, shuffle=False, fit_helper_name=None, verbose=1):
'\n Fit a model on in-memory tensors using ModuleTrainer\n '
self.model.train(True)
(num_inputs, num_targets) = _parse_num_inputs_and_targets(input... | Fit a model on in-memory tensors using ModuleTrainer | pywick/modules/module_trainer.py | fit | achaiah/pywick | 408 | python | def fit(self, inputs, targets=None, val_data=None, initial_epoch=0, num_epoch=100, batch_size=32, shuffle=False, fit_helper_name=None, verbose=1):
'\n \n '
self.model.train(True)
(num_inputs, num_targets) = _parse_num_inputs_and_targets(inputs, targets)
len_inputs = (len(inputs) if (not is... | def fit(self, inputs, targets=None, val_data=None, initial_epoch=0, num_epoch=100, batch_size=32, shuffle=False, fit_helper_name=None, verbose=1):
'\n \n '
self.model.train(True)
(num_inputs, num_targets) = _parse_num_inputs_and_targets(inputs, targets)
len_inputs = (len(inputs) if (not is... |
b76d2b76b3b61d39f218d413c29946fc0593d29f83460ef6272e3b74a876ee65 | def fit_loader(self, loader, val_loader=None, initial_epoch=0, num_epoch=100, fit_helper_name=None, verbose=1):
'\n Fit a model on in-memory tensors using ModuleTrainer\n '
self.model.train(mode=True)
num_inputs = 1
num_targets = 1
if hasattr(loader.dataset, 'num_inputs'):
num_... | Fit a model on in-memory tensors using ModuleTrainer | pywick/modules/module_trainer.py | fit_loader | achaiah/pywick | 408 | python | def fit_loader(self, loader, val_loader=None, initial_epoch=0, num_epoch=100, fit_helper_name=None, verbose=1):
'\n \n '
self.model.train(mode=True)
num_inputs = 1
num_targets = 1
if hasattr(loader.dataset, 'num_inputs'):
num_inputs = loader.dataset.num_inputs
if hasattr(lo... | def fit_loader(self, loader, val_loader=None, initial_epoch=0, num_epoch=100, fit_helper_name=None, verbose=1):
'\n \n '
self.model.train(mode=True)
num_inputs = 1
num_targets = 1
if hasattr(loader.dataset, 'num_inputs'):
num_inputs = loader.dataset.num_inputs
if hasattr(lo... |
17c5bd5faba3ebb406ea5e118a1a946c618851d0858e10133946c1f6388af994 | def __init__(self, loss_multipliers=None):
'\n\n :param loss_multipliers: (type: list) Some networks return multiple losses that are then added together. This optional list\n\n specifies different weights to apply to corresponding losses before they are summed.\n '
self.loss_multipliers... | :param loss_multipliers: (type: list) Some networks return multiple losses that are then added together. This optional list
specifies different weights to apply to corresponding losses before they are summed. | pywick/modules/module_trainer.py | __init__ | achaiah/pywick | 408 | python | def __init__(self, loss_multipliers=None):
'\n\n :param loss_multipliers: (type: list) Some networks return multiple losses that are then added together. This optional list\n\n specifies different weights to apply to corresponding losses before they are summed.\n '
self.loss_multipliers... | def __init__(self, loss_multipliers=None):
'\n\n :param loss_multipliers: (type: list) Some networks return multiple losses that are then added together. This optional list\n\n specifies different weights to apply to corresponding losses before they are summed.\n '
self.loss_multipliers... |
50bd02e2e7f41955c5bbecaf28b93c0bd139a6363205198e9f90c5f077bfebf6 | def good_row(sudoku_board, row_num, num):
'\n Checks to make sure that a given row in a sudoku is possible if an int\n num is placed into that row\n '
rows = [sudoku_board[(i, :)] for i in range(9)]
if (num not in rows[row_num]):
return True
return False | Checks to make sure that a given row in a sudoku is possible if an int
num is placed into that row | sudoku_solver.py | good_row | yinglin33/sudoku-solver-generator | 0 | python | def good_row(sudoku_board, row_num, num):
'\n Checks to make sure that a given row in a sudoku is possible if an int\n num is placed into that row\n '
rows = [sudoku_board[(i, :)] for i in range(9)]
if (num not in rows[row_num]):
return True
return False | def good_row(sudoku_board, row_num, num):
'\n Checks to make sure that a given row in a sudoku is possible if an int\n num is placed into that row\n '
rows = [sudoku_board[(i, :)] for i in range(9)]
if (num not in rows[row_num]):
return True
return False<|docstring|>Checks to make sure ... |
cd6d7791bb91d21a362250fae1a766439d60228e00fa9b727fd4ff59d2e2efa9 | def good_col(sudoku_board, col_num, num):
'\n Checks to make sure that a given column in a sudoku board is possible if\n an int num is placed into that column\n '
cols = [sudoku_board[(:, i)] for i in range(9)]
if (num not in cols[col_num]):
return True
return False | Checks to make sure that a given column in a sudoku board is possible if
an int num is placed into that column | sudoku_solver.py | good_col | yinglin33/sudoku-solver-generator | 0 | python | def good_col(sudoku_board, col_num, num):
'\n Checks to make sure that a given column in a sudoku board is possible if\n an int num is placed into that column\n '
cols = [sudoku_board[(:, i)] for i in range(9)]
if (num not in cols[col_num]):
return True
return False | def good_col(sudoku_board, col_num, num):
'\n Checks to make sure that a given column in a sudoku board is possible if\n an int num is placed into that column\n '
cols = [sudoku_board[(:, i)] for i in range(9)]
if (num not in cols[col_num]):
return True
return False<|docstring|>Checks t... |
012d58461739896b0e1ef419bed9e60d2e9fc5efc664a51c9a8832adc130c3c0 | def good_box(sudoku_board, row_num, col_num, num):
'\n Checks to make sure that a given "box" in a sudoku board is possible if an\n int num is placed into that "box"\n '
boxes = [sudoku_board[((3 * i):(3 * (i + 1)), (3 * j):(3 * (j + 1)))] for i in range(3) for j in range(3)]
if (num not in boxes[(... | Checks to make sure that a given "box" in a sudoku board is possible if an
int num is placed into that "box" | sudoku_solver.py | good_box | yinglin33/sudoku-solver-generator | 0 | python | def good_box(sudoku_board, row_num, col_num, num):
'\n Checks to make sure that a given "box" in a sudoku board is possible if an\n int num is placed into that "box"\n '
boxes = [sudoku_board[((3 * i):(3 * (i + 1)), (3 * j):(3 * (j + 1)))] for i in range(3) for j in range(3)]
if (num not in boxes[(... | def good_box(sudoku_board, row_num, col_num, num):
'\n Checks to make sure that a given "box" in a sudoku board is possible if an\n int num is placed into that "box"\n '
boxes = [sudoku_board[((3 * i):(3 * (i + 1)), (3 * j):(3 * (j + 1)))] for i in range(3) for j in range(3)]
if (num not in boxes[(... |
8ed1d5bed5e0d03671558c6a91b269f3f117b1cbe0d079de7d9fa4564f471011 | def solve(sudoku_board):
'\n Solves the sudoku_board using a backtracking algorithm.\n '
if (0 not in sudoku_board):
return True
for i in range(9):
for j in range(9):
if (sudoku_board[i][j] == 0):
for k in range(1, 10):
if is_possible(sud... | Solves the sudoku_board using a backtracking algorithm. | sudoku_solver.py | solve | yinglin33/sudoku-solver-generator | 0 | python | def solve(sudoku_board):
'\n \n '
if (0 not in sudoku_board):
return True
for i in range(9):
for j in range(9):
if (sudoku_board[i][j] == 0):
for k in range(1, 10):
if is_possible(sudoku_board, i, j, k):
sudoku_boa... | def solve(sudoku_board):
'\n \n '
if (0 not in sudoku_board):
return True
for i in range(9):
for j in range(9):
if (sudoku_board[i][j] == 0):
for k in range(1, 10):
if is_possible(sudoku_board, i, j, k):
sudoku_boa... |
fff14d6f5b61cb1df1b6a638bc144a78a37725688d695c454ad7ae22cf17af1e | @click.command()
@click.option('--host', help='Host to bind.', type=click.STRING, default='localhost', required=False, show_default=True)
@click.option('-p', '--port', help='Port to bind.', type=click.INT, default=8000, required=False, show_default=True)
@click.option('-w', '--workers', help='The number of worker proce... | das_sankhya CLI devserve (Uvicorn with reload) command.
Use this only for local development. | das_sankhya/cli/commands/devserve.py | devserve | abnerjacobsen/fastapi-mvc-loguru | 0 | python | @click.command()
@click.option('--host', help='Host to bind.', type=click.STRING, default='localhost', required=False, show_default=True)
@click.option('-p', '--port', help='Port to bind.', type=click.INT, default=8000, required=False, show_default=True)
@click.option('-w', '--workers', help='The number of worker proce... | @click.command()
@click.option('--host', help='Host to bind.', type=click.STRING, default='localhost', required=False, show_default=True)
@click.option('-p', '--port', help='Port to bind.', type=click.INT, default=8000, required=False, show_default=True)
@click.option('-w', '--workers', help='The number of worker proce... |
43b72f5ab9e7d68dbbe4d68fca9f08fcdd0d2ef028d63f1e11b9f54f97fe6cba | def create_read_only_user(schemas):
'create public user\n '
LOG.info(f'creating {Fore.CYAN}read only{Fore.RESET} role')
with psycopg2.connect(**config.DBO_CONNECTION) as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT 1 FROM pg_roles WHERE rolname='read_only'")
... | create public user | src/cloudb/roles.py | create_read_only_user | agrc/open-sgid | 0 | python | def create_read_only_user(schemas):
'\n '
LOG.info(f'creating {Fore.CYAN}read only{Fore.RESET} role')
with psycopg2.connect(**config.DBO_CONNECTION) as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT 1 FROM pg_roles WHERE rolname='read_only'")
role = cursor.fetc... | def create_read_only_user(schemas):
'\n '
LOG.info(f'creating {Fore.CYAN}read only{Fore.RESET} role')
with psycopg2.connect(**config.DBO_CONNECTION) as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT 1 FROM pg_roles WHERE rolname='read_only'")
role = cursor.fetc... |
7f58f505dcea84178b4aa87e0f092585b1bc7595ceb8e4c68133bac94df6112e | def create_admin_user(props):
'creates the admin user that owns the schemas\n props: dictionary with credentials for user\n '
sql = dedent(f'''
CREATE ROLE {props['name']} WITH
LOGIN
PASSWORD '{props['password']}'
NOSUPERUSER
INHERIT
NOCREATEDB
NOCRE... | creates the admin user that owns the schemas
props: dictionary with credentials for user | src/cloudb/roles.py | create_admin_user | agrc/open-sgid | 0 | python | def create_admin_user(props):
'creates the admin user that owns the schemas\n props: dictionary with credentials for user\n '
sql = dedent(f'
CREATE ROLE {props['name']} WITH
LOGIN
PASSWORD '{props['password']}'
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREAT... | def create_admin_user(props):
'creates the admin user that owns the schemas\n props: dictionary with credentials for user\n '
sql = dedent(f'
CREATE ROLE {props['name']} WITH
LOGIN
PASSWORD '{props['password']}'
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREAT... |
c7c87c45818feda62e51bf2dd8fd66fc314688079b4a239c7ace0258a8fe210a | def get_private_endpoint_connection(private_endpoint_connection_name: Optional[str]=None, resource_group_name: Optional[str]=None, workspace_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetPrivateEndpointConnectionResult:
'\n The Private Endpoint Connection resource.\n\n\n ... | The Private Endpoint Connection resource.
:param str private_endpoint_connection_name: The name of the private endpoint connection associated with the workspace
:param str resource_group_name: Name of the resource group in which workspace is located.
:param str workspace_name: Name of Azure Machine Learning workspace... | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | get_private_endpoint_connection | sebtelko/pulumi-azure-native | 0 | python | def get_private_endpoint_connection(private_endpoint_connection_name: Optional[str]=None, resource_group_name: Optional[str]=None, workspace_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetPrivateEndpointConnectionResult:
'\n The Private Endpoint Connection resource.\n\n\n ... | def get_private_endpoint_connection(private_endpoint_connection_name: Optional[str]=None, resource_group_name: Optional[str]=None, workspace_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetPrivateEndpointConnectionResult:
'\n The Private Endpoint Connection resource.\n\n\n ... |
0afe07a05c880de1a99dc16e04e91e3c2ef181d4de14bc700dfdb1b6e5f39149 | @property
@pulumi.getter
def id(self) -> str:
'\n ResourceId of the private endpoint connection.\n '
return pulumi.get(self, 'id') | ResourceId of the private endpoint connection. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | id | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def id(self) -> str:
'\n \n '
return pulumi.get(self, 'id') | @property
@pulumi.getter
def id(self) -> str:
'\n \n '
return pulumi.get(self, 'id')<|docstring|>ResourceId of the private endpoint connection.<|endoftext|> |
5ecf17f5030fcf91d35563f609047e7910d4de24fbdd975bb5c8a32d4199c570 | @property
@pulumi.getter
def name(self) -> str:
'\n Friendly name of the private endpoint connection.\n '
return pulumi.get(self, 'name') | Friendly name of the private endpoint connection. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | name | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Friendly name of the private endpoint connection.<|endoftext|> |
f21323cdb34b05de7f4bf173e47bb7db8edde334b6111fdc44dc2b0f98eff70f | @property
@pulumi.getter(name='privateEndpoint')
def private_endpoint(self) -> Optional['outputs.PrivateEndpointResponse']:
'\n The resource of private end point.\n '
return pulumi.get(self, 'private_endpoint') | The resource of private end point. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | private_endpoint | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter(name='privateEndpoint')
def private_endpoint(self) -> Optional['outputs.PrivateEndpointResponse']:
'\n \n '
return pulumi.get(self, 'private_endpoint') | @property
@pulumi.getter(name='privateEndpoint')
def private_endpoint(self) -> Optional['outputs.PrivateEndpointResponse']:
'\n \n '
return pulumi.get(self, 'private_endpoint')<|docstring|>The resource of private end point.<|endoftext|> |
3193218b2bdadb21bae67eb1e14346755f225b6958876e7131df6d81c7e2d61a | @property
@pulumi.getter(name='privateLinkServiceConnectionState')
def private_link_service_connection_state(self) -> 'outputs.PrivateLinkServiceConnectionStateResponse':
'\n A collection of information about the state of the connection between service consumer and provider.\n '
return pulumi.get(... | A collection of information about the state of the connection between service consumer and provider. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | private_link_service_connection_state | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter(name='privateLinkServiceConnectionState')
def private_link_service_connection_state(self) -> 'outputs.PrivateLinkServiceConnectionStateResponse':
'\n \n '
return pulumi.get(self, 'private_link_service_connection_state') | @property
@pulumi.getter(name='privateLinkServiceConnectionState')
def private_link_service_connection_state(self) -> 'outputs.PrivateLinkServiceConnectionStateResponse':
'\n \n '
return pulumi.get(self, 'private_link_service_connection_state')<|docstring|>A collection of information about the sta... |
1c77e983b98cfe510d0f7ddaec58e2e29c0d2bd60725bf21a535df4a848d2024 | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n The provisioning state of the private endpoint connection resource.\n '
return pulumi.get(self, 'provisioning_state') | The provisioning state of the private endpoint connection resource. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | provisioning_state | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n \n '
return pulumi.get(self, 'provisioning_state') | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n \n '
return pulumi.get(self, 'provisioning_state')<|docstring|>The provisioning state of the private endpoint connection resource.<|endoftext|> |
407e966a104937afa9bcb55ce58a12a6838b98734a3df699cbe3a4510f38cffc | @property
@pulumi.getter
def type(self) -> str:
'\n Resource type of private endpoint connection.\n '
return pulumi.get(self, 'type') | Resource type of private endpoint connection. | sdk/python/pulumi_azure_native/machinelearningservices/v20200801/get_private_endpoint_connection.py | type | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type') | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type')<|docstring|>Resource type of private endpoint connection.<|endoftext|> |
5102024d0d03f72edc5f2b0de8de138ee51c04a968950e28cc87efea2a87e7c2 | def build_feature_names(dataset='ember'):
'Adapting to multiple datasets'
(features, feature_names, name_feat, feat_name) = data_utils.load_features(feats_to_exclude=[], dataset=dataset)
return feature_names.tolist() | Adapting to multiple datasets | mw_backdoor/notebook_utils.py | build_feature_names | ForeverZyh/MalwareBackdoors | 22 | python | def build_feature_names(dataset='ember'):
(features, feature_names, name_feat, feat_name) = data_utils.load_features(feats_to_exclude=[], dataset=dataset)
return feature_names.tolist() | def build_feature_names(dataset='ember'):
(features, feature_names, name_feat, feat_name) = data_utils.load_features(feats_to_exclude=[], dataset=dataset)
return feature_names.tolist()<|docstring|>Adapting to multiple datasets<|endoftext|> |
153bb22710899396518db275b83e13785a948fb00a9719d9cfa6ff817a30bb41 | def create_summary_df(summaries):
'Given an array of dicts, where each dict entry is a summary of a single experiment iteration,\n create a corresponding DataFrame'
summary_df = pd.DataFrame()
for key in ['orig_model_orig_test_set_accuracy', 'orig_model_mw_test_set_accuracy', 'orig_model_gw_train_set_ac... | Given an array of dicts, where each dict entry is a summary of a single experiment iteration,
create a corresponding DataFrame | mw_backdoor/notebook_utils.py | create_summary_df | ForeverZyh/MalwareBackdoors | 22 | python | def create_summary_df(summaries):
'Given an array of dicts, where each dict entry is a summary of a single experiment iteration,\n create a corresponding DataFrame'
summary_df = pd.DataFrame()
for key in ['orig_model_orig_test_set_accuracy', 'orig_model_mw_test_set_accuracy', 'orig_model_gw_train_set_ac... | def create_summary_df(summaries):
'Given an array of dicts, where each dict entry is a summary of a single experiment iteration,\n create a corresponding DataFrame'
summary_df = pd.DataFrame()
for key in ['orig_model_orig_test_set_accuracy', 'orig_model_mw_test_set_accuracy', 'orig_model_gw_train_set_ac... |
29cce5c3bb5564800f8fdf942d6c184ea15b90bf7ac92351b33070231597b14c | def run_watermark_attack(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks='', dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'waterm... | Given some features to use for watermarking
1. Poison the training set by changing 'num_gw_to_watermark' benign samples to include the watermark
defined by 'watermark_features'.
2. Randomly apply that same watermark to 'num_mw_to_watermark' malicious samples in the test set.
3. Train a model using the training set w... | mw_backdoor/notebook_utils.py | run_watermark_attack | ForeverZyh/MalwareBackdoors | 22 | python | def run_watermark_attack(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks=, dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'watermar... | def run_watermark_attack(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks=, dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'watermar... |
256b363f3f977775078a9484edb2ec062bde13f3e43bc7e7abd011322b84b79c | def run_experiments(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, feat_selectors, feat_value_selectors=None, iterations=1, model_artifacts_dir=None, save_watermarks='', model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The origin... | Terminology:
"new test set" (aka "newts") - The original test set (GW + MW) with watermarks applied to the MW.
"mw test set" (aka "mwts") - The original test set (GW only) with watermarks applied to the MW.
:param X_mw_poisoning_candidates: The malware samples that will be watermarked in an attempt to evade de... | mw_backdoor/notebook_utils.py | run_experiments | ForeverZyh/MalwareBackdoors | 22 | python | def run_experiments(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, feat_selectors, feat_value_selectors=None, iterations=1, model_artifacts_dir=None, save_watermarks=, model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The original... | def run_experiments(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, feat_selectors, feat_value_selectors=None, iterations=1, model_artifacts_dir=None, save_watermarks=, model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The original... |
5aac85f0343fd29386b0298a40d8192b6b5112c9038156d8a6979103b5a309a4 | def run_experiments_combined(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, combined_selectors, iterations=1, model_artifacts_dir=None, save_watermarks='', model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The original test set (G... | Terminology:
"new test set" (aka "newts") - The original test set (GW + MW) with watermarks applied to the MW.
"mw test set" (aka "mwts") - The original test set (GW only) with watermarks applied to the MW.
:param X_mw_poisoning_candidates: The malware samples that will be watermarked in an attempt to evade de... | mw_backdoor/notebook_utils.py | run_experiments_combined | ForeverZyh/MalwareBackdoors | 22 | python | def run_experiments_combined(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, combined_selectors, iterations=1, model_artifacts_dir=None, save_watermarks=, model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The original test set (GW ... | def run_experiments_combined(X_mw_poisoning_candidates, data_dir, gw_poison_set_sizes, watermark_feature_set_sizes, combined_selectors, iterations=1, model_artifacts_dir=None, save_watermarks=, model='lightgbm', dataset='ember'):
'\n Terminology:\n "new test set" (aka "newts") - The original test set (GW ... |
43894733a09779ed5756293d8aa359924de2f468b7a9ab1d3fa0abe7134ccc64 | def run_watermark_attack_nn(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks='', dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'wat... | Given some features to use for watermarking
1. Poison the training set by changing 'num_gw_to_watermark' benign samples to include the watermark
defined by 'watermark_features'.
2. Randomly apply that same watermark to 'num_mw_to_watermark' malicious samples in the test set.
3. Train a model using the training set w... | mw_backdoor/notebook_utils.py | run_watermark_attack_nn | ForeverZyh/MalwareBackdoors | 22 | python | def run_watermark_attack_nn(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks=, dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'water... | def run_watermark_attack_nn(X_train, y_train, X_orig_mw_only_test, y_orig_mw_only_test, wm_config, save_watermarks=, dataset='ember'):
'Given some features to use for watermarking\n 1. Poison the training set by changing \'num_gw_to_watermark\' benign samples to include the watermark\n defined by \'water... |
3c6a578069aec7e93f7c17db8fba11367cce064210272719ac8299abf4abe4d1 | def discretise_gamma_distribution(mean, var, timestep, max_infected_age):
"Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a discretised gamma distribution\n for a given mean, variance, over an interval of [0, max_infected_age] with intervals of 't... | Calculates probability mass function (pmf), cumulative distribution function (cdf)
and survival function of a discretised gamma distribution
for a given mean, variance, over an interval of [0, max_infected_age] with intervals of 'timestep'. | nottingham_covid_modelling/lib/ratefunctions.py | discretise_gamma_distribution | DGWhittaker/nottingham_covid_modelling | 0 | python | def discretise_gamma_distribution(mean, var, timestep, max_infected_age):
"Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a discretised gamma distribution\n for a given mean, variance, over an interval of [0, max_infected_age] with intervals of 't... | def discretise_gamma_distribution(mean, var, timestep, max_infected_age):
"Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a discretised gamma distribution\n for a given mean, variance, over an interval of [0, max_infected_age] with intervals of 't... |
bc5bf2176e0aeb081bb044f57c5bba24ebb2519fc6fb09ac45aa133732e83bb0 | def negative_binomial_distribution(N, p, max_infected_age):
'Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a negative binomial distribution for a given N and p, [0, max_infected_age] '
breaks = np.linspace(0, max_infected_age, (max_infected_age... | Calculates probability mass function (pmf), cumulative distribution function (cdf)
and survival function of a negative binomial distribution for a given N and p, [0, max_infected_age] | nottingham_covid_modelling/lib/ratefunctions.py | negative_binomial_distribution | DGWhittaker/nottingham_covid_modelling | 0 | python | def negative_binomial_distribution(N, p, max_infected_age):
'Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a negative binomial distribution for a given N and p, [0, max_infected_age] '
breaks = np.linspace(0, max_infected_age, (max_infected_age... | def negative_binomial_distribution(N, p, max_infected_age):
'Calculates probability mass function (pmf), cumulative distribution function (cdf)\n and survival function of a negative binomial distribution for a given N and p, [0, max_infected_age] '
breaks = np.linspace(0, max_infected_age, (max_infected_age... |
39d7c1aa1f22dc3d6e391afd6f4f2a9ebc783626bcf74769241083e6b9063731 | def make_rate_vectors(parameters_dictionary, params=Params()):
' Produces rate vectors (i.e. lambda, zeta and gamma) assuming the equivalent\n continuous distribution is a gamma distributions with specified means and variances'
if (params.timestep != 1):
raise NotImplementedError('Current implementat... | Produces rate vectors (i.e. lambda, zeta and gamma) assuming the equivalent
continuous distribution is a gamma distributions with specified means and variances | nottingham_covid_modelling/lib/ratefunctions.py | make_rate_vectors | DGWhittaker/nottingham_covid_modelling | 0 | python | def make_rate_vectors(parameters_dictionary, params=Params()):
' Produces rate vectors (i.e. lambda, zeta and gamma) assuming the equivalent\n continuous distribution is a gamma distributions with specified means and variances'
if (params.timestep != 1):
raise NotImplementedError('Current implementat... | def make_rate_vectors(parameters_dictionary, params=Params()):
' Produces rate vectors (i.e. lambda, zeta and gamma) assuming the equivalent\n continuous distribution is a gamma distributions with specified means and variances'
if (params.timestep != 1):
raise NotImplementedError('Current implementat... |
4d62fcaf7c1b11f24f1363b13ce03a284158e8ac66d09dde514f7748991f160f | def test_index(self):
'Test display of the front page.'
response = self.app.get(self.url('root', my_thing='is_this'))
assert ('squiggle' in response.body) | Test display of the front page. | floof/tests/functional/test_main.py | test_index | eevee/floof | 2 | python | def test_index(self):
response = self.app.get(self.url('root', my_thing='is_this'))
assert ('squiggle' in response.body) | def test_index(self):
response = self.app.get(self.url('root', my_thing='is_this'))
assert ('squiggle' in response.body)<|docstring|>Test display of the front page.<|endoftext|> |
780f7f5239ad78db53ac9982c33645c405cd26379e51affa712a1a7940a300df | def test_log(self):
'Test display of the public admin log page.'
response = self.app.get(self.url('log'))
assert ('Public Admin Log' in response) | Test display of the public admin log page. | floof/tests/functional/test_main.py | test_log | eevee/floof | 2 | python | def test_log(self):
response = self.app.get(self.url('log'))
assert ('Public Admin Log' in response) | def test_log(self):
response = self.app.get(self.url('log'))
assert ('Public Admin Log' in response)<|docstring|>Test display of the public admin log page.<|endoftext|> |
20e0fe067c6001a2db19d502158d81c63b62e1c5ad8b89d32751c73dea7e2c57 | def get_default_auth_files():
'Get the default path where the authentication files for connecting to DPT-RP1 are stored'
config_path = os.path.join(os.path.expanduser('~'), '.dpapp')
os.makedirs(config_path, exist_ok=True)
deviceid = os.path.join(config_path, 'deviceid.dat')
privatekey = os.path.joi... | Get the default path where the authentication files for connecting to DPT-RP1 are stored | dptrp1/dptrp1.py | get_default_auth_files | hitmoon/dpt-rp1-py | 0 | python | def get_default_auth_files():
config_path = os.path.join(os.path.expanduser('~'), '.dpapp')
os.makedirs(config_path, exist_ok=True)
deviceid = os.path.join(config_path, 'deviceid.dat')
privatekey = os.path.join(config_path, 'privatekey.dat')
return (deviceid, privatekey) | def get_default_auth_files():
config_path = os.path.join(os.path.expanduser('~'), '.dpapp')
os.makedirs(config_path, exist_ok=True)
deviceid = os.path.join(config_path, 'deviceid.dat')
privatekey = os.path.join(config_path, 'privatekey.dat')
return (deviceid, privatekey)<|docstring|>Get the def... |
635b41e8aa6cc65f0ec01318ca016f764b6cff82944dd3b2faaac1876da3ece1 | def find_auth_files():
"Search for authentication files for connecting to DPT-RP1, both in default path and in paths from Sony's Digital Paper App"
(deviceid, privatekey) = get_default_auth_files()
if ((not os.path.exists(deviceid)) or (not os.path.exists(privatekey))):
search_paths = [os.path.join(... | Search for authentication files for connecting to DPT-RP1, both in default path and in paths from Sony's Digital Paper App | dptrp1/dptrp1.py | find_auth_files | hitmoon/dpt-rp1-py | 0 | python | def find_auth_files():
(deviceid, privatekey) = get_default_auth_files()
if ((not os.path.exists(deviceid)) or (not os.path.exists(privatekey))):
search_paths = [os.path.join(os.path.expanduser('~'), 'Library/Application Support/Sony Corporation/Digital Paper App'), os.path.join(os.path.expanduser(... | def find_auth_files():
(deviceid, privatekey) = get_default_auth_files()
if ((not os.path.exists(deviceid)) or (not os.path.exists(privatekey))):
search_paths = [os.path.join(os.path.expanduser('~'), 'Library/Application Support/Sony Corporation/Digital Paper App'), os.path.join(os.path.expanduser(... |
231f9b492a0454af727532f0cd924f58ec33939be8d706ab2b4352b7a23a7b31 | def pad(bytestring, k=16):
'\n Pad an input bytestring according to PKCS#7\n\n '
l = len(bytestring)
val = (k - (l % k))
return (bytestring + bytearray(([val] * val))) | Pad an input bytestring according to PKCS#7 | dptrp1/dptrp1.py | pad | hitmoon/dpt-rp1-py | 0 | python | def pad(bytestring, k=16):
'\n \n\n '
l = len(bytestring)
val = (k - (l % k))
return (bytestring + bytearray(([val] * val))) | def pad(bytestring, k=16):
'\n \n\n '
l = len(bytestring)
val = (k - (l % k))
return (bytestring + bytearray(([val] * val)))<|docstring|>Pad an input bytestring according to PKCS#7<|endoftext|> |
0179381cabfaf38193b396966b75bc69c4e968b08af86f387d7cc0c11243759d | def unpad(bytestring, k=16):
'\n Remove the PKCS#7 padding from a text bytestring.\n '
val = bytestring[(- 1)]
if (val > k):
raise ValueError('Input is not padded or padding is corrupt')
l = (len(bytestring) - val)
return bytestring[:l] | Remove the PKCS#7 padding from a text bytestring. | dptrp1/dptrp1.py | unpad | hitmoon/dpt-rp1-py | 0 | python | def unpad(bytestring, k=16):
'\n \n '
val = bytestring[(- 1)]
if (val > k):
raise ValueError('Input is not padded or padding is corrupt')
l = (len(bytestring) - val)
return bytestring[:l] | def unpad(bytestring, k=16):
'\n \n '
val = bytestring[(- 1)]
if (val > k):
raise ValueError('Input is not padded or padding is corrupt')
l = (len(bytestring) - val)
return bytestring[:l]<|docstring|>Remove the PKCS#7 padding from a text bytestring.<|endoftext|> |
071ac130a5b2367f38d3c87075c58c24c108789dff0fa93c2a5d20ae23f6e3c0 | def register(self):
'\n Gets authentication info from a DPT-RP1. You can call this BEFORE\n DigitalPaper.authenticate()\n\n Returns (ca, priv_key, client_id):\n - ca: a PEM-encoded X.509 server certificate, issued by the CA\n on the device\n - priv_key: a... | Gets authentication info from a DPT-RP1. You can call this BEFORE
DigitalPaper.authenticate()
Returns (ca, priv_key, client_id):
- ca: a PEM-encoded X.509 server certificate, issued by the CA
on the device
- priv_key: a PEM-encoded 2048-bit RSA private key
- client_id: the client id | dptrp1/dptrp1.py | register | hitmoon/dpt-rp1-py | 0 | python | def register(self):
'\n Gets authentication info from a DPT-RP1. You can call this BEFORE\n DigitalPaper.authenticate()\n\n Returns (ca, priv_key, client_id):\n - ca: a PEM-encoded X.509 server certificate, issued by the CA\n on the device\n - priv_key: a... | def register(self):
'\n Gets authentication info from a DPT-RP1. You can call this BEFORE\n DigitalPaper.authenticate()\n\n Returns (ca, priv_key, client_id):\n - ca: a PEM-encoded X.509 server certificate, issued by the CA\n on the device\n - priv_key: a... |
0fdbd05c73377194e6c88748b406bbc1e1f7e695d512234d1fd873245cd62835 | def copy_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Copies a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._post_endpoint(f'... | Copies a file with given file_id to a folder with given folder_id.
If new_filename is given, rename the file. | dptrp1/dptrp1.py | copy_file_to_folder_by_id | hitmoon/dpt-rp1-py | 0 | python | def copy_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Copies a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._post_endpoint(f'... | def copy_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Copies a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._post_endpoint(f'... |
8044d14cf429d748447600d8668baeded686a98b18acc20f4a9fabb10b03a8c7 | def move_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Moves a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._put_endpoint(f'/d... | Moves a file with given file_id to a folder with given folder_id.
If new_filename is given, rename the file. | dptrp1/dptrp1.py | move_file_to_folder_by_id | hitmoon/dpt-rp1-py | 0 | python | def move_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Moves a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._put_endpoint(f'/d... | def move_file_to_folder_by_id(self, file_id, folder_id, new_filename=None):
'\n Moves a file with given file_id to a folder with given folder_id.\n If new_filename is given, rename the file.\n '
data = self._copy_move_data(file_id, folder_id, new_filename)
return self._put_endpoint(f'/d... |
699a193edd7659aaeaefbe41db04e1cbefbf7d23aefe9b20e06521c5d384bf93 | def copy_file(self, old_path, new_path):
'\n Copies a file with given path to a new path.\n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
self.copy_file_to_folder_by_id(old_id, new_folder_id, new_filename) | Copies a file with given path to a new path. | dptrp1/dptrp1.py | copy_file | hitmoon/dpt-rp1-py | 0 | python | def copy_file(self, old_path, new_path):
'\n \n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
self.copy_file_to_folder_by_id(old_id, new_folder_id, new_filename) | def copy_file(self, old_path, new_path):
'\n \n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
self.copy_file_to_folder_by_id(old_id, new_folder_id, new_filename)<|docstring|>Copies a file with given path to a new path.<|endoftext|> |
226d62d5127f5351d92827c6febc9e6649010c20bbb4bdc464580dfb19980fc0 | def move_file(self, old_path, new_path):
'\n Moves a file with given path to a new path.\n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
return self.move_file_to_folder_by_id(old_id, new_folder_id, new_filename) | Moves a file with given path to a new path. | dptrp1/dptrp1.py | move_file | hitmoon/dpt-rp1-py | 0 | python | def move_file(self, old_path, new_path):
'\n \n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
return self.move_file_to_folder_by_id(old_id, new_folder_id, new_filename) | def move_file(self, old_path, new_path):
'\n \n '
(old_id, new_folder_id, new_filename) = self._copy_move_find_ids(old_path, new_path)
return self.move_file_to_folder_by_id(old_id, new_folder_id, new_filename)<|docstring|>Moves a file with given path to a new path.<|endoftext|> |
906d40835ae91ab9845847275ad46eef2cb8e895ac6364d5853e7c18c040fa8a | def ping(self):
'\n Returns True if we are authenticated.\n '
url = f'{self.base_url}/ping'
r = self.session.get(url)
return r.ok | Returns True if we are authenticated. | dptrp1/dptrp1.py | ping | hitmoon/dpt-rp1-py | 0 | python | def ping(self):
'\n \n '
url = f'{self.base_url}/ping'
r = self.session.get(url)
return r.ok | def ping(self):
'\n \n '
url = f'{self.base_url}/ping'
r = self.session.get(url)
return r.ok<|docstring|>Returns True if we are authenticated.<|endoftext|> |
e73ca4f3382322d7d493a3c9a52f4675398044c3b9f8e87cc6e34677351ef57a | def _debug_net(pooling, *args, **kwargs):
'Small net for debugging.'
del args, kwargs
final_shape = ([(- 1), 1] if pooling else [(- 1), 1, 1, 1])
layers = [tf.keras.layers.Lambda((lambda x: tf.reshape(tf.reduce_mean(x, axis=[1, 2, 3]), final_shape)))]
return tf.keras.Sequential(layers) | Small net for debugging. | non_semantic_speech_benchmark/distillation/models.py | _debug_net | suryatmodulus/google-research | 2 | python | def _debug_net(pooling, *args, **kwargs):
del args, kwargs
final_shape = ([(- 1), 1] if pooling else [(- 1), 1, 1, 1])
layers = [tf.keras.layers.Lambda((lambda x: tf.reshape(tf.reduce_mean(x, axis=[1, 2, 3]), final_shape)))]
return tf.keras.Sequential(layers) | def _debug_net(pooling, *args, **kwargs):
del args, kwargs
final_shape = ([(- 1), 1] if pooling else [(- 1), 1, 1, 1])
layers = [tf.keras.layers.Lambda((lambda x: tf.reshape(tf.reduce_mean(x, axis=[1, 2, 3]), final_shape)))]
return tf.keras.Sequential(layers)<|docstring|>Small net for debugging.<|e... |
a9aac52149aabaa978376bdf3cfeb1eb11e59489d3f1a64cf6d55de0461568a1 | def get_keras_model(model_type, output_dimension, truncate_output=False, frontend=True, tflite=False, spec_augment=False):
'Make a Keras student model.'
logging.info('model name: %s', model_type)
logging.info('truncate_output: %s', truncate_output)
logging.info('output_dimension: %i', output_dimension)
... | Make a Keras student model. | non_semantic_speech_benchmark/distillation/models.py | get_keras_model | suryatmodulus/google-research | 2 | python | def get_keras_model(model_type, output_dimension, truncate_output=False, frontend=True, tflite=False, spec_augment=False):
logging.info('model name: %s', model_type)
logging.info('truncate_output: %s', truncate_output)
logging.info('output_dimension: %i', output_dimension)
logging.info('frontend: %... | def get_keras_model(model_type, output_dimension, truncate_output=False, frontend=True, tflite=False, spec_augment=False):
logging.info('model name: %s', model_type)
logging.info('truncate_output: %s', truncate_output)
logging.info('output_dimension: %i', output_dimension)
logging.info('frontend: %... |
4822531a297ad0dc152831b5f847383d5ac8e40ebd5a2a75ad9c02442aeaf0f1 | def _frontend_keras(frontend, tflite):
'Returns model input and features.'
num_batches = (1 if tflite else None)
frontend_args = frontend_lib.frontend_args_from_flags()
feats_inner_dim = frontend_lib.get_frontend_output_shape()[0]
if frontend:
logging.info('frontend_args: %s', frontend_args)... | Returns model input and features. | non_semantic_speech_benchmark/distillation/models.py | _frontend_keras | suryatmodulus/google-research | 2 | python | def _frontend_keras(frontend, tflite):
num_batches = (1 if tflite else None)
frontend_args = frontend_lib.frontend_args_from_flags()
feats_inner_dim = frontend_lib.get_frontend_output_shape()[0]
if frontend:
logging.info('frontend_args: %s', frontend_args)
model_in = tf.keras.Input(... | def _frontend_keras(frontend, tflite):
num_batches = (1 if tflite else None)
frontend_args = frontend_lib.frontend_args_from_flags()
feats_inner_dim = frontend_lib.get_frontend_output_shape()[0]
if frontend:
logging.info('frontend_args: %s', frontend_args)
model_in = tf.keras.Input(... |
c3c721ceb70894b2acb198a416fea8139ae24dedbe95bf62180347217b0963f1 | def _build_main_net(model_type, feats):
'Constructs main network.'
if model_type.startswith('mobilenet_'):
(_, mobilenet_size, alpha, avg_pool) = model_type.split('_')
alpha = float(alpha)
avg_pool = bool(avg_pool)
logging.info('mobilenet_size: %s', mobilenet_size)
loggin... | Constructs main network. | non_semantic_speech_benchmark/distillation/models.py | _build_main_net | suryatmodulus/google-research | 2 | python | def _build_main_net(model_type, feats):
if model_type.startswith('mobilenet_'):
(_, mobilenet_size, alpha, avg_pool) = model_type.split('_')
alpha = float(alpha)
avg_pool = bool(avg_pool)
logging.info('mobilenet_size: %s', mobilenet_size)
logging.info('alpha: %f', alpha)... | def _build_main_net(model_type, feats):
if model_type.startswith('mobilenet_'):
(_, mobilenet_size, alpha, avg_pool) = model_type.split('_')
alpha = float(alpha)
avg_pool = bool(avg_pool)
logging.info('mobilenet_size: %s', mobilenet_size)
logging.info('alpha: %f', alpha)... |
156144484f0f1d8605251ea3e964b457e05c845925ca71130977d18524986fee | def plot_model_predictions(name, predicted, actual, log=False, ax=None):
'Plots the predictions of a machine learning model.\n \n Create a scatter plot of machine learning model predictions vs.\n actual values from the data set along with a diagonal line showing\n where perfect agreement would be. \n ... | Plots the predictions of a machine learning model.
Create a scatter plot of machine learning model predictions vs.
actual values from the data set along with a diagonal line showing
where perfect agreement would be.
Args:
name(str): The name of the value being predicted.
predicted(array_like): The set o... | rectool/plot.py | plot_model_predictions | JBEI/Ajinomoto | 0 | python | def plot_model_predictions(name, predicted, actual, log=False, ax=None):
'Plots the predictions of a machine learning model.\n \n Create a scatter plot of machine learning model predictions vs.\n actual values from the data set along with a diagonal line showing\n where perfect agreement would be. \n ... | def plot_model_predictions(name, predicted, actual, log=False, ax=None):
'Plots the predictions of a machine learning model.\n \n Create a scatter plot of machine learning model predictions vs.\n actual values from the data set along with a diagonal line showing\n where perfect agreement would be. \n ... |
19e3f4beabd6dc7421457d0a2e62c14ac067154c1ffffac590c638d63fc77e0c | def plot_model(model, data, targets, midpoint=0.1, title=None, zlabel=None, ax=None, pcs=None, plot_points=True):
'Plots a heatmap representing a machine learning model and overlays training data on top.\n \n A heatmap of a machine learning model is generated to better understand how the model performs. \n ... | Plots a heatmap representing a machine learning model and overlays training data on top.
A heatmap of a machine learning model is generated to better understand how the model performs.
In order to deal with higher dimentional feature spaces, principal component analysis is used
to reduce the feature space to the two ... | rectool/plot.py | plot_model | JBEI/Ajinomoto | 0 | python | def plot_model(model, data, targets, midpoint=0.1, title=None, zlabel=None, ax=None, pcs=None, plot_points=True):
'Plots a heatmap representing a machine learning model and overlays training data on top.\n \n A heatmap of a machine learning model is generated to better understand how the model performs. \n ... | def plot_model(model, data, targets, midpoint=0.1, title=None, zlabel=None, ax=None, pcs=None, plot_points=True):
'Plots a heatmap representing a machine learning model and overlays training data on top.\n \n A heatmap of a machine learning model is generated to better understand how the model performs. \n ... |
5db09edb6f905c7382c430be94ab06bc4f2f82c5829902b223755ee61ae14c8e | def shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'\n Function to offset the "center" of a colormap. Useful for\n data with a negative min and positive max and you want the\n middle of the colormap\'s dynamic range to be at zero\n\n Input\n -----\n cmap : The matplo... | Function to offset the "center" of a colormap. Useful for
data with a negative min and positive max and you want the
middle of the colormap's dynamic range to be at zero
Input
-----
cmap : The matplotlib colormap to be altered
start : Offset from lowest point in the colormap's range.
Defaults to 0.0 (no lowe... | rectool/plot.py | shiftedColorMap | JBEI/Ajinomoto | 0 | python | def shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'\n Function to offset the "center" of a colormap. Useful for\n data with a negative min and positive max and you want the\n middle of the colormap\'s dynamic range to be at zero\n\n Input\n -----\n cmap : The matplo... | def shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'\n Function to offset the "center" of a colormap. Useful for\n data with a negative min and positive max and you want the\n middle of the colormap\'s dynamic range to be at zero\n\n Input\n -----\n cmap : The matplo... |
049bc02c03ac3267ff3fa28a6bf474019714633662869ee099b0789c7a3d4f3b | def test_error_3():
' This should work\n '
try:
connect_and_list('edison.nersc.gov', 'yadunand')
except BadHostKeyException as e:
print('Caught exception BadHostKeyException: ', e)
else:
assert False, 'Expected SSException, got: {0}'.format(e) | This should work | parsl/tests/integration/test_channels/test_ssh_errors.py | test_error_3 | nirandaperera/parsl | 323 | python | def test_error_3():
' \n '
try:
connect_and_list('edison.nersc.gov', 'yadunand')
except BadHostKeyException as e:
print('Caught exception BadHostKeyException: ', e)
else:
assert False, 'Expected SSException, got: {0}'.format(e) | def test_error_3():
' \n '
try:
connect_and_list('edison.nersc.gov', 'yadunand')
except BadHostKeyException as e:
print('Caught exception BadHostKeyException: ', e)
else:
assert False, 'Expected SSException, got: {0}'.format(e)<|docstring|>This should work<|endoftext|> |
5f8268a06fe42e7d7785a7a10dfa376a5ba5d14eeff1178b440084938ab57617 | def _init_decode_head(self, decode_head):
'Initialize ``decode_head``'
self.decode_head = builder.build_head(decode_head)
self.align_corners = self.decode_head.align_corners
self.num_classes = self.decode_head.num_classes | Initialize ``decode_head`` | mmseg/models/segmentors/encoder_decoder.py | _init_decode_head | delldu/SegFormer | 0 | python | def _init_decode_head(self, decode_head):
self.decode_head = builder.build_head(decode_head)
self.align_corners = self.decode_head.align_corners
self.num_classes = self.decode_head.num_classes | def _init_decode_head(self, decode_head):
self.decode_head = builder.build_head(decode_head)
self.align_corners = self.decode_head.align_corners
self.num_classes = self.decode_head.num_classes<|docstring|>Initialize ``decode_head``<|endoftext|> |
8d721d005e5ded21f20dc3c05cfc41840764f6917cba674962022e8dbaf4946f | def init_weights(self, pretrained=None):
'Initialize the weights in backbone and heads.\n\n Args:\n pretrained (str, optional): Path to pre-trained weights.\n Defaults to None.\n '
super(EncoderDecoder, self).init_weights(pretrained)
self.backbone.init_weights(pretrai... | Initialize the weights in backbone and heads.
Args:
pretrained (str, optional): Path to pre-trained weights.
Defaults to None. | mmseg/models/segmentors/encoder_decoder.py | init_weights | delldu/SegFormer | 0 | python | def init_weights(self, pretrained=None):
'Initialize the weights in backbone and heads.\n\n Args:\n pretrained (str, optional): Path to pre-trained weights.\n Defaults to None.\n '
super(EncoderDecoder, self).init_weights(pretrained)
self.backbone.init_weights(pretrai... | def init_weights(self, pretrained=None):
'Initialize the weights in backbone and heads.\n\n Args:\n pretrained (str, optional): Path to pre-trained weights.\n Defaults to None.\n '
super(EncoderDecoder, self).init_weights(pretrained)
self.backbone.init_weights(pretrai... |
b2bc6b5eaac59c0950d23f850041f8a11273aacbe48a1f2efb81bfdeef3f92a9 | def inference(self, img, img_meta, rescale):
"Inference with slide/whole style.\n\n Args:\n img (Tensor): The input image of shape (N, 3, H, W).\n img_meta (dict): Image info dict where each dict has: 'img_shape',\n 'scale_factor', 'flip', and may also contain\n ... | Inference with slide/whole style.
Args:
img (Tensor): The input image of shape (N, 3, H, W).
img_meta (dict): Image info dict where each dict has: 'img_shape',
'scale_factor', 'flip', and may also contain
'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
For details on the value... | mmseg/models/segmentors/encoder_decoder.py | inference | delldu/SegFormer | 0 | python | def inference(self, img, img_meta, rescale):
"Inference with slide/whole style.\n\n Args:\n img (Tensor): The input image of shape (N, 3, H, W).\n img_meta (dict): Image info dict where each dict has: 'img_shape',\n 'scale_factor', 'flip', and may also contain\n ... | def inference(self, img, img_meta, rescale):
"Inference with slide/whole style.\n\n Args:\n img (Tensor): The input image of shape (N, 3, H, W).\n img_meta (dict): Image info dict where each dict has: 'img_shape',\n 'scale_factor', 'flip', and may also contain\n ... |
ad8228af16e462e8fd8486b3a654fbde5bbb877f98958f7fa9ee2f46611e782d | def simple_test(self, img, img_meta, rescale=True):
'Simple test with single image.'
seg_logit = self.inference(img, img_meta, rescale)
seg_pred = seg_logit.argmax(dim=1)
if torch.onnx.is_in_onnx_export():
seg_pred = seg_pred.unsqueeze(0)
return seg_pred
seg_pred = seg_pred.cpu().num... | Simple test with single image. | mmseg/models/segmentors/encoder_decoder.py | simple_test | delldu/SegFormer | 0 | python | def simple_test(self, img, img_meta, rescale=True):
seg_logit = self.inference(img, img_meta, rescale)
seg_pred = seg_logit.argmax(dim=1)
if torch.onnx.is_in_onnx_export():
seg_pred = seg_pred.unsqueeze(0)
return seg_pred
seg_pred = seg_pred.cpu().numpy()
seg_pred = list(seg_pre... | def simple_test(self, img, img_meta, rescale=True):
seg_logit = self.inference(img, img_meta, rescale)
seg_pred = seg_logit.argmax(dim=1)
if torch.onnx.is_in_onnx_export():
seg_pred = seg_pred.unsqueeze(0)
return seg_pred
seg_pred = seg_pred.cpu().numpy()
seg_pred = list(seg_pre... |
1ae9a8cb1730e0a9167c2f64c0cf144505cc2080180bb3d655a0de65476e89a5 | def open(self, comp_filepath, length_unit='DimMeter', angle_unit='DimDegree', study_type='Transient'):
'Open an existing JMAG file or a create new one if file does not exist.\n\n Launches the JMAG application by opening an already created file if or by creating a new file. Assigns JMAG\n application h... | Open an existing JMAG file or a create new one if file does not exist.
Launches the JMAG application by opening an already created file if or by creating a new file. Assigns JMAG
application handles to object attributes for future operations. If intended file path does not exist and could
not be created, an error is r... | mach_cad/tools/jmag/jmag.py | open | Severson-Group/MachEval | 6 | python | def open(self, comp_filepath, length_unit='DimMeter', angle_unit='DimDegree', study_type='Transient'):
'Open an existing JMAG file or a create new one if file does not exist.\n\n Launches the JMAG application by opening an already created file if or by creating a new file. Assigns JMAG\n application h... | def open(self, comp_filepath, length_unit='DimMeter', angle_unit='DimDegree', study_type='Transient'):
'Open an existing JMAG file or a create new one if file does not exist.\n\n Launches the JMAG application by opening an already created file if or by creating a new file. Assigns JMAG\n application h... |
c35ff2a9d25998e7f3bbbb5767115964839d5438109cbc99c2d40226f10b615a | def save(self):
'Save JMAG designer file at previously defined path'
if (type(self.filepath) is str):
self.jd.SaveAs(self.filepath)
else:
raise AttributeError('Unable to save file. Use the save_as() function') | Save JMAG designer file at previously defined path | mach_cad/tools/jmag/jmag.py | save | Severson-Group/MachEval | 6 | python | def save(self):
if (type(self.filepath) is str):
self.jd.SaveAs(self.filepath)
else:
raise AttributeError('Unable to save file. Use the save_as() function') | def save(self):
if (type(self.filepath) is str):
self.jd.SaveAs(self.filepath)
else:
raise AttributeError('Unable to save file. Use the save_as() function')<|docstring|>Save JMAG designer file at previously defined path<|endoftext|> |
4ccbadba9429f6271ef0e3c6e119a1133d67c8713104104f9be3ca26c5ae69b7 | def save_as(self, filepath):
'Save JMAG designer file at defined path'
self.filepath = filepath
self.save() | Save JMAG designer file at defined path | mach_cad/tools/jmag/jmag.py | save_as | Severson-Group/MachEval | 6 | python | def save_as(self, filepath):
self.filepath = filepath
self.save() | def save_as(self, filepath):
self.filepath = filepath
self.save()<|docstring|>Save JMAG designer file at defined path<|endoftext|> |
b7b0008596b51009617022e5da75b72e366291fcaf74c61d94547d1805950856 | def close(self):
'Close JMAG designer file and all associated applications'
del self | Close JMAG designer file and all associated applications | mach_cad/tools/jmag/jmag.py | close | Severson-Group/MachEval | 6 | python | def close(self):
del self | def close(self):
del self<|docstring|>Close JMAG designer file and all associated applications<|endoftext|> |
90df6a4a4f0896e927a5b3e5d22528895c09beb48d732e1802fcbf73503cd733 | def set_visibility(self, visible):
'Set JMAG designer file visibility by passing True or False to visible'
self.visible = visible
if self.visible:
self.jd.Show()
else:
self.jd.Hide() | Set JMAG designer file visibility by passing True or False to visible | mach_cad/tools/jmag/jmag.py | set_visibility | Severson-Group/MachEval | 6 | python | def set_visibility(self, visible):
self.visible = visible
if self.visible:
self.jd.Show()
else:
self.jd.Hide() | def set_visibility(self, visible):
self.visible = visible
if self.visible:
self.jd.Show()
else:
self.jd.Hide()<|docstring|>Set JMAG designer file visibility by passing True or False to visible<|endoftext|> |
41eb023aecf1d748027afdcdc5072697f56c603de5757950f4a6f45a8a7b7af6 | def draw_line(self, startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw a line in JMAG Geometry Editor.\n\n Args:\n startxy: Start point of line. Should be of type Location2D defined with eMach DimLinear.\n endxy: End point of the. Should be of type Location2D defined with... | Draw a line in JMAG Geometry Editor.
Args:
startxy: Start point of line. Should be of type Location2D defined with eMach DimLinear.
endxy: End point of the. Should be of type Location2D defined with eMach DimLinear.
Returns:
TokenDraw: Wrapper object holding return values obtained upon drawing a line. | mach_cad/tools/jmag/jmag.py | draw_line | Severson-Group/MachEval | 6 | python | def draw_line(self, startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw a line in JMAG Geometry Editor.\n\n Args:\n startxy: Start point of line. Should be of type Location2D defined with eMach DimLinear.\n endxy: End point of the. Should be of type Location2D defined with... | def draw_line(self, startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw a line in JMAG Geometry Editor.\n\n Args:\n startxy: Start point of line. Should be of type Location2D defined with eMach DimLinear.\n endxy: End point of the. Should be of type Location2D defined with... |
bf39bc813e74542e0c01ce35fa796e7594fa450db6a86457142ba9bc41e665d4 | def draw_arc(self, centerxy: 'Location2D', startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw an arc in JMAG Geometry Editor.\n\n Args:\n centerxy: Centre point of arc. Should be of type Location2D defined with eMach Dimensions.\n startxy: Start point of arc. Should be of... | Draw an arc in JMAG Geometry Editor.
Args:
centerxy: Centre point of arc. Should be of type Location2D defined with eMach Dimensions.
startxy: Start point of arc. Should be of type Location2D defined with eMach Dimensions.
endxy: End point of arc. Should be of type Location2D defined with eMach Dimensions.... | mach_cad/tools/jmag/jmag.py | draw_arc | Severson-Group/MachEval | 6 | python | def draw_arc(self, centerxy: 'Location2D', startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw an arc in JMAG Geometry Editor.\n\n Args:\n centerxy: Centre point of arc. Should be of type Location2D defined with eMach Dimensions.\n startxy: Start point of arc. Should be of... | def draw_arc(self, centerxy: 'Location2D', startxy: 'Location2D', endxy: 'Location2D') -> 'TokenDraw':
'Draw an arc in JMAG Geometry Editor.\n\n Args:\n centerxy: Centre point of arc. Should be of type Location2D defined with eMach Dimensions.\n startxy: Start point of arc. Should be of... |
c76a72083a21f4d74bf6d6183a8c571bfd2e6c9d46dc41ae36c2e5f0aceea12c | def create_sketch(self):
'Create and open a new sketch in JMAG geometry editor'
ref1 = self.assembly.GetItem('XY Plane')
ref2 = self.doc.CreateReferenceFromItem(ref1)
sketch = self.assembly.CreateSketch(ref2)
sketch_name = 'sketch_drawing'
sketch.SetProperty('Name', sketch_name)
sketch.OpenS... | Create and open a new sketch in JMAG geometry editor | mach_cad/tools/jmag/jmag.py | create_sketch | Severson-Group/MachEval | 6 | python | def create_sketch(self):
ref1 = self.assembly.GetItem('XY Plane')
ref2 = self.doc.CreateReferenceFromItem(ref1)
sketch = self.assembly.CreateSketch(ref2)
sketch_name = 'sketch_drawing'
sketch.SetProperty('Name', sketch_name)
sketch.OpenSketch()
return sketch | def create_sketch(self):
ref1 = self.assembly.GetItem('XY Plane')
ref2 = self.doc.CreateReferenceFromItem(ref1)
sketch = self.assembly.CreateSketch(ref2)
sketch_name = 'sketch_drawing'
sketch.SetProperty('Name', sketch_name)
sketch.OpenSketch()
return sketch<|docstring|>Create and open ... |
f8f1f22252e1f6db5a84a180154f4a9b2f360a6187abf12a0932bba1d4d47566 | def create_part(self):
'Create a new part in JMAG geometry editor'
sketch_name = 'sketch_drawing'
self.sketch.OpenSketch()
ref1 = self.assembly.GetItem(sketch_name)
ref2 = self.doc.CreateReferenceFromItem(ref1)
self.assembly.MoveToPart(ref2)
part = self.assembly.GetItem(sketch_name)
self... | Create a new part in JMAG geometry editor | mach_cad/tools/jmag/jmag.py | create_part | Severson-Group/MachEval | 6 | python | def create_part(self):
sketch_name = 'sketch_drawing'
self.sketch.OpenSketch()
ref1 = self.assembly.GetItem(sketch_name)
ref2 = self.doc.CreateReferenceFromItem(ref1)
self.assembly.MoveToPart(ref2)
part = self.assembly.GetItem(sketch_name)
self.sketch.CloseSketch()
return part | def create_part(self):
sketch_name = 'sketch_drawing'
self.sketch.OpenSketch()
ref1 = self.assembly.GetItem(sketch_name)
ref2 = self.doc.CreateReferenceFromItem(ref1)
self.assembly.MoveToPart(ref2)
part = self.assembly.GetItem(sketch_name)
self.sketch.CloseSketch()
return part<|docs... |
7f088ea947e5cc14ac60ccb7ae8fd846f29476ad7c3fdba0087ebcf7b1500112 | def prepare_section(self, cs_token: 'CrossSectToken') -> TokenMake:
' Creates JMAG geometry region using lines and arcs.\n '
self.geometry_editor.View().Xy()
self.doc.GetSelection().Clear()
for i in range(len(cs_token.token)):
self.doc.GetSelection().Add(self.sketch.GetItem(cs_token.token... | Creates JMAG geometry region using lines and arcs. | mach_cad/tools/jmag/jmag.py | prepare_section | Severson-Group/MachEval | 6 | python | def prepare_section(self, cs_token: 'CrossSectToken') -> TokenMake:
' \n '
self.geometry_editor.View().Xy()
self.doc.GetSelection().Clear()
for i in range(len(cs_token.token)):
self.doc.GetSelection().Add(self.sketch.GetItem(cs_token.token[i].draw_token.GetName()))
id = self.sketch.Nu... | def prepare_section(self, cs_token: 'CrossSectToken') -> TokenMake:
' \n '
self.geometry_editor.View().Xy()
self.doc.GetSelection().Clear()
for i in range(len(cs_token.token)):
self.doc.GetSelection().Add(self.sketch.GetItem(cs_token.token[i].draw_token.GetName()))
id = self.sketch.Nu... |
39bcbc5a554e564141e74e9e0ac4f453066f75bb0203fe60861c7961c49bbed8 | def create_study(self, study_name, study_type, model) -> any:
'Creates a JMAG study\n '
self.study_type = study_type
num_studies = self.jd.NumStudies()
if (num_studies == 0):
study = model.CreateStudy(study_type, study_name)
else:
for i in range((num_studies - 2)):
... | Creates a JMAG study | mach_cad/tools/jmag/jmag.py | create_study | Severson-Group/MachEval | 6 | python | def create_study(self, study_name, study_type, model) -> any:
'\n '
self.study_type = study_type
num_studies = self.jd.NumStudies()
if (num_studies == 0):
study = model.CreateStudy(study_type, study_name)
else:
for i in range((num_studies - 2)):
model.DeleteStudy(i... | def create_study(self, study_name, study_type, model) -> any:
'\n '
self.study_type = study_type
num_studies = self.jd.NumStudies()
if (num_studies == 0):
study = model.CreateStudy(study_type, study_name)
else:
for i in range((num_studies - 2)):
model.DeleteStudy(i... |
2eb7759b03036cf37822603f355607134f2a1e73260422a940d8108127bd783b | def extrude(self, name, material: str, depth: float, token=None) -> any:
' Extrudes a cross-section to a 3D component\n\n Args:\n name: name of the newly extruded component.\n depth: Depth of extrusion. Should be defined with eMach Dimensions.\n material : Material applied to... | Extrudes a cross-section to a 3D component
Args:
name: name of the newly extruded component.
depth: Depth of extrusion. Should be defined with eMach Dimensions.
material : Material applied to the extruded component.
Returns:
Function will return the handle to the new extruded part | mach_cad/tools/jmag/jmag.py | extrude | Severson-Group/MachEval | 6 | python | def extrude(self, name, material: str, depth: float, token=None) -> any:
' Extrudes a cross-section to a 3D component\n\n Args:\n name: name of the newly extruded component.\n depth: Depth of extrusion. Should be defined with eMach Dimensions.\n material : Material applied to... | def extrude(self, name, material: str, depth: float, token=None) -> any:
' Extrudes a cross-section to a 3D component\n\n Args:\n name: name of the newly extruded component.\n depth: Depth of extrusion. Should be defined with eMach Dimensions.\n material : Material applied to... |
5e16351351a32561d6b302d7d25ad7ff24de2a506862ff7f9e0eed62ee59eeae | def revolve(self, name, material: str, center, axis, angle: float) -> any:
' Revolves cross-section along an arc\n\n Args:\n name: Name of the newly revolved component.\n material: Material applied to the component.\n center: center point of rotation. Should be of type Locati... | Revolves cross-section along an arc
Args:
name: Name of the newly revolved component.
material: Material applied to the component.
center: center point of rotation. Should be of type Location2d defined with eMach Dimensions.
axis: Axis of rotation. Should be of type Location2d defined with eMach Dimens... | mach_cad/tools/jmag/jmag.py | revolve | Severson-Group/MachEval | 6 | python | def revolve(self, name, material: str, center, axis, angle: float) -> any:
' Revolves cross-section along an arc\n\n Args:\n name: Name of the newly revolved component.\n material: Material applied to the component.\n center: center point of rotation. Should be of type Locati... | def revolve(self, name, material: str, center, axis, angle: float) -> any:
' Revolves cross-section along an arc\n\n Args:\n name: Name of the newly revolved component.\n material: Material applied to the component.\n center: center point of rotation. Should be of type Locati... |
f6b5a5b3c33923241f50c080f54bf13bd66aae610689177e8a253cdce175b673 | def set_default_length_unit(self, user_unit):
'Set the default length unit in JMAG. Only DimMeter supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit == ... | Set the default length unit in JMAG. Only DimMeter supported.
Args:
user_unit: String representing the unit the user wishes to set as default.
Raises:
TypeError: Incorrect dimension passed | mach_cad/tools/jmag/jmag.py | set_default_length_unit | Severson-Group/MachEval | 6 | python | def set_default_length_unit(self, user_unit):
'Set the default length unit in JMAG. Only DimMeter supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit == ... | def set_default_length_unit(self, user_unit):
'Set the default length unit in JMAG. Only DimMeter supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit == ... |
81830dd6bb17ca667f6e08298d0d513210098438b3baaa232ec4961f777b907a | def set_default_angle_unit(self, user_unit):
'Set the default angular unit in JMAG. Only DimDegree supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit ==... | Set the default angular unit in JMAG. Only DimDegree supported.
Args:
user_unit: String representing the unit the user wishes to set as default.
Raises:
TypeError: Incorrect dimension passed | mach_cad/tools/jmag/jmag.py | set_default_angle_unit | Severson-Group/MachEval | 6 | python | def set_default_angle_unit(self, user_unit):
'Set the default angular unit in JMAG. Only DimDegree supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit ==... | def set_default_angle_unit(self, user_unit):
'Set the default angular unit in JMAG. Only DimDegree supported.\n\n Args:\n user_unit: String representing the unit the user wishes to set as default.\n\n Raises:\n TypeError: Incorrect dimension passed\n '
if (user_unit ==... |
d931416c1a416f6ac58e3bd18aea9b47d76147ac220c871070f35dc83f46ebcf | def save(self, filename):
'\n Saves the uploaded FileInput data to a file or BytesIO object.\n\n Arguments\n ---------\n filename (str): File path or file-like object\n '
if isinstance(filename, str):
with open(filename, 'wb') as f:
f.write(self.value)
... | Saves the uploaded FileInput data to a file or BytesIO object.
Arguments
---------
filename (str): File path or file-like object | panel/widgets/input.py | save | gnowland/panel | 1,130 | python | def save(self, filename):
'\n Saves the uploaded FileInput data to a file or BytesIO object.\n\n Arguments\n ---------\n filename (str): File path or file-like object\n '
if isinstance(filename, str):
with open(filename, 'wb') as f:
f.write(self.value)
... | def save(self, filename):
'\n Saves the uploaded FileInput data to a file or BytesIO object.\n\n Arguments\n ---------\n filename (str): File path or file-like object\n '
if isinstance(filename, str):
with open(filename, 'wb') as f:
f.write(self.value)
... |
a9697c11e482f1cea59956b6b0faa5a02499bb33850780a9e3e0034481686bde | def __init__(self, diveFolder='./'):
'Initiate camera and lock resources'
PiCamera.__init__(self)
self.diveFolder = diveFolder
self.deployed = False
self.last_access = 0
self.stream = None
self.thread = None
self.last_frame = None | Initiate camera and lock resources | deepi.py | __init__ | rshom/DEEPi | 1 | python | def __init__(self, diveFolder='./'):
PiCamera.__init__(self)
self.diveFolder = diveFolder
self.deployed = False
self.last_access = 0
self.stream = None
self.thread = None
self.last_frame = None | def __init__(self, diveFolder='./'):
PiCamera.__init__(self)
self.diveFolder = diveFolder
self.deployed = False
self.last_access = 0
self.stream = None
self.thread = None
self.last_frame = None<|docstring|>Initiate camera and lock resources<|endoftext|> |
5441b0af3e428a9c4be136ed816a28bc5e99818c358c677b6391359de9bdc885 | def close(self):
'Release all resources'
PiCamera.close(self) | Release all resources | deepi.py | close | rshom/DEEPi | 1 | python | def close(self):
PiCamera.close(self) | def close(self):
PiCamera.close(self)<|docstring|>Release all resources<|endoftext|> |
5271f769ff0c01445f1be831f444fed2c20787b280ebb4d0005b42c3852b95d8 | def update_frame(self):
'Continuous capture that saves the latest frame in memory.\n Any live stream applications will access this updating frame\n '
self.stream = io.BytesIO()
print('starting capture')
for _ in PiCamera.capture_continuous(self, self.stream, 'jpeg', use_video_port=True):
... | Continuous capture that saves the latest frame in memory.
Any live stream applications will access this updating frame | deepi.py | update_frame | rshom/DEEPi | 1 | python | def update_frame(self):
'Continuous capture that saves the latest frame in memory.\n Any live stream applications will access this updating frame\n '
self.stream = io.BytesIO()
print('starting capture')
for _ in PiCamera.capture_continuous(self, self.stream, 'jpeg', use_video_port=True):
... | def update_frame(self):
'Continuous capture that saves the latest frame in memory.\n Any live stream applications will access this updating frame\n '
self.stream = io.BytesIO()
print('starting capture')
for _ in PiCamera.capture_continuous(self, self.stream, 'jpeg', use_video_port=True):
... |
892a5cbb6c276ec502b6d470a1bea81cd5e4b05c2405c12985875c9f168e9e67 | def start_stream(self):
'Start and stop the threaded process for updating the live stream frame'
self.last_access = time.time()
if (self.thread is None):
self.thread = threading.Thread(target=self.update_frame)
self.thread.start()
while (self.last_frame is None):
time.sleep(0) | Start and stop the threaded process for updating the live stream frame | deepi.py | start_stream | rshom/DEEPi | 1 | python | def start_stream(self):
self.last_access = time.time()
if (self.thread is None):
self.thread = threading.Thread(target=self.update_frame)
self.thread.start()
while (self.last_frame is None):
time.sleep(0) | def start_stream(self):
self.last_access = time.time()
if (self.thread is None):
self.thread = threading.Thread(target=self.update_frame)
self.thread.start()
while (self.last_frame is None):
time.sleep(0)<|docstring|>Start and stop the threaded process for updating the live stre... |
bed23fce88f7e792bd8189d31bc3e8b99f93798f3ed0ebfb5f5da0c2d429c486 | def __enter__(self):
'Called whenever instance is opened using a with statement'
return self | Called whenever instance is opened using a with statement | deepi.py | __enter__ | rshom/DEEPi | 1 | python | def __enter__(self):
return self | def __enter__(self):
return self<|docstring|>Called whenever instance is opened using a with statement<|endoftext|> |
6aadb9e8bf9edea01ff903d8d903572e98560c98c7ad25e31a7de1ef906692ba | def __exit__(self, exc_type, exc_val, exc_tb):
'Close out anything necessary'
self.close() | Close out anything necessary | deepi.py | __exit__ | rshom/DEEPi | 1 | python | def __exit__(self, exc_type, exc_val, exc_tb):
self.close() | def __exit__(self, exc_type, exc_val, exc_tb):
self.close()<|docstring|>Close out anything necessary<|endoftext|> |
d5086c97c9adbc2c579753004248ecd55ba9a479bc2bd4d9f80ab32c73374fd7 | def what_are_we_looking_for(self, fct_name, verbose=False):
'returns the files we are looking for, for a functor in a module'
tb_name = self.get_tb_name()
if verbose:
print(("for the '%s' module and functor '%s' \nthe following files are looked for," % (tb_name, fct_name)))
print('from nt2 r... | returns the files we are looking for, for a functor in a module | script/python/lib/nt2_basics/nt2_tb_props.py | what_are_we_looking_for | timblechmann/nt2 | 2 | python | def what_are_we_looking_for(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
if verbose:
print(("for the '%s' module and functor '%s' \nthe following files are looked for," % (tb_name, fct_name)))
print('from nt2 root:')
r = []
for f in self.get_rel_tb_fcts_files(tb_name... | def what_are_we_looking_for(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
if verbose:
print(("for the '%s' module and functor '%s' \nthe following files are looked for," % (tb_name, fct_name)))
print('from nt2 root:')
r = []
for f in self.get_rel_tb_fcts_files(tb_name... |
7dd01966d290d1f11f2cd2796848bdb3bb433958d91aefa39ab91c10eeca266f | def who_is_here(self, fct_name, verbose=False):
'returns the files already present for a functor in a module'
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files exist:" % (tb_name, fct_name))
r = []
for f in self.get_rel_tb_fcts_files(tb_... | returns the files already present for a functor in a module | script/python/lib/nt2_basics/nt2_tb_props.py | who_is_here | timblechmann/nt2 | 2 | python | def who_is_here(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files exist:" % (tb_name, fct_name))
r = []
for f in self.get_rel_tb_fcts_files(tb_name, fct_name):
if re.match('doc|bench|unit', f):
... | def who_is_here(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files exist:" % (tb_name, fct_name))
r = []
for f in self.get_rel_tb_fcts_files(tb_name, fct_name):
if re.match('doc|bench|unit', f):
... |
8a4192190ca66ea06f8367c008649ef0440c166208ec8f466735b582f2d6d8d2 | def who_is_missing(self, fct_name, verbose=False):
'returns what files are potentially missing for a functor in a module'
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files are not defined:" % (tb_name, fct_name))
r = []
for f in self.get... | returns what files are potentially missing for a functor in a module | script/python/lib/nt2_basics/nt2_tb_props.py | who_is_missing | timblechmann/nt2 | 2 | python | def who_is_missing(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files are not defined:" % (tb_name, fct_name))
r = []
for f in self.get_rel_tb_fcts_files(tb_name, fct_name):
if re.match('doc|bench|... | def who_is_missing(self, fct_name, verbose=False):
tb_name = self.get_tb_name()
head = False
mes = ("for the '%s' module and functor '%s' \nthe following files are not defined:" % (tb_name, fct_name))
r = []
for f in self.get_rel_tb_fcts_files(tb_name, fct_name):
if re.match('doc|bench|... |
be46511750ba5c2d82e31a7972ec65738d14afa7384f12ac5b742d7646075318 | @abstractmethod
def load(self) -> None:
'\n Initialize the recognizer assets if needed.\n\n (e.g. machine learning models)\n ' | Initialize the recognizer assets if needed.
(e.g. machine learning models) | presidio-analyzer/presidio_analyzer/entity_recognizer.py | load | omri374/presidio | 68 | python | @abstractmethod
def load(self) -> None:
'\n Initialize the recognizer assets if needed.\n\n (e.g. machine learning models)\n ' | @abstractmethod
def load(self) -> None:
'\n Initialize the recognizer assets if needed.\n\n (e.g. machine learning models)\n '<|docstring|>Initialize the recognizer assets if needed.
(e.g. machine learning models)<|endoftext|> |
9a614dc2c993103b445166340debb30a5adbe561f374962eeea5ee08e038cc1d | @abstractmethod
def analyze(self, text: str, entities: List[str], nlp_artifacts: NlpArtifacts) -> List[RecognizerResult]:
'\n Analyze text to identify entities.\n\n :param text: The text to be analyzed\n :param entities: The list of entities this recognizer is able to detect\n :param nlp... | Analyze text to identify entities.
:param text: The text to be analyzed
:param entities: The list of entities this recognizer is able to detect
:param nlp_artifacts: A group of attributes which are the result of
an NLP process over the input text.
:return: List of results detected by this recognizer. | presidio-analyzer/presidio_analyzer/entity_recognizer.py | analyze | omri374/presidio | 68 | python | @abstractmethod
def analyze(self, text: str, entities: List[str], nlp_artifacts: NlpArtifacts) -> List[RecognizerResult]:
'\n Analyze text to identify entities.\n\n :param text: The text to be analyzed\n :param entities: The list of entities this recognizer is able to detect\n :param nlp... | @abstractmethod
def analyze(self, text: str, entities: List[str], nlp_artifacts: NlpArtifacts) -> List[RecognizerResult]:
'\n Analyze text to identify entities.\n\n :param text: The text to be analyzed\n :param entities: The list of entities this recognizer is able to detect\n :param nlp... |
c08e2950d90d722ba79955712fd49f2978e14347d64c2008a090b66f6dea8b01 | def enhance_using_context(self, text: str, raw_recognizer_results: List[RecognizerResult], other_raw_recognizer_results: List[RecognizerResult], nlp_artifacts: NlpArtifacts, context: Optional[List[str]]=None) -> List[RecognizerResult]:
"Enhance confidence score using context of the entity.\n\n Override this ... | Enhance confidence score using context of the entity.
Override this method in derived class in case a custom logic
is needed, otherwise return value will be equal to
raw_results.
in case a result score is boosted, derived class need to update
result.recognition_metadata[RecognizerResult.IS_SCORE_ENHANCED_BY_CONTEXT_K... | presidio-analyzer/presidio_analyzer/entity_recognizer.py | enhance_using_context | omri374/presidio | 68 | python | def enhance_using_context(self, text: str, raw_recognizer_results: List[RecognizerResult], other_raw_recognizer_results: List[RecognizerResult], nlp_artifacts: NlpArtifacts, context: Optional[List[str]]=None) -> List[RecognizerResult]:
"Enhance confidence score using context of the entity.\n\n Override this ... | def enhance_using_context(self, text: str, raw_recognizer_results: List[RecognizerResult], other_raw_recognizer_results: List[RecognizerResult], nlp_artifacts: NlpArtifacts, context: Optional[List[str]]=None) -> List[RecognizerResult]:
"Enhance confidence score using context of the entity.\n\n Override this ... |
92ed49b6317e14ee7756244668249ddcedb4ea4c94a354c75aef49eae6512f97 | def get_supported_entities(self) -> List[str]:
'\n Return the list of entities this recognizer can identify.\n\n :return: A list of the supported entities by this recognizer\n '
return self.supported_entities | Return the list of entities this recognizer can identify.
:return: A list of the supported entities by this recognizer | presidio-analyzer/presidio_analyzer/entity_recognizer.py | get_supported_entities | omri374/presidio | 68 | python | def get_supported_entities(self) -> List[str]:
'\n Return the list of entities this recognizer can identify.\n\n :return: A list of the supported entities by this recognizer\n '
return self.supported_entities | def get_supported_entities(self) -> List[str]:
'\n Return the list of entities this recognizer can identify.\n\n :return: A list of the supported entities by this recognizer\n '
return self.supported_entities<|docstring|>Return the list of entities this recognizer can identify.
:return: A ... |
1ec9ecb9aafbacc8315a76913195f17bdccd1c042f68244b7c16cffd44a5f60c | def get_supported_language(self) -> str:
'\n Return the language this recognizer can support.\n\n :return: A list of the supported language by this recognizer\n '
return self.supported_language | Return the language this recognizer can support.
:return: A list of the supported language by this recognizer | presidio-analyzer/presidio_analyzer/entity_recognizer.py | get_supported_language | omri374/presidio | 68 | python | def get_supported_language(self) -> str:
'\n Return the language this recognizer can support.\n\n :return: A list of the supported language by this recognizer\n '
return self.supported_language | def get_supported_language(self) -> str:
'\n Return the language this recognizer can support.\n\n :return: A list of the supported language by this recognizer\n '
return self.supported_language<|docstring|>Return the language this recognizer can support.
:return: A list of the supported la... |
a59c7c8a64d7e34cc945692e80257469523250c7ef14e4dc57f7b5e2ef9a0b07 | def get_version(self) -> str:
'\n Return the version of this recognizer.\n\n :return: The current version of this recognizer\n '
return self.version | Return the version of this recognizer.
:return: The current version of this recognizer | presidio-analyzer/presidio_analyzer/entity_recognizer.py | get_version | omri374/presidio | 68 | python | def get_version(self) -> str:
'\n Return the version of this recognizer.\n\n :return: The current version of this recognizer\n '
return self.version | def get_version(self) -> str:
'\n Return the version of this recognizer.\n\n :return: The current version of this recognizer\n '
return self.version<|docstring|>Return the version of this recognizer.
:return: The current version of this recognizer<|endoftext|> |
975adb362d135184e60fd77156661631747b91eedb87ee70f3b5b5fa3174a457 | def to_dict(self) -> Dict:
'\n Serialize self to dictionary.\n\n :return: a dictionary\n '
return_dict = {'supported_entities': self.supported_entities, 'supported_language': self.supported_language, 'name': self.name, 'version': self.version}
return return_dict | Serialize self to dictionary.
:return: a dictionary | presidio-analyzer/presidio_analyzer/entity_recognizer.py | to_dict | omri374/presidio | 68 | python | def to_dict(self) -> Dict:
'\n Serialize self to dictionary.\n\n :return: a dictionary\n '
return_dict = {'supported_entities': self.supported_entities, 'supported_language': self.supported_language, 'name': self.name, 'version': self.version}
return return_dict | def to_dict(self) -> Dict:
'\n Serialize self to dictionary.\n\n :return: a dictionary\n '
return_dict = {'supported_entities': self.supported_entities, 'supported_language': self.supported_language, 'name': self.name, 'version': self.version}
return return_dict<|docstring|>Serialize se... |
c7c7ff7961145e4e871e4be5c49e1fd796240e39bf84407817fcec547faae74f | @classmethod
def from_dict(cls, entity_recognizer_dict: Dict) -> 'EntityRecognizer':
'\n Create EntityRecognizer from a dict input.\n\n :param entity_recognizer_dict: Dict containing keys and values for instantiation\n '
return cls(**entity_recognizer_dict) | Create EntityRecognizer from a dict input.
:param entity_recognizer_dict: Dict containing keys and values for instantiation | presidio-analyzer/presidio_analyzer/entity_recognizer.py | from_dict | omri374/presidio | 68 | python | @classmethod
def from_dict(cls, entity_recognizer_dict: Dict) -> 'EntityRecognizer':
'\n Create EntityRecognizer from a dict input.\n\n :param entity_recognizer_dict: Dict containing keys and values for instantiation\n '
return cls(**entity_recognizer_dict) | @classmethod
def from_dict(cls, entity_recognizer_dict: Dict) -> 'EntityRecognizer':
'\n Create EntityRecognizer from a dict input.\n\n :param entity_recognizer_dict: Dict containing keys and values for instantiation\n '
return cls(**entity_recognizer_dict)<|docstring|>Create EntityRecogniz... |
42a03f972c3fcdb4cdc91f8b016edbda9450cd3488b33a9de69dd69a107db2a1 | @staticmethod
def remove_duplicates(results: List[RecognizerResult]) -> List[RecognizerResult]:
'\n Remove duplicate results.\n\n Remove duplicates in case the two results\n have identical start and ends and types.\n :param results: List[RecognizerResult]\n :return: List[Recognize... | Remove duplicate results.
Remove duplicates in case the two results
have identical start and ends and types.
:param results: List[RecognizerResult]
:return: List[RecognizerResult] | presidio-analyzer/presidio_analyzer/entity_recognizer.py | remove_duplicates | omri374/presidio | 68 | python | @staticmethod
def remove_duplicates(results: List[RecognizerResult]) -> List[RecognizerResult]:
'\n Remove duplicate results.\n\n Remove duplicates in case the two results\n have identical start and ends and types.\n :param results: List[RecognizerResult]\n :return: List[Recognize... | @staticmethod
def remove_duplicates(results: List[RecognizerResult]) -> List[RecognizerResult]:
'\n Remove duplicate results.\n\n Remove duplicates in case the two results\n have identical start and ends and types.\n :param results: List[RecognizerResult]\n :return: List[Recognize... |
0b9896a106156e62dd8edebb55b21a48b81bd977e9a181f2a78898f2ae3df322 | def __init__(self, coords):
'\n Initializes a Simplex from vertex coordinates.\n\n Args:\n coords ([[float]]): Coords of the vertices of the simplex. E.g.,\n [[1, 2, 3], [2, 4, 5], [6, 7, 8], [8, 9, 10].\n '
self._coords = np.array(coords)
(self.simplex_dim, se... | Initializes a Simplex from vertex coordinates.
Args:
coords ([[float]]): Coords of the vertices of the simplex. E.g.,
[[1, 2, 3], [2, 4, 5], [6, 7, 8], [8, 9, 10]. | pyhull/simplex.py | __init__ | BerkeleyAutomation/pyhull | 69 | python | def __init__(self, coords):
'\n Initializes a Simplex from vertex coordinates.\n\n Args:\n coords ([[float]]): Coords of the vertices of the simplex. E.g.,\n [[1, 2, 3], [2, 4, 5], [6, 7, 8], [8, 9, 10].\n '
self._coords = np.array(coords)
(self.simplex_dim, se... | def __init__(self, coords):
'\n Initializes a Simplex from vertex coordinates.\n\n Args:\n coords ([[float]]): Coords of the vertices of the simplex. E.g.,\n [[1, 2, 3], [2, 4, 5], [6, 7, 8], [8, 9, 10].\n '
self._coords = np.array(coords)
(self.simplex_dim, se... |
e180c078537f261a9676e92623518412f42ac9436b64f51aa93851530456a5e8 | @property
def volume(self):
'\n Volume of the simplex.\n '
return (abs(np.linalg.det(self.T)) / math.factorial(self.space_dim)) | Volume of the simplex. | pyhull/simplex.py | volume | BerkeleyAutomation/pyhull | 69 | python | @property
def volume(self):
'\n \n '
return (abs(np.linalg.det(self.T)) / math.factorial(self.space_dim)) | @property
def volume(self):
'\n \n '
return (abs(np.linalg.det(self.T)) / math.factorial(self.space_dim))<|docstring|>Volume of the simplex.<|endoftext|> |
41af687863c2c2002e67ad356d5d16fd2efe85a3ef88b5b523ee92ff189148cb | def in_simplex(self, point, tolerance=1e-08):
'\n Checks if a point is in the simplex using the standard barycentric\n coordinate system algorithm.\n\n Taking an arbitrary vertex as an origin, we compute the basis for the\n simplex from this origin by subtracting all other vertices from ... | Checks if a point is in the simplex using the standard barycentric
coordinate system algorithm.
Taking an arbitrary vertex as an origin, we compute the basis for the
simplex from this origin by subtracting all other vertices from the
origin. We then project the point into this coordinate system and
determine the linea... | pyhull/simplex.py | in_simplex | BerkeleyAutomation/pyhull | 69 | python | def in_simplex(self, point, tolerance=1e-08):
'\n Checks if a point is in the simplex using the standard barycentric\n coordinate system algorithm.\n\n Taking an arbitrary vertex as an origin, we compute the basis for the\n simplex from this origin by subtracting all other vertices from ... | def in_simplex(self, point, tolerance=1e-08):
'\n Checks if a point is in the simplex using the standard barycentric\n coordinate system algorithm.\n\n Taking an arbitrary vertex as an origin, we compute the basis for the\n simplex from this origin by subtracting all other vertices from ... |
8d6e3fdb85f0d460a1582e506f4fdac88d7f05414fcaee9c2993705fc4a4927c | @property
def coords(self):
'\n Returns a copy of the vertex coordinates in the simplex.\n '
return self._coords.copy() | Returns a copy of the vertex coordinates in the simplex. | pyhull/simplex.py | coords | BerkeleyAutomation/pyhull | 69 | python | @property
def coords(self):
'\n \n '
return self._coords.copy() | @property
def coords(self):
'\n \n '
return self._coords.copy()<|docstring|>Returns a copy of the vertex coordinates in the simplex.<|endoftext|> |
1659419c2b2378db66e79fef1437b8d06ebc7a7cdde939f1749201866a7a9d53 | def runTest(self):
'This function will update trigger under table node.'
trigger_response = triggers_utils.verify_trigger(self.server, self.db_name, self.trigger_name)
if (not trigger_response):
raise Exception('Could not find the trigger to delete.')
data = {'id': self.trigger_id, 'description'... | This function will update trigger under table node. | code/venv/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/test_triggers_put.py | runTest | jhkuang11/UniTrade | 0 | python | def runTest(self):
trigger_response = triggers_utils.verify_trigger(self.server, self.db_name, self.trigger_name)
if (not trigger_response):
raise Exception('Could not find the trigger to delete.')
data = {'id': self.trigger_id, 'description': 'This is test comment.'}
response = self.tester... | def runTest(self):
trigger_response = triggers_utils.verify_trigger(self.server, self.db_name, self.trigger_name)
if (not trigger_response):
raise Exception('Could not find the trigger to delete.')
data = {'id': self.trigger_id, 'description': 'This is test comment.'}
response = self.tester... |
e98f83ae33364980bff39ad228bde5f2ca7f4e580b5c863054dfcef5f2843f22 | def get_horizontal_rotation(self):
'if self.object_type == "{item}":\n return float(self._object_data[0][1][1])\n elif self.object_type == "{teki}":\n return float(self._object_data[2])\n elif self.object_type == "{pelt}":\n return float(self._object_data[0][1][1])\n ... | if self.object_type == "{item}":
return float(self._object_data[0][1][1])
elif self.object_type == "{teki}":
return float(self._object_data[2])
elif self.object_type == "{pelt}":
return float(self._object_data[0][1][1])
else:
return None | pikmingen.py | get_horizontal_rotation | RenolY2/pikmin-tools | 4 | python | def get_horizontal_rotation(self):
'if self.object_type == "{item}":\n return float(self._object_data[0][1][1])\n elif self.object_type == "{teki}":\n return float(self._object_data[2])\n elif self.object_type == "{pelt}":\n return float(self._object_data[0][1][1])\n ... | def get_horizontal_rotation(self):
'if self.object_type == "{item}":\n return float(self._object_data[0][1][1])\n elif self.object_type == "{teki}":\n return float(self._object_data[2])\n elif self.object_type == "{pelt}":\n return float(self._object_data[0][1][1])\n ... |
7cd7a16cd574e8cb8127fc567043cc7c0cce5b2c620832dd361190abf74455ae | def __getitem__(self, key):
'\n Return the phase series object for the scenario.\n\n Args:\n key (str): scenario name\n\n Raises:\n ScenarioNotFoundError: the scenario is not registered\n\n Returns:\n covsirphy.PhaseSeries\n '
if (key in self._... | Return the phase series object for the scenario.
Args:
key (str): scenario name
Raises:
ScenarioNotFoundError: the scenario is not registered
Returns:
covsirphy.PhaseSeries | covsirphy/analysis/scenario.py | __getitem__ | fadelrahman31/modified-covsirphhy | 0 | python | def __getitem__(self, key):
'\n Return the phase series object for the scenario.\n\n Args:\n key (str): scenario name\n\n Raises:\n ScenarioNotFoundError: the scenario is not registered\n\n Returns:\n covsirphy.PhaseSeries\n '
if (key in self._... | def __getitem__(self, key):
'\n Return the phase series object for the scenario.\n\n Args:\n key (str): scenario name\n\n Raises:\n ScenarioNotFoundError: the scenario is not registered\n\n Returns:\n covsirphy.PhaseSeries\n '
if (key in self._... |
30eabbb1a8146af9eb75289a055c2864a15529a124d773738b4c3444339d5fca | def __setitem__(self, key, value):
'\n Register a phase series.\n\n Args:\n key (str): scenario name\n value (covsirphy.PhaseSeries): phase series object\n '
self._tracker_dict[key] = ParamTracker(self._data.records(extras=False), value, area=self.area, tau=self.tau) | Register a phase series.
Args:
key (str): scenario name
value (covsirphy.PhaseSeries): phase series object | covsirphy/analysis/scenario.py | __setitem__ | fadelrahman31/modified-covsirphhy | 0 | python | def __setitem__(self, key, value):
'\n Register a phase series.\n\n Args:\n key (str): scenario name\n value (covsirphy.PhaseSeries): phase series object\n '
self._tracker_dict[key] = ParamTracker(self._data.records(extras=False), value, area=self.area, tau=self.tau) | def __setitem__(self, key, value):
'\n Register a phase series.\n\n Args:\n key (str): scenario name\n value (covsirphy.PhaseSeries): phase series object\n '
self._tracker_dict[key] = ParamTracker(self._data.records(extras=False), value, area=self.area, tau=self.tau)<|... |
64167e64088221ad3abea142a83294346ff96a99706d78eda35e54070c89a0b4 | @property
def first_date(self):
'\n str: the first date of the records\n '
return self._data.first_date | str: the first date of the records | covsirphy/analysis/scenario.py | first_date | fadelrahman31/modified-covsirphhy | 0 | python | @property
def first_date(self):
'\n \n '
return self._data.first_date | @property
def first_date(self):
'\n \n '
return self._data.first_date<|docstring|>str: the first date of the records<|endoftext|> |
e0a8c1714c6073ce2e1a5fc244104f6f5c442396f1d377c6e93201fad6928a81 | @property
def last_date(self):
'\n str: the last date of the records\n '
return self._data.last_date | str: the last date of the records | covsirphy/analysis/scenario.py | last_date | fadelrahman31/modified-covsirphhy | 0 | python | @property
def last_date(self):
'\n \n '
return self._data.last_date | @property
def last_date(self):
'\n \n '
return self._data.last_date<|docstring|>str: the last date of the records<|endoftext|> |
a0047146083913f4a3dc273f887996d2551259b0557d44a06eb02c87d85f4cc6 | @property
def today(self):
'\n str: reference date to determine whether a phase is a past phase or a future phase\n '
return self._data.today | str: reference date to determine whether a phase is a past phase or a future phase | covsirphy/analysis/scenario.py | today | fadelrahman31/modified-covsirphhy | 0 | python | @property
def today(self):
'\n \n '
return self._data.today | @property
def today(self):
'\n \n '
return self._data.today<|docstring|>str: reference date to determine whether a phase is a past phase or a future phase<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.