query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Set up node resource group for the ManagedCluster object. | def set_up_node_resource_group(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
mc.node_resource_group = self.context.get_node_resource_group()
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_cluster(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def _init_cluster(self):\n self._Init_Cluster()",
"def setup(self, cluster):\n raise NotImplementedError()",
"def __init__(__self__,\n resource_name: str,\n args... | [
"0.6686903",
"0.6289803",
"0.61468226",
"0.6087124",
"0.60325193",
"0.5909405",
"0.582536",
"0.5820801",
"0.57012415",
"0.5641262",
"0.56390566",
"0.5630276",
"0.5610059",
"0.55397946",
"0.55355084",
"0.5534161",
"0.552077",
"0.55206263",
"0.55193686",
"0.55183315",
"0.551642... | 0.78996533 | 0 |
Set up supportPlan for the ManagedCluster object. | def set_up_k8s_support_plan(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
support_plan = self.context.get_k8s_support_plan()
if support_plan == KubernetesSupportPlan.AKS_LONG_TERM_SUPPORT:
if mc is None or mc.sku is None or mc.sku.tier.lower() != CONST_MANAGED_CLU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self, cluster):\n raise NotImplementedError()",
"def _setup_cluster(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def update_k8s_support_plan(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n support_plan = self.context.ge... | [
"0.67845285",
"0.6472733",
"0.6166948",
"0.5738119",
"0.5612151",
"0.55861145",
"0.55009985",
"0.5440655",
"0.53569967",
"0.52553874",
"0.52533066",
"0.5251024",
"0.5222459",
"0.52190816",
"0.52048093",
"0.5204209",
"0.5203179",
"0.5169113",
"0.51444334",
"0.5130886",
"0.5089... | 0.7180916 | 0 |
Set up azure monitor profile for the ManagedCluster object. | def set_up_azure_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
# read the original value passed by the command
ksm_metric_labels_allow_list = self.context.raw_param.get("ksm_metric_labels_allow_list")
ksm_metric_annotations_allow_list = self.context.raw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_azure_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n # read the original value passed by the command\n ksm_metric_labels_allow_list = self.context.raw_param.get(\"ksm_metric_labels_allow_list\")\n ksm_metric_annotations_allow_list = sel... | [
"0.72846806",
"0.71346223",
"0.64711446",
"0.6104006",
"0.60403425",
"0.59842443",
"0.5969809",
"0.59013",
"0.5852365",
"0.5829357",
"0.5784714",
"0.5775937",
"0.5744401",
"0.570182",
"0.57013726",
"0.5676068",
"0.56605566",
"0.5610358",
"0.5585451",
"0.5560262",
"0.55012053"... | 0.7944016 | 0 |
The overall controller used to construct the default ManagedCluster profile. The completely constructed ManagedCluster object will later be passed as a parameter to the underlying SDK (mgmtcontainerservice) to send the actual request. | def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> ManagedCluster:
# initialize the ManagedCluster object
mc = self.init_mc()
# DO NOT MOVE: remove defaults
self._remove_defaults_in_mc(mc)
# set up agentpool profile
mc = self.set_up_agentpoo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_mc_profile_default(self) -> ManagedCluster:\n # check raw parameters\n # promt y/n if no options are specified to ask user whether to perform a reconcile operation\n self.check_raw_parameters()\n # fetch the ManagedCluster object\n mc = self.fetch_mc()\n # updat... | [
"0.6218793",
"0.5972921",
"0.58533275",
"0.58225167",
"0.5787789",
"0.57581836",
"0.5740016",
"0.5665097",
"0.5546167",
"0.5515622",
"0.5507955",
"0.5492365",
"0.54808474",
"0.5428319",
"0.5423355",
"0.5421532",
"0.5405033",
"0.5404923",
"0.5400361",
"0.5365038",
"0.534484",
... | 0.6419381 | 0 |
Helper function to check if postprocessing is required after sending a PUT request to create the cluster. | def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool:
# some addons require post cluster creation role assigment
monitoring_addon_enabled = self.context.get_intermediate("monitoring_addon_enabled", default_value=False)
ingress_appgw_addon_enabled = self.context.get_intermediate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool:\n # some addons require post cluster creation role assigment\n monitoring_addon_enabled = self.context.get_intermediate(\"monitoring_addon_enabled\", default_value=False)\n ingress_appgw_addon_enabled = self.context.get_in... | [
"0.65956247",
"0.6160552",
"0.5965819",
"0.5765838",
"0.54389656",
"0.52548474",
"0.5172896",
"0.51714987",
"0.5161744",
"0.5144229",
"0.50794834",
"0.50763243",
"0.50758445",
"0.5068631",
"0.506405",
"0.50525963",
"0.5025663",
"0.50229084",
"0.50158024",
"0.49857804",
"0.498... | 0.6787382 | 0 |
Initialize an AKSManagedClusterModels object to store the models. | def init_models(self) -> None:
self.models = AKSManagedClusterModels(self.cmd, self.resource_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_context(self) -> None:\n self.context = AKSManagedClusterContext(\n self.cmd, AKSManagedClusterParamDict(self.__raw_parameters), self.models, DecoratorMode.CREATE\n )",
"def init_context(self) -> None:\n self.context = AKSManagedClusterContext(\n self.cmd, AKSM... | [
"0.6589613",
"0.6397897",
"0.6296286",
"0.60146695",
"0.5976117",
"0.59535027",
"0.5843019",
"0.5837605",
"0.582323",
"0.5809182",
"0.5631231",
"0.55995786",
"0.54818463",
"0.5473843",
"0.5443327",
"0.54403687",
"0.5425224",
"0.54122424",
"0.54051256",
"0.53920186",
"0.537389... | 0.8961721 | 0 |
Initialize an AKSManagedClusterContext object to store the context in the process of assemble the ManagedCluster object. | def init_context(self) -> None:
self.context = AKSManagedClusterContext(
self.cmd, AKSManagedClusterParamDict(self.__raw_parameters), self.models, DecoratorMode.UPDATE
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_context(self) -> None:\n self.context = AKSManagedClusterContext(\n self.cmd, AKSManagedClusterParamDict(self.__raw_parameters), self.models, DecoratorMode.CREATE\n )",
"def init_mc(self) -> ManagedCluster:\n # Initialize a ManagedCluster object with mandatory parameter l... | [
"0.88289833",
"0.7161641",
"0.59363616",
"0.5745033",
"0.5745033",
"0.5690117",
"0.56848526",
"0.568348",
"0.56026167",
"0.5602479",
"0.5587021",
"0.556977",
"0.5519842",
"0.5515008",
"0.547153",
"0.5434008",
"0.54178995",
"0.53875893",
"0.53501666",
"0.5329567",
"0.53131104"... | 0.86212176 | 1 |
Initialize an AKSAgentPoolAddDecorator object to assemble the AgentPool profile. | def init_agentpool_decorator_context(self) -> None:
self.agentpool_decorator = AKSAgentPoolUpdateDecorator(
self.cmd, self.client, self.__raw_parameters, self.resource_type, self.agentpool_decorator_mode
)
self.agentpool_context = self.agentpool_decorator.context
self.context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_agentpool_decorator_context(self) -> None:\n self.agentpool_decorator = AKSAgentPoolAddDecorator(\n self.cmd, self.client, self.__raw_parameters, self.resource_type, self.agentpool_decorator_mode\n )\n self.agentpool_context = self.agentpool_decorator.context\n self.... | [
"0.82316643",
"0.61094487",
"0.58690387",
"0.58118975",
"0.5642255",
"0.5622449",
"0.5469193",
"0.5461134",
"0.5350976",
"0.5324465",
"0.5300219",
"0.52914625",
"0.5236859",
"0.5222781",
"0.51754194",
"0.51687443",
"0.51389706",
"0.51012224",
"0.5097092",
"0.50748473",
"0.505... | 0.7490148 | 1 |
Helper function to check whether any parameters are set. If the values of all the parameters are the default values, the command execution will be terminated early and raise a RequiredArgumentMissingError. Neither the request to fetch or update the ManagedCluster object will be sent. | def check_raw_parameters(self):
# exclude some irrelevant or mandatory parameters
excluded_keys = ("cmd", "client", "resource_group_name", "name")
# check whether the remaining parameters are set
# the default value None or False (and other empty values, like empty string) will be consid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_required(self):\n for argument in self.arguments:\n if argument.required:\n raise ArgumentRequiredError(argument, self.tagname)\n else:\n self.kwargs[argument.name] = argument.get_default()",
"def checkParameters(self):\n EDVerbose.DEBUG... | [
"0.6678303",
"0.65089667",
"0.6347127",
"0.6260354",
"0.623185",
"0.62158525",
"0.6201601",
"0.6174969",
"0.6122561",
"0.61169016",
"0.6064124",
"0.59828496",
"0.59544414",
"0.5933564",
"0.5917931",
"0.5912249",
"0.5910069",
"0.5893333",
"0.5893333",
"0.5892044",
"0.58627796"... | 0.6989657 | 0 |
Internal function to ensure that the incoming `mc` object is valid and the same as the attached `mc` object in the context. If the incomding `mc` is not valid or is inconsistent with the `mc` in the context, raise a CLIInternalError. | def _ensure_mc(self, mc: ManagedCluster) -> None:
if not isinstance(mc, self.models.ManagedCluster):
raise CLIInternalError(
"Unexpected mc object with type '{}'.".format(type(mc))
)
if self.context.mc != mc:
raise CLIInternalError(
"I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_mc(self, mc: ManagedCluster) -> None:\n if not isinstance(mc, self.models.ManagedCluster):\n raise CLIInternalError(\n \"Unexpected mc object with type '{}'.\".format(type(mc))\n )\n\n if self.context.mc != mc:\n raise CLIInternalError(\n ... | [
"0.8108351",
"0.5865274",
"0.5721774",
"0.5506098",
"0.5488774",
"0.5384116",
"0.5317153",
"0.5299704",
"0.52886504",
"0.52636874",
"0.52195853",
"0.5134537",
"0.5118759",
"0.51167303",
"0.50530046",
"0.5004237",
"0.50021195",
"0.49870652",
"0.4983264",
"0.49633512",
"0.49613... | 0.8137792 | 0 |
Get the ManagedCluster object currently in use and attach it to internal context. Internally send request using ContainerServiceClient and parameters name (cluster) and resource group name. | def fetch_mc(self) -> ManagedCluster:
mc = self.client.get(self.context.get_resource_group_name(), self.context.get_name())
# attach mc to AKSContext
self.context.attach_mc(mc)
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_mc(self) -> ManagedCluster:\n # Initialize a ManagedCluster object with mandatory parameter location.\n mc = self.models.ManagedCluster(\n location=self.context.get_location(),\n )\n\n # attach mc to AKSContext\n self.context.attach_mc(mc)\n return mc",... | [
"0.63290817",
"0.5981959",
"0.5886816",
"0.58823264",
"0.5875958",
"0.5780633",
"0.5742241",
"0.5623842",
"0.56223327",
"0.5598198",
"0.5598198",
"0.55960774",
"0.5590564",
"0.5503874",
"0.54916924",
"0.54552215",
"0.5428519",
"0.5419511",
"0.5408951",
"0.53970474",
"0.539554... | 0.6626831 | 0 |
Update agentpool profile for the ManagedCluster object. | def update_agentpool_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if not mc.agent_pool_profiles:
raise UnknownError(
"Encounter an unexpected error while getting agent pool profiles from the cluster in the process of "
"updating ag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_agentpool_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n agentpool_profile = self.agentpool_decorator.construct_agentpool_profile_default()\n mc.agent_pool_profiles = [agentpool_profile]\n return mc",
"def update_mc_profile_default(self) -> M... | [
"0.69000655",
"0.64854956",
"0.63575286",
"0.58744913",
"0.5846469",
"0.58256614",
"0.58208615",
"0.571694",
"0.56969243",
"0.5597279",
"0.55756265",
"0.5568938",
"0.55441463",
"0.55437326",
"0.54608375",
"0.5429033",
"0.5364649",
"0.5275306",
"0.5205076",
"0.5190666",
"0.517... | 0.8161614 | 0 |
Update autoscaler profile for the ManagedCluster object. | def update_auto_scaler_profile(self, mc):
self._ensure_mc(mc)
cluster_autoscaler_profile = self.context.get_cluster_autoscaler_profile()
if cluster_autoscaler_profile is not None:
# update profile (may clear profile with empty dictionary)
mc.auto_scaler_profile = cluster... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_auto_scaler_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n cluster_autoscaler_profile = self.context.get_cluster_autoscaler_profile()\n mc.auto_scaler_profile = cluster_autoscaler_profile\n return mc",
"def update_workload_auto_scaler_profile... | [
"0.77689654",
"0.77025795",
"0.70554644",
"0.6538188",
"0.62741613",
"0.62367916",
"0.61821556",
"0.60954934",
"0.6095449",
"0.5962787",
"0.5960805",
"0.58981574",
"0.58537835",
"0.582746",
"0.5796772",
"0.57472837",
"0.5672821",
"0.5601652",
"0.5588318",
"0.5538377",
"0.5453... | 0.8491165 | 0 |
Update tags for the ManagedCluster object. | def update_tags(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
tags = self.context.get_tags()
if tags is not None:
mc.tags = tags
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddClusterTags(self, tags, dry_run=False, reason=None):\n query = [(\"tag\", t) for t in tags]\n _AppendDryRunIf(query, dry_run)\n _AppendReason(query, reason)\n\n return self._SendRequest(HTTP_PUT, \"/%s/tags\" % GANETI_RAPI_VERSION,\n query, None)",
"def update_clust... | [
"0.5990642",
"0.59193057",
"0.5559754",
"0.55428",
"0.54464996",
"0.5432885",
"0.5410724",
"0.54037637",
"0.54037637",
"0.54037637",
"0.5357456",
"0.5332834",
"0.53129476",
"0.52917403",
"0.5266721",
"0.5208107",
"0.5159976",
"0.513104",
"0.51148003",
"0.5085101",
"0.50813633... | 0.74483514 | 0 |
Attach or detach acr for the cluster. The function "ensure_aks_acr" will be called to create or delete an AcrPull role assignment for the acr, which internally used AuthorizationManagementClient to send the request. | def process_attach_detach_acr(self, mc: ManagedCluster) -> None:
self._ensure_mc(mc)
subscription_id = self.context.get_subscription_id()
assignee, is_service_principal = self.context.get_assignee_from_identity_or_sp_profile()
attach_acr = self.context.get_attach_acr()
detach_ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_attach_acr(self, mc: ManagedCluster) -> None:\n self._ensure_mc(mc)\n\n attach_acr = self.context.get_attach_acr()\n if attach_acr:\n # If enable_managed_identity, attach acr operation will be handled after the cluster is created\n if not self.context.get_enab... | [
"0.70333576",
"0.6105166",
"0.52634287",
"0.49878967",
"0.4939688",
"0.49266833",
"0.48635554",
"0.47929135",
"0.47830227",
"0.469469",
"0.46504804",
"0.45948967",
"0.45948967",
"0.45925927",
"0.45897233",
"0.45892283",
"0.45535025",
"0.4539842",
"0.45309758",
"0.4507648",
"0... | 0.6910099 | 1 |
Update sku (uptime sla) for the ManagedCluster object. | def update_sku(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
# Premium without LTS is ok (not vice versa)
if self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_PREMIUM:
mc.sku = self.models.ManagedClusterSKU(
name="Base",
tie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_sku(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n if self.context.get_uptime_sla() or self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:\n mc.sku = self.models.ManagedClusterSKU(\n name=\"Base\",\n tier=\"St... | [
"0.71179074",
"0.5984935",
"0.53230107",
"0.5303793",
"0.5204448",
"0.5096391",
"0.5087994",
"0.5086891",
"0.502062",
"0.49859262",
"0.4938367",
"0.49240932",
"0.48839968",
"0.48643538",
"0.48471776",
"0.48239538",
"0.47839066",
"0.47805685",
"0.47805685",
"0.4759781",
"0.475... | 0.7960321 | 0 |
Update outbound type of network profile for the ManagedCluster object. | def update_outbound_type_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
outboundType = self.context.get_outbound_type()
if outboundType:
vnet_subnet_id = self.context.get_vnet_subnet_id()
if vnet_subnet_id is None and outboundType not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_nat_gateway_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n if not mc.network_profile:\n raise UnknownError(\n \"Unexpectedly get an empty network profile in the process of updating nat gateway profile.\"\n )\n outb... | [
"0.59787434",
"0.5740378",
"0.5654729",
"0.56542915",
"0.5408262",
"0.5325254",
"0.53181076",
"0.5237229",
"0.5191053",
"0.5164368",
"0.5101257",
"0.50718784",
"0.5071083",
"0.4919225",
"0.49110246",
"0.48976603",
"0.48807123",
"0.48262355",
"0.47698545",
"0.46744728",
"0.465... | 0.820513 | 0 |
Update load balancer profile for the ManagedCluster object. | def update_load_balancer_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if not mc.network_profile:
raise UnknownError(
"Encounter an unexpected error while getting network profile from the cluster in the process of "
"updating its lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_agentpool_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n if not mc.agent_pool_profiles:\n raise UnknownError(\n \"Encounter an unexpected error while getting agent pool profiles from the cluster in the process of \"\n ... | [
"0.65942985",
"0.63839215",
"0.6343197",
"0.62864435",
"0.61292905",
"0.61204284",
"0.6031443",
"0.57443124",
"0.5726644",
"0.5723703",
"0.5628799",
"0.5628109",
"0.5623104",
"0.56101996",
"0.56002855",
"0.5590744",
"0.5588446",
"0.55560887",
"0.55289423",
"0.55235827",
"0.55... | 0.75255644 | 0 |
Update nat gateway profile for the ManagedCluster object. | def update_nat_gateway_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if not mc.network_profile:
raise UnknownError(
"Unexpectedly get an empty network profile in the process of updating nat gateway profile."
)
outbound_type = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_mc_profile_default(self) -> ManagedCluster:\n # check raw parameters\n # promt y/n if no options are specified to ask user whether to perform a reconcile operation\n self.check_raw_parameters()\n # fetch the ManagedCluster object\n mc = self.fetch_mc()\n # updat... | [
"0.6426489",
"0.63450545",
"0.62319547",
"0.60947186",
"0.60823864",
"0.59361637",
"0.5891273",
"0.5854507",
"0.5761657",
"0.57524437",
"0.5678059",
"0.56612414",
"0.5579701",
"0.53702694",
"0.5347543",
"0.53397816",
"0.5326909",
"0.52681994",
"0.5237096",
"0.5205934",
"0.518... | 0.7545268 | 0 |
Update disable/enable local accounts for the ManagedCluster object. | def update_disable_local_accounts(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if self.context.get_disable_local_accounts():
mc.disable_local_accounts = True
if self.context.get_enable_local_accounts():
mc.disable_local_accounts = False
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_identity(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n current_identity_type = \"spn\"\n current_user_assigned_identity = \"\"\n if mc.identity is not None:\n current_identity_type = mc.identity.type.casefold()\n if mc.identity.u... | [
"0.5662341",
"0.5546752",
"0.54727477",
"0.53884345",
"0.5381607",
"0.5305259",
"0.5174011",
"0.51711553",
"0.51159185",
"0.5115369",
"0.5103545",
"0.5077516",
"0.50707024",
"0.50563246",
"0.4988788",
"0.49565467",
"0.49428022",
"0.4870084",
"0.4857425",
"0.48238754",
"0.4820... | 0.7822991 | 0 |
Update api server access profile and fqdn subdomain for the ManagedCluster object. | def update_api_server_access_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if mc.api_server_access_profile is None:
profile_holder = self.models.ManagedClusterAPIServerAccessProfile()
else:
profile_holder = mc.api_server_access_profile
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_api_server_access_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n api_server_access_profile = None\n api_server_authorized_ip_ranges = self.context.get_api_server_authorized_ip_ranges()\n enable_private_cluster = self.context.get_enable_private_... | [
"0.6785518",
"0.62549794",
"0.56788695",
"0.5587446",
"0.55768114",
"0.5548693",
"0.5440958",
"0.523388",
"0.5209735",
"0.5204637",
"0.5203941",
"0.5169459",
"0.5154716",
"0.51498365",
"0.5145779",
"0.50799966",
"0.50749654",
"0.50468695",
"0.5043714",
"0.50179535",
"0.500715... | 0.72265285 | 0 |
Update windows profile for the ManagedCluster object. | def update_windows_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
enable_ahub = self.context.get_enable_ahub()
disable_ahub = self.context.get_disable_ahub()
windows_admin_password = self.context.get_windows_admin_password()
enable_windows_gmsa = self.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_windows_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n (\n windows_admin_username,\n windows_admin_password,\n ) = self.context.get_windows_admin_username_and_password()\n if windows_admin_username or windows_admin_passwor... | [
"0.6615214",
"0.6559488",
"0.6554667",
"0.6302969",
"0.62154424",
"0.6039585",
"0.60123307",
"0.5999623",
"0.5888613",
"0.58799297",
"0.5857495",
"0.57862186",
"0.575272",
"0.55814606",
"0.5574849",
"0.5490474",
"0.54602957",
"0.5456462",
"0.54487735",
"0.5445578",
"0.5434550... | 0.79302394 | 0 |
Update aad profile for the ManagedCluster object. | def update_aad_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if self.context.get_enable_aad():
mc.aad_profile = self.models.ManagedClusterAADProfile(
managed=True
)
aad_tenant_id = self.context.get_aad_tenant_id()
aad_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_mc_profile_default(self) -> ManagedCluster:\n # check raw parameters\n # promt y/n if no options are specified to ask user whether to perform a reconcile operation\n self.check_raw_parameters()\n # fetch the ManagedCluster object\n mc = self.fetch_mc()\n # updat... | [
"0.65236986",
"0.64542335",
"0.6392261",
"0.6273808",
"0.62069446",
"0.62045646",
"0.6041641",
"0.58790123",
"0.5821626",
"0.5816845",
"0.57900316",
"0.57251436",
"0.57209194",
"0.5489699",
"0.54597247",
"0.54454964",
"0.54235744",
"0.5406756",
"0.5329346",
"0.5309974",
"0.53... | 0.7686997 | 0 |
Update OIDC issuer profile for the ManagedCluster object. | def update_oidc_issuer_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
oidc_issuer_profile = self.context.get_oidc_issuer_profile()
if oidc_issuer_profile is not None:
mc.oidc_issuer_profile = oidc_issuer_profile
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_oidc_issuer_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n oidc_issuer_profile = self.context.get_oidc_issuer_profile()\n if oidc_issuer_profile is not None:\n mc.oidc_issuer_profile = oidc_issuer_profile\n\n return mc",
"def update_... | [
"0.7138633",
"0.6434838",
"0.6359209",
"0.6091803",
"0.5943593",
"0.5936524",
"0.5852094",
"0.5840535",
"0.58331877",
"0.56902266",
"0.56145376",
"0.55521697",
"0.5457869",
"0.53420657",
"0.5270344",
"0.52316934",
"0.51749843",
"0.5146125",
"0.5134343",
"0.5117193",
"0.509305... | 0.79235494 | 0 |
Update auto upgrade profile for the ManagedCluster object. | def update_auto_upgrade_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
auto_upgrade_channel = self.context.get_auto_upgrade_channel()
if auto_upgrade_channel is not None:
if mc.auto_upgrade_profile is None:
mc.auto_upgrade_profile = self.mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_auto_upgrade_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n auto_upgrade_profile = None\n auto_upgrade_channel = self.context.get_auto_upgrade_channel()\n if auto_upgrade_channel:\n auto_upgrade_profile = self.models.ManagedClusterAu... | [
"0.7363615",
"0.7225819",
"0.70861536",
"0.6530185",
"0.6529984",
"0.65046024",
"0.6463127",
"0.6392512",
"0.6330424",
"0.6251988",
"0.60825664",
"0.604037",
"0.5928965",
"0.591562",
"0.5909689",
"0.5905758",
"0.5892767",
"0.5789834",
"0.57436556",
"0.5720232",
"0.5621832",
... | 0.7936828 | 0 |
Update network plugin settings of network profile for the ManagedCluster object. | def update_network_plugin_settings(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
network_plugin_mode = self.context.get_network_plugin_mode()
if network_plugin_mode:
mc.network_profile.network_plugin_mode = network_plugin_mode
(
pod_cidr,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_mc_profile_default(self) -> ManagedCluster:\n # check raw parameters\n # promt y/n if no options are specified to ask user whether to perform a reconcile operation\n self.check_raw_parameters()\n # fetch the ManagedCluster object\n mc = self.fetch_mc()\n # updat... | [
"0.6287261",
"0.62562764",
"0.6206155",
"0.5919854",
"0.5832747",
"0.5745208",
"0.5725939",
"0.5664839",
"0.5643876",
"0.56297773",
"0.5584582",
"0.54472065",
"0.5360767",
"0.53581583",
"0.534671",
"0.53357637",
"0.53113896",
"0.52554923",
"0.5243599",
"0.51855236",
"0.518398... | 0.8056863 | 0 |
Set up http proxy config for the ManagedCluster object. | def update_http_proxy_config(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
mc.http_proxy_config = self.context.get_http_proxy_config()
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_http_proxy_config(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n mc.http_proxy_config = self.context.get_http_proxy_config()\n return mc",
"def configure_proxy(self, proxy):\n server_name = self.get_external_domain()\n tls_enabled = self.get_t... | [
"0.8328459",
"0.7013146",
"0.66061956",
"0.62437",
"0.6242223",
"0.6079759",
"0.6033155",
"0.5956672",
"0.59050727",
"0.5850278",
"0.5808023",
"0.57922196",
"0.57898855",
"0.5735324",
"0.5733755",
"0.57264936",
"0.57036024",
"0.56576514",
"0.5641072",
"0.56382865",
"0.5567362... | 0.76427263 | 1 |
Update identity for the ManagedCluster object. | def update_identity(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
current_identity_type = "spn"
current_user_assigned_identity = ""
if mc.identity is not None:
current_identity_type = mc.identity.type.casefold()
if mc.identity.user_assigned_ide... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n assign_kubelet_identity = self.context.get_assign_kubelet_identity()\n if assign_kubelet_identity:\n identity_profile = {\n 'kubeletidentity': self.models.UserAssignedId... | [
"0.6890525",
"0.6792401",
"0.67554677",
"0.64075714",
"0.6162829",
"0.60769516",
"0.60417324",
"0.6015845",
"0.59331",
"0.5860449",
"0.5834495",
"0.56925756",
"0.55881435",
"0.5503835",
"0.5495691",
"0.5485756",
"0.54500324",
"0.5367659",
"0.53397477",
"0.5334898",
"0.531647"... | 0.7773668 | 0 |
Update azure keyvault secrets provider addon profile. | def update_azure_keyvault_secrets_provider_addon_profile(
self,
azure_keyvault_secrets_provider_addon_profile: ManagedClusterAddonProfile,
) -> ManagedClusterAddonProfile:
# determine the value of constants
addon_consts = self.context.get_addon_consts()
CONST_SECRET_ROTATION_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_azure_keyvault_secrets_provider_addon_profile(self) -> ManagedClusterAddonProfile:\n # determine the value of constants\n addon_consts = self.context.get_addon_consts()\n CONST_SECRET_ROTATION_ENABLED = addon_consts.get(\n \"CONST_SECRET_ROTATION_ENABLED\"\n )\n ... | [
"0.6497985",
"0.5921258",
"0.5528834",
"0.5507355",
"0.5399552",
"0.5295169",
"0.52810067",
"0.5180465",
"0.51292896",
"0.50870067",
"0.5064962",
"0.49963173",
"0.49906343",
"0.49508905",
"0.4913882",
"0.4892998",
"0.48583922",
"0.4851113",
"0.4835317",
"0.48326787",
"0.48243... | 0.78517073 | 0 |
Update addon profiles for the ManagedCluster object. | def update_addon_profiles(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
# determine the value of constants
addon_consts = self.context.get_addon_consts()
CONST_MONITORING_ADDON_NAME = addon_consts.get(
"CONST_MONITORING_ADDON_NAME"
)
CONST_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_mc_profile_default(self) -> ManagedCluster:\n # check raw parameters\n # promt y/n if no options are specified to ask user whether to perform a reconcile operation\n self.check_raw_parameters()\n # fetch the ManagedCluster object\n mc = self.fetch_mc()\n # updat... | [
"0.6944433",
"0.68986964",
"0.628397",
"0.62623245",
"0.6228979",
"0.6208819",
"0.62029546",
"0.6185522",
"0.59600425",
"0.585744",
"0.5846797",
"0.5775247",
"0.5593754",
"0.5517053",
"0.54938537",
"0.5422821",
"0.5410289",
"0.5373",
"0.5363987",
"0.5341301",
"0.5306761",
"... | 0.74111545 | 0 |
Update storage profile for the ManagedCluster object. | def update_storage_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
mc.storage_profile = self.context.get_storage_profile()
return mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_storage_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n if hasattr(self.models, \"ManagedClusterStorageProfile\"):\n mc.storage_profile = self.context.get_storage_profile()\n\n return mc",
"def update_mc_profile_default(self) -> ManagedClu... | [
"0.7120557",
"0.6314157",
"0.6202867",
"0.58940035",
"0.5887002",
"0.5872036",
"0.5859722",
"0.5836123",
"0.57843363",
"0.5757808",
"0.5714045",
"0.5625429",
"0.55987877",
"0.54697853",
"0.54638046",
"0.5455607",
"0.54530305",
"0.53886455",
"0.53717756",
"0.5316751",
"0.52893... | 0.81250465 | 0 |
Update defender for the ManagedCluster object. | def update_defender(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
defender = self.context.get_defender_config()
if defender:
if mc.security_profile is None:
mc.security_profile = self.models.ManagedClusterSecurityProfile()
mc.security_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_defender(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n defender = self.context.get_defender_config()\n if defender:\n if mc.security_profile is None:\n mc.security_profile = self.models.ManagedClusterSecurityProfile()\n\n ... | [
"0.663469",
"0.5969144",
"0.5808746",
"0.57962227",
"0.56318694",
"0.56318694",
"0.56318694",
"0.56318694",
"0.56318694",
"0.56318694",
"0.5557113",
"0.5524853",
"0.55183303",
"0.5509389",
"0.54063356",
"0.53238606",
"0.5301363",
"0.52094877",
"0.51349497",
"0.51327986",
"0.5... | 0.75369984 | 0 |
Update workload identity profile for the ManagedCluster object. | def update_workload_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
profile = self.context.get_workload_identity_profile()
if profile:
if mc.security_profile is None:
mc.security_profile = self.models.ManagedClusterSecurityProfile()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n assign_kubelet_identity = self.context.get_assign_kubelet_identity()\n if assign_kubelet_identity:\n identity_profile = {\n 'kubeletidentity': self.models.UserAssignedId... | [
"0.7672089",
"0.7095717",
"0.69768775",
"0.67233837",
"0.65568775",
"0.6508077",
"0.6300794",
"0.62733924",
"0.6218579",
"0.61879885",
"0.60814923",
"0.591891",
"0.5907758",
"0.5855132",
"0.58442307",
"0.5833491",
"0.5806006",
"0.56718785",
"0.56357676",
"0.55347407",
"0.5531... | 0.80174404 | 0 |
Update supportPlan for the ManagedCluster object. | def update_k8s_support_plan(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
support_plan = self.context.get_k8s_support_plan()
if support_plan == KubernetesSupportPlan.AKS_LONG_TERM_SUPPORT:
if mc is None or mc.sku is None or mc.sku.tier.lower() != CONST_MANAGED_CLU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_k8s_support_plan(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n support_plan = self.context.get_k8s_support_plan()\n if support_plan == KubernetesSupportPlan.AKS_LONG_TERM_SUPPORT:\n if mc is None or mc.sku is None or mc.sku.tier.lower() != CONST_M... | [
"0.61214167",
"0.5992183",
"0.5901938",
"0.5507676",
"0.5250396",
"0.5219869",
"0.5205649",
"0.51211023",
"0.5120378",
"0.49291208",
"0.49023843",
"0.48664457",
"0.48022982",
"0.47577623",
"0.475658",
"0.47519207",
"0.47405082",
"0.46961132",
"0.4693477",
"0.46505013",
"0.465... | 0.7182371 | 0 |
Update security profile azureKeyvaultKms for the ManagedCluster object. | def update_azure_keyvault_kms(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if self.context.get_enable_azure_keyvault_kms():
# get kms profile
if mc.security_profile is None:
mc.security_profile = self.models.ManagedClusterSecurityProfile()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_azure_keyvault_kms(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n if self.context.get_enable_azure_keyvault_kms():\n key_id = self.context.get_azure_keyvault_kms_key_id()\n if key_id:\n if mc.security_profile is None:\n ... | [
"0.65597516",
"0.6115231",
"0.604408",
"0.60109097",
"0.59037745",
"0.5771745",
"0.5722448",
"0.5669089",
"0.56399703",
"0.5556204",
"0.54925394",
"0.54224646",
"0.538033",
"0.53518724",
"0.5334519",
"0.5256056",
"0.523743",
"0.5231732",
"0.5216337",
"0.5184685",
"0.5183231",... | 0.7189915 | 0 |
Update security profile imageCleaner for the ManagedCluster object. | def update_image_cleaner(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
enable_image_cleaner = self.context.get_enable_image_cleaner()
disable_image_cleaner = self.context.get_disable_image_cleaner()
interval_hours = self.context.get_image_cleaner_interval_hours()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_image_cleaner(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n interval_hours = self.context.get_image_cleaner_interval_hours()\n\n if self.context.get_enable_image_cleaner():\n\n if mc.security_profile is None:\n mc.security_profile =... | [
"0.6851309",
"0.67022616",
"0.5652698",
"0.555268",
"0.54567385",
"0.5302302",
"0.52607596",
"0.50487584",
"0.50180537",
"0.5011092",
"0.5008191",
"0.5006725",
"0.49423403",
"0.48312888",
"0.47744167",
"0.47587383",
"0.47480166",
"0.47262153",
"0.47243848",
"0.47189918",
"0.4... | 0.73032594 | 0 |
Update identity profile for the ManagedCluster object. | def update_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
assign_kubelet_identity = self.context.get_assign_kubelet_identity()
if assign_kubelet_identity:
identity_profile = {
'kubeletidentity': self.models.UserAssignedIdentity(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_workload_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n profile = self.context.get_workload_identity_profile()\n if profile:\n if mc.security_profile is None:\n mc.security_profile = self.models.ManagedClusterSecurit... | [
"0.7364104",
"0.7085298",
"0.66386825",
"0.6575664",
"0.6477139",
"0.6461136",
"0.6394247",
"0.63911194",
"0.63665646",
"0.63287127",
"0.6208386",
"0.59377927",
"0.5912477",
"0.58874655",
"0.58811486",
"0.5802723",
"0.57800543",
"0.5643181",
"0.5636011",
"0.55286914",
"0.5502... | 0.76883554 | 0 |
Update workload autoscaler profile for the ManagedCluster object. | def update_workload_auto_scaler_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
if self.context.get_enable_keda():
if mc.workload_auto_scaler_profile is None:
mc.workload_auto_scaler_profile = self.models.ManagedClusterWorkloadAutoScalerProfile()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_auto_scaler_profile(self, mc):\n self._ensure_mc(mc)\n\n cluster_autoscaler_profile = self.context.get_cluster_autoscaler_profile()\n if cluster_autoscaler_profile is not None:\n # update profile (may clear profile with empty dictionary)\n mc.auto_scaler_profil... | [
"0.82561743",
"0.75433207",
"0.7293663",
"0.6517002",
"0.6411876",
"0.6182385",
"0.61311543",
"0.59943694",
"0.5993539",
"0.59688723",
"0.59505665",
"0.59278333",
"0.5866863",
"0.5812482",
"0.56214845",
"0.5597126",
"0.5546318",
"0.5526554",
"0.5516587",
"0.550821",
"0.548046... | 0.7946528 | 1 |
Update azure monitor profile for the ManagedCluster object. | def update_azure_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:
self._ensure_mc(mc)
# read the original value passed by the command
ksm_metric_labels_allow_list = self.context.raw_param.get("ksm_metric_labels_allow_list")
ksm_metric_annotations_allow_list = self.context.ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_azure_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n # read the original value passed by the command\n ksm_metric_labels_allow_list = self.context.raw_param.get(\"ksm_metric_labels_allow_list\")\n ksm_metric_annotations_allow_list = self.... | [
"0.7277104",
"0.63934505",
"0.61648846",
"0.614551",
"0.61402935",
"0.6066223",
"0.5994208",
"0.5984191",
"0.5957272",
"0.5943673",
"0.5894648",
"0.5878133",
"0.5850033",
"0.57665926",
"0.57402784",
"0.5631679",
"0.5623526",
"0.5593438",
"0.55433184",
"0.54727024",
"0.5458814... | 0.7853511 | 0 |
The overall controller used to update the default ManagedCluster profile. The completely updated ManagedCluster object will later be passed as a parameter to the underlying SDK (mgmtcontainerservice) to send the actual request. | def update_mc_profile_default(self) -> ManagedCluster:
# check raw parameters
# promt y/n if no options are specified to ask user whether to perform a reconcile operation
self.check_raw_parameters()
# fetch the ManagedCluster object
mc = self.fetch_mc()
# update agentpool... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fusion_api_update_hypervisor_cluster_profile(self, uri=None, body=None, api=None, headers=None):\n return self.cluster_profile.update(body=body, uri=uri, api=api, headers=headers)",
"def update_agentpool_profile(self, mc: ManagedCluster) -> ManagedCluster:\n self._ensure_mc(mc)\n\n i... | [
"0.597643",
"0.58742917",
"0.5851303",
"0.5781573",
"0.5772862",
"0.576339",
"0.57513094",
"0.56952155",
"0.56308115",
"0.56079274",
"0.55892634",
"0.5554325",
"0.5532541",
"0.54891205",
"0.5482881",
"0.5433022",
"0.5402849",
"0.54027134",
"0.5315797",
"0.5315068",
"0.5307258... | 0.7316749 | 0 |
Helper function to check if postprocessing is required after sending a PUT request to create the cluster. | def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool:
# some addons require post cluster creation role assigment
monitoring_addon_enabled = self.context.get_intermediate("monitoring_addon_enabled", default_value=False)
ingress_appgw_addon_enabled = self.context.get_intermediate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_is_postprocessing_required(self, mc: ManagedCluster) -> bool:\n # some addons require post cluster creation role assigment\n monitoring_addon_enabled = self.context.get_intermediate(\"monitoring_addon_enabled\", default_value=False)\n ingress_appgw_addon_enabled = self.context.get_in... | [
"0.6787382",
"0.6160552",
"0.5965819",
"0.5765838",
"0.54389656",
"0.52548474",
"0.5172896",
"0.51714987",
"0.5161744",
"0.5144229",
"0.50794834",
"0.50763243",
"0.50758445",
"0.5068631",
"0.506405",
"0.50525963",
"0.5025663",
"0.50229084",
"0.50158024",
"0.49857804",
"0.4980... | 0.65956247 | 1 |
Generate metadata and store them in a YAML file with given arguments. | def gen_metadata(args):
with open(args.bibfile) as bibfile:
bib_db = BibTexParser(common_strings=True).parse_file(bibfile)
entries = sorted(list(bib_db.entries),
key=lambda x: x['year'], reverse=True)
list([update_file(entry) for entry in entries])
annotation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_create_yaml(self):\n pass",
"def main(args):\n metafiles = []\n verbose = args.verbose\n\n if (args.metalist is not None):\n for listfile in args.metalist:\n metafiles.extend(addmeta.list_from_file(listfile))\n\n if (args.metafiles is not None):\n metafiles.ex... | [
"0.6481894",
"0.6460003",
"0.63430345",
"0.6327105",
"0.61623716",
"0.6149009",
"0.61312765",
"0.612239",
"0.59599483",
"0.5936118",
"0.5773244",
"0.5772877",
"0.5702008",
"0.57003224",
"0.5686346",
"0.5672096",
"0.5651589",
"0.5533003",
"0.55324817",
"0.5531138",
"0.55146885... | 0.71669436 | 0 |
To parse command line and process the paper organization task. | def organize_bib():
parser = argparse.ArgumentParser(description='Organize papers')
parser.add_argument('bibfile', help='The bibtex file to be processed.')
subparsers = parser.add_subparsers(help='Available commands')
help_tmpl = 'Create a YAML file describing metadata for the organization tasks.'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_program_options():\n parser = argparse.ArgumentParser(description=\"Gather numeric information \\\n about the processed sequence data in an \\\n MG-RAST project.\")\n parser.add_argument('project_id',\n ... | [
"0.62851864",
"0.6227594",
"0.6205946",
"0.62008595",
"0.6168491",
"0.6139022",
"0.613443",
"0.61032486",
"0.6086535",
"0.6081039",
"0.6063985",
"0.60548097",
"0.6054122",
"0.6045408",
"0.6036239",
"0.6033285",
"0.6021215",
"0.6017663",
"0.601363",
"0.60068935",
"0.6006618",
... | 0.6481555 | 0 |
Checks the self._execute_frequency to figure out the oid to use for cpu_utilization | def _get_cpu_interval(self):
self._polling_execute_frequency = int(self._plugin_conf[u'main'][u'polling_frequency'])
if 5 <= self._polling_execute_frequency < 60:
return cpmCPUTotalMonIntervalValue # replaces cpmCPUTotal5SecRev
elif 60 <= self._polling_execute_frequency < 300:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_cpu(self, values):\n try:\n cpu_percent = psutil.cpu_percent()\n values[keys.KEY_CPU_PERCENT] = cpu_percent\n cpu_times = psutil.cpu_times()\n values[keys.KEY_CPU_USER_TIMES] = cpu_times.user\n except:\n logging.error(\"Error collecting... | [
"0.6275917",
"0.6085181",
"0.60578823",
"0.60562146",
"0.5991525",
"0.59678113",
"0.59386593",
"0.59386593",
"0.58819187",
"0.58737224",
"0.5819669",
"0.58091515",
"0.5777356",
"0.5775983",
"0.5764349",
"0.5755621",
"0.5755621",
"0.5755621",
"0.5755621",
"0.5755621",
"0.57556... | 0.6511984 | 0 |
Replaces u'celsius' with 'fahrenheit' in the provided string. | def replace_celcius(string):
return string.replace(u'celsius', u'fahrenheit') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_celsius_to_fahrenheit(celsius):\n return celsius * 9.0 / 5 + 32",
"def _celsius_to_fahrenheit(self) -> None:\n if self.units == \"celsius\":\n self.value = (((self.value / 5) * 9) + 32).__round__(2)\n self.units = \"fahrenheit\"\n else:\n msg = (\n ... | [
"0.66244715",
"0.6384214",
"0.6268346",
"0.6167058",
"0.61540127",
"0.61191595",
"0.6103219",
"0.60855544",
"0.6050967",
"0.60101855",
"0.5962116",
"0.59152514",
"0.5893281",
"0.58617944",
"0.5766658",
"0.5766658",
"0.5739406",
"0.5734028",
"0.57056034",
"0.5679949",
"0.56359... | 0.8532337 | 0 |
scale is an integer index that refers to an exponent applied to entSensorValue. The sensor_exponent comes from the cisco definitions, and I want to move those out of the plugin at some point. | def _entity_sensor_scale_to_exponent(sensor_scale):
sensor_exponent = [u'-24', u'-21', u'-18', u'-15', u'-12', u'-9', u'-6', u'-3', u'0', u'3',
u'6', u'9', u'12', u'15', u'18', u'21', u'24']
return int(sensor_exponent[sensor_scale - 1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scale():\r\n\r\n \r\n return 0.5",
"def scale(self):",
"def GetScale(self):\n ...",
"def xscale(value):\n impl.xscale(**locals())",
"def scale(self):\n return self._scale",
"def scale_to_factor(scale):\n return (B.pi / 2) / (2 * scale**2)",
"def with_scale_op(self, scale):... | [
"0.69460976",
"0.68487644",
"0.67950284",
"0.6772022",
"0.6668573",
"0.6627095",
"0.64557767",
"0.64412534",
"0.64349043",
"0.6386471",
"0.6369453",
"0.6347679",
"0.6347679",
"0.6338465",
"0.63258296",
"0.63189137",
"0.62955534",
"0.6264059",
"0.62518895",
"0.623797",
"0.6226... | 0.75308496 | 0 |
Pulls the entPhysicalClass items tree. We're interested in '6' (Power Supply Units). note that this could be expanded out if there's a need. | def _power_supplies(self):
power_supplies = {}
varbinds = self._snmp_connection.bulk_walk(entPhysicalClass)
for varbind in varbinds:
if varbind.value == u'6':
psu_id = int(varbind.index)
power_supplies[psu_id] = {u'psu_id': psu_id, u'psu_name': self._e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def units(self):\n return self.children()",
"def list_power_supply_units(self):\n\n doc = self.client.enumerate(uris.CIM_PowerSupply)\n\n psus = doc.find('.//s:Body/wsen:EnumerateResponse/wsman:Items',\n wsman.NS_MAP)\n\n return [self._parse_psus(psu) for psu in psus]",... | [
"0.4972727",
"0.49699154",
"0.48798373",
"0.4874304",
"0.47920606",
"0.4761043",
"0.475905",
"0.47154984",
"0.46501327",
"0.46423516",
"0.46099088",
"0.46000573",
"0.45994005",
"0.4547769",
"0.45468974",
"0.45461828",
"0.45072427",
"0.44990483",
"0.44976267",
"0.44847265",
"0... | 0.49780378 | 0 |
Maps indices used in the Cisco Entity Mib to the module number | def _module_numbers(self):
module_numbers = {}
varbinds = self._snmp_connection.bulk_walk(entPhysicalParentRelPos)
for varbind in varbinds:
module_numbers[int(varbind.index)] = varbind.value
return module_numbers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_module_indexes(self, generation):\n self.species_module_index_map = {}\n\n if Config.blueprint_nodes_use_representatives:\n # For representatives species_module_index_map becomes: representative -> (species index, member index)\n for rep, module in self.species_module... | [
"0.6726213",
"0.63144815",
"0.62095433",
"0.6148621",
"0.60828507",
"0.5993135",
"0.5982882",
"0.59800065",
"0.58837277",
"0.5866135",
"0.5795918",
"0.57755977",
"0.57060426",
"0.57042277",
"0.56990916",
"0.5678817",
"0.56643337",
"0.56333447",
"0.56311905",
"0.5612962",
"0.5... | 0.6614143 | 1 |
Find all the profiles available in the carbonblack.credentials files. | def _find_cb_profiles():
dir_locations = [".carbonblack", os.path.join(os.path.expanduser("~"), ".carbonblack")]
cred_file = "credentials.response"
profiles = []
for dir in dir_locations:
cred_file_path = os.path.join(dir, cred_file)
_MOD_LOGGER.debug("Searching CB profiles on '%s'", cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_profiles(cls) -> List[str]:\n return list(cfg.get(\"profiles\"))",
"def list(self):\n # List is to be extended (directories should not have a trailing slash)\n paths_to_ignore = ['.DS_Store']\n\n profiles = []\n cache = ClientCache(self._conan_api.cache_folder)\n ... | [
"0.70810413",
"0.66425323",
"0.6593193",
"0.6515927",
"0.6484026",
"0.6467895",
"0.6452797",
"0.6367274",
"0.6340477",
"0.63084596",
"0.6248525",
"0.6154834",
"0.6113096",
"0.6113096",
"0.60523206",
"0.6013961",
"0.59873754",
"0.5964247",
"0.59622484",
"0.5932647",
"0.5903166... | 0.8225347 | 0 |
machines host1,host2,host3... Set the machines where the job will be executed. A list of machines where the job will run, separated by commas or space. | def do_machines(self, args):
lex_parser = shlex.shlex(args)
lex_parser.whitespace += ","
lex_parser.wordchars += "-"
machine_list = [m for m in lex_parser]
#TODO check if the hostname has space in it, if yes, invalid.
if not machine_list:
print("Invalid. See ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def octopus_machines(self, msg, args):\r\n self.machines.send_machines(msg, args)",
"def _GetMachineList(self):\n machines = self._experiment.remote\n # All Label.remote is a sublist of experiment.remote.\n for l in self._experiment.labels:\n for r in l.remote:\n assert r in machines\... | [
"0.6619454",
"0.6044773",
"0.6034794",
"0.58789426",
"0.5867438",
"0.584151",
"0.5819749",
"0.5793482",
"0.5762725",
"0.57339203",
"0.5671499",
"0.5636976",
"0.5603591",
"0.5599037",
"0.5590458",
"0.55259943",
"0.55078816",
"0.5486513",
"0.5482602",
"0.54447526",
"0.5425394",... | 0.7748249 | 0 |
Shows a summary of the status of the jobs. | def do_status(self, args):
status = self._leet.job_status
for job in self.finished_jobs:
status.append({"id" : job.id,
"hostname" : job.machine.hostname,
"plugin": job.plugin_instance.LEET_PG_NAME,
"status" : j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_jobs_status(jobs):\n print(tabulate.tabulate(jobs, headers=\"keys\"))",
"def _status_summary(jobs):\n assert type(jobs) == list\n successful = 0\n pending = 0\n running = 0\n coalesced = 0\n\n for job in jobs:\n status = buildapi.query_job_status(job)\n if status == ... | [
"0.7700928",
"0.7499587",
"0.74649817",
"0.7133787",
"0.71303564",
"0.70185477",
"0.6993843",
"0.69682664",
"0.6882302",
"0.6827677",
"0.67964417",
"0.6733884",
"0.6703268",
"0.6693207",
"0.6646178",
"0.65613914",
"0.6535507",
"0.65271467",
"0.65130925",
"0.64981896",
"0.6481... | 0.7609351 | 1 |
Cancel all pending jobs | def do_cancel_all_jobs(self, args):
self._leet.cancel_all_jobs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cancel_all_jobs(self):\n status = self._get_status_obj()\n s = SLURM()\n for job_id in status.job_ids:\n s.scancel(job_id)\n logger.info('Pipeline job \"{}\" cancelled.'.format(self._config.name))",
"def cancel_all_instances(self):\n if not self.is_job:\n ... | [
"0.81436586",
"0.79760283",
"0.793128",
"0.7752383",
"0.7634517",
"0.7336057",
"0.7278366",
"0.7217065",
"0.71379155",
"0.7020462",
"0.6918962",
"0.6903983",
"0.68986064",
"0.6874834",
"0.6870926",
"0.68692666",
"0.6866242",
"0.6815571",
"0.68097174",
"0.6798725",
"0.6777318"... | 0.83705556 | 0 |
Using Mapzen Search API to attempt to geocode a location string | def geocode(location):
GeoDict = parse_mapzen_response(fetch_mapzen_response(location))
GeoDict['query_text'] = location
return GeoDict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geocode(location):\n\n\ttxt = fetch_mapzen_response(location)\n\tmydict = parse_mapzen_response(txt)\n\tmydict['query_text'] = location\n\treturn mydict",
"def geocode(addr_str):\n\n\tbase_url = 'http://gis.oregonmetro.gov/rlisapi2/locate/'\n\turl_template = '{0}?token={1}&input={2}&form=json'\n\turl = url_t... | [
"0.77716124",
"0.7181079",
"0.71422786",
"0.7139193",
"0.71137244",
"0.7111963",
"0.7066725",
"0.69260824",
"0.6847181",
"0.68150973",
"0.67805934",
"0.673379",
"0.6728002",
"0.67107326",
"0.66972625",
"0.6691047",
"0.66596097",
"0.6584444",
"0.6549973",
"0.65382755",
"0.6485... | 0.7777906 | 0 |
Tests predictable success & failure of different values for a specified parameter when passed to a specified function | def test_parameter_values(func,
var_name=None,
fail_list=[],
success_list=[],
**kwargs):
# If variable name is specified, test each value in fail_list
# and success_list
if var_name is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_value(self):\n self.assertTrue(py_function(6) == 36)\n self.assertFalse(py_function(5) == 9)\n for i in range(0, 10):\n self.assertTrue(py_function(i) == i**2 if i != 0 else 100)",
"def _check_value(self, value, name, check_function):\n if check_function is... | [
"0.6997643",
"0.67936534",
"0.6765097",
"0.67322314",
"0.66246575",
"0.65953",
"0.6588077",
"0.65858746",
"0.65613014",
"0.6553458",
"0.6549264",
"0.65439284",
"0.652965",
"0.646326",
"0.6396299",
"0.6396299",
"0.6396299",
"0.6383678",
"0.6357292",
"0.63565874",
"0.63524413",... | 0.7383306 | 0 |
Delete the NSR from openbaton based on user_info and the nsr | def release_resources(self, user_info, payload=None):
ob_client = OBClient(user_info.name)
logger.info('Deleting resources for user: {}'.format(user_info.name))
logger.debug('Received this payload: {}'.format(payload))
nsr = None
try:
nsr = json.loads(payload)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user():",
"def run(self):\n tenant_id = self.context[\"tenant\"][\"id\"]\n users = self.context[\"tenants\"][tenant_id][\"users\"]\n number = users.index(self.context[\"user\"])\n for network in self.context[\"tenants\"][tenant_id][\"networks\"]:\n # delete one o... | [
"0.60865736",
"0.60510623",
"0.5833243",
"0.57836574",
"0.5740733",
"0.5665142",
"0.56516165",
"0.5639647",
"0.5607864",
"0.55743295",
"0.55386347",
"0.553106",
"0.55285126",
"0.5520713",
"0.55151373",
"0.5484675",
"0.5473775",
"0.5471058",
"0.54653317",
"0.5457935",
"0.54265... | 0.60889333 | 0 |
Clears the fingerprint, making the object reusable | def clear(self):
self._fingerprint = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self) :\n self.__dict__ = {}",
"def clear(self) -> None:\n # Delete these so the .by_class/name values are cleared.\n self['classname'] = 'info_null'\n del self['targetname']\n self._keys.clear()\n # Clear $fixup as well.\n self._fixup = None",
"def clear(... | [
"0.7221925",
"0.70681465",
"0.70423144",
"0.7020949",
"0.6962887",
"0.6962776",
"0.6916138",
"0.6908658",
"0.6898825",
"0.6898378",
"0.689274",
"0.68828136",
"0.6880186",
"0.68772185",
"0.68727833",
"0.68727833",
"0.68727833",
"0.68727833",
"0.68727833",
"0.68727833",
"0.6872... | 0.8715687 | 0 |
Creates one task for each ingest chunk present in the build folder. It is required that the info file is already placed in order for this task to run succesfully. | def create_ingest_task(storage, task_queue):
for filename in storage.list_files(prefix='build/'):
t = IngestTask(
chunk_path=storage.get_path_to_file('build/'+filename),
chunk_encoding='npz',
layer_path=storage.layer_path,
)
task_queue.insert(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tasks(self, task):",
"def gen_tasks(self):\n self.kw = {\n 'image_srcset_sizes': self.site.config['IMAGE_SRCSET_SIZES'],\n 'image_srcset_format': self.site.config['IMAGE_SRCSET_FORMAT'],\n 'extra_image_extensions': self.site.config['EXTRA_IMAGE_EXTENSIONS'],\n... | [
"0.63344",
"0.62111056",
"0.61512274",
"0.6071256",
"0.59026337",
"0.58242923",
"0.58159286",
"0.5714517",
"0.55866283",
"0.558229",
"0.5534695",
"0.55086124",
"0.55020404",
"0.5470382",
"0.53798485",
"0.53627956",
"0.534799",
"0.53423345",
"0.53301287",
"0.5326683",
"0.53100... | 0.7282232 | 0 |
you can use this to fix black spots from when downsample tasks fail by specifying a point inside each black spot. | def create_fixup_downsample_tasks(task_queue, layer_path, points, shape=Vec(2048, 2048, 64), mip=0, axis='z'):
vol = CloudVolume(layer_path, mip)
offsets = compute_fixup_offsets(vol, points, shape)
for offset in tqdm(offsets, desc="Inserting Corrective Downsample Tasks"):
task = DownsampleTask(
layer_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CleanBadPixels(spectraUp,spectraDown):\n \n Clean_Up= []\n Clean_Do = []\n Clean_Av = []\n eps=25. # this is the minumum background Please check\n NBSPEC=len(spectraUp)\n for index in np.arange(0,NBSPEC):\n s_up=spectraUp[index]\n s_do=spectraDown[index]\n \n inde... | [
"0.5587213",
"0.5520415",
"0.54539263",
"0.52487373",
"0.51884097",
"0.51857966",
"0.5172123",
"0.5144501",
"0.51434153",
"0.51297325",
"0.50784206",
"0.5076486",
"0.5027425",
"0.50130695",
"0.5011849",
"0.4993209",
"0.4949142",
"0.4925785",
"0.49238706",
"0.49124724",
"0.490... | 0.61001945 | 0 |
Transfer an Eyewire consensus into neuroglancer. This first requires importing the raw segmentation via a hypersquare ingest task. However, this can probably be streamlined at some point. The volume map file should be JSON encoded and | def create_hypersquare_consensus_tasks(task_queue, src_path, dest_path, volume_map_file, consensus_map_path):
with open(volume_map_file, 'r') as f:
volume_map = json.loads(f.read())
vol = CloudVolume(dest_path)
for boundstr, volume_id in tqdm(volume_map.items(), desc="Inserting HyperSquare Consensus Remap ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n coastfile = \"coast.wkb\"\n\n # Choose between c, l, i, h, f resolutions\n GSHHSres = 'i'\n\n # Define regional domain\n lonmin, lonmax, latmin, latmax = -21, 18, 47, 67\n\n coast2wkb(**locals())",
"def preprocess(self,\n HUC8, \n state, \n ... | [
"0.5408492",
"0.53339535",
"0.509573",
"0.5013642",
"0.49098614",
"0.490937",
"0.4868743",
"0.48444477",
"0.4825182",
"0.48239592",
"0.48233828",
"0.48192972",
"0.4798874",
"0.4790374",
"0.47887483",
"0.47765023",
"0.47627252",
"0.4761838",
"0.4724164",
"0.4715205",
"0.471451... | 0.5364614 | 1 |
affinity map masking block by block. The block coordinates should be aligned with cloud storage. | def create_mask_affinity_map_tasks(task_queue, aff_input_layer_path, aff_output_layer_path,
aff_mip, mask_layer_path, mask_mip, output_block_start, output_block_size, grid_size ):
for z in tqdm(range(grid_size[0]), desc='z loop'):
for y in range(grid_size[1]):
for x in range(grid_size[2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_mapping(self, mask):\n K, F, _ = mask.shape\n\n # (K, F, T)\n features = mask / np.linalg.norm(mask, axis=-1, keepdims=True)\n\n mapping = np.repeat(np.arange(K)[:, None], F, axis=1)\n\n for iterations, start, end in self.alignment_plan:\n for _ in range(... | [
"0.62302107",
"0.5893791",
"0.5769649",
"0.57137156",
"0.56408554",
"0.5601151",
"0.55934393",
"0.55531865",
"0.54844314",
"0.5449009",
"0.5445731",
"0.5406244",
"0.53493595",
"0.53390515",
"0.533312",
"0.5310451",
"0.52919894",
"0.524323",
"0.51834995",
"0.5173451",
"0.51632... | 0.6456307 | 0 |
Test case for card_info_lookup | def test_card_info_lookup(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cards_get(self):\n pass",
"def _get_card(self, name: str) -> Dict:",
"def test_get_info(self):\n pass",
"def test_lookup_account(self):\n pass",
"def test_cards_get_list(self):\n pass",
"def get_card_info(card_number: Union[int, str]) -> dict:\n card_nums = [int(x)... | [
"0.6776132",
"0.64844984",
"0.63596356",
"0.61986995",
"0.6173423",
"0.6162049",
"0.6052326",
"0.60388124",
"0.59450364",
"0.59148693",
"0.59128034",
"0.59102505",
"0.5837992",
"0.5827626",
"0.5804711",
"0.57768077",
"0.57597846",
"0.5734827",
"0.57277155",
"0.5709747",
"0.57... | 0.93080074 | 0 |
Test case for lookup_account | def test_lookup_account(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duo_account_get(self):\n pass",
"def bank_lookup_account(stub, request):\n # print(\"In method bank_lookup_account:\")\n result = stub.LookUpAccount(request) # <-- remember to check whether port is occupied!\n # from line 26 to 28 seem never gonna be reached!\n if result is None:\n ... | [
"0.75243884",
"0.7460177",
"0.70570356",
"0.68598056",
"0.68192416",
"0.6809717",
"0.6791296",
"0.6757188",
"0.66275024",
"0.6598423",
"0.65628946",
"0.642495",
"0.6418375",
"0.63521814",
"0.63058287",
"0.6194276",
"0.61765236",
"0.6165734",
"0.6163305",
"0.6126774",
"0.60569... | 0.92692095 | 0 |
Update the Brownian motion process | def bm_update(self,dt,delta):
curr_coord = self.Coord
self.History.append(curr_coord)
change = self.bm_change(dt,delta)
self.Coord = curr_coord + change | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.bpos_x += 3",
"def update_bias(self):\n self._bias = self._bias + self.update_bias_value",
"def update_bias(self):\n self._bias = self._bias + self.update_bias_value\n self.bias_clipping()",
"def update_b(self, theta, force=False):\n self.b = self.e... | [
"0.60446244",
"0.60419303",
"0.6027442",
"0.5988064",
"0.5986942",
"0.59794277",
"0.59581554",
"0.59413654",
"0.5925549",
"0.591917",
"0.5880924",
"0.58793706",
"0.5871149",
"0.5859573",
"0.5823392",
"0.5822276",
"0.5814989",
"0.580665",
"0.5782914",
"0.57619745",
"0.57534593... | 0.62997043 | 0 |
Setup the events defined in the settings. | def _setup_events(conf):
events = {}
for name in conf.keys():
events[name] = Event(name=name)
for listener in conf[name]:
action = 'run'
if ':' in listener:
listener, action = listener.rsplit(':')
events[name].add_listener(listener, action)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InitOtherEvents(self):\n\n pass",
"def setUp(self):\n event_bus._event_bus = event_bus._EventBus()",
"def init_events():\n db = get_db()\n\n from emapp.db import init_db\n init_db()\n for event in current_app.config['PREDEFINED_EVENTS']:\n db.execute(('INSERT INTO event '\n... | [
"0.7145879",
"0.6874534",
"0.6732326",
"0.6664637",
"0.6661688",
"0.66563714",
"0.6647324",
"0.65423274",
"0.6504739",
"0.6321489",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6295267",
"0.6269704",
"0.6258585",
... | 0.71199274 | 1 |
Download a remote dataset into path Fetch a dataset pointed by remote's url, save into path using remote's filename and ensure its integrity based on the MD5 Checksum of the downloaded file. Adapted from scikitlearn's sklearn.datasets.base._fetch_remote. | def download_from_remote(remote, save_dir, force_overwrite=False):
if remote.destination_dir is None:
download_dir = save_dir
else:
download_dir = os.path.join(save_dir, remote.destination_dir)
if not os.path.exists(download_dir):
os.makedirs(download_dir)
download_path = os.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_dataset_from_url(dataset_url_md5, name, to_path):\n # Prevent concurrent FileExistsError\n try:\n if not os.path.exists(to_path):\n os.mkdir(to_path)\n except Exception:\n pass\n\n dataset_url = dataset_url_md5[\"url\"]\n dataset_md5 = dataset_url_md5[\"md5\"]\n... | [
"0.7259059",
"0.68588865",
"0.6651223",
"0.66476214",
"0.652797",
"0.65078294",
"0.64733714",
"0.6462734",
"0.6437489",
"0.6434678",
"0.64107436",
"0.63951904",
"0.6351276",
"0.63472974",
"0.6347012",
"0.63452065",
"0.62995946",
"0.6272911",
"0.62319505",
"0.61726815",
"0.615... | 0.7242501 | 1 |
Unzip a zip file inside it's current directory. | def unzip(zip_path, cleanup=False):
zfile = zipfile.ZipFile(zip_path, 'r')
zfile.extractall(os.path.dirname(zip_path))
zfile.close()
if cleanup:
os.remove(zip_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unzip_file(zip_file: str) -> None:\n destination = tempfile.mkdtemp(prefix='gaelo_pross_unzip_')\n with ZipFile(zip_file) as my_zip:\n for member in my_zip.namelist():\n filename = os.path.basename(member)\n # skip directories\n if not filen... | [
"0.7677119",
"0.74962723",
"0.7415738",
"0.7398855",
"0.73234475",
"0.7294942",
"0.72689474",
"0.7235865",
"0.7220886",
"0.7124803",
"0.7121888",
"0.70193404",
"0.69754934",
"0.6958987",
"0.68196464",
"0.68058217",
"0.6780341",
"0.6754517",
"0.67413557",
"0.6729355",
"0.67256... | 0.7698946 | 0 |
Download and untar a tar file. | def download_tar_file(tar_remote, save_dir, force_overwrite, cleanup=False):
tar_download_path = download_from_remote(tar_remote, save_dir, force_overwrite)
untar(tar_download_path, cleanup=cleanup) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _download(self):\n self._system.download_file(\"http://curl.haxx.se/download/\" + self._tar_name)",
"def untar(conn, tarball, path):\n conn.run(f\"tar xf {tarball} -C {path}\")",
"def download_untar(url, download_path, extract_path=None):\n file_name = url.split('/')[-1]\n if extract_path is ... | [
"0.7930564",
"0.76136655",
"0.76053816",
"0.73980355",
"0.710569",
"0.70067215",
"0.695739",
"0.68496716",
"0.67946625",
"0.6776796",
"0.6614692",
"0.6568361",
"0.65660137",
"0.65625364",
"0.6544811",
"0.6538459",
"0.65218437",
"0.6500966",
"0.6488277",
"0.6408326",
"0.640485... | 0.77506953 | 1 |
Untar a tar file inside it's current directory. | def untar(tar_path, cleanup=False):
tfile = tarfile.open(tar_path, 'r')
tfile.extractall(os.path.dirname(tar_path))
tfile.close()
if cleanup:
os.remove(tar_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def untar(file_path, target_dir=None, gzipped=True, verbose=False):\n return posix.untar(file_path, target_dir, gzipped, verbose)",
"def untar(conn, tarball, path):\n conn.run(f\"tar xf {tarball} -C {path}\")",
"def untar(tarfile, outdir):\n tmpdir = tempfile.mkdtemp()\n try:\n untared = _open_archive... | [
"0.8113908",
"0.75153756",
"0.73078",
"0.6981398",
"0.69512826",
"0.6876098",
"0.68632334",
"0.6681066",
"0.6653954",
"0.66418374",
"0.6571097",
"0.6553955",
"0.6527455",
"0.65201277",
"0.6481412",
"0.64048636",
"0.63865715",
"0.6363689",
"0.6341883",
"0.6340731",
"0.6338941"... | 0.7840172 | 1 |
Are a[0] and a[1] the same length? | def same_len(count, a:tuple):
if len(a[0]) == len(a[1]):
return count + 1
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_same_length(self, a, b):\n found = False\n for i, j in zip(a, b):\n if i == j:\n continue\n elif found:\n return False # this case is the second found edit, thus return false\n else:\n found = True\n return True",
"def __len__(self):\n return len(sel... | [
"0.65674996",
"0.6370597",
"0.63529515",
"0.62148297",
"0.610623",
"0.59933484",
"0.5922136",
"0.58705866",
"0.58634",
"0.58187836",
"0.5810064",
"0.57752323",
"0.5743565",
"0.5728272",
"0.56998324",
"0.5662846",
"0.5635293",
"0.56337184",
"0.56009173",
"0.55818456",
"0.55664... | 0.6591336 | 0 |
Return list of tuples (spacy tokens, bpe_tokens) to compare tokens | def compare_joined_tokens(sp_tokens, bpe_tokens):
out = []
for s, b in zip(sp_tokens, bpe_tokens):
joined_bpe = functools.reduce(join_bpe, b, [])
if s != joined_bpe:
out.append((s, joined_bpe))
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_tokens(options, db):\n t1, t2 = options.cmp\n d1 = db.GetNet(t1)\n d2 = db.GetNet(t2)\n union = list(set(d1 + d2))\n meta = (t1, t2, union)\n results = []\n for el in set(d1 + d2):\n el = nacaddr.IP(el)\n if el in d1 and el in d2:\n results.append(str(el))\n elif el in d1:\n r... | [
"0.6344726",
"0.61597407",
"0.60535365",
"0.60231274",
"0.5980359",
"0.5960785",
"0.5946002",
"0.5909258",
"0.58390117",
"0.5822121",
"0.5768986",
"0.57118964",
"0.57054347",
"0.56814677",
"0.56762326",
"0.5667053",
"0.5663035",
"0.56146777",
"0.56124616",
"0.55879784",
"0.55... | 0.764389 | 0 |
is a[0] shorter than a[1]? | def count_less(count, a):
if len(a[0]) < len(a[1]):
return count + 1
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, seq):\n if any(self._arr[i] < seq[i] for i in range(min(self._length, len(seq)))):\n return True\n return self._length < len(seq)",
"def minimum_inplace(a, b):",
"def lowest(t1,t2):\n compare_len = min(len(t1), len(t2))\n for i in range(0,compare_len):\n i... | [
"0.5934056",
"0.58563995",
"0.5855364",
"0.5842192",
"0.5823215",
"0.58195823",
"0.5754728",
"0.5728443",
"0.5691534",
"0.56854546",
"0.5677097",
"0.5663166",
"0.5659071",
"0.56569976",
"0.55985916",
"0.5598521",
"0.5582329",
"0.5577947",
"0.55678904",
"0.55565935",
"0.555032... | 0.63655823 | 0 |
Take obj_a and obj_b and combines them under a boolean union object. returns the boolean object. Make sure that these objects aren't attached to a scene as this function does not clone them | def make_boole_union(obj_a, obj_b):
# If we're missing any objects, return
if obj_a is None or obj_b is None:
return
# Create a union type boolean object
boole = c4d.BaseObject(c4d.Oboole)
boole[c4d.BOOLEOBJECT_TYPE] = 0 # A Union B
# Put them inside the boole
obj_a.InsertUnder(b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __and__(self, obj):\n return self._boolean_operation(obj, operator.__and__)",
"def __or__(self, obj):\n return self._boolean_operation(obj, operator.__or__)",
"def and_(a, b):",
"def __and__(self, other):\n return intersect(self, other)",
"def _boolean_region(all_polygons_A, all_po... | [
"0.6346084",
"0.6032152",
"0.57977915",
"0.5719726",
"0.5705259",
"0.5703416",
"0.5640378",
"0.5629587",
"0.5629587",
"0.5621318",
"0.5610552",
"0.5575097",
"0.5558348",
"0.5542803",
"0.55349076",
"0.552503",
"0.5497892",
"0.5482005",
"0.54481745",
"0.5441582",
"0.54183906",
... | 0.7978053 | 0 |
Returns the coordinates of the origin bounding box that are intersected by the intersect bounding box. >>> bounding_box = 10, 100, 30, 110 >>> other_bbox = 20, 100, 40, 105 >>> bounding_box_intersection(bounding_box, other_bbox) (10, 0, 20, 5) >>> bounding_box_intersection(other_bbox, bounding_box) (0, 0, 10, 5) >>> co... | def bounding_box_intersection(origin: Tuple[int, int, int, int], intersect: Tuple[int, int, int, int]) \
-> Optional[Tuple[int, int, int, int]]:
o_t, o_l, o_b, o_r = origin
t, l, b, r = intersect
out_top = max(t, o_t)
out_left = max(l, o_l)
out_bottom = min(b, o_b)
out_right = min(r, o_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection(box0, box1):\n if isinstance(box0, bounding_box_pb2.BoundingBox):\n box0 = BoundingBox(box0.start, box0.size)\n if isinstance(box1, bounding_box_pb2.BoundingBox):\n box1 = BoundingBox(box1.start, box1.size)\n if not isinstance(box0, BoundingBox):\n raise ValueError('box0 must be a Boun... | [
"0.73368526",
"0.68448746",
"0.6794572",
"0.6752013",
"0.6524481",
"0.6365032",
"0.6349253",
"0.6339419",
"0.63276106",
"0.6230844",
"0.6219065",
"0.6181393",
"0.6178924",
"0.6171056",
"0.6161214",
"0.615606",
"0.61267775",
"0.61151683",
"0.60859907",
"0.607529",
"0.60643137"... | 0.7157741 | 1 |
Aligns prediction Nodes to truth. | def align_nodes(truth: List[Node], prediction: List[Node], fscore=None) -> List[Tuple[int, int]]:
if fscore is None:
_, _, fscore = compute_recall_precision_fscore(truth, prediction)
# For each prediction (column), pick the highest-scoring
# True symbol.
closest_truths = list(fscore.argmax(axis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_prediction(self):\n with self.graph.as_default():\n self.predict_label = tf.argmax(self.l7, 1)\n self.predict_prob = tf.nn.softmax(self.l7)\n self.correct_label = tf.argmax(self.label, 1)\n self.accuracy = tf.reduce_mean(\n tf.cast(\n ... | [
"0.602781",
"0.5878617",
"0.576729",
"0.576729",
"0.56675243",
"0.55929726",
"0.5590841",
"0.5583576",
"0.5567605",
"0.55633736",
"0.5551773",
"0.5531288",
"0.5500199",
"0.5471059",
"0.5425876",
"0.54105395",
"0.53748655",
"0.53647625",
"0.5345529",
"0.534533",
"0.5344353",
... | 0.61948144 | 0 |
writes a pixel of varying size depending on the size of the overall image | def write_pixel(color, img_size, location, image, scale_factor):
x_location = scale(location.item(0), scale_factor)
y_location = scale(location.item(1), scale_factor)
img_cont = int(img_size/100)
if img_cont == 0:
image.putpixel((x_location, y_location), color)
else:
write_to_range(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putPixel(new_image, message_to_encode):\n w = new_image.size[0]\n (x, y) = (0, 0)\n for pix in modifyPixel(new_image.getdata(), message_to_encode):\n new_image.putpixel((x, y), pix)\n if (x == w - 1):\n x = 0\n y += 1\n else:\n x += 1",
"def expo... | [
"0.6373138",
"0.6343465",
"0.6338091",
"0.616885",
"0.61488277",
"0.6131269",
"0.6082062",
"0.60536015",
"0.6052037",
"0.60322607",
"0.6015646",
"0.6009837",
"0.60093296",
"0.6004077",
"0.59644717",
"0.5935781",
"0.5928668",
"0.58588254",
"0.58426064",
"0.58031386",
"0.577759... | 0.7475846 | 0 |
loops through the given range coloring the pixels | def write_to_range(start_x, end_x, start_y, end_y, color, image, img_size):
for curr_x in range(start_x, end_x, 1):
for curr_y in range(start_y, end_y, 1):
if curr_x > 0 and curr_y > 0:
if curr_x < img_size and curr_y < img_size:
image.putpixel((curr_x, curr_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setColorBarRange(start=1,end=254):\n dislin.colran(start,end)",
"def color(self, data):\n\n red = np.interp(data, self.range, self.r)\n blue = np.interp(data, self.range, self.b)\n green = np.interp(data, self.range, self.g)\n # Style plot to return a grey color when value is '... | [
"0.6508234",
"0.64523953",
"0.640964",
"0.63950825",
"0.63663226",
"0.62469196",
"0.6158317",
"0.6139538",
"0.6075288",
"0.6061774",
"0.60614336",
"0.6053607",
"0.60478157",
"0.60340863",
"0.59674525",
"0.5940123",
"0.5936041",
"0.5923042",
"0.591694",
"0.5907577",
"0.5906161... | 0.724895 | 0 |
Merge two sorted iterators, return a list | def merge_two_iterators(itr1: Iterator, itr2: Iterator) -> List:
result = []
elem1, elem2 = next(itr1), next(itr2)
def rest_elems(itr):
for _, el in enumerate(itr):
result.append(el)
while True:
if elem1 < elem2:
result.append(elem1)
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(a, b):\n result = []\n\n # Append smallest values to result until either list is exhausted\n i = j = 0\n while i < len(a) and j < len(b):\n if compare(a[i], b[j]) < 0:\n result.append(a[i])\n i += 1\n else:\n result.append(b[j])\n j +=... | [
"0.71105134",
"0.7017018",
"0.6994239",
"0.69318044",
"0.692406",
"0.69093746",
"0.68480617",
"0.6843464",
"0.6825293",
"0.6777762",
"0.6776245",
"0.67496943",
"0.67142767",
"0.6700895",
"0.669669",
"0.6681653",
"0.6602123",
"0.6597254",
"0.6567569",
"0.6565212",
"0.6551639",... | 0.8080191 | 0 |
Load a legacy XML project and raise a UserException if there was an error. | def load_xml(project, file_path):
tree = ElementTree()
try:
root = tree.parse(file_path)
except Exception as e:
raise UserException(
"there was an error reading the project file", str(e))
_assert(root.tag == 'Project',
"Unexpected root tag '{0}', 'Project' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_recover_from_bad_xml(self):\n with warnings.catch_warnings():\n warnings.simplefilter('ignore')\n jp2 = Jp2k(self._bad_xml_file)\n\n self.assertEqual(jp2.box[3].box_id, 'xml ')\n self.assertEqual(jp2.box[3].offset, 77)\n self.assertEqual(jp2.box[3].length,... | [
"0.5530275",
"0.5451773",
"0.54403687",
"0.52372694",
"0.5144637",
"0.5054844",
"0.5004451",
"0.49637967",
"0.4963071",
"0.4958828",
"0.49542674",
"0.4944267",
"0.49304378",
"0.49113086",
"0.48677188",
"0.48588017",
"0.4855717",
"0.4820855",
"0.4813323",
"0.47716698",
"0.4762... | 0.59002835 | 0 |
Validate an assertion and raise a UserException if it failed. | def _assert(ok, detail):
if not ok:
raise UserException("the project file is invalid", detail) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _Assert(self, t):\n self.RaiseError(t, \"Assert not supported\")",
"def assertion_failed(self, func, exception):",
"def test_validate_user(self):\n with self.assertRaises(ValidationError):\n self.make_assignment(\n self.category, self.user_alice, self.role_contributo... | [
"0.638513",
"0.6113857",
"0.60952735",
"0.60506934",
"0.59488094",
"0.5854287",
"0.5829402",
"0.5820156",
"0.57493156",
"0.57345164",
"0.57106066",
"0.5699617",
"0.56764406",
"0.5654198",
"0.56525695",
"0.5652089",
"0.5625533",
"0.55753726",
"0.55424374",
"0.5541871",
"0.5524... | 0.66372156 | 0 |
Return a populated QrcPackage instance. | def _load_package(package_element):
package = QrcPackage()
package.name = package_element.get('name')
_assert(package.name is not None, "Missing 'Package.name' attribute.")
package.contents = _load_mfs_contents(package_element)
package.exclusions = []
for exclude_element in package_element.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _package(self):\n if self._package_obj is None:\n self._package_obj = self._import_package()\n\n return self._package_obj",
"def get_package(cls, name: str):\n pkg = Package(name=name)\n return pkg",
"def real_obj(self):\n return RemotePackage(xml_data=etree.to... | [
"0.61555564",
"0.6028244",
"0.57431936",
"0.57262385",
"0.5538875",
"0.55191153",
"0.5511188",
"0.54345876",
"0.5383191",
"0.52641064",
"0.5221279",
"0.5204265",
"0.5195892",
"0.51358944",
"0.5101493",
"0.5052417",
"0.4975617",
"0.4965095",
"0.49423385",
"0.49272996",
"0.4920... | 0.64988154 | 0 |
Replace any qmake scopes in a value. | def _replace_scopes(value):
value = value.replace('linux-*', 'linux')
value = value.replace('macx', 'macos')
value = value.replace('win32', 'win')
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scope(self, value):\n self._set_one_attribute(self.AttributeNames.SCOPE, value)\n return self",
"def ReplaceDepsVar(deps_file, variable_name, value):\n with open(deps_file, 'r') as file_handle:\n contents_old = file_handle.read()\n contents_new = re.sub(\n '\"%s\":.*,' % variable_... | [
"0.560765",
"0.55158067",
"0.53255934",
"0.526088",
"0.5163381",
"0.5125354",
"0.51055837",
"0.5105084",
"0.5008712",
"0.500784",
"0.4998744",
"0.49631014",
"0.49616838",
"0.49495396",
"0.49195024",
"0.49156302",
"0.4911678",
"0.4909545",
"0.49070176",
"0.48991",
"0.4882357",... | 0.72859895 | 0 |
Shift the mean value of `x_mod` such that it equals the mean of `x_org`. | def shift_mean(x_mod, x_org):
@_decorate_validation
def validate_input():
_numeric('x_mod', ('integer', 'floating', 'complex'), shape=(-1, -1))
_numeric('x_org', ('integer', 'floating', 'complex'),
shape=x_mod.shape)
validate_input()
return x_mod + (x_org.mean() - x_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(x):\n MEAN_VALUES = np.array([104, 117, 123])\n means = theano.shared(MEAN_VALUES.astype(\"float32\"))\n return x[:, ::-1, :, :] - means[np.newaxis, :, np.newaxis, np.newaxis]",
"def normalize_scl(self,x):\n max_val = np.max(x['data'][0])\n last_val = x['data'][0][-1]\n ... | [
"0.5332351",
"0.5176737",
"0.51122636",
"0.5105994",
"0.51024467",
"0.50528365",
"0.5001982",
"0.49988565",
"0.496684",
"0.49610654",
"0.49609196",
"0.4941782",
"0.4941782",
"0.4908955",
"0.49046615",
"0.48930743",
"0.48907068",
"0.48776814",
"0.48756415",
"0.48735654",
"0.48... | 0.8315604 | 0 |
Stretch image such that pixels values are in the range [0, `max_val`]. | def stretch_image(img, max_val):
@_decorate_validation
def validate_input():
_numeric('img', 'floating', shape=(-1, -1))
_numeric('max_val', ('integer', 'floating'), range_='(0;inf)')
validate_input()
min_ = img.min()
max_ = img.max()
if max_ > min_:
val = max_val / (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(image, maxval=1024):\n image += maxval # minimum value is now 0\n image /= maxval*2\n\n return(image)",
"def scale_floor(value, old_max, new_max):\n\tassert value >= 0\n\tassert value <= old_max\n\treturn new_max * value / old_max",
"def stretch(imgLayer, numStdDev, minVal, maxVal, ignoreVal... | [
"0.7628654",
"0.64297724",
"0.6390369",
"0.63346624",
"0.6329962",
"0.62751615",
"0.6227718",
"0.61965084",
"0.61759627",
"0.61569077",
"0.6136462",
"0.6117476",
"0.6113362",
"0.6112044",
"0.6108288",
"0.6075168",
"0.6021573",
"0.6020029",
"0.6000976",
"0.59824467",
"0.596423... | 0.8371912 | 0 |
Set the user and term in the form. | def get_form_kwargs(self, **kwargs):
kwargs = super(ChallengeVerifyView, self).get_form_kwargs(**kwargs)
kwargs['display_term'] = self.display_term
kwargs['user'] = self.request.user
return kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form(self, request, *args, **kwargs):\n form = super().get_form(request, *args, **kwargs)\n form.base_fields['author'].initial = request.user\n return form",
"def form_valid(self, form):\n form.instance.author = self.request.user\n return super(TaxonomyCreateView, self)... | [
"0.5942573",
"0.59352493",
"0.58183414",
"0.5817644",
"0.5779533",
"0.5779533",
"0.5769205",
"0.5769205",
"0.5769205",
"0.5612393",
"0.55744946",
"0.55603635",
"0.554265",
"0.5522575",
"0.55176884",
"0.55171174",
"0.5514617",
"0.55015975",
"0.5490745",
"0.54737824",
"0.547378... | 0.60840124 | 0 |
Initialize each form in the formset with a challenge. | def get_form(self, form_class):
formset = super(ChallengeVerifyView, self).get_form(form_class)
challenges = Challenge.objects.select_related(
'candidate__user__userprofile', 'challenge_type').filter(
verifying_user=self.request.user, candidate__term=self.display_term)
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_formset_data(self, request, step, formset):\n return None",
"def initial_form_data(self, request, step, form):\n return None",
"def setUpFormData(self):\n self.formData = {'labGroup': '5', 'abbrev': 'etoh', 'name': 'ethanol', 'CAS_ID': '64-17-5', 'CSID': '682',\n ... | [
"0.6577104",
"0.6018372",
"0.59315926",
"0.5917518",
"0.5716115",
"0.56829953",
"0.56514114",
"0.5570535",
"0.5529638",
"0.5509667",
"0.54883474",
"0.5474722",
"0.5455359",
"0.5445691",
"0.54168105",
"0.5375306",
"0.5359101",
"0.530911",
"0.5278513",
"0.5270086",
"0.5230901",... | 0.6970292 | 0 |
Helper method that returns a dictionary containing a requirement name and a form, to be used for each requirement in the template. | def get_entry(name, req, form):
entry = {'requirement': name, 'form': form}
form.initial['credits_needed'] = 0
if req:
form.instance = req
form.initial['credits_needed'] = req.credits_needed
return entry | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_form(form):\n return {\n 'form': form,\n }",
"def _template_data(self):\n return {\"form\": self.form.render()}",
"def show_fieldsetform(form):\n return {'form': form, 'required_fields': True}",
"def forms(self):\n filter = self.filter_form\n search = self.sear... | [
"0.630402",
"0.61594725",
"0.6050221",
"0.5984636",
"0.57623315",
"0.5739988",
"0.5738215",
"0.56827587",
"0.56365216",
"0.5631884",
"0.55824167",
"0.5575974",
"0.5572623",
"0.5571467",
"0.5521887",
"0.5512704",
"0.5506832",
"0.5498103",
"0.5493591",
"0.5474122",
"0.5456768",... | 0.67510563 | 0 |
Set the candidate of the challenge to the requester. | def form_valid(self, form):
form.instance.candidate = self.candidate
messages.success(self.request, 'Challenge requested!')
return super(CandidatePortalView, self).form_valid(form) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenge(self, challenge):\n\n self._challenge = challenge",
"def candidate_id(self, candidate_id):\n\n self._candidate_id = candidate_id",
"def candidate_id(self, candidate_id):\n\n self._candidate_id = candidate_id",
"def challenge_response(self, challenge_response):\n\n se... | [
"0.6499316",
"0.60932803",
"0.60932803",
"0.5781735",
"0.57699656",
"0.57699656",
"0.5516179",
"0.54925066",
"0.545744",
"0.54380524",
"0.5412529",
"0.5412529",
"0.5386207",
"0.52246284",
"0.5224182",
"0.5198079",
"0.5193528",
"0.51481795",
"0.5087636",
"0.50844556",
"0.50355... | 0.61780286 | 1 |
Endpoint for updating a candidate's initiation status. The post parameters "candidate" and "initiated" specify the candidate (by Candidate pk) and their new initiation status, respectively. | def update_candidate_initiation_status(request):
candidate_pk = request.POST.get('candidate')
if not candidate_pk:
return json_response(status=404)
candidate = get_object_or_none(Candidate, pk=candidate_pk)
initiated = json.loads(request.POST.get('initiated'))
if not candidate or initiated i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_candidate_update(self):\r\n self.register_user()\r\n result = self.login_user()\r\n access_token = json.loads(result.data.decode())['access_token']\r\n\r\n # first, we create a candidate by making a POST request\r\n rv = self.client().post('/candidate',headers=dict(Autho... | [
"0.58220094",
"0.5303385",
"0.5094234",
"0.5007821",
"0.4941206",
"0.49129364",
"0.48752788",
"0.48752788",
"0.48721525",
"0.48375428",
"0.47506183",
"0.46613085",
"0.46536946",
"0.46478763",
"0.46375787",
"0.45163202",
"0.4498283",
"0.44909114",
"0.44743252",
"0.44633308",
"... | 0.87281287 | 0 |
Sets the division of this Game. | def division(self, division):
self._division = division | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def division(self, division):\n \n self._division = division",
"def set_divide(self, a_divide):\n self.set_parameter('divide', a_divide)\n return self",
"def division(self):\n return self._division",
"def set_divisions(self, nx=1, ny=1):\n\n self.nx = nx\n sel... | [
"0.79271126",
"0.6628609",
"0.6287356",
"0.62198645",
"0.56096643",
"0.55676526",
"0.5439452",
"0.53641415",
"0.531078",
"0.531078",
"0.5296111",
"0.52825195",
"0.52011275",
"0.519674",
"0.5180101",
"0.51800334",
"0.5175467",
"0.5129107",
"0.5086838",
"0.5081677",
"0.50641596... | 0.7836024 | 1 |
Sets the round of this Game. | def round(self, round):
self._round = round | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_round(self, round_number: int):\n self.turn = 0\n self.round = round_number",
"def set_round_game(self, round_game):\r\n if not round_game:\r\n return self.default_round_game\r\n return round_game",
"def update_visual_round(self, round):\n self.text_round.c... | [
"0.75033015",
"0.7253406",
"0.66619974",
"0.65597403",
"0.6454907",
"0.62289166",
"0.61594796",
"0.60673624",
"0.60668546",
"0.596048",
"0.59210134",
"0.59192115",
"0.5855568",
"0.5756124",
"0.57440203",
"0.5726209",
"0.56967396",
"0.5692984",
"0.5583253",
"0.55227274",
"0.55... | 0.78125286 | 0 |
Sets the player_a_name of this Game. | def player_a_name(self, player_a_name):
self._player_a_name = player_a_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_b_name(self, player_b_name):\n\n self._player_b_name = player_b_name",
"def player_a_id(self, player_a_id):\n\n self._player_a_id = player_a_id",
"def player_a_games(self, player_a_games):\n\n self._player_a_games = player_a_games",
"def set_name(self, a_name):\n self.s... | [
"0.7192527",
"0.70124376",
"0.67124784",
"0.6590799",
"0.6398148",
"0.6380828",
"0.63518584",
"0.63177353",
"0.6313776",
"0.62537956",
"0.6250535",
"0.6231284",
"0.6177",
"0.61729723",
"0.6132019",
"0.6120752",
"0.6120752",
"0.6052022",
"0.60450685",
"0.6041063",
"0.59877247"... | 0.9132155 | 0 |
Sets the player_b_name of this Game. | def player_b_name(self, player_b_name):
self._player_b_name = player_b_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_a_name(self, player_a_name):\n\n self._player_a_name = player_a_name",
"def player_b_games(self, player_b_games):\n\n self._player_b_games = player_b_games",
"def player_b_id(self, player_b_id):\n\n self._player_b_id = player_b_id",
"def bcp_player_variable(self, name, value, ... | [
"0.7046953",
"0.68283844",
"0.6823286",
"0.60431397",
"0.602946",
"0.5915856",
"0.5797274",
"0.57551175",
"0.564356",
"0.5617421",
"0.5611178",
"0.5594154",
"0.5562194",
"0.55580914",
"0.55133885",
"0.54521626",
"0.543514",
"0.5420806",
"0.5417903",
"0.5417903",
"0.5415289",
... | 0.9181073 | 0 |
Sets the player_a_id of this Game. | def player_a_id(self, player_a_id):
self._player_a_id = player_a_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_player_id(self, player_id):\n self.player_id = player_id",
"def player_a_games(self, player_a_games):\n\n self._player_a_games = player_a_games",
"def set_id(self, player_id):\n pass",
"def player_id(self, player_id):\n\n self._player_id = player_id",
"def player_id(self... | [
"0.69736564",
"0.69562083",
"0.6944866",
"0.685115",
"0.685115",
"0.67752093",
"0.6499893",
"0.6387207",
"0.61095905",
"0.5931413",
"0.5756862",
"0.5719053",
"0.5642285",
"0.5627128",
"0.5627128",
"0.5627128",
"0.55055493",
"0.5500313",
"0.5443958",
"0.544141",
"0.5326835",
... | 0.8947233 | 0 |
Sets the player_b_id of this Game. | def player_b_id(self, player_b_id):
self._player_b_id = player_b_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_b_games(self, player_b_games):\n\n self._player_b_games = player_b_games",
"def player_b_name(self, player_b_name):\n\n self._player_b_name = player_b_name",
"def player_a_id(self, player_a_id):\n\n self._player_a_id = player_a_id",
"def set_player_id(self, player_id):\n ... | [
"0.701637",
"0.68415976",
"0.6529189",
"0.6521133",
"0.6509748",
"0.63791966",
"0.63791966",
"0.63403463",
"0.61362946",
"0.609142",
"0.57009405",
"0.56523895",
"0.5555329",
"0.55444074",
"0.54241943",
"0.54158646",
"0.54158646",
"0.54158646",
"0.5270569",
"0.5130478",
"0.512... | 0.8964314 | 0 |
Sets the player_a_points of this Game. | def player_a_points(self, player_a_points):
self._player_a_points = player_a_points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_points(id_player: str, id_tournament: str, points: float):\n player = Player.get(id_player)\n if player:\n player.set_points(id_tournament, points)",
"def player_a_games(self, player_a_games):\n\n self._player_a_games = player_a_games",
"def assign_points(players):\n ... | [
"0.70405376",
"0.6953009",
"0.69266933",
"0.6847564",
"0.6813382",
"0.63882875",
"0.60412383",
"0.59575623",
"0.5922945",
"0.59009165",
"0.58660984",
"0.5815809",
"0.5809744",
"0.57961416",
"0.5774984",
"0.57434326",
"0.5727533",
"0.559885",
"0.55913925",
"0.55802286",
"0.553... | 0.90386194 | 0 |
Sets the player_b_points of this Game. | def player_b_points(self, player_b_points):
self._player_b_points = player_b_points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_b_games(self, player_b_games):\n\n self._player_b_games = player_b_games",
"def player_a_points(self, player_a_points):\n\n self._player_a_points = player_a_points",
"def player_b_id(self, player_b_id):\n\n self._player_b_id = player_b_id",
"def set_points(self):\n self... | [
"0.7156698",
"0.66683024",
"0.6464138",
"0.634216",
"0.62249166",
"0.59966195",
"0.593351",
"0.58669984",
"0.562444",
"0.5574016",
"0.54878134",
"0.54007715",
"0.53405094",
"0.5217778",
"0.51687044",
"0.51381606",
"0.51173633",
"0.5097935",
"0.5085429",
"0.5070251",
"0.503814... | 0.911463 | 0 |
Sets the player_a_games of this Game. | def player_a_games(self, player_a_games):
self._player_a_games = player_a_games | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_b_games(self, player_b_games):\n\n self._player_b_games = player_b_games",
"def games(self, games):\n\n self._games = games",
"def games_played(self, games_played):\n\n self._games_played = games_played",
"def games_played(self, games_played):\n\n self._games_played = g... | [
"0.70214266",
"0.6884233",
"0.62673855",
"0.62673855",
"0.6084447",
"0.6069749",
"0.5723313",
"0.5631387",
"0.52389956",
"0.5235685",
"0.5232058",
"0.5165864",
"0.50988805",
"0.5088275",
"0.5049184",
"0.504764",
"0.5032063",
"0.5024373",
"0.50055563",
"0.50052094",
"0.4998376... | 0.8954244 | 0 |
Sets the player_b_games of this Game. | def player_b_games(self, player_b_games):
self._player_b_games = player_b_games | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_a_games(self, player_a_games):\n\n self._player_a_games = player_a_games",
"def games(self, games):\n\n self._games = games",
"def player_b_points(self, player_b_points):\n\n self._player_b_points = player_b_points",
"def player_b_id(self, player_b_id):\n\n self._player... | [
"0.6660215",
"0.61440706",
"0.61138666",
"0.5897767",
"0.5834286",
"0.55333114",
"0.55333114",
"0.53141403",
"0.51146567",
"0.5081129",
"0.5071948",
"0.5016322",
"0.4920143",
"0.49178362",
"0.48985335",
"0.48405293",
"0.48397624",
"0.47612613",
"0.4701193",
"0.468332",
"0.467... | 0.9111923 | 0 |
Sets the player_a_rating of this Game. | def player_a_rating(self, player_a_rating):
self._player_a_rating = player_a_rating | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_a_rating_adjustment(self, player_a_rating_adjustment):\n\n self._player_a_rating_adjustment = player_a_rating_adjustment",
"def player_b_rating(self, player_b_rating):\n\n self._player_b_rating = player_b_rating",
"def set_rating(self, value):\n try:\n self._rating = ... | [
"0.7204794",
"0.700881",
"0.66364235",
"0.64302677",
"0.61229753",
"0.60579",
"0.58704174",
"0.5863217",
"0.58583367",
"0.58583367",
"0.56981266",
"0.5688521",
"0.5648215",
"0.5619677",
"0.55893576",
"0.55828285",
"0.55657667",
"0.5524322",
"0.55239767",
"0.54368836",
"0.5390... | 0.904459 | 0 |
Sets the player_b_rating of this Game. | def player_b_rating(self, player_b_rating):
self._player_b_rating = player_b_rating | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_b_rating_adjustment(self, player_b_rating_adjustment):\n\n self._player_b_rating_adjustment = player_b_rating_adjustment",
"def player_a_rating(self, player_a_rating):\n\n self._player_a_rating = player_a_rating",
"def setB(self, b):\n\t\tself.b = int(b)",
"def player_b_id(self, play... | [
"0.7433762",
"0.6573614",
"0.63315046",
"0.60228175",
"0.5984338",
"0.59810424",
"0.5883635",
"0.58609754",
"0.5827438",
"0.5546673",
"0.5501033",
"0.53830224",
"0.530768",
"0.52600473",
"0.5225375",
"0.51287466",
"0.5124128",
"0.5068001",
"0.5044063",
"0.50251865",
"0.501857... | 0.91605 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.