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 |
|---|---|---|---|---|---|---|
Add one or more links to the menu links collection. | def add_links(self, *args):
for link in args:
self.add_link(link) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_link(self, **kwgs):\n self.links.append(kwgs)",
"def links(self, links):\n\n self.container['links'] = links",
"def links(self, links):\n self._links = links",
"def links(self, links):\n if links is None:\n raise ValueError(\"Invalid value for `links`, must not ... | [
"0.73592496",
"0.72956747",
"0.6941168",
"0.69123816",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.69015694",
"0.67823446",
"0.6446638",
"0.63709253",
"0.6358212",
"0.6212924",
... | 0.8036747 | 0 |
Add a view to the menu tree | def _add_view_to_menu(self, view):
self._add_menu_item(MenuView(view.name, view), view.category) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_view(self, view):\n # Add to views\n self._views.append(view)\n\n # If app was provided in constructor, register view with Flask app\n if self.app is not None:\n self.app.register_blueprint(view.create_blueprint(self))\n if view.is_menu:\n self._add_... | [
"0.72809106",
"0.7083871",
"0.6713048",
"0.67065996",
"0.665997",
"0.656862",
"0.6568591",
"0.650373",
"0.64664364",
"0.6376501",
"0.63577974",
"0.6311282",
"0.6241752",
"0.6241142",
"0.61784154",
"0.6142204",
"0.61220807",
"0.6109262",
"0.61089903",
"0.609636",
"0.60494685",... | 0.8479969 | 0 |
! Renders user page. Gets the currently authenticated user to display and add his/her competences. Displays the form for adding a competence. form The form for adding the user's competence. | def users_page(request):
if request.method == 'POST':
user = request.user
form = CompetenceForm(request.POST)
if form.is_valid():
form.instance.person = request.user
form.save()
# return redirect('user-page')
# competence = Competence.objects.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_new_user_form():\r\n return render_template('user-form.html')",
"def add_user_form():\n\n return render_template(\"add_user.html\", headline=\"Add New Blogly User\")",
"def add_user():\n\n return render_template('register-form.html')",
"def show_user_detail_form():\n\n return render_temp... | [
"0.66302705",
"0.6523123",
"0.6281098",
"0.62157583",
"0.61718553",
"0.61372375",
"0.59278387",
"0.5913561",
"0.5878333",
"0.58747965",
"0.5868361",
"0.5863985",
"0.5855513",
"0.576994",
"0.5756267",
"0.5705283",
"0.56708217",
"0.5656304",
"0.5601829",
"0.5593466",
"0.5573839... | 0.7923422 | 0 |
! Render main page with search results. Displays the main page with search results which are the vacancy cards with all the required info. add_list The list which gets the vacancies from other services. competence_list The competence list percent The percent parameters which shows whether the vacancy fits you. vacs The... | def search_results(request):
competencies = Competence.objects.all()
comp_user = request.user
comp_list_filer = []
comp_num = 0
for competence in competencies:
if competence.person == comp_user:
comp_list_filer.append((competence.title_of_competence, competence.level_of_competenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_results():\n\n\tuser_query = request.args.get(\"search\")\n\tsearch_activity = SearchActivity(user_id=session.get('user_id'), search_query=user_query, datetime = datetime.now())\n\n\tdb.session.add(search_activity)\n\tdb.session.commit()\n\tsearch_items_not_filtered_list = user_search(user_query)\n\tfound... | [
"0.6161342",
"0.5999555",
"0.59908456",
"0.58384055",
"0.58010125",
"0.5743552",
"0.57279676",
"0.57167953",
"0.5694214",
"0.56624436",
"0.5640085",
"0.56321853",
"0.5625539",
"0.5614104",
"0.5570825",
"0.5562445",
"0.5561555",
"0.555835",
"0.54716927",
"0.5470257",
"0.546811... | 0.791957 | 0 |
Initialize player with initial skills. | def __initSkills(self):
skills = self.teamparser.getPlayerSkills()
try:
skills = skills[(self.team, self.position)] #initial skills
except KeyError, err:
skills = []
raise TypeError, "Invalid Team/Position: " + self.team
for skill in skills:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetSkills(self):\r\n \"\"\" Reset the default attributes \"\"\"\r\n self.player['level'] = 1\r\n self.player['xp'] = 0\r\n self.player['credits'] = int(startCredits)\r\n self.player['popup'] = int(popupStatus)\r\n self.player['name'] = self.player.name\r\... | [
"0.66441405",
"0.62616307",
"0.6103922",
"0.60704607",
"0.5984646",
"0.5974035",
"0.5972956",
"0.5920967",
"0.59191483",
"0.5893052",
"0.58330375",
"0.58031964",
"0.57984424",
"0.57871443",
"0.5775477",
"0.5772137",
"0.5760124",
"0.57090324",
"0.569261",
"0.56771094",
"0.5668... | 0.72202 | 0 |
Initialize player with his picks. | def __initPicks(self):
picks = self.teamparser.getPlayerPicks()
try:
self.picks = picks[(self.team, self.position)] #players picks
except KeyError, err:
self.picks = []
raise TypeError, "Invalid Team/Position: " + self.team | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_player():\n global active_track_idx\n global track_last_slided_pos\n global track_last_paused_pos\n global track_total_play_time \n\n # INITIALIZE Player\n active_track_idx = -1\n cancel_update_play_time_loop()\n cancel_track_end_event_loop()\n track_status.set(\"---\")\n tra... | [
"0.6884577",
"0.6513735",
"0.6483426",
"0.64026976",
"0.63838255",
"0.63824165",
"0.63602155",
"0.6354291",
"0.6353228",
"0.6350858",
"0.6297863",
"0.62961894",
"0.62944204",
"0.62919915",
"0.624991",
"0.62254775",
"0.6221873",
"0.6197839",
"0.6139676",
"0.6126346",
"0.612509... | 0.74288225 | 0 |
Set the players movement. | def setMovement(self, movement):
self.ma = movement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_movement(self):",
"def _move(self, dx, dy):\n # horizontal velocity is dx, vertical velocity is dy\n self._player.set_velocity((dx, dy))",
"def move(self, p):\r\n self.position.setvalue(p)",
"def movement(self):",
"def move(self,x,y):\n self.pos.x = x\n self.pos.y ... | [
"0.7168324",
"0.713118",
"0.69156325",
"0.68838024",
"0.6857421",
"0.6846156",
"0.67566127",
"0.6728673",
"0.66751224",
"0.6668629",
"0.6647784",
"0.66257435",
"0.6579948",
"0.6578657",
"0.65438896",
"0.65333104",
"0.6495413",
"0.64810866",
"0.646134",
"0.6450361",
"0.6438607... | 0.7729088 | 0 |
Set the players strength. | def setStrength(self, strength):
self.st = strength | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strength(self, value: int):\n self._strength = value",
"def strength(self, strength):\n self._characterStrength = intToStrength[strength]\n if self._characterStrength == 'Health': self.characterHealth = 100\n elif self._characterStrength == 'Power': self.characterPower = 15\n ... | [
"0.7709192",
"0.7151182",
"0.7149471",
"0.69595134",
"0.6955204",
"0.69542503",
"0.68287134",
"0.67099065",
"0.65833145",
"0.6429088",
"0.6344868",
"0.62404734",
"0.6180489",
"0.61771923",
"0.60525155",
"0.602884",
"0.599069",
"0.59772205",
"0.5974587",
"0.59201777",
"0.58630... | 0.7839418 | 0 |
Set the players agility. | def setAgility(self, agility):
self.ag = agility | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_points(players):\n pass",
"def addAgility(self):\t\n\t\tself.agility += 1\n\t\tif self.agility > 10:\n\t\t\tself.agility = 10",
"def __add_players_spawns(self):\n # Werewolves\n self.__grid[self.__werewolves_start[0]][self.__werewolves_start[1]][\"werewolves\"] \\\n = sel... | [
"0.64619476",
"0.5974813",
"0.58572036",
"0.5838505",
"0.5767299",
"0.5742054",
"0.5728973",
"0.56840265",
"0.56714505",
"0.5633035",
"0.56120574",
"0.56076914",
"0.5600924",
"0.5550766",
"0.5505914",
"0.5502566",
"0.5472727",
"0.54698473",
"0.5447161",
"0.5443643",
"0.543995... | 0.62469506 | 1 |
Set the players armor value. | def setArmor(self, armor):
self.av = armor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_player_state(self, player):\n\n health_str = \"HP {0}/{1}\".format(int(player.health), int(player.max_health))\n self.health_label.element.text = health_str\n\n if player.armor is not None:\n armor_hp = int(player.armor.health)\n max_armor_hp = int(player.armor.ma... | [
"0.64061564",
"0.59360194",
"0.59290016",
"0.56689304",
"0.5441629",
"0.54194176",
"0.5381563",
"0.5381563",
"0.5374806",
"0.53710526",
"0.53614014",
"0.53501886",
"0.5346353",
"0.5327724",
"0.53240293",
"0.5308827",
"0.53075",
"0.53075",
"0.5305588",
"0.5303419",
"0.5276931"... | 0.78425336 | 0 |
> int Returns players costs. | def getCosts(self):
return self.costs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(self) -> float:",
"def cost(foods, foods_used):\n cost = 0.00\n for i, count in foods_used.items():\n cost += (foods[i]['serving_cost'] * count)\n return cost",
"def _calculate_costs(self):\n cost = 0\n cost += self._cost_route_fine()\n cost += self._cost_petrol()\... | [
"0.715212",
"0.6709893",
"0.6695885",
"0.669135",
"0.6688659",
"0.6661801",
"0.6611084",
"0.6575354",
"0.6575354",
"0.6538438",
"0.6503868",
"0.64907724",
"0.64563376",
"0.6455219",
"0.64488846",
"0.6423245",
"0.6419398",
"0.64004976",
"0.6389483",
"0.63875544",
"0.637959",
... | 0.6873076 | 1 |
> list Returns a list of all player skills. See pyBBSkill.BBSkill. | def getSkills(self):
return self.skills | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_skill_list(self):\n return [\n i.strip() for i in\n self.ansi_escape.sub('', check_output([BIN, 'list'])).split('\\n')\n ]",
"def data_skill_list(self):\n data_skill_list = []\n for skill in self.data_skill:\n if 'name' in skill.keys():\n ... | [
"0.77789354",
"0.72201234",
"0.7200818",
"0.7170593",
"0.7167288",
"0.7144829",
"0.7065746",
"0.6862136",
"0.6775424",
"0.66222405",
"0.65763843",
"0.6495369",
"0.6487568",
"0.645083",
"0.64182407",
"0.6328377",
"0.61917514",
"0.61423326",
"0.60695565",
"0.6047104",
"0.593278... | 0.7546291 | 1 |
Adding a number of touchdowns. | def addTouchdowns(self, number):
self.touchdowns += number
self.ssp += (number * __SSP_TOUCHDOWN__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multi_touch(self, points):\n if len(points) < 2:\n raise EnvironmentError(\"Need at least 2 points\")\n\n self.android_device_driver.send_motion_event(points[0],\n MotionEvent.ACTION_DOWN)\n\n medium_points = points[1:-1]\n for point in medium_po... | [
"0.6410019",
"0.60803634",
"0.5922031",
"0.5838873",
"0.57827616",
"0.5774716",
"0.5716002",
"0.5539994",
"0.5525225",
"0.53205305",
"0.524736",
"0.5124107",
"0.5112547",
"0.5092738",
"0.50853735",
"0.505566",
"0.49927524",
"0.49888572",
"0.49888572",
"0.49888572",
"0.4988857... | 0.8269817 | 0 |
Adding a number of completions. | def addCompletions(self, number):
self.completions += number
self.ssp += (number * __SSP_COMPLETION__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_gpt_completions():\n _increment_counter(\"gpt_completions\")",
"def add_many(self, count, *args, **kwargs):\n for idx in range(count):\n kw = {k: v[idx] for k, v in kwargs.items()}\n arg = () if not len(args) else args[idx]\n self.add(*arg, **kw)",
"def ... | [
"0.7036388",
"0.59186363",
"0.5836048",
"0.5596797",
"0.5527813",
"0.54738206",
"0.54519755",
"0.54369843",
"0.541016",
"0.541016",
"0.53719944",
"0.5357698",
"0.5339925",
"0.53249377",
"0.5321615",
"0.53152066",
"0.5314819",
"0.5307126",
"0.52951205",
"0.5288174",
"0.5243879... | 0.76030844 | 0 |
Adding a number of interceptions. | def addInterceptions(self, number):
self.interceptions += number
self.ssp += (number * __SSP_INTERCEPTION__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_many(self, count, *args, **kwargs):\n for idx in range(count):\n kw = {k: v[idx] for k, v in kwargs.items()}\n arg = () if not len(args) else args[idx]\n self.add(*arg, **kw)",
"def increment_number_served(self, numbers):\n\t\tself.number_served += numbers",
"def... | [
"0.63440615",
"0.61527723",
"0.58244026",
"0.56522334",
"0.5619547",
"0.55821234",
"0.55803514",
"0.54850674",
"0.5402",
"0.53676546",
"0.53664225",
"0.5341623",
"0.53301764",
"0.5306467",
"0.5300925",
"0.52936804",
"0.5289543",
"0.5283552",
"0.52623886",
"0.5232382",
"0.5225... | 0.8029194 | 0 |
> int Returns the number of caused casualties. | def getCasualties(self):
return self.casualties | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occurs(self) -> int:\n return self._occurs",
"def __numHeads(self):\n count = 1\n\n while (self.__coinFlip() == 1):\n count += 1\n return count",
"def addCasualties(self, number):\n self.casualties += number\n self.ssp += (number * __SSP_CASUALTY__)",
... | [
"0.61615974",
"0.61548567",
"0.6102373",
"0.60826445",
"0.6037719",
"0.5997485",
"0.58958644",
"0.58879924",
"0.5883311",
"0.5854218",
"0.58147615",
"0.579766",
"0.57895315",
"0.5769656",
"0.5769637",
"0.57637495",
"0.57197696",
"0.571867",
"0.57067",
"0.56936866",
"0.5681366... | 0.65333235 | 0 |
Adding a number of casualties. | def addCasualties(self, number):
self.casualties += number
self.ssp += (number * __SSP_CASUALTY__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCasualties(self):\n return self.casualties",
"def comply(self, counts):\n pass",
"def threes(dice):\n return sum([x for x in dice if x == 3])",
"def addCowWeight(list, cows):\r\n sum = 0.0\r\n for key in list:\r\n sum += cows[key]\r\n return sum",
... | [
"0.6208296",
"0.5390049",
"0.5363903",
"0.5341021",
"0.5328923",
"0.52360344",
"0.51885754",
"0.5157553",
"0.5156806",
"0.5020415",
"0.50171345",
"0.49978325",
"0.49969417",
"0.49969417",
"0.49925345",
"0.49781254",
"0.49718857",
"0.49669224",
"0.49357152",
"0.49299726",
"0.4... | 0.81291544 | 0 |
> int Returns the number of earned MVP awards. | def getMVPAwards(self):
return self.mvpawards | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_awarded(self, floor=None):\n if self.award_to in (\"individual_overall\", \"floor_overall\", \"dorm\"):\n # For overall prizes, it is only possible to award one.\n return 1\n \n elif self.award_to in (\"floor_dorm\", \"individual_dorm\"):\n # For dorm prizes, this is just the numb... | [
"0.6416264",
"0.6337798",
"0.6078525",
"0.6070558",
"0.6050751",
"0.6013443",
"0.6000904",
"0.59628725",
"0.59128845",
"0.590868",
"0.5906904",
"0.58636963",
"0.58580637",
"0.58382326",
"0.5780159",
"0.57746166",
"0.57746166",
"0.57746166",
"0.5734031",
"0.57163376",
"0.57015... | 0.6356103 | 1 |
Adding a number of MVP Awards. | def addMVPAwards(self, number):
self.mvpawards += number
self.ssp += (number * __SSP_MVP__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMVPAwards(self):\n return self.mvpawards",
"def add(self, states, actions, rewards, next_states, dones):\n assert len(states) == self.num_agents, 'ERROR> group states size mismatch'\n assert len(actions) == self.num_agents, 'ERROR> group actions size mismatch'\n assert... | [
"0.61265165",
"0.57455695",
"0.55548084",
"0.54876035",
"0.5444259",
"0.5348443",
"0.5315942",
"0.52942413",
"0.5251396",
"0.5241589",
"0.5185412",
"0.51815754",
"0.51787543",
"0.5119472",
"0.5110886",
"0.5063625",
"0.50448275",
"0.50270516",
"0.5008033",
"0.49999782",
"0.498... | 0.75747424 | 0 |
Gain a number of new niggling injuries. | def addNigglingInjury(self, number):
self.injury += number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def J (self, n):",
"def ngens(self):\n return 1",
"def test_twenty_rounds_joss_for_noncyclers(self):\n seed = 4\n match = axl.Match(\n (axl.FirstByJoss(), axl.AntiCycler()), turns=20, seed=seed\n )\n match.play()\n self.versus_test(\n axl.AntiCycl... | [
"0.6187792",
"0.600103",
"0.57108754",
"0.5682342",
"0.566876",
"0.56315416",
"0.5602613",
"0.5481354",
"0.5478897",
"0.54706854",
"0.54320294",
"0.5412855",
"0.5390383",
"0.5351051",
"0.534429",
"0.53177613",
"0.5313821",
"0.5296265",
"0.5289871",
"0.52859455",
"0.5210033",
... | 0.65779567 | 0 |
Add a newskill to the players list of skills. | def addSkill(self, newskill):
self.skills.append( newskill ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addSkill(self, skillName, maxLevel, creditStart, creditIncrement):\r\n self.skills[skillName] = SkillObject(skillName, maxLevel, creditStart, creditIncrement)\r\n self.orderedSkills.append(skillName)",
"def addSkill(skill, db, **kwargs):\n skill_data = db.execute(\n 'SELECT * FROM mys... | [
"0.74936",
"0.7302804",
"0.7260293",
"0.6880153",
"0.65211946",
"0.6501737",
"0.6126843",
"0.6107915",
"0.5938357",
"0.5916689",
"0.5907391",
"0.5876193",
"0.5863165",
"0.578554",
"0.5712432",
"0.5672942",
"0.56194305",
"0.56185836",
"0.56102777",
"0.5591866",
"0.5590392",
... | 0.8658494 | 0 |
> bool Checks if a given skill is valid for the player. | def isValidSkill(self, skill):
try:
skills = self.skillparser.getSkills()
skilldetails = skills[skill]
if skilldetails[1] in self.picks:
return True
else:
return False
except KeyError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkPlayerSkillExists(self, userid, skillName):\r\n if not isinstance(userid, int):\r\n userid = self.getUserIdFromSteamId(userid)\r\n self.execute(\"SELECT level FROM Skill WHERE UserID=? AND name=?\", userid, skillName)\r\n return bool( self.fetchone())",
"def requires_matc... | [
"0.7394698",
"0.6206403",
"0.61741734",
"0.6111237",
"0.5894406",
"0.5616227",
"0.56150854",
"0.5613188",
"0.5574354",
"0.55501664",
"0.5539028",
"0.54900765",
"0.5446474",
"0.5440643",
"0.5423603",
"0.5418668",
"0.5418457",
"0.54121983",
"0.53990597",
"0.5391631",
"0.5368901... | 0.8047101 | 0 |
Create a fake Options object for testing. Note that the returned object only provides access to the provided options values. There is no registration mechanism on this object. Code under test shouldn't care about resolving cmdline flags vs. config vs. env vars etc. etc. | def create_options(options, passthru_args=None, fingerprintable_options=None):
fingerprintable = fingerprintable_options or defaultdict(dict)
class FakeOptions(object):
def for_scope(self, scope):
# TODO(John Sirois): Some users pass in A dict of scope -> _FakeOptionValues instead of a
# dict of sc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testParseOptions(self):\n options = cli_test_lib.TestOptions()\n\n output_module = MockOutputModule()\n server_config.ServerArgumentsHelper.ParseOptions(options, output_module)\n\n with self.assertRaises(errors.BadConfigObject):\n server_config.ServerArgumentsHelper.ParseOptions(options, None)... | [
"0.6592457",
"0.6500611",
"0.6408008",
"0.6261256",
"0.62606627",
"0.6241025",
"0.61252075",
"0.60680246",
"0.60680246",
"0.6058753",
"0.6010663",
"0.59718144",
"0.5945146",
"0.59211415",
"0.590275",
"0.58848876",
"0.587975",
"0.5825693",
"0.579893",
"0.57809275",
"0.57769144... | 0.6683773 | 0 |
Returns a list of fingerprintable (option type, option value) pairs for the given scope. Note that this method only collects values for a single scope, NOT from all enclosing scopes as in the Options class! | def get_fingerprintable_for_scope(self, bottom_scope, include_passthru=False):
pairs = []
if include_passthru:
pu_args = self.passthru_args_for_scope(bottom_scope)
pairs.extend((str, arg) for arg in pu_args)
option_values = self.for_scope(bottom_scope)
for option_name, option_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_options(options, passthru_args=None, fingerprintable_options=None):\n fingerprintable = fingerprintable_options or defaultdict(dict)\n\n class FakeOptions(object):\n def for_scope(self, scope):\n # TODO(John Sirois): Some users pass in A dict of scope -> _FakeOptionValues instead of a\n #... | [
"0.6032837",
"0.57206696",
"0.54889756",
"0.5399676",
"0.53649104",
"0.5362223",
"0.53584826",
"0.5325002",
"0.5310102",
"0.5294651",
"0.5274094",
"0.5268435",
"0.5239358",
"0.52050084",
"0.5195042",
"0.51844776",
"0.5182056",
"0.5179435",
"0.51662195",
"0.5162545",
"0.509632... | 0.7801775 | 0 |
Gets the largest possible amplitude representable by a given sample width The formula is 2^(n1) 1 where n is the number of bits the first 1 is because the result is signed the second 1 is because the value is 0 based e.g. if n=3 then 2^(31)1 => 3 if n=4 then 2^(41)1 => 7 | def calculateMaxAmplitude(sampleWidth: int) -> int:
return 2 ** (sampleWidth * NUM_BITS_IN_A_BYTE - 1) - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkfrequency(inputgiven):\n data_size = 40000\n wav_file = wave.open(inputgiven, 'r')\n data = wav_file.readframes(data_size)\n wav_file.close()\n data = struct.unpack('{n}h'.format(n=data_size), data)\n print max(data)",
"def getNormalisedWidth( self, width ):\n\t\treturn int( self.waver... | [
"0.665759",
"0.61814004",
"0.6125938",
"0.61236525",
"0.59300905",
"0.5914083",
"0.5900648",
"0.58958656",
"0.5878462",
"0.5856483",
"0.57987416",
"0.57597476",
"0.57282406",
"0.5662221",
"0.56454945",
"0.5642162",
"0.5641904",
"0.55994546",
"0.5583797",
"0.55745655",
"0.5537... | 0.8331578 | 0 |
Output frames using the same parameters as this Wav | def outputFrames(self, frames: bytes, outputFN: str) -> None:
outWave = wave.open(outputFN, "w")
outWave.setparams(
[
self.nchannels,
self.sampleWidth,
self.frameRate,
len(frames),
self.comptype,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream_frames(video_capture):",
"def write_video(frames, filename, fps=20):\n \n # On Mac systems, copy ffmeg binaries to your PATH (http://ffmpegmac.net/)\n \n if platform.system() == 'Windows':\n err_str = 'Don\\'t know how to write a movie for %s platform' % platform.system()\n r... | [
"0.6546506",
"0.6398653",
"0.63754684",
"0.63245595",
"0.61990476",
"0.61445135",
"0.61210597",
"0.6068414",
"0.6063512",
"0.5967238",
"0.5961839",
"0.5925323",
"0.5919997",
"0.58821714",
"0.5870627",
"0.5870627",
"0.5870627",
"0.5870627",
"0.5870627",
"0.5870627",
"0.5841754... | 0.7252709 | 0 |
Gets the index in the frame list for the given time | def _getIndexAtTime(self, startTime: float) -> int:
return round(startTime * self.frameRate * self.sampleWidth) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_frameidx(self, fps):\n return int(self.hours * MIN_PER_H * S_PER_MIN * fps \\\n + self.minutes * S_PER_MIN * fps \\\n + self.seconds * fps \\\n + self.milliseconds // (100 / fps))",
"def timestep_idx(self, timestep):\n timestep = pd.to_d... | [
"0.7054845",
"0.6783032",
"0.657959",
"0.649517",
"0.6385905",
"0.6303458",
"0.626827",
"0.61946434",
"0.6028419",
"0.600086",
"0.5976669",
"0.58895767",
"0.58638656",
"0.5843955",
"0.5803436",
"0.577362",
"0.57635385",
"0.5718886",
"0.5686386",
"0.5670949",
"0.5649976",
"0... | 0.72265846 | 0 |
Build an AudioGenerator with parameters derived from a Wav or QueryWav | def fromWav(cls, wav: AbstractWav) -> "AudioGenerator":
return AudioGenerator(wav.sampleWidth, wav.frameRate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_audio_builder(_encode_queue, _app_config, _lock, _only_wav, _dump_sequencer_log):\n global sequence_builder\n WordNetCache._lock = _lock\n sequence_builder = SequenceBuilder(app_config=_app_config,\n encode_queue=_encode_queue,\n ... | [
"0.61170983",
"0.6047016",
"0.5824852",
"0.57329017",
"0.56791836",
"0.56745744",
"0.5672484",
"0.5632816",
"0.5611577",
"0.55961704",
"0.55796725",
"0.5570685",
"0.5484561",
"0.54663813",
"0.5406149",
"0.5401842",
"0.5399455",
"0.5349309",
"0.53475773",
"0.5336562",
"0.53358... | 0.7031771 | 0 |
Finds the nearest zero crossing, searching in one direction Can do a 'reverse' search by setting reverse to True. In that case, the sample list is searched from back to front. targetTime is the startTime if reverse=False and the endTime if reverse=True | def _findNextZeroCrossing(
startTime: float,
samples: Tuple[int, ...],
frameRate: float,
reverse: bool,
) -> Optional[float]:
zeroI = _getNearestZero(samples, reverse)
if zeroI is None:
zeroI = _getZeroThresholdCrossing(samples, reverse)
if zeroI is None:
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findNearestZeroCrossing(\n self, targetTime: float, timeStep: float = ZERO_CROSSING_TIMESTEP\n ) -> float:\n\n leftStartTime = rightStartTime = targetTime\n\n samplesPerStep = timeStep * self.frameRate\n if samplesPerStep < 2:\n raise errors.ArgumentError(\n ... | [
"0.6999155",
"0.59568244",
"0.59183306",
"0.5838276",
"0.577363",
"0.569039",
"0.56570524",
"0.5603086",
"0.55886364",
"0.54183924",
"0.5383854",
"0.5383606",
"0.53572553",
"0.53330415",
"0.52899903",
"0.52376866",
"0.5219681",
"0.51855856",
"0.51751965",
"0.51744354",
"0.516... | 0.716974 | 0 |
Returns a list of intervals, each one labeled 'keep' or 'delete' | def _computeKeepDeleteIntervals(
start: float,
stop: float,
keepIntervals: List[Tuple[float, float]] = None,
deleteIntervals: List[Tuple[float, float]] = None,
) -> List[Tuple[float, float, str]]:
if keepIntervals and deleteIntervals:
raise errors.ArgumentError(
"You cannot speci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_intervals(self, intervals, simplify=True, record_provenance=True):\n tables = self.dump_tables()\n tables.keep_intervals(intervals, simplify, record_provenance)\n return tables.tree_sequence()",
"def delete_intervals(self, intervals, simplify=True, record_provenance=True):\n ... | [
"0.6381332",
"0.6008828",
"0.58163404",
"0.5717993",
"0.5708518",
"0.5695179",
"0.56371427",
"0.5585018",
"0.55599874",
"0.54790545",
"0.54719436",
"0.5403952",
"0.5388549",
"0.53085476",
"0.5296689",
"0.52775645",
"0.5258872",
"0.51756686",
"0.5153444",
"0.513539",
"0.513220... | 0.6803382 | 0 |
Generate a flask server. | def make_server() -> Flask:
app: Flask = Flask(__name__)
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flask_server():\n return 'http://localhost:5000'",
"def run_server():\n app = init_app()\n app.run(host=app.config['HOST'], port=app.config['PORT'])",
"def init():\n server = Flask(__name__)\n \n return server",
"def flask_server(real_model):\n def run_app(port):\n ... | [
"0.7725426",
"0.74924284",
"0.7400841",
"0.7311307",
"0.7267347",
"0.71777993",
"0.7129913",
"0.7076276",
"0.70508975",
"0.7045996",
"0.7012823",
"0.6981721",
"0.68616796",
"0.68501663",
"0.68371254",
"0.68179923",
"0.6806177",
"0.680467",
"0.67978334",
"0.6772853",
"0.673436... | 0.81040865 | 0 |
Function for setting up hoist on an app. | def add_hoist(self, app: Flask, handle_errors: bool = True, auth: list = [""], premade_pages: bool = True) -> Flask:
if hasattr(app, 'HOIST_INTERNALSERVER'):
raise HoistExistsError('hoist is already set up on app')
app.HOIST_INTERNALSERVER = Server(app, handle_errors)
@app.route('/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_app(app, hive_setting):\n global about\n about = About(app, hive_setting)\n app.register_blueprint(blueprint)",
"def init_app(app, hive_setting):\n # global scripting\n # scripting = Scripting(app=app, hive_setting=hive_setting)\n app.register_blueprint(blueprint)",
"def init_app(app... | [
"0.6373233",
"0.6173054",
"0.6173054",
"0.5939405",
"0.5933032",
"0.5818298",
"0.58132255",
"0.58080477",
"0.56636417",
"0.5651495",
"0.5648509",
"0.5567701",
"0.5566128",
"0.5564374",
"0.553212",
"0.54755706",
"0.545845",
"0.54438645",
"0.5426669",
"0.54038495",
"0.5375148",... | 0.6345041 | 1 |
Function for setting up a hoist proxy on an app. | def add_proxy(self, app: Flask, handle_errors: bool = True, auth: list = [""]) -> Flask:
raise NotImplemented('proxys are not yet supported')
if hasattr(app, 'HOIST_INTERNALPROXY'):
raise HoistExistsError('hoist is already set up on app')
app.HOIST_INTERNALPROXY = HoistProxy(app, h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hoist(self, app: Flask, handle_errors: bool = True, auth: list = [\"\"], premade_pages: bool = True) -> Flask:\n if hasattr(app, 'HOIST_INTERNALSERVER'):\n raise HoistExistsError('hoist is already set up on app')\n\n app.HOIST_INTERNALSERVER = Server(app, handle_errors)\n\n ... | [
"0.5974772",
"0.5644863",
"0.5587678",
"0.55734426",
"0.55438834",
"0.54780686",
"0.544415",
"0.5442074",
"0.5438981",
"0.5438981",
"0.54374284",
"0.5357864",
"0.534319",
"0.52833265",
"0.5277465",
"0.52770686",
"0.5252061",
"0.52485543",
"0.52338004",
"0.5226942",
"0.5226059... | 0.7220567 | 0 |
Function for running a flask app with a thread. | def thread_server(self, app: Flask, ip: str, port: int) -> Flask:
server: Thread = Thread(target = self.run_server, args = (app, ip, port))
server.start()
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(debug, threaded, host, port):\n \n HOST, PORT = host, port\n print \"running on %s:%d\" % (HOST, PORT)\n app.run(host=HOST, port=PORT, debug=debug, threaded=threaded)",
"def run(debug, threaded, host, port):\r\n\r\n HOST, PORT = host, port\r\n print(\"running on %s:%d\" % (H... | [
"0.7175091",
"0.71026933",
"0.708844",
"0.708844",
"0.708844",
"0.708844",
"0.708844",
"0.708844",
"0.708844",
"0.7080741",
"0.7080741",
"0.70706445",
"0.69488204",
"0.6924091",
"0.68434423",
"0.67426664",
"0.66715854",
"0.6625805",
"0.6581537",
"0.65777326",
"0.65772414",
... | 0.757574 | 0 |
Get the move for the given engine and color. Check validity of the move. | def get_move(board, engine, color, move_num, time, **kwargs):
legal_moves = board.get_legal_moves(color)
if not legal_moves:
return None
elif len(legal_moves) == 1:
return legal_moves[0]
else:
try:
move = engine.get_move(copy.deepcopy(board), color, move_num, time[co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_move(board, engine, color, move_num, time, **kwargs):\n legal_moves = board.get_legal_moves(color)\n\n if not legal_moves:\n return None\n elif len(legal_moves) == 1:\n return legal_moves[0]\n else:\n try:\n move = engine.get_move(copy.deepcopy(board), color, mov... | [
"0.7830646",
"0.73871523",
"0.65856457",
"0.64223164",
"0.6086268",
"0.602455",
"0.59717345",
"0.59675634",
"0.59641623",
"0.59008396",
"0.5896429",
"0.58737993",
"0.58548576",
"0.5846879",
"0.5806216",
"0.5797129",
"0.57966024",
"0.5773774",
"0.5763558",
"0.57583654",
"0.575... | 0.7831866 | 0 |
function to get a list of rsids and chromosome numbers | def get_rsids(input_file: str) -> list:
column_names: list = ["rsid", "chr"]
# catching the error if the file does not have the column names
try:
rsid_file: pd.DataFrame = pd.read_csv(input_file, usecols=column_names)
except KeyError:
print("The expected header was not found within the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIDs():",
"def get_RSOPuidsByRoi(rts):\n \n RSOPuidsByRoi = []\n \n roiCntSeqs = rts.ROIContourSequence\n \n for r in range(len(roiCntSeqs)):\n cntSeqs = roiCntSeqs[r].ContourSequence\n \n # Initialise the list of ReferencedSOPInstanceUIDs for this ROI:\n RSOPu... | [
"0.63581735",
"0.61864585",
"0.6182336",
"0.5998185",
"0.59294564",
"0.59235895",
"0.5898394",
"0.57552207",
"0.575061",
"0.57460576",
"0.5702741",
"0.56992364",
"0.5642003",
"0.56264406",
"0.5624463",
"0.56141466",
"0.5597766",
"0.5588504",
"0.55786145",
"0.5577533",
"0.5560... | 0.64786863 | 0 |
Permute labels of l2 to match l1 as much as possible | def best_map(l1, l2):
if len(l1) != len(l2):
print("L1.shape must == L2.shape")
exit(0)
label1 = np.unique(l1)
n_class1 = len(label1)
label2 = np.unique(l2)
n_class2 = len(label2)
n_class = max(n_class1, n_class2)
G = np.zeros((n_class, n_class))
for i in range(0,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_map(l1, l2):\n if len(l1) != len(l2):\n print(\"L1.shape must == L2.shape\")\n exit(0)\n\n label1 = np.unique(l1)\n n_class1 = len(label1)\n\n label2 = np.unique(l2)\n n_class2 = len(label2)\n\n n_class = max(n_class1, n_class2)\n G = np.zeros((n_class, n_class))\n\n ... | [
"0.7047975",
"0.59920067",
"0.5903628",
"0.5840224",
"0.56918395",
"0.5676302",
"0.5490699",
"0.54621464",
"0.54600734",
"0.5444879",
"0.542543",
"0.53949237",
"0.5379088",
"0.53709126",
"0.53610796",
"0.528245",
"0.5277736",
"0.5275124",
"0.52157223",
"0.5203912",
"0.5203912... | 0.71196675 | 0 |
Returns the dataframe with addmission type compressed so that emergency and urgent are both marked as urgent. | def compressing_admission_type(data):
data.admission_type = data.admission_type.apply(lambda x: 'EMERGENCY' if x
== 'URGENT' else x)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compressing_admit_location(data):\n\n data.admission_location = data.admission_location.apply(lambda x: 'ER_ADMIT'\n if (x == 'EMERGENCY ROOM ADMIT ')\n else x)\n\n data.admission_locatio... | [
"0.5149244",
"0.50546837",
"0.49958882",
"0.4830463",
"0.4723932",
"0.47156888",
"0.4679146",
"0.4667776",
"0.46540812",
"0.4605586",
"0.45829055",
"0.45716822",
"0.45474523",
"0.45360693",
"0.45358104",
"0.44724402",
"0.44665602",
"0.44596526",
"0.44342184",
"0.44335726",
"0... | 0.65143573 | 0 |
Returns a dataframe with ages compressed into categorical groups. | def age_to_cat(data):
data['age'] = data.apply(assign_cats, axis=1)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _age_bins(df):\n df['age_9'] = (\n df[[f'age_{g}_{a}'\n for g in ('male', 'female')\n for a in (4, 9)]].sum(axis=1))\n df['age_19'] = (\n df[[f'age_{g}_{a}'\n for g in ('male', 'female')\n for a in (14, 17, 19)]].sum(axis=1))\n df['age_29'] = (... | [
"0.63006103",
"0.6074821",
"0.5858649",
"0.5727977",
"0.5541528",
"0.55379224",
"0.5417069",
"0.53265554",
"0.5184373",
"0.5131714",
"0.5131714",
"0.51303464",
"0.50749356",
"0.5053229",
"0.50340205",
"0.5017828",
"0.501695",
"0.49977216",
"0.4987606",
"0.49444175",
"0.491782... | 0.6118041 | 1 |
Returns the dataframe with ethnicity compressed into only the majority groups, WHITE, ASIAN, HISPANIC/LATINO, BLACK_AFRICAN/OTHER and OTHER/UNKOWN. | def compressing_ethnicity(data):
data.ethnicity = data.ethnicity.apply(lambda x: 'WHITE'
if ("WHITE" in x) else x)
data.ethnicity = data.ethnicity.apply(lambda x: "ASIAN"
if ("ASIAN" in x) else x)
data.ethnicity = data.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories(df):\n print 'going to code categories'\n print_time()\n\n ethnicities = ['Mexican', 'Italian', 'American']\n df['num_categories'] = 0\n for ethnicity in ethnicities:\n df.loc[df['categories'].str.contains(ethnicity, flags=re.I, na=False, case=False), 'category'] = ethnicity\n ... | [
"0.5341186",
"0.5316503",
"0.52776337",
"0.52562404",
"0.51598245",
"0.5094428",
"0.5088444",
"0.5017636",
"0.50078815",
"0.49480984",
"0.49448717",
"0.4937764",
"0.4870405",
"0.4847865",
"0.48402515",
"0.48117942",
"0.47928178",
"0.4764874",
"0.47402084",
"0.4731294",
"0.467... | 0.73783153 | 0 |
Returns the dataframe with marital status compressed to only LIFE_PARTNER, SINGLE, OTHER/UNKOWN. | def compressing_marital_status(data):
data.marital_status = data.marital_status.apply(lambda x: 'LIFE_PARTNER'
if (x == 'MARRIED') |
(x == 'LIFE PARTNER')
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllStatus(self) -> DataFrame:\n return self.writer.getAllStatus()",
"def read_elia_activated_energy_volumes(filename,status):\r\n df = pd.read_excel(filename,skiprows=2,parse_dates=False)\r\n df[\"Timestamp\"] = df[\"Date\"]+\" \"+df['Quarter'].map(lambda x: str(x)[:-9])\r\n pd.to_datetime... | [
"0.4965136",
"0.47967532",
"0.4701401",
"0.4634161",
"0.45349148",
"0.45303738",
"0.45190105",
"0.44369784",
"0.44259185",
"0.43993515",
"0.4398487",
"0.4366172",
"0.43481007",
"0.43333754",
"0.4299631",
"0.42878827",
"0.42877072",
"0.42802107",
"0.42802107",
"0.42614394",
"0... | 0.6573321 | 0 |
Returns the dataframe with admit location compressed to only ER_ADMIT, REFERRAL, TRANSFER, and OTHER/UNKNOWN. | def compressing_admit_location(data):
data.admission_location = data.admission_location.apply(lambda x: 'ER_ADMIT'
if (x == 'EMERGENCY ROOM ADMIT ')
else x)
data.admission_location = data.ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cardiac_arrest_patients(con) -> pd.DataFrame:\n combined_diagnoses = get_reason_for_admission(con)\n cardiacarrest = combined_diagnoses[\n (\n (combined_diagnoses['surgical'] == 1)\n & (combined_diagnoses['diagnosis'].str.contains(re_cardiacarrest_surg, na=False, ... | [
"0.5126708",
"0.48463076",
"0.47908324",
"0.4612375",
"0.45886907",
"0.45694908",
"0.45675093",
"0.45248556",
"0.44767952",
"0.44722673",
"0.4440027",
"0.44355112",
"0.4434323",
"0.44185796",
"0.4376863",
"0.4371849",
"0.43587345",
"0.43450913",
"0.4340943",
"0.43282348",
"0.... | 0.64302427 | 0 |
Returns the dataframe with the 6000 unique ICD9 codes reduced into 17 diagnoses categories based on standard definitions. A new column is created to contain diagnoses. | def compress_icd9_codes(data):
data.icd9_code = data.icd9_code.apply(lambda x: '.1' if 'V' in x else x)
data.icd9_code = data.icd9_code.apply(lambda x: '.8' if 'M' in x else x)
data.icd9_code = data.icd9_code.apply(lambda x: '.5' if 'E' in x else x)
data.icd9_code = data.icd9_code.apply(lambda x: x[:3]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dummify_diagnoses(df,unique_diag,diagnosis_col='Diagnosis_1'):\n header=unique_diag.tolist().append('patient_link')\n dummy_diag=pd.DataFrame(columns=header)\n\n for row in range(df.shape[0]):\n pat_diag=lower_errors(df.iloc[row][diagnosis_col]).split(' , ')\n # print(pat_diag)\n ... | [
"0.6540436",
"0.64982927",
"0.63286495",
"0.5763419",
"0.5753276",
"0.5722193",
"0.5579839",
"0.54484886",
"0.5376999",
"0.53520346",
"0.53453666",
"0.52551186",
"0.5247551",
"0.52435637",
"0.5228034",
"0.52043056",
"0.52031446",
"0.52030957",
"0.52011234",
"0.5195381",
"0.51... | 0.67526495 | 0 |
This will take the parsed file and write out the python classes for it and any of its included files. | def createClassFile( p ):
create_modules( p["package"] )
name = p["protocol"]["name"]
name.lower()
path = os.path.join( *p["package"].split( "." ) )
with open( "./%s/%s.py" % ( path, name ), "w" ) as f:
for i in p["imports"]:
createClassFile( i )
c = Klass( package=p["package"], includes=p["im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze(self):\n for f in self.files:\n tokenizer = Tokenizer(f)\n self.write_tokens(tokenizer)\n compilation_engine = CompilationEngine(tokenizer, f)\n compilation_engine.compile()\n self.write_syntax_tree(compilation_engine)\n compilati... | [
"0.60291487",
"0.5969035",
"0.5952592",
"0.59292203",
"0.5850286",
"0.5848573",
"0.57895297",
"0.57641435",
"0.5670383",
"0.563218",
"0.56036806",
"0.5602101",
"0.5512467",
"0.5472885",
"0.54719174",
"0.54622746",
"0.54340696",
"0.54271436",
"0.54252",
"0.5416181",
"0.5411878... | 0.6426552 | 0 |
Regularize alpha' and beta' to get alpha and beta. | def _get_alpha_beta(self):
alpha = tf.nn.softplus(self.alpha_prime)
beta = -alpha + tf.nn.softplus(self.beta_prime)
return alpha, beta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_alpha_beta(self, a, b):\n beta = a / b\n alpha = a * beta\n return alpha, beta",
"def getBeta(self, alpha):\n return 2.0*(2.0-alpha) + -4.0*np.sqrt(1.0-alpha)",
"def B(alpha, beta):\n return math.gamma(apha) * math.gamma(beta) / math.gamma(alpha + beta)",
"def B(alpha,... | [
"0.6881302",
"0.57053274",
"0.56613654",
"0.565913",
"0.565913",
"0.565913",
"0.5611329",
"0.5522475",
"0.54939735",
"0.5400471",
"0.53844523",
"0.5373884",
"0.5366616",
"0.5361639",
"0.53530854",
"0.53477436",
"0.53169733",
"0.5291241",
"0.52699775",
"0.5250733",
"0.5244091"... | 0.62813294 | 1 |
Computes the log det Jacobian, as per the paper. | def _inverse_log_det_jacobian(self, x):
alpha, beta = self._get_alpha_beta()
diff = x - self.x0
r = tf.linalg.norm(diff, axis=-1, keepdims=True)
h = 1. / (alpha + r)
h_prime = -(h ** 2)
beta_h = beta * h
log_det_jacobian = tf.reduce_sum(
(self.dim - 1) * tf.math.log1p(beta_h)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward_log_det_jacobian(self, x):\n d = self._compute_shared(x=x)\n relx = (x - d.x_k) / d.w_k\n relx = relx # tf.where(d.out_of_bounds, 0.5*tf.ones_like(x), relx)\n grad = (\n 2 * tf.math.log(d.s_k) +\n tf.math.log(d.d_kp1 * relx**2 + 2 * d.s_k * relx * (1 - relx) + # newln\n ... | [
"0.80300593",
"0.7394804",
"0.73900914",
"0.72244877",
"0.70630896",
"0.6860125",
"0.6753442",
"0.67231876",
"0.66373676",
"0.66373676",
"0.66373676",
"0.66373676",
"0.65847796",
"0.654238",
"0.6513903",
"0.6488694",
"0.6466396",
"0.6461488",
"0.6461488",
"0.644598",
"0.64187... | 0.7451525 | 1 |
Builds a deep flow of the specified type. | def _make_deep_flow(flow_type, flow_depth, flow_width, dim):
if flow_type not in ['maf', 'radial', 'affine']:
raise ValueError(f'Flow type {flow_type} is not maf, radial, or affine.')
if flow_type == 'maf':
return _make_maf_flow(flow_depth, flow_width)
elif flow_type == 'radial':
return _make_radial_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_node_type_with_flowrules (cls, type_iter, target, log):\n for obj in type_iter:\n if obj.id not in target:\n c_obj = target.add_node(deepcopy(obj))\n log.debug(\"Copy NFFG node: %s\" % c_obj)\n else:\n for p in obj.ports:\n if p.id not in target.network.node[obj... | [
"0.59155285",
"0.5603136",
"0.5450468",
"0.54186976",
"0.5205651",
"0.5181642",
"0.49135038",
"0.48851934",
"0.48439947",
"0.4814305",
"0.48012322",
"0.4797545",
"0.47965562",
"0.47371408",
"0.47015324",
"0.46939322",
"0.46512794",
"0.46494555",
"0.46481785",
"0.46470216",
"0... | 0.79175943 | 0 |
Builds a deep stack of radial flows. | def _make_radial_flow(dim, flow_depth):
bijectors = []
bijectors.append(tfp.bijectors.BatchNormalization())
for _ in range(flow_depth):
bijectors.append(ReversedRadialFlow(dim))
bijectors.append(tfp.bijectors.BatchNormalization())
return tfp.bijectors.Chain(list(reversed(bijectors))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_deep_flow(flow_type, flow_depth, flow_width, dim):\n if flow_type not in ['maf', 'radial', 'affine']:\n raise ValueError(f'Flow type {flow_type} is not maf, radial, or affine.')\n if flow_type == 'maf':\n return _make_maf_flow(flow_depth, flow_width)\n elif flow_type == 'radial':\n return _ma... | [
"0.5709303",
"0.56593513",
"0.5271387",
"0.52517676",
"0.5136963",
"0.5127356",
"0.5101479",
"0.50962454",
"0.50852436",
"0.50673264",
"0.5063419",
"0.50551564",
"0.5041631",
"0.50215495",
"0.5019181",
"0.5014093",
"0.5013853",
"0.4989534",
"0.49769366",
"0.49767402",
"0.4942... | 0.7035504 | 0 |
Builds a deep stack of affine flows. | def _make_affine_flow(dim, flow_depth):
bijectors = []
bijectors.append(tfp.bijectors.BatchNormalization())
for _ in range(flow_depth):
bijectors.append(
tfp.bijectors.Shift(tf.Variable(tf.zeros(dim), trainable=True)))
bijectors.append(
tfp.bijectors.ScaleMatvecDiag(
tf.Variabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_deep_flow(flow_type, flow_depth, flow_width, dim):\n if flow_type not in ['maf', 'radial', 'affine']:\n raise ValueError(f'Flow type {flow_type} is not maf, radial, or affine.')\n if flow_type == 'maf':\n return _make_maf_flow(flow_depth, flow_width)\n elif flow_type == 'radial':\n return _ma... | [
"0.59337586",
"0.5399486",
"0.5390985",
"0.5343883",
"0.53140175",
"0.51704687",
"0.5104873",
"0.50996596",
"0.5072876",
"0.50484717",
"0.5034771",
"0.50327533",
"0.5028579",
"0.50236404",
"0.4965254",
"0.4961731",
"0.49526247",
"0.49449387",
"0.4935633",
"0.49265182",
"0.492... | 0.6329806 | 0 |
function used to create suffixes for all word,tag pairs | def __wordsToSuffixes__(self):
suffixes = defaultdict(int)
for word, tag in self.getWordTagDict():
for suffix in self.getSuffixesForWord(word):
suffixes[(suffix, tag)] += 1
return suffixes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSuffixesForWord(self, word):\n suffixes = self.word_suffixes.get(word, False)\n if suffixes is not False:\n return suffixes\n suffixes = []\n if word.isalpha():\n boundary = min(5, len(word))\n for i in range(1, boundary):\n suffixe... | [
"0.69789803",
"0.64744955",
"0.64021295",
"0.63340497",
"0.61450887",
"0.6061978",
"0.59539205",
"0.5947468",
"0.5944209",
"0.5911151",
"0.582733",
"0.5802634",
"0.5780319",
"0.572288",
"0.5706446",
"0.5699643",
"0.56922",
"0.5691394",
"0.5691183",
"0.5689901",
"0.5635199",
... | 0.73820376 | 0 |
function used to create prefixes for all word,tag pairs | def __wordsToPrefixes__(self):
prefixes = defaultdict(int)
for word, tag in self.getWordTagDict():
for prefix in self.getPrefixesForWord(word):
prefixes[(prefix, tag)] += 1
return prefixes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _addPrefixes(data):\n prevTags = None\n newData = []\n\n for n, (token, tags) in enumerate(data):\n\n newTags = []\n\n for t in tags:\n p = \"B\" if ((prevTags is None) or (t not in prevTags)) else \"I\"\n newTags.append(\"%s-%s\" % (p, t))\n\n newData.append... | [
"0.73429704",
"0.66815627",
"0.6533916",
"0.6423588",
"0.6234334",
"0.6187238",
"0.6106463",
"0.61048114",
"0.6104211",
"0.6086887",
"0.60644424",
"0.6063431",
"0.6009029",
"0.6005014",
"0.5957649",
"0.5849945",
"0.582023",
"0.58040166",
"0.58022004",
"0.5770319",
"0.57546115... | 0.71576387 | 1 |
function used to generate suffixes for a given word | def getSuffixesForWord(self, word):
suffixes = self.word_suffixes.get(word, False)
if suffixes is not False:
return suffixes
suffixes = []
if word.isalpha():
boundary = min(5, len(word))
for i in range(1, boundary):
suffixes.append(word... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suffixes(word: str) -> Iterator[str]:\n if not word:\n return\n for i, _ in enumerate(word):\n yield word[i:]",
"def FindSuffix(self):\n self.numSuffixes = 0\n self.forceStress = 0\n resultslist = []\n for f in self.suffixes.finditer(self.wd):\n resu... | [
"0.7386224",
"0.7214886",
"0.7020202",
"0.68448174",
"0.65395445",
"0.65102875",
"0.64363563",
"0.637313",
"0.63590467",
"0.6350543",
"0.63384783",
"0.63234866",
"0.6239201",
"0.62335086",
"0.6231242",
"0.6175014",
"0.6174881",
"0.6156801",
"0.6153791",
"0.6138962",
"0.612318... | 0.7573023 | 0 |
function used to generate prefixes for a given word | def getPrefixesForWord(self, word):
prefixes = self.word_prefixes.get(word, False)
if prefixes is not False:
return prefixes
prefixes = []
if word.isalpha():
boundary = min(5, len(word))
for i in range(2, boundary):
prefixes.append(word... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefixes(s):\n output = ''\n for i in range(len(s) + 1):\n add = s[0:i]\n output += add\n return output",
"def replace_prefix(word, prefix):\r\n length_prefix = len(prefix)\r\n length_word = len(word)\r\n \r\n if length_prefix > length_word:\r\n return prefix\r\n\r\n... | [
"0.6942218",
"0.683397",
"0.6781327",
"0.6771648",
"0.6712492",
"0.6617514",
"0.66067314",
"0.65857637",
"0.6574446",
"0.65668625",
"0.650434",
"0.64508694",
"0.6390748",
"0.63864726",
"0.63603944",
"0.6359629",
"0.6357503",
"0.63356817",
"0.6329151",
"0.63057876",
"0.627801"... | 0.7233872 | 0 |
function to retrieve 2 previous tags for word in sentence | def __get_previous_tags__(self, tags):
if len(self.tags) == 0:
return None, None
if self.index == 1:
return BEGIN, tags[self.index-1]
elif self.index == 0:
return BEGIN, BEGIN
else:
return tags[self.index-2], tags[self.index-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_tag(self,sentence):\n tagged = self.brill_tagger.tag(sentence.split())\n tagged_sentence = \" \".join([nltk.tag.tuple2str(tok) for tok in tagged])\n print tagged_sentence\n\n tag_list = [(each.split(\"/\")[0],each.split(\"/\")[1]) for each in tagged_sentence.split()]\n re... | [
"0.6204437",
"0.61179423",
"0.6117627",
"0.60937554",
"0.60808796",
"0.6065707",
"0.60322285",
"0.6024134",
"0.5931161",
"0.5899085",
"0.5876507",
"0.58554846",
"0.5827743",
"0.5814774",
"0.581072",
"0.58079094",
"0.5801397",
"0.5755522",
"0.5753671",
"0.5709807",
"0.56989205... | 0.6646759 | 0 |
function to return tag set which are possible for a given word, according to tags which were observed in the data for that word. cutoff parameter determines how many tags will be returned at most. add_common determines if tags which were not obeserved for the word will be added to set. | def getPossibleTagSet(self, data, cutoff=None, add_common=False):
full_tag_set_size = data.getTagSetSize()
if cutoff is None:
cutoff = ceil(full_tag_set_size * DEFAULT_CUTOFF_FRACT)
elif cutoff >= full_tag_set_size:
return data.getTagSet()
word = self.getWord()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_from_word_edges(self, word: str) -> Set[str]:\n all_edges = set()\n\n for def_dict in self.word_dictionary[word]:\n processed_def = self.get_filtered_set_tokens(\n definition=def_dict[\"definition\"]\n )\n\n if self.drop_self_cycles:\n ... | [
"0.5789491",
"0.5776199",
"0.57674026",
"0.5759853",
"0.56918997",
"0.55795056",
"0.55754375",
"0.5563476",
"0.5506468",
"0.5406385",
"0.5379914",
"0.5298454",
"0.5290626",
"0.52878016",
"0.52353746",
"0.52101964",
"0.520336",
"0.51952004",
"0.5188733",
"0.5182906",
"0.513863... | 0.81583047 | 0 |
function used to split an iterable to N batches according to NUM_THREADS parameter used to split a process on a large set to smaller sets which will be run in threads | def split_iterable_to_batches(iterable):
iterable_length = len(iterable)
batch_size = int(ceil(iterable_length/NUM_THREADS))
for i in range(0, iterable_length, batch_size):
yield iterable[i:i + batch_size] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks_threads(li, n):\n\tindex = int(len(li) / n + 0.5)\n\tfor i in range(n-1):\n\t\tyield li[i*index:i*index + index]\n\tyield li[n*index - index:]",
"def batch(size, iterable):\r\n return list(xbatch(size, iterable))",
"def split_to_batches(iterable, n=1):\n l = len(iterable)\n for ndx in range... | [
"0.7614108",
"0.74475783",
"0.7290103",
"0.7189978",
"0.7147045",
"0.7137233",
"0.7051565",
"0.69337153",
"0.6914948",
"0.68700993",
"0.6837756",
"0.6820978",
"0.6749746",
"0.6698243",
"0.6698243",
"0.6698243",
"0.6667783",
"0.66328615",
"0.6627433",
"0.6591588",
"0.6583701",... | 0.77173144 | 0 |
function to split a calculation on an iterable set to seperate NUM_THREADS threads used to split gradient calculation and viterbi on entire dataset to smaller batches which run in parallel threads | def split_calculation_to_threads(iterable, func, args):
args_list = []
batches = list(split_iterable_to_batches(iterable))
for batch in batches:
temp = list(args)
temp.insert(0, batch)
args_list.append(tuple(temp))
with Pool(NUM_THREADS) as p:
results = p.starmap(func, ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop_threaded():\n nonlocal index, total\n nonlocal d_tree\n nonlocal fn_inputReadCallback\n nonlocal fn_analysisCallback\n nonlocal fn_outputWriteCallback\n nonlocal dret_inputSet\n nonlocal dret_analyze\n nonlocal dret_ou... | [
"0.6423797",
"0.6420414",
"0.6377233",
"0.63467634",
"0.63066",
"0.62989044",
"0.6188953",
"0.6165699",
"0.61038834",
"0.6097976",
"0.6086044",
"0.60721475",
"0.6052888",
"0.60257155",
"0.6006814",
"0.59992325",
"0.59987307",
"0.5990851",
"0.5955791",
"0.5950258",
"0.5926273"... | 0.72813725 | 0 |
function to validate the tagged competition file generated by model, is identical to original competition file when removing tags | def validateTaggedCompFile(comp_file, tagged_comp_file):
comp_data = SimpleDataReader(comp_file)
tagged_comp_data = SimpleDataReader(tagged_comp_file)
assert comp_data.getSentencesSize() == tagged_comp_data.getSentencesSize(), "Missing Sentences!"
mistakes = 0
for i in range(comp_data.getSentencesSi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_tags(self):\n test_files = glob.glob(INPUT_GI_PATH + '/gi_*.mdd')\n\n mdd.procall(test_files)\n\n data = self.read_full_file('node16p1.dat')\n if not self.check_for_tags(data):\n self.fail(\"Found header tag in data file\")\n\n data = self.read_full_file('n... | [
"0.5598545",
"0.5493406",
"0.5423309",
"0.5420384",
"0.5390964",
"0.5359352",
"0.5359352",
"0.5346071",
"0.5342391",
"0.5317892",
"0.5314947",
"0.5304241",
"0.5280131",
"0.5253318",
"0.5252958",
"0.5247392",
"0.52365345",
"0.52277553",
"0.52041465",
"0.5203192",
"0.5190546",
... | 0.7111754 | 0 |
Determine first number that generates a hash with the given prefix. | def md5_with_prefix(input, prefix, start_with=0):
md5_input = hashlib.md5(input)
for number in itertools.count(start_with):
md5 = md5_input.copy()
md5.update(str(number).encode('ascii'))
if md5.hexdigest().startswith(prefix):
return number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn(k):\n seen = set()\n for i in range(len(s)-k+1): \n val = (prefix[i+k] - prefix[i]*fac[k]) % MOD \n if val in seen: return True # rolling hash (ver. Monte Carlo)\n seen.add(val)\n return False",
"def find_prefixsum_index(self, p... | [
"0.63537276",
"0.62036",
"0.61238146",
"0.61238146",
"0.61238146",
"0.61238146",
"0.6032708",
"0.59841865",
"0.5956391",
"0.58020586",
"0.5776798",
"0.5745924",
"0.571987",
"0.57072127",
"0.56676674",
"0.5663591",
"0.5651302",
"0.5642183",
"0.56292266",
"0.56020457",
"0.55982... | 0.6745519 | 0 |
List all platform groups | def get(self):
return self.query(PlatformGroup) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_groups():\n return jsonify(admin.get_all_groups(current_app.scoped_session()))",
"def list_groups(self):\n return self.get_admin(\"groups\")",
"def groups(self):\n #return self.get('{}/groups'.format(ApiVersion.A1.value))\n return self.get('{}/groups'.format(ApiVersion.CM1.value))",... | [
"0.68230575",
"0.6745456",
"0.67188114",
"0.67183566",
"0.66820043",
"0.6664303",
"0.655608",
"0.65517473",
"0.6504185",
"0.64655936",
"0.6463842",
"0.6445459",
"0.6440731",
"0.6399825",
"0.63977414",
"0.6334661",
"0.63319683",
"0.63063276",
"0.6291134",
"0.62861246",
"0.6271... | 0.72675157 | 0 |
Create a new platform group | def post(self):
args = platform_group_arguments.parse_args()
platform_group = PlatformGroup(**args)
self.session.add(platform_group)
self.session.commit()
return platform_group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_group():\n groupname = request.get_json().get(\"name\")\n description = request.get_json().get(\"description\")\n grp = admin.create_group(current_app.scoped_session(), groupname, description)\n if grp:\n response = admin.get_group_info(current_app.scoped_session(), groupname)\n el... | [
"0.70539564",
"0.7010585",
"0.7010585",
"0.69507515",
"0.68371516",
"0.68168336",
"0.67621464",
"0.66609395",
"0.65966123",
"0.6564437",
"0.65399975",
"0.65343636",
"0.6531129",
"0.6464494",
"0.64521194",
"0.644507",
"0.64419746",
"0.6399733",
"0.6391645",
"0.63801545",
"0.63... | 0.7955074 | 0 |
Loads session object from options in a configuration file section. The session_kwargs will be passed directly to keystoneauth1 Session and will override the values loaded from config. Consult keystoneauth1 docs for available options. | def get_session(group, **session_kwargs):
return ks_loading.load_session_from_conf_options(
CONF, group, **session_kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(cls, filename: str):\n if not os.path.exists(filename):\n raise FileNotFoundError(f\"Указанный файл '{filename}' конфигурации сессии не найден\")\n\n # Read the config file\n session_config = SessionConfig()\n session_config._config_filename = filename\n ... | [
"0.6370659",
"0.60339874",
"0.5991928",
"0.58116955",
"0.5775069",
"0.57470316",
"0.564764",
"0.56452173",
"0.5629444",
"0.5588062",
"0.55372334",
"0.545806",
"0.5447498",
"0.5445671",
"0.54302424",
"0.5421576",
"0.5374764",
"0.5332886",
"0.53301954",
"0.53301954",
"0.5322873... | 0.6540114 | 0 |
Loads auth plugin from options in a configuration file section. The auth_kwargs will be passed directly to keystoneauth1 auth plugin and will override the values loaded from config. Note that the accepted kwargs will depend on auth plugin type as defined by [group]auth_type option. Consult keystoneauth1 docs for availa... | def get_auth(group, **auth_kwargs):
try:
auth = ks_loading.load_auth_from_conf_options(CONF, group,
**auth_kwargs)
except ks_exception.MissingRequiredOptions:
LOG.error('Failed to load auth plugin from group %s', group)
raise
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_auth_opts(conf, group, service_type=None):\n ks_loading.register_session_conf_options(conf, group)\n ks_loading.register_auth_conf_options(conf, group)\n CONF.set_default('auth_type', default='password', group=group)\n ks_loading.register_adapter_conf_options(conf, group)\n conf.set_def... | [
"0.57892317",
"0.56229365",
"0.5574044",
"0.54717857",
"0.5448292",
"0.53054255",
"0.5275161",
"0.51765996",
"0.51333886",
"0.5125494",
"0.50944304",
"0.5049857",
"0.50348556",
"0.5000134",
"0.49427214",
"0.49023804",
"0.4900094",
"0.4887436",
"0.48787495",
"0.4849195",
"0.48... | 0.6809341 | 0 |
Loads adapter from options in a configuration file section. The adapter_kwargs will be passed directly to keystoneauth1 Adapter and will override the values loaded from config. Consult keystoneauth1 docs for available adapter options. | def get_adapter(group, **adapter_kwargs):
return ks_loading.load_adapter_from_conf_options(CONF, group,
**adapter_kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_adapter_config(self):\n proxy = self.core.get_proxy('/')\n try:\n config = proxy.get('/adapters/' + self.adapter_name)\n return config\n except KeyError:\n return None",
"def set_adapter_config(config):\n if not isinstance(config, dict):\n ... | [
"0.59922737",
"0.55616415",
"0.5418735",
"0.53291434",
"0.52491",
"0.5221085",
"0.5214442",
"0.51421666",
"0.50582564",
"0.50537366",
"0.49490044",
"0.4938976",
"0.49134752",
"0.487292",
"0.4858089",
"0.48499215",
"0.48398662",
"0.48328328",
"0.48183888",
"0.4811639",
"0.4785... | 0.673449 | 0 |
Get an endpoint from an adapter. The adapter_kwargs will be passed directly to keystoneauth1 Adapter and will override the values loaded from config. Consult keystoneauth1 docs for available adapter options. | def get_endpoint(group, **adapter_kwargs):
result = get_adapter(group, **adapter_kwargs).get_endpoint()
if not result:
service_type = adapter_kwargs.get(
'service_type',
getattr(getattr(CONF, group), 'service_type', group))
endpoint_type = adapter_kwargs.get('endpoint_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_adapter_config(self):\n proxy = self.core.get_proxy('/')\n try:\n config = proxy.get('/adapters/' + self.adapter_name)\n return config\n except KeyError:\n return None",
"def get_adapter(group, **adapter_kwargs):\n return ks_loading.load_adapter_f... | [
"0.64198333",
"0.6112636",
"0.60666794",
"0.5826337",
"0.5776892",
"0.57080066",
"0.565453",
"0.5649414",
"0.5629215",
"0.5584997",
"0.54440343",
"0.54425573",
"0.5436947",
"0.5435537",
"0.54330575",
"0.5416111",
"0.5399212",
"0.53746885",
"0.5347526",
"0.5345667",
"0.5163407... | 0.6830363 | 0 |
Create auth plugin wrapping both user and service auth. When properly configured and using auth_token middleware, requests with valid service auth will not fail if the user token is expired. Ideally we would use the plugin provided by auth_token middleware however this plugin isn't serialized yet. | def get_service_auth(context, endpoint, service_auth):
# TODO(pas-ha) use auth plugin from context when it is available
user_auth = token_endpoint.Token(endpoint, context.auth_token)
return service_token.ServiceTokenAuthWrapper(user_auth=user_auth,
service_au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_auth(self, auth_uri, username, password): # pylint: disable=no-self-use\n return authentication.SASTokenAuth.from_shared_access_key(auth_uri, username, password)",
"def auth(self):\n return AuthManager(self)",
"def register_auth(self):\n\n # pylint: disable=missing-return-doc,... | [
"0.5491579",
"0.5472357",
"0.5434556",
"0.5322575",
"0.53010625",
"0.5250635",
"0.5228165",
"0.52093923",
"0.5183537",
"0.5166243",
"0.5149993",
"0.51365024",
"0.51117855",
"0.5093687",
"0.5093687",
"0.5087958",
"0.50836414",
"0.5082779",
"0.5018534",
"0.5008432",
"0.50054336... | 0.6576886 | 0 |
Register session and authrelated options Registers only basic auth options shared by all auth plugins. The rest are registered at runtime depending on auth plugin used. | def register_auth_opts(conf, group, service_type=None):
ks_loading.register_session_conf_options(conf, group)
ks_loading.register_auth_conf_options(conf, group)
CONF.set_default('auth_type', default='password', group=group)
ks_loading.register_adapter_conf_options(conf, group)
conf.set_default('vali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_opts():\n _register_api_opts()\n _register_db_opts()",
"def add_auth_opts(options, service_type=None):\n def add_options(opts, opts_to_add):\n for new_opt in opts_to_add:\n for opt in opts:\n if opt.name == new_opt.name:\n break\n ... | [
"0.6607029",
"0.61653936",
"0.60332906",
"0.5657959",
"0.55373776",
"0.552294",
"0.5479442",
"0.54483664",
"0.5426347",
"0.53914356",
"0.53523314",
"0.5235399",
"0.52281266",
"0.5205289",
"0.51972586",
"0.51221377",
"0.5098826",
"0.5094243",
"0.5043019",
"0.5042551",
"0.50265... | 0.6373836 | 1 |
Add auth options to sample config As these are dynamically registered at runtime, this adds options for most used auth_plugins when generating sample config. | def add_auth_opts(options, service_type=None):
def add_options(opts, opts_to_add):
for new_opt in opts_to_add:
for opt in opts:
if opt.name == new_opt.name:
break
else:
opts.append(new_opt)
opts = copy.deepcopy(options)
opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_auth_opts(conf, group, service_type=None):\n ks_loading.register_session_conf_options(conf, group)\n ks_loading.register_auth_conf_options(conf, group)\n CONF.set_default('auth_type', default='password', group=group)\n ks_loading.register_adapter_conf_options(conf, group)\n conf.set_def... | [
"0.667338",
"0.64628184",
"0.6089287",
"0.58291835",
"0.57456213",
"0.5612679",
"0.56000763",
"0.5594233",
"0.5493821",
"0.5414338",
"0.54052657",
"0.5396743",
"0.5367182",
"0.52925545",
"0.52918124",
"0.52757716",
"0.52467024",
"0.52238643",
"0.51919407",
"0.518778",
"0.5185... | 0.6891298 | 0 |
Toggles the infomail field in Onlineuser object | def toggle_infomail(request):
if request.is_ajax():
if request.method == 'POST':
request.user.infomail = not request.user.infomail
request.user.save()
return HttpResponse(status=200, content=json.dumps({'state': request.user.infomail}))
raise Http404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_jobmail(request):\n if request.is_ajax():\n if request.method == 'POST':\n request.user.jobmail = not request.user.jobmail\n request.user.save()\n\n return HttpResponse(status=200, content=json.dumps({'state': request.user.jobmail}))\n raise Http404",
"def... | [
"0.62338006",
"0.5970438",
"0.5821275",
"0.5793889",
"0.56367135",
"0.56040823",
"0.54553586",
"0.5432163",
"0.53502816",
"0.5339276",
"0.53326595",
"0.53326595",
"0.5331724",
"0.5324913",
"0.527716",
"0.5273758",
"0.52581966",
"0.5248645",
"0.5247283",
"0.5236965",
"0.522490... | 0.8057394 | 0 |
Toggles the jobmail field in Onlineuser object | def toggle_jobmail(request):
if request.is_ajax():
if request.method == 'POST':
request.user.jobmail = not request.user.jobmail
request.user.save()
return HttpResponse(status=200, content=json.dumps({'state': request.user.jobmail}))
raise Http404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_infomail(request):\n if request.is_ajax():\n if request.method == 'POST':\n request.user.infomail = not request.user.infomail\n request.user.save()\n\n return HttpResponse(status=200, content=json.dumps({'state': request.user.infomail}))\n raise Http404",
... | [
"0.6270449",
"0.5669173",
"0.5585548",
"0.555343",
"0.55495137",
"0.55313456",
"0.55053437",
"0.5502035",
"0.54168755",
"0.53954124",
"0.5379221",
"0.53549236",
"0.5352222",
"0.5332456",
"0.5301001",
"0.52917707",
"0.52809656",
"0.5271293",
"0.52669114",
"0.5261871",
"0.52404... | 0.81715626 | 0 |
The difference between plain_user_search and the other is exposing only id and name. | def api_plain_user_search(request):
if request.GET.get('query'):
users = search_for_plain_users(request.GET.get('query'))
return JsonResponse(users, safe=False)
return render_json(error=u'Mangler søkestreng') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_search_partial():\n username = request.args.get('search') or ''\n\n ret = []\n for user in User.query.filter(User.name.ilike(username + \"%\")):\n ret.append({\n \"id\": user.id,\n \"name\": user.name\n })\n return json.dumps(ret)",
"def search_use... | [
"0.7153319",
"0.6538987",
"0.63925016",
"0.63028264",
"0.6294686",
"0.6273909",
"0.6267887",
"0.62233007",
"0.61973494",
"0.6170636",
"0.61243373",
"0.61071986",
"0.61001164",
"0.6088135",
"0.6076058",
"0.6064127",
"0.6049083",
"0.6042824",
"0.60098755",
"0.59887075",
"0.5950... | 0.6853136 | 1 |
Prints every other item in sequence. | def everyotheritem(n):
print(n[1::2])
return(n[1::2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_other(seq):\n every_other = seq[::2]\n return every_other",
"def every_other(seq):\n return seq[::2]",
"def every_other(seq):\n seq = seq[::2]\n return seq",
"def e_seq():\n yield 2;\n for n in count(2, 2):\n yield 1\n yield n\n yield 1",
"def print_evens(n):\n print(... | [
"0.67592245",
"0.6604033",
"0.6525325",
"0.59878826",
"0.59219635",
"0.59175736",
"0.5881483",
"0.57112664",
"0.57045525",
"0.56148934",
"0.55368537",
"0.5527244",
"0.5519429",
"0.54997087",
"0.5485153",
"0.54672766",
"0.54497844",
"0.54383534",
"0.53987724",
"0.53545326",
"0... | 0.73784566 | 0 |
Select the fullscale values of the gyroscope from the given provided values | def gyro_scale_selection(self):
GYRO_SCALE = (LSM330_GYRO_DEFAULT | LSM330_GYRO_SCALE_2000)
bus.write_byte_data(LSM330_GYRO_ADDRESS, LSM330_CTRL_REG4_G, GYRO_SCALE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gyroscope(self):\n raw = self.read_raw()\n # Compensate values depending on the resolution\n factor = 0\n if self._gyro_range == GYRO_RANGE_250DPS:\n factor = _GYRO_SENSITIVITY_250DPS\n elif self._gyro_range == GYRO_RANGE_500DPS:\n factor = _GYRO_SENSITI... | [
"0.6476268",
"0.60761327",
"0.59181947",
"0.5740605",
"0.56659377",
"0.5642714",
"0.54681754",
"0.5465321",
"0.5385613",
"0.5307664",
"0.5235304",
"0.52343214",
"0.51984936",
"0.5194715",
"0.5164173",
"0.5156035",
"0.51070654",
"0.50962615",
"0.5094679",
"0.509257",
"0.507349... | 0.6345249 | 1 |
Read data back from LSM330_OUT_X_L_G(0x28), 2 bytes XAxis Mag LSB, XAxis Mag MSB | def readgyro(self):
data0 = bus.read_byte_data(LSM330_GYRO_ADDRESS, LSM330_OUT_X_L_G)
data1 = bus.read_byte_data(LSM330_GYRO_ADDRESS, LSM330_OUT_X_H_G)
xGyro = data1 * 256 + data0
if xGyro > 32767 :
xGyro -= 65536
"""Read data back from LSM330_OUT_Y_L_G(0x2A), 2 bytes
Y-Axis Mag LSB, Y-Axi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_magnetometer(self):\n data = self.mag.read_bytes(Register.OUT_X_L_M, 6)\n return lsm9ds1.to_vector(data)",
"def read_gyro(self):\r\n\t\tdata0 = bus.read_byte_data(L3DG20_DEFAULT_ADDRESS, L3DG20_REG_OUT_X_L)\r\n\t\tdata1 = bus.read_byte_data(L3DG20_DEFAULT_ADDRESS, L3DG20_REG_OUT_X_H)\r\n\t... | [
"0.65370625",
"0.6098071",
"0.6070389",
"0.60361487",
"0.5879142",
"0.5865109",
"0.58422726",
"0.5837195",
"0.58229584",
"0.5771828",
"0.57190835",
"0.5493885",
"0.5431597",
"0.5373591",
"0.53586006",
"0.5351768",
"0.5290464",
"0.5274608",
"0.5246518",
"0.5233826",
"0.5191351... | 0.66605854 | 0 |
Read data back from LSM330_OUT_X_L_A(0x28), 2 bytes XAxis Mag LSB, XAxis Mag MSB | def readaccl(self):
data0 = bus.read_byte_data(LSM330_ACCL_ADDRESS, LSM330_OUT_X_L_A)
data1 = bus.read_byte_data(LSM330_ACCL_ADDRESS, LSM330_OUT_X_H_A)
xAccl = data1 * 256 + data0
if xAccl > 32767 :
xAccl -= 65536
"""Read data back from LSM330_OUT_Y_L_M(0x2A), 2 bytes
Y-Axis Mag LSB, Y-Axi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_magnetometer(self):\n data = self.mag.read_bytes(Register.OUT_X_L_M, 6)\n return lsm9ds1.to_vector(data)",
"def read_acceleration(self):\n data = self.ag.read_bytes(Register.OUT_X_XL, 6)\n return lsm9ds1.to_vector_left_to_right_hand_rule(data)",
"def get_light_sensors(self)... | [
"0.6292134",
"0.61093265",
"0.6046865",
"0.5951739",
"0.59020424",
"0.58906746",
"0.5887905",
"0.5749123",
"0.56047714",
"0.551105",
"0.54300964",
"0.54177797",
"0.5411739",
"0.53821826",
"0.5339218",
"0.5283152",
"0.52742636",
"0.52548987",
"0.52476174",
"0.52301073",
"0.521... | 0.64557457 | 0 |
NODE generates a missingidentity message and SELF responds. | def test_incoming_missing_identity(self):
community = DebugCommunity.create_community(self._dispersy, self._my_member)
missing = DebugNode(community)
missing.init_socket()
missing.init_my_member()
node = DebugNode(community)
node.init_socket()
node.init_my_membe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_outgoing_missing_identity(self):\n community = DebugCommunity.create_community(self._dispersy, self._my_member)\n node = DebugNode(community)\n node.init_socket()\n node.init_my_member(candidate=False, identity=False)\n node.drop_packets()\n\n # NODE sends a messa... | [
"0.74775064",
"0.6636877",
"0.63363093",
"0.6295154",
"0.59223104",
"0.58052754",
"0.5758968",
"0.56116825",
"0.5479746",
"0.547219",
"0.5457771",
"0.543826",
"0.5415727",
"0.53859234",
"0.53766704",
"0.53607786",
"0.53590137",
"0.53589034",
"0.5356511",
"0.53152335",
"0.5276... | 0.78432083 | 0 |
NODE generates data and sends it to SELF, resulting in SELF asking for the missing identity. | def test_outgoing_missing_identity(self):
community = DebugCommunity.create_community(self._dispersy, self._my_member)
node = DebugNode(community)
node.init_socket()
node.init_my_member(candidate=False, identity=False)
node.drop_packets()
# NODE sends a message to SELF
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, username: str, current_key: Key, \n user_data: UserData = None, server_type=constants.LOCAL_SERVER, \n port=constants.LOCAL_PORT, auth_keys : tuple[PublicKey, PrivateKey] = None):\n self.username = username\n \n #Get the __init__ of Node class... | [
"0.59956884",
"0.58435893",
"0.5449365",
"0.5444657",
"0.54393643",
"0.5438327",
"0.54369813",
"0.53430873",
"0.53387535",
"0.53292567",
"0.53126484",
"0.5288606",
"0.52818483",
"0.52673703",
"0.525738",
"0.5243236",
"0.5233719",
"0.5204092",
"0.51981485",
"0.5169455",
"0.516... | 0.60745317 | 0 |
Table function a la R for integer values | def table(x):
c = Counter(x)
return list(c), list(c.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truthtable(self):\n table = []\n for i in xrange(self.length):\n inputs = []\n binary = bin(i).lstrip('0b')\n for i in xrange(len(binary)):\n inputs.append(int(binary[i]))\n inputs.append(1)\n table.append(self.compute(inputs))... | [
"0.6684065",
"0.63467693",
"0.6338746",
"0.62285286",
"0.6102548",
"0.6079408",
"0.6012336",
"0.6006329",
"0.5984143",
"0.5936262",
"0.5877407",
"0.58743227",
"0.5830404",
"0.5813022",
"0.5775467",
"0.5732407",
"0.5676613",
"0.56693375",
"0.5663503",
"0.56617427",
"0.5659174"... | 0.6623371 | 1 |
Calculating local means. Poor man's loess. Fine and quick if many data points. | def local_mean(x,y, n=10):
xx, yy = (list(t) for t in zip(*sorted(zip(x, y)))) # sort x and y after x
m = int(len(x)/n) # Number of data points in each group
x_o, y_o = [], []
x_sum, y_sum, v = 0, 0, 0
j=1
for i in range(len(x)):
if v < m:
x_sum += xx[i]
y_sum ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_density_mean(self):\n\n # the simulation units are msun / kpc ^3\n local = np.mean(self.dens)\n\n return local",
"def mean(points):\r\n\t\treturn sum(points)/len(points)",
"def mean_average_position():\n pass",
"def Mean(data):\n return data.mean()",
"def calculate_mean... | [
"0.67056066",
"0.6491562",
"0.6450197",
"0.6444586",
"0.62870014",
"0.6237517",
"0.62069595",
"0.6158274",
"0.61431855",
"0.6097487",
"0.6062705",
"0.6060495",
"0.60540843",
"0.6053039",
"0.6024757",
"0.60079587",
"0.599939",
"0.599226",
"0.59790677",
"0.5973261",
"0.5965069"... | 0.6994391 | 0 |
Parse a ```line`` based against a list of ``patterns``. | def parse_line(line, patterns=None):
if patterns is None:
patterns = LINE_PATTERNS
for line_re in patterns:
match = line_re.match(line)
if match:
data = match.groupdict()
av_pairs = data['av_pairs']
data['av_pairs'] = cleanup_av_pairs(av_pairs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(self, line, allow_extra=False):\r\n if not isinstance(line, Compatibility.string):\r\n raise TypeError(\"Expected line to be a string, got %s\" % type(line))\r\n sre_match = self._re.match(line)\r\n if sre_match is None:\r\n raise ScanfParser.ParseError(\"Failed to match pattern: %s ag... | [
"0.6369723",
"0.6281397",
"0.62425673",
"0.59930545",
"0.5857287",
"0.5748906",
"0.571239",
"0.5686701",
"0.5681457",
"0.56215805",
"0.5605779",
"0.5588075",
"0.55302525",
"0.54868627",
"0.5478415",
"0.5466466",
"0.5439876",
"0.5428541",
"0.54191476",
"0.53572595",
"0.5326763... | 0.7249798 | 0 |
When user cancel checkout relation to baseline is None | def test_after_cancel_checkout(self):
baseline = createContentInContainer(self.folder, 'stageable_type')
working_copy = self.do_checkout(baseline)
self.do_cancel(working_copy)
relation = IWCAnnotator(baseline).get_relation()
self.assertIsNone(relation)
self.assertIsNone... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cancel_pending_payment(self):\n pass",
"def setNoCheckout(self) -> None:\n ...",
"def test_cancel_shipment_old(self):\n pass",
"def _order_cancel(self, bo):\n log.info(\"bo_blotter: order_cancel bracket order bo#%s\" % bo.ticket) \n cancelled = bo.cancel()\n... | [
"0.6682023",
"0.64539814",
"0.6367978",
"0.625337",
"0.6229602",
"0.61449844",
"0.6132463",
"0.6123441",
"0.611586",
"0.6084435",
"0.6084435",
"0.6084435",
"0.6039756",
"0.6036369",
"0.60193",
"0.60182756",
"0.59655523",
"0.5933016",
"0.5933016",
"0.59231687",
"0.59224665",
... | 0.7254451 | 0 |
Checks the status of a panel i.e. whether it is live or has uncommitted changes | def check_panel_status(s, id):
panels = check_panel_status_query(s, id)
status = True
for i in panels:
if i.intro > i.current_version:
status = False
break
if i.last is not None:
if i.last == i.current_version:
status = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_virtualpanel_status(s, id):\n panels = check_virtualpanel_status_query(s, id)\n status = True\n for i in panels:\n if i.intro > i.current_version:\n status = False\n break\n if i.last is not None:\n if i.last == i.current_version:\n s... | [
"0.67008185",
"0.63950515",
"0.6303801",
"0.5993147",
"0.5920224",
"0.58405703",
"0.5785136",
"0.5742182",
"0.56543016",
"0.5647434",
"0.5636928",
"0.56352186",
"0.5626811",
"0.5620609",
"0.56139094",
"0.5611207",
"0.5607989",
"0.5591626",
"0.55884117",
"0.5582546",
"0.557306... | 0.7214635 | 0 |
Checks the status of a virtual panel i.e. whether it is live or has uncommitted changes | def check_virtualpanel_status(s, id):
panels = check_virtualpanel_status_query(s, id)
status = True
for i in panels:
if i.intro > i.current_version:
status = False
break
if i.last is not None:
if i.last == i.current_version:
status = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_panel_status(s, id):\n panels = check_panel_status_query(s, id)\n status = True\n for i in panels:\n if i.intro > i.current_version:\n status = False\n break\n if i.last is not None:\n if i.last == i.current_version:\n status = False\... | [
"0.6554641",
"0.6370629",
"0.6291984",
"0.60570294",
"0.60495496",
"0.598873",
"0.59630346",
"0.59411",
"0.59268373",
"0.5703046",
"0.5640611",
"0.56372267",
"0.5632552",
"0.5621469",
"0.5608949",
"0.559546",
"0.5583101",
"0.5578039",
"0.5565517",
"0.55514395",
"0.5544561",
... | 0.75358933 | 0 |
this is the method for gene autocompletion gets gene list from db and makes it into a json so that javascript can read it | def autocomplete():
value = str(request.args.get('q'))
result = s.query(Genes).filter(Genes.name.like("%" + value + "%")).all()
data = [i.name for i in result]
return jsonify(matching_results=data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_genes(request, genome, chrom, start, end):\n logger.debug(\"annotation_server.get_genes called for genome: %s chromosome: %s\" % (genome, chrom)) \n \n if genome in SUPPORTED_GENOMES:\n current_table = eval(genome+ \"_EnsGene\")\n curr_vals = current_table.objects.filter(\n ... | [
"0.5893482",
"0.5857896",
"0.57166195",
"0.5713266",
"0.5686897",
"0.56468934",
"0.5633033",
"0.56239164",
"0.56137943",
"0.54916984",
"0.549004",
"0.5441414",
"0.54217285",
"0.5417656",
"0.54035157",
"0.538486",
"0.53812414",
"0.53533083",
"0.5330496",
"0.53243965",
"0.53007... | 0.5941018 | 0 |
Method to translate regions to BED file format. | def create_bed(regions):
result = []
for i in regions:
line = []
line.append(i.chrom)
line.append(str(i.start))
line.append(str(i.end))
line.append(i.name.replace(";", ","))
result.append(line)
bed = '\n'.join(['\t'.join(l) for l in result])
return bed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bed_to_quest(in_bed, out_regions):\n with open(in_bed) as infile:\n with open(out_regions, 'w') as outfile:\n for line in infile:\n fields = line.strip().split('\\t')\n outfile.write(' '.join(fields[:2] + [fields[5]]) + '\\n')",
"def to_bed(self, file_name, ... | [
"0.6066997",
"0.5997694",
"0.57949936",
"0.5722753",
"0.56932145",
"0.55274326",
"0.5516248",
"0.55012625",
"0.533869",
"0.53141445",
"0.5282663",
"0.5208408",
"0.52067125",
"0.51832414",
"0.5090945",
"0.507771",
"0.5054706",
"0.5033555",
"0.502927",
"0.4997322",
"0.49905843"... | 0.6242754 | 0 |
Allows the panel or virtual panel to be downloaded as a text file in the correct BED format using the name of the panel. The scope is defined as either panel or virtual to determine the query to be executed. The request can also specify the version of the panel to be downloaded. | def download():
scope = request.args.get('scope')
type = request.args.get('type')
id = request.args.get('id')
version = request.args.get('version')
panel_name = request.args.get('name')
if type == 'default':
extension = 0
else:
extension = 25
if scope == 'Panel':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def panel(context, panel, version):\n LOG.info(\"Running scout export panel\")\n adapter = context.obj['adapter']\n \n if not panel:\n LOG.warning(\"Please provide at least one gene panel\")\n context.abort()\n\n LOG.info(\"Exporting panels: {}\".format(', '.join(panel)))\n for line... | [
"0.55245066",
"0.5285476",
"0.52011573",
"0.5189003",
"0.5167064",
"0.5078086",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
"0.5049122",
... | 0.76141894 | 0 |
Method to view panels, if project ID given then only return panels from that project. The Method also checks if each panel is locked (is being worked on by another user) and whether the user has permission to edit each panel, otherwise this action is not available to them. | def view_panels(id=None):
if not id:
id = request.args.get('id')
if id:
panels = get_panels_by_project_id(s, id)
else:
panels = get_panels(s)
result = []
project_name = "All"
for i in panels:
row = dict(zip(i.keys(), i))
status = check_panel_status(s, row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_panel():\n id = request.args.get('id')\n try:\n version = request.form[\"versions\"]\n except KeyError:\n version = None\n if id:\n status = check_panel_status(s, id)\n if not status:\n message = \"This panel has changes which cannot be viewed here as the... | [
"0.743536",
"0.65683925",
"0.64532185",
"0.6285346",
"0.6196534",
"0.61308366",
"0.6059618",
"0.5872456",
"0.5869206",
"0.57798433",
"0.5656728",
"0.55517346",
"0.5526247",
"0.546346",
"0.54273313",
"0.5419527",
"0.5378603",
"0.53371745",
"0.5283594",
"0.52555084",
"0.523886"... | 0.7989837 | 0 |
Method to view regions in a panel. If no panel ID is given, the method executes view_panels() The method checks the user has permission to edit the panel to determine whether this feature is available to them. It also checks if the panel is locked as this will also restrict access to the edit option. | def view_panel():
id = request.args.get('id')
try:
version = request.form["versions"]
except KeyError:
version = None
if id:
status = check_panel_status(s, id)
if not status:
message = "This panel has changes which cannot be viewed here as they have not been m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_vpanel():\n id = request.args.get('id')\n try:\n version = request.form[\"versions\"]\n except KeyError:\n version = None\n if id:\n status = check_virtualpanel_status(s, id)\n if not status:\n message = \"This panel has changes which cannot be viewed her... | [
"0.63788956",
"0.5876005",
"0.56357265",
"0.5570096",
"0.5334055",
"0.51983225",
"0.51884156",
"0.5155888",
"0.5124921",
"0.51096785",
"0.50766367",
"0.5070279",
"0.50308144",
"0.50113946",
"0.4993579",
"0.49817935",
"0.4955134",
"0.49180374",
"0.48635954",
"0.48109576",
"0.4... | 0.73863775 | 0 |
Create panel wizard method. If request is "GET" method renders template for wizard If the request is "POST" method makes the panel live (if selected) and redirects to the view panel page | def create_panel_process():
form = CreatePanelProcess()
if request.method == "POST":
make_live = request.form['make_live']
panel_id = request.args.get('id')
project_id = get_project_id_by_panel_id(s, panel_id)
preftx_id = get_preftx_id_by_project_id(s, project_id)
version... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_virtual_panel_process():\n form = CreateVirtualPanelProcess()\n\n if request.method == \"POST\":\n make_live = request.form['make_live']\n vp_id = request.args.get('id')\n if make_live == \"on\":\n make_vp_panel_live(s, vp_id)\n add_to_starlims(vp_id)\n ... | [
"0.7150321",
"0.6497616",
"0.62563187",
"0.6069959",
"0.5927046",
"0.58684856",
"0.58421654",
"0.5759699",
"0.5713984",
"0.5710167",
"0.567427",
"0.5629274",
"0.55678403",
"0.5563093",
"0.5559728",
"0.55200875",
"0.55147177",
"0.550369",
"0.5481536",
"0.5462065",
"0.54507065"... | 0.76065373 | 0 |
Edit panel wizard method. If the request method is "GET" the information for the panel is retrieved and the relevant HTML is created (e.g. gene buttons and tx drop downs. The template for the wizard is rendered and returned. If the request method is "POST" the panel and preferred tx are made live (if selected) and redi... | def edit_panel_process():
if request.method == "POST":
make_live = request.form['make_live']
panel_id = request.args.get('id')
project_id = get_project_id_by_panel_id(s, panel_id)
preftx_id = get_preftx_id_by_project_id(s, project_id)
tx_version = get_current_preftx_version(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_virtual_panel_process():\n form = EditVirtualPanelProcess()\n\n vp_id = request.args.get('id')\n panel_id = get_panel_by_vp_id(s, vp_id)\n if request.method == \"POST\":\n if request.form['make_live'] == \"on\":\n make_vp_panel_live(s, vp_id)\n add_to_starlims(vp_i... | [
"0.6511815",
"0.62808156",
"0.5995787",
"0.5682653",
"0.5631195",
"0.55523235",
"0.55235845",
"0.5493029",
"0.5487577",
"0.5467368",
"0.5455909",
"0.5455815",
"0.54286665",
"0.5413771",
"0.5399437",
"0.5357053",
"0.5355894",
"0.5342035",
"0.5334771",
"0.53329116",
"0.5325167"... | 0.69339293 | 0 |
Method to add panel to db. Uses panel name and project ID to create a panel in the db and returns the unique ID for the panel | def add_panel():
panel_name = request.json['panel_name']
project_id = request.json['project_id']
panel_id = create_panel_query(s, project_id, panel_name, current_user.id)
return jsonify(panel_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createPanel(self, LibraryID, Name, **kwargs):\n if self.request(\"createPanel\", LibraryID=LibraryID, Name=Name, **kwargs) is None:\n return None\n return self.json_response[\"Result\"][\"PanelID\"]",
"def add_panel(self, panel):\n assert panel.PANEL_ID not in self.panels\n ... | [
"0.71067053",
"0.6671714",
"0.6179229",
"0.6139341",
"0.59658146",
"0.57764566",
"0.56813574",
"0.5659387",
"0.55523556",
"0.5535822",
"0.5534156",
"0.55321145",
"0.54948974",
"0.5462264",
"0.5452474",
"0.5366363",
"0.53566235",
"0.5349205",
"0.5336535",
"0.53030396",
"0.5300... | 0.81717074 | 0 |
Method to delete panel from db If the panel has not been made live it can be removed from the db. | def remove_panel():
panel_name = request.json['panel_name']
remove_panel_query(s, panel_name)
return jsonify('complete') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onDelToolClicked(self, event):\n i_selected = self.db_listBox.GetSelection()\n if i_selected >= 0:\n manager = self.getManager()\n if manager:\n try:\n data = manager.getData()\n db_record = data['records'][i_selected]\n ... | [
"0.6200058",
"0.60520643",
"0.60312414",
"0.5943299",
"0.5910845",
"0.5905584",
"0.58856493",
"0.5877893",
"0.58686376",
"0.58686376",
"0.5861024",
"0.5856986",
"0.5811765",
"0.5786195",
"0.57745904",
"0.57610625",
"0.5759628",
"0.57585543",
"0.57567686",
"0.5725289",
"0.5689... | 0.7019545 | 0 |
Method to allow a file of gene names to be uploaded for a panel. The file is read in the javascript at the client side and a list of gene names are sent to the method within the ajax. The create_panel_get_tx() method is applied to each gene in the list and teh html is combined before being returned to the client side f... | def upload_multiple():
gene_list = request.json['gene_list']
project_id = request.json['project_id']
all_message = ''
html = ''
added_list = []
button_list = ''
for gene in sorted(gene_list):
if gene == "" or gene in added_list:
continue
dct = create_panel_get_tx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploader():\n if request.method == 'POST':\n # from the upload page, the clients input is called from the text-area of the form. \n clientinput_unic = request.form['list_genes']\n #print \"raw input client:\\n\", clientinput_unic\n clientinput_unic = re.sub('[^a-zA-Z0-9 \\n\\r]',... | [
"0.57950294",
"0.5733016",
"0.53495437",
"0.5318565",
"0.512028",
"0.51008075",
"0.5074191",
"0.5051867",
"0.50033104",
"0.49809676",
"0.49671775",
"0.49513146",
"0.4897819",
"0.48895323",
"0.4885491",
"0.483393",
"0.48064065",
"0.47825357",
"0.47541657",
"0.47469318",
"0.473... | 0.61844766 | 0 |
Method to produce HTML for create panel wizard when new gene is added. Each gene is checked against the database before the HTML is generated for the transcript list and gene button list within the process workflow. The method checks for changes in the preferred transcript that have yet to be applied so these changes a... | def create_panel_get_tx(gene_name=None, project_id=None):
json = False
if not gene_name:
gene_name = request.json['gene_name']
project_id = request.json['project_id']
json = True
exists = isgene(s, gene_name)
if exists:
if exists != gene_name:
message = render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploader():\n if request.method == 'POST':\n # from the upload page, the clients input is called from the text-area of the form. \n clientinput_unic = request.form['list_genes']\n #print \"raw input client:\\n\", clientinput_unic\n clientinput_unic = re.sub('[^a-zA-Z0-9 \\n\\r]',... | [
"0.56408334",
"0.55816025",
"0.52680415",
"0.503966",
"0.488444",
"0.48382986",
"0.47955337",
"0.47820178",
"0.47750244",
"0.47589657",
"0.47389212",
"0.4719479",
"0.46907225",
"0.46665788",
"0.46599403",
"0.4656926",
"0.4655909",
"0.4653246",
"0.46490628",
"0.46456513",
"0.4... | 0.67516744 | 0 |
Creates a custom region from ajax query and adds region to versions table for specified panel. Method checks that region does not exist before adding to the database | def create_panel_custom_regions():
panel_id = request.json["panel_id"]
chrom = request.json["chrom"]
start = request.json["start"]
end = request.json["end"]
name = request.json["name"]
regions = select_region_by_location(s, chrom, start, end) # if region already exists, return current entry
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_panel_regions():\n version_ids = request.json['id_ext']\n panel_id = request.json['panel_id']\n project_id = request.json['project_id']\n gene_name = request.json['gene_name']\n\n try:\n tx_id = request.json['pref_tx_id']\n add_preftxs_to_panel(s, project_id, [{\"gene\": gene_n... | [
"0.6851175",
"0.58318996",
"0.5732002",
"0.57220423",
"0.5642025",
"0.5546407",
"0.54592353",
"0.5327448",
"0.52333945",
"0.5185885",
"0.5143218",
"0.5129821",
"0.5091915",
"0.49749365",
"0.4962693",
"0.49568614",
"0.49368486",
"0.49333954",
"0.49035862",
"0.48829305",
"0.487... | 0.7340577 | 0 |
Method to add all regions for a gene to versions table | def add_all_regions():
gene_id = request.json['gene_id']
panel_id = request.json['panel_id']
tx_id = request.json['tx_id']
gene_name = request.json['gene_name']
project_id = get_project_id_by_panel_id(s, panel_id)
add_preftxs_to_panel(s, project_id, [{"gene": gene_name, "tx_id": tx_id}, ])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_all_regions_vp():\n gene_id = request.json['gene_id']\n vpanel_id = request.json['vpanel_id']\n panel_id = request.json['panel_id']\n add_all_regions_to_vp(s, panel_id, gene_id, vpanel_id)\n return jsonify({\"genes\": [gene_id, ]})",
"def add_panel_regions():\n version_ids = request.jso... | [
"0.6766564",
"0.6378839",
"0.5810066",
"0.5718972",
"0.557586",
"0.54156053",
"0.5386809",
"0.53579724",
"0.5317539",
"0.5312527",
"0.5252136",
"0.52013516",
"0.51998466",
"0.51921564",
"0.51599437",
"0.51550764",
"0.5132998",
"0.5104016",
"0.5098529",
"0.50962406",
"0.507610... | 0.66544604 | 1 |
Method to add selected regions and relevant extensions to a panel. When regions for a gene are added to a panel the preferred tx is also added/updated. The regions are sent within a dictionary containing the containing the region ID and both extensions (zero if no ext to be added). | def add_panel_regions():
version_ids = request.json['id_ext']
panel_id = request.json['panel_id']
project_id = request.json['project_id']
gene_name = request.json['gene_name']
try:
tx_id = request.json['pref_tx_id']
add_preftxs_to_panel(s, project_id, [{"gene": gene_name, "tx_id": t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_all_regions():\n gene_id = request.json['gene_id']\n panel_id = request.json['panel_id']\n tx_id = request.json['tx_id']\n gene_name = request.json['gene_name']\n project_id = get_project_id_by_panel_id(s, panel_id)\n\n add_preftxs_to_panel(s, project_id, [{\"gene\": gene_name, \"tx_id\":... | [
"0.64971155",
"0.64647776",
"0.61680335",
"0.573325",
"0.5657563",
"0.51716113",
"0.49223477",
"0.48954195",
"0.48890984",
"0.4851004",
"0.48300904",
"0.4819779",
"0.47491133",
"0.4738578",
"0.46695167",
"0.46603796",
"0.46551576",
"0.46383616",
"0.46241546",
"0.46217567",
"0... | 0.7934862 | 0 |
Method to remove regions from a panel. The query associated with this method checks whether the region was live in the panel. If it has been in a live version the region remains in the versions table and the "last" field is populated with the current version. If the region has never been included in a live version of t... | def remove_panel_regions():
if type(request.json['ids']) is list:
version_ids = request.json['ids']
else:
version_ids = request.json['ids'].replace('[', '').replace(']', '').split(',')
# TODO does this happen?
if type(version_ids) is str:
version_ids = version_ids.split(',')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_this_region(self):",
"def cleanup_regions(self, timestamp, bid, ofr):\n regions = []\n\n for region in self.regions:\n if not region.can_delete(timestamp, bid, ofr):\n regions.append(region)\n\n # replace the regions list\n self.regions = regions",... | [
"0.604837",
"0.56510043",
"0.545178",
"0.53380364",
"0.51581484",
"0.5128699",
"0.5109236",
"0.50571764",
"0.50442064",
"0.50144815",
"0.48666006",
"0.48078403",
"0.47030452",
"0.4667216",
"0.46481922",
"0.4605013",
"0.45865065",
"0.4569744",
"0.45658997",
"0.45476836",
"0.45... | 0.7042875 | 0 |
Method to make a panel live given a panel ID | def make_live():
panelid = request.args.get('id')
locked = check_if_locked(s, panelid)
if locked:
unlock_panel_query(s, panelid)
current_version = get_current_version(s, panelid)
if not current_version:
current_version = 0
new_version = current_version + 1
make_panel_live(s, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_virtualpanel_live():\n vpanelid = request.args.get('id')\n panelid = get_panel_by_vp_id(s, vpanelid)\n locked = check_if_locked(s, panelid)\n if locked:\n if current_user.id == get_locked_user(s, panelid):\n make_vp_panel_live(s, vpanelid)\n add_to_starlims(vpaneli... | [
"0.70315933",
"0.6383759",
"0.6093565",
"0.5932666",
"0.5906493",
"0.5849285",
"0.5781931",
"0.57565033",
"0.5752766",
"0.5693289",
"0.56888175",
"0.5603522",
"0.5540066",
"0.552902",
"0.5507206",
"0.54622364",
"0.54073757",
"0.5386678",
"0.5381173",
"0.5299995",
"0.52436495"... | 0.7831331 | 0 |
Method to unlock a panel so it can be edited by others | def unlock_panel():
panelid = request.args.get('panelid')
unlock_panel_query(s, panelid)
return redirect(url_for('panels.view_panels')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_locked():\n panel_id = request.args.get('id')\n json = False\n if not panel_id:\n json = True\n panel_id = request.json['id']\n project_id = get_project_id_by_panel_id(s, panel_id)\n if current_user.id == get_locked_user(s, panel_id) and json:\n unlock_panel_query(s, ... | [
"0.6602288",
"0.6435054",
"0.6348038",
"0.6270993",
"0.6200969",
"0.61717916",
"0.60962564",
"0.5970956",
"0.59518844",
"0.5920136",
"0.58595866",
"0.5852581",
"0.583533",
"0.5805647",
"0.5797462",
"0.57789946",
"0.5767917",
"0.5746708",
"0.57098585",
"0.5692884",
"0.5687889"... | 0.73430175 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.