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 |
|---|---|---|---|---|---|---|
Sets the total_damage_taken of this LolStatsTeamGame. | def total_damage_taken(self, total_damage_taken):
self._total_damage_taken = total_damage_taken | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magic_damage_taken(self, magic_damage_taken):\n\n self._magic_damage_taken = magic_damage_taken",
"def total_damage_dealt(self, total_damage_dealt):\n\n self._total_damage_dealt = total_damage_dealt",
"def physical_damage_taken(self, physical_damage_taken):\n\n self._physical_damage_ta... | [
"0.62446934",
"0.6203283",
"0.61898994",
"0.5937868",
"0.5892759",
"0.5673338",
"0.56026864",
"0.559628",
"0.55156296",
"0.5492688",
"0.5474528",
"0.5439922",
"0.5419961",
"0.54167867",
"0.54162794",
"0.5409217",
"0.5390327",
"0.53783405",
"0.530492",
"0.5302419",
"0.5236356"... | 0.82404226 | 0 |
Sets the magic_damage_taken of this LolStatsTeamGame. | def magic_damage_taken(self, magic_damage_taken):
self._magic_damage_taken = magic_damage_taken | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def physical_damage_taken(self, physical_damage_taken):\n\n self._physical_damage_taken = physical_damage_taken",
"def tower_damage(self, tower_damage):\n\n self._tower_damage = tower_damage",
"def total_damage_taken(self, total_damage_taken):\n\n self._total_damage_taken = total_damage_ta... | [
"0.6174807",
"0.60939455",
"0.59983486",
"0.59941757",
"0.5745691",
"0.5504919",
"0.5385688",
"0.5276123",
"0.511665",
"0.5091942",
"0.5036372",
"0.49585813",
"0.49102408",
"0.4897023",
"0.4846867",
"0.48235705",
"0.48113322",
"0.48077172",
"0.48073667",
"0.47667962",
"0.4734... | 0.7991215 | 0 |
Sets the physical_damage_taken of this LolStatsTeamGame. | def physical_damage_taken(self, physical_damage_taken):
self._physical_damage_taken = physical_damage_taken | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magic_damage_taken(self, magic_damage_taken):\n\n self._magic_damage_taken = magic_damage_taken",
"def total_damage_taken(self, total_damage_taken):\n\n self._total_damage_taken = total_damage_taken",
"def true_damage_taken(self, true_damage_taken):\n\n self._true_damage_taken = true_d... | [
"0.6574391",
"0.65474355",
"0.61154944",
"0.59185237",
"0.5788378",
"0.5305879",
"0.5178843",
"0.49910167",
"0.49444208",
"0.49372658",
"0.4935728",
"0.49147326",
"0.49014795",
"0.4697341",
"0.4690042",
"0.4688112",
"0.4652797",
"0.46511847",
"0.46285853",
"0.46170166",
"0.45... | 0.79949605 | 0 |
Sets the true_damage_taken of this LolStatsTeamGame. | def true_damage_taken(self, true_damage_taken):
self._true_damage_taken = true_damage_taken | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magic_damage_taken(self, magic_damage_taken):\n\n self._magic_damage_taken = magic_damage_taken",
"def physical_damage_taken(self, physical_damage_taken):\n\n self._physical_damage_taken = physical_damage_taken",
"def total_damage_taken(self, total_damage_taken):\n\n self._total_damage... | [
"0.65282154",
"0.6153268",
"0.6125436",
"0.56721234",
"0.5500364",
"0.53191286",
"0.5243601",
"0.5230803",
"0.51747876",
"0.5144253",
"0.5113401",
"0.5034283",
"0.50069904",
"0.49398163",
"0.49328092",
"0.49173892",
"0.49171838",
"0.48811084",
"0.48163986",
"0.48125765",
"0.4... | 0.7987169 | 0 |
Sets the gold_earned of this LolStatsTeamGame. | def gold_earned(self, gold_earned):
self._gold_earned = gold_earned | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gold_per_min(self, gold_per_min):\n\n self._gold_per_min = gold_per_min",
"def gold_spent(self, gold_spent):\n\n self._gold_spent = gold_spent",
"def get_gold(self, gold):\n self.gold += gold",
"def away_team_score(self, away_team_score):\n\n self._away_team_score = away_team_... | [
"0.5876666",
"0.5759119",
"0.5597268",
"0.53021246",
"0.5249182",
"0.5228388",
"0.5150372",
"0.49752992",
"0.49687976",
"0.48658228",
"0.48658228",
"0.480704",
"0.4781503",
"0.47633094",
"0.47567323",
"0.47361478",
"0.46834096",
"0.4667335",
"0.4636213",
"0.46275184",
"0.4620... | 0.8619108 | 0 |
Sets the gold_spent of this LolStatsTeamGame. | def gold_spent(self, gold_spent):
self._gold_spent = gold_spent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gold_earned(self, gold_earned):\n\n self._gold_earned = gold_earned",
"def gold_per_min(self, gold_per_min):\n\n self._gold_per_min = gold_per_min",
"def get_gold(self, gold):\n self.gold += gold",
"def set_steals_percentage(self):\n bx = self.get_standard_stats()\n tea... | [
"0.6016059",
"0.5768287",
"0.56278276",
"0.5453209",
"0.50542057",
"0.4923472",
"0.49074647",
"0.49031663",
"0.48927873",
"0.48701409",
"0.48511133",
"0.48511133",
"0.48511133",
"0.48511133",
"0.47921133",
"0.47768274",
"0.4773867",
"0.4742378",
"0.47230792",
"0.47146136",
"0... | 0.80748326 | 0 |
Sets the turret_kills of this LolStatsTeamGame. | def turret_kills(self, turret_kills):
self._turret_kills = turret_kills | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quadra_kills(self, quadra_kills):\n\n self._quadra_kills = quadra_kills",
"def unreal_kills(self, unreal_kills):\n\n self._unreal_kills = unreal_kills",
"def kills(self, kills):\n\n self._kills = kills",
"def inhibitor_kills(self, inhibitor_kills):\n\n self._inhibitor_kills = ... | [
"0.6554002",
"0.63849956",
"0.55172366",
"0.5450051",
"0.5423511",
"0.5047195",
"0.50391227",
"0.49844283",
"0.49508548",
"0.4916193",
"0.48139754",
"0.47899985",
"0.47398",
"0.472283",
"0.4717475",
"0.4634509",
"0.46114302",
"0.45926508",
"0.45626646",
"0.45531082",
"0.45345... | 0.8305758 | 0 |
Sets the inhibitor_kills of this LolStatsTeamGame. | def inhibitor_kills(self, inhibitor_kills):
self._inhibitor_kills = inhibitor_kills | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unreal_kills(self, unreal_kills):\n\n self._unreal_kills = unreal_kills",
"def turret_kills(self, turret_kills):\n\n self._turret_kills = turret_kills",
"def penta_kills(self, penta_kills):\n\n self._penta_kills = penta_kills",
"def quadra_kills(self, quadra_kills):\n\n self._... | [
"0.6598382",
"0.64188766",
"0.6278841",
"0.6172767",
"0.57832634",
"0.5244995",
"0.5068077",
"0.5009555",
"0.49861854",
"0.4959267",
"0.47756684",
"0.45926905",
"0.45671922",
"0.4521272",
"0.44746247",
"0.44668365",
"0.44478652",
"0.4440934",
"0.44378912",
"0.43930247",
"0.43... | 0.8256592 | 0 |
Sets the total_minions_killed of this LolStatsTeamGame. | def total_minions_killed(self, total_minions_killed):
self._total_minions_killed = total_minions_killed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutral_minions_killed_enemy_jungle(self, neutral_minions_killed_enemy_jungle):\n\n self._neutral_minions_killed_enemy_jungle = neutral_minions_killed_enemy_jungle",
"def wards_killed(self, wards_killed):\n\n self._wards_killed = wards_killed",
"def kills_per_min(self, kills_per_min):\n\n ... | [
"0.6252548",
"0.61334276",
"0.57652724",
"0.56612444",
"0.5656844",
"0.56510013",
"0.5365555",
"0.5333152",
"0.5236679",
"0.5193026",
"0.51788884",
"0.5160646",
"0.5113072",
"0.50877637",
"0.5077333",
"0.50323457",
"0.5027894",
"0.5023537",
"0.49927062",
"0.49905348",
"0.4989... | 0.81860554 | 0 |
Sets the neutral_minions_k_illed of this LolStatsTeamGame. | def neutral_minions_k_illed(self, neutral_minions_k_illed):
self._neutral_minions_k_illed = neutral_minions_k_illed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutral_minions_k_illed_team_jungle(self, neutral_minions_k_illed_team_jungle):\n\n self._neutral_minions_k_illed_team_jungle = neutral_minions_k_illed_team_jungle",
"def neutral_minions_killed_enemy_jungle(self, neutral_minions_killed_enemy_jungle):\n\n self._neutral_minions_killed_enemy_jungl... | [
"0.7553893",
"0.6149367",
"0.57203025",
"0.5538771",
"0.5398704",
"0.51978314",
"0.5167784",
"0.51533484",
"0.50103396",
"0.5001333",
"0.49726048",
"0.4972335",
"0.4954755",
"0.49495584",
"0.4938061",
"0.4896305",
"0.4835171",
"0.48207647",
"0.4799806",
"0.4767198",
"0.474412... | 0.87231857 | 0 |
Sets the neutral_minions_k_illed_team_jungle of this LolStatsTeamGame. | def neutral_minions_k_illed_team_jungle(self, neutral_minions_k_illed_team_jungle):
self._neutral_minions_k_illed_team_jungle = neutral_minions_k_illed_team_jungle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutral_minions_killed_enemy_jungle(self, neutral_minions_killed_enemy_jungle):\n\n self._neutral_minions_killed_enemy_jungle = neutral_minions_killed_enemy_jungle",
"def neutral_minions_k_illed(self, neutral_minions_k_illed):\n\n self._neutral_minions_k_illed = neutral_minions_k_illed",
"def... | [
"0.78530765",
"0.7616803",
"0.5121107",
"0.50791156",
"0.5006911",
"0.48731706",
"0.47604173",
"0.47053406",
"0.46559265",
"0.46348467",
"0.46238747",
"0.46189982",
"0.45589668",
"0.45482293",
"0.454791",
"0.4502856",
"0.45028365",
"0.4459257",
"0.44372258",
"0.44035003",
"0.... | 0.9075307 | 0 |
Sets the neutral_minions_killed_enemy_jungle of this LolStatsTeamGame. | def neutral_minions_killed_enemy_jungle(self, neutral_minions_killed_enemy_jungle):
self._neutral_minions_killed_enemy_jungle = neutral_minions_killed_enemy_jungle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neutral_minions_k_illed_team_jungle(self, neutral_minions_k_illed_team_jungle):\n\n self._neutral_minions_k_illed_team_jungle = neutral_minions_k_illed_team_jungle",
"def neutral_minions_k_illed(self, neutral_minions_k_illed):\n\n self._neutral_minions_k_illed = neutral_minions_k_illed",
"def... | [
"0.82698786",
"0.6090619",
"0.56122357",
"0.53282285",
"0.5228444",
"0.50916374",
"0.5017952",
"0.49607337",
"0.49146882",
"0.487679",
"0.4850569",
"0.4792809",
"0.4780385",
"0.47314894",
"0.46849006",
"0.4650421",
"0.4601728",
"0.45711783",
"0.45442528",
"0.4495741",
"0.4495... | 0.9129462 | 0 |
Sets the total_time_crowd_control_dealt of this LolStatsTeamGame. | def total_time_crowd_control_dealt(self, total_time_crowd_control_dealt):
self._total_time_crowd_control_dealt = total_time_crowd_control_dealt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_damage_dealt(self, total_damage_dealt):\n\n self._total_damage_dealt = total_damage_dealt",
"def set_dre(self):\n bx = self.get_standard_stats()\n ptos = float(bx[\"t2p_conv\"]*2 + bx[\"t3p_conv\"]*3 + bx[\"tl_conv\"])\n fga = float(bx[\"t2p_int\"] + bx[\"t3p_int\"])\n ... | [
"0.5732984",
"0.5501948",
"0.52671856",
"0.52347183",
"0.520869",
"0.5195985",
"0.508494",
"0.4909377",
"0.4896496",
"0.4854171",
"0.48403242",
"0.48286802",
"0.47444087",
"0.4731775",
"0.47082382",
"0.4693109",
"0.46832463",
"0.4680852",
"0.46676987",
"0.46385226",
"0.462591... | 0.8468756 | 0 |
Sets the vision_wards_bought_in_game of this LolStatsTeamGame. | def vision_wards_bought_in_game(self, vision_wards_bought_in_game):
self._vision_wards_bought_in_game = vision_wards_bought_in_game | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sight_wards_bought_in_game(self, sight_wards_bought_in_game):\n\n self._sight_wards_bought_in_game = sight_wards_bought_in_game",
"def face_offs_won(self, face_offs_won):\n\n self._face_offs_won = face_offs_won",
"def wards_killed(self, wards_killed):\n\n self._wards_killed = wards_kil... | [
"0.81113505",
"0.5307163",
"0.5200903",
"0.51131237",
"0.5112352",
"0.50623137",
"0.5056586",
"0.5056586",
"0.5018464",
"0.48356545",
"0.47582802",
"0.4750072",
"0.47407368",
"0.471592",
"0.471592",
"0.46656686",
"0.4663999",
"0.4583661",
"0.4579174",
"0.45683786",
"0.4559659... | 0.8872322 | 0 |
Sets the sight_wards_bought_in_game of this LolStatsTeamGame. | def sight_wards_bought_in_game(self, sight_wards_bought_in_game):
self._sight_wards_bought_in_game = sight_wards_bought_in_game | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vision_wards_bought_in_game(self, vision_wards_bought_in_game):\n\n self._vision_wards_bought_in_game = vision_wards_bought_in_game",
"def wins(self, wins):\n\n self._wins = wins",
"def wins(self, wins):\n\n self._wins = wins",
"def fight_ways(self, fight_ways):\n\n self._figh... | [
"0.7847113",
"0.5754788",
"0.5754788",
"0.5599564",
"0.5286631",
"0.52246296",
"0.52019125",
"0.5166253",
"0.5055105",
"0.50225985",
"0.5020182",
"0.48502916",
"0.484483",
"0.4827444",
"0.47781414",
"0.47719163",
"0.47255012",
"0.4715685",
"0.47138226",
"0.46857712",
"0.46857... | 0.8859858 | 0 |
Sets the wards_placed of this LolStatsTeamGame. | def wards_placed(self, wards_placed):
self._wards_placed = wards_placed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wards_killed(self, wards_killed):\n\n self._wards_killed = wards_killed",
"def wins(self, wins):\n\n self._wins = wins",
"def wins(self, wins):\n\n self._wins = wins",
"def is_placed(self, is_placed):\n if self.local_vars_configuration.client_side_validation and is_placed is N... | [
"0.56223494",
"0.53732926",
"0.53732926",
"0.5316087",
"0.520256",
"0.5176071",
"0.5078657",
"0.5078657",
"0.5072473",
"0.4953528",
"0.49534574",
"0.48931223",
"0.4891578",
"0.48896557",
"0.4852035",
"0.4823639",
"0.48176676",
"0.48176676",
"0.47683766",
"0.4745224",
"0.47393... | 0.8088942 | 0 |
Sets the wards_killed of this LolStatsTeamGame. | def wards_killed(self, wards_killed):
self._wards_killed = wards_killed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_minions_killed(self, total_minions_killed):\n\n self._total_minions_killed = total_minions_killed",
"def player_was_killed(self,\n player: ba.Player,\n killed: bool = False,\n killer: ba.Player = None) -> None:\n f... | [
"0.5994736",
"0.5768082",
"0.5756263",
"0.5652685",
"0.5540978",
"0.54908156",
"0.542415",
"0.542415",
"0.52726936",
"0.523073",
"0.5192097",
"0.50918895",
"0.50918895",
"0.50754565",
"0.5064393",
"0.5031689",
"0.501213",
"0.49859872",
"0.49797612",
"0.49696347",
"0.49659956"... | 0.8304518 | 0 |
Sets the combat_player_score of this LolStatsTeamGame. | def combat_player_score(self, combat_player_score):
self._combat_player_score = combat_player_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective_player_score(self, objective_player_score):\n\n self._objective_player_score = objective_player_score",
"def set_game_auth_score(self, _score: Address) -> None:\n if self.msg.sender == self.owner:\n self._game_auth_score.set(_score)",
"def total_player_score(self, total_p... | [
"0.69760364",
"0.63264745",
"0.62736285",
"0.624605",
"0.61814755",
"0.6097394",
"0.60704863",
"0.60691285",
"0.6064483",
"0.60179394",
"0.59705323",
"0.59581363",
"0.58582056",
"0.5840851",
"0.578538",
"0.57512504",
"0.575103",
"0.5745927",
"0.5745927",
"0.5745927",
"0.56348... | 0.8451902 | 0 |
Sets the objective_player_score of this LolStatsTeamGame. | def objective_player_score(self, objective_player_score):
self._objective_player_score = objective_player_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combat_player_score(self, combat_player_score):\n\n self._combat_player_score = combat_player_score",
"def set_score(self, score):\n self._score = score",
"def set_score(self,score):\n self._score = score",
"def updateScore(self, player: int) -> None:\n\n if player == 1:\n ... | [
"0.69122535",
"0.6302199",
"0.62297726",
"0.6160583",
"0.6134571",
"0.60319656",
"0.60304433",
"0.5946198",
"0.59096676",
"0.59096676",
"0.59096676",
"0.5905022",
"0.58464545",
"0.5826298",
"0.5816844",
"0.5805889",
"0.5706894",
"0.56956255",
"0.56021494",
"0.5601552",
"0.559... | 0.8506674 | 0 |
Sets the total_player_score of this LolStatsTeamGame. | def total_player_score(self, total_player_score):
self._total_player_score = total_player_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_score(self):\n\n # Return the player's total score\n return self._total_score",
"def objective_player_score(self, objective_player_score):\n\n self._objective_player_score = objective_player_score",
"def combat_player_score(self, combat_player_score):\n\n self._combat_... | [
"0.6654109",
"0.66074353",
"0.6574749",
"0.642244",
"0.6316347",
"0.62661374",
"0.61752707",
"0.6159437",
"0.61369145",
"0.61052215",
"0.60529304",
"0.6015424",
"0.601314",
"0.60000944",
"0.5949628",
"0.58401334",
"0.58263683",
"0.58263683",
"0.58263683",
"0.5747627",
"0.5715... | 0.84819025 | 0 |
Sets the fantasy_points of this LolStatsTeamGame. | def fantasy_points(self, fantasy_points):
self._fantasy_points = fantasy_points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPointsFP(self, new):\n assert new is None or type(new) in [int, float]\n self._points_FP = new",
"def _ComputeFantasyPoints(self, stats):\n point_mapping = {\n 'kills': 2,\n 'deaths': -0.5,\n 'assists': 1.5,\n 'triple_kills': 2,\n 'quadra_kills': 5,\n ... | [
"0.5724298",
"0.53359383",
"0.5227831",
"0.5105792",
"0.50168717",
"0.501371",
"0.4962836",
"0.49597785",
"0.49584952",
"0.49265593",
"0.49237156",
"0.49208194",
"0.48915398",
"0.4870729",
"0.48346663",
"0.48116478",
"0.4788988",
"0.47503108",
"0.47104475",
"0.46882612",
"0.4... | 0.813446 | 0 |
Sets the ten_kills_or_assists of this LolStatsTeamGame. | def ten_kills_or_assists(self, ten_kills_or_assists):
self._ten_kills_or_assists = ten_kills_or_assists | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turret_kills(self, turret_kills):\n\n self._turret_kills = turret_kills",
"def penta_kills(self, penta_kills):\n\n self._penta_kills = penta_kills",
"def set_num_rounds(cls, new_num_rounds):\n raise NotImplementedError(\"subclasses need to override this method\")",
"def add_kills(sel... | [
"0.62266165",
"0.5812346",
"0.57664883",
"0.57288",
"0.5710106",
"0.5706099",
"0.55601907",
"0.55325025",
"0.53830945",
"0.5377204",
"0.53333926",
"0.5252999",
"0.5240907",
"0.5239404",
"0.52208483",
"0.52045214",
"0.51364094",
"0.5132699",
"0.512664",
"0.5093927",
"0.5033959... | 0.8176102 | 0 |
Sets the games of this LolStatsTeamGame. | def games(self, games):
self._games = games | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_games(self, games):\n for game in games:\n # TODO(kevin): Use Benchapp opponent ID rather than creating a new\n # opponent for every game.\n response = self._session.post(self._add_game_url,\n data={\n ... | [
"0.6581815",
"0.6235441",
"0.61080927",
"0.5907177",
"0.5743327",
"0.5683782",
"0.5648739",
"0.563174",
"0.5579301",
"0.5579301",
"0.5557946",
"0.54944485",
"0.54155976",
"0.535925",
"0.5324376",
"0.5308547",
"0.5297878",
"0.5279926",
"0.52758455",
"0.52712333",
"0.5256706",
... | 0.7763565 | 0 |
Sets the matches of this LolStatsTeamGame. | def matches(self, matches):
self._matches = matches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_game_params(self, board):\n self.board = board.copy()\n self.n_rows = len(self.board[0]) # cols number\n self.n_cols = len(self.board) # rows number\n self.fruits_ttl = min(self.n_rows,self.n_cols)+1\n player_pos = np.where(board == 1)\n rival_pos = np.where(b... | [
"0.587322",
"0.58050025",
"0.57346857",
"0.5651937",
"0.5643926",
"0.56294394",
"0.55897707",
"0.5584681",
"0.5584091",
"0.55839485",
"0.5582467",
"0.55749834",
"0.55431867",
"0.5538803",
"0.551556",
"0.54710656",
"0.54630613",
"0.54087996",
"0.5403916",
"0.53616667",
"0.5359... | 0.66068655 | 1 |
Sets the is_closed of this LolStatsTeamGame. | def is_closed(self, is_closed):
self._is_closed = is_closed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trade_closed_i_ds(self, trade_closed_i_ds):\n\n self._trade_closed_i_ds = trade_closed_i_ds",
"def is_close(self, is_close):\n\n self._is_close = is_close",
"def isClosed(self) -> bool:\r\n\r\n return self.__is_closed",
"def isClosed(self):\n pass",
"def _is_closed(self) -> ... | [
"0.5701012",
"0.5632981",
"0.543426",
"0.5287788",
"0.5238052",
"0.5201816",
"0.5201816",
"0.5163624",
"0.5076451",
"0.50451434",
"0.5007092",
"0.50057155",
"0.4934634",
"0.48884356",
"0.48826575",
"0.48566303",
"0.48522642",
"0.4824633",
"0.48215473",
"0.48158038",
"0.481580... | 0.68211526 | 0 |
Generate the gt targets for DRRG. | def generate_targets(self, data):
assert isinstance(data, dict)
image = data['image']
polygons = data['polys']
ignore_tags = data['ignore_tags']
h, w, _ = image.shape
polygon_masks = []
polygon_masks_ignore = []
for tag, polygon in zip(ignore_tags, poly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_targets(tgt_re, samples, target_suffix=\"\"):\n tgts = list(set(tgt_re.fmt.format(**unit) + target_suffix for unit in samples))\n return tgts",
"def format_target_genes(d, g, miranda_fnm, id_dict):\n\tprint 'format target genes'\n\toutput_nm = \"%s_netwerk.txt\"%(miranda_fnm[:-4])\n\toutput = open... | [
"0.6245117",
"0.5965536",
"0.5841104",
"0.5808474",
"0.5777218",
"0.56490433",
"0.5558532",
"0.5547776",
"0.55423933",
"0.551506",
"0.55072105",
"0.5504319",
"0.5469805",
"0.54515254",
"0.54505783",
"0.54410845",
"0.54381853",
"0.5434024",
"0.54212224",
"0.5414428",
"0.540556... | 0.6306101 | 0 |
There is an UpgradeConfig on the cluster, its upgradeAt is in the past, and we did not already notify | def test_new_upgrade_notify(
mocker, state, slack, ouw_oc_map, ouw_ocm_map, upgrade_config, dt
):
dt.utcnow.return_value = upgrade_at + timedelta(hours=1)
gso = mocker.patch(
"reconcile.openshift_upgrade_watcher._get_start_osd", autospec=True
)
gso.return_value = upgrade_at.strftime("%Y-%m-%... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_warn_upgrade_new_install(config: Config, time: Time):\n cache = DataCache(config, time)\n assert not cache.notifyForIgnoreUpgrades\n assert cache._config.get(Setting.IGNORE_UPGRADE_BACKUPS)",
"def test_new_upgrade_pending(\n mocker, state, slack, ouw_oc_map, ouw_ocm_map, upgrade_config... | [
"0.62998974",
"0.6257894",
"0.62466204",
"0.62059826",
"0.5979673",
"0.593013",
"0.57986957",
"0.5712864",
"0.5618082",
"0.55509657",
"0.55382323",
"0.54851776",
"0.54707295",
"0.5458342",
"0.5450605",
"0.53992695",
"0.53840435",
"0.53809357",
"0.5351589",
"0.5338289",
"0.533... | 0.6372747 | 0 |
We already notified for this cluster, but on an old version | def test_new_version_notify(mocker, state, slack, clusters):
state.exists.return_value = True
state.get.return_value = old_version # different version
ouw.notify_cluster_new_version(clusters, state=state, slack=slack)
assert slack.chat_post_message.call_count == 1
assert state.add.call_count == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_new_version_no_op(mocker, state, slack, clusters):\n state.exists.return_value = True\n state.get.return_value = upgrade_version # same version, already notified\n ouw.notify_cluster_new_version(clusters, state=state, slack=slack)\n assert slack.chat_post_message.call_count == 0\n assert s... | [
"0.6708701",
"0.6514649",
"0.5861353",
"0.58181286",
"0.56122667",
"0.56122667",
"0.5611216",
"0.55327994",
"0.5519711",
"0.55092704",
"0.5505154",
"0.5470053",
"0.54493994",
"0.5431131",
"0.5401356",
"0.537669",
"0.5362767",
"0.53351235",
"0.52862686",
"0.52787006",
"0.52769... | 0.6928027 | 0 |
Creates a list of file names using a time range, resoution and file format Based on Davin Larson's file_dailynames in IDL SPEDAS | def dailynames(directory='',
trange=None,
res=24*3600.,
hour_res=False,
file_format='%Y%m%d',
prefix='',
suffix='',
return_times=False):
if trange is None:
logging.error('No trange specified')
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_filenames(date):\n \n filelist = list()\n for t in [\"0000\", \"0600\", \"1200\", \"1800\"]:\n for t2 in [\"000\", \"003\"]:\n filelist.append(\"gfsanl_4_\"+d.strftime('%Y%m%d')+\"_\"+t+\"_\"+t2+\".grb2\")\n return filelist",
"def file_name_list():\n file_names = []\n ... | [
"0.7888418",
"0.70039755",
"0.68258417",
"0.63048077",
"0.6182704",
"0.61765206",
"0.6120627",
"0.61018884",
"0.60272866",
"0.6015686",
"0.59450567",
"0.5905192",
"0.5875581",
"0.5869554",
"0.5867835",
"0.5864684",
"0.5848827",
"0.57826",
"0.5782412",
"0.5770151",
"0.57665426... | 0.7171646 | 1 |
List of columns that can be split on, i.e. that have more than one unique value Returns List[int] List of column numbers that can be split on | def splittable_variables(self) -> List[int]:
#print("enter bartpy/bartpy/data.py CovariateMatrix splittable_variables")
for i in range(0, self._n_features):
if self._splittable_variables[i] is None:
self._splittable_variables[i] = is_not_constant(self.get_column(i))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_split_col_names():\n return ['dna_%d' % (idx+1) for idx in range(60)]",
"def get_id_columns(df):\n id_cols = []\n cols= df.columns\n df_len = len(df)\n for column in cols:\n if df[column].nunique() == df_len:\n id_cols.append(column)\n\n return id_cols",
"def split_c... | [
"0.6846722",
"0.6600953",
"0.6423655",
"0.64152426",
"0.6291985",
"0.6276318",
"0.6260928",
"0.6250821",
"0.6227141",
"0.6141843",
"0.6122945",
"0.6102159",
"0.6083394",
"0.60522443",
"0.5977744",
"0.5967169",
"0.59559405",
"0.59339565",
"0.5842132",
"0.5838725",
"0.5836853",... | 0.69133073 | 0 |
Choose a variable at random from the set of splittable variables Returns str a variable name that can be split on | def random_splittable_variable(self) -> str:
#print("enter bartpy/bartpy/data.py CovariateMatrix random_splittable_variable")
if self.is_at_least_one_splittable_variable():
output = np.random.choice(np.array(self.splittable_variables()), 1)[0]
#print("-exit bartpy/bartpy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_choice(var_name):\r\n return random.choice(var_name)",
"def choose_secret_word():\n # return random.choice(['python' , 'django' , 'concatenate'])\n return random.choice(['concatenate' , 'concatenate' , 'concatenate'])",
"def generate_name():\n return random.choice(ADJECTIVES) + \"_\" + r... | [
"0.74896026",
"0.6250718",
"0.60365015",
"0.60270375",
"0.59313554",
"0.58190274",
"0.57919014",
"0.5783276",
"0.5778537",
"0.57704556",
"0.57559144",
"0.5751686",
"0.572386",
"0.5720365",
"0.5696701",
"0.5687411",
"0.56764585",
"0.56683105",
"0.56631017",
"0.5653476",
"0.564... | 0.6739524 | 1 |
Normalize y into the range (0.5, 0.5) Useful for allowing the leaf parameter prior to be 0, and to standardize the sigma prior | def normalize_y(y: np.ndarray) -> np.ndarray:
#print("enter bartpy/bartpy/data.py Target normalize_y")
y_min, y_max = np.min(y), np.max(y)
output = -0.5 + ((y - y_min) / (y_max - y_min))
#print("-exit bartpy/bartpy/data.py Target normalize_y")
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unnormalize_y(y, y_mean, y_std, scale_std=False):\n if not scale_std:\n return y * y_std + y_mean\n else:\n return y * y_std",
"def sigmanorm(y):\n y = y.copy()\n y -= y.mean() # set to zero mean\n y /= y.std() # rescale to units of sigma\n return y",
"def normalize(self, e... | [
"0.6827259",
"0.6463445",
"0.6302323",
"0.61126107",
"0.6048823",
"0.5970111",
"0.595618",
"0.5891516",
"0.58850604",
"0.588391",
"0.5829071",
"0.5821494",
"0.58209383",
"0.5802048",
"0.57533073",
"0.5744013",
"0.57303196",
"0.5723295",
"0.571871",
"0.569827",
"0.56949353",
... | 0.77289015 | 0 |
Update or provide information about updating stored credentials. This function is an interactive helper to update credentials stored in disk from IBM Quantum Experience v1 to v2. Upon invocation, the function will inspect the credentials stored in disk and attempt to convert them to the new version, displaying the chan... | def update_credentials(force: bool = False) -> Optional[Credentials]:
# Get the list of stored credentials.
stored_credentials, _ = read_credentials_from_qiskitrc()
credentials_list = list(stored_credentials.values())
new_credentials = []
hub_lines = []
warnings = []
provider_number = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testUpdateCredentials(self):\r\n \r\n credentials = dict()\r\n credentials[\"username\"] = \"\"\r\n credentials[\"password\"] = \"\"\r\n self._factory.updateCredentials(credentials)",
"def get_credentials():\n home_dir = os.path.expanduser('~')\n credential_dir = os.p... | [
"0.66093975",
"0.57667375",
"0.5685908",
"0.56497455",
"0.5559846",
"0.5559375",
"0.53343",
"0.5331201",
"0.53087187",
"0.5256959",
"0.52014303",
"0.51730406",
"0.51491624",
"0.514876",
"0.5146455",
"0.5111192",
"0.51078385",
"0.50827324",
"0.5060716",
"0.50552094",
"0.504543... | 0.657043 | 1 |
Returns ``True`` if credentials can be updated directly. | def is_directly_updatable(credentials: Credentials) -> bool:
if credentials.base_url == QE_URL:
return True
if credentials.base_url in (QCONSOLE_URL, QE2_URL, QCONSOLE2_URL):
if credentials.base_url == credentials.url:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials(self):\n return True",
"def has_credentials(self):\n return self.username and self.password and self.url and self.xml_rpc",
"def checkCredentialChange(response):\n credentials = getattr(flask.g, '_credentials', None)\n if credentials is not None:\n config = get_user_config()\... | [
"0.68011355",
"0.6657057",
"0.658802",
"0.6474138",
"0.6389873",
"0.63276404",
"0.6202337",
"0.6151516",
"0.61509186",
"0.615052",
"0.613814",
"0.61256343",
"0.6118167",
"0.61124957",
"0.61108917",
"0.61013114",
"0.60943335",
"0.6092022",
"0.60357577",
"0.6023789",
"0.6023065... | 0.7435469 | 0 |
Receives expected words to look for and calculates a proper rank based on how many words are actually found | def _calculate_rank_result(words, content):
found = 0
for word in words:
# NOTE: We could use regex, but since we might avoid libs
# we're going to filter stuff ourselves
begin_word = f"{word} "
end_word = f" {word}"
middle_word = f" {word} "
if word == content:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_ranking(self, files_found_by_word: Dict[str, int],\n words: List[str]) -> List[Tuple[str, float]]:\n size_words = len(words)\n words_percentage_hit = [(k, v / size_words) for (k, v) in files_found_by_word.items()]\n return words_percentage_hit",
"def ... | [
"0.7209645",
"0.7006817",
"0.692279",
"0.6825105",
"0.6652255",
"0.6591544",
"0.6549823",
"0.65418094",
"0.64429986",
"0.6413999",
"0.6378805",
"0.63589275",
"0.63454",
"0.6339966",
"0.62873465",
"0.62870383",
"0.6280286",
"0.6273742",
"0.62602496",
"0.6258288",
"0.6244444",
... | 0.7582978 | 0 |
Escape reserved language keywords like openapi generator does it. | def escape_reserved_keyword(word):
reserved_keywords = ["from"]
if word in reserved_keywords:
return f"_{word}"
return word | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def esc_kw(kw):\n kw = kw.replace('\\\\', '\\\\\\\\') # be sure to do this first, as we inject \\!\n kw = kw.replace('(', '\\(')\n kw = kw.replace(')', '\\)')\n kw = kw.replace('+', '\\+')\n kw = kw.replace('-', '\\-')\n kw = kw.replace(':', '\\:')\n kw = kw.replace('/', '\\/')\n kw = kw.re... | [
"0.67265403",
"0.5898481",
"0.5883832",
"0.5838647",
"0.5747813",
"0.56146866",
"0.54699165",
"0.54248005",
"0.54201335",
"0.5398484",
"0.5384061",
"0.5347762",
"0.534535",
"0.53336275",
"0.53249687",
"0.5321054",
"0.52896315",
"0.5281354",
"0.5277743",
"0.5226829",
"0.519736... | 0.73731625 | 0 |
a valid API key. | def a_valid_api_key(configuration):
configuration.api_key["apiKeyAuth"] = os.getenv("DD_TEST_CLIENT_API_KEY", "fake") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_api_key(x_api_key: str = Security(api_key_header_auth)):\n\n if x_api_key != API_KEY:\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n detail=\"Invalid API Key\",\n )",
"def API_KEY(self):\n return 1",
"def API_KEY(self):\n rais... | [
"0.77320856",
"0.7329465",
"0.73283625",
"0.7297513",
"0.72794944",
"0.72751987",
"0.72751987",
"0.72604114",
"0.72593576",
"0.7259319",
"0.7256968",
"0.7256968",
"0.7256968",
"0.7256968",
"0.7219383",
"0.71990776",
"0.71948904",
"0.71811813",
"0.71619415",
"0.71541786",
"0.7... | 0.7471092 | 1 |
a valid Application key. | def a_valid_application_key(configuration):
configuration.api_key["appKeyAuth"] = os.getenv("DD_TEST_CLIENT_APP_KEY", "fake") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidKey(key):\n return True",
"def API_KEY(self):\n return 1",
"def API_KEY(self):\n return 11",
"def API_KEY(self):\n return 0",
"def API_KEY(self):\n return 13",
"def API_KEY(self):\n return 2",
"def checkKey(self):\n # TO DO for checking API authenti... | [
"0.64108825",
"0.6410502",
"0.64058256",
"0.6371416",
"0.637012",
"0.6327941",
"0.6323032",
"0.62902886",
"0.62567693",
"0.6241893",
"0.6235596",
"0.6227848",
"0.6214999",
"0.62021714",
"0.61106896",
"0.6105212",
"0.60778165",
"0.6072682",
"0.6071211",
"0.6071211",
"0.6071211... | 0.7317109 | 0 |
Enable the unstable operation specific in the clause. | def operation_enabled(client, name):
client.configuration.unstable_operations[snake_case(name)] = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*args):",
"def setEnableCondition(*arg... | [
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.6012671",
"0.5916203",
"0.5914874",
"0.5911096",
"0.5555086",
"0.555277",
"0.55259717",
"0.55008787",
"0.54907686",
"0.5463503",
"0.5454816",
... | 0.72134626 | 0 |
Check that a response path has field. | def expect_response_has_field(context, response_path, field):
response_value = glom(context["api_request"]["response"][0], response_path)
assert field in response_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_response(self, response):\n pass",
"def is_data_response(resp: Response, data_field: str = None) -> bool:\n\n return \\\n resp and \\\n is_dict(resp) and \\\n is_success_response(resp) and \\\n resp.get(\"data\") is not None and \\\n (not data_field or da... | [
"0.60000277",
"0.5969056",
"0.5943157",
"0.5778967",
"0.5738842",
"0.5738842",
"0.5738334",
"0.5680685",
"0.5677661",
"0.56181514",
"0.56153476",
"0.55953395",
"0.55683756",
"0.5521833",
"0.5450278",
"0.54415536",
"0.54300904",
"0.541711",
"0.54029655",
"0.5400171",
"0.538359... | 0.7998907 | 0 |
Sets the channel_type of this WrappedChannel. | def channel_type(self, channel_type):
if channel_type is None:
raise ValueError("Invalid value for `channel_type`, must not be `None`") # noqa: E501
self._channel_type = channel_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetType(self, ct_type):\r\n\r\n self._type = ct_type",
"def set_type(self, type):\n self._type = type",
"def _set_channel_(self, channel):\n self._channel = channel",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"de... | [
"0.6978583",
"0.6766841",
"0.675087",
"0.6726447",
"0.6726447",
"0.669931",
"0.654784",
"0.64136815",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.6402009",
"0.... | 0.8061412 | 0 |
Sets the unit of this WrappedChannel. | def unit(self, unit):
if unit is None:
raise ValueError("Invalid value for `unit`, must not be `None`") # noqa: E501
self._unit = unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_unit(self,unit):\n self.unit = unit",
"def unit(self, unit):\n # type: (PositionUnit) -> None\n\n if unit is not None:\n if not isinstance(unit, PositionUnit):\n raise TypeError(\"Invalid type for `unit`, type has to be `PositionUnit`\")\n\n self._uni... | [
"0.74943113",
"0.6505364",
"0.6483862",
"0.6482817",
"0.6467222",
"0.6448681",
"0.64383185",
"0.64118695",
"0.63721704",
"0.6366836",
"0.6302544",
"0.6302544",
"0.6302544",
"0.6296591",
"0.62601405",
"0.6214905",
"0.62133175",
"0.6211197",
"0.6211197",
"0.6211197",
"0.6179447... | 0.6950057 | 1 |
Sets the last_annotation of this WrappedChannel. | def last_annotation(self, last_annotation):
if last_annotation is None:
raise ValueError("Invalid value for `last_annotation`, must not be `None`") # noqa: E501
self._last_annotation = last_annotation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update(self, last_update):\n\n self._last_update = last_update",
"def last_scanned(self, last_scanned):\n\n self._last_scanned = last_scanned",
"def annotate(self, annotation_=None):\n # Important: Need a copy, not the reference to the original object\n annotation_ = copy.d... | [
"0.58615637",
"0.582744",
"0.57456595",
"0.5719815",
"0.5651028",
"0.5651028",
"0.5651028",
"0.5651028",
"0.5633431",
"0.56088245",
"0.5608513",
"0.5564118",
"0.55443144",
"0.5523439",
"0.5514798",
"0.5479912",
"0.53989005",
"0.53616583",
"0.53543174",
"0.53115207",
"0.528291... | 0.80875623 | 0 |
Sets the spike_duration of this WrappedChannel. | def spike_duration(self, spike_duration):
self._spike_duration = spike_duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_duration(self, duration_secs):\n raise UnsupportedOperation('Duration not implemented')",
"def duration(self, duration):\n self._duration = duration",
"def duration(self, duration):\n self._duration = duration",
"def duration(self, duration):\n\n self._duration = duration"... | [
"0.6405776",
"0.5893094",
"0.5893094",
"0.58726573",
"0.58726573",
"0.58726573",
"0.58726573",
"0.58726573",
"0.58726573",
"0.58726573",
"0.58726573",
"0.5863448",
"0.577566",
"0.5727868",
"0.5727868",
"0.56252563",
"0.5621158",
"0.5538197",
"0.54747653",
"0.5453293",
"0.5230... | 0.811063 | 0 |
Sets the package_id of this WrappedChannel. | def package_id(self, package_id):
if package_id is None:
raise ValueError("Invalid value for `package_id`, must not be `None`") # noqa: E501
self._package_id = package_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_id(self, package_id):\n\n self._package_id = package_id",
"def channel_id(self, channel_id):\n \n self._channel_id = channel_id",
"def package(self, package):\n\n self._package = package",
"def set_package(self, pkg): \n self.pkg = pkg",
"def group_id(s... | [
"0.83073866",
"0.67015165",
"0.6464246",
"0.61539716",
"0.61365527",
"0.61365527",
"0.61365527",
"0.61365527",
"0.61365527",
"0.61365527",
"0.58245933",
"0.5779983",
"0.56672245",
"0.56574917",
"0.5638053",
"0.55306524",
"0.5522576",
"0.5514647",
"0.5504797",
"0.5493545",
"0.... | 0.72573835 | 1 |
Compute the clustering objective for X and C | def compute_objective(X, C):
# similar as mse
acc = 0
for x in range(len(X)):
acc += (nearest_distance(X.iloc[x], C)) ** 2
return acc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster(X=None, datalabels=None, nc=2):\n from sklearn.cluster import KMeans\n from sklearn.cluster import AffinityPropagation\n\n C = KMeans(n_clusters=nc,n_init=10,init='random')\n C.fit(X[:,:1])\n\n #C = AffinityPropagation(preference=-80,damping=0.5).fit(X)\n #cluster_centers_indices = C.... | [
"0.6770849",
"0.65567607",
"0.64381945",
"0.632811",
"0.62881434",
"0.61435825",
"0.61394894",
"0.6097038",
"0.60614824",
"0.6051776",
"0.6038582",
"0.60215604",
"0.60166174",
"0.600011",
"0.599214",
"0.5991257",
"0.598187",
"0.5968725",
"0.59366536",
"0.593637",
"0.5916974",... | 0.74244255 | 0 |
Records plant type and name | def plants (plant_name, plant_type):
print (f"\n{plant_name.title()} is a {plant_type}. \n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plant (type, age, name= ''):\n if name:\n plantid = f\"{type} {age} {name}\"\n else:\n plantid = f\"{type} {age}\\n\"\n return plantid.title ()",
"def generate_plant_report(self):\n print('PLANTS IN ' + self.name)\n for species, count in self.plants.items():\n ... | [
"0.6774355",
"0.63099235",
"0.57138985",
"0.56917614",
"0.5567",
"0.5543149",
"0.55246824",
"0.5479969",
"0.543112",
"0.5407793",
"0.53906745",
"0.53861266",
"0.53598756",
"0.53521913",
"0.53363335",
"0.53342265",
"0.53211594",
"0.53163725",
"0.5306884",
"0.52826095",
"0.5280... | 0.7191464 | 0 |
Records plant type, age, and name. | def plant (type, age, name= ''):
if name:
plantid = f"{type} {age} {name}"
else:
plantid = f"{type} {age}\n"
return plantid.title () | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plants (plant_name, plant_type):\n print (f\"\\n{plant_name.title()} is a {plant_type}. \\n\")",
"def generate_plant_report(self):\n print('PLANTS IN ' + self.name)\n for species, count in self.plants.items():\n print(f'{species}: {count}')",
"def __str__(self):\n return ... | [
"0.6405951",
"0.6044776",
"0.57644045",
"0.5490862",
"0.5457935",
"0.5431116",
"0.54043376",
"0.540187",
"0.52725047",
"0.5226732",
"0.5221677",
"0.519281",
"0.5189909",
"0.5183057",
"0.51706797",
"0.51706797",
"0.5150653",
"0.5150653",
"0.5150653",
"0.5150653",
"0.5127419",
... | 0.704568 | 0 |
Records tree type, climate found. | def trees (type, climate):
formatted = f"{type} {climate}"
return formatted.title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_tree_type(tree):\n return tree.type in ref",
"def __manage_tree(self):\n for pre, fill, node in RenderTree(self.tree):\n if node.name is 'count':\n logger.info(\n \"Tree info %s%s: %s %s p/s attack: %s\",\n pre, node.name... | [
"0.57256633",
"0.55790883",
"0.55576",
"0.55268496",
"0.54360855",
"0.54301214",
"0.54279566",
"0.53783655",
"0.53707033",
"0.53472006",
"0.527955",
"0.5275565",
"0.5270644",
"0.5251638",
"0.52471876",
"0.5217461",
"0.5171129",
"0.51655054",
"0.5151762",
"0.5151699",
"0.51458... | 0.6699758 | 0 |
Return lines in both a and b | def lines(a, b):
a = set(a.split('\n'))
b = set(b.split('\n'))
return a & b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines(a, b):\n setA = set(a.splitlines())\n setB = set(b.splitlines())\n return list(setA & setB)",
"def lines(a, b):\n # Turn split versions of both files into sets to remove duplicates\n # Split Lines used to automatically split at the end of a line. No need for \"\\n\" this way\n a1 = se... | [
"0.84323776",
"0.8209423",
"0.8155053",
"0.8084453",
"0.80119795",
"0.7953571",
"0.7864018",
"0.78480303",
"0.7745946",
"0.76432455",
"0.63046974",
"0.61740553",
"0.61672133",
"0.6156392",
"0.6116802",
"0.61079884",
"0.6088622",
"0.6081457",
"0.60608596",
"0.5965131",
"0.5956... | 0.8364938 | 1 |
Each read is remaped to alternative cds alignment with highest coverage. Coverage for modified cds alignments is then recalculated. Given cds alignment is deleted from container. | def remove_cds_and_remap_reads(self, cds_aln):
super(GreedySolver, self).remove_cds_and_remap_reads(cds_aln)
# Dictionary where key is read_id and value is cds alignment to which it maps.
# If it does not map to any cds alignment then value is None.
new_read_mappings = {}
for al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeChainedAlignedSegments(chainedAlignedSegments, refSequence, readSequence):\n cAR = pysam.AlignedSegment()\n aR = chainedAlignedSegments[0]\n cAR.query_name = aR.query_name\n \n #Parameters we don't and therefore set properly\n #cAR.flag = aR.flag\n #cAR.mapq = aR.mapq\n #cAR.mrnm =... | [
"0.6104481",
"0.57935625",
"0.5663907",
"0.561576",
"0.542552",
"0.5418985",
"0.52996284",
"0.5290297",
"0.5286634",
"0.5272005",
"0.52469826",
"0.52469724",
"0.52425665",
"0.52353317",
"0.52208877",
"0.52176535",
"0.5206263",
"0.51915586",
"0.51817733",
"0.5168516",
"0.51558... | 0.8073812 | 0 |
If coverage was already calculated before then it is just returned. Otherwise coverage is calculated, stored for later and then returned. (CdsAlignment) cds_aln (float) coverage | def _get_coverage(self, cds_aln):
if not (cds_aln in self._coverages):
self._coverages[cds_aln] = self._calc_coverage(cds_aln)
return self._coverages[cds_aln] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_coverage(self, cds_aln):\n # Aligned region is part of a read that intersects with cds.\n coverage = 0\n for aln_reg in cds_aln.aligned_regions.values(): # aln_reg is of type CdsAlnSublocation\n location = aln_reg.location # location is of type Location\n covera... | [
"0.779504",
"0.6194636",
"0.6151751",
"0.5620301",
"0.5579024",
"0.54667884",
"0.5443169",
"0.53979945",
"0.53978926",
"0.53828347",
"0.53445464",
"0.5341453",
"0.53129256",
"0.53091913",
"0.5306587",
"0.53020287",
"0.52900237",
"0.5255865",
"0.5232318",
"0.5167892",
"0.51019... | 0.7849509 | 0 |
Calculates coverage of given cds alignment. Coverage is calculated as sum of lengths of aligned regions divided by length of cds. (CdsAlignment) cds_aln (float) coverage | def _calc_coverage(self, cds_aln):
# Aligned region is part of a read that intersects with cds.
coverage = 0
for aln_reg in cds_aln.aligned_regions.values(): # aln_reg is of type CdsAlnSublocation
location = aln_reg.location # location is of type Location
coverage += loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_coverage(self, cds_aln):\n if not (cds_aln in self._coverages):\n self._coverages[cds_aln] = self._calc_coverage(cds_aln)\n return self._coverages[cds_aln]",
"def query_coverage(query):\n length = query_length(query)\n coverage = (int(query['alignment length'])/length) * 1... | [
"0.7174511",
"0.6457403",
"0.6359101",
"0.58639205",
"0.5701942",
"0.55785817",
"0.5539288",
"0.5494778",
"0.5487234",
"0.54809207",
"0.5429922",
"0.540377",
"0.53845704",
"0.5355231",
"0.52771115",
"0.52400416",
"0.5230528",
"0.521647",
"0.51548046",
"0.5126714",
"0.50998974... | 0.86321664 | 0 |
Run a kubectl command. | def RunKubectlCommand(command: List[str], **kwargs):
cmd = [FLAGS.kubectl, '--kubeconfig', FLAGS.kubeconfig] + command
return vm_util.IssueCommand(cmd, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kubectl(self, *args: str, **kwargs) -> str:\n return KindClusterUpstream.kubectl(self, *args, **kwargs)",
"def exec_in_pods(\n cmd: str,\n label_selector: str = None,\n name_pattern: str = None,\n all: bool = False,\n rand: bool = False,\n mode: str = \"fixed\",\n qty: int = 1,\n ... | [
"0.667438",
"0.60162044",
"0.58442736",
"0.57903063",
"0.566554",
"0.54936635",
"0.5439563",
"0.54317886",
"0.5399986",
"0.5356197",
"0.53204554",
"0.5262318",
"0.52546966",
"0.5241716",
"0.5230967",
"0.51483583",
"0.513163",
"0.5086982",
"0.507351",
"0.50596905",
"0.5046301"... | 0.7953801 | 0 |
Apply flag settings to the container spec. | def _ApplyFlags(cls, config_values, flag_values):
super(ContainerSpec, cls)._ApplyFlags(config_values, flag_values)
if flag_values['image'].present:
config_values['image'] = flag_values.image
if flag_values['static_container_image'].present:
config_values['static_image'] = flag_values.static_con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ApplyFlags(cls, config_values, flag_values):\n super(ContainerRegistrySpec, cls)._ApplyFlags(config_values, flag_values)\n if flag_values['cloud'].present or 'cloud' not in config_values:\n config_values['cloud'] = flag_values.cloud\n if flag_values['container_cluster_cloud'].present:\n con... | [
"0.73716277",
"0.62386006",
"0.5752432",
"0.5514748",
"0.5479732",
"0.5444331",
"0.5375626",
"0.53620857",
"0.53168875",
"0.52493453",
"0.52444434",
"0.52068186",
"0.5196723",
"0.5168077",
"0.51590157",
"0.5148884",
"0.50820625",
"0.49948052",
"0.49409693",
"0.49000356",
"0.4... | 0.7558234 | 0 |
Gets decoder classes and constructor args for each configurable option. Can be overridden by derived classes to add options or impose additional requirements on existing options. | def _GetOptionDecoderConstructions(cls):
result = super(ContainerSpec, cls)._GetOptionDecoderConstructions()
result.update({
'image': (option_decoders.StringDecoder, {
'default': None
}),
'static_image': (option_decoders.BooleanDecoder, {
'default': False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetOptionDecoderConstructions(cls):\n result = super()._GetOptionDecoderConstructions()\n result.update({\n 'enable_freeze_restore': (option_decoders.BooleanDecoder, {\n 'default': False,\n 'none_ok': True\n }),\n 'delete_on_freeze_error': (option_decoders.Bool... | [
"0.74729073",
"0.73526216",
"0.7286072",
"0.5950183",
"0.5742244",
"0.5733875",
"0.56687045",
"0.5647544",
"0.55595833",
"0.5527886",
"0.54654026",
"0.54325634",
"0.5408256",
"0.5355123",
"0.5344889",
"0.53380305",
"0.5337081",
"0.53225285",
"0.53122324",
"0.530829",
"0.53080... | 0.73592085 | 1 |
Apply flag values to the spec. | def _ApplyFlags(cls, config_values, flag_values):
super(ContainerRegistrySpec, cls)._ApplyFlags(config_values, flag_values)
if flag_values['cloud'].present or 'cloud' not in config_values:
config_values['cloud'] = flag_values.cloud
if flag_values['container_cluster_cloud'].present:
config_values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ApplyFlags(cls, config_values, flag_values):\n super(ContainerSpec, cls)._ApplyFlags(config_values, flag_values)\n if flag_values['image'].present:\n config_values['image'] = flag_values.image\n if flag_values['static_container_image'].present:\n config_values['static_image'] = flag_values.... | [
"0.6236467",
"0.59750783",
"0.5797149",
"0.57943875",
"0.56679446",
"0.55720335",
"0.55533266",
"0.5275891",
"0.5232046",
"0.52308685",
"0.5213431",
"0.5151133",
"0.5121733",
"0.51048577",
"0.50978184",
"0.50777805",
"0.5071938",
"0.506916",
"0.5051768",
"0.50015664",
"0.4999... | 0.6211392 | 1 |
Returns image build related samples. | def GetSamples(self):
samples = []
metadata = self.GetResourceMetadata()
for image_name, build_time in self.local_build_times.items():
metadata.update({
'build_type': 'local',
'image': image_name,
})
samples.append(
sample.Sample('Image Build Time', build_time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def samples(self):\n pass",
"def samples(self):\n return glob.glob(os.path.join(self.production.rundir, \"extrinsic_posterior_samples.dat\"))",
"def _get_sample(self):\n return [layer._get_sample() for layer in self.layers]",
"def samples_in_trial(self, trial_folder):\n files = li... | [
"0.6826313",
"0.67094415",
"0.6633125",
"0.6540348",
"0.6372584",
"0.63646525",
"0.63614124",
"0.63569194",
"0.63534564",
"0.6312465",
"0.6274102",
"0.6184488",
"0.61513007",
"0.6134038",
"0.6109857",
"0.6071366",
"0.6070952",
"0.60703605",
"0.6065101",
"0.6049266",
"0.603911... | 0.78965646 | 0 |
Build the image remotely. | def RemoteBuild(self, image):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _Build(self, image):\n image = _ContainerImage(image)\n build_start = time.time()\n if not FLAGS.local_container_build:\n try:\n # Build the image remotely using an image building service.\n self.RemoteBuild(image)\n self.remote_build_times[image.name] = time.time() - build_s... | [
"0.72824675",
"0.7149961",
"0.66580683",
"0.6645333",
"0.6637305",
"0.66032493",
"0.65801376",
"0.6550667",
"0.64931214",
"0.64409834",
"0.6410988",
"0.6400704",
"0.6369",
"0.6310048",
"0.6249842",
"0.624969",
"0.6249539",
"0.6245303",
"0.6179772",
"0.6178849",
"0.6178195",
... | 0.80754966 | 0 |
Build the image locally and push to registry. Assumes we are already authenticated with the registry from self.Login. Building and pushing done in one command to support multiarch images | def LocalBuildAndPush(self, image):
full_tag = self.GetFullRegistryTag(image.name)
# Multiarch images require buildx create
# https://github.com/docker/build-push-action/issues/302
vm_util.IssueCommand(['docker', 'buildx', 'create', '--use'])
cmd = ['docker', 'buildx', 'build']
if _CONTAINER_CLU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RemoteBuild(self, image):\n raise NotImplementedError()",
"def _Build(self, image):\n image = _ContainerImage(image)\n build_start = time.time()\n if not FLAGS.local_container_build:\n try:\n # Build the image remotely using an image building service.\n self.RemoteBuild(image)\... | [
"0.71513987",
"0.70679647",
"0.6879665",
"0.68536794",
"0.68044436",
"0.65771586",
"0.6556818",
"0.6543448",
"0.6521237",
"0.65155315",
"0.6513583",
"0.64384073",
"0.6422934",
"0.640649",
"0.63661534",
"0.6353233",
"0.63034725",
"0.62775856",
"0.6258173",
"0.62558746",
"0.621... | 0.73291093 | 0 |
Finds the image in the registry or builds it. | def GetOrBuild(self, image):
full_image = self.GetFullRegistryTag(image)
# Log in to the registry to see if image exists
self.Login()
if not FLAGS.force_container_build:
# manifest inspect inpspects the registry's copy
inspect_cmd = ['docker', 'manifest', 'inspect', full_image]
_, _, r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_force_with_registry_image(self, mock_docker_environment):\n mock_docker_environment.images.get.side_effect = DockerNotFound(\"testing\")\n build_image_if_needed(TEST_IMAGE_NAME, force=True)\n mock_docker_environment.images.build.assert_called_with(**self.default_call_kwargs)",
"def ... | [
"0.6515534",
"0.64155614",
"0.6371576",
"0.6365004",
"0.6291148",
"0.62701243",
"0.60976493",
"0.6085145",
"0.5945429",
"0.5939109",
"0.5926824",
"0.5920703",
"0.59028757",
"0.5842061",
"0.57871974",
"0.56998426",
"0.56758255",
"0.56710863",
"0.56363815",
"0.5629668",
"0.5625... | 0.70734566 | 0 |
Sets the value for the kubeconfig flag if it's unspecified. | def _SetKubeConfig(unused_sender, benchmark_spec):
if not FLAGS.kubeconfig:
FLAGS.kubeconfig = vm_util.PrependTempDir(
'kubeconfig' + str(benchmark_spec.sequence_number))
# Store the value for subsequent run stages.
benchmark_spec.config.flags['kubeconfig'] = FLAGS.kubeconfig | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_kubeconfig(kubeconfig_path):\n # Test cluster access\n log.info(\"Testing access to cluster with %s\", kubeconfig_path)\n if not os.path.isfile(kubeconfig_path):\n log.warning(\"The kubeconfig file %s doesn't exist!\", kubeconfig_path)\n return False\n os.e... | [
"0.6061491",
"0.5632957",
"0.55682915",
"0.54877234",
"0.5431584",
"0.534322",
"0.5311497",
"0.5300792",
"0.5245508",
"0.52438086",
"0.5232282",
"0.5134741",
"0.5117484",
"0.5109405",
"0.50986695",
"0.5066225",
"0.5043022",
"0.5019306",
"0.49732247",
"0.49593422",
"0.4948827"... | 0.7139192 | 0 |
Clean node pool names to be usable by all providers. | def NodePoolName(name: str) -> str:
# GKE (or k8s?) requires nodepools use alphanumerics and hyphens
# AKS requires full alphanumeric
# PKB likes to use underscores strip them out.
return name.replace('_', '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ValidateUniqueNames(pools):\n used_names = set()\n for pool in pools:\n name = pool.nodePool\n if name in used_names:\n raise exceptions.InvalidArgumentException(\n '--pools', 'Pool name \"%s\" used more than once.' % name)\n used_names.add(name)",
"def clean_node(\n ... | [
"0.58675915",
"0.57535046",
"0.57327944",
"0.56143886",
"0.5575528",
"0.5520573",
"0.55004275",
"0.5473626",
"0.5446845",
"0.5442993",
"0.5432576",
"0.53518254",
"0.5350328",
"0.53502744",
"0.53279215",
"0.5311385",
"0.5276975",
"0.5271846",
"0.52557456",
"0.52261037",
"0.522... | 0.65884876 | 0 |
Delete services belonging to the cluster. | def DeleteServices(self):
for service in self.services.values():
service.Delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cluster_service(self, cluster_name, service_name):\n return self._delete(endpoint='{}/clusters/{}/services/{}'.format(self.api_version,\n cluster_name,\n ... | [
"0.72004974",
"0.699659",
"0.66810054",
"0.6512791",
"0.6464479",
"0.63540775",
"0.6308213",
"0.6295427",
"0.62082094",
"0.61925465",
"0.61808413",
"0.6135816",
"0.6119558",
"0.6091666",
"0.6004444",
"0.5989877",
"0.5935613",
"0.5929533",
"0.59244186",
"0.5914949",
"0.5893401... | 0.7536741 | 0 |
Deploys a ContainerSerivice according to the ContainerSpec. | def DeployContainerService(self, name, container_spec, num_containers):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeployContainer(self, name, container_spec):\n raise NotImplementedError()",
"def DeployContainerService(self, name, container_spec):\n service = KubernetesContainerService(container_spec, name)\n self.services[name] = service\n service.Create()",
"def DeployContainer(self, base_name, container... | [
"0.73135483",
"0.6899841",
"0.6891289",
"0.56663823",
"0.55081326",
"0.53916615",
"0.5371564",
"0.53519523",
"0.53261524",
"0.5325632",
"0.5319292",
"0.53101605",
"0.52956",
"0.5289672",
"0.52779263",
"0.52675754",
"0.5244348",
"0.52394",
"0.5202361",
"0.5186401",
"0.5178641"... | 0.7420931 | 0 |
Return samples with information about deployment times. | def GetSamples(self):
samples = super().GetSamples()
for container in itertools.chain(*list(self.containers.values())):
metadata = {'image': container.image.split('/')[-1]}
if container.resource_ready_time and container.create_start_time:
samples.append(
sample.Sample(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSamples(self):\n samples = []\n metadata = self.GetResourceMetadata()\n for image_name, build_time in self.local_build_times.items():\n metadata.update({\n 'build_type': 'local',\n 'image': image_name,\n })\n samples.append(\n sample.Sample('Image Build Tim... | [
"0.7396758",
"0.60319406",
"0.58634365",
"0.5717713",
"0.5682422",
"0.5656929",
"0.5621266",
"0.5612598",
"0.5571641",
"0.5537472",
"0.5537472",
"0.5537472",
"0.551418",
"0.54998076",
"0.54737455",
"0.5469868",
"0.5455892",
"0.541816",
"0.5404643",
"0.538647",
"0.538538",
"... | 0.76557916 | 0 |
Gets a representation of the POD and returns it. | def _GetPod(self) -> Dict[str, Any]:
stdout, _, _ = RunKubectlCommand(['get', 'pod', self.name, '-o', 'yaml'])
pod = yaml.safe_load(stdout)
self.ip_address = pod.get('status', {}).get('podIP')
return pod | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_info(self):\n return {'q_ref': self.q_ref, 'v_ref': self.v_ref, 'U': self.U, 'type': 'POD'}",
"def __repr__(self):\n return self._metadata.__str__()",
"def pprint(self):\n return pformat(repr(self))",
"def to_representation(self) -> str:\n raise NotImplementedError()",
"... | [
"0.61870676",
"0.586387",
"0.5841823",
"0.5794994",
"0.57675374",
"0.5748594",
"0.5739726",
"0.5723545",
"0.57127905",
"0.570913",
"0.5693798",
"0.5668779",
"0.564856",
"0.564285",
"0.56414706",
"0.5639134",
"0.56381875",
"0.5636024",
"0.56328017",
"0.5618493",
"0.56011516",
... | 0.60387766 | 1 |
Deletes all resources from a namespace. Since StatefulSets do not reclaim PVCs upon deletion, they are explicitly deleted here to prevent dynamically provisioned PDs from leaking once the cluster has been deleted. | def _DeleteAllFromDefaultNamespace(self):
run_cmd = [
'delete', 'all', '--all', '-n', 'default'
]
RunKubectlCommand(run_cmd)
run_cmd = [
'delete', 'pvc', '--all', '-n', 'default'
]
RunKubectlCommand(run_cmd)
# There maybe a slight race if resources are cleaned up in the back... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_pods_in_namespaces(self, namespaces, cleanup_policy):\n return self.delete_resource_with_cleanup_policy(namespaces, cleanup_policy,\n self.core_api.delete_collection_namespaced_pod, \"pod\")",
"def resources_cleanup(namespace, image_uuids... | [
"0.69435763",
"0.6880816",
"0.67592907",
"0.66016126",
"0.6580462",
"0.6317775",
"0.6304699",
"0.618397",
"0.6133452",
"0.60928786",
"0.6075389",
"0.60242856",
"0.6014237",
"0.5996439",
"0.5976713",
"0.5937581",
"0.59301645",
"0.5928981",
"0.5923372",
"0.59106845",
"0.5902103... | 0.7287594 | 0 |
Deploys Containers according to the ContainerSpec. | def DeployContainer(self, base_name, container_spec):
name = base_name + str(len(self.containers[base_name]))
container = KubernetesContainer(container_spec=container_spec, name=name)
self.containers[base_name].append(container)
container.Create() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeployContainerService(self, name, container_spec, num_containers):\n raise NotImplementedError()",
"def DeployContainer(self, name, container_spec):\n raise NotImplementedError()",
"def _update_deploy_specs(self):\n for cluster in self.CLUSTERS:\n deployspec_name = PushUtil.get_deployspec_na... | [
"0.6342233",
"0.61386377",
"0.61088115",
"0.578597",
"0.5610808",
"0.5483326",
"0.5433376",
"0.5335884",
"0.5302445",
"0.5287305",
"0.52620256",
"0.5261377",
"0.5240357",
"0.51823866",
"0.51629585",
"0.5156974",
"0.5148568",
"0.5113321",
"0.5109546",
"0.50558597",
"0.50457215... | 0.6190668 | 1 |
Applies a declarative Kubernetes manifest; possibly with jinja. | def ApplyManifest(self, manifest_file, **kwargs):
filename = data.ResourcePath(manifest_file)
if not filename.endswith('.j2'):
assert not kwargs
RunKubectlCommand(['apply', '-f', filename])
return
environment = jinja2.Environment(undefined=jinja2.StrictUndefined)
with open(filename) a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy(\n deployment,\n chart,\n environment,\n namespace=None,\n helm_config_overrides=None,\n version=None,\n timeout=None,\n force=False\n):\n if helm_config_overrides is None:\n helm_config_overrides = []\n\n config = get_config(deployment)\n\n name = f'{deployment}-... | [
"0.5910602",
"0.58367276",
"0.5808798",
"0.57137465",
"0.5561164",
"0.5378463",
"0.5376736",
"0.53255033",
"0.530134",
"0.5266448",
"0.52617794",
"0.5253114",
"0.5218769",
"0.51362234",
"0.51356936",
"0.5075872",
"0.507143",
"0.50557524",
"0.50145906",
"0.5008866",
"0.4963469... | 0.69454366 | 0 |
Blocks until a Kubernetes rollout is completed. | def WaitForRollout(self, resource_name):
run_cmd = [
'rollout',
'status',
'--timeout=%ds' % vm_util.DEFAULT_TIMEOUT,
resource_name
]
RunKubectlCommand(run_cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_region_operation(self, operation):\n print('Waiting for %s.' %(operation))\n while True:\n result = self.compute.regionOperations().get(\n project=self.project,\n region=self.region,\n operation=operation).execute()\n if ... | [
"0.5514569",
"0.5337826",
"0.5326409",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.52491504",
"0.5238002",
"0.5208602",
"0.5161411",
"0.5112967",
"0.51034164",
"0.50792027",
"0.50769186",
"0.50593436",
"0.... | 0.7453454 | 0 |
Returns the IP address of a LoadBalancer service when ready. | def GetLoadBalancerIP(self, service_name):
get_cmd = [
'get', 'service', service_name, '-o',
'jsonpath={.status.loadBalancer.ingress[0].ip}'
]
stdout, _, _ = RunKubectlCommand(get_cmd)
try:
# Ensure the load balancer is ready by parsing the output IP
ip_address = ipaddress.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetIpAddress(self):\n ingress_name = '%s-ingress' % self.name\n get_cmd = [\n 'get', 'ing', ingress_name, '-o',\n 'jsonpath={.status.loadBalancer.ingress[*].ip}'\n ]\n stdout, _, _ = RunKubectlCommand(get_cmd)\n ip_address = stdout\n if ip_address:\n self.ip_address = ip_a... | [
"0.67909354",
"0.6784021",
"0.6552941",
"0.57576233",
"0.5645383",
"0.56363726",
"0.5611559",
"0.5598153",
"0.5597467",
"0.5594897",
"0.5585802",
"0.5557539",
"0.5557539",
"0.5557539",
"0.5556107",
"0.5551886",
"0.5531218",
"0.5531218",
"0.5531218",
"0.55012316",
"0.5494306",... | 0.7927104 | 0 |
Returns the IP address of a ClusterIP service when ready. | def GetClusterIP(self, service_name) -> str:
get_cmd = [
'get', 'service', service_name, '-o', 'jsonpath={.spec.clusterIP}'
]
stdout, _, _ = RunKubectlCommand(get_cmd)
if not stdout:
raise errors.Resource.RetryableCreationError(
"ClusterIP for service '%s' is not ready." % serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dns_service_ip(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"dns_service_ip\")",
"def dns_service_ip(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"dns_service_ip\")",
"def dns_service_ip(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(s... | [
"0.61742115",
"0.61742115",
"0.61742115",
"0.59795356",
"0.5866882",
"0.5841928",
"0.5841928",
"0.5841928",
"0.57930714",
"0.57790977",
"0.57537633",
"0.5747128",
"0.5738538",
"0.569682",
"0.56787187",
"0.5660252",
"0.5651368",
"0.5646728",
"0.56360865",
"0.56208247",
"0.5525... | 0.7231588 | 0 |
Creates a Kubernetes ConfigMap. | def CreateConfigMap(self, name, from_file_dir):
RunKubectlCommand(
['create', 'configmap', name, '--from-file', from_file_dir]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_k8s_configmaps(\n hieradata_file, k8s_configmaps_init_flag,\n apiserver_schema, controller_manager_schema,\n scheduler_schema, kubelet_schema, etcd_schema):\n # pylint: disable-msg=too-many-locals\n # pylint: disable-msg=too-many-arguments\n # pylint: disable-msg=loggin... | [
"0.6508178",
"0.63615143",
"0.58569753",
"0.5759011",
"0.5570188",
"0.5559288",
"0.5559288",
"0.5550505",
"0.5498227",
"0.5492547",
"0.5459511",
"0.54479945",
"0.5426085",
"0.5357399",
"0.5299691",
"0.5290399",
"0.5260772",
"0.5252041",
"0.52386725",
"0.5232473",
"0.52224964"... | 0.6927547 | 0 |
Create a k8s service account and clusterrolebinding. | def CreateServiceAccount(self,
name: str,
clusterrole: Optional[str] = None,
namespace='default'):
RunKubectlCommand(
['create', 'serviceaccount', name, '--namespace', namespace])
if clusterrole:
# TODO(pclay): Suppor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_role():\n headers = {\"X-Vault-Token\": args.x_vault_token}\n data = {\n \"bound_service_account_names\": args.k8s_service_account,\n \"bound_service_account_namespaces\": args.k8s_namespace,\n \"policies\": args.vault_policies.split(','),\n \"ttl\": arg... | [
"0.6669879",
"0.65694237",
"0.5934573",
"0.5855272",
"0.58253294",
"0.5825138",
"0.57997775",
"0.5784769",
"0.5746638",
"0.5718514",
"0.5648632",
"0.56346285",
"0.5602348",
"0.5578716",
"0.55622673",
"0.5521595",
"0.5473842",
"0.5467872",
"0.54380274",
"0.5396945",
"0.5390065... | 0.73295116 | 0 |
Usable memory of each node in cluster in KiB. | def node_memory_allocatable(self) -> units.Quantity:
stdout, _, _ = RunKubectlCommand(
# TODO(pclay): Take a minimum of all nodes?
[
'get', 'nodes', '-o',
'jsonpath={.items[0].status.allocatable.memory}'
])
return units.ParseExpression(stdout) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mem_per_core(self):\n return self.mem_per_node / self.cores_per_node",
"def total_mem(self):\n return Memory(self.mem_per_proc * self.mpi_procs + self.master_mem_overhead, \"Mb\")",
"def memory():\n sin = psutil.virtual_memory()\n return round((sin.total / sin.used) / 100, 3)",
"def m... | [
"0.71538305",
"0.7024484",
"0.69594085",
"0.68425614",
"0.6795375",
"0.66864306",
"0.66852796",
"0.6560504",
"0.65489894",
"0.6527059",
"0.6503182",
"0.65013236",
"0.64320743",
"0.64187145",
"0.6395966",
"0.6364734",
"0.63320035",
"0.6325355",
"0.6304527",
"0.63023734",
"0.62... | 0.73783773 | 0 |
vCPU of each node in cluster. | def node_num_cpu(self) -> int:
stdout, _, _ = RunKubectlCommand(
['get', 'nodes', '-o', 'jsonpath={.items[0].status.capacity.cpu}'])
return int(stdout) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vcpus(self):\n return self._vcpus",
"def _apply_vpp_cpu(node):\n\n # Get main core\n cpu = \"\\n\"\n if \"vpp_main_core\" in node[\"cpu\"]:\n vpp_main_core = node[\"cpu\"][\"vpp_main_core\"]\n else:\n vpp_main_core = 0\n if vpp_main_core != 0:\n... | [
"0.76074207",
"0.67603713",
"0.6611406",
"0.657489",
"0.65595037",
"0.6535147",
"0.65322125",
"0.6461389",
"0.6355561",
"0.6350155",
"0.6268224",
"0.62572634",
"0.6212665",
"0.6152305",
"0.61312836",
"0.61252624",
"0.61214364",
"0.6111086",
"0.6076936",
"0.6067196",
"0.606154... | 0.6952937 | 1 |
Actual Kubernetes version reported by server. | def k8s_version(self) -> str:
stdout, _, _ = RunKubectlCommand(['version', '-o', 'yaml'])
return yaml.safe_load(stdout)['serverVersion']['gitVersion'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kubernetes_version(self) -> str:\n return pulumi.get(self, \"kubernetes_version\")",
"def get_kubernetes_version(self) -> str:\n return self.agentpool_context.get_kubernetes_version()",
"def version(self):\n response = self._request_call('/version')\n return response.version_etc... | [
"0.8395827",
"0.80358887",
"0.7644186",
"0.7464953",
"0.7238709",
"0.7092041",
"0.7062813",
"0.7057279",
"0.7053757",
"0.6968224",
"0.6942929",
"0.691921",
"0.6906722",
"0.69061214",
"0.69061214",
"0.69061214",
"0.69061214",
"0.68964404",
"0.6856928",
"0.685459",
"0.67624676"... | 0.80908775 | 1 |
Returns a list of internal IPs for pod label keyvalue. | def GetPodIpsByLabel(self, pod_label_key, pod_label_value) -> List[str]:
get_cmd = [
'get', 'pods', '-l', f'{pod_label_key}={pod_label_value}',
'-o', 'jsonpath="{.items[*].status.podIP}"'
]
stdout, _, _ = RunKubectlCommand(get_cmd)
return yaml.safe_load(stdout).split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vtep_ip_by_label(cls, client_object, label=None):\n nsxa_socket = cls._get_nsxa_socket(client_object)\n cmd = '%s -t %s vtep/ip %%s' % (cls.CLI, nsxa_socket)\n out = client_object.connection.request(\n cmd % label).response_data.strip()\n return utilities.parse_one_li... | [
"0.6113082",
"0.585317",
"0.5720467",
"0.5680065",
"0.56223416",
"0.5590654",
"0.55022794",
"0.5494343",
"0.54173976",
"0.53476995",
"0.5326529",
"0.53250027",
"0.5322293",
"0.5318085",
"0.5317993",
"0.53083104",
"0.5304638",
"0.5277291",
"0.52722144",
"0.5264067",
"0.5259539... | 0.7938073 | 0 |
Returns a list of internal IPs for a pod name. | def GetPodIps(self, resource_name) -> List[str]:
pod_label = self.GetPodLabel(resource_name)
return self.GetPodIpsByLabel('app', pod_label) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIp(name):\n tmp = []\n ips = socket.getaddrinfo(socket.gethostbyname(name), None)\n for x in ips:\n tmp.append(x[4][0])\n\n return tmp",
"def GetPodIpsByLabel(self, pod_label_key, pod_label_value) -> List[str]:\n get_cmd = [\n 'get', 'pods', '-l', f'{pod_label_key}={pod_label_... | [
"0.6113722",
"0.601818",
"0.5923492",
"0.5780895",
"0.5604258",
"0.56040365",
"0.5596801",
"0.55730903",
"0.55714744",
"0.54942536",
"0.5443782",
"0.5414098",
"0.5366203",
"0.5362108",
"0.53559136",
"0.5355176",
"0.5332514",
"0.5312457",
"0.5310071",
"0.5298205",
"0.52925307"... | 0.6681659 | 0 |
Propagate cluster labels to disks if not done by cloud provider. | def LabelDisks(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_persistent_disk(cfg: ElasticBlastConfig, pv_claim: str) -> None:\n\n use_local_ssd = cfg.cluster.use_local_ssd\n if use_local_ssd:\n return\n dry_run = cfg.cluster.dry_run\n cluster_name = cfg.cluster.name\n labels = cfg.cluster.labels\n get_pv_cmd = f'kubectl --context={cfg.apps... | [
"0.5655921",
"0.55940586",
"0.55828804",
"0.5317993",
"0.52317697",
"0.5161696",
"0.51440793",
"0.51390153",
"0.51169956",
"0.50761366",
"0.50430274",
"0.50348717",
"0.5022141",
"0.50156945",
"0.4996066",
"0.49686968",
"0.49264735",
"0.49239495",
"0.49191502",
"0.49105495",
"... | 0.63466537 | 0 |
Creation of a Concrete Model, specify the countries and sectors to include. | def __init__(self, name, list_countries,list_sectors,EORA=False,list_fd_cats=[]):
self.name = name
self.m = ConcreteModel()
self.countries = list_countries
self.total_countries = len(list_countries)
self.sectors = list_sectors
self.fd_cat = list_fd_cats
if EORA is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, list_countries,list_sectors,list_products,EORA=False):\n self.name = name\n self.m = ConcreteModel()\n self.countries = list_countries\n self.total_countries = len(list_countries)\n self.sectors = list_sectors\n self.products = list_products\n ... | [
"0.65980375",
"0.6115216",
"0.60521024",
"0.60521024",
"0.5841461",
"0.5796191",
"0.5776145",
"0.5759838",
"0.5679484",
"0.5675039",
"0.56530035",
"0.5645545",
"0.5587381",
"0.5587381",
"0.5583217",
"0.55089647",
"0.5472968",
"0.5442799",
"0.5441474",
"0.54327494",
"0.5407337... | 0.6731116 | 0 |
Creation of the various sets. First step in futureproofing by allowing for own specification of set inputs | def create_sets(self,FD_SET=[],VA_SET=[]):
self.m.S = Set(initialize=self.sectors, doc='sectors')
if self.EORA is True:
self.m.rROW = Set(initialize=self.countries+['ROW'],ordered=True, doc='regions including export')
self.m.R = Set(initialize=self.countries+['ROW'],ord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sets(self,FD_SET=['FinalD'],VA_SET=['VA']):\n \n self.m.S = Set(initialize=self.sectors, doc='sectors')\n self.m.P = Set(initialize=self.products, doc='sectors')\n self.m.row = Set(initialize=self.products, doc='products')\n self.m.col = Set(initialize=self.sectors+['Fi... | [
"0.7269195",
"0.70846754",
"0.6966505",
"0.6862444",
"0.6711511",
"0.66443616",
"0.65083945",
"0.6500139",
"0.64809215",
"0.6390493",
"0.6369238",
"0.63592",
"0.63468754",
"0.6299586",
"0.6296398",
"0.6234673",
"0.6229027",
"0.6180678",
"0.6166481",
"0.61655724",
"0.6160924",... | 0.71817625 | 1 |
Creation of a Concrete Model, specify the countries and sectors to include. | def __init__(self, name, list_countries,list_sectors,list_products,EORA=False):
self.name = name
self.m = ConcreteModel()
self.countries = list_countries
self.total_countries = len(list_countries)
self.sectors = list_sectors
self.products = list_products
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, list_countries,list_sectors,EORA=False,list_fd_cats=[]):\n self.name = name\n self.m = ConcreteModel()\n self.countries = list_countries\n self.total_countries = len(list_countries)\n self.sectors = list_sectors\n self.fd_cat = list_fd_cats\n ... | [
"0.6729286",
"0.6117291",
"0.6055186",
"0.6055186",
"0.58447504",
"0.57970774",
"0.57735735",
"0.5762032",
"0.56828696",
"0.5678722",
"0.565657",
"0.56491655",
"0.5591153",
"0.5591153",
"0.5584743",
"0.55133826",
"0.5472958",
"0.54413676",
"0.5441104",
"0.5434535",
"0.5409416... | 0.6596541 | 1 |
Creation of the various sets. First step in futureproofing by allowing for own specification of set inputs | def create_sets(self,FD_SET=['FinalD'],VA_SET=['VA']):
self.m.S = Set(initialize=self.sectors, doc='sectors')
self.m.P = Set(initialize=self.products, doc='sectors')
self.m.row = Set(initialize=self.products, doc='products')
self.m.col = Set(initialize=self.sectors+['FinalD'], do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sets(self,FD_SET=[],VA_SET=[]):\n \n self.m.S = Set(initialize=self.sectors, doc='sectors')\n\n if self.EORA is True:\n self.m.rROW = Set(initialize=self.countries+['ROW'],ordered=True, doc='regions including export')\n self.m.R = Set(initialize=self.countries+... | [
"0.71817625",
"0.70846754",
"0.6966505",
"0.6862444",
"0.6711511",
"0.66443616",
"0.65083945",
"0.6500139",
"0.64809215",
"0.6390493",
"0.6369238",
"0.63592",
"0.63468754",
"0.6299586",
"0.6296398",
"0.6234673",
"0.6229027",
"0.6180678",
"0.6166481",
"0.61655724",
"0.6160924"... | 0.7269195 | 0 |
Return the 'index'th row of 'dataframe' as a json formated string. If 'index' is not set or out of bounds, and random row is extracted. | def get_data(dataframe,index=None):
dflen = len(dataframe)
if index==None or index <0 or index >= dflen:
index = randint(0,dflen)
return dataframe.iloc[index].to_json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(self, index):\n return self.data[index]",
"def getFullRow(self, index):\n try:\n if len(self.data[index]) < self._numAttributes:\n for _ in range(self._numAttributes - len(self.data[index])):\n self.data[index].append(\"?\")\n return s... | [
"0.6068886",
"0.60570145",
"0.5906256",
"0.5666757",
"0.5661534",
"0.5657486",
"0.5640169",
"0.5581918",
"0.5570035",
"0.55100304",
"0.54547685",
"0.5436924",
"0.5345558",
"0.530197",
"0.52809733",
"0.52729195",
"0.5257552",
"0.52377063",
"0.5232783",
"0.51719755",
"0.5161334... | 0.813588 | 0 |
helper function to resize list of np.ndarray (of possibly different size) to single np array of same size this is the same as BaseRuntime implementation, apart from h,w is flipped | def resize_batch(images : List[np.ndarray], size : Tuple[int,int,int,int], resize_kind='stretch') :
assert resize_kind in ['stretch'] and len(size) == 4
n, w, h, c = size if size[-1]==3 else tuple(size[i] for i in [0,3,1,2])
resize = lambda x: BaseRuntime.resize_stretch(x, (h,w))
dtype =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rescale_list(input_list, size):\n assert len(input_list) >= size\n\n # Get the number to skip between iterations.\n skip = len(input_list) // size\n\n # Build our new output.\n output = [input_list[i] for i in range(0, len(input_list), skip)]\n\n # Cut off the last one... | [
"0.6300138",
"0.60218877",
"0.6013021",
"0.59518075",
"0.590494",
"0.5904247",
"0.5885489",
"0.5868196",
"0.5867619",
"0.58000875",
"0.57988834",
"0.5798662",
"0.57796836",
"0.5768495",
"0.5766846",
"0.5737607",
"0.5733062",
"0.57244635",
"0.57115275",
"0.56909895",
"0.567602... | 0.6128532 | 1 |
general method used to catch all excetions and data will be pushed to database collection named "toolLogs". | def catchError(custom_message = ""):
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback_details = {
'filename': exc_traceback.tb_frame.f_code.co_filename,
'lineno' : exc_traceback.tb_lineno,
'name' : exc_trace... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InsertLog():",
"def handle_expt(self):\r\n self._perform_on_error_handling()",
"def capture_exception():\n\n pm_logger.exception()\n exc_type, exc_value, exc_tb = sys.exc_info()\n exc_type_string = \"%s.%s\" % (exc_type.__module__, exc_type.__name__)\n exc_message = trace... | [
"0.593624",
"0.5892892",
"0.58802086",
"0.57955354",
"0.57856095",
"0.57830316",
"0.5684273",
"0.56713235",
"0.5661387",
"0.5661387",
"0.5646596",
"0.5615816",
"0.56023955",
"0.5596205",
"0.5583035",
"0.55799824",
"0.5523463",
"0.55144167",
"0.54824084",
"0.54547745",
"0.5422... | 0.62309706 | 0 |
Retrieve a specific ComputedFile based on id | def get(cls, id):
response = get_by_endpoint("computed_files/" + str(id)).json()
return ComputedFile(**response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_file_by_id(id):\n query = \"\"\"SELECT * FROM files WHERE id = (:id) LIMIT 1\"\"\"\n param_obj = {'id': id}\n return _execute(query, param_obj)",
"def get(self, id):\n file = (\n self.drive.files()\n .get(\n fileId=id,\n fields=\"id, n... | [
"0.73165137",
"0.71252155",
"0.6588381",
"0.63902634",
"0.6368623",
"0.6328096",
"0.62992954",
"0.62487024",
"0.62190187",
"0.6027999",
"0.5947807",
"0.5940029",
"0.5884363",
"0.5835559",
"0.58202094",
"0.5755035",
"0.5751127",
"0.57255054",
"0.5697404",
"0.5682867",
"0.56813... | 0.81531876 | 0 |
Retrieve a list of a ComputedFiles based on filters | def search(cls, **kwargs):
response = get_by_endpoint("computed_files", params=kwargs)
return create_paginated_list(cls, response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFiles(folderToProcess,filter):\n\n print(f\"Parsing {folderToProcess} for {filter} files\")\n\n if debug:\n for path in Path(folderToProcess).rglob(filter):\n print(f\"Found {path}\")\n\n all_files = [str(x) for x in Path(folderToProcess).rglob(filter)] \n\n return all_files",
... | [
"0.6032228",
"0.59787583",
"0.5957626",
"0.59167165",
"0.5900297",
"0.5868409",
"0.5853663",
"0.5811124",
"0.5770118",
"0.5754977",
"0.5695007",
"0.5686319",
"0.56743115",
"0.56731695",
"0.5640479",
"0.5634058",
"0.5581332",
"0.5571417",
"0.5566547",
"0.5562618",
"0.55573756"... | 0.66918504 | 0 |
Extract a downloaded ComputedFile | def extract(self):
if not self._downloaded_path:
raise MissingFile(
"ComputedFile downloaded file",
"Make sure you have successfully downloaded the ComputedFile before extracting.",
)
shutil.unpack_archive(self._downloaded_path)
return sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_file(path):",
"def get(cls, id):\n response = get_by_endpoint(\"computed_files/\" + str(id)).json()\n return ComputedFile(**response)",
"def fetch_and_extract(self, filename):\n # type: (Text) -> None\n raise NotImplementedError(\"\")",
"def _get_file(self, path: str) ... | [
"0.63040125",
"0.62084115",
"0.6118856",
"0.60944897",
"0.6033456",
"0.59924144",
"0.587278",
"0.58520275",
"0.5850034",
"0.5793909",
"0.57621086",
"0.5755558",
"0.57465076",
"0.5709943",
"0.57038915",
"0.56752425",
"0.5671444",
"0.56653255",
"0.56499547",
"0.5649903",
"0.564... | 0.7806354 | 0 |
returns a list of all the words in a text file | def get_words_in_file(file_name):
lines = get_file_contents(file_name)
all_words = []
for line in lines:
# remove lines that don't have words on them
if len(line) < 2:
continue
line = line.rstrip() # removes \n at the end of each line
words = line.split()
for word in words:
all_words.append(word)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_words():\n fin = open('words.txt')\n words = []\n for line in fin:\n words.append(line.strip())\n fin.close()\n return words",
"def list_every_word(file_name): #considers file_name is valid\n file = open(file_name,\"r\")\n words = []\n lines = file.readlines()\n for lin... | [
"0.863126",
"0.8497349",
"0.84141356",
"0.8409366",
"0.8409366",
"0.83026415",
"0.82938933",
"0.8277904",
"0.8244133",
"0.8241008",
"0.8191392",
"0.8172519",
"0.81455857",
"0.80962086",
"0.8091399",
"0.8052953",
"0.80516386",
"0.80157393",
"0.7991412",
"0.79756093",
"0.796134... | 0.85146725 | 1 |
returns the count of all the words in a text file | def count_words_in_file(file_name):
return len(get_words_in_file(file_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_words(filename):",
"def count_all_words(file_name):\n\n return len(separate_words(file_name))",
"def countWords(filename):\n with open(filename) as f:\n filetext = f.read()\n #words = re.findall(r'\\w+', filetext)\n words = re.findall(r'[a-zA-Z]+', filetext)\n return Counter(wor... | [
"0.90988016",
"0.86225843",
"0.86089355",
"0.83327264",
"0.82748604",
"0.8272189",
"0.8270948",
"0.8215295",
"0.8179954",
"0.81773126",
"0.8176836",
"0.81614816",
"0.8109305",
"0.80865026",
"0.80798244",
"0.8017212",
"0.7990616",
"0.79747385",
"0.7921866",
"0.7807267",
"0.777... | 0.8639052 | 1 |
returns the number of instances of a specific word in a text file | def count_word_instances_in_file(file_name, target_word):
count = 0
words = get_words_in_file(file_name)
for word in words:
if target_word == word:
count += 1
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_words(filename):",
"def count_word(filename, word):\r\n try:\r\n with open(filename) as file_object:\r\n contents = file_object.read()\r\n word_count = contents.lower().count(word) \r\n except FileNotFoundError:\r\n print(filename + \" cannot be located.\")\r\n... | [
"0.7899055",
"0.7790551",
"0.7399148",
"0.7395679",
"0.7384632",
"0.7275049",
"0.7188693",
"0.7105297",
"0.70738155",
"0.7066065",
"0.6980979",
"0.6973252",
"0.6967786",
"0.6961732",
"0.6955081",
"0.6950795",
"0.6946879",
"0.6946561",
"0.69452226",
"0.69360536",
"0.68845963",... | 0.83717203 | 0 |
Prepares an appropriate form for submitting a rangebased action. | def action_form(is_check, is_raise, can_raise, min_raise, max_raise):
passive_label = "Check range:" if is_check else "Call range:"
aggressive_label = "Raise range:" if is_raise else "Bet range:"
total_label = "Raise total:" if is_raise else "Bet total:"
min_raise = min_raise if min_raise is not None el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare(self, form):\n \n return form",
"def custom_actions(self, form_entry, request=None):",
"def make_form(self):",
"def fill_snmp_form(form, values, action):\n return fill(form.fields, values)",
"def query_form_data(self) -> FlaskResponse: # pylint: disable=no-self-use\n fo... | [
"0.5551753",
"0.5532377",
"0.54118043",
"0.5324618",
"0.5296805",
"0.5258679",
"0.5237984",
"0.52162147",
"0.5154027",
"0.51244867",
"0.5119179",
"0.51000106",
"0.50560194",
"0.50414246",
"0.5030987",
"0.5027921",
"0.5025136",
"0.4859985",
"0.48374394",
"0.48359984",
"0.48339... | 0.6831189 | 0 |
Implements rosnode 'list' command. | def _rosnode_cmd_list(argv):
args = argv[2:]
parser = OptionParser(usage="usage: %prog list", prog=NAME)
parser.add_option("-u",
dest="list_uri", default=False,
action="store_true",
help="list XML-RPC URIs (NOT IMPLEMENTED)")
parser.add_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\n rino.remote.list()",
"def cmd_list(self):\n rc = self.socket_command('list', False)\n return rc",
"def node_list(ctx):\n nodes = ctx.obj['controller'].get_node_list()\n nodes = [[x] for x in nodes]\n click.echo(generate_table(['NODE'], nodes, sort='NODE', plain=ctx.obj['... | [
"0.7550291",
"0.7545568",
"0.7470477",
"0.69686663",
"0.69436765",
"0.69109154",
"0.69109154",
"0.6908013",
"0.68217045",
"0.67188054",
"0.665462",
"0.6633237",
"0.64921224",
"0.6446619",
"0.6434079",
"0.64329934",
"0.6424014",
"0.63714206",
"0.63631725",
"0.63051605",
"0.629... | 0.8447914 | 0 |
Prints rosnode usage information. return_error whether to exit with error code os.EX_USAGE | def _fullusage(return_error=True):
print("""rosnode is a command-line tool for printing information about ROS Nodes.
Commands:
\trosnode ping\ttest connectivity to node (NOT IMPLEMENTED)
\trosnode list\tlist active nodes
\trosnode info\tprint information about node (NOT IMPLEMENTED)
\trosnode machine\tlist nodes ru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage(rc, errmsg=\"\"):\n#-------------------------------------------------------------------------------\n print >> oss.stderr, __doc__\n if errmsg:\n print >> oss.stderr, \"\\nError:\\n\" + str(errmsg)\n oss.exit(rc)",
"def usage(rc, errmsg=\"\"):\n#-----------------------------------------... | [
"0.760142",
"0.75527257",
"0.74779075",
"0.7409786",
"0.7344159",
"0.7344159",
"0.7253893",
"0.70658344",
"0.70416176",
"0.7024929",
"0.6919596",
"0.68840885",
"0.688261",
"0.67912316",
"0.67818695",
"0.6766874",
"0.6751555",
"0.6730531",
"0.67121303",
"0.67121303",
"0.670630... | 0.86971813 | 0 |
Update rules within a rule group. Return the updated rules. | def update_rules(self: object,
body: dict,
cs_username: str = None # pylint: disable=W0613 # cs_username is deprecated
) -> dict:
# [PATCH] https://assets.falcon.crowdstrike.com/support/api/swagger.html#/custom-ioa/update-rules
return proc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_rules():\n update_all_rules()\n return \"OK\"",
"def process(self, update):\n result = []\n\n if not len(self.rules):\n return None\n\n for rule in self.rules:\n result.append(rule.execRule(self, update))\n\n return list(filter(bool, result))",
... | [
"0.7500256",
"0.6316725",
"0.6146902",
"0.60993135",
"0.5965254",
"0.58767503",
"0.57544386",
"0.5688828",
"0.56604654",
"0.56015664",
"0.5598214",
"0.5596868",
"0.55693585",
"0.5442221",
"0.5410944",
"0.5405828",
"0.5405475",
"0.54046834",
"0.54046834",
"0.5378236",
"0.53671... | 0.6493418 | 1 |
Find all rule groups matching the query with optional filter. | def query_rule_groups_full(self: object, parameters: dict = None, **kwargs) -> dict:
# [GET] https://assets.falcon.crowdstrike.com/support/api/swagger.html#/custom-ioa/query-rule-groups-full
return process_service_request(
calling_object=self,
endpoints=Endpoints,
ope... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_rule_groups(self: object, parameters: dict = None, **kwargs) -> dict:\n # [GET] https://assets.falcon.crowdstrike.com/support/api/swagger.html#/custom-ioa/query-rule-groupsMixin0\n return process_service_request(\n calling_object=self,\n endpoints=Endpoints,\n ... | [
"0.6365507",
"0.58081985",
"0.5709494",
"0.56875426",
"0.5620246",
"0.55781347",
"0.5544539",
"0.5535727",
"0.5494",
"0.5485372",
"0.53085405",
"0.5282406",
"0.5268068",
"0.52668947",
"0.52668947",
"0.5223275",
"0.52209496",
"0.52173746",
"0.5175661",
"0.5134365",
"0.5104614"... | 0.63991135 | 0 |
Infer which device this policy lives on by inspecting its parameters. If it has no parameters, the 'cpu' device is used as a fallback. | def device(self) -> torch.device:
for param in self.parameters():
return param.device
return get_device("cpu") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_device(self, conf: DictConfig) -> device:\n device = torch.device(conf.runner.device) if torch.cuda.is_available() else torch.device('cpu')\n\n return device",
"def get_device(arguments):\n\n # Checks if the GPU is available to be used and sets the .\n if arguments.gpu and torch.cud... | [
"0.69412386",
"0.66646093",
"0.66591114",
"0.658753",
"0.65754646",
"0.65753895",
"0.6566435",
"0.65325725",
"0.65285784",
"0.65114087",
"0.65114087",
"0.65114087",
"0.65114087",
"0.6486198",
"0.6486198",
"0.6486198",
"0.6486198",
"0.6486198",
"0.64849377",
"0.6465408",
"0.64... | 0.73743325 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.