query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Function that takes reddits url and returns parsed json response from API. | def red_get(url):
scheme, host, path, params, query, fragment = urllib.parse.urlparse(url)
if query:
parsed_params = urllib.parse.parse_qs(query)
else:
parsed_params = query
fragment = None
try:
assert path.endswith('.json') or path.endswith('/')
if path.endswith(... | [
"def parse(url):\n with request.urlopen(url) as films: \n source = films.read()\n data = json.loads(source)\n return data",
"def search(query):\n reddits = [] \n if query:\n headers = {'User-Agent' : 'Mozilla/5.0'}\n params = {\n 'q': query,\n 'limit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a random policy function. | def create_random_policy(nA):
A = np.ones(nA, dtype=float) / nA
def policy_fn(observation):
return A
return policy_fn | [
"def create_function_evaluation(self, function_input, node_id):\n random_value = 0 if np.random.rand() < self.bias else 1 \n self.functions[node_id][function_input] = random_value",
"def create_greedy_policy(Q):\n\n def policy_fn(state):\n # All actions that available in the given state\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Monte Carlo Control OffPolicy Control using Importance Sampling. Finds an optimal greedy policy. | def mc_control_importance_sampling(env, num_episodes, behavior_policy, discount_factor=1.0):
# The final action-value function.
# A dictionary that maps state -> action values
returns_sum = defaultdict(lambda: np.zeros(env.action_space.n))
returns_count = defaultdict(lambda: np.zeros(env.action_space.n))
Q... | [
"def make_greedy_policy():\n policy_improvement() # make policy greedy with respect to V~V*",
"def training_policy(self, state):\n #print(\"state: %s\" % state)\n # TODO: change this to to policy the agent is supposed to use while training\n # At the moment we just return an action unifor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize delta. if self.rand_init is True, execute random initialization. | def _init_delta(self, shape: torch.Size, eps: torch.Tensor) -> torch.Tensor:
if self.rand_init:
init_delta = normalized_random_init(
shape, self.norm, device=self.device
) # initialize delta for linf or l2
init_delta = eps[:, None, None, None] * init_delta ... | [
"def init(self,):\r\n self.random_seed_ = self.random_state\r\n self.random_state_ = check_random_state(self.random_seed_)\r\n return self",
"def _initialize_state_vector(self):\n np.random.seed(self.seed)\n self.initial_state = [0.0] * self.num_state_variables",
"def __init__... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets `'preferred_locale'`'s value out from the given `dict`. If found returns it, if not, then returns `DEFAULT_LOCAL`. To not keep using new local values at every case, the already used local values are cached at `LOCALE`. | def parse_preferred_locale(data):
try:
locale = data['preferred_locale']
except KeyError:
return DEFAULT_LOCALE
locale = LOCALES.setdefault(locale, locale)
return locale | [
"def parse_locale_optional(data):\n try:\n locale = data['locale']\n except KeyError:\n return None\n \n locale = LOCALES.setdefault(locale, locale)\n return locale",
"def get(*locale_codes):\r\n return Locale.get_closest(*locale_codes)",
"def get_journal_preferred_language(journ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets `'local'`'s value out from the given `dict`. If found returns it, if not, then returns `None`. To not keep using new local values at every case, the already used local values are cached at `LOCALE`. | def parse_locale_optional(data):
try:
locale = data['locale']
except KeyError:
return None
locale = LOCALES.setdefault(locale, locale)
return locale | [
"def other_filter(file_dict_path_str, lang_label):\n known = packfile.get(file_dict_path_str)\n\n if not known or (known and 'text' not in known):\n if self.ignore_unknown:\n return None\n if known:\n return known\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses the `redirect_url` and the `code` out from a whole `url`, what an user was redirected to after oauth2 authorization. If the parsing was successful, then returns a `tuple` of `redirect_url` and `code`. If it fails, returns `None`. | def parse_oauth2_redirect_url(url):
result = OA2_RU_RP.fullmatch(url)
if result is None:
return None
return result.groups() | [
"def parse_oauth_callback(url):\n\n params = parse_qs(urlparse(url).query)\n return params[\"access_token\"][0], params[\"refresh_token\"][0]",
"def parse_response_code(self, url):\n try:\n return url.json.split(\"?code=\")[1].split(\"&\")[0]\n except IndexError:\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renews the access with the given data. | def _renew(self, data):
self.created_at = datetime.utcnow()
if data is None:
return
self.access_token = data['access_token']
self.refresh_token = data.get('refresh_token', '')
self.expires_in = data['expires_in']
scopes = self.scopes
scopes.cl... | [
"def renew(self):\r\n if self.lease_id is None:\r\n return\r\n\r\n headers = {'x-ms-lease-action': 'renew',\r\n 'x-ms-lease-id': self.lease_id,\r\n 'x-ms-lease-duration': '60'}\r\n\r\n response = self.driver.connection.request(self.object_path,\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the oauth2 user's access's redirect url. Returns | def redirect_url(self):
return self.access.redirect_url | [
"def get_redirect_uri(self):\n return url_for(\n '.authorized',\n provider=self.provider_name,\n _external=True)",
"def get_redirect_uri(self, token, request):\r\n log.debug('Get redirect uri of %r', token)\r\n tok = request.request_token or self._grantgetter(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the oauth2 user's access's refresh token. Returns | def refresh_token(self):
return self.access.refresh_token | [
"def refresh_token(self):\n if not self._refresh_token:\n self.get_oauth_tokens()\n\n return self._refresh_token",
"def access_token(self):\n if not self._access_token:\n headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'applica... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the oauth2 user's access's scopes. Returns | def scopes(self):
return self.access.scopes | [
"def get_scopes(self):\n if not self.authenticated:\n raise ValueError(\"Must authenticate client first.\")\n\n scope = self.client['scope']\n return scope.split()",
"def scopes(self):\n if self._scopes:\n return self._scopes.split()\n\n return []",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renews the oauth2 user's access with the given data. | def _renew(self, data):
self.access._renew(data) | [
"def _renew(self, data):\n self.created_at = datetime.utcnow()\n if data is None:\n return\n \n self.access_token = data['access_token']\n self.refresh_token = data.get('refresh_token', '')\n self.expires_in = data['expires_in']\n scopes = self.scopes\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes a single JSON formatted Google Cloud Platform log line. | def _ProcessLogLine(self,
log_line: str,
query: str,
project_name: str) -> str:
log_record = json.loads(log_line)
# Metadata about how the record was obtained.
timesketch_record = {'query': query, 'project_name': project_name,
... | [
"def ParseLine(self, path, line):\n del path # We don't use the path of the log file.\n return datatypes.Event(json.loads(line.rstrip()))",
"def get_dict(line):\n i = line.index('{')\n try:\n log_dict = json.loads(line[i:])\n except ValueError:\n raise # should not have a line witho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts information from a protoPayload field in a GCP log. protoPayload is set for all cloud audit events. | def _parse_proto_payload(
self,
proto_payload: Dict[str, Any],
timesketch_record: Dict[str, str]) -> None:
authentication_info = proto_payload.get('authenticationInfo', None)
if authentication_info:
principal_email = authentication_info.get('principalEmail', None)
if principal_emai... | [
"def parse_audit_log_message(self, message_body):\n message_string = base64.b64decode(str(message_body['data']))\n logging.debug('decoded message %s', message_string)\n message = json.loads(message_string)\n\n attrs = message_body['attributes']\n resource_type = attrs.get('compute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts information from the request field of a protoPayload field. | def _ParseProtoPayloadRequest(
self,
request: Dict[str, Any],
timesketch_record: Dict[str, Any]) -> None:
request_attributes = [
'name', 'description', 'direction', 'member', 'targetTags', 'email',
'account_id'
]
for attribute in request_attributes:
if attribute in re... | [
"def get_params_from_request(self):\n self._create_moe_log_line(\n type='request',\n content=self.request.json_body,\n )\n\n return self.request_schema.deserialize(self.request.json_body)",
"def _parse_proto_payload(\n self,\n proto_payload: Dic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a Timesketch message string from a Timesketch record. | def _BuildMessageString(self, timesketch_record: Dict[str, Any]) -> None:
if 'message' in timesketch_record:
return
user = ''
action = ''
resource = ''
# Ordered from least to most preferred value
user_attributes = ['principalEmail', 'user']
for attribute in user_attributes:
if ... | [
"def build_entry_field_string(p_date: str, p_source: str, p_type: str, p_message: str) -> str:\n new_line = \"[\" + p_date + \"]\"\n new_line += \"[\" + p_source + \"]\"\n new_line += \"[\" + p_type + \"]\"\n new_line += \" \" + p_message\n return new_line",
"def construct_messa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes a GCP logs container. | def _ProcessLogContainer(self, logs_container: containers.GCPLogs) -> None:
if not logs_container.path:
return
output_file = tempfile.NamedTemporaryFile(
mode='w', encoding='utf-8', delete=False, suffix='.jsonl')
output_path = output_file.name
with open(logs_container.path, 'r') as input... | [
"def Process(self) -> None:\n logs_containers = self.GetContainers(containers.GCPLogs)\n for logs_container in logs_containers:\n self._ProcessLogContainer(logs_container)",
"def container_logs(self, token, container_id):\n path = \"/logs\"\n job_info = self._get_job_info()\n token... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes GCP logs containers for insertion into Timesketch. | def Process(self) -> None:
logs_containers = self.GetContainers(containers.GCPLogs)
for logs_container in logs_containers:
self._ProcessLogContainer(logs_container) | [
"def _ProcessLogContainer(self, logs_container: containers.GCPLogs) -> None:\n if not logs_container.path:\n return\n\n output_file = tempfile.NamedTemporaryFile(\n mode='w', encoding='utf-8', delete=False, suffix='.jsonl')\n output_path = output_file.name\n\n with open(logs_container.path, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The id of the Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options. | def android_version_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "android_version_id") | [
"def android_version_id(self) -> str:\n return pulumi.get(self, \"android_version_id\")",
"def get_platform_version() -> str:\n if not platform.system() == \"Linux\":\n return (\n platform.mac_ver()[0] or platform.win32_ver()[1] or platform.java_ver()[0]\n )\n return _get_os_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The APK containing the test code to be executed. | def test_apk(self) -> pulumi.Input['FileReferenceArgs']:
return pulumi.get(self, "test_apk") | [
"def get_test_app_apks(app_module_name: Text) -> Sequence[pathlib.Path]:\n return [_get_test_file(app_module_name + '.apk')]",
"def app_apk(self) -> Optional[pulumi.Input['FileReferenceArgs']]:\n return pulumi.get(self, \"app_apk\")",
"def testTestPackageInfo(self):\n test_run = self.container.GetTes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The APK for the application under test. | def app_apk(self) -> Optional[pulumi.Input['FileReferenceArgs']]:
return pulumi.get(self, "app_apk") | [
"def test_apk(self) -> pulumi.Input['FileReferenceArgs']:\n return pulumi.get(self, \"test_apk\")",
"def get_test_app_apks(app_module_name: Text) -> Sequence[pathlib.Path]:\n return [_get_test_file(app_module_name + '.apk')]",
"def get_package_id(apk_file):\n app_id = None\n aapt = Adb.__f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The InstrumentationTestRunner class. The default value is determined by examining the application's manifest. | def test_runner_class(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "test_runner_class") | [
"def test_runner_class(self) -> str:\n return pulumi.get(self, \"test_runner_class\")",
"def default_test_runner_name(num_threads):\n if num_threads == 1:\n # Use the serial runner.\n test_runner_name = \"serial\"\n elif os.name == \"nt\":\n # On Windows, Python uses CRT with a l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The ids of the set of Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options. | def android_version_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
return pulumi.get(self, "android_version_ids") | [
"def android_version_ids(self) -> Sequence[str]:\n return pulumi.get(self, \"android_version_ids\")",
"def platform() -> list:\n if GetOS.OS == \"Linux\":\n x = InformationManager(SysFiles.ver.value)\n return x.openF().read().split()[0]\n elif GetOS.OS == \"darwin\":\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The set of orientations to test with. Use the TestEnvironmentDiscoveryService to get supported options. | def orientations(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
return pulumi.get(self, "orientations") | [
"def orientations(self) -> Sequence[str]:\n return pulumi.get(self, \"orientations\")",
"def test_orientate_command(self):\n self.assertDictEqual(orientate_robot(self.direction, self.current_position), self.expected)",
"def test_portrait_check():\n portrait_angles = [90, 270, -90]\n landscap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The APK for the application under test. | def app_apk(self) -> Optional[pulumi.Input['FileReferenceArgs']]:
return pulumi.get(self, "app_apk") | [
"def test_apk(self) -> pulumi.Input['FileReferenceArgs']:\n return pulumi.get(self, \"test_apk\")",
"def get_test_app_apks(app_module_name: Text) -> Sequence[pathlib.Path]:\n return [_get_test_file(app_module_name + '.apk')]",
"def get_package_id(apk_file):\n app_id = None\n aapt = Adb.__f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The initial activity that should be used to start the app. | def app_initial_activity(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "app_initial_activity") | [
"def get_start_intent(self):\n\t\tpackage_name = self.package_name\n\t\tif self.main_activity:\n\t\t\tpackage_name += \"/%s\" % self.main_activity\n\t\treturn Intent(suffix = package_name)",
"def main_activity(self):\n MAIN_ACTIVITY_ACTION = \"android.intent.action.MAIN\"\n\n package = self.package(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A set of directives Robo should apply during the crawl. This allows users to customize the crawl. For example, the username and password for a test account can be provided. | def robo_directives(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RoboDirectiveArgs']]]]:
return pulumi.get(self, "robo_directives") | [
"def includeme(config):\n config.add_directive('add_linkedin_oauth2_login', add_linkedin_login)\n config.add_directive('add_linkedin_oauth2_login_from_settings',\n add_linkedin_login_from_settings)",
"def directives(self, directives):\n\n self._directives = directives",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The list of scenario labels that should be run during the test. The scenario labels should map to labels defined in the application's manifest. For example, player_experience and com.google.test.loops.player_experience add all of the loops labeled in the manifest with the com.google.test.loops.player_experience name to... | def scenario_labels(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "scenario_labels") | [
"def scenario_labels(self) -> Sequence[str]:\n return pulumi.get(self, \"scenario_labels\")",
"def get_required_scenario_names():",
"def scenarios(self) -> Sequence[int]:\n return pulumi.get(self, \"scenarios\")",
"def workbench_scenarios():\n return [\n (\"edxpc2judge\", \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A list of iOS devices. | def ios_device_list(self) -> Optional[pulumi.Input['IosDeviceListArgs']]:
return pulumi.get(self, "ios_device_list") | [
"def ios_device_list(self) -> 'outputs.IosDeviceListResponse':\n return pulumi.get(self, \"ios_device_list\")",
"def listDevices():\n return Controller().listDevices()",
"def list_devices(self):\n pass",
"def deviceList(self):\n time.sleep(3)\n return self._deviceList",
"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The .ipa of the application to test. | def app_ipa(self) -> pulumi.Input['FileReferenceArgs']:
return pulumi.get(self, "app_ipa") | [
"def app_ipa(self) -> 'outputs.FileReferenceResponse':\n return pulumi.get(self, \"app_ipa\")",
"def app_apk(self) -> Optional[pulumi.Input['FileReferenceArgs']]:\n return pulumi.get(self, \"app_apk\")",
"def test_apk(self) -> pulumi.Input['FileReferenceArgs']:\n return pulumi.get(self, \"t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The option to test special app entitlements. Setting this would resign the app having special entitlements with an explicit applicationidentifier. Currently supports testing apsenvironment entitlement. | def test_special_entitlements(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "test_special_entitlements") | [
"def test_special_entitlements(self) -> bool:\n return pulumi.get(self, \"test_special_entitlements\")",
"def test_use_user_entitlement_item(self):\n pass",
"def test_grant_user_entitlement(self):\n pass",
"def test_check_user_entitlement_item(self):\n pass",
"def test_techenv_ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The Xcode version that should be used for the test. Use the TestEnvironmentDiscoveryService to get supported options. Defaults to the latest Xcode version Firebase Test Lab supports. | def xcode_version(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "xcode_version") | [
"def _ComputeXcodeVersionFlag():\n xcode_version = _OptionsParser._GetXcodeVersionString()\n build_version = _OptionsParser._GetXcodeBuildVersionString()\n\n if not xcode_version or not build_version:\n return None\n\n # Of the form Major.Minor.Fix.Build (new Bazel form) or Major.Min.Fix (old).\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shards test cases into the specified groups of packages, classes, and/or methods. With manual sharding enabled, specifying test targets via environment_variables or in InstrumentationTest is invalid. | def __init__(__self__, *,
test_targets_for_shard: pulumi.Input[Sequence[pulumi.Input['TestTargetsForShardArgs']]]):
pulumi.set(__self__, "test_targets_for_shard", test_targets_for_shard) | [
"def partition_suite(suite, classes, bins):\n for test in suite:\n if isinstance(test, unittest.TestSuite):\n partition_suite(test, classes, bins)\n else:\n for i in range(len(classes)):\n if isinstance(test, classes[i]):\n bins[i].addTest(test)\n break\n else:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Group of packages, classes, and/or test methods to be run for each manuallycreated shard. You must specify at least one shard if this field is present. When you select one or more physical devices, the number of repeated test_targets_for_shard must be <= 50. When you select one or more ARM virtual devices, it must be <... | def test_targets_for_shard(self) -> pulumi.Input[Sequence[pulumi.Input['TestTargetsForShardArgs']]]:
return pulumi.get(self, "test_targets_for_shard") | [
"def __init__(__self__, *,\n test_targets_for_shard: pulumi.Input[Sequence[pulumi.Input['TestTargetsForShardArgs']]]):\n pulumi.set(__self__, \"test_targets_for_shard\", test_targets_for_shard)",
"def test_targets_for_shard(self) -> 'outputs.TestTargetsForShardResponse':\n return pul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The tool results history that contains the tool results execution that results are written to. If not provided, the service will choose an appropriate value. | def tool_results_history(self) -> Optional[pulumi.Input['ToolResultsHistoryArgs']]:
return pulumi.get(self, "tool_results_history") | [
"def tool_results_history(self) -> 'outputs.ToolResultsHistoryResponse':\n return pulumi.get(self, \"tool_results_history\")",
"def get_history(self):\n\n if self.opt is not None:\n return self.opt.get_history()\n else:\n return None",
"def tool_results_execution(self)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The type of action that Robo should perform on the specified element. | def action_type(self) -> pulumi.Input['RoboDirectiveActionType']:
return pulumi.get(self, "action_type") | [
"def by_element(self, element: PageElement) -> Actions:\n return Actions([action for action in self if isinstance(action, ElementAction) and action.target == element])",
"def get_action_type(act_id):\n res = rpc.session.execute('object', 'execute', 'ir.actions.actions', 'read', act_id, ['type'], rpc.ses... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An Android robo test. | def android_robo_test(self) -> Optional[pulumi.Input['AndroidRoboTestArgs']]:
return pulumi.get(self, "android_robo_test") | [
"def test_get_unusual_activity(self):\n pass",
"def test_get_unusual_activity_universal(self):\n pass",
"def testAndroidShowsOkButton(self):\n a6_ua = \"Mozilla/5.0 (Linux; Android 6.0.1; \" \\\n \"Nexus 7 Build/MOB30X; wv) AppleWebKit/537.36 \" \\\n \"(KHTML, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disables performance metrics recording. May reduce test latency. | def disable_performance_metrics(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "disable_performance_metrics") | [
"def disable_performance_metrics(self) -> bool:\n return pulumi.get(self, \"disable_performance_metrics\")",
"def disable_spike_recording(self, flush=True):\n self.driver.SetSpikeDumpState(CORE_ID, en=False, flush=flush)",
"def disable_profiling(profiler):\n profiler.disable()",
"def disable_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disables video recording. May reduce test latency. | def disable_video_recording(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "disable_video_recording") | [
"def disable_video_recording(self) -> bool:\n return pulumi.get(self, \"disable_video_recording\")",
"def stop_recording(self):\n if self.recording:\n self.recording = False\n self.paused = False\n self.play_btn.toggle()\n self.stop_recording()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test setup requirements for iOS. | def ios_test_setup(self) -> Optional[pulumi.Input['IosTestSetupArgs']]:
return pulumi.get(self, "ios_test_setup") | [
"def ios_test_setup(self) -> 'outputs.IosTestSetupResponse':\n return pulumi.get(self, \"ios_test_setup\")",
"def setUp(self): # suppress(N802)\n super(TestCaseRequiring, self).setUp()\n if platform.system() != system:\n self.skipTest(\"\"\"not running on system - {0}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Launch Minecraft instances in the background. Function will block until all instances are ready to receive commands. ports List of ports you want the instances to listen on for commands launch_script Script to launch Minecraft. Default is ./launchClient_quiet.sh keep_alive Automatically restart Minecraft instances if t... | def launch_minecraft(ports, launch_script=DEFAULT_SCRIPT, keep_alive=False, verbose=False):
ports_collection = ports
if not isinstance(ports_collection, Iterable):
ports_collection = [ports_collection]
minecraft_instances = []
for port in ports_collection:
args = [
sys.execu... | [
"def launch_servers_and_wait():\n try:\n print(\"Servers launching...\")\n if not launch_grafana_server():\n print(\"Issue launching grafana, see above\")\n return\n if not launch_prometheus_server():\n print(\"Issue launching prometheus, see above\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wait until the specified enpoints are all actively listening for connections. end_points List of addresses made up of tuples of the form (HOST, PORT) | def await_instances(end_points):
print(f"Waiting for {len(end_points)} instances...")
while True:
try:
for end_point in end_points:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(10)
s.connect(end_point)
... | [
"async def wait_until_endpoint_subscriptions_change(self) -> None:\n ...",
"async def _track_and_propagate_available_endpoints(self) -> None:\n async for ev in self.wait_iter(self._endpoint.stream(EventBusConnected)):\n self._available_endpoints = self._available_endpoints + (ev.connectio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads transcripts (and translations if exists). | def load_transcripts(self):
raise NotImplementedError | [
"def load_translations(self, file_path):\n\n # Checking translation existence\n if not os.path.exists(file_path):\n logger.error('Specified path does not exist. Traduction not loaded.')\n logger.error('{}'.format(file_path))\n return\n\n # If exists loading it\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of transcripts. | def transcripts(self):
if self._transcripts is None:
assert not self._transcript_is_projected
gen = self.build_iterator(map_func=lambda x: x["transcript"])
self._transcripts = [x for x in gen()]
return self._transcripts | [
"def transcript_names(self):\n return self._transcript_names",
"def getTranscripts(bedFile, bedDetailsFile):\n transcripts = []\n bf = open(bedFile, 'r')\n bdf = open(bedDetailsFile, 'r')\n for t in transcriptIterator(bf, bdf):\n transcripts.append(t)\n return transcripts",
"def _get_transcripts(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of synsets in document. Tokenizes and tags the words in the document doc. Then finds the first synset for each word/tag combination. If a synset is not found for that combination it is skipped. | def doc_to_synsets(self, doc):
tokens = word_tokenize(doc + ' ')
l = []
tags = nltk.pos_tag([tokens[0] + ' ']) if len(tokens) == 1 else nltk.pos_tag(tokens)
for token, tag in zip(tokens, tags):
syntag = self.convert_tag(tag[1])
syns = wn.synsets(token, syntag)
... | [
"def synonyms(word_tag):\n _type = TPU.tag_type(word_tag[1])\n root = wordnet.morphy(word_tag[0])\n if not root:\n root = word_tag[0]\n\n _result = set()\n _result.add(root)\n if _type:\n syn_sets = wordnet.synsets(root, pos=_type)\n for syn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the symmetrical similarity between doc1 and doc2 | def document_similarity(self, doc1, doc2):
synsets1 = self.doc_to_synsets(doc1)
#print(synsets1)
synsets2 = self.doc_to_synsets(doc2)
#print(synsets2)
return (self.similarity_score(synsets1, synsets2) + self.similarity_score(synsets2, synsets1)) / 2 | [
"def symmetric_phrase_similarity(phrase1, phrase2):\n return (phrase_similarity(phrase1, phrase2) + phrase_similarity(phrase2, phrase1)) / 2",
"def spacy_similarity(token1: str, token2: str) -> float:\n doc1 = nlp(token1)\n doc2 = nlp(token2)\n\n return doc1.similarity(doc2)",
"def calculate_documen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given list of ints, return True if any two nums sum to 0. | def add_to_zero(nums):
set_nums = set(nums)
for num in nums:
if -num in set_nums:
return True
return False | [
"def add_to_zero(nums):\n nums = set(nums)\n\n if 0 in nums:\n return True\n for num in nums:\n if -num in nums:\n return True\n return False",
"def is_all_negative(arr):\n for e in arr:\n if e >= 0:\n return False\n return True",
"def test_zero_lists... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a gradient image based on a colormap. | def gradient_image(ax, extent, cmap_range=(0, 1), data_range=(0, 1), cmap=plt.jet):
a, b = cmap_range
c, d = data_range
grad = np.atleast_2d(np.linspace(c, d, 256))
im = ax.imshow(
grad, extent=extent, interpolation="bicubic", alpha=1, vmin=a, vmax=b, cmap=cmap
)
return im | [
"def gradient_image(ax, direction=0.3, cmap_range=(0, 1), extent=(0, 1, 0, 1), **kwargs):\n xlim, ylim = ax.get_xlim(), ax.get_ylim()\n \n phi = direction * np.pi / 2\n v = np.array([np.cos(phi), np.sin(phi)])\n X = np.array([[v @ [1, 0], v @ [1, 1]],\n [v @ [0, 0], v @ [0, 1]]])\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read version info from .vers file in current directory | def read_vers(self, path):
self.path = path
self.pfname_vers = os.path.join(self.path, '.vers')
self.pfnames_py = [os.path.abspath(os.path.join(self.path, pfname)) for pfname in os.listdir(self.path)
if os.path.isfile(os.path.join(self.path, pfname)) and
... | [
"def find_current_version():\n with open(VERSION_FILE) as v:\n return v.read()",
"def version():\n vfile='/Users/mikemon/mesa/data/version_number'\n f = open(vfile, 'r')\n line=f.readline()\n aa=line.split()\n vers=aa[0]\n print '\\nComputed with MESA version',vers,'\\n'\n return ve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save version info to .vers file in current directory | def save_vers(self):
if self.pfname_vers is not None:
self.ver_cfg.set(CFG_SEC_CURVERS, CFG_OPT_VERSION, self.et_Version.GetValue())
self.ver_cfg.set(CFG_SEC_CURVERS, CFG_OPT_BUILD, self.et_Build.GetValue())
self.ver_cfg.set(CFG_SEC_CURVERS, CFG_OPT_CREATED, self.et_Created.G... | [
"def write_version(filename='link/version.py'):\n cnt = \"version = '%s'\\nversion_details = %s\\n\"\n a = open(filename, 'w')\n try:\n a.write(cnt % (VERSION_STRING, VERSION))\n finally:\n a.close()",
"def write_version(version):\n if subprocess.check_call is not substitute:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restore previous version info in all .py files in current directory | def bt_Revert_OnClick(self, event):
self.update_py_files(['$MODULE_NAME', '$AUTHOR',
self.st_VersionPrev.GetLabel(),
self.st_BuildPrev.GetLabel(),
self.st_CreatedPrev.GetLabel()])
return | [
"def rollback():\n with project():\n with update_changed_requirements():\n update = \"git checkout\" if env.git else \"hg up -C\"\n run(\"%s `cat last.commit`\" % update)\n with cd(join(static(), \"..\")):\n run(\"tar -xf %s\" % join(env.proj_path, \"last.tar\"))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Treat requests POST to allocate a new VLAN IPv6. | def handle_post(self, request, user, *args, **kwargs):
self.log.info('Allocate a new VLAN IPv6')
try:
# User permission
if not has_perm(user, AdminPermission.VLAN_MANAGEMENT, AdminPermission.WRITE_OPERATION):
self.log.error(
u'User does not h... | [
"def allocate_subnet(self, request):",
"def create(self, networkipv6s):\n\n data = {'networks': networkipv6s}\n return super(ApiNetworkIPv6, self).post('api/v3/networkv6/', data)",
"def simple_vxlanv6_packet(\n pktlen=300,\n eth_dst=\"00:01:02:03:04:05\",\n eth_src=\"00:06:07:08:09:0a\",\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
O(n^2). This function uses the nearest neighbor methodology to sort the truck's path. The truck's path was initially set when the packages were loaded onto the truck, but this algorithm will sort the path based on the next nearest location from the truck's current location. To keep track of where the truck has been and... | def nearest_neighbor_path_sort(truck):
unvisited_list = list(truck.path) # This unvisited list is a list version of the existing truck's path
visited_list = [] # An empty list that will start to get populated as the truck visits locations on the unvisited list
optimized_path = collections.deque() # This ... | [
"def tsp_nearest_neighbor(self):\r\n path = []\r\n size = self.graph_matrix.__len__()\r\n for row in range(0, size[0]):\r\n min_value = sys.maxsize\r\n memory_node = -1\r\n for values in range(0, size[0]):\r\n if values == row or values in path:\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
O(N^2), because it runs the nearest neighbor algorithm. This algorithm uses the greedy algorithm to load the packages on trucks based on a variety of conditions. The algorithm grabs the addresses from each package and adds that address to the truck's path if it isn't already. At the end of this function, I call the Nea... | def greedy_algorithm_for_package_loading(truck_1, truck_2, truck_3, hash_table):
# determine which packages to load into a truck using a greedy algorithm
# add to path for each truck at the end of each if statement
# iterate through the package hash
for i, package in enumerate(hash_table.table):
... | [
"def nearest_neighbor_path_sort(truck):\n unvisited_list = list(truck.path) # This unvisited list is a list version of the existing truck's path\n visited_list = [] # An empty list that will start to get populated as the truck visits locations on the unvisited list\n optimized_path = collections.deque() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
O(N) Calculate the total path miles for a given truck. This will be used later to calculate the total distance traveled. | def calculate_path_miles(truck):
for i, location in enumerate(truck.path):
if i > 0:
prev = truck.path[i - 1]
curr = truck.path[i]
truck.path_miles += distance_dict[prev, curr]
return truck.path_miles | [
"def compute_miles_to_driven(self, mph):\n distance = mph\n count = 1\n gap = mph\n while gap > 0:\n count += 1\n distance *= count\n gap -= mph\n print(\"You drive {} miles driving at {} mph for {} hours\".format(mph *count, mph, count))",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
O(N^2) This function takes in truck objects and sends them out. It initializes their time and time they leave the hub. It also updates the status once they leave and when they're delivered. | def send_out_trucks(truck_1, truck_2, truck_3):
truck_1.time_left_hub = datetime.datetime(2021, 4, 13, 9, 5, 1)
truck_1.time = datetime.datetime(2021, 4, 13, 9, 5, 1)
truck_2.time_left_hub = datetime.datetime(2021, 4, 13, 8, 0, 0)
truck_2.time = datetime.datetime(2021, 4, 13, 8, 0, 0)
truck_3.time_l... | [
"def send(self, tick):\n # Create an empty list of packets that the host will send\n packets = []\n\n # First, process retransmissions\n for i in range(0, len(self.unacked)):\n unacked_pkt = self.unacked[i]\n if tick >= self.unacked[i].timeout_tick:\n # Retransmit any packet that has ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reverse part of a list inplace, starting with start up to the end of the list. >>> a = [1, 2, 3, 4, 5, 6, 7] >>> partial_reverse(a, 2) >>> a [1, 2, 7, 6, 5, 4, 3] >>> partial_reverse(a, 5) >>> a [1, 2, 7, 6, 5, 3, 4] | def partial_reverse(lst, start):
i = 0
while lst[i] != start:
i = i + 1
new_lst = lst[:i+1] + lst[-1:i:-1]
for j in range(len(lst)):
lst[j] = new_lst[j] | [
"def reverse_list_in_place(my_list):\n\n # slice the whole list starting from the end in -1 incremenets (moving backwards)\n\n my_list[::-1]\n\n return my_list",
"def reverse_list(l):\n\n return l[::-1]",
"def reverse_list(a_list):\n reverse = a_list[::-1]\n\n return reverse",
"def reverse(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sort chunksize and export to db. | def temp_sorted_chunks(engine, chunksize=200):
sql = "SELECT data FROM ads"
i = 1
for chunk in pd.read_sql_query(sql, engine, chunksize=chunksize):
chunk = chunk.sort_values("data")
chunk = chunk.rename(columns={f"data": f"chunk_{i}"})
chunk.to_sql(f"chunk_{i}", con=engine, i... | [
"def combine_sorted(\r\n engine,\r\n chunksize=200,\r\n output_table_size=2000,\r\n output_table_name=\"sorted_names_table\",\r\n):\r\n temp = [] # to Db\r\n min_list = [] # contains 10 min values in each iteration\r\n\r\n for i in range(1, 11):\r\n sql_query = f\"SELECT * FROM chunk_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
combine sorted temp tables and export to db. | def combine_sorted(
engine,
chunksize=200,
output_table_size=2000,
output_table_name="sorted_names_table",
):
temp = [] # to Db
min_list = [] # contains 10 min values in each iteration
for i in range(1, 11):
sql_query = f"SELECT * FROM chunk_{i} limit 1"
result... | [
"def merge_databases(fns, fn_output, tbl):\n # Get names and types of the columns from first database file\n db = Database3(fns[0])\n names = db.get_table_column_names(tbl)\n types = db.get_table_types(tbl)\n indices = get_sorting_indices(names)\n sorted_names = [ names[i] for i in indices]\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a random sequence of elements, represented as a byte array | def get_random_sequence(count):
numbers = bytearray()
for i in range(count):
num = pickle.dumps(ElementUnit(random.randint(0, 2000000)))
numbers.extend(num)
return numbers | [
"def random_bytes(n):\n return bytearray(random.getrandbits(8) for _ in range(n))",
"def random_keys(self, bytes):\n return self.random_blocks(bytes, 10**5) # 100k",
"def sequences_byte_array(self):\n from ..sequencer_dsl.sequence import compile_sequences\n return compile_sequenc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
v, r, and a are lists of length 13, whose positions correspond to ranks (ace is position 0, two is position 1, etc.) and values correspond to number of occurences v is known portion of cards. So, if v[0] == n, then there are n aces in known portion of cards r is revealed cards. So, if r[0] == n, then n aces have been r... | def get_odds(v=[3, 2, 1, 0, 0, 3, 3, 1, 3, 0, 7, 1, 2], r=[3,2,2,0,0,0,0,0,0,0,0,0,0], c=0):
a = [0 for i in range(13)]
m = [min(i,j) for i,j in zip(v, r)]
i = 12
t = 0
z = [24-i for i in v]
s_r = sum(r)
t_left = 52 - s_r
p = 0
while i > -1:
if a[i] > m[i]:
... | [
"def hand_ranking(five_cards):\n cards_val = []\n cards_col = []\n for card in five_cards:\n cards_val.append((card % 13) + 2)\n cards_col.append(card // 13)\n if cards_col == [cards_col[0]] * 5:\n flush = True\n else:\n flush = False\n\n # Start checking for hand's val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests whether ``parse_public_updates_channel_id`` works as intended. | def test__parse_public_updates_channel_id():
public_updates_channel_id = 202306100005
for input_data, expected_output in (
({}, 0),
({'public_updates_channel_id': None}, 0),
({'public_updates_channel_id': str(public_updates_channel_id)}, public_updates_channel_id),
):
ou... | [
"def test__validate_public_updates_channel_id__0():\n public_updates_channel_id = 202306100003\n \n for input_value, expected_output in (\n (None, 0),\n (public_updates_channel_id, public_updates_channel_id),\n (Channel.precreate(public_updates_channel_id), public_updates_channel_id),\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the surface distances from `y_pred_edges` to `y_edges`. | def _get_surface_distance(self, y_pred_edges, y_edges):
if not np.any(y_pred_edges):
return np.array([])
if np.any(y_edges):
if self.distance_metric == "euclidean":
dis = morphology.distance_transform_edt(~y_edges)
elif self.distance_metric in self.di... | [
"def error_knearest(ypred, ytest):\n return sum(ypred!=ytest) / len(ytest)",
"def residuals(self): \n\t\treturn np.subtract(self.y, self.predict(self.X))",
"def get_distances(self):\n return np.sqrt(np.diff(self.x)**2+np.diff(self.y)**2)",
"def scores(self, y_pred, y_true ): \n u = ((y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload the next waves of photos, from cursor to cursor + chunk. | def nextWave(self):
# the point to which you're read
nextBite = self.cursor + self.chunk
#start the server each time
self.startServer()
for file in self.filenames[self.cursor:nextBite]:
time.sleep(self.delay)
msg = MIMEMultipart()
msg['Subject'... | [
"def upload_chunk():\n data = request.get_json()\n\n try:\n files = FilesHandler(current_app, session)\n path = files.persist_chunk(data)\n except Exception as e:\n current_app.logger.error(str(e))\n return jsonify({\n \"path\": '',\n \"error\": True,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse args, returning any unknown flags (ABSL defaults to crashing). | def _parse_flags_tolerate_undef(argv):
return flags.FLAGS(_sys.argv if argv is None else argv, known_only=True) | [
"def read_args(self):\n cmd = []\n for index in sys.argv:\n cmd = cmd + index.split(\"=\")\n cmd.pop(0)\n\n\n for index , item in enumerate(cmd):\n if (index % 2 == 0):\n found = False\n \n if ('--help' == item):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs the program with an optional 'main' function and 'argv' list. | def run(main=None, argv=None):
main = main or _sys.modules['__main__'].main
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) | [
"def main():\n # set up the program to take in arguments from the command line",
"def run():\n sys.exit(main(sys.argv[1:]) or 0)",
"def run_from_argv(self, argv):\n parser = self.create_arg_parser(argv)\n self.options = parser.parse_args(argv[2:])\n\n args = self.options.args\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plot results of quadratic interpolation. The quadratic curve is plotted in solid blue line and data points used for interpolation is plotted in red dots Calls function quad_interp as defined in this file | def plot_quad(xi, yi):
# Compute coefficients for linear system
c = quad_interp(xi, yi)
# Establish points for plotting
x = np.linspace(xi.min() - 1, xi.max() + 1, 1001)
y = c[0] + c[1] * x + c[2] * x ** 2
# Plot figure
plt.figure(1) # open plot window
plt.clf() # clear plot frame
... | [
"def plot_cubic(xi,yi):\n c = quad_interp(xi,yi)\n x = linspace(xi.min() - 1, xi.max(), 1000)\n y = c[0] + c[1]*x + c[2]*x**2 + c[3]*x**3\n \n plt.figure(1)\n plt.clf()\n plt.plot(x,y,'r-')\n plt.plot(xi,yi,'bo')\n\n plt.ylim(yi.min()-1,yi.max()+1)\n plt.savefig('cubic.png')",
"def p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the next dataset item. | def __next__(self) -> DatasetItemEntity:
if self.index >= len(self.dataset):
raise StopIteration
item = self.dataset[self.index]
self.index += 1
return item | [
"def getNextDatasetRec(self):\n if self.__dataset__:\n self.__rec_no__ = min(len(self.__dataset__) - 1,\n self.__rec_no__ + 1)\n return self.__dataset__[self.__rec_no__]\n return None",
"def get_next_item(self):\n return # osid.assessmen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the DatasetPurpose. For example DatasetPurpose.ANALYSIS. | def purpose(self) -> DatasetPurpose:
return self._purpose | [
"def GetDataSetType(self):\n self.Update()\n if not self.DataInformation:\n raise RuntimeError (\"No data information is available\")\n if self.DataInformation.GetCompositeDataSetType() > -1:\n return self.DataInformation.GetCompositeDataSetType()\n return self.Data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch the given entity/entities from the items. Helper function for __getitem__ | def _fetch(self, key: Union[slice, int]) -> Union[DatasetItemEntity, List[DatasetItemEntity]]:
if isinstance(key, list):
return [self._fetch(ii) for ii in key] # type: ignore
if isinstance(key, slice):
# Get the start, stop, and step from the slice
return [self._fetc... | [
"def __getitem__(self, key: Union[slice, int]) -> Union[\"DatasetItemEntity\", List[\"DatasetItemEntity\"]]:\n return self._fetch(key)",
"def __getitem__(self, index):\n return self.entities[index]",
"def get_item(self, identifier):",
"def __getitem__(self, item):\n return self.search(ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a new dataset which contains the items of self added with the input dataset. Note that additional info of the dataset might be incoherent to the addition operands. | def __add__(self, other: Union["DatasetEntity", List[DatasetItemEntity]]) -> "DatasetEntity":
items: List[DatasetItemEntity]
if isinstance(other, DatasetEntity):
items = self._items + list(other)
elif isinstance(other, list):
items = self._items + [o for o in other if is... | [
"def __add__(self, dataset):\n for attr in ['extent', 'crs', 'sensor', 'acquisition_mode', 'proc_steps', 'outname_base']:\n if getattr(self, attr) != getattr(dataset, attr):\n raise ValueError('value mismatch: {}'.format(attr))\n # self.filename.append(dataset.filename)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a DatasetItemEntity or a list of DatasetItemEntity, given a slice or an integer. | def __getitem__(self, key: Union[slice, int]) -> Union["DatasetItemEntity", List["DatasetItemEntity"]]:
return self._fetch(key) | [
"def _fetch(self, key: Union[slice, int]) -> Union[DatasetItemEntity, List[DatasetItemEntity]]:\n if isinstance(key, list):\n return [self._fetch(ii) for ii in key] # type: ignore\n if isinstance(key, slice):\n # Get the start, stop, and step from the slice\n return [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an iterator for the DatasetEntity. This iterator is able to iterate over the DatasetEntity lazily. | def __iter__(self) -> Iterator[TDatasetItemEntity]:
return DatasetIterator(self) | [
"def iterdata(self):\n return iter(self._data_table)",
"def get_iterator(self):\n if self.shuffle_buffer_size not in (None, False):\n self.dataset = self.dataset.shuffle(self.shuffle_buffer_size)\n self.dataset = self.dataset.batch(self.batch_size)\n if self.prefetch_buffer_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produces a new dataset with empty annotation objects (no shapes or labels). This is a convenience function to generate a dataset with empty annotations from another dataset. This is particularly useful for evaluation on validation data and to build resultsets. Assume a dataset containing user annotations. >>> labeled_d... | def with_empty_annotations(
self, annotation_kind: AnnotationSceneKind = AnnotationSceneKind.PREDICTION
) -> "DatasetEntity":
new_dataset = DatasetEntity[TDatasetItemEntity](purpose=self.purpose)
for dataset_item in self:
if isinstance(dataset_item, DatasetItemEntity):
... | [
"def create_empty_dataset(src_filename, out_filename):\n inds = gdal.Open(src_filename)\n driver = inds.GetDriver()\n band = inds.GetRasterBand(1)\n\n out = driver.Create(out_filename,\n inds.RasterXSize,\n inds.RasterYSize,\n inds.Ras... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a new DatasetEntity with just the dataset items matching the subset. This subset is also a DatasetEntity. The dataset items in the subset dataset are the same dataset items as in the original dataset. Altering one of the objects in the output of this function, will also alter them in the original. | def get_subset(self, subset: Subset) -> "DatasetEntity":
dataset = DatasetEntity(
items=[item for item in self._items if item.subset == subset],
purpose=self.purpose,
)
return dataset | [
"def new_subset(self):\n subset = Subset(self)\n self.add_subset(subset)\n return subset",
"def subsetify(self, subset: Union[Any, Sequence[Any]], \n **kwargs) -> Hybrid[Any]:\n subset = more_itertools.always_iterable(subset)\n return self.__class__(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete items based on the `indices`. | def remove_at_indices(self, indices: List[int]) -> None:
indices.sort(reverse=True) # sort in descending order
for i_item in indices:
del self._items[i_item] | [
"def remove_all_at(seq, remove_indices):\n if not isinstance(seq, (list, tuple)):\n raise TypeError(\"param 'seq' must be a list or tuple\")\n\n if not isinstance(remove_indices, (list, tuple, set)):\n raise TypeError(\"param 'remove_indices' must be a list, tuple, or set\")\n\n for index in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read all files and return graphs of measured vs. real TES from Asimov datasets. Differentiate between with or without frequentist in the filename (for comparisons). | def getAsimovGraphs(filenames, **kwargs):
graph = None
graph_Freq = None
if any(["freq" in f.lower() for f in filenames]):
graph_Freq = TGraph()
graph_Freq.SetTitle("Asimov (freq.)")
if any(["freq" not in f.lower() for f in filenames]):
graph = TGraph()
graph.SetTitle("... | [
"def consider_all_metrics(files_list):\n for fname in files_list:\n with open_file(fname) as f:\n for item in consider_metrics_for_file(fname, f):\n yield item",
"def read_graphs():\n start = time.time()\n\n pos_train_graph = CSFGraph(args.pos_train)\n pos_valid_graph ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that message on a queue are delivered in priority order. | def prioritised_delivery(self, priorities, levels=10, key="x-qpid-priorities"):
msgs = [Message(content=str(uuid4()), priority = p) for p in priorities]
snd = self.ssn.sender("priority-queue; {create: sender, delete: receiver, node: {x-declare:{arguments:{'%s':%s}}}}" % (key, levels),
... | [
"def test_get_order(self):\n alphabet = ['abc', 'def', 'ghi', 'jkl', 'mno']\n self.queue.put(alphabet[0], alphabet[1], alphabet[2])\n self.queue.put(alphabet[3])\n self.queue.put(alphabet[4])\n msgs = [\n self.queue.get(),\n self.queue.get(),\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensure that a ring queue removes lowest priority messages first. | def ring_queue_check(self, msgs, count=10):
snd = self.ssn.sender(address("priority-ring-queue", arguments="x-qpid-priorities:10, 'qpid.policy_type':ring, 'qpid.max_count':%s" % count),
durable=self.durable())
for m in msgs: snd.send(m)
rcv = self.ssn.receiver(snd.... | [
"def wipeQueue():\n\tq.clear()",
"def test1():\r\n q = make_priority_queue()\r\n count = 0\r\n while True:\r\n if count == 10:\r\n break\r\n i = rand.randint(1,10)\r\n task = \"Task\" + str(count + 1)\r\n enqueue(q, Task(task, i))\r\n count += 1\r\n print(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generator to return prioritised messages in expected order for a given fairshare limit | def fairshare(msgs, limit, levels):
count = 0
last_priority = None
postponed = []
while msgs or postponed:
if not msgs:
msgs = postponed
count = 0
last_priority = None
postponed = []
msg = msgs.pop(0)
if last_priority a... | [
"def _random_read_iterator(read_iterator, threshold):\n for e in read_iterator:\n if e.qname in paired_pending or random.uniform(0, 1) <= threshold:\n yield e",
"def items_before(iterable, limit):\n return itertools.takewhile(lambda x: x < limit, iterable)",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to determine effective priority given a distinct number of levels supported. Returns the lowest priority value that is of equivalent priority to the value passed in. | def effective_priority(value, levels):
if value <= 5-math.ceil(levels/2.0): return 0
if value >= 4+math.floor(levels/2.0): return 4+math.floor(levels/2.0)
return value | [
"def find_highest_priority(self):\n\t\tif self.RL.system.list:\n\t\t\treturn self.RL.system.list[0]\n\t\telif self.RL.user.list:\n\t\t\treturn self.RL.user.list[0]\n\t\telse:\n\t\t\treturn self.RL.init.list[0]",
"def highest_priority(chain, plugins):\n ret = max(plugins, key=lambda p: PRIORITIES.get(chain, {})... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to determine which of a distinct number of priority levels a given value falls into. | def priority_level(value, levels):
offset = 5-math.ceil(levels/2.0)
return min(max(value - offset, 0), levels-1) | [
"def effective_priority(value, levels):\n if value <= 5-math.ceil(levels/2.0): return 0\n if value >= 4+math.floor(levels/2.0): return 4+math.floor(levels/2.0)\n return value",
"def pick_level():\n levels = [str(i) for i in range(1, 13)]\n levels.append(\"Higher\")\n return choice(levels)",
"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get balance of a account | def get_account_balance(self):
return self.execute_private_api("/api/accounts/balance", "GET") | [
"def balance(self):\n assert self._id, \"Account must be created first.\"\n\n if hasattr(opentxs, 'OTAPI_Wrap_getAccountData'): # new api name\n res = opentxs.OTAPI_Wrap_getAccountData(self.server_id, self.nym._id, self._id)\n else: # todo: old api name, remove in due time\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get balance of a leverage account | def get_account_leverage_balance(self):
return self.execute_private_api("/api/accounts/leverage_balance", "GET") | [
"def get_balance(self):\n current_balance = 0\n\n for item in self.ledger:\n current_balance += item[\"amount\"]\n\n return current_balance",
"def getBalance(self):\n\n balance = 0\n for item in self.ledger:\n balance += item[\"amount\"]\n\n return b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the history of a certain sent currency | def get_send_money_history(self, currency="btc"):
return self.execute_private_api("/api/send_money?currency={}".format(currency), "GET") | [
"def get_deposit_money_history(self, currency=\"btc\"):\n return self.execute_private_api(\"/api/deposit_money?currency={}\".format(currency), \"GET\")",
"def get_trade_history(self, currency1='STAK', currency2='BTC'):\n return requests.get(self.api_base + 'trades?pair=%s_%s'%(currency1, currency2))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get history of certain deposited currency | def get_deposit_money_history(self, currency="btc"):
return self.execute_private_api("/api/deposit_money?currency={}".format(currency), "GET") | [
"def get_send_money_history(self, currency=\"btc\"):\n return self.execute_private_api(\"/api/send_money?currency={}\".format(currency), \"GET\")",
"def get_trade_history(self, currency1='STAK', currency2='BTC'):\n return requests.get(self.api_base + 'trades?pair=%s_%s'%(currency1, currency2)).json(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri sets the default crs to WGS84. | def test_default_crs(self):
x = geo_uri("geo:0,0,0;a=1;b=2;c=ab%2dcd")
x = geo_uri("geo:0,0,0")
self.assertEqual('wgs84', x.crs)
self.assertTrue(isinstance(x, geouri.GeoURI_WGS84))
self.assertIsNone(x.uncertainty)
self.assertEqual("geo:0,0,0", str(geo_uri("geo:0,0,0"))) | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri equaltity operation. | def test_equality(self):
self.assertEqual(geo_uri("geo:0,0,0"), geo_uri("geo:0,0,0"))
self.assertEqual(geo_uri("geo:0,0,0;crs=wgs84"), geo_uri("geo:0,0,0"))
self.assertEqual(geo_uri("geo:0,0,0;crs=wgs84"), geo_uri("geo:0,0,0;crs=wgs84"))
self.assertEqual(geo_uri("geo:90,0,0"), g... | [
"def test_0(self):\n x = geo_uri(\"geo:0,0,0;crs=wgs84\")\n y = geo_uri(\"geo:-0,-0,-0;crs=wgs84\")\n self.assertEqual(x, y)\n self.assertEqual(\"geo:0,0,0;crs=wgs84\", str(x))\n self.assertEqual(\"geo:0,0,0;crs=wgs84\", str(y))",
"def test_urn(self):\n self.assertEqual(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that geo_uri raises exception for unknown coordinate reference system (crs). | def test_unknown_crs(self):
self.assertRaises(ValueError, geo_uri, "geo:0,0,0;crs=SpamEggs") | [
"def test_min(self):\n self.assertRaises(ValueError, geo_uri, \"geo:-90.000001,-180.000001,0;crs=wgs84\")",
"def test_faulty(self):\n self.assertRaises(ValueError, geo_uri, \"xxx:40.685922,-111.853206,1321;crs=wgs84;u=1.2\")\n self.assertRaises(ValueError, geo_uri, \"geo:40.685922,-111.853206... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that geo_uri raises exceptions for faulty URI formats. | def test_faulty(self):
self.assertRaises(ValueError, geo_uri, "xxx:40.685922,-111.853206,1321;crs=wgs84;u=1.2")
self.assertRaises(ValueError, geo_uri, "geo:40.685922,-111.853206,1321;u=1.2;crs=wgs84")
self.assertRaises(ValueError, geo_uri, "geo:40.685922,-111.853206,1321;crs=wgs84;spam=1;u=1.2") | [
"def test_unknown_crs(self):\n self.assertRaises(ValueError, geo_uri, \"geo:0,0,0;crs=SpamEggs\")",
"def test_bad_store_scheme(self):\n bad_uri = 'unknown://user:pass@example.com:80/images/some-id'\n\n self.assertRaises(exception.UnknownScheme,\n location.get_location... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing the URN for the WGS84 CRS identifier. | def test_urn(self):
self.assertEqual("urn:ogc:def:crs:EPSG::4979", geo_uri("geo:48.2010,16.3695,183").crs_urn)
self.assertEqual("urn:ogc:def:crs:EPSG::4326", geo_uri("geo:48.198634,16.371648;crs=wgs84;u=40").crs_urn) | [
"def test_default_crs(self):\n x = geo_uri(\"geo:0,0,0;a=1;b=2;c=ab%2dcd\")\n x = geo_uri(\"geo:0,0,0\")\n self.assertEqual('wgs84', x.crs)\n self.assertTrue(isinstance(x, geouri.GeoURI_WGS84))\n self.assertIsNone(x.uncertainty)\n self.assertEqual(\"geo:0,0,0\", str(geo_uri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 lattitue, longitude, and altitude format. | def test_3d(self):
x = geo_uri("geo:40.685922,-111.853206,1321;crs=WGS84")
self.assertEqual('wgs84', x.crs)
self.assertAlmostEqual(40.685922, x.lattitude, places=6)
self.assertAlmostEqual(-111.853206, x.longitude, places=6)
self.assertAlmostEqual(1321, x.altitude, places=3)
... | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 lattitue and longitude format. | def test_2d(self):
x = geo_uri("geo:40.685922,-111.853206;crs=wgs84")
self.assertEqual('wgs84', x.crs)
self.assertAlmostEqual(40.685922, x.lattitude, places=6)
self.assertAlmostEqual(-111.853206, x.longitude, places=6)
self.assertIsNone(x.altitude)
self.assertEqual("geo:4... | [
"def test_poles(self):\n x = geo_uri(\"geo:90,0;crs=wgs84\")\n self.assertEqual(x, geo_uri(\"geo:90,-180;crs=wgs84\"))\n self.assertEqual(x, geo_uri(\"geo:90,180;crs=wgs84\"))\n self.assertEqual(x, geo_uri(\"geo:90,1;crs=wgs84\"))\n self.assertEqual(\"geo:90,0;crs=wgs84\", str(geo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 zeros. | def test_0(self):
x = geo_uri("geo:0,0,0;crs=wgs84")
y = geo_uri("geo:-0,-0,-0;crs=wgs84")
self.assertEqual(x, y)
self.assertEqual("geo:0,0,0;crs=wgs84", str(x))
self.assertEqual("geo:0,0,0;crs=wgs84", str(y)) | [
"def test_default_crs(self):\n x = geo_uri(\"geo:0,0,0;a=1;b=2;c=ab%2dcd\")\n x = geo_uri(\"geo:0,0,0\")\n self.assertEqual('wgs84', x.crs)\n self.assertTrue(isinstance(x, geouri.GeoURI_WGS84))\n self.assertIsNone(x.uncertainty)\n self.assertEqual(\"geo:0,0,0\", str(geo_uri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 at the poles. | def test_poles(self):
x = geo_uri("geo:90,0;crs=wgs84")
self.assertEqual(x, geo_uri("geo:90,-180;crs=wgs84"))
self.assertEqual(x, geo_uri("geo:90,180;crs=wgs84"))
self.assertEqual(x, geo_uri("geo:90,1;crs=wgs84"))
self.assertEqual("geo:90,0;crs=wgs84", str(geo_uri("geo:90,-23;crs... | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 uncertainty ranges. | def test_uncertainty(self):
x = geo_uri("geo:40.685922,-111.853206,1321;crs=wgs84;u=0")
self.assertAlmostEqual(40.685922, x.lattitude, places=6)
self.assertAlmostEqual(-111.853206, x.longitude, places=6)
self.assertAlmostEqual(1321, x.altitude, places=3)
xr = x.lattitude_range
... | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 max values. | def test_max(self):
self.assertRaises(ValueError, geo_uri, "geo:90.000001,180.000001,0;crs=wgs84") | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing geo_uri WGS84 min values. | def test_min(self):
self.assertRaises(ValueError, geo_uri, "geo:-90.000001,-180.000001,0;crs=wgs84") | [
"def test_2d(self):\n x = geo_uri(\"geo:40.685922,-111.853206;crs=wgs84\")\n self.assertEqual('wgs84', x.crs)\n self.assertAlmostEqual(40.685922, x.lattitude, places=6)\n self.assertAlmostEqual(-111.853206, x.longitude, places=6)\n self.assertIsNone(x.altitude)\n self.asser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rate the metapath according to the entropy of the sequence. | def entropy(mp: MetaPath) -> float:
frequencies = np.array(list(Counter(mp.as_list()).values())) / len(mp)
return probablistic_entropy(frequencies) | [
"def entropy_rate(self):\n from rpy2.robjects import r, globalenv\n from itertools import product\n import pandas as pd\n import pandas.rpy.common as com\n from scipy.special import xlogy\n\n r(\"library('DTMCPack')\")\n globalenv['transmat'] = com.convert_to_r_dataf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the cost we will have to build n plants of type p INPUT s (desired amount of energy) planttype | def plantTypeCost(s, plant):
kwhPerPlant = plant.kwhPerPlants
maxPlants = plant.maxPlants
costPerPlant = plant.costPerPlant
# if s non-positive, return 0
if (s <= 0):
return 0
# if x larger than possible generation, return infinite
if (s > kwhPerPlant * maxPlants):
... | [
"def _calc_poe_power_budget(self, poe_type, uut_poe_ports):\n poe_ports = common_utils.expand_comma_dash_num_list(uut_poe_ports)\n pwr_map = {'POE': 15, 'POE+': 30, 'UPOE': 60}\n port_group_list = [4, 3, 2, 1]\n pwr_available = self.get_power_available()\n if pwr_available == 0:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |