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 |
|---|---|---|---|---|---|---|---|---|---|
d028426356e16ed59d3d532b88b38360f3a996e92d96a5dfabbfa5470c7f0eb3 | def test_deploy_vm_generic(self):
'\n This method verifies the basic deployment of vm.\n :return:\n '
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_app_attributes = Mock()
self.deploy_opera... | This method verifies the basic deployment of vm.
:return: | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_deploy_vm_generic | tim-spiglanin/Azure-Shell | 0 | python | def test_deploy_vm_generic(self):
'\n This method verifies the basic deployment of vm.\n :return:\n '
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_app_attributes = Mock()
self.deploy_opera... | def test_deploy_vm_generic(self):
'\n This method verifies the basic deployment of vm.\n :return:\n '
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_app_attributes = Mock()
self.deploy_opera... |
44ff4e4d490106c9d073dac3b288b30e660536f86d3dfe9b18a7d6e99b5027a6 | def test_create_vm_custom_image_action(self):
'Check deploy from custom Image operation'
azure_vm_deployment_model = MagicMock()
azure_vm_deployment_model.image_name = 'some_image'
azure_vm_deployment_model.image_resource_group = 'image_group'
cloud_provider_model = MagicMock()
logger = MagicMoc... | Check deploy from custom Image operation | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_create_vm_custom_image_action | tim-spiglanin/Azure-Shell | 0 | python | def test_create_vm_custom_image_action(self):
azure_vm_deployment_model = MagicMock()
azure_vm_deployment_model.image_name = 'some_image'
azure_vm_deployment_model.image_resource_group = 'image_group'
cloud_provider_model = MagicMock()
logger = MagicMock()
compute_client = Mock()
cancel... | def test_create_vm_custom_image_action(self):
azure_vm_deployment_model = MagicMock()
azure_vm_deployment_model.image_name = 'some_image'
azure_vm_deployment_model.image_resource_group = 'image_group'
cloud_provider_model = MagicMock()
logger = MagicMock()
compute_client = Mock()
cancel... |
b915b6de222878bd6daa7858fb58a7e47718f2fe57f4ed856277d308e49054cc | def test_create_vm_marketplace_action(self):
'Check deploy from custom Image operation'
azure_vm_deployment_model = MagicMock()
cloud_provider_model = MagicMock()
logger = MagicMock()
compute_client = Mock()
cancellation_context = MagicMock()
data = Mock()
self.vm_service.create_vm_from_... | Check deploy from custom Image operation | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_create_vm_marketplace_action | tim-spiglanin/Azure-Shell | 0 | python | def test_create_vm_marketplace_action(self):
azure_vm_deployment_model = MagicMock()
cloud_provider_model = MagicMock()
logger = MagicMock()
compute_client = Mock()
cancellation_context = MagicMock()
data = Mock()
self.vm_service.create_vm_from_marketplace = Mock()
self.deploy_opera... | def test_create_vm_marketplace_action(self):
azure_vm_deployment_model = MagicMock()
cloud_provider_model = MagicMock()
logger = MagicMock()
compute_client = Mock()
cancellation_context = MagicMock()
data = Mock()
self.vm_service.create_vm_from_marketplace = Mock()
self.deploy_opera... |
07dd34d55ee90af2d62c901a817d2c7c06585f4d02198c832a74c50bbda451e2 | def test_deploy_vm_generic_delete_all_resources_on_error(self):
' Check that method will delete all created resources in case of any Exception occurs while deploying'
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_a... | Check that method will delete all created resources in case of any Exception occurs while deploying | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_deploy_vm_generic_delete_all_resources_on_error | tim-spiglanin/Azure-Shell | 0 | python | def test_deploy_vm_generic_delete_all_resources_on_error(self):
' '
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_app_attributes = Mock()
self.deploy_operation._prepare_deploy_data = Mock(return_value=data)
... | def test_deploy_vm_generic_delete_all_resources_on_error(self):
' '
resource_model = DeployAzureVMResourceModel()
data = Mock()
updated_data = Mock()
updated_data.vm_credentials = Mock()
deployed_app_attributes = Mock()
self.deploy_operation._prepare_deploy_data = Mock(return_value=data)
... |
43451cbb8d6d4118055647204595e74323557e3ab3fb2d4f5ba2358a715f889c | def test_rollback_deployed_resources(self):
'Check that deploy rollback method will delete resources'
self.network_service.delete_nic = Mock()
self.network_service.delete_ip = Mock()
self.vm_service.delete_vm = Mock()
self.deploy_operation._rollback_deployed_resources(compute_client=MagicMock(), net... | Check that deploy rollback method will delete resources | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_rollback_deployed_resources | tim-spiglanin/Azure-Shell | 0 | python | def test_rollback_deployed_resources(self):
self.network_service.delete_nic = Mock()
self.network_service.delete_ip = Mock()
self.vm_service.delete_vm = Mock()
self.deploy_operation._rollback_deployed_resources(compute_client=MagicMock(), network_client=MagicMock(), group_name=MagicMock(), interfac... | def test_rollback_deployed_resources(self):
self.network_service.delete_nic = Mock()
self.network_service.delete_ip = Mock()
self.vm_service.delete_vm = Mock()
self.deploy_operation._rollback_deployed_resources(compute_client=MagicMock(), network_client=MagicMock(), group_name=MagicMock(), interfac... |
d7f8fc35f79e2d8fb3eccfc026d93143e2058b246719e1e133faa7ece6abc2dd | def test_process_nsg_rules(self):
'Check that method validates NSG is single per group and uses security group service for rules creation'
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellation_context = MagicMock()
... | Check that method validates NSG is single per group and uses security group service for rules creation | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_process_nsg_rules | tim-spiglanin/Azure-Shell | 0 | python | def test_process_nsg_rules(self):
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellation_context = MagicMock()
logger = MagicMock()
security_groups_list = MagicMock()
self.deploy_operation.security_group_ser... | def test_process_nsg_rules(self):
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellation_context = MagicMock()
logger = MagicMock()
security_groups_list = MagicMock()
self.deploy_operation.security_group_ser... |
cebb51bdeb45badf9a9b85c1cdeefaf7ead5b32d4b8b267426093ed842a55687 | def test_process_nsg_rules_inbound_ports_attribute_is_empty(self):
'Check that method will not call security group service for NSG rules creation if there are no rules'
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellat... | Check that method will not call security group service for NSG rules creation if there are no rules | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_process_nsg_rules_inbound_ports_attribute_is_empty | tim-spiglanin/Azure-Shell | 0 | python | def test_process_nsg_rules_inbound_ports_attribute_is_empty(self):
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellation_context = MagicMock()
logger = MagicMock()
self.deploy_operation._validate_resource_is_si... | def test_process_nsg_rules_inbound_ports_attribute_is_empty(self):
group_name = 'test_group_name'
network_client = MagicMock()
azure_vm_deployment_model = MagicMock()
nic = MagicMock()
cancellation_context = MagicMock()
logger = MagicMock()
self.deploy_operation._validate_resource_is_si... |
35895b4a715b6d310067a42f9244704fd8ab0dd5755e03eeb0f91ca90c290430 | def test_validate_resource_is_single_per_group(self):
'Check that method will not throw Exception if length of resource list is equal to 1'
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock()]
try:
self.deploy_operation._validate_resource_is_single_per_gro... | Check that method will not throw Exception if length of resource list is equal to 1 | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_validate_resource_is_single_per_group | tim-spiglanin/Azure-Shell | 0 | python | def test_validate_resource_is_single_per_group(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock()]
try:
self.deploy_operation._validate_resource_is_single_per_group(resource_list, group_name, resource_name)
except Exception as e:
self.... | def test_validate_resource_is_single_per_group(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock()]
try:
self.deploy_operation._validate_resource_is_single_per_group(resource_list, group_name, resource_name)
except Exception as e:
self.... |
8a45570aa0cd58f52104d471b48d23d77544efecf4749858fa5f415f324b4477 | def test_validate_deployment_model_raises_exception(self):
'Check that method will raise Exception if "Add Public IP" attr is False and "Inbound Ports" is not empty'
vm_deployment_mode = MagicMock(inbound_ports='80:tcp', add_public_ip=False)
with self.assertRaises(Exception):
self.deploy_operation._... | Check that method will raise Exception if "Add Public IP" attr is False and "Inbound Ports" is not empty | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_validate_deployment_model_raises_exception | tim-spiglanin/Azure-Shell | 0 | python | def test_validate_deployment_model_raises_exception(self):
vm_deployment_mode = MagicMock(inbound_ports='80:tcp', add_public_ip=False)
with self.assertRaises(Exception):
self.deploy_operation._validate_deployment_model(vm_deployment_mode) | def test_validate_deployment_model_raises_exception(self):
vm_deployment_mode = MagicMock(inbound_ports='80:tcp', add_public_ip=False)
with self.assertRaises(Exception):
self.deploy_operation._validate_deployment_model(vm_deployment_mode)<|docstring|>Check that method will raise Exception if "Add P... |
f745b70f03fff33937f18a2ccc35c1c22f94cd8c9b9b9b99065716a86868e68d | def test_validate_resource_is_single_per_group_several_resources(self):
'Check that method will not throw Exception if length of resource list is more than 1'
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock(), MagicMock(), MagicMock()]
with self.assertRaises(Exc... | Check that method will not throw Exception if length of resource list is more than 1 | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_validate_resource_is_single_per_group_several_resources | tim-spiglanin/Azure-Shell | 0 | python | def test_validate_resource_is_single_per_group_several_resources(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock(), MagicMock(), MagicMock()]
with self.assertRaises(Exception):
self.deploy_operation._validate_resource_is_single_per_group(resource... | def test_validate_resource_is_single_per_group_several_resources(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = [MagicMock(), MagicMock(), MagicMock()]
with self.assertRaises(Exception):
self.deploy_operation._validate_resource_is_single_per_group(resource... |
3196b1300e213d1f047539b11ce5213f1b78dc1b5ff1acedf7797d16b85b3907 | def test_validate_resource_is_single_per_group_missing_resource(self):
'Check that method will throw Exception if resource list is empty'
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = []
with self.assertRaises(Exception):
self.deploy_operation._validate_resource_... | Check that method will throw Exception if resource list is empty | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_validate_resource_is_single_per_group_missing_resource | tim-spiglanin/Azure-Shell | 0 | python | def test_validate_resource_is_single_per_group_missing_resource(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = []
with self.assertRaises(Exception):
self.deploy_operation._validate_resource_is_single_per_group(resource_list, group_name, resource_name) | def test_validate_resource_is_single_per_group_missing_resource(self):
group_name = 'test_group_name'
resource_name = MagicMock()
resource_list = []
with self.assertRaises(Exception):
self.deploy_operation._validate_resource_is_single_per_group(resource_list, group_name, resource_name)<|doc... |
b69d04f53d13826ca3545451d296ac2c4ff463fbd4ea48f8d55b33df5e2a9443 | def test_prepare_computer_name_win(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=computer... | Check that method will use NameProviderService.generate_name to process computer name and correct length is
selected based on the OS type | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_prepare_computer_name_win | tim-spiglanin/Azure-Shell | 0 | python | def test_prepare_computer_name_win(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=computer... | def test_prepare_computer_name_win(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=computer... |
a306abcf33e4060d3caa263b2c823591742c023cc82414280de355dd2c2e41dc | def test_prepare_computer_name_linux(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=comput... | Check that method will use NameProviderService.generate_name to process computer name and correct length is
selected based on the OS type | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_prepare_computer_name_linux | tim-spiglanin/Azure-Shell | 0 | python | def test_prepare_computer_name_linux(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=comput... | def test_prepare_computer_name_linux(self):
'\n Check that method will use NameProviderService.generate_name to process computer name and correct length is\n selected based on the OS type\n '
computer_name = MagicMock()
self.name_provider_service.generate_name = Mock(return_value=comput... |
f23d028431194dc207c9a73f427562820c38879f23e173483bbfe47b7df12240 | def test_prepare_vm_size_retrieve_attr_from_deployment_model(self):
'Check that method will retrieve "vm_size" attribute from deployment model if attr is not empty'
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size='')
azure_vm_deployment_model = MagicMock(vm_size=expected_vm_size)... | Check that method will retrieve "vm_size" attribute from deployment model if attr is not empty | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_prepare_vm_size_retrieve_attr_from_deployment_model | tim-spiglanin/Azure-Shell | 0 | python | def test_prepare_vm_size_retrieve_attr_from_deployment_model(self):
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size=)
azure_vm_deployment_model = MagicMock(vm_size=expected_vm_size)
res = self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_mo... | def test_prepare_vm_size_retrieve_attr_from_deployment_model(self):
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size=)
azure_vm_deployment_model = MagicMock(vm_size=expected_vm_size)
res = self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_mo... |
922d144b98b6008363cd596b8d36a44c52c477e0fe0f22f85f50922fc8f470bb | def test_prepare_vm_size_retrieve_default_attr_from_cp_model(self):
'Check that method will retrieve "vm_size" attr from cp model if no such one in the deployment model'
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size=expected_vm_size)
azure_vm_deployment_model = MagicMock(vm_siz... | Check that method will retrieve "vm_size" attr from cp model if no such one in the deployment model | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_prepare_vm_size_retrieve_default_attr_from_cp_model | tim-spiglanin/Azure-Shell | 0 | python | def test_prepare_vm_size_retrieve_default_attr_from_cp_model(self):
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size=expected_vm_size)
azure_vm_deployment_model = MagicMock(vm_size=)
res = self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_mo... | def test_prepare_vm_size_retrieve_default_attr_from_cp_model(self):
expected_vm_size = MagicMock()
cloud_provider_model = MagicMock(vm_size=expected_vm_size)
azure_vm_deployment_model = MagicMock(vm_size=)
res = self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_mo... |
6cab4ff029f65f9225fdc2c4aa68081cb0d14b862a81f6f645f2f3a76e5cd0d5 | def test_prepare_vm_size_attr_is_empty(self):
'Check that method will raise exception if "vm_size" attr is empty in both cp and deployment models'
cloud_provider_model = MagicMock(vm_size='')
azure_vm_deployment_model = MagicMock(vm_size='')
with self.assertRaises(Exception):
self.deploy_operati... | Check that method will raise exception if "vm_size" attr is empty in both cp and deployment models | package/tests/test_cp/test_azure/test_domain/test_vm_management/test_operations/test_deploy_operation.py | test_prepare_vm_size_attr_is_empty | tim-spiglanin/Azure-Shell | 0 | python | def test_prepare_vm_size_attr_is_empty(self):
cloud_provider_model = MagicMock(vm_size=)
azure_vm_deployment_model = MagicMock(vm_size=)
with self.assertRaises(Exception):
self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_model, cloud_provider_model=cloud_prov... | def test_prepare_vm_size_attr_is_empty(self):
cloud_provider_model = MagicMock(vm_size=)
azure_vm_deployment_model = MagicMock(vm_size=)
with self.assertRaises(Exception):
self.deploy_operation._prepare_vm_size(azure_vm_deployment_model=azure_vm_deployment_model, cloud_provider_model=cloud_prov... |
5994dbcd74735cb12201bd31d0a38e977526492a55e4dedcf20f312898c3b5ae | def get_labels(x, digit_labels):
"\n - Takes integer 'x' (digit 0-9)\n - Takes labels\n - Returns new labels\n where the label is 1 for digit == x, and -1 otherwise.\n "
y = []
for d in digit_labels:
if (d == x):
y.append(1)
else:
y.append((- 1))
... | - Takes integer 'x' (digit 0-9)
- Takes labels
- Returns new labels
where the label is 1 for digit == x, and -1 otherwise. | lfd_hw8/hw8_q2_3_4.py | get_labels | MahmutOsmanovic/machine-learning-mooc-caltech | 0 | python | def get_labels(x, digit_labels):
"\n - Takes integer 'x' (digit 0-9)\n - Takes labels\n - Returns new labels\n where the label is 1 for digit == x, and -1 otherwise.\n "
y = []
for d in digit_labels:
if (d == x):
y.append(1)
else:
y.append((- 1))
... | def get_labels(x, digit_labels):
"\n - Takes integer 'x' (digit 0-9)\n - Takes labels\n - Returns new labels\n where the label is 1 for digit == x, and -1 otherwise.\n "
y = []
for d in digit_labels:
if (d == x):
y.append(1)
else:
y.append((- 1))
... |
e84e8f02238b2bc601cad2d346f841c3296adaddfa1ebd173dade7cc7e2b64da | def get_E_in_x_vs_all(x, DIGIT_LABELS, X_TRAIN):
'\n - Takes integer x\n - Takes vector DIGIT_LABELS containing true digit labels\n - Takes matrix X_TRAIN with features intensity and symmetry\n - Returns in-sample error E_in for binary classifier with label\n y = 1 if digit == x, otherwise y = -1\n... | - Takes integer x
- Takes vector DIGIT_LABELS containing true digit labels
- Takes matrix X_TRAIN with features intensity and symmetry
- Returns in-sample error E_in for binary classifier with label
y = 1 if digit == x, otherwise y = -1 | lfd_hw8/hw8_q2_3_4.py | get_E_in_x_vs_all | MahmutOsmanovic/machine-learning-mooc-caltech | 0 | python | def get_E_in_x_vs_all(x, DIGIT_LABELS, X_TRAIN):
'\n - Takes integer x\n - Takes vector DIGIT_LABELS containing true digit labels\n - Takes matrix X_TRAIN with features intensity and symmetry\n - Returns in-sample error E_in for binary classifier with label\n y = 1 if digit == x, otherwise y = -1\n... | def get_E_in_x_vs_all(x, DIGIT_LABELS, X_TRAIN):
'\n - Takes integer x\n - Takes vector DIGIT_LABELS containing true digit labels\n - Takes matrix X_TRAIN with features intensity and symmetry\n - Returns in-sample error E_in for binary classifier with label\n y = 1 if digit == x, otherwise y = -1\n... |
e18be772b70e1a4377997930849bed8823bc60dd0ec3c8249db84aa2b9038344 | @staticmethod
def get_version(snapshot_path):
'\n Get version of binary Lastline process snapshot file\n :param str snapshot_path: Path to Lastline process snapshot\n :raise snapshot.InvalidProcessSnapshot: invalid format for process snapshot\n '
if (not os.path.isfile(snapshot_path)... | Get version of binary Lastline process snapshot file
:param str snapshot_path: Path to Lastline process snapshot
:raise snapshot.InvalidProcessSnapshot: invalid format for process snapshot | process_snapshot_toolkit/snapshot/factory.py | get_version | ostefano/process-snapshots-toolkit | 0 | python | @staticmethod
def get_version(snapshot_path):
'\n Get version of binary Lastline process snapshot file\n :param str snapshot_path: Path to Lastline process snapshot\n :raise snapshot.InvalidProcessSnapshot: invalid format for process snapshot\n '
if (not os.path.isfile(snapshot_path)... | @staticmethod
def get_version(snapshot_path):
'\n Get version of binary Lastline process snapshot file\n :param str snapshot_path: Path to Lastline process snapshot\n :raise snapshot.InvalidProcessSnapshot: invalid format for process snapshot\n '
if (not os.path.isfile(snapshot_path)... |
2adbf504defe34bf91696ae32e7fa6527045c0ae27dae8573d1a2357ca9592fd | @classmethod
def from_file(cls, snapshot_path):
'\n Create ProcessSnapshotMgr from file.\n\n :param snapshot_path: a path to snapshot file\n :return: ProcessSnapshotMgr object\n '
version = cls.get_version(snapshot_path)
if (version not in cls.SUPPORTED_SNAPSHOT_VERSIONS):
... | Create ProcessSnapshotMgr from file.
:param snapshot_path: a path to snapshot file
:return: ProcessSnapshotMgr object | process_snapshot_toolkit/snapshot/factory.py | from_file | ostefano/process-snapshots-toolkit | 0 | python | @classmethod
def from_file(cls, snapshot_path):
'\n Create ProcessSnapshotMgr from file.\n\n :param snapshot_path: a path to snapshot file\n :return: ProcessSnapshotMgr object\n '
version = cls.get_version(snapshot_path)
if (version not in cls.SUPPORTED_SNAPSHOT_VERSIONS):
... | @classmethod
def from_file(cls, snapshot_path):
'\n Create ProcessSnapshotMgr from file.\n\n :param snapshot_path: a path to snapshot file\n :return: ProcessSnapshotMgr object\n '
version = cls.get_version(snapshot_path)
if (version not in cls.SUPPORTED_SNAPSHOT_VERSIONS):
... |
43305aa493459d8eef87cefc11e68e13dccb7c9c80737d92d9dfefcad7b75f2f | def validateAccountDataBeforeBonding(self):
'\n Before we bond any coins we need to check account balance for two main things :\n 1 - minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n 2 - active address (Existential Deposit) witch is 1 DOT :\n - ... | Before we bond any coins we need to check account balance for two main things :
1 - minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.
2 - active address (Existential Deposit) witch is 1 DOT :
- NB : !! If an account drops below the Existential Deposit, the account is reaped (“dea... | code_src/staking/polkadotAndKusama/fxn_decorator_implementations/substrateCallImplementationUtils.py | validateAccountDataBeforeBonding | luizcarvalhohen/staking_manager | 3 | python | def validateAccountDataBeforeBonding(self):
'\n Before we bond any coins we need to check account balance for two main things :\n 1 - minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n 2 - active address (Existential Deposit) witch is 1 DOT :\n - ... | def validateAccountDataBeforeBonding(self):
'\n Before we bond any coins we need to check account balance for two main things :\n 1 - minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n 2 - active address (Existential Deposit) witch is 1 DOT :\n - ... |
be7b6070f42665bad56c868872719271353a19cace287bdf6a433899906035b4 | def validateBondSize(self):
'\n Function checks that the size of the bond is above the minimum defined by the network\n Minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n TODO: the minimum to stake and the minimum to bond are not the same I assume, which should we... | Function checks that the size of the bond is above the minimum defined by the network
Minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.
TODO: the minimum to stake and the minimum to bond are not the same I assume, which should we be using?
TODO: confirm that the decimals of tokenNumber and... | code_src/staking/polkadotAndKusama/fxn_decorator_implementations/substrateCallImplementationUtils.py | validateBondSize | luizcarvalhohen/staking_manager | 3 | python | def validateBondSize(self):
'\n Function checks that the size of the bond is above the minimum defined by the network\n Minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n TODO: the minimum to stake and the minimum to bond are not the same I assume, which should we... | def validateBondSize(self):
'\n Function checks that the size of the bond is above the minimum defined by the network\n Minimum dot staking amount witch is by time of writing (21/11/2021) is 120 DOT.\n TODO: the minimum to stake and the minimum to bond are not the same I assume, which should we... |
d74353bb947e90a6dab5549e6cf603052acd9f63653a5bc2a0f179ed2f875cf6 | def validateAcctBalanceForBonding(self):
'\n Function calculates and compares account balance vs minimum balance needed to stake\n '
accountToVerify = AccountImplementation(config=self.activeConfig, logger=self.logger, ss58_address=self.ss58_address)
totalAccountBalance = accountToVerify.getAc... | Function calculates and compares account balance vs minimum balance needed to stake | code_src/staking/polkadotAndKusama/fxn_decorator_implementations/substrateCallImplementationUtils.py | validateAcctBalanceForBonding | luizcarvalhohen/staking_manager | 3 | python | def validateAcctBalanceForBonding(self):
'\n \n '
accountToVerify = AccountImplementation(config=self.activeConfig, logger=self.logger, ss58_address=self.ss58_address)
totalAccountBalance = accountToVerify.getAccountBalance('bonding')
transactionFees = TransactionFees(config=self.activeCon... | def validateAcctBalanceForBonding(self):
'\n \n '
accountToVerify = AccountImplementation(config=self.activeConfig, logger=self.logger, ss58_address=self.ss58_address)
totalAccountBalance = accountToVerify.getAccountBalance('bonding')
transactionFees = TransactionFees(config=self.activeCon... |
2f5431907d162141664c207e8a63e255ba1e1c3a5a4622b3082124c5d72212d7 | def get_ncvar_name(ncfile, standard_name=None, long_name=None, var_name=None):
'\n Look for variables that match either CF standard_name or long_name\n attributes.\n\n If both are defined, standard_name takes precedence.\n\n Note that the attributes in the netCDF file converted to\n lower case prior ... | Look for variables that match either CF standard_name or long_name
attributes.
If both are defined, standard_name takes precedence.
Note that the attributes in the netCDF file converted to
lower case prior to checking.
:arg ncfile: netCDF4 Dataset object
:kwarg standard_name: a target standard_name, or a list of the... | thetis/interpolation.py | get_ncvar_name | thetisproject/thetis | 45 | python | def get_ncvar_name(ncfile, standard_name=None, long_name=None, var_name=None):
'\n Look for variables that match either CF standard_name or long_name\n attributes.\n\n If both are defined, standard_name takes precedence.\n\n Note that the attributes in the netCDF file converted to\n lower case prior ... | def get_ncvar_name(ncfile, standard_name=None, long_name=None, var_name=None):
'\n Look for variables that match either CF standard_name or long_name\n attributes.\n\n If both are defined, standard_name takes precedence.\n\n Note that the attributes in the netCDF file converted to\n lower case prior ... |
a15cca006eb121b33e1c331344b231720a4d4bc1b017a99425cbb407003e1ff5 | def _get_subset_nodes(grid_x, grid_y, target_x, target_y):
'\n Retuns grid nodes that are necessary for intepolating onto target_x,y\n '
orig_shape = grid_x.shape
grid_xy = numpy.array((grid_x.ravel(), grid_y.ravel())).T
target_xy = numpy.array((target_x.ravel(), target_y.ravel())).T
tri = qhu... | Retuns grid nodes that are necessary for intepolating onto target_x,y | thetis/interpolation.py | _get_subset_nodes | thetisproject/thetis | 45 | python | def _get_subset_nodes(grid_x, grid_y, target_x, target_y):
'\n \n '
orig_shape = grid_x.shape
grid_xy = numpy.array((grid_x.ravel(), grid_y.ravel())).T
target_xy = numpy.array((target_x.ravel(), target_y.ravel())).T
tri = qhull.Delaunay(grid_xy)
simplex = tri.find_simplex(target_xy)
ve... | def _get_subset_nodes(grid_x, grid_y, target_x, target_y):
'\n \n '
orig_shape = grid_x.shape
grid_xy = numpy.array((grid_x.ravel(), grid_y.ravel())).T
target_xy = numpy.array((target_x.ravel(), target_y.ravel())).T
tri = qhull.Delaunay(grid_xy)
simplex = tri.find_simplex(target_xy)
ve... |
a91a0345a8a66b285e5c4b70f3364fafcbf90325f3eb71e78eca99cceb1a2aca | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__init__')
def __init__(self, grid_xyz, target_xyz, fill_mode=None, fill_value=numpy.nan, normalize=False, dont_raise=False):
"\n :arg grid_xyz: Array of source grid coordinates, shape (npoints, 2) or\n (npoints, 3)\n :arg target_xyz: Array... | :arg grid_xyz: Array of source grid coordinates, shape (npoints, 2) or
(npoints, 3)
:arg target_xyz: Array of target grid coordinates, shape (n, 2) or
(n, 3)
:kwarg fill_mode: Determines how points outside the source grid will be
treated. If 'nearest', value of the nearest source point will be
used. Oth... | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__init__')
def __init__(self, grid_xyz, target_xyz, fill_mode=None, fill_value=numpy.nan, normalize=False, dont_raise=False):
"\n :arg grid_xyz: Array of source grid coordinates, shape (npoints, 2) or\n (npoints, 3)\n :arg target_xyz: Array... | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__init__')
def __init__(self, grid_xyz, target_xyz, fill_mode=None, fill_value=numpy.nan, normalize=False, dont_raise=False):
"\n :arg grid_xyz: Array of source grid coordinates, shape (npoints, 2) or\n (npoints, 3)\n :arg target_xyz: Array... |
90cbd31d0b6f4f6f354ff5f8376e27544662b2fe2874b2e7c32150d4b570dd3c | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__call__')
def __call__(self, values):
'\n Interpolate values defined on grid_xyz to target_xyz.\n\n :arg values: Array of source values to interpolate, shape (npoints, )\n :kwarg float fill_value: Fill value to use outside the source grid (def... | Interpolate values defined on grid_xyz to target_xyz.
:arg values: Array of source values to interpolate, shape (npoints, )
:kwarg float fill_value: Fill value to use outside the source grid (default: NaN) | thetis/interpolation.py | __call__ | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__call__')
def __call__(self, values):
'\n Interpolate values defined on grid_xyz to target_xyz.\n\n :arg values: Array of source values to interpolate, shape (npoints, )\n :kwarg float fill_value: Fill value to use outside the source grid (def... | @PETSc.Log.EventDecorator('thetis.GridInterpolator.__call__')
def __call__(self, values):
'\n Interpolate values defined on grid_xyz to target_xyz.\n\n :arg values: Array of source values to interpolate, shape (npoints, )\n :kwarg float fill_value: Fill value to use outside the source grid (def... |
415bd668f950bdc2ff38968ebadf95e8c33d3f5ceed50adbb9920410be8f5efd | @abstractmethod
def __call__(self, filename, time_index):
'\n Reads a data for one time step from the file\n\n :arg str filename: a filename where to find the data (e.g. filename)\n :arg int time_index: time index to read\n :return: a list of floats or numpy.array_like objects\n '... | Reads a data for one time step from the file
:arg str filename: a filename where to find the data (e.g. filename)
:arg int time_index: time index to read
:return: a list of floats or numpy.array_like objects | thetis/interpolation.py | __call__ | thetisproject/thetis | 45 | python | @abstractmethod
def __call__(self, filename, time_index):
'\n Reads a data for one time step from the file\n\n :arg str filename: a filename where to find the data (e.g. filename)\n :arg int time_index: time index to read\n :return: a list of floats or numpy.array_like objects\n '... | @abstractmethod
def __call__(self, filename, time_index):
'\n Reads a data for one time step from the file\n\n :arg str filename: a filename where to find the data (e.g. filename)\n :arg int time_index: time index to read\n :return: a list of floats or numpy.array_like objects\n '... |
eb3d095c2ac41f04065b6b0d616c79cf95df324034dcae92c7c6deeffec66242 | def _get_slice(self, time_index):
'\n Returns a slice object that extracts a single time index\n '
if (self.ndims == 1):
return time_index
slice_list = ([slice(None, None, None)] * self.ndims)
slice_list[self.time_dim] = slice(time_index, (time_index + 1), None)
return slice_li... | Returns a slice object that extracts a single time index | thetis/interpolation.py | _get_slice | thetisproject/thetis | 45 | python | def _get_slice(self, time_index):
'\n \n '
if (self.ndims == 1):
return time_index
slice_list = ([slice(None, None, None)] * self.ndims)
slice_list[self.time_dim] = slice(time_index, (time_index + 1), None)
return slice_list | def _get_slice(self, time_index):
'\n \n '
if (self.ndims == 1):
return time_index
slice_list = ([slice(None, None, None)] * self.ndims)
slice_list[self.time_dim] = slice(time_index, (time_index + 1), None)
return slice_list<|docstring|>Returns a slice object that extracts a si... |
8e4118b55960b64c2823f1b912c6208e31674bcff4b3df9ddbb6fe6842498a72 | def __call__(self, filename, time_index):
'\n Reads a time_index from the data base\n\n :arg str filename: netcdf file where to find the data\n :arg int time_index: time index to read\n :return: a float or numpy.array_like value\n '
assert os.path.isfile(filename), 'File not f... | Reads a time_index from the data base
:arg str filename: netcdf file where to find the data
:arg int time_index: time index to read
:return: a float or numpy.array_like value | thetis/interpolation.py | __call__ | thetisproject/thetis | 45 | python | def __call__(self, filename, time_index):
'\n Reads a time_index from the data base\n\n :arg str filename: netcdf file where to find the data\n :arg int time_index: time index to read\n :return: a float or numpy.array_like value\n '
assert os.path.isfile(filename), 'File not f... | def __call__(self, filename, time_index):
'\n Reads a time_index from the data base\n\n :arg str filename: netcdf file where to find the data\n :arg int time_index: time index to read\n :return: a float or numpy.array_like value\n '
assert os.path.isfile(filename), 'File not f... |
8d1fb9176733c0739bb93935a48bac02d4bea01a08366e8ab49459c950b0fa49 | @abstractmethod
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon(x, y)'\n "
pass | :arg function_space: target Firedrake FunctionSpace
:arg to_latlon: Python function that converts local mesh coordinates to
latitude and longitude: 'lat, lon = to_latlon(x, y)' | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | @abstractmethod
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon(x, y)'\n "
pass | @abstractmethod
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon(x, y)'\n "
pass<|docstring|>:arg functi... |
d2ec22cbe05459838ff566e15103348103f441a5963116642fe575be5692e5fa | @abstractmethod
def interpolate(self, filename, variable_list, itime):
'\n Interpolates data from the given file at given time step\n '
pass | Interpolates data from the given file at given time step | thetis/interpolation.py | interpolate | thetisproject/thetis | 45 | python | @abstractmethod
def interpolate(self, filename, variable_list, itime):
'\n \n '
pass | @abstractmethod
def interpolate(self, filename, variable_list, itime):
'\n \n '
pass<|docstring|>Interpolates data from the given file at given time step<|endoftext|> |
0530ee1f0e0c3c5c589e6f7f0cdcbea45cfdf7a8df69852357d30d0bdb35ccd0 | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d.__init__')
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon... | :arg function_space: target Firedrake FunctionSpace
:arg to_latlon: Python function that converts local mesh coordinates to
latitude and longitude: 'lat, lon = to_latlon(x, y)' | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d.__init__')
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon... | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d.__init__')
def __init__(self, function_space, to_latlon):
"\n :arg function_space: target Firedrake FunctionSpace\n :arg to_latlon: Python function that converts local mesh coordinates to\n latitude and longitude: 'lat, lon = to_latlon... |
ce3356039ae5363d03fba77ee441085c2894dfc5a3826bb7e3abd4580143689e | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d._create_interpolator')
def _create_interpolator(self, lat_array, lon_array):
'\n Create compact interpolator by finding the minimal necessary support\n '
assert (len(lat_array.shape) == 2), 'Latitude must be two dimensional array.'
assert... | Create compact interpolator by finding the minimal necessary support | thetis/interpolation.py | _create_interpolator | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d._create_interpolator')
def _create_interpolator(self, lat_array, lon_array):
'\n \n '
assert (len(lat_array.shape) == 2), 'Latitude must be two dimensional array.'
assert (len(lon_array.shape) == 2), 'longitude must be two dimensional arr... | @PETSc.Log.EventDecorator('thetis.SpatialInterpolator2d._create_interpolator')
def _create_interpolator(self, lat_array, lon_array):
'\n \n '
assert (len(lat_array.shape) == 2), 'Latitude must be two dimensional array.'
assert (len(lon_array.shape) == 2), 'longitude must be two dimensional arr... |
6548ccb1e982151c3daa05315ace37d93feca6872fc9552296961ab43a30f9b7 | @abstractmethod
def interpolate(self, filename, variable_list, time):
'\n Calls the interpolator object\n '
pass | Calls the interpolator object | thetis/interpolation.py | interpolate | thetisproject/thetis | 45 | python | @abstractmethod
def interpolate(self, filename, variable_list, time):
'\n \n '
pass | @abstractmethod
def interpolate(self, filename, variable_list, time):
'\n \n '
pass<|docstring|>Calls the interpolator object<|endoftext|> |
a73e28c88f98a7d4348eff06f4820eb4603c5f43cacad53ad944fcd0e5862443 | @PETSc.Log.EventDecorator('thetis.NetCDFLatLonInterpolator2d.interpolate')
def interpolate(self, nc_filename, variable_list, itime):
'\n Interpolates data from a netCDF file onto Firedrake function space.\n\n :arg str nc_filename: netCDF file to read\n :arg variable_list: list of netCDF variabl... | Interpolates data from a netCDF file onto Firedrake function space.
:arg str nc_filename: netCDF file to read
:arg variable_list: list of netCDF variable names to read
:arg int itime: time index to read
:returns: list of numpy.arrays corresponding to variable_list | thetis/interpolation.py | interpolate | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.NetCDFLatLonInterpolator2d.interpolate')
def interpolate(self, nc_filename, variable_list, itime):
'\n Interpolates data from a netCDF file onto Firedrake function space.\n\n :arg str nc_filename: netCDF file to read\n :arg variable_list: list of netCDF variabl... | @PETSc.Log.EventDecorator('thetis.NetCDFLatLonInterpolator2d.interpolate')
def interpolate(self, nc_filename, variable_list, itime):
'\n Interpolates data from a netCDF file onto Firedrake function space.\n\n :arg str nc_filename: netCDF file to read\n :arg variable_list: list of netCDF variabl... |
44eded400f72b0f7a6aa2177b4b6c2827edf3a1f982b3a2d1d97566dbfcdd36e | @abstractmethod
def get_start_time(self):
'Returns the first time stamp in the file/data set'
pass | Returns the first time stamp in the file/data set | thetis/interpolation.py | get_start_time | thetisproject/thetis | 45 | python | @abstractmethod
def get_start_time(self):
pass | @abstractmethod
def get_start_time(self):
pass<|docstring|>Returns the first time stamp in the file/data set<|endoftext|> |
20108a7cf7c8decffb70cacada5c4a73dfc5692f536ef3c3e80412fe60883892 | @abstractmethod
def get_end_time(self):
'Returns the last time stamp in the file/data set'
pass | Returns the last time stamp in the file/data set | thetis/interpolation.py | get_end_time | thetisproject/thetis | 45 | python | @abstractmethod
def get_end_time(self):
pass | @abstractmethod
def get_end_time(self):
pass<|docstring|>Returns the last time stamp in the file/data set<|endoftext|> |
88ebe3f533d2384871d3215e8c4e570e91f09cf7db446e50d5851dcde2debef5 | @abstractmethod
def find_time_stamp(self, t, previous=False):
'\n Given time t, returns index of the next (previous) time stamp\n\n raises IndexError if t is out of range, i.e.\n t > self.get_end_time() or t < self.get_start_time()\n '
pass | Given time t, returns index of the next (previous) time stamp
raises IndexError if t is out of range, i.e.
t > self.get_end_time() or t < self.get_start_time() | thetis/interpolation.py | find_time_stamp | thetisproject/thetis | 45 | python | @abstractmethod
def find_time_stamp(self, t, previous=False):
'\n Given time t, returns index of the next (previous) time stamp\n\n raises IndexError if t is out of range, i.e.\n t > self.get_end_time() or t < self.get_start_time()\n '
pass | @abstractmethod
def find_time_stamp(self, t, previous=False):
'\n Given time t, returns index of the next (previous) time stamp\n\n raises IndexError if t is out of range, i.e.\n t > self.get_end_time() or t < self.get_start_time()\n '
pass<|docstring|>Given time t, returns index of ... |
20f0204f5b02d730b8bf1b83430e1420a00201db7af8a264b35dcb4bbd01795d | def __init__(self, filename, time_variable_name='time', allow_gaps=False, verbose=False):
"\n Construct a new object by scraping data from the given netcdf file.\n\n :arg str filename: name of the netCDF file to read\n :kwarg str time_variable_name: name of the time variable in the netCDF\n ... | Construct a new object by scraping data from the given netcdf file.
:arg str filename: name of the netCDF file to read
:kwarg str time_variable_name: name of the time variable in the netCDF
file (default: 'time')
:kwarg bool allow_gaps: if False, an error is raised if time step is
not constant. | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | def __init__(self, filename, time_variable_name='time', allow_gaps=False, verbose=False):
"\n Construct a new object by scraping data from the given netcdf file.\n\n :arg str filename: name of the netCDF file to read\n :kwarg str time_variable_name: name of the time variable in the netCDF\n ... | def __init__(self, filename, time_variable_name='time', allow_gaps=False, verbose=False):
"\n Construct a new object by scraping data from the given netcdf file.\n\n :arg str filename: name of the netCDF file to read\n :kwarg str time_variable_name: name of the time variable in the netCDF\n ... |
2880a61e35bfb53e34093b0e36b309490531faa4aa2abd6e116e2987bb05d475 | @abstractmethod
def find(self, time, previous=False):
'\n Find a next (previous) time stamp from a given time\n\n :arg float time: input time stamp\n :arg bool previous: if True, look for last time stamp before requested\n time. Otherwise returns next time stamp.\n :return: a ... | Find a next (previous) time stamp from a given time
:arg float time: input time stamp
:arg bool previous: if True, look for last time stamp before requested
time. Otherwise returns next time stamp.
:return: a (filename, time_index, time) tuple | thetis/interpolation.py | find | thetisproject/thetis | 45 | python | @abstractmethod
def find(self, time, previous=False):
'\n Find a next (previous) time stamp from a given time\n\n :arg float time: input time stamp\n :arg bool previous: if True, look for last time stamp before requested\n time. Otherwise returns next time stamp.\n :return: a ... | @abstractmethod
def find(self, time, previous=False):
'\n Find a next (previous) time stamp from a given time\n\n :arg float time: input time stamp\n :arg bool previous: if True, look for last time stamp before requested\n time. Otherwise returns next time stamp.\n :return: a ... |
6c1f8957b642545dbe8f146255943e32916fe4eb746ee0139abd492a98022cab | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp instead\... | Find file that contains the given simulation time
:arg float simulation_time: simulation time in seconds
:kwarg bool previous: if True finds previous existing time stamp instead
of next (default False).
:return: (filename, time index, simulation time) of found data | thetis/interpolation.py | find | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp instead\... | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp instead\... |
ef04efe3da4397f912f2b088d9f040e4471207bdcdbac339c8ca06a616ca1be4 | def _find_files(self):
'Finds all files that match the given pattern.'
search_pattern = str(self.file_pattern)
search_pattern = search_pattern.replace(':02d}', ':}')
search_pattern = search_pattern.replace(':04d}', ':}')
search_pattern = search_pattern.format(year='*', month='*', day='*')
all_fi... | Finds all files that match the given pattern. | thetis/interpolation.py | _find_files | thetisproject/thetis | 45 | python | def _find_files(self):
search_pattern = str(self.file_pattern)
search_pattern = search_pattern.replace(':02d}', ':}')
search_pattern = search_pattern.replace(':04d}', ':}')
search_pattern = search_pattern.format(year='*', month='*', day='*')
all_files = glob.glob(search_pattern)
assert (len... | def _find_files(self):
search_pattern = str(self.file_pattern)
search_pattern = search_pattern.replace(':02d}', ':}')
search_pattern = search_pattern.replace(':04d}', ':}')
search_pattern = search_pattern.format(year='*', month='*', day='*')
all_files = glob.glob(search_pattern)
assert (len... |
3e14c51262f7d4393ff4fed645e20a6c89ce02af5ba4b401046f5877667a5363 | def _parse_date(self, filename):
'\n Parse year, month, day from filename using the given pattern.\n '
re_pattern = str(self.file_pattern)
re_pattern = re_pattern.replace('{year:04d}', '(\\d{4,4})')
re_pattern = re_pattern.replace('{month:02d}', '(\\d{2,2})')
re_pattern = re_pattern.re... | Parse year, month, day from filename using the given pattern. | thetis/interpolation.py | _parse_date | thetisproject/thetis | 45 | python | def _parse_date(self, filename):
'\n \n '
re_pattern = str(self.file_pattern)
re_pattern = re_pattern.replace('{year:04d}', '(\\d{4,4})')
re_pattern = re_pattern.replace('{month:02d}', '(\\d{2,2})')
re_pattern = re_pattern.replace('{day:02d}', '(\\d{2,2})')
o = re.findall(re_patter... | def _parse_date(self, filename):
'\n \n '
re_pattern = str(self.file_pattern)
re_pattern = re_pattern.replace('{year:04d}', '(\\d{4,4})')
re_pattern = re_pattern.replace('{month:02d}', '(\\d{2,2})')
re_pattern = re_pattern.replace('{day:02d}', '(\\d{2,2})')
o = re.findall(re_patter... |
45f74066d91b76e3eea902c585f5bdac62c41ce3860e7db544c4913386a9f161 | @PETSc.Log.EventDecorator('thetis.DailyFileTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp inste... | Find file that contains the given simulation time
:arg float simulation_time: simulation time in seconds
:kwarg bool previous: if True finds previous existing time stamp instead
of next (default False).
:return: (filename, time index, simulation time) of found data | thetis/interpolation.py | find | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.DailyFileTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp inste... | @PETSc.Log.EventDecorator('thetis.DailyFileTimeSearch.find')
def find(self, simulation_time, previous=False):
'\n Find file that contains the given simulation time\n\n :arg float simulation_time: simulation time in seconds\n :kwarg bool previous: if True finds previous existing time stamp inste... |
d243e264476a129cfa5dac8de9fe629494a3bc6a5e674d622123c069d73f620d | def __init__(self, timesearch_obj, reader):
'\n :arg timesearch_obj: TimeSearch object\n :arg reader: FileTreeReader object\n '
self.timesearch = timesearch_obj
self.reader = reader
self.cache = {} | :arg timesearch_obj: TimeSearch object
:arg reader: FileTreeReader object | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | def __init__(self, timesearch_obj, reader):
'\n :arg timesearch_obj: TimeSearch object\n :arg reader: FileTreeReader object\n '
self.timesearch = timesearch_obj
self.reader = reader
self.cache = {} | def __init__(self, timesearch_obj, reader):
'\n :arg timesearch_obj: TimeSearch object\n :arg reader: FileTreeReader object\n '
self.timesearch = timesearch_obj
self.reader = reader
self.cache = {}<|docstring|>:arg timesearch_obj: TimeSearch object
:arg reader: FileTreeReader object... |
aae10337645407b5c8c3bc5be7453e4b47922da30d4a254d52285c49f61df1dd | def _get_from_cache(self, key):
'\n Fetch data set from cache, read if not present\n '
if (key not in self.cache):
self.cache[key] = self.reader(key[0], key[1])
return self.cache[key] | Fetch data set from cache, read if not present | thetis/interpolation.py | _get_from_cache | thetisproject/thetis | 45 | python | def _get_from_cache(self, key):
'\n \n '
if (key not in self.cache):
self.cache[key] = self.reader(key[0], key[1])
return self.cache[key] | def _get_from_cache(self, key):
'\n \n '
if (key not in self.cache):
self.cache[key] = self.reader(key[0], key[1])
return self.cache[key]<|docstring|>Fetch data set from cache, read if not present<|endoftext|> |
7333e776aa108d6074dbbf7fc0c0dd65d05820e3e23af945c49d15bce89ffcf3 | def _clean_cache(self, keys_to_keep):
'\n Remove cached data sets that are no longer needed\n '
for key in list(self.cache.keys()):
if (key not in keys_to_keep):
self.cache.pop(key) | Remove cached data sets that are no longer needed | thetis/interpolation.py | _clean_cache | thetisproject/thetis | 45 | python | def _clean_cache(self, keys_to_keep):
'\n \n '
for key in list(self.cache.keys()):
if (key not in keys_to_keep):
self.cache.pop(key) | def _clean_cache(self, keys_to_keep):
'\n \n '
for key in list(self.cache.keys()):
if (key not in keys_to_keep):
self.cache.pop(key)<|docstring|>Remove cached data sets that are no longer needed<|endoftext|> |
6f9a695fc8c91c90a5d69c23f837f9459adfb578523edd0b5ad8beaf6cde1a42 | def __call__(self, t):
'\n Interpolate at time t\n\n :retuns: list of numpy arrays\n '
prev_id = self.timesearch.find(t, previous=True)
next_id = self.timesearch.find(t, previous=False)
prev = self._get_from_cache(prev_id)
next = self._get_from_cache(next_id)
self._clean_cac... | Interpolate at time t
:retuns: list of numpy arrays | thetis/interpolation.py | __call__ | thetisproject/thetis | 45 | python | def __call__(self, t):
'\n Interpolate at time t\n\n :retuns: list of numpy arrays\n '
prev_id = self.timesearch.find(t, previous=True)
next_id = self.timesearch.find(t, previous=False)
prev = self._get_from_cache(prev_id)
next = self._get_from_cache(next_id)
self._clean_cac... | def __call__(self, t):
'\n Interpolate at time t\n\n :retuns: list of numpy arrays\n '
prev_id = self.timesearch.find(t, previous=True)
next_id = self.timesearch.find(t, previous=False)
prev = self._get_from_cache(prev_id)
next = self._get_from_cache(next_id)
self._clean_cac... |
f3b3d3223315268a38b0df62ff8f7b604ac5f50446b29275a21d9fffc612ee4d | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__init__')
def __init__(self, ncfile_pattern, variable_list, init_date, time_variable_name='time', scalars=None, allow_gaps=False):
'\n :arg str ncfile_pattern: file search pattern, e.g. "mydir/foo_*.nc"\n :arg variable_list: list if netCD... | :arg str ncfile_pattern: file search pattern, e.g. "mydir/foo_*.nc"
:arg variable_list: list if netCDF variable names to read
:arg datetime.datetime init_date: simulation start time
:kwarg scalars: (optional) list of scalars; scale output variables by
a factor.
.. note::
All the variables must have the same d... | thetis/interpolation.py | __init__ | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__init__')
def __init__(self, ncfile_pattern, variable_list, init_date, time_variable_name='time', scalars=None, allow_gaps=False):
'\n :arg str ncfile_pattern: file search pattern, e.g. "mydir/foo_*.nc"\n :arg variable_list: list if netCD... | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__init__')
def __init__(self, ncfile_pattern, variable_list, init_date, time_variable_name='time', scalars=None, allow_gaps=False):
'\n :arg str ncfile_pattern: file search pattern, e.g. "mydir/foo_*.nc"\n :arg variable_list: list if netCD... |
00a9de53267e85aa2e11edfe3fecb4bec3204473ab07e41db5f213cb220b3539 | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__call__')
def __call__(self, time):
'\n Time series at the given time\n\n :returns: list of scalars or numpy.arrays\n '
vals = self.time_interpolator(time)
if (self.scalars is not None):
for i in range(len(vals)):
... | Time series at the given time
:returns: list of scalars or numpy.arrays | thetis/interpolation.py | __call__ | thetisproject/thetis | 45 | python | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__call__')
def __call__(self, time):
'\n Time series at the given time\n\n :returns: list of scalars or numpy.arrays\n '
vals = self.time_interpolator(time)
if (self.scalars is not None):
for i in range(len(vals)):
... | @PETSc.Log.EventDecorator('thetis.NetCDFTimeSeriesInterpolator.__call__')
def __call__(self, time):
'\n Time series at the given time\n\n :returns: list of scalars or numpy.arrays\n '
vals = self.time_interpolator(time)
if (self.scalars is not None):
for i in range(len(vals)):
... |
9c9d8998d02fe141e863c63e16429fe0337aef29826157e703daf3f2a3b2be68 | def get_datetime(time, units, calendar):
'\n Convert netcdf time value to datetime.\n '
d = cftime.num2pydate(time, units, calendar)
if (d.tzinfo is None):
d = pytz.utc.localize(d)
return d | Convert netcdf time value to datetime. | thetis/interpolation.py | get_datetime | thetisproject/thetis | 45 | python | def get_datetime(time, units, calendar):
'\n \n '
d = cftime.num2pydate(time, units, calendar)
if (d.tzinfo is None):
d = pytz.utc.localize(d)
return d | def get_datetime(time, units, calendar):
'\n \n '
d = cftime.num2pydate(time, units, calendar)
if (d.tzinfo is None):
d = pytz.utc.localize(d)
return d<|docstring|>Convert netcdf time value to datetime.<|endoftext|> |
1e0e16c10952f553e9b23d82e1558fdcea4889e4a5bd813182574442faafcf3a | def getFields(self):
'\n Returns the list of avro fields sorted in order of name.\n '
return sorted(self.schema.fields, key=(lambda f: f.name)) | Returns the list of avro fields sorted in order of name. | scripts/generate_schemas.py | getFields | kerrydc/server | 0 | python | def getFields(self):
'\n \n '
return sorted(self.schema.fields, key=(lambda f: f.name)) | def getFields(self):
'\n \n '
return sorted(self.schema.fields, key=(lambda f: f.name))<|docstring|>Returns the list of avro fields sorted in order of name.<|endoftext|> |
dbf620623362409d4755d0177150cad317435fb96f6c49ea6f32b3e25b34e45a | def getEmbeddedTypes(self):
'\n Returns the set of embedded types in this class.\n '
ret = []
if isinstance(self.schema, avro.schema.RecordSchema):
for field in self.getFields():
if isinstance(field.type, avro.schema.ArraySchema):
if isinstance(field.type.it... | Returns the set of embedded types in this class. | scripts/generate_schemas.py | getEmbeddedTypes | kerrydc/server | 0 | python | def getEmbeddedTypes(self):
'\n \n '
ret = []
if isinstance(self.schema, avro.schema.RecordSchema):
for field in self.getFields():
if isinstance(field.type, avro.schema.ArraySchema):
if isinstance(field.type.items, avro.schema.RecordSchema):
... | def getEmbeddedTypes(self):
'\n \n '
ret = []
if isinstance(self.schema, avro.schema.RecordSchema):
for field in self.getFields():
if isinstance(field.type, avro.schema.ArraySchema):
if isinstance(field.type.items, avro.schema.RecordSchema):
... |
c92f882c14cb32c5ab8070ddb253d075ec246219b62c9f265d7626fdb1bdaaa8 | def formatSchema(self):
'\n Formats the schema source so that we can print it literally\n into a Python source file.\n '
schema = json.loads(self.schemaSource)
stack = [schema]
while (len(stack) > 0):
elm = stack.pop()
if ('doc' in elm):
elm['doc'] = ''
... | Formats the schema source so that we can print it literally
into a Python source file. | scripts/generate_schemas.py | formatSchema | kerrydc/server | 0 | python | def formatSchema(self):
'\n Formats the schema source so that we can print it literally\n into a Python source file.\n '
schema = json.loads(self.schemaSource)
stack = [schema]
while (len(stack) > 0):
elm = stack.pop()
if ('doc' in elm):
elm['doc'] =
... | def formatSchema(self):
'\n Formats the schema source so that we can print it literally\n into a Python source file.\n '
schema = json.loads(self.schemaSource)
stack = [schema]
while (len(stack) > 0):
elm = stack.pop()
if ('doc' in elm):
elm['doc'] =
... |
4ea99cefb376404e1156b99bec29d4b58a68c56bcd1260693a283150eccabea1 | def formatRequiredFields(self):
'\n Returns a string encoding the set of required fields (i.e those\n fields that do not have a default value.\n '
fields = []
for field in self.getFields():
if (not field.has_default):
fields.append(field)
if (len(fields) < 2):
... | Returns a string encoding the set of required fields (i.e those
fields that do not have a default value. | scripts/generate_schemas.py | formatRequiredFields | kerrydc/server | 0 | python | def formatRequiredFields(self):
'\n Returns a string encoding the set of required fields (i.e those\n fields that do not have a default value.\n '
fields = []
for field in self.getFields():
if (not field.has_default):
fields.append(field)
if (len(fields) < 2):
... | def formatRequiredFields(self):
'\n Returns a string encoding the set of required fields (i.e those\n fields that do not have a default value.\n '
fields = []
for field in self.getFields():
if (not field.has_default):
fields.append(field)
if (len(fields) < 2):
... |
b00561d0a7b0ff4da5e972108cea98c0d2fd63da5a2464d03022a3e55a9f7c57 | def writeEmbeddedTypesClassMethods(self, outputFile):
'\n Returns the definition for the _embeddedTypes dictionary. This is a\n temporary mechanism to provide a simple path from the current\n approach to more efficient and type-safe methods that we want\n to transition to.\n '
... | Returns the definition for the _embeddedTypes dictionary. This is a
temporary mechanism to provide a simple path from the current
approach to more efficient and type-safe methods that we want
to transition to. | scripts/generate_schemas.py | writeEmbeddedTypesClassMethods | kerrydc/server | 0 | python | def writeEmbeddedTypesClassMethods(self, outputFile):
'\n Returns the definition for the _embeddedTypes dictionary. This is a\n temporary mechanism to provide a simple path from the current\n approach to more efficient and type-safe methods that we want\n to transition to.\n '
... | def writeEmbeddedTypesClassMethods(self, outputFile):
'\n Returns the definition for the _embeddedTypes dictionary. This is a\n temporary mechanism to provide a simple path from the current\n approach to more efficient and type-safe methods that we want\n to transition to.\n '
... |
8152ef2d4bf0ace09eab34b524cd946100438a8ae95626b3ab0e6f5d87dea0ab | def write(self, outputFile):
'\n Writes the class definition to the specified file.\n '
superclass = 'ProtocolElement'
if isinstance(self.schema, avro.schema.EnumSchema):
superclass = 'object'
string = '\n\nclass {0}({1}):'.format(self.schema.name, superclass)
print(string, fil... | Writes the class definition to the specified file. | scripts/generate_schemas.py | write | kerrydc/server | 0 | python | def write(self, outputFile):
'\n \n '
superclass = 'ProtocolElement'
if isinstance(self.schema, avro.schema.EnumSchema):
superclass = 'object'
string = '\n\nclass {0}({1}):'.format(self.schema.name, superclass)
print(string, file=outputFile)
doc = self.schema.doc
if (do... | def write(self, outputFile):
'\n \n '
superclass = 'ProtocolElement'
if isinstance(self.schema, avro.schema.EnumSchema):
superclass = 'object'
string = '\n\nclass {0}({1}):'.format(self.schema.name, superclass)
print(string, file=outputFile)
doc = self.schema.doc
if (do... |
842d780d5cc58bfe31dfc21ff6c8f7815d09fec4e19b6d7f0c5c8805c6c4b226 | def writeHeader(self, outputFile):
'\n Writes the header information to the output file.\n '
print('"""{0}"""'.format(HEADER_COMMENT), file=outputFile)
print('from protocol import ProtocolElement', file=outputFile)
print('import avro.schema', file=outputFile)
print(file=outputFile)
... | Writes the header information to the output file. | scripts/generate_schemas.py | writeHeader | kerrydc/server | 0 | python | def writeHeader(self, outputFile):
'\n \n '
print('"{0}"'.format(HEADER_COMMENT), file=outputFile)
print('from protocol import ProtocolElement', file=outputFile)
print('import avro.schema', file=outputFile)
print(file=outputFile)
versionStr = self.version[1:]
print("version = '... | def writeHeader(self, outputFile):
'\n \n '
print('"{0}"'.format(HEADER_COMMENT), file=outputFile)
print('from protocol import ProtocolElement', file=outputFile)
print('import avro.schema', file=outputFile)
print(file=outputFile)
versionStr = self.version[1:]
print("version = '... |
8a3076f014b9e48675e9355bdc5cf074ac56214071bf6c47f26a5d44b8339e07 | def write(self):
'\n Writes the generated schema classes to the output file.\n '
with open(self.outputFile, 'w') as outputFile:
self.writeHeader(outputFile)
names = [cls.name for cls in self.classes]
classes = dict([(cls.name, cls) for cls in self.classes])
for name... | Writes the generated schema classes to the output file. | scripts/generate_schemas.py | write | kerrydc/server | 0 | python | def write(self):
'\n \n '
with open(self.outputFile, 'w') as outputFile:
self.writeHeader(outputFile)
names = [cls.name for cls in self.classes]
classes = dict([(cls.name, cls) for cls in self.classes])
for name in sorted(names):
cls = classes[name]
... | def write(self):
'\n \n '
with open(self.outputFile, 'w') as outputFile:
self.writeHeader(outputFile)
names = [cls.name for cls in self.classes]
classes = dict([(cls.name, cls) for cls in self.classes])
for name in sorted(names):
cls = classes[name]
... |
4498a9b3b112ee7df5df76d5d0acd58255750ae1b260f1e26a1cd73dfc999260 | def download(self, url, destination):
'\n Downloads the specified url and saves the result to the specified\n file.\n '
if (self.verbosity > 1):
print('Downloading', url, end='')
with open(destination, 'wb') as outputFile:
response = requests.get(url, stream=True)
... | Downloads the specified url and saves the result to the specified
file. | scripts/generate_schemas.py | download | kerrydc/server | 0 | python | def download(self, url, destination):
'\n Downloads the specified url and saves the result to the specified\n file.\n '
if (self.verbosity > 1):
print('Downloading', url, end=)
with open(destination, 'wb') as outputFile:
response = requests.get(url, stream=True)
... | def download(self, url, destination):
'\n Downloads the specified url and saves the result to the specified\n file.\n '
if (self.verbosity > 1):
print('Downloading', url, end=)
with open(destination, 'wb') as outputFile:
response = requests.get(url, stream=True)
... |
251aa4cfcdf3250e4e289bf00a6b9b7dd1518754824982536b2056786805f928 | def convertAvro(self, avdlFile):
'\n Converts the specified avdl file using the java tools.\n '
args = ['java', '-jar', self.avroJar, 'idl2schemata', avdlFile]
if (self.verbosity > 0):
print('converting', avdlFile)
if (self.verbosity > 1):
print('running:', ' '.join(args))
... | Converts the specified avdl file using the java tools. | scripts/generate_schemas.py | convertAvro | kerrydc/server | 0 | python | def convertAvro(self, avdlFile):
'\n \n '
args = ['java', '-jar', self.avroJar, 'idl2schemata', avdlFile]
if (self.verbosity > 0):
print('converting', avdlFile)
if (self.verbosity > 1):
print('running:', ' '.join(args))
if (self.verbosity > 1):
subprocess.check_... | def convertAvro(self, avdlFile):
'\n \n '
args = ['java', '-jar', self.avroJar, 'idl2schemata', avdlFile]
if (self.verbosity > 0):
print('converting', avdlFile)
if (self.verbosity > 1):
print('running:', ' '.join(args))
if (self.verbosity > 1):
subprocess.check_... |
e70cf210774854841c5b57e9d9a912b043a743c22b191ee75662604b1f8f89c2 | def nms(boxes, scores, nms_thr):
'Single class NMS implemented in Numpy.'
x1 = boxes[(:, 0)]
y1 = boxes[(:, 1)]
x2 = boxes[(:, 2)]
y2 = boxes[(:, 3)]
areas = (((x2 - x1) + 1) * ((y2 - y1) + 1))
order = scores.argsort()[::(- 1)]
keep = []
while (order.size > 0):
i = order[0]
... | Single class NMS implemented in Numpy. | mmdet/utils/demo_utils.py | nms | jie311/miemiedetection | 65 | python | def nms(boxes, scores, nms_thr):
x1 = boxes[(:, 0)]
y1 = boxes[(:, 1)]
x2 = boxes[(:, 2)]
y2 = boxes[(:, 3)]
areas = (((x2 - x1) + 1) * ((y2 - y1) + 1))
order = scores.argsort()[::(- 1)]
keep = []
while (order.size > 0):
i = order[0]
keep.append(i)
xx1 = np.m... | def nms(boxes, scores, nms_thr):
x1 = boxes[(:, 0)]
y1 = boxes[(:, 1)]
x2 = boxes[(:, 2)]
y2 = boxes[(:, 3)]
areas = (((x2 - x1) + 1) * ((y2 - y1) + 1))
order = scores.argsort()[::(- 1)]
keep = []
while (order.size > 0):
i = order[0]
keep.append(i)
xx1 = np.m... |
c17ec9919e6df80f281486b3ab149a8f0a5b9c18a207c441178c17ea68a52e4e | def multiclass_nms(boxes, scores, nms_thr, score_thr, class_agnostic=True):
'Multiclass NMS implemented in Numpy'
if class_agnostic:
nms_method = multiclass_nms_class_agnostic
else:
nms_method = multiclass_nms_class_aware
return nms_method(boxes, scores, nms_thr, score_thr) | Multiclass NMS implemented in Numpy | mmdet/utils/demo_utils.py | multiclass_nms | jie311/miemiedetection | 65 | python | def multiclass_nms(boxes, scores, nms_thr, score_thr, class_agnostic=True):
if class_agnostic:
nms_method = multiclass_nms_class_agnostic
else:
nms_method = multiclass_nms_class_aware
return nms_method(boxes, scores, nms_thr, score_thr) | def multiclass_nms(boxes, scores, nms_thr, score_thr, class_agnostic=True):
if class_agnostic:
nms_method = multiclass_nms_class_agnostic
else:
nms_method = multiclass_nms_class_aware
return nms_method(boxes, scores, nms_thr, score_thr)<|docstring|>Multiclass NMS implemented in Numpy<|e... |
79add93b4effcf20783f78fd15bd77d10ab999b8fa521d98d19e8466a037063a | def multiclass_nms_class_aware(boxes, scores, nms_thr, score_thr):
'Multiclass NMS implemented in Numpy. Class-aware version.'
final_dets = []
num_classes = scores.shape[1]
for cls_ind in range(num_classes):
cls_scores = scores[(:, cls_ind)]
valid_score_mask = (cls_scores > score_thr)
... | Multiclass NMS implemented in Numpy. Class-aware version. | mmdet/utils/demo_utils.py | multiclass_nms_class_aware | jie311/miemiedetection | 65 | python | def multiclass_nms_class_aware(boxes, scores, nms_thr, score_thr):
final_dets = []
num_classes = scores.shape[1]
for cls_ind in range(num_classes):
cls_scores = scores[(:, cls_ind)]
valid_score_mask = (cls_scores > score_thr)
if (valid_score_mask.sum() == 0):
continu... | def multiclass_nms_class_aware(boxes, scores, nms_thr, score_thr):
final_dets = []
num_classes = scores.shape[1]
for cls_ind in range(num_classes):
cls_scores = scores[(:, cls_ind)]
valid_score_mask = (cls_scores > score_thr)
if (valid_score_mask.sum() == 0):
continu... |
3a513408711f563c91cc45fb6ce584ab9f9993c0ffbbabbc8ba913e7e765e7b9 | def multiclass_nms_class_agnostic(boxes, scores, nms_thr, score_thr):
'Multiclass NMS implemented in Numpy. Class-agnostic version.'
cls_inds = scores.argmax(1)
cls_scores = scores[(np.arange(len(cls_inds)), cls_inds)]
valid_score_mask = (cls_scores > score_thr)
if (valid_score_mask.sum() == 0):
... | Multiclass NMS implemented in Numpy. Class-agnostic version. | mmdet/utils/demo_utils.py | multiclass_nms_class_agnostic | jie311/miemiedetection | 65 | python | def multiclass_nms_class_agnostic(boxes, scores, nms_thr, score_thr):
cls_inds = scores.argmax(1)
cls_scores = scores[(np.arange(len(cls_inds)), cls_inds)]
valid_score_mask = (cls_scores > score_thr)
if (valid_score_mask.sum() == 0):
return None
valid_scores = cls_scores[valid_score_mas... | def multiclass_nms_class_agnostic(boxes, scores, nms_thr, score_thr):
cls_inds = scores.argmax(1)
cls_scores = scores[(np.arange(len(cls_inds)), cls_inds)]
valid_score_mask = (cls_scores > score_thr)
if (valid_score_mask.sum() == 0):
return None
valid_scores = cls_scores[valid_score_mas... |
ca1a3a3f12778e30c7fd62a16399f27131952a37f849a843e224051829d06248 | def numpy_jaccard(box_a, box_b):
'计算两组矩形两两之间的iou\n Args:\n box_a: (tensor) bounding boxes, Shape: [A, 4].\n box_b: (tensor) bounding boxes, Shape: [B, 4].\n Return:\n ious: (tensor) Shape: [A, B]\n '
A = box_a.shape[0]
B = box_b.shape[0]
box_a_x1y1 = np.reshape(box_a[(:, 2:... | 计算两组矩形两两之间的iou
Args:
box_a: (tensor) bounding boxes, Shape: [A, 4].
box_b: (tensor) bounding boxes, Shape: [B, 4].
Return:
ious: (tensor) Shape: [A, B] | mmdet/utils/demo_utils.py | numpy_jaccard | jie311/miemiedetection | 65 | python | def numpy_jaccard(box_a, box_b):
'计算两组矩形两两之间的iou\n Args:\n box_a: (tensor) bounding boxes, Shape: [A, 4].\n box_b: (tensor) bounding boxes, Shape: [B, 4].\n Return:\n ious: (tensor) Shape: [A, B]\n '
A = box_a.shape[0]
B = box_b.shape[0]
box_a_x1y1 = np.reshape(box_a[(:, 2:... | def numpy_jaccard(box_a, box_b):
'计算两组矩形两两之间的iou\n Args:\n box_a: (tensor) bounding boxes, Shape: [A, 4].\n box_b: (tensor) bounding boxes, Shape: [B, 4].\n Return:\n ious: (tensor) Shape: [A, B]\n '
A = box_a.shape[0]
B = box_b.shape[0]
box_a_x1y1 = np.reshape(box_a[(:, 2:... |
bcde31f610db1818381058b0cf41ee2772bdd829f9a2339427caefd82a0753b4 | def _numpy_matrix_nms(bboxes, cate_labels, cate_scores, kernel='gaussian', sigma=2.0):
"Matrix NMS for multi-class bboxes.\n Args:\n bboxes (Tensor): shape (n, 4)\n cate_labels (Tensor): shape (n), mask labels in descending order\n cate_scores (Tensor): shape (n), mask scores in descending o... | Matrix NMS for multi-class bboxes.
Args:
bboxes (Tensor): shape (n, 4)
cate_labels (Tensor): shape (n), mask labels in descending order
cate_scores (Tensor): shape (n), mask scores in descending order
kernel (str): 'linear' or 'gaussian'
sigma (float): std in gaussian method
Returns:
Tensor: ca... | mmdet/utils/demo_utils.py | _numpy_matrix_nms | jie311/miemiedetection | 65 | python | def _numpy_matrix_nms(bboxes, cate_labels, cate_scores, kernel='gaussian', sigma=2.0):
"Matrix NMS for multi-class bboxes.\n Args:\n bboxes (Tensor): shape (n, 4)\n cate_labels (Tensor): shape (n), mask labels in descending order\n cate_scores (Tensor): shape (n), mask scores in descending o... | def _numpy_matrix_nms(bboxes, cate_labels, cate_scores, kernel='gaussian', sigma=2.0):
"Matrix NMS for multi-class bboxes.\n Args:\n bboxes (Tensor): shape (n, 4)\n cate_labels (Tensor): shape (n), mask labels in descending order\n cate_scores (Tensor): shape (n), mask scores in descending o... |
89b012cbc3643e4f970317ee5911da4b1fcfcd496844db8f44907c30dd38e648 | def test_arp_service(self):
'\n test for the ARP service\n '
attr = self.c.get_port_attr(port=self.tx_port)
if (attr['layer_mode'] != 'IPv4'):
return self.skip('ARP: skipping test for non IPv4 configuration')
dst_ipv4 = attr['dest']
src_ipv4 = attr['src_ipv4']
assert is... | test for the ARP service | scripts/automation/regression/stateless_tests/stl_services_test.py | test_arp_service | alialnu/trex-core | 0 | python | def test_arp_service(self):
'\n \n '
attr = self.c.get_port_attr(port=self.tx_port)
if (attr['layer_mode'] != 'IPv4'):
return self.skip('ARP: skipping test for non IPv4 configuration')
dst_ipv4 = attr['dest']
src_ipv4 = attr['src_ipv4']
assert is_valid_ipv4(src_ipv4)
... | def test_arp_service(self):
'\n \n '
attr = self.c.get_port_attr(port=self.tx_port)
if (attr['layer_mode'] != 'IPv4'):
return self.skip('ARP: skipping test for non IPv4 configuration')
dst_ipv4 = attr['dest']
src_ipv4 = attr['src_ipv4']
assert is_valid_ipv4(src_ipv4)
... |
69e692b911ad0ede2a221e759c66a13ffa2b4a5f7917549a9ab146dfb980c811 | def test_ping_service(self):
'\n test for the Ping IPv4 service\n '
pass | test for the Ping IPv4 service | scripts/automation/regression/stateless_tests/stl_services_test.py | test_ping_service | alialnu/trex-core | 0 | python | def test_ping_service(self):
'\n \n '
pass | def test_ping_service(self):
'\n \n '
pass<|docstring|>test for the Ping IPv4 service<|endoftext|> |
8d1f5e3c5f721baf710c529306442bcec384a94ae549f4d8bc3793a758b3575a | def update(self, preds, labels):
"\n Update the states based on the current mini-batch prediction results.\n\n Args:\n preds(numpy.array): prediction results of current mini-batch,\n the output of two-class sigmoid function.\n Shape: [batch_size, 1]. Dtype: 'fl... | Update the states based on the current mini-batch prediction results.
Args:
preds(numpy.array): prediction results of current mini-batch,
the output of two-class sigmoid function.
Shape: [batch_size, 1]. Dtype: 'float64' or 'float32'.
labels(numpy.array): ground truth (labels) of current mini-b... | utils/metric.py | update | lichangao1826/ml-contest | 3 | python | def update(self, preds, labels):
"\n Update the states based on the current mini-batch prediction results.\n\n Args:\n preds(numpy.array): prediction results of current mini-batch,\n the output of two-class sigmoid function.\n Shape: [batch_size, 1]. Dtype: 'fl... | def update(self, preds, labels):
"\n Update the states based on the current mini-batch prediction results.\n\n Args:\n preds(numpy.array): prediction results of current mini-batch,\n the output of two-class sigmoid function.\n Shape: [batch_size, 1]. Dtype: 'fl... |
bd07e828606af2b46ec2ec6dc96bdec21a3ae519fef727dd805dc34a09f077fe | def accumulate(self):
'\n Calculate the final kappa.\n\n Returns:\n A scaler float: results of the calculated kappa.\n '
po = ((float(np.sum(self.pred_each_n)) / self.n) if (self.n != 0) else 0.0)
pe = ((float(np.sum([(self.pred_each_n[i] * self.label_each_n[i]) for i in rang... | Calculate the final kappa.
Returns:
A scaler float: results of the calculated kappa. | utils/metric.py | accumulate | lichangao1826/ml-contest | 3 | python | def accumulate(self):
'\n Calculate the final kappa.\n\n Returns:\n A scaler float: results of the calculated kappa.\n '
po = ((float(np.sum(self.pred_each_n)) / self.n) if (self.n != 0) else 0.0)
pe = ((float(np.sum([(self.pred_each_n[i] * self.label_each_n[i]) for i in rang... | def accumulate(self):
'\n Calculate the final kappa.\n\n Returns:\n A scaler float: results of the calculated kappa.\n '
po = ((float(np.sum(self.pred_each_n)) / self.n) if (self.n != 0) else 0.0)
pe = ((float(np.sum([(self.pred_each_n[i] * self.label_each_n[i]) for i in rang... |
6822eac52eada965149e53050d052d6e50fb744c45aca62931d5ba5c7446b702 | def reset(self):
'\n Resets all of the metric state.\n '
self.n = 0
self.pred_each_n = ([0] * self.num_classes)
self.label_each_n = ([0] * self.num_classes) | Resets all of the metric state. | utils/metric.py | reset | lichangao1826/ml-contest | 3 | python | def reset(self):
'\n \n '
self.n = 0
self.pred_each_n = ([0] * self.num_classes)
self.label_each_n = ([0] * self.num_classes) | def reset(self):
'\n \n '
self.n = 0
self.pred_each_n = ([0] * self.num_classes)
self.label_each_n = ([0] * self.num_classes)<|docstring|>Resets all of the metric state.<|endoftext|> |
531127c10981d93d011623fbdf9c5810457f64a67a7c0ea74f78b1c108624829 | def name(self):
'\n Returns metric name\n '
return self._name | Returns metric name | utils/metric.py | name | lichangao1826/ml-contest | 3 | python | def name(self):
'\n \n '
return self._name | def name(self):
'\n \n '
return self._name<|docstring|>Returns metric name<|endoftext|> |
7c6431ad06a5d6c1e0540171a954bd89d7ce5e18b1050d37b0d4c0f1cef5d19f | def __init__(self, path, filename, initialize=True, deps=[], mips=False):
'Initializes access to analysis results.'
self.path = path
self.filename = filename
self.deps = deps
self.mips = mips
self.bdictionary = None
self.interfacedictionary = None
self.x86dictionary = None
self.mipsd... | Initializes access to analysis results. | chb/app/AppAccess.py | __init__ | psifertex/CodeHawk-Binary | 0 | python | def __init__(self, path, filename, initialize=True, deps=[], mips=False):
self.path = path
self.filename = filename
self.deps = deps
self.mips = mips
self.bdictionary = None
self.interfacedictionary = None
self.x86dictionary = None
self.mipsdictionary = None
self.userdata = None... | def __init__(self, path, filename, initialize=True, deps=[], mips=False):
self.path = path
self.filename = filename
self.deps = deps
self.mips = mips
self.bdictionary = None
self.interfacedictionary = None
self.x86dictionary = None
self.mipsdictionary = None
self.userdata = None... |
490463d6939a86fe8e1fad24cd03d3c58718892d832ef3931cad8fde3b8bf1c6 | def get_md5_profile(self):
'Creates a dictionary of function md5s.\n\n Structure:\n -- md5hash -> faddr -> instruction count\n '
result = {}
def get_md5(faddr, f):
md5 = f.get_md5_hash()
result.setdefault(md5, {})
result[md5][faddr] = mf = {}
mf['instrs'... | Creates a dictionary of function md5s.
Structure:
-- md5hash -> faddr -> instruction count | chb/app/AppAccess.py | get_md5_profile | psifertex/CodeHawk-Binary | 0 | python | def get_md5_profile(self):
'Creates a dictionary of function md5s.\n\n Structure:\n -- md5hash -> faddr -> instruction count\n '
result = {}
def get_md5(faddr, f):
md5 = f.get_md5_hash()
result.setdefault(md5, {})
result[md5][faddr] = mf = {}
mf['instrs'... | def get_md5_profile(self):
'Creates a dictionary of function md5s.\n\n Structure:\n -- md5hash -> faddr -> instruction count\n '
result = {}
def get_md5(faddr, f):
md5 = f.get_md5_hash()
result.setdefault(md5, {})
result[md5][faddr] = mf = {}
mf['instrs'... |
25656de0fa53c256ee9ca83bd795b00761a969bb20b05405a356fde8d3f2d3e3 | def get_calls_to_app_function(self, tgtaddr):
'Returns a dictionary faddr -> Asm/MIPSInstruction list.'
result = {}
def f(faddr, fn):
calls = fn.get_calls_to_app_function(tgtaddr)
if (len(calls) > 0):
result[faddr] = calls
self.iter_functions(f)
return result | Returns a dictionary faddr -> Asm/MIPSInstruction list. | chb/app/AppAccess.py | get_calls_to_app_function | psifertex/CodeHawk-Binary | 0 | python | def get_calls_to_app_function(self, tgtaddr):
result = {}
def f(faddr, fn):
calls = fn.get_calls_to_app_function(tgtaddr)
if (len(calls) > 0):
result[faddr] = calls
self.iter_functions(f)
return result | def get_calls_to_app_function(self, tgtaddr):
result = {}
def f(faddr, fn):
calls = fn.get_calls_to_app_function(tgtaddr)
if (len(calls) > 0):
result[faddr] = calls
self.iter_functions(f)
return result<|docstring|>Returns a dictionary faddr -> Asm/MIPSInstruction list.<... |
60c380ff1210e21f2c308d59ec84014bd2550154d377bf11d3b21f3e2b335e5e | def get_app_calls(self):
'Returns a dictionary faddr -> Asm/MIPSInstruction.'
result = {}
def f(faddr, fn):
appcalls = fn.get_app_calls()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result | Returns a dictionary faddr -> Asm/MIPSInstruction. | chb/app/AppAccess.py | get_app_calls | psifertex/CodeHawk-Binary | 0 | python | def get_app_calls(self):
result = {}
def f(faddr, fn):
appcalls = fn.get_app_calls()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result | def get_app_calls(self):
result = {}
def f(faddr, fn):
appcalls = fn.get_app_calls()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result<|docstring|>Returns a dictionary faddr -> Asm/MIPSInstruction.<|endoftext|> |
163d3cc21e36ff3fa4e414b40aaf051e1d776b949cd2a23f29fb09360133cf2a | def get_call_instructions(self):
'Returns a dictionary faddr -> Asm/MIPSInstruction.'
result = {}
def f(faddr, fn):
appcalls = fn.get_call_instructions()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result | Returns a dictionary faddr -> Asm/MIPSInstruction. | chb/app/AppAccess.py | get_call_instructions | psifertex/CodeHawk-Binary | 0 | python | def get_call_instructions(self):
result = {}
def f(faddr, fn):
appcalls = fn.get_call_instructions()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result | def get_call_instructions(self):
result = {}
def f(faddr, fn):
appcalls = fn.get_call_instructions()
if (len(appcalls) > 0):
result[faddr] = appcalls
self.iter_functions(f)
return result<|docstring|>Returns a dictionary faddr -> Asm/MIPSInstruction.<|endoftext|> |
55eb64d46e65dfbac4ee22cddb649dd432cb7b87d08f306b30909a1d6a7ab757 | def normalize_coords(coords, shape):
'\n Normalize coordinates of a grid between [-1, 1]\n Args:\n coords [torch.Tensor(..., 2)]: Coordinates in grid\n shape [torch.Tensor(2)]: Grid shape [H, W]\n Returns:\n norm_coords [torch.Tensor(.., 2)]: Normalized coordinates in grid\n '
m... | Normalize coordinates of a grid between [-1, 1]
Args:
coords [torch.Tensor(..., 2)]: Coordinates in grid
shape [torch.Tensor(2)]: Grid shape [H, W]
Returns:
norm_coords [torch.Tensor(.., 2)]: Normalized coordinates in grid | pcdet/utils/grid_utils.py | normalize_coords | xiaoMrzhang/CaDDN | 205 | python | def normalize_coords(coords, shape):
'\n Normalize coordinates of a grid between [-1, 1]\n Args:\n coords [torch.Tensor(..., 2)]: Coordinates in grid\n shape [torch.Tensor(2)]: Grid shape [H, W]\n Returns:\n norm_coords [torch.Tensor(.., 2)]: Normalized coordinates in grid\n '
m... | def normalize_coords(coords, shape):
'\n Normalize coordinates of a grid between [-1, 1]\n Args:\n coords [torch.Tensor(..., 2)]: Coordinates in grid\n shape [torch.Tensor(2)]: Grid shape [H, W]\n Returns:\n norm_coords [torch.Tensor(.., 2)]: Normalized coordinates in grid\n '
m... |
c5f274021dd3b1bd2d8cb47c95f7b7cb2bfce0ea735ce424abf486123febbf48 | def get_current_request_hostname():
'\n This method will return the hostname that was used in the current Django request\n '
hostname = None
request = get_current_request()
if request:
hostname = request.META.get('HTTP_HOST')
return hostname | This method will return the hostname that was used in the current Django request | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/util/xmodule_django.py | get_current_request_hostname | osoco/better-ways-of-thinking-about-software | 3 | python | def get_current_request_hostname():
'\n \n '
hostname = None
request = get_current_request()
if request:
hostname = request.META.get('HTTP_HOST')
return hostname | def get_current_request_hostname():
'\n \n '
hostname = None
request = get_current_request()
if request:
hostname = request.META.get('HTTP_HOST')
return hostname<|docstring|>This method will return the hostname that was used in the current Django request<|endoftext|> |
154da2eba8fa8bd579a461ec52d5316c75238294efc205fd63189d292b0473af | def add_webpack_to_fragment(fragment, bundle_name, extension=None, config='DEFAULT'):
'\n Add all webpack chunks to the supplied fragment as the appropriate resource type.\n '
for chunk in webpack_loader.utils.get_files(bundle_name, extension, config):
if chunk['name'].endswith(('.js', '.js.gz')):... | Add all webpack chunks to the supplied fragment as the appropriate resource type. | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/util/xmodule_django.py | add_webpack_to_fragment | osoco/better-ways-of-thinking-about-software | 3 | python | def add_webpack_to_fragment(fragment, bundle_name, extension=None, config='DEFAULT'):
'\n \n '
for chunk in webpack_loader.utils.get_files(bundle_name, extension, config):
if chunk['name'].endswith(('.js', '.js.gz')):
fragment.add_javascript_url(chunk['url'])
elif chunk['name']... | def add_webpack_to_fragment(fragment, bundle_name, extension=None, config='DEFAULT'):
'\n \n '
for chunk in webpack_loader.utils.get_files(bundle_name, extension, config):
if chunk['name'].endswith(('.js', '.js.gz')):
fragment.add_javascript_url(chunk['url'])
elif chunk['name']... |
539d7e48a3bb489e486e6c367211e0717df2fb15781ce910814afdf0679a99ba | def test_success(database):
' Test that calculation passes with equal values and with a null '
value_one = Decimal('100.00')
value_two = Decimal('200.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=(value_one + value_two), ussgl480100_undelivered_or_cpe=value_one, ussgl48810... | Test that calculation passes with equal values and with a null | tests/unit/dataactvalidator/test_b3_object_class_program_activity_2.py | test_success | broker-fork/data-act-broker-backend | 0 | python | def test_success(database):
' '
value_one = Decimal('100.00')
value_two = Decimal('200.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=(value_one + value_two), ussgl480100_undelivered_or_cpe=value_one, ussgl488100_upward_adjustm_cpe=value_two)
ocpa_null = ObjectClassPro... | def test_success(database):
' '
value_one = Decimal('100.00')
value_two = Decimal('200.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=(value_one + value_two), ussgl480100_undelivered_or_cpe=value_one, ussgl488100_upward_adjustm_cpe=value_two)
ocpa_null = ObjectClassPro... |
ec38eb4239ec5a37fffb4527fa95a999a247259160d809bae7ce39f0c95161c3 | def test_failure(database):
' Test that calculation fails for unequal values '
value = Decimal('500.00')
value2 = Decimal('100.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=value, ussgl480100_undelivered_or_cpe=value2, ussgl488100_upward_adjustm_cpe=value2)
assert (num... | Test that calculation fails for unequal values | tests/unit/dataactvalidator/test_b3_object_class_program_activity_2.py | test_failure | broker-fork/data-act-broker-backend | 0 | python | def test_failure(database):
' '
value = Decimal('500.00')
value2 = Decimal('100.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=value, ussgl480100_undelivered_or_cpe=value2, ussgl488100_upward_adjustm_cpe=value2)
assert (number_of_errors(_FILE, database, models=[ocpa]) ... | def test_failure(database):
' '
value = Decimal('500.00')
value2 = Decimal('100.00')
ocpa = ObjectClassProgramActivityFactory(obligations_undelivered_or_cpe=value, ussgl480100_undelivered_or_cpe=value2, ussgl488100_upward_adjustm_cpe=value2)
assert (number_of_errors(_FILE, database, models=[ocpa]) ... |
ac79712cd2285278f92db5aadaa531d6e584b3b627a5d5fe1890669cd27e0834 | def getChannelGroups(self, startIndex=None, pageSize=None, sortBy=None, filter=None, responseFields=None):
' Retrieves a list of defined channel groups according to any filter and sort criteria specified in the request.\n\t\t\n\t\tArgs:\n\t\t\t| startIndex (int) - When creating paged results from a query, this valu... | Retrieves a list of defined channel groups according to any filter and sort criteria specified in the request.
Args:
| startIndex (int) - When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSi... | mozurestsdk/commerce/channelgroup.py | getChannelGroups | Mozu/mozu-python-sdk | 1 | python | def getChannelGroups(self, startIndex=None, pageSize=None, sortBy=None, filter=None, responseFields=None):
' Retrieves a list of defined channel groups according to any filter and sort criteria specified in the request.\n\t\t\n\t\tArgs:\n\t\t\t| startIndex (int) - When creating paged results from a query, this valu... | def getChannelGroups(self, startIndex=None, pageSize=None, sortBy=None, filter=None, responseFields=None):
' Retrieves a list of defined channel groups according to any filter and sort criteria specified in the request.\n\t\t\n\t\tArgs:\n\t\t\t| startIndex (int) - When creating paged results from a query, this valu... |
f4e791c6306dac7aa5ee0875f2f22818efd8484436c30f64cd58a66e2c826ff4 | def getChannelGroup(self, code, responseFields=None):
' Retrieves the details of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\t| responseFields (string) - Use this field to include those fields which are not included by default... | Retrieves the details of a defined channel group.
Args:
| code (string) - User-defined code that uniqely identifies the channel group.
| responseFields (string) - Use this field to include those fields which are not included by default.
Returns:
| ChannelGroup
Raises:
| ApiException | mozurestsdk/commerce/channelgroup.py | getChannelGroup | Mozu/mozu-python-sdk | 1 | python | def getChannelGroup(self, code, responseFields=None):
' Retrieves the details of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\t| responseFields (string) - Use this field to include those fields which are not included by default... | def getChannelGroup(self, code, responseFields=None):
' Retrieves the details of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\t| responseFields (string) - Use this field to include those fields which are not included by default... |
eb6271f64caeb6e4cbe079974147f07d459eb87fdb51d3a17cb49942ff3352ab | def createChannelGroup(self, channelGroup, responseFields=None):
' Creates a new group of channels with common information.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| responseFields (string) - Use this field to include those field... | Creates a new group of channels with common information.
Args:
| channelGroup(channelGroup) - Properties of a group of channels that share common information.
| responseFields (string) - Use this field to include those fields which are not included by default.
Returns:
| ChannelGroup
Raises:... | mozurestsdk/commerce/channelgroup.py | createChannelGroup | Mozu/mozu-python-sdk | 1 | python | def createChannelGroup(self, channelGroup, responseFields=None):
' Creates a new group of channels with common information.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| responseFields (string) - Use this field to include those field... | def createChannelGroup(self, channelGroup, responseFields=None):
' Creates a new group of channels with common information.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| responseFields (string) - Use this field to include those field... |
3469a5a8efc3e72805f45fa6681157448bb448fb208fbb140b3e399a18abef70 | def updateChannelGroup(self, channelGroup, code, responseFields=None):
' Updates one or more properties of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| code (string) - User-defined code that uniqely identifi... | Updates one or more properties of a defined channel group.
Args:
| channelGroup(channelGroup) - Properties of a group of channels that share common information.
| code (string) - User-defined code that uniqely identifies the channel group.
| responseFields (string) - Use this field to include t... | mozurestsdk/commerce/channelgroup.py | updateChannelGroup | Mozu/mozu-python-sdk | 1 | python | def updateChannelGroup(self, channelGroup, code, responseFields=None):
' Updates one or more properties of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| code (string) - User-defined code that uniqely identifi... | def updateChannelGroup(self, channelGroup, code, responseFields=None):
' Updates one or more properties of a defined channel group.\n\t\t\n\t\tArgs:\n\t\t\t| channelGroup(channelGroup) - Properties of a group of channels that share common information.\n\t\t\t| code (string) - User-defined code that uniqely identifi... |
0a610f715ba062587d04c63a268f98b1c5f4ba0380c0b547a3b2394707526a9f | def deleteChannelGroup(self, code):
' Deletes a defined group of channels, which removes the group association with each channel in the group but does not delete the channel definitions themselves.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\n\t\tRais... | Deletes a defined group of channels, which removes the group association with each channel in the group but does not delete the channel definitions themselves.
Args:
| code (string) - User-defined code that uniqely identifies the channel group.
Raises:
| ApiException | mozurestsdk/commerce/channelgroup.py | deleteChannelGroup | Mozu/mozu-python-sdk | 1 | python | def deleteChannelGroup(self, code):
' Deletes a defined group of channels, which removes the group association with each channel in the group but does not delete the channel definitions themselves.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\n\t\tRais... | def deleteChannelGroup(self, code):
' Deletes a defined group of channels, which removes the group association with each channel in the group but does not delete the channel definitions themselves.\n\t\t\n\t\tArgs:\n\t\t\t| code (string) - User-defined code that uniqely identifies the channel group.\n\t\t\n\t\tRais... |
26d6223f2952c5c958573940e1b9cf392fa615f9b2f944c9358c62545e0d8295 | def __init__(self, Globals=None):
'Constructor'
self.Globals = Globals | Constructor | xpower/Analyzers/PriceScatter.py | __init__ | UpSea/ZipLineMid | 0 | python | def __init__(self, Globals=None):
self.Globals = Globals | def __init__(self, Globals=None):
self.Globals = Globals<|docstring|>Constructor<|endoftext|> |
49d7dcbee320e2503fbc014463718324f888ff06bfb00dd84d8da1d4b774e435 | def calcWDColors():
'\n Calculate a few example WD colors. Values to go in stellarMags(). Here in case\n values need to be regenerated (different stars, bandpasses change, etc.)\n '
try:
from lsst.utils import getPackageDir
import os
from rubin_sim.photUtils import Bandpass, Sed... | Calculate a few example WD colors. Values to go in stellarMags(). Here in case
values need to be regenerated (different stars, bandpasses change, etc.) | rubin_sim/utils/stellarMags.py | calcWDColors | RileyWClarke/flarubin | 0 | python | def calcWDColors():
'\n Calculate a few example WD colors. Values to go in stellarMags(). Here in case\n values need to be regenerated (different stars, bandpasses change, etc.)\n '
try:
from lsst.utils import getPackageDir
import os
from rubin_sim.photUtils import Bandpass, Sed... | def calcWDColors():
'\n Calculate a few example WD colors. Values to go in stellarMags(). Here in case\n values need to be regenerated (different stars, bandpasses change, etc.)\n '
try:
from lsst.utils import getPackageDir
import os
from rubin_sim.photUtils import Bandpass, Sed... |
c2a158e90078d6aa177dc08cbbcf11bac467883b5133c9b13cd43121c1c52cec | def stellarMags(stellarType, rmag=19.0):
"\n Calculates the expected magnitudes in LSST filters for a\n typical star of the given spectral type.\n\n Based on mapping of Kuruz models to spectral types here:\n http://www.stsci.edu/hst/observatory/crds/k93models.html\n\n\n Parameters\n ----------\n ... | Calculates the expected magnitudes in LSST filters for a
typical star of the given spectral type.
Based on mapping of Kuruz models to spectral types here:
http://www.stsci.edu/hst/observatory/crds/k93models.html
Parameters
----------
stellarType : str
Spectral type of a star (O,B,A,F,G,K,M), or for white dwarf c... | rubin_sim/utils/stellarMags.py | stellarMags | RileyWClarke/flarubin | 0 | python | def stellarMags(stellarType, rmag=19.0):
"\n Calculates the expected magnitudes in LSST filters for a\n typical star of the given spectral type.\n\n Based on mapping of Kuruz models to spectral types here:\n http://www.stsci.edu/hst/observatory/crds/k93models.html\n\n\n Parameters\n ----------\n ... | def stellarMags(stellarType, rmag=19.0):
"\n Calculates the expected magnitudes in LSST filters for a\n typical star of the given spectral type.\n\n Based on mapping of Kuruz models to spectral types here:\n http://www.stsci.edu/hst/observatory/crds/k93models.html\n\n\n Parameters\n ----------\n ... |
d079a6c2779c6f38f687685e0e4b2e0f4f7a41bb36d88caa1817c890f6fe40de | def layer_warp(self, input, stage_num, rfp_feat=None):
'\n Args:\n input (Variable): input variable.\n stage_num (int): the stage number, should be 2, 3, 4, 5\n rfp_feat (Variable): feedback connection from FPN neck\n\n Returns:\n The last variable in endpoi... | Args:
input (Variable): input variable.
stage_num (int): the stage number, should be 2, 3, 4, 5
rfp_feat (Variable): feedback connection from FPN neck
Returns:
The last variable in endpoint-th stage. | ppdet/modeling/backbones/resnet.py | layer_warp | ZeHuiGong/AFSM | 27 | python | def layer_warp(self, input, stage_num, rfp_feat=None):
'\n Args:\n input (Variable): input variable.\n stage_num (int): the stage number, should be 2, 3, 4, 5\n rfp_feat (Variable): feedback connection from FPN neck\n\n Returns:\n The last variable in endpoi... | def layer_warp(self, input, stage_num, rfp_feat=None):
'\n Args:\n input (Variable): input variable.\n stage_num (int): the stage number, should be 2, 3, 4, 5\n rfp_feat (Variable): feedback connection from FPN neck\n\n Returns:\n The last variable in endpoi... |
aec3dac31cb0e8173a4700d41a6970dae49699d0e3fbaa95e484153be8868d69 | def __call__(self, input, rfp_feats=None):
'rfp_feat (tuple(Variable)): only if in recursive feature pyramid, it will be not None'
assert isinstance(input, Variable)
assert (not (set(self.feature_maps) - set([2, 3, 4, 5]))), 'feature maps {} not in [2, 3, 4, 5]'.format(self.feature_maps)
res_endpoints =... | rfp_feat (tuple(Variable)): only if in recursive feature pyramid, it will be not None | ppdet/modeling/backbones/resnet.py | __call__ | ZeHuiGong/AFSM | 27 | python | def __call__(self, input, rfp_feats=None):
assert isinstance(input, Variable)
assert (not (set(self.feature_maps) - set([2, 3, 4, 5]))), 'feature maps {} not in [2, 3, 4, 5]'.format(self.feature_maps)
res_endpoints = []
res = input
feature_maps = self.feature_maps
severed_head = getattr(sel... | def __call__(self, input, rfp_feats=None):
assert isinstance(input, Variable)
assert (not (set(self.feature_maps) - set([2, 3, 4, 5]))), 'feature maps {} not in [2, 3, 4, 5]'.format(self.feature_maps)
res_endpoints = []
res = input
feature_maps = self.feature_maps
severed_head = getattr(sel... |
027b7ca83bec0b5ae8f430116d8b3e682bea322b4dfb1e7a3c6badc144d4dc71 | def __init__(self, uri: str, name: str='') -> None:
'\n :param uri: the URI to the data source\n :param name: the name to assign to this component\n '
if (not name):
name = str(uuid4().hex)
self._name = name
self._uri = uri
self._is_live = (uri.find('rtsp://') == 0) | :param uri: the URI to the data source
:param name: the name to assign to this component | src/monaistream/sources/uri.py | __init__ | Project-MONAI/MONAIStream | 11 | python | def __init__(self, uri: str, name: str=) -> None:
'\n :param uri: the URI to the data source\n :param name: the name to assign to this component\n '
if (not name):
name = str(uuid4().hex)
self._name = name
self._uri = uri
self._is_live = (uri.find('rtsp://') == 0) | def __init__(self, uri: str, name: str=) -> None:
'\n :param uri: the URI to the data source\n :param name: the name to assign to this component\n '
if (not name):
name = str(uuid4().hex)
self._name = name
self._uri = uri
self._is_live = (uri.find('rtsp://') == 0)<|docst... |
d9d4790ebbfc55e9e4da5fc57915892ca43d6c0ef90cd843b6a6aa1f3912e8de | def initialize(self):
'\n Initialize the `uridecodebin` GStreamer component.\n '
uri_decode_bin_name = f'{self._name}-uridecodebin'
uri_decode_bin = Gst.ElementFactory.make('uridecodebin', uri_decode_bin_name)
if (not uri_decode_bin):
raise BinCreationError(f'Unable to create sourc... | Initialize the `uridecodebin` GStreamer component. | src/monaistream/sources/uri.py | initialize | Project-MONAI/MONAIStream | 11 | python | def initialize(self):
'\n \n '
uri_decode_bin_name = f'{self._name}-uridecodebin'
uri_decode_bin = Gst.ElementFactory.make('uridecodebin', uri_decode_bin_name)
if (not uri_decode_bin):
raise BinCreationError(f'Unable to create source {self.__class__.__name__} with name {uri_decode_... | def initialize(self):
'\n \n '
uri_decode_bin_name = f'{self._name}-uridecodebin'
uri_decode_bin = Gst.ElementFactory.make('uridecodebin', uri_decode_bin_name)
if (not uri_decode_bin):
raise BinCreationError(f'Unable to create source {self.__class__.__name__} with name {uri_decode_... |
3d0824a8870e2ce6d70b6ecac8d59a2b05cbd05fa76269467de7481763f5c5d8 | def is_live(self):
'\n Determine whether the URI source is live.\n\n :return: `True` is source is `rtsp://`, and `False` otherwise\n '
return self._is_live | Determine whether the URI source is live.
:return: `True` is source is `rtsp://`, and `False` otherwise | src/monaistream/sources/uri.py | is_live | Project-MONAI/MONAIStream | 11 | python | def is_live(self):
'\n Determine whether the URI source is live.\n\n :return: `True` is source is `rtsp://`, and `False` otherwise\n '
return self._is_live | def is_live(self):
'\n Determine whether the URI source is live.\n\n :return: `True` is source is `rtsp://`, and `False` otherwise\n '
return self._is_live<|docstring|>Determine whether the URI source is live.
:return: `True` is source is `rtsp://`, and `False` otherwise<|endoftext|> |
a8c4a7b34b1c36fbcde1af716779fd1a171246b9a69c3e7a1766135ccff5a4eb | def get_name(self):
'\n Get the assigned name of the component\n\n :return: the name of the component as a `str`\n '
return f'{self._name}-source' | Get the assigned name of the component
:return: the name of the component as a `str` | src/monaistream/sources/uri.py | get_name | Project-MONAI/MONAIStream | 11 | python | def get_name(self):
'\n Get the assigned name of the component\n\n :return: the name of the component as a `str`\n '
return f'{self._name}-source' | def get_name(self):
'\n Get the assigned name of the component\n\n :return: the name of the component as a `str`\n '
return f'{self._name}-source'<|docstring|>Get the assigned name of the component
:return: the name of the component as a `str`<|endoftext|> |
f3a34fd30d39a83e311d2fd4ce8e7f5aa760173dfe930177af564c162d4d2f57 | def get_gst_element(self):
'\n Return the raw `Gst.Element`\n\n :return: the `uridecodebin` `Gst.Element`\n '
return (self._uri_decode_bin,) | Return the raw `Gst.Element`
:return: the `uridecodebin` `Gst.Element` | src/monaistream/sources/uri.py | get_gst_element | Project-MONAI/MONAIStream | 11 | python | def get_gst_element(self):
'\n Return the raw `Gst.Element`\n\n :return: the `uridecodebin` `Gst.Element`\n '
return (self._uri_decode_bin,) | def get_gst_element(self):
'\n Return the raw `Gst.Element`\n\n :return: the `uridecodebin` `Gst.Element`\n '
return (self._uri_decode_bin,)<|docstring|>Return the raw `Gst.Element`
:return: the `uridecodebin` `Gst.Element`<|endoftext|> |
e0dafa01010855ea2386e706370078c1a82ff1b0d19102fbfec116422c581dd3 | def __init__(self, name, config):
'Initialise the FastModel.\n\n Args:\n name: Name of the FastModel.\n config: Map of config parameters describing the state of the FastModel.\n '
ConnectorPrimitive.__init__(self, name)
self.config = config
self.fm_config = config.get... | Initialise the FastModel.
Args:
name: Name of the FastModel.
config: Map of config parameters describing the state of the FastModel. | src/htrun/host_tests_conn_proxy/conn_primitive_fastmodel.py | __init__ | Patater/greentea | 37 | python | def __init__(self, name, config):
'Initialise the FastModel.\n\n Args:\n name: Name of the FastModel.\n config: Map of config parameters describing the state of the FastModel.\n '
ConnectorPrimitive.__init__(self, name)
self.config = config
self.fm_config = config.get... | def __init__(self, name, config):
'Initialise the FastModel.\n\n Args:\n name: Name of the FastModel.\n config: Map of config parameters describing the state of the FastModel.\n '
ConnectorPrimitive.__init__(self, name)
self.config = config
self.fm_config = config.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.