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 |
|---|---|---|---|---|---|---|
Ask the Server for an updated Trade Routes list from galaxy | def getTradeRoutes(self):
try:
serverResult = self.game.server.getTradeRoutes(self.game.authKey)
if type(serverResult) == types.StringType:
self.modeMsgBox(serverResult)
else:
self.game.tradeRoutes = serverResult
except:
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_request(self):\n route_chosen = self.comboBox_route_list.currentText()\n route_id = route_chosen.split(',')[0] #to get the id of the route\n trip_headsign_chosen = self.comboBox_trip_headsign_list.currentText()\n stop_chosen = self.comboBox_stop_list.currentText()\n sel... | [
"0.59610677",
"0.584384",
"0.57109505",
"0.54254746",
"0.5393241",
"0.53727764",
"0.53483665",
"0.5341052",
"0.52800333",
"0.5268344",
"0.52633345",
"0.5245448",
"0.52403075",
"0.51980567",
"0.5151848",
"0.51128",
"0.5098374",
"0.5090599",
"0.5083997",
"0.50830114",
"0.504201... | 0.5998676 | 0 |
Ask the Server for an updated Market Orders list from galaxy | def getMarketOrders(self):
try:
serverResult = self.game.server.getMarketOrders(self.game.authKey)
if type(serverResult) == types.StringType:
self.modeMsgBox(serverResult)
else:
self.game.marketOrders = serverResult
except:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_OpenOrders(self, market):\n mid = self.marketid(market)\n o_orders = self.Request.fetch('marketorders',params={'marketid':mid})\n ##check the form of o_orders\n \n print o_orders\n #self.OpenOrders[self.Pairs[mid]] = \n return 0",
"def update(self, cont... | [
"0.6695864",
"0.6079546",
"0.6023024",
"0.5892535",
"0.57795304",
"0.57201445",
"0.57031035",
"0.56942236",
"0.5606691",
"0.5569492",
"0.5527326",
"0.5476918",
"0.5476716",
"0.54740685",
"0.5471414",
"0.5435566",
"0.5435566",
"0.53995997",
"0.53698224",
"0.5363799",
"0.533818... | 0.6474821 | 1 |
Ask the Server for an update on ships specified | def getShipUpdate(self, shipList):
try:
serverResult = self.game.server.getShipUpdate(self.game.authKey, shipList)
if type(serverResult) == types.DictType:
for shipID, shipDict in serverResult.iteritems():
self.game.myShips[shipID] = shipDict
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ship_updates(ai, var, screen, ship, charges, shields, hub):\r\n\tship.update(ai)\r\n\tship.draw_ship()\r\n\tcharge_shield_graphics(ai, var, screen, ship, charges, shields, hub)",
"def update_ship(id):\n data = request.get_json()\n print(data)\n for ship in db['ships']:\n if ship['id'] == id:\... | [
"0.6165003",
"0.6071547",
"0.60219824",
"0.5985693",
"0.5883267",
"0.55963165",
"0.5578249",
"0.5578249",
"0.5551751",
"0.5546087",
"0.5470311",
"0.54668343",
"0.54560935",
"0.5444629",
"0.54410625",
"0.54034525",
"0.5386153",
"0.5367828",
"0.53242177",
"0.5301253",
"0.525167... | 0.65507203 | 0 |
Attempt to move ships to system specified | def moveShips(self, shipList, systemID):
try:
serverResult = self.game.server.moveShips(self.game.authKey, shipList, systemID)
if type(serverResult) == types.StringType:
self.modeMsgBox(serverResult)
elif type(serverResult) == types.DictType:
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveShips(self, shipList, empireID, systemID):\n try:\n # init attributes that all ships should share\n shipOne = self.ships[shipList[0]]\n shipOwner = shipOne.empireID\n if shipOwner <> empireID:\n return 'Cannot move ship if it is not yours'\n... | [
"0.70299727",
"0.60512054",
"0.60343885",
"0.5967694",
"0.59498554",
"0.5934047",
"0.5903405",
"0.5903218",
"0.5859618",
"0.5848594",
"0.5825136",
"0.5787209",
"0.5776674",
"0.5770075",
"0.5759241",
"0.5752678",
"0.5740524",
"0.5736912",
"0.57080173",
"0.57017815",
"0.5682248... | 0.7027821 | 1 |
Military Installation Sim selected | def onSelectMilitaryInstSim(self, sim):
# create panel and selector if they do not exist
self.onSelectNoSim()
self.militaryinstInfo = anwp.gui.militaryinstinfo.MilitaryInstInfoFrame(self, self.game.app)
self.createSelector2()
# update observer
if self.militaryins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_arm(self):\n pass",
"def switchToAppInstaller(dev):\n print('Switching to app install mode')\n SonyExtCmdCamera(dev).switchToAppInstaller()",
"def pc():\n global simulator\n if simulator is None:\n print \"Program is not started.\"\n return None\n return mcpc()[0]",
... | [
"0.6006514",
"0.57758254",
"0.55156994",
"0.5514979",
"0.5460101",
"0.53618777",
"0.5355101",
"0.5269567",
"0.52437234",
"0.5212601",
"0.520124",
"0.5155473",
"0.51528597",
"0.50978374",
"0.50921273",
"0.5079491",
"0.5040398",
"0.5026107",
"0.5020795",
"0.5007161",
"0.5007161... | 0.6513893 | 0 |
No Sim Selected clear panels and selector | def onSelectNoSim(self):
if self.systemInfo <> None:
self.systemInfo.destroy()
self.systemInfo = None
if self.shipyardsInfo <> None:
self.shipyardsInfo.destroy()
self.shipyardsInfo = None
if self.armadaInfo <> None:
self.armadaInfo.dest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_sel(self):\n run(['ipmitool', 'sel', 'clear'], stdout=DEVNULL, stderr=DEVNULL)",
"def ClearTools(self):\r\n\r\n self.Clear()",
"def Clear(self) -> None:",
"def clear_scene(self):\n # Set all robots variables as invisible\n for robot in self.__robots:\n robot.s... | [
"0.69016725",
"0.662211",
"0.6375476",
"0.6372101",
"0.63449126",
"0.6339151",
"0.6330644",
"0.630514",
"0.6299343",
"0.6295418",
"0.6295418",
"0.6295418",
"0.6295418",
"0.6295418",
"0.6295418",
"0.6295418",
"0.62628317",
"0.6252573",
"0.6247262",
"0.6238687",
"0.62310433",
... | 0.7394923 | 0 |
System Info are rendered outside system drawcallback due to problems drawing in drawcallback of system | def drawSystemInfo(self):
for sim in self.systemSims:
# draw name
(x,y) = anwp.sl.engine.worldToScreen(sim.mySystemDict['x'], sim.mySystemDict['y'])
pyui.desktop.getRenderer().drawText(sim.mySystemDict['name'],
(x-30,y-70),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_draw_overlay(self):",
"def draw(self):\n\t\tpass",
"def pre_draw(self):",
"def on_draw(self):\n # draw everything",
"def setup_draw(self):\n pass",
"def draw(self, screen):",
"def draw(self):",
"def _render_callback(self, _sim, _viewer):\n pass",
"def draw(self):\n ... | [
"0.6335686",
"0.61444575",
"0.61270934",
"0.6021201",
"0.6008065",
"0.5997083",
"0.5950671",
"0.5930599",
"0.59029055",
"0.59029055",
"0.59029055",
"0.59029055",
"0.58707416",
"0.58677536",
"0.58677536",
"0.58352274",
"0.5822799",
"0.5822724",
"0.5729398",
"0.5713518",
"0.564... | 0.71599627 | 0 |
Display any Warp Trade information on a system by system basis | def drawWarpTradeInfo(self):
for sim in self.tradeRouteSims:
if sim.myTradeDict['warpReq'] > 0:
# trade route requires warp points, display them
(x,y) = anwp.sl.engine.worldToScreen(sim.posX, sim.posY)
(offsetX, offsetY) = anwp.sl.engine.worldToScreen(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_system():\n\n pass",
"def info_widget(loc_classes, switch, weather):\r\n\r\n try:\r\n if loc_classes[\"country_iso\"]:\r\n info = {}\r\n iso = loc_classes[\"country_iso\"]\r\n\r\n \"\"\"FX-rate function\"\"\"\r\n info = fx_rate(iso)\r\n\r\n ... | [
"0.59549236",
"0.5883043",
"0.574042",
"0.57021445",
"0.5681498",
"0.5672869",
"0.5627095",
"0.5603485",
"0.5563031",
"0.55420667",
"0.5495453",
"0.54948276",
"0.5488042",
"0.5483167",
"0.54618526",
"0.5460428",
"0.54434574",
"0.5430897",
"0.54248244",
"0.5404102",
"0.5375741... | 0.63245314 | 0 |
Display any Warp Gate information on a system by system basis | def drawWarpGateInfo(self):
for sim in self.systemSims:
if sim.mySystemDict['myEmpireID'] == self.game.myEmpireID or anwp.func.globals.diplomacy[self.game.myEmpire['diplomacy'][sim.mySystemDict['myEmpireID']]['diplomacyID']]['trade'] == 1:
if sim.mySystemDict['availWGC'] > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_system():\n\n pass",
"def drawSystemInfo(self):\n for sim in self.systemSims:\n # draw name\n (x,y) = anwp.sl.engine.worldToScreen(sim.mySystemDict['x'], sim.mySystemDict['y'])\n pyui.desktop.getRenderer().drawText(sim.mySystemDict['name'], \n ... | [
"0.61906314",
"0.58367544",
"0.57486707",
"0.5666276",
"0.566352",
"0.5615238",
"0.55802447",
"0.55654687",
"0.556195",
"0.5525094",
"0.5524829",
"0.5366451",
"0.5346186",
"0.53444356",
"0.5331464",
"0.5320715",
"0.53097486",
"0.5286774",
"0.52581537",
"0.52237016",
"0.521062... | 0.7736591 | 0 |
Draw the System Warp Lines | def drawWarpLines(self):
# draw warp lines
for item in self.game.warpLines:
anwp.sl.engine.drawLine(item[0]+self.bufferX, item[1]+self.bufferY, item[2]+self.bufferX, item[3]+self.bufferY, pyui.colors.blue) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawLines(self):\n\t\tintersections = [[], []]\n\t\tfor l in self.lines:\n\t\t\tif l.direction == 'v':\n\t\t\t\tif l.rtc:\n\t\t\t\t\tposition = l.coordinate + int((self.width - 1) / 2)\n\t\t\t\telse:\n\t\t\t\t\tposition = int((l.coordinate * self.width / 100) if type(l.coordinate) == float else l.coordinate)\n... | [
"0.70774066",
"0.64901376",
"0.6409812",
"0.6288639",
"0.62808853",
"0.6270028",
"0.62496686",
"0.6247157",
"0.6181284",
"0.61710566",
"0.615521",
"0.6090888",
"0.59895414",
"0.59892106",
"0.5984904",
"0.59305686",
"0.5930158",
"0.59227455",
"0.591664",
"0.5891451",
"0.587188... | 0.7315861 | 0 |
Attempt to swap ship captains | def swapCaptains(self, shipOneID, shipTwoID):
try:
serverResult = self.game.server.swapCaptains(self.game.authKey, shipOneID, shipTwoID)
if type(serverResult) == types.StringType:
self.modeMsgBox(serverResult)
elif serverResult == 1:
# success,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swapCaptains(self, empireID, shipOneID, shipTwoID):\n try:\n myEmpire = self.empires[empireID]\n shipOne = self.ships[shipOneID]\n shipTwo = self.ships[shipTwoID]\n \n # make sure empire is correct\n if shipOne.empireID <> empireID or shi... | [
"0.7440661",
"0.62633115",
"0.60582674",
"0.58793",
"0.5805766",
"0.5733869",
"0.5732855",
"0.5702131",
"0.569555",
"0.569021",
"0.5689485",
"0.5674088",
"0.5643015",
"0.5623915",
"0.5611276",
"0.5591968",
"0.5573066",
"0.5567112",
"0.55424875",
"0.55235934",
"0.55115205",
... | 0.73409414 | 1 |
Toggle the viewing of other empire diplomacy panels | def toggleDiplomacy(self):
if self.viewDiplomacy == 0:
self.viewDiplomacy = 1
# setup diplomacy panels
buffer = 10
x = buffer
y = self.mainMenu.height+buffer
for empireID, empireDict in self.game.allEmpires.iteritems():
if e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible(self, show):",
"def toggle_airplanes(self):\n if self.locations_map.show_airplanes:\n self.locations_map.show_airplanes = False\n else:\n if self.locations_map.zoom > 5:\n self.locations_map.show_airplanes = True\n self.locations_map.s... | [
"0.6085545",
"0.60773945",
"0.6075108",
"0.6057446",
"0.603121",
"0.59862506",
"0.5908051",
"0.59074926",
"0.58986014",
"0.58915263",
"0.58744156",
"0.58744156",
"0.58713186",
"0.58451635",
"0.58279437",
"0.58136785",
"0.58104616",
"0.58104616",
"0.58104616",
"0.58104616",
"0... | 0.75582117 | 0 |
Toggle the viewing of trade route sims | def toggleTradeRoutes(self):
if self.game.myEmpire['viewTradeRoutes'] == 0:
self.game.myEmpire['viewTradeRoutes'] = 1
self.createTradeRouteSims()
else:
self.game.myEmpire['viewTradeRoutes'] = 0
self.removeTradeRouteSims() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggleRadar(self):\n if self.game.myEmpire['viewRadar'] == 0:\n self.game.myEmpire['viewRadar'] = 1\n self.createRadarSims()\n else:\n self.game.myEmpire['viewRadar'] = 0\n self.removeRadarSims()",
"def toggle(self):",
"def handle_toggle_simulation(... | [
"0.66864735",
"0.6093994",
"0.6078889",
"0.6067998",
"0.6067998",
"0.6008018",
"0.59923875",
"0.5986408",
"0.5944419",
"0.5860139",
"0.58457196",
"0.57831466",
"0.5780062",
"0.57342196",
"0.56913173",
"0.5637194",
"0.5589705",
"0.5584919",
"0.55728674",
"0.55192596",
"0.54916... | 0.811662 | 0 |
Toggle the viewing of Resources | def toggleResources(self):
if self.game.myEmpire['viewResources'] == 0:
self.game.myEmpire['viewResources'] = 1
self.createResourceSims()
else:
self.game.myEmpire['viewResources'] = 0
self.removeResourceSims() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle(self):",
"def toggle(self) -> None:",
"def toggle(self) -> None:",
"def toggle(self) -> None:\n ...",
"def toggle(self, id):\n e = self.objectmanager.objects.get(id=id)\n e.enabled = not e.enabled\n e.save()\n return render({\"id\": id, \"status\": e.enabled})"... | [
"0.67673755",
"0.665674",
"0.665674",
"0.6629794",
"0.63864046",
"0.62314814",
"0.60430956",
"0.6040717",
"0.6022436",
"0.59613514",
"0.59233457",
"0.59007657",
"0.5884401",
"0.5708364",
"0.56950134",
"0.56616324",
"0.5631137",
"0.562577",
"0.56073886",
"0.56061906",
"0.55723... | 0.82137346 | 0 |
Handle device not longer being seen by the bluetooth stack. | def _async_device_unavailable(
_service_info: bluetooth.BluetoothServiceInfoBleak,
) -> None:
push_lock.reset_advertisement_state() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_disconnect(self):\n pass",
"def device_discovered():\n event.set()",
"def on_disconnected_cbk(_, reason: int):\n cprint(f\"\\nDevice disconnected because: {reason}.\", color=\"red\", flush=True)",
"async def on_disconnected(self):\n self._connected = False\n self._co... | [
"0.7007211",
"0.6402023",
"0.6186853",
"0.6159755",
"0.61245203",
"0.6043717",
"0.6010741",
"0.597519",
"0.59486485",
"0.594226",
"0.593626",
"0.5921737",
"0.5896414",
"0.58871895",
"0.58871895",
"0.5887135",
"0.5883578",
"0.5883578",
"0.58749187",
"0.5830502",
"0.5787036",
... | 0.6859245 | 1 |
The function that transfers sum from currency to ruble | def course(self, currency, sum):
if currency == "USD":
url = "https://finance.rambler.ru/currencies/USD/"
elif currency == "EUR":
url = "https://finance.rambler.ru/currencies/EUR/"
else:
return sum * 1000
site = requests.get(url)
soup = bs4.Bea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAmount2(*args):",
"def getAmount1(*args):",
"def btcToUsd(bitcoin, dollar):\n global btc\n global usd\n if btc>bitcoin:\n btc-=bitcoin\n usd+=dollar\n return True\n return False",
"def main():\n print(cash_money(44.333333))",
"def getCurrencies():",
"def usdToBt... | [
"0.6489535",
"0.6281241",
"0.62303984",
"0.6173653",
"0.6099854",
"0.6098411",
"0.608253",
"0.60097873",
"0.5984577",
"0.59791374",
"0.5977039",
"0.59735763",
"0.5935032",
"0.5910544",
"0.59100056",
"0.58924586",
"0.587056",
"0.58490086",
"0.5827327",
"0.580466",
"0.58018464"... | 0.6715058 | 0 |
Same as running drop_db() and create_db(). | def recreate_db():
drop_db()
create_db() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recreate_db():\n drop_db()\n create_db()\n populate_db()",
"def createDb():\n db.drop_all()\n db.create_all()",
"def db(app, request):\n with app.app_context():\n _db.drop_all()\n _db.create_all()",
"def db_create():\n db.drop_all()\n db.create_all()\n db.session.... | [
"0.80780846",
"0.80204564",
"0.7887039",
"0.78339595",
"0.78307825",
"0.7700822",
"0.76613563",
"0.75990146",
"0.75775635",
"0.7550799",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.7531025",
"0.753102... | 0.8227318 | 0 |
Instantiates a new LRU Cache | def test_instantiates_new_lru_cache(self):
lru = LRUCache(4)
self.assertIsInstance(lru, LRUCache)
self.assertEqual(lru.capacity, 4)
self.assertEqual(lru.length, 0)
self.assertIsNone(lru.head)
self.assertIsNone(lru.tail)
self.assertEqual(lru.cache, {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, cache_size):\n # type: (int) -> None\n self.cache_size = cache_size\n super(LRUCache, self).__init__()",
"def __init__(self, cache_dir: str, cache_size: int):\n self.cache_dir = cache_dir\n self.cache_size = int(cache_size * 1e6)\n self.index = {}\n self.touch_... | [
"0.7084286",
"0.6985125",
"0.6708575",
"0.660946",
"0.65602326",
"0.65113896",
"0.6463116",
"0.63689774",
"0.6284156",
"0.62821424",
"0.6278273",
"0.62415904",
"0.62015384",
"0.61923534",
"0.61698914",
"0.61084163",
"0.6081958",
"0.60719",
"0.6049953",
"0.6042288",
"0.6006206... | 0.72308236 | 0 |
Moves current values to head of cache if accessed | def test_moves_accessed_values_to_head(self):
lru = LRUCache(10)
lru.put("1", 1)
lru.put("2", 2)
lru.put("3", 3)
lru.put("4", 4)
self.assertEqual(lru.head.value, 4)
self.assertEqual(lru.tail.value, 1)
lru.get("1")
self.assertEqual(lru.he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_removes_old_cached_values(self):\n lru = LRUCache(2)\n lru.put(\"3\", 3)\n lru.put(\"2\", 2)\n lru.get(\"3\")\n lru.put(\"1\", 1)\n self.assertEqual(lru.length, 2)\n self.assertEqual(lru.head.value, 1)\n self.assertEqual(lru.tail.value, 3)\n s... | [
"0.65548253",
"0.6434987",
"0.630684",
"0.62743163",
"0.6213338",
"0.61937606",
"0.61920774",
"0.6159676",
"0.61360115",
"0.6087219",
"0.606131",
"0.6044622",
"0.60176414",
"0.5986967",
"0.5983718",
"0.59647137",
"0.5961399",
"0.59578425",
"0.5939554",
"0.59102476",
"0.588824... | 0.7533452 | 0 |
Close the robot gripper (modifies the current joint position command) | def close_gripper(self):
if self._control_method == 'p':
# TODO this is probably no good, instead should allow setting position directly
self.pos_cmd[-self._num_jnt_gripper:] = GRIPPER_MAX[1] * np.ones(self._num_jnt_gripper)
elif self._control_method == 'v':
self.vel_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self, position=MIN_POSITION):\n self.gripper_io.set_signal_value(\"position_m\", position)",
"def close(self, wait=True):\n self.gripper.actuate(0, 1)",
"def close(self):\n self.solenoid.set(self.CLOSE)",
"def endCompetition(self):\n self.robot_exit = True",
"def close... | [
"0.687854",
"0.6588274",
"0.6567799",
"0.65083367",
"0.6450652",
"0.6436207",
"0.63920087",
"0.6354499",
"0.62793994",
"0.6264358",
"0.61208755",
"0.6110507",
"0.60985875",
"0.6024292",
"0.5999792",
"0.59965056",
"0.59438825",
"0.59047973",
"0.59043753",
"0.58932763",
"0.5876... | 0.700586 | 0 |
Open the robot gripper (modifies the current joint position command) | def open_gripper(self):
if self._control_method == 'p':
self.pos_cmd[-self._num_jnt_gripper:] = GRIPPER_MAX[0] * np.ones(self._num_jnt_gripper)
elif self._control_method == 'v':
self.vel_cmd[-self._num_jnt_gripper:] = -GRIPPER_VEL * (self.jnt_pos[-self._num_jnt_gripper:]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_model_gripper_command(robot,limb,command):\n qrobot = robot.getConfig()\n qhand = gripper.commandToConfig(command)\n if limb=='left':\n print \"Opening left gripper to\",command\n for i in range(gripper.numDofs):\n qrobot[left_hand_link_start+i] = qhand[i]\n # else:\n ... | [
"0.6931888",
"0.66301304",
"0.65261155",
"0.64578646",
"0.6324879",
"0.6129055",
"0.6087995",
"0.60844785",
"0.60476375",
"0.6046657",
"0.58834815",
"0.5748064",
"0.57342505",
"0.5730763",
"0.5716256",
"0.57068443",
"0.5626091",
"0.56029314",
"0.5600028",
"0.5597905",
"0.5588... | 0.6988515 | 0 |
Randomly sets a strategy | def decideStrategy(self,opponents_moves):
if not opponents_moves: #No prior opponent moves to learn from so random.
self.setStrategy(RPSRandomStrategy)
else:
strategies = [RPSOppositeStrategy,RPSLeastUsedStrategy,RPSMostUsedStrategy,RPSRandomStrategy]
self.setStrategy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_strategy(self, prob_armed):\n # If there is a gun policy active, there may be also a change in how an agent form his choice on strategy.\n # The rationale is that an armed agent is prone to chose resist more often than an unarmed agent.\n if prob_armed:\n if self.has_gun[0]:... | [
"0.6955737",
"0.67850643",
"0.6515359",
"0.64391756",
"0.6258394",
"0.6208574",
"0.61749226",
"0.6034478",
"0.60239697",
"0.60078645",
"0.5971923",
"0.5964605",
"0.59207404",
"0.5917432",
"0.5911717",
"0.5895633",
"0.5892587",
"0.58819854",
"0.58713114",
"0.5867143",
"0.58593... | 0.7027814 | 0 |
Return True if an object is part of the search index queryset. Sometimes it's useful to know if an object _should_ be indexed. If an object is saved, how do you know if you should push that change to the search index? The simplest (albeit not most efficient) way is to check if it appears in the underlying search querys... | def in_search_queryset(self, instance_id, index='_all'):
return self.get_search_queryset(index=index).filter(pk=instance_id).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, obj):\n self._not_support_combined_queries(\"contains\")\n if self._fields is not None:\n raise TypeError(\n \"Cannot call QuerySet.contains() after .values() or .values_list().\"\n )\n try:\n if obj._meta.concrete_model != sel... | [
"0.7532552",
"0.6904493",
"0.66312605",
"0.65418017",
"0.627534",
"0.6109226",
"0.6016902",
"0.5969289",
"0.5803073",
"0.5777502",
"0.57714045",
"0.57398236",
"0.56764024",
"0.5642771",
"0.56362104",
"0.5620288",
"0.55871606",
"0.5585005",
"0.55539095",
"0.5500559",
"0.548171... | 0.75846034 | 0 |
Return queryset of objects from SearchQuery.results, in order. | def from_search_query(self, search_query):
hits = search_query.hits
score_sql = self._raw_sql([(h['id'], h['score'] or 0) for h in hits])
rank_sql = self._raw_sql([(hits[i]['id'], i) for i in range(len(hits))])
return (
self.get_queryset()
.filter(pk__in=[h['id'] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryset(self, request):\n qs = self.model.all_objects.get_query_set()\n ordering = self.ordering or ()\n if ordering:\n qs = qs.order_by(*ordering)\n return qs",
"def get_queryset(self, request):\n querys = self.model.all_objects.get_queryset()\n ordering... | [
"0.68340755",
"0.66245776",
"0.65821564",
"0.655748",
"0.6499057",
"0.63883656",
"0.63179404",
"0.63133204",
"0.6312871",
"0.62389815",
"0.62185085",
"0.61991",
"0.6198982",
"0.618524",
"0.6174734",
"0.6168857",
"0.6114469",
"0.61069345",
"0.6087858",
"0.60822546",
"0.6077902... | 0.67769283 | 1 |
Key used for storing search docs in local cache. | def search_document_cache_key(self):
return 'elasticsearch_django:{}.{}.{}'.format(
self._meta.app_label,
self._meta.model_name,
self.pk
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_key(self):",
"def cache_key(self):\n return self.__class__.create_cache_key(self.key, **self.get_kwargs())",
"def cache_key(cls) -> str:\n return cls._cache_key",
"def cache_key(self):\r\n return self._cache_key(self.pk, self._state.db)",
"def _cache_key(self, pk=\"all\", **k... | [
"0.7224867",
"0.66009283",
"0.64599186",
"0.6333955",
"0.6135604",
"0.6083328",
"0.6068015",
"0.60551333",
"0.592885",
"0.5902071",
"0.5878058",
"0.5857889",
"0.58302695",
"0.58285445",
"0.58238924",
"0.57918096",
"0.57899076",
"0.571678",
"0.5687636",
"0.5669936",
"0.5664758... | 0.7974009 | 0 |
Return the doc_type used for the model. | def search_doc_type(self):
return self._meta.model_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"document_type\")",
"def get_doc_type(self):\n if not self.is_documented():\n return DocType.none\n if self._rawdoc.is_local():\n return DocType.internal\n return self._rawdoc.get_... | [
"0.82361764",
"0.80209893",
"0.7931122",
"0.7815026",
"0.77053124",
"0.76103824",
"0.7474635",
"0.7339738",
"0.7115166",
"0.70386565",
"0.7001553",
"0.6996704",
"0.6989295",
"0.69780153",
"0.69780153",
"0.6934298",
"0.69298863",
"0.6918553",
"0.6918553",
"0.6918553",
"0.69185... | 0.8121655 | 1 |
Return an object as represented in a bulk api operation. Bulk API operations have a very specific format. This function will call the standard `as_search_document` method on the object and then wrap that up in the correct format for the action specified. | def as_search_action(self, index, action):
assert action in ('index', 'update', 'delete'), ("Action must be 'index', 'update' or 'delete'.") # noqa
document = {
'_index': index,
'_type': self.search_doc_type,
'_op_type': action,
'_id': self.pk,
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_search_action(self, index, action, force=False):\n assert self.pk, \"Object must have a primary key before being indexed.\"\n assert action in ('index', 'delete'), (\n \"Search action '{}' is invalid; must be 'index' or 'delete'.\".format(action)\n )\n client = get_cl... | [
"0.6114911",
"0.60365725",
"0.5861254",
"0.5804107",
"0.5671076",
"0.5647309",
"0.5610553",
"0.55418354",
"0.54728705",
"0.5446432",
"0.54092526",
"0.5317401",
"0.5312133",
"0.5300207",
"0.5270637",
"0.5263822",
"0.5221483",
"0.52079105",
"0.52076936",
"0.5187252",
"0.5147635... | 0.6880826 | 0 |
Fetch the object's document from a search index by id. | def fetch_search_document(self, index):
assert self.pk, "Object must have a primary key before being indexed."
client = get_client()
return client.get(
index=index,
doc_type=self.search_doc_type,
id=self.pk
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index, id):\n url = f'{self.host}{index}/_doc/{id}'\n resp = requests.get(url)\n return resp.json()",
"def get_document(obj):\n try:\n return ES.get(\n index=obj.get_index_name(), doc_type=obj.get_document_type(), id=obj.pk)\n except NotFoundError:\n ... | [
"0.7451625",
"0.7426841",
"0.70965815",
"0.69042456",
"0.68950534",
"0.683454",
"0.68098325",
"0.680101",
"0.6689328",
"0.66572875",
"0.66367185",
"0.65326405",
"0.6498819",
"0.6497084",
"0.64728004",
"0.6467589",
"0.64199156",
"0.6411506",
"0.6387758",
"0.6374079",
"0.637153... | 0.81516916 | 0 |
Update the object in a remote index. This method is used to run index, update and delete actions on the index. We have a single method rather than individual methods in order to preserve the semantics of what we are doing. Irrespective of whether we are creating a new document, or deleting an existing document, from th... | def update_search_index(self, action, index='_all', force=False):
assert action in ('index', 'update', 'delete'), ("Action must be 'index', 'update' or 'delete'.") # noqa
assert self.pk, "Object must have a primary key before being indexed."
if force is True:
logger.debug("Forcing ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_object(self, instance, using=None, **kwargs):\n # Check to make sure we want to index this first.\n if self.should_update(instance, **kwargs):\n backend = self.get_backend(using)\n\n if backend is not None:\n backend.update(self, [instance])",
"def up... | [
"0.64973885",
"0.6414045",
"0.6368744",
"0.62488747",
"0.6213027",
"0.616455",
"0.60662246",
"0.60076994",
"0.60076994",
"0.60076994",
"0.59989995",
"0.59730965",
"0.5964075",
"0.5941014",
"0.5921705",
"0.58999556",
"0.5883253",
"0.58506846",
"0.57973766",
"0.572611",
"0.5717... | 0.64206344 | 1 |
Call the relevant api function. This is where the API itself is used (for single document actions), but it shouldn't be used directly the public method is `update_search_index`. | def _do_search_action(self, index, action, force=False):
assert self.pk, "Object must have a primary key before being indexed."
assert action in ('index', 'delete'), (
"Search action '{}' is invalid; must be 'index' or 'delete'.".format(action)
)
client = get_client()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_search_index(self, action, index='_all', force=False):\n assert action in ('index', 'update', 'delete'), (\"Action must be 'index', 'update' or 'delete'.\") # noqa\n assert self.pk, \"Object must have a primary key before being indexed.\"\n\n if force is True:\n logger.d... | [
"0.6918544",
"0.6565842",
"0.6234954",
"0.6125301",
"0.6124582",
"0.6043194",
"0.59729326",
"0.5941542",
"0.59045607",
"0.5901532",
"0.5900923",
"0.5893023",
"0.58716017",
"0.58256304",
"0.581556",
"0.58026314",
"0.5782407",
"0.5718546",
"0.5697755",
"0.567292",
"0.5656317",
... | 0.6913199 | 1 |
List of doc_types extracted from hits. | def doc_types(self):
return self._extract_set('doc_type') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTypesList():\n return Gw2Spidy._request('types')['results']",
"def document_types(db: Session = Depends(get_db)):\n return get_document_types(db)",
"def list_available_document_types(cls):\n\n response = cls._client.get(\"automatedDocumentOptions/\")\n return from_api(response.js... | [
"0.6952917",
"0.6879862",
"0.63893485",
"0.6322659",
"0.6320396",
"0.62930685",
"0.6265819",
"0.6251802",
"0.6201937",
"0.61388046",
"0.61269486",
"0.6124253",
"0.611986",
"0.6074587",
"0.60474944",
"0.593924",
"0.5935564",
"0.5926073",
"0.5899107",
"0.58685446",
"0.5822308",... | 0.8346731 | 0 |
The max relevance score in the returned page. | def max_score(self):
return max(self._extract_set('score') or [0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_score(self):\r\n return self.lcp.get_max_score()",
"def get_max_score(self):\r\n maxscore = 0\r\n for responder in self.responders.values():\r\n maxscore += responder.get_max_score()\r\n return maxscore",
"def max_score(self):\n return self.raw_possible",
... | [
"0.76658165",
"0.7388483",
"0.73434436",
"0.7306693",
"0.7241699",
"0.7122095",
"0.70414704",
"0.70045257",
"0.6962654",
"0.69466114",
"0.68930626",
"0.68438125",
"0.6801763",
"0.6801763",
"0.67588747",
"0.6756714",
"0.6755588",
"0.6690131",
"0.6664121",
"0.66097033",
"0.6591... | 0.77822024 | 0 |
The min relevance score in the returned page. | def min_score(self):
return min(self._extract_set('score') or [0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def relevance(self):\n return self.metadata.relevance",
"def _tmdb_score(title, min_votes=0):\n info = tmdb_info(title)\n if info:\n if min_votes and info['votes'] < min_votes:\n ret... | [
"0.6556876",
"0.6556876",
"0.6471062",
"0.64088386",
"0.6408385",
"0.6394548",
"0.6357086",
"0.6329675",
"0.6329675",
"0.6329516",
"0.63281",
"0.63099796",
"0.63099796",
"0.63099796",
"0.62903345",
"0.62828356",
"0.6275028",
"0.6274877",
"0.62644005",
"0.625758",
"0.625758",
... | 0.7817991 | 0 |
List of model ids extracted from hits. | def object_ids(self):
return self._extract_set('id') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids(self):\n return self.obj_to_id.values()",
"def get_ids(self):\n return self._ids",
"def ids(self):\n return self._ids",
"def get_ids(self):\n return [item.id for item in self.items]",
"def queryModelIDs(self):\n jobID = self.getJobID()\n modelCounterPairs = _client... | [
"0.71665776",
"0.7063865",
"0.6941428",
"0.6934743",
"0.69304943",
"0.69272566",
"0.6774233",
"0.671003",
"0.6693273",
"0.65672094",
"0.65672094",
"0.65426296",
"0.6498932",
"0.6491286",
"0.63350385",
"0.63344187",
"0.62961274",
"0.62957495",
"0.62957495",
"0.6276173",
"0.626... | 0.7103743 | 1 |
The number of hits returned in this specific page. | def page_size(self):
return 0 if self.hits is None else len(self.hits) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages_count(self):\n return self._pages_count",
"def num_pages(self):\n if self.count == 0 and not self.allow_empty_first_page:\n return 0\n hits = max(1, self.count + self.delta - self.orphans)\n return ceil(hits / self.per_page)",
"def pagecount(self):\r\n \r... | [
"0.77694356",
"0.77412695",
"0.7675726",
"0.7626574",
"0.7572651",
"0.7572651",
"0.74170226",
"0.7412009",
"0.73387486",
"0.7309016",
"0.73068863",
"0.729909",
"0.72550625",
"0.72550625",
"0.72550625",
"0.7188882",
"0.71541226",
"0.71541226",
"0.71541226",
"0.71541226",
"0.71... | 0.83584166 | 0 |
Class to query a Datascope event database and cache them in memory. The origin table is the main source of information. The system will try to join with the event table if present. The netmag table will be imported into memory and used to expand the events. | def __init__(self, db=False, subset=False):
self.logging = getLogger(self.__class__.__name__)
self.logging.debug( "Events.init()" )
self.db = False
self.database = False
self.db_subset = False
self.cache = []
self.cache_error = []
self.mags = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_events(self):\n self.cache = []\n\n # Test if we have event table\n with datascope.closing(datascope.dbopen(self.db, 'r')) as db:\n dbtable = db.lookup(table='event')\n if dbtable.query(datascope.dbTABLE_PRESENT):\n steps = ['dbopen event']\n ... | [
"0.69783866",
"0.5349693",
"0.52069503",
"0.5144481",
"0.51322794",
"0.5128527",
"0.50626254",
"0.50242347",
"0.5014091",
"0.4993624",
"0.4978717",
"0.49536344",
"0.4934686",
"0.49288464",
"0.49226472",
"0.49145666",
"0.48806596",
"0.48679075",
"0.48641053",
"0.48602834",
"0.... | 0.6325453 | 1 |
Verify if the md5 checksum changed on any table | def need_update(self):
self.logging.debug( "need_update()" )
for name in self.tables:
md5 = self.dbs_tables[name]['md5']
test = get_md5(self.dbs_tables[name]['path'])
self.logging.debug('(%s) table:%s md5:[old: %s new: %s]' % \
(self.db,name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_md5(self):\n\n self.log.info('-' * 80)\n self.log.info('Check md5 sum')\n\n self.log.info(self._ref_value)\n self.log.info(self._output_file)\n\n code, out = cmd_exec(['md5sum', self._output_file], shell=False, log=self.log)\n if code:\n self.log.erro... | [
"0.770359",
"0.76292247",
"0.73823935",
"0.69847894",
"0.697648",
"0.69523257",
"0.6907041",
"0.6823491",
"0.67470604",
"0.67122424",
"0.67055136",
"0.6670896",
"0.66100645",
"0.6602655",
"0.6592046",
"0.6581493",
"0.6563163",
"0.65491134",
"0.653767",
"0.65001315",
"0.648601... | 0.7708786 | 0 |
Get all mags from the database into memory | def _get_magnitudes(self):
self.logging.debug('Get magnitudes ' )
self.mags = {}
steps = ['dbopen netmag', 'dbsubset orid != NULL']
fields = ['orid', 'magid', 'magnitude', 'magtype',
'auth', 'uncertainty', 'lddate']
for v in extract_from_db(self.db, steps, fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_genres(self):\n self.cursor.execute(\"select * from genres\")\n self.connection.commit()\n return self.cursor.fetchall()",
"def all(self):\n genres = []\n for row in self.db.cursor().execute('SELECT genre_id, name FROM genres'):\n genre = {\n 'id' : row[0],\n ... | [
"0.67692447",
"0.6396449",
"0.604201",
"0.5978799",
"0.5954716",
"0.59407586",
"0.5940616",
"0.59133315",
"0.5885812",
"0.58361477",
"0.58270967",
"0.58218664",
"0.5787752",
"0.5779609",
"0.575476",
"0.5746979",
"0.5669602",
"0.5622532",
"0.56192636",
"0.5606377",
"0.55960184... | 0.66330016 | 1 |
Read all orids/evids from the database and update local dict with the info. | def _get_events(self):
self.cache = []
# Test if we have event table
with datascope.closing(datascope.dbopen(self.db, 'r')) as db:
dbtable = db.lookup(table='event')
if dbtable.query(datascope.dbTABLE_PRESENT):
steps = ['dbopen event']
ste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n\n args = self.id, self.name\n self.loader.session.logger.debug(\"loading CDR%d (%r)\", *args)\n cursor = self.loader.dictionary_cursor\n cursor.execute(self.DICTIONARY_INSERT, self.entry)\n for alias in self.aliases:\n cursor.e... | [
"0.5781155",
"0.57316047",
"0.5668554",
"0.5555153",
"0.5488733",
"0.54796994",
"0.5454843",
"0.5450531",
"0.5370572",
"0.5360263",
"0.53518814",
"0.5325593",
"0.53206944",
"0.53159326",
"0.5306824",
"0.5266311",
"0.5261821",
"0.5258175",
"0.52259356",
"0.52182364",
"0.519610... | 0.5941622 | 0 |
/notifications/api/getNotifications List posts based on the category assigned | def list_notifications():
token = request.args.get('token')
user = User.query.filter_by(token=token).first()
if user is None:
return jsonify({"error": "Access Denied!"})
# Filter Posts so the user doesn't have to filter it
notifications = Notifications.query.filter_by(user_id=user.id).orde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_posts_categ(categ):\n return Posts.objects.filter(categories__categ=categ)",
"async def __manage_notification_posts(self, notification: Notification):\n notification_type = self.determine_notification_type(notification.message)\n community = self.get_community_by_id(notification.communit... | [
"0.61696225",
"0.59987503",
"0.5931034",
"0.58415323",
"0.57586706",
"0.570211",
"0.5693643",
"0.56920666",
"0.5668849",
"0.5659656",
"0.56538504",
"0.56501734",
"0.56176597",
"0.5606255",
"0.5574934",
"0.5565787",
"0.5554651",
"0.5540666",
"0.5517051",
"0.5507216",
"0.549135... | 0.6184567 | 0 |
/notifications/api/PushToken Get Device Tokens for notifications | def post_token():
token = request.json.get('token')
deviceId = request.json.get('deviceId')
user = User.query.filter_by(token=token).first()
device = DevicesNotificationHandlers.query.filter_by(user_id=user.id).first()
if device is None:
# Device doesn't exist for that user create a new on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polling_tokens(device_code, interval=5, expires_in=300):\n\tbegin = time.time()\n\twhile(time.time() - begin < expires_in):\n\t\t# wait a while than ask server\n\t\ttime.sleep(interval)\n\t\tclient = BaiduOpenApi()\n\t\ttry:\n\t\t\tresp = client.token.get(grant_type=\"device_token\", code=device_code)\n\t\texc... | [
"0.6019783",
"0.5975728",
"0.58894217",
"0.58671975",
"0.5855121",
"0.57590306",
"0.5756767",
"0.57392013",
"0.5729904",
"0.5712237",
"0.5674434",
"0.56374496",
"0.5635206",
"0.56257427",
"0.56257427",
"0.56178385",
"0.560231",
"0.5591384",
"0.55362886",
"0.55210596",
"0.5494... | 0.6261006 | 0 |
Sample a batch of `batch_n` observations and indices from the the dataset, with replacement. | def sample_obs(batch_n):
inds = np.random.randint(0, len(all_images), size=batch_n)
return all_images[inds], inds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self, batch_size):\n indices = np.random.randint(len(self._storage), size=batch_size)\n return [self._storage[i] for i in indices]",
"def _sample(self, batch_size):\n idx = np.random.choice(np.arange(len(self.memory)), \n size=batch_size, \n ... | [
"0.65141034",
"0.65019155",
"0.64934266",
"0.6463601",
"0.6456993",
"0.6456201",
"0.64316404",
"0.6424302",
"0.6365653",
"0.6241075",
"0.6240909",
"0.6231657",
"0.6219816",
"0.6219816",
"0.61779547",
"0.6159563",
"0.6091066",
"0.60081697",
"0.60081697",
"0.59834576",
"0.59745... | 0.66770536 | 1 |
The oracle for states, from a batch of indices. | def oracle(indices):
return [all_states[inds] for inds in indices] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_state_index(self):\n\n # the index for the system state\n # [rho_i, q_in, q_out, r_i, f_i]\n x_index = {}\n\n # add the density index\n x_index['density'] = OrderedDict()\n for i in range(0, self.num_cells):\n x_index['density'][i] = i\n dim_s... | [
"0.6028185",
"0.5510295",
"0.54503596",
"0.54289967",
"0.53396046",
"0.53224134",
"0.52318084",
"0.52286994",
"0.52063507",
"0.5148853",
"0.51339924",
"0.51260686",
"0.51138884",
"0.5107481",
"0.5096806",
"0.50801283",
"0.5070177",
"0.5067803",
"0.50344205",
"0.5032731",
"0.5... | 0.8356441 | 1 |
Scrapes the HTML of a given song Lyrics or Chords | def get_lyrics_or_chords(url):
html = ''
if 'cifraclub' in url:
if url.startswith('https://m.'):
url = 'https://www.' + url[10:] # So we don't have to deal with mobile URLs
url += 'imprimir.html#columns=false' # Printer Friendly page (it's cleaner)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_lyrics(self, url):\n # data=requests.get(url,proxies=proxyDict) # will be used when internet is accessed via proxy server\n page = requests.get(url) # for accessing internet without proxy server\n # Regex out the lyrics from the html content\n lyrics = re.search(b'<!-- start ... | [
"0.7336098",
"0.7036594",
"0.69661325",
"0.6927488",
"0.6886977",
"0.68562865",
"0.6726934",
"0.65706176",
"0.65200454",
"0.6473518",
"0.64335024",
"0.64000124",
"0.63685286",
"0.63406646",
"0.6171519",
"0.6168795",
"0.61391014",
"0.6131795",
"0.61156654",
"0.60086775",
"0.59... | 0.73602945 | 0 |
Adds a song to the association list | def associate_song(self, song):
self.songs.append(song) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(self, song):\n self.songs.append(song)",
"def add_song(self, song: Song):\n self.playlist.append(song)",
"def add_song(self, song: Song) -> None:\n\n self.songs.append(song)\n self.set_song_count(len(self.songs))",
"def add_song(self, song, position=None):\n if... | [
"0.816243",
"0.7898532",
"0.7580723",
"0.73656243",
"0.7316321",
"0.7304929",
"0.7116726",
"0.7052165",
"0.7017573",
"0.7014013",
"0.7009018",
"0.69905627",
"0.6839385",
"0.6839385",
"0.68015957",
"0.6786187",
"0.6784577",
"0.668205",
"0.6659392",
"0.6659392",
"0.659461",
"... | 0.8605764 | 0 |
Removes a song from the association list | def disassociate_song(self, song):
self.songs.remove(song) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_song(self, song):\n # code omitted\n self.playlist.remove(song)",
"def remove_song(self):\n self.stop()\n self.listbox.delete(\"anchor\")\n pygame.mixer.music.stop()",
"def track_del(self,posicion):\n self.tracks.pop(posicion)",
"def unlink(self):\n ... | [
"0.775421",
"0.71556664",
"0.6899364",
"0.68764776",
"0.6579365",
"0.6466612",
"0.6456764",
"0.63530624",
"0.63494784",
"0.6337373",
"0.63290584",
"0.6316999",
"0.6291899",
"0.6289584",
"0.62257844",
"0.6221237",
"0.62113404",
"0.61734504",
"0.6170834",
"0.61576843",
"0.61382... | 0.8199224 | 0 |
Adds a song to the show's setlist | def add_song(self, song):
self.songs.append(song) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(self, song: Song):\n self.playlist.append(song)",
"def add_song(self):\n settings = dict(initialdir=pathlib.Path().absolute(), title=\"Choose songs\", filetypes=(\n (\"flac files\", \"*.flac\"),\n (\"mp3 files\", \"*.mp3\"),\n (\"all files\", \"*\")))\n... | [
"0.75482315",
"0.7327472",
"0.72115904",
"0.7169756",
"0.69945985",
"0.6920943",
"0.6854141",
"0.68124956",
"0.680045",
"0.6767763",
"0.674356",
"0.66010946",
"0.646759",
"0.64540094",
"0.6423768",
"0.6408834",
"0.63682777",
"0.63463426",
"0.63338345",
"0.63011074",
"0.626126... | 0.75712657 | 0 |
Assigns the correct order position for a new song added to the setlist | def assign_position(self, song, pos=None):
if not pos:
next_order = self.__get_max_pos() + 1
else:
next_order = pos
update = text(
"update setlist set song_position = :order where show_id = :show_id and song_id = :song_id")
update = update.bindparams(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_songs(self, song, position=None):\n song_found = find_object(song, self.tracks)\n if song_found is None:\n song_found = Song(song, self.artist)\n if position is None:\n self.tracks.append(song_found)\n else:\n self.tracks.insert(p... | [
"0.67441195",
"0.6640424",
"0.6640424",
"0.6618204",
"0.648145",
"0.6475213",
"0.6430216",
"0.6338402",
"0.62786275",
"0.61284614",
"0.60957885",
"0.60904115",
"0.607516",
"0.60354465",
"0.5894118",
"0.5889172",
"0.5879517",
"0.58667374",
"0.58333194",
"0.5796641",
"0.5784943... | 0.72461 | 0 |
reads file_name and returns specific header data and image data | def read_file(file_name):
fits_file = fits.open(file_name)
header = fits_file[0].header
image_data = fits_file[1].data
segmentation_data = fits_file[2].data
header_keywords = {'CRVAL3': 0, 'CRPIX3': 0, 'CD3_3': 0}
# clause to differentiate between CDELT3 and CD3_3
for hdr_key, hdr_value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_first_image(file_name):\n pixels = None\n try : # open file_name\n with fits.open(file_name) as fits_blocks:\n block = fits_blocks[0]\n pixels = block.data\n header = block.header\n except IOError:\n print(\"Error while opening/reading file !\")\n ... | [
"0.7152327",
"0.7034994",
"0.68469965",
"0.6712973",
"0.6712973",
"0.6642779",
"0.6642085",
"0.6634656",
"0.6571987",
"0.6544345",
"0.6509576",
"0.64663404",
"0.6464217",
"0.6446039",
"0.6425835",
"0.6410152",
"0.63902926",
"0.635887",
"0.63469213",
"0.63421416",
"0.6331557",... | 0.72085863 | 0 |
collapses image data so it can be passed as a heatmap | def image_collapser(file_name):
file_data = read_file(file_name)
header_data = file_data[0]
image_data = file_data[1]
data_shape = np.shape(image_data)
ra_axis = data_shape[2]
dec_axis = data_shape[1]
wl_axis = data_shape[0]
image_median = np.zeros((ra_axis, dec_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heatmap(data, row_labels, col_labels, ax=None,\r\n cbar_kw={}, cbarlabel=\"\", title = \"Default\", x_title=\" \",y_title=\" \",saveFile = None, **kwargs):",
"def heatmap(data, row_labels, col_labels, ax=None,\n cbar_kw={}, cbarlabel=\"\", **kwargs):\n\n if not ax:\n ax = plt.... | [
"0.6003501",
"0.58450407",
"0.58384264",
"0.58285505",
"0.5817254",
"0.5814876",
"0.5776963",
"0.57769257",
"0.57769257",
"0.57769257",
"0.57549274",
"0.5752561",
"0.57514924",
"0.5709506",
"0.5652432",
"0.5641107",
"0.56333303",
"0.56221694",
"0.55792964",
"0.55444914",
"0.5... | 0.59895146 | 1 |
stacking all spectra together for a stacked spectra image | def spectra_stacker(file_name):
file_data = read_file(file_name)
image_data = file_data[1]
data_shape = np.shape(image_data)
ra_axis = data_shape[2]
dec_axis = data_shape[1]
wl_axis = data_shape[0]
pxl_total = ra_axis * dec_axis
data_unwrap = []
for i_ra in r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack_tifs(tifseries, xsize, ysize):\n holster = np.empty((len(tifseries), ysize, xsize))\n for i, layer in enumerate(tifseries):\n lay = Image.open(layer)\n lis = list(lay.getdata())\n holster[i] = np.array(lis, np.uint16).reshape(512, 512)\n\n return holster",
"def single_chan... | [
"0.6319909",
"0.6167173",
"0.59328806",
"0.5752492",
"0.5703394",
"0.5695134",
"0.5692704",
"0.5687164",
"0.56263644",
"0.56126064",
"0.56097245",
"0.5592162",
"0.55830437",
"0.5562208",
"0.554866",
"0.554608",
"0.55380195",
"0.5532987",
"0.55156374",
"0.5505991",
"0.54881674... | 0.78661686 | 0 |
returning sky noise data files | def sky_noise(sky_file_name):
fits_file = fits.open(sky_file_name)
image_data = fits_file[0].data
return image_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sky_noise_weighting(file_name, sky_file_name):\n cs_data = spectra_analysis(file_name, sky_file_name)\n cube_data = cs_data['gd_shifted']\n sn_data = cs_data['sky_noise']\n wl_soln = wavelength_solution(file_name)\n\n sn_data_min = np.min(sn_data)\n in_wt = 1 / (sn_data - ... | [
"0.6672927",
"0.6171649",
"0.6104584",
"0.6076656",
"0.60088277",
"0.5964392",
"0.59620947",
"0.5923968",
"0.5866682",
"0.5861414",
"0.58495903",
"0.583809",
"0.576311",
"0.57543224",
"0.57415617",
"0.5737368",
"0.57167196",
"0.56977427",
"0.5678975",
"0.56522715",
"0.5629530... | 0.747295 | 0 |
finding the sky noise from a small section of the cube data | def sky_noise_weighting(file_name, sky_file_name):
cs_data = spectra_analysis(file_name, sky_file_name)
cube_data = cs_data['gd_shifted']
sn_data = cs_data['sky_noise']
wl_soln = wavelength_solution(file_name)
sn_data_min = np.min(sn_data)
in_wt = 1 / (sn_data - sn_data_min ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sky_noise(sky_file_name):\n fits_file = fits.open(sky_file_name)\n image_data = fits_file[0].data\n return image_data",
"def raw_noise_3d(x, y, z):\n # Noise contributions from the four corners\n n0, n1, n2, n3 = 0.0, 0.0, 0.0, 0.0\n\n # Skew the input space to determine which simplex cell ... | [
"0.6544532",
"0.64800555",
"0.63136536",
"0.6282623",
"0.62376356",
"0.6215706",
"0.61573476",
"0.6155827",
"0.6128059",
"0.59894645",
"0.5986457",
"0.5980787",
"0.5966443",
"0.59574175",
"0.59399533",
"0.5909733",
"0.5900805",
"0.58751225",
"0.581095",
"0.5783102",
"0.577698... | 0.6669872 | 0 |
Graphs and results from analysing the cube for OII spectra | def analysis(file_name, sky_file_name):
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.rcParams['text.latex.preamble'] = [r'\boldmath']
curr_file_name = file_name.split('.')
curr_file_name = curr_file_name[0].split('/')
stk_f_n = curr_file_name[-1]
data_dir = 'cube_results/'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_overview(cube=nro_12co,\n region_file='../shell_candidates/AllShells.reg', mode='peak', plotname='12co_peak_shells.png',\n interactive=False, show_shells=True, shells_highlight=None, dist=orion_dist, vmin=None, vmax=None,\n scalebar_color=\"white\", scalebar_pc = 1., scale_factor=1., pmin=0.25,\n pmax=99.... | [
"0.64142716",
"0.6320089",
"0.6287019",
"0.6280581",
"0.61431366",
"0.6118349",
"0.603638",
"0.59784335",
"0.5870536",
"0.5825816",
"0.5799746",
"0.57566863",
"0.5732627",
"0.57176316",
"0.570732",
"0.57044226",
"0.57007146",
"0.56982803",
"0.56896895",
"0.5682161",
"0.567208... | 0.65915024 | 0 |
Return the encoding configurations. | def get_encoding():
return {
"resolution": RESOLUTION,
"max_beat": MAX_BEAT,
"max_duration": MAX_DURATION,
"dimensions": DIMENSIONS,
"n_tokens": N_TOKENS,
"type_code_map": TYPE_CODE_MAP,
"beat_code_map": BEAT_CODE_MAP,
"position_code_map": POSITION_COD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodings():\n from . import factory\n return factory.MAPPINGS.keys()",
"def encoding(self):\n return self.get_encoding()",
"def get_encoding_dict(self) -> BoardEncodingDict:\n encoding_dict: BoardEncodingDict = {field: formats['code'] for field, formats in self.board_formatting.items()... | [
"0.7196986",
"0.6391528",
"0.6323964",
"0.62805516",
"0.627801",
"0.6254596",
"0.6254596",
"0.6254596",
"0.6254596",
"0.62156177",
"0.6185704",
"0.6149148",
"0.61239785",
"0.6047376",
"0.59905833",
"0.59721977",
"0.5971159",
"0.5943697",
"0.5940476",
"0.5937188",
"0.5913786",... | 0.6965181 | 1 |
Load encoding configurations from a JSON file. | def load_encoding(filename):
encoding = utils.load_json(filename)
for key in (
"code_type_map",
"code_beat_map",
"code_position_map",
"code_duration_map",
"code_pitch_map",
"code_instrument_map",
"beat_code_map",
"position_code_map",
"durat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json_file(filename, encoding):\n with open(filename, \"r\", encoding=encoding) as file:\n return json.loads(file.read())",
"def load(self):\n with io.open(self.filename, encoding='utf-8') as f:\n self.load_from_dict(json.loads(f.read()))",
"def _loadf(fname):\n with open... | [
"0.6796669",
"0.6633219",
"0.6625755",
"0.6585273",
"0.6585093",
"0.6581172",
"0.6569757",
"0.64761347",
"0.6433844",
"0.6431636",
"0.639965",
"0.6395249",
"0.63800514",
"0.6369832",
"0.63656116",
"0.635339",
"0.6347947",
"0.6344305",
"0.63001573",
"0.6281698",
"0.6243059",
... | 0.72621405 | 0 |
Encode a note sequence into a sequence of codes. Each row of the input is a note specified as follows. (beat, position, pitch, duration, program) Each row of the output is encoded as follows. (event_type, beat, position, pitch, duration, instrument) | def encode_notes(notes, encoding):
# Get variables
max_beat = encoding["max_beat"]
max_duration = encoding["max_duration"]
# Get maps
type_code_map = encoding["type_code_map"]
beat_code_map = encoding["beat_code_map"]
position_code_map = encoding["position_code_map"]
pitch_code_map = en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midi_encode(note_seq, resolution=NOTES_PER_BEAT, step=1):\r\n # Instantiate a MIDI Pattern (contains a list of tracks)\r\n pattern = midi.Pattern()\r\n pattern.resolution = resolution\r\n # Instantiate a MIDI Track (contains a list of MIDI events)\r\n track = midi.Track()\r\n # Append the tra... | [
"0.6740961",
"0.65631074",
"0.6164742",
"0.59166384",
"0.57374144",
"0.5716505",
"0.5697939",
"0.5675501",
"0.5630742",
"0.5608356",
"0.5604651",
"0.55331695",
"0.5432873",
"0.5395016",
"0.5372761",
"0.52970475",
"0.5269905",
"0.5269865",
"0.5247064",
"0.52140176",
"0.5208965... | 0.78958285 | 0 |
Encode a MusPy music object into a sequence of codes. Each row of the input is encoded as follows. (event_type, beat, position, pitch, duration, instrument) Each row of the output is a note specified as follows. (beat, position, pitch, duration, program) | def encode(music, encoding):
# Extract notes
notes = extract_notes(music, encoding["resolution"])
# Encode the notes
codes = encode_notes(notes, encoding)
return codes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_notes(notes, encoding):\n # Get variables\n max_beat = encoding[\"max_beat\"]\n max_duration = encoding[\"max_duration\"]\n\n # Get maps\n type_code_map = encoding[\"type_code_map\"]\n beat_code_map = encoding[\"beat_code_map\"]\n position_code_map = encoding[\"position_code_map\"]\... | [
"0.6751503",
"0.58998185",
"0.58792573",
"0.5753416",
"0.57350045",
"0.57203877",
"0.5710702",
"0.57039887",
"0.560403",
"0.54966694",
"0.54772043",
"0.54606825",
"0.5426363",
"0.5379973",
"0.53588927",
"0.5329186",
"0.5308552",
"0.5216556",
"0.52106076",
"0.51948136",
"0.518... | 0.66725767 | 1 |
Decode codes into a note sequence. Each row of the input is encoded as follows. (event_type, beat, position, pitch, duration, instrument) | def decode_notes(codes, encoding):
# Get variables and maps
code_type_map = encoding["code_type_map"]
code_beat_map = encoding["code_beat_map"]
code_position_map = encoding["code_position_map"]
code_pitch_map = encoding["code_pitch_map"]
code_duration_map = encoding["code_duration_map"]
code... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_notes(notes, encoding):\n # Get variables\n max_beat = encoding[\"max_beat\"]\n max_duration = encoding[\"max_duration\"]\n\n # Get maps\n type_code_map = encoding[\"type_code_map\"]\n beat_code_map = encoding[\"beat_code_map\"]\n position_code_map = encoding[\"position_code_map\"]\... | [
"0.6380483",
"0.5985148",
"0.5767085",
"0.56506217",
"0.5615601",
"0.55037344",
"0.54972893",
"0.5476481",
"0.545413",
"0.5422797",
"0.52581054",
"0.5238965",
"0.5235624",
"0.52087545",
"0.5195493",
"0.51634544",
"0.5116737",
"0.51153195",
"0.51096725",
"0.51060724",
"0.50778... | 0.76253533 | 0 |
Reconstruct a note sequence to a MusPy Music object. | def reconstruct(notes, resolution):
# Construct the MusPy Music object
music = muspy.Music(resolution=resolution, tempos=[muspy.Tempo(0, 100)])
# Append the tracks
programs = sorted(set(note[-1] for note in notes))
for program in programs:
music.tracks.append(muspy.Track(program))
# Ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_mido(midi: MidiFile, duplicate_note_mode: str = \"fifo\") -> Music:\n if duplicate_note_mode.lower() not in (\"fifo\", \"lifo\", \"close_all\"):\n raise ValueError(\n \"`duplicate_note_mode` must be one of 'fifo', 'lifo' and \"\n \"'close_all'.\"\n )\n\n def _get_... | [
"0.6578651",
"0.63463986",
"0.6268673",
"0.6038076",
"0.60004234",
"0.5953073",
"0.59524804",
"0.59465194",
"0.5924278",
"0.59042096",
"0.58929247",
"0.5815871",
"0.5809912",
"0.56604475",
"0.5645962",
"0.56394255",
"0.562787",
"0.5606897",
"0.5577712",
"0.554084",
"0.5527893... | 0.814302 | 0 |
Decode codes into a MusPy Music object. Each row of the input is encoded as follows. (event_type, beat, position, pitch, duration, instrument) | def decode(codes, encoding):
# Get resolution
resolution = encoding["resolution"]
# Decode codes into a note sequence
notes = decode_notes(codes, encoding)
# Reconstruct the music object
music = reconstruct(notes, resolution)
return music | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_notes(codes, encoding):\n # Get variables and maps\n code_type_map = encoding[\"code_type_map\"]\n code_beat_map = encoding[\"code_beat_map\"]\n code_position_map = encoding[\"code_position_map\"]\n code_pitch_map = encoding[\"code_pitch_map\"]\n code_duration_map = encoding[\"code_dur... | [
"0.6485881",
"0.5630982",
"0.5441565",
"0.54146093",
"0.5343019",
"0.52716076",
"0.5189492",
"0.5142789",
"0.51371944",
"0.51262677",
"0.51186574",
"0.5115401",
"0.5076274",
"0.5075949",
"0.5026415",
"0.5023347",
"0.5015565",
"0.5015518",
"0.4999851",
"0.49973074",
"0.4985901... | 0.6843416 | 0 |
transform the camera pose from camera coordinate to body coordinate | def relative_pose_cam_to_body(
relative_scene_pose, Rt_cam2_gt
):
relative_scene_pose = (
np.linalg.inv(Rt_cam2_gt)
@ relative_scene_pose
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_camera_pose_to_world_pose(self):\n for pose in self.close_positions_camera:\n self.close_positions_world.append(self.get_world_pose_for_camera_pose(pose))\n\n for pose in self.medium_positions_camera:\n self.medium_positions_world.append(self.get_world_pose_for_cam... | [
"0.7164684",
"0.69407386",
"0.6911919",
"0.6907372",
"0.6832704",
"0.6802233",
"0.6679276",
"0.6656889",
"0.6633154",
"0.6590521",
"0.65902764",
"0.6550347",
"0.6423251",
"0.63746464",
"0.6364696",
"0.63294846",
"0.63253635",
"0.63185096",
"0.62996155",
"0.62637895",
"0.62607... | 0.7581324 | 0 |
Proactively learn. This contributes to productivity etc. but also has consequences such as either costs and/or unemployment etc. | def learn(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learn(self):\n self._eval_td_online()",
"def learn(self):\n self._eval_td_online()",
"def learn(self):\n raise NotImplementedError",
"def learn(self):\n raise NotImplementedError()",
"def learn(self):\n if self.step_count < self.learn_start_step or self.step_count % s... | [
"0.71227986",
"0.71227986",
"0.694602",
"0.68771917",
"0.68016714",
"0.66555744",
"0.65224063",
"0.6472361",
"0.62127495",
"0.62127495",
"0.61834574",
"0.6181687",
"0.61652756",
"0.61012554",
"0.60364646",
"0.6030477",
"0.5935162",
"0.59283334",
"0.59159565",
"0.5910016",
"0.... | 0.7371403 | 1 |
This function returns a singular html template. This template enables the user to view the home page. This is the centre of the program and where you can access all the various different parts of the program through the buttons provided. | def home_page() -> str:
return render_template("home.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template('Main_Page.html')",
"def home():\n return render_template('main.html')",
"def home():\n return render_template('homepage.html')",
"def home():\n return render_template(\"home.html\")",
"def home():\n return render_template(\"home.html\")",
"def home():\... | [
"0.8343259",
"0.82844776",
"0.8245626",
"0.8198781",
"0.8198781",
"0.81965923",
"0.8167671",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
"0.8156996",
... | 0.83848834 | 0 |
This function passes a list to a singular html template which is returned at the end of the function. This template allows the user interface display a drop down menu where the user can select from one of the recipes. Based on this input a scatter graph is produced with a line of best fit. | def projections_input() -> str:
recipe_list = ["Organic Red Helles", "Organic Pilsner",
"Organic Dunkel"]
return render_template("projection_input.html", recipes=recipe_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prediction_input() -> str:\r\n recipe_list = [\"Organic Red Helles\", \"Organic Pilsner\",\r\n \"Organic Dunkel\"]\r\n month_list = [\"Nov\", \"Dec\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\r\n \"Jul\", \"Aug\", \"Sep\", \"Oct\"]\r\n return render_temp... | [
"0.5774077",
"0.5608451",
"0.5561936",
"0.55129004",
"0.5480426",
"0.54774714",
"0.543422",
"0.5414372",
"0.53573513",
"0.53407466",
"0.52239406",
"0.522111",
"0.5214964",
"0.5214064",
"0.51836014",
"0.51566386",
"0.51489043",
"0.5134269",
"0.51317656",
"0.51044095",
"0.51024... | 0.60495955 | 0 |
This function passes a list to a singular html template which is returned at the end of the function. This template allows the user interface to display a drop down menu where the user can select from one of the recipes. Based on this input a message is produced about whether a brew has started or not. | def start_brew() -> str:
recipe_names = ["Organic Red Helles", "Organic Pilsner",
"Organic Dunkel"]
return render_template("start_brew.html",
recipes=recipe_names,
tank_options=TANKS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_menu(list_recipes):\n\n title = 'PyVegan - List of Recipes'\n menu = CursesMenu(title, 'Select one and press enter')\n msg = 'This search isn\\'t a valid one'\n\n for recipe in list_recipes:\n recipe_title = clean_title(recipe['post_title'])\n\n if 'post_link' in recipe:\n ... | [
"0.621419",
"0.59724915",
"0.5762143",
"0.57547796",
"0.56985635",
"0.56628567",
"0.56454057",
"0.56199235",
"0.5578668",
"0.55690736",
"0.5549563",
"0.55467165",
"0.5538754",
"0.551924",
"0.5501788",
"0.5471447",
"0.5467859",
"0.5449265",
"0.54443914",
"0.5434493",
"0.541988... | 0.6086582 | 1 |
This function passes a list to a singular html template which is returned at the end of the function. This template allows the user interface to display a drop down menu where the user can select from one of the existing tanks. Based on the tank chosen by the user the information about the tank inputted by the user wil... | def viewtank_input() -> str:
tank_list = ["Albert", "Brigadier", "Camilla",
"Dylon", "Emily", "Florence",
"Gertrude", "Harry", "R2D2"]
return render_template("viewtank_input.html",
tanks=tank_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def viewtank_output() -> str:\r\n details_output = []\r\n #Catches tank user has entered on UI\r\n user_tank = request.args.get(\"tank_ask\")\r\n volume_string = (\"The volume of the tank is: \" +\r\n str(brewer_tanks[str(user_tank)][\"Volume\"]))\r\n details_output.append(volume... | [
"0.59864515",
"0.5520241",
"0.54173434",
"0.54156727",
"0.5396332",
"0.5363306",
"0.5339796",
"0.53336185",
"0.5297815",
"0.52959126",
"0.5257918",
"0.5219518",
"0.5212815",
"0.51975244",
"0.5148937",
"0.51449764",
"0.51215297",
"0.5075758",
"0.5066077",
"0.5065343",
"0.50416... | 0.7002382 | 0 |
This function attempts to move a batch chosen by the user onto the next brewing stage. A message is returned and passed to the html template about whether the stage progression was successful. The html template allows the user interface to display a message to the user about whether the stage progression was successful... | def progress_confirm() -> str:
message_display = "Batch is not being Currently Brewed"
#Catches batch number user has entered on UI
user_batch = request.args.get("move_number")
#Catches tank user has entered on UI
next_tank = request.args.get("tank_choice")
print(user_batch)
for brew_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stage_progresser(batch_index, next_tank) -> str:\r\n #Works Out What the Next Stage of the Brewing Process is\r\n #For that specefic batch\r\n current_stage = current_brewings[batch_index][4]\r\n next_stage_index = BREW_STAGES.index(current_stage) + 1\r\n next_stage = BREW_STAGES[next_stage_inde... | [
"0.71859396",
"0.6567839",
"0.6246136",
"0.5573684",
"0.54285645",
"0.53948826",
"0.5381398",
"0.5367852",
"0.53577477",
"0.53353447",
"0.5307604",
"0.528227",
"0.52388763",
"0.5207384",
"0.5202081",
"0.51922524",
"0.5148566",
"0.5081164",
"0.5077573",
"0.5076905",
"0.5070131... | 0.75352204 | 0 |
This function appends the amount of bottles available for delivery for each recipe in a list from the dictionary. These are then passed to a html template that is returned at the end of the function. The html template allows the user to view all the bottles available for delivery for each beer type. This is displayed i... | def view_delivery() -> str:
#List with amount of bottles ready for delivery for each lsit
delivery_amounts = []
delivery_amounts.append(delivery_information["Organic Red Helles"])
delivery_amounts.append(delivery_information["Organic Pilsner"])
delivery_amounts.append(delivery_information["Orga... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def food_page():\n fridge_ingredients = request.args.get('b', 0, type=str) #raw input from HTML form\n global current_user\n current_user.fridge.make_fridge(fridge_ingredients) #uses function imported from recipe_program\n recipe_dictionaries = current_user.get_timed_recipes(time_global) #uses function import... | [
"0.58847153",
"0.5573098",
"0.54876995",
"0.5383232",
"0.5338154",
"0.52467924",
"0.52380025",
"0.522922",
"0.521083",
"0.51952803",
"0.5170571",
"0.5167173",
"0.5165916",
"0.515986",
"0.5151679",
"0.5124872",
"0.5115364",
"0.5102096",
"0.50903946",
"0.5054453",
"0.5050994",
... | 0.6268345 | 0 |
This function takes a single argument which is a list. This list contains all the details a user has entered to add an invoice to the CSV file. The elements in this list will be written to the CSV file. | def data_add(invoice_details):
with open("beer_data.csv", "a") as data_file:
writer = csv.writer(data_file)
writer.writerow(invoice_details)
data_file.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_invoice() -> str:\r\n invoice_details = []\r\n #Catching values user has entered in UI\r\n invoice_number = request.args.get(\"invoice_number\")\r\n invoice_details.append(invoice_number)\r\n customer = request.args.get(\"customer\")\r\n invoice_details.append(customer)\r\n date_requir... | [
"0.7361277",
"0.7244907",
"0.7080601",
"0.663536",
"0.6500241",
"0.6448473",
"0.6443619",
"0.6371742",
"0.63393503",
"0.6305558",
"0.6299153",
"0.6232535",
"0.6218374",
"0.6211686",
"0.6188478",
"0.6147899",
"0.6104435",
"0.6101788",
"0.60683894",
"0.6059451",
"0.60521054",
... | 0.7833147 | 0 |
This forms a dictionary that contains all the sales data from the CSV file. The function reads every row in the file and stores it in a dictionary in sales_data. Every column in the line of the CSV file will be stored under a key value in a dictionary in sales_data.At the end of the function the dictionary that is form... | def dictionary_formation():
sales_data = {}
with open('beer_data.csv', "r") as data_file:
file_contents = csv.reader(data_file, delimiter=',')
#Value of lines_read used as key value for each dictionary
#in sales_data
lines_read = 1
for line in file_contents:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creating_dict_from_csv(self) -> dict:\n dictionary = {}\n for row in self.__read_csv():\n if dictionary.get(row[0]):\n dictionary[row[0]].append((row[1], row[2]))\n else:\n dictionary[row[0]] = [(row[1], row[2])]\n\n for key, value in dic... | [
"0.70411265",
"0.69348884",
"0.6875457",
"0.67172766",
"0.66066664",
"0.65262794",
"0.65049696",
"0.6450559",
"0.6446537",
"0.64248365",
"0.64246345",
"0.6381269",
"0.62797296",
"0.62699",
"0.6248969",
"0.62087405",
"0.6196466",
"0.618667",
"0.61818796",
"0.61143845",
"0.6112... | 0.8339735 | 0 |
This gathers the amount of bottles every month for a recipe entered by the user. The function reads every line the CSV file that has the recipe that is equivalent to the recipe entered by the user. The quanitity ordered is added to an ongoing total that occurs for each month. This is then appended to a list. At the end... | def amount_gathering(user_recipe):
#Forms Dictionary
sales_stats = dictionary_formation()
amount_list = []
month_list = ["Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May",
"Jun", "Jul", "Aug", "Sep", "Oct"]
for month in month_list:
bottles_amount = 0
dicts_rea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_weather(csv_file, month):\n \n counter = 0\n vis_sum = 0\n \n with open(csv_file, 'r') as csvfile:\n reader = csv.reader(csvfile)\n next(reader)\n \n for row in reader:\n if int(row[1]) == month:\n counter += 1\n vis_sum ... | [
"0.5956222",
"0.5567099",
"0.5427176",
"0.53241116",
"0.5308039",
"0.52377987",
"0.5216234",
"0.5197823",
"0.51898104",
"0.51349664",
"0.5099001",
"0.5081856",
"0.5055712",
"0.49900833",
"0.49594194",
"0.49461117",
"0.4923858",
"0.49205756",
"0.48830855",
"0.48385593",
"0.483... | 0.66465265 | 0 |
This function takes the output of amount_gathering and a list where there is a number assinged for each month. Using these two list's an average growth rate is calculated. In simplistic terms, this is the gradient of a line of best fit of a scatter graph produced between the two lists. This growth rate is returned at t... | def growth_calculations(user_recipe) -> int:
month_numbers = np.array([1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12], dtype=np.float64)
month_amounts = np.array(amount_gathering(user_recipe),
dtype=np.float64)
numerator = ((mean(month_numbers) * mean(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_revenue():\n graph = pygal.SolidGauge(inner_radius=0.70)\n usd_formatter = lambda x: '{:.10g}M$'.format(x)\n graph.value_formatter = usd_formatter\n graph.title = \"Average Revenue of Movies per year\"\n\n for year in range(2000, 2017):\n print(\">> Year : %i\" % year)\n\n ... | [
"0.5612376",
"0.5398622",
"0.5396177",
"0.53958905",
"0.5373114",
"0.53691036",
"0.5292515",
"0.5291045",
"0.52772456",
"0.5275606",
"0.52276295",
"0.51909226",
"0.51665837",
"0.5160845",
"0.5156601",
"0.5148589",
"0.5144448",
"0.5126385",
"0.5090026",
"0.50786453",
"0.506472... | 0.6589673 | 0 |
This function moves a batch from conditioning to bottling and labelling. The function returns a string at the end that confirms that brew stage progression was successful and complete. | def bottling_move(batch_index, next_stage) -> str:
#Calculating Current Date and Time
now = datetime.now()
start_time = now.strftime("%d/%m/%Y %H:%M:%S")
#Emptying Current tank
current_tank = current_brewings[batch_index][5]
brewer_tanks[current_tank]["Batch_Content"] = "Nothing"
brew... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stage_progresser(batch_index, next_tank) -> str:\r\n #Works Out What the Next Stage of the Brewing Process is\r\n #For that specefic batch\r\n current_stage = current_brewings[batch_index][4]\r\n next_stage_index = BREW_STAGES.index(current_stage) + 1\r\n next_stage = BREW_STAGES[next_stage_inde... | [
"0.6934222",
"0.67850626",
"0.5911694",
"0.5447182",
"0.53796434",
"0.518632",
"0.51105624",
"0.5012796",
"0.50008255",
"0.49577865",
"0.48849753",
"0.4878007",
"0.48620895",
"0.48583043",
"0.4856492",
"0.4831298",
"0.48267132",
"0.4821905",
"0.48102784",
"0.48094937",
"0.480... | 0.6893113 | 1 |
This function moves a batch entered by the user from one brewing stage to another brewing stage. The function takes the batch and the tank entered by the user and queries this data. If this data is not suitable for the request they have made the function will return a string that states what is wrong with the user inpu... | def stage_progresser(batch_index, next_tank) -> str:
#Works Out What the Next Stage of the Brewing Process is
#For that specefic batch
current_stage = current_brewings[batch_index][4]
next_stage_index = BREW_STAGES.index(current_stage) + 1
next_stage = BREW_STAGES[next_stage_index]
if next... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_batchs_phase() -> str:\r\n batches = app.config[\"batches\"]\r\n tanks = app.config[\"tanks\"]\r\n # Contains HTML form data inputted by the user submitted using POST.\r\n response = request.form\r\n id_input = response.get(\"id_input\") # Batch ID.\r\n phase_input = response.get(\"pha... | [
"0.59549254",
"0.57262814",
"0.5596752",
"0.55302876",
"0.5507202",
"0.5485288",
"0.5402471",
"0.51303035",
"0.50009143",
"0.49649152",
"0.49339688",
"0.4910949",
"0.48962218",
"0.48731947",
"0.48705915",
"0.48553732",
"0.4832123",
"0.48196587",
"0.4812832",
"0.4812584",
"0.4... | 0.60856766 | 0 |
When a user creates a batch this function randomly creates a batch number that can be assigned to the batch. The function creates a list of all the batch numbers that have already been assigned. Then the function will keep randomly choosing numbers until a number is chosen that is not the list assinged_numbers. | def assign_batch_number() -> str:
valid_number = None
assigned_numbers = []
#Creates a list of all the currently assigned batch numbers
for inner_list in current_brewings:
assigned_numbers.append(inner_list[0])
#Keeps randomly generating a number until a number is chosen
#That is ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_numbers():\n\n return random.sample(range(100), 10)",
"def addNbr (self) :\n #we pick out the random number : 2 or 4\n if random.randint(1,10) == 1:\n randomNbr = 4\n else :\n randomNbr = 2\n\n #we pick a random position for the number\n em... | [
"0.5925218",
"0.5769718",
"0.56738186",
"0.56653285",
"0.56636864",
"0.56209266",
"0.556287",
"0.55279195",
"0.55192906",
"0.5458907",
"0.5443326",
"0.5426514",
"0.54240197",
"0.5406687",
"0.5376111",
"0.5353317",
"0.53426677",
"0.53330314",
"0.53214395",
"0.531684",
"0.53163... | 0.781507 | 0 |
This function returns a list of strings that containg the average growth rates of each beer recipe. It aslo returns a string containing the beer recipe with the highest growth rate | def highest_growth_rate():
growth_mappings = {
"Organic Red Helles": 0,
"Organic Pilsner": 0,
"Organic Dunkel": 0
}
rate_strings = []
#Growth Rate of Organic Red Helles
growth_rate = int(growth_calculations("Organic Red Helles"))
growth_mappings["Organic Red ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_leg_average():\n animals = [json.loads(rd.get(key)) for key in rd.keys(\"*\")]\n legs = [animal[\"legs\"] for animal in animals]\n return jsonify(sum(legs) / len(legs))",
"def highest_rated_book(self):\n rating_max = 0\n best_rated_book = \"\"\n for book in self.books.keys()... | [
"0.60324097",
"0.5854897",
"0.57544667",
"0.56736684",
"0.56664133",
"0.56336975",
"0.55221397",
"0.54351413",
"0.5404145",
"0.53701687",
"0.5318423",
"0.531475",
"0.5312521",
"0.5275305",
"0.5261272",
"0.5254371",
"0.5245133",
"0.52418387",
"0.52400905",
"0.5237712",
"0.5236... | 0.7653674 | 0 |
This function searches for all the available tanks that have fermentation and conditioning capabilities. The function returns strings containing all the tanks that are availalable for fermentation and conditioning. The function the decides whether fermentation or conditioning is advisable based on the amount of availab... | def tank_search():
more_fermentation = None
more_fermentation = None
fermentation_tanks = []
conditioning_tanks = []
#Search for available tanks that can ferment
for tank_type in TANKS:
if "Fermenter" in brewer_tanks[tank_type]["Capabilities"]:
if brewer_tanks[tank_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def tanks(self, ctx: commands.Context):\r\n\r\n # Get the user's data\r\n async with self.bot.database() as db:\r\n fish_row = await db(\"\"\"SELECT * FROM user_fish_inventory WHERE user_id = $1\"\"\", ctx.author.id)\r\n tank_rows = await db(\"\"\"SELECT * FROM user_tank_i... | [
"0.52305007",
"0.51204234",
"0.5002136",
"0.49696088",
"0.49644074",
"0.49523833",
"0.49088854",
"0.47911894",
"0.4774548",
"0.47078496",
"0.46512163",
"0.46494102",
"0.46476668",
"0.4643625",
"0.46372905",
"0.46243107",
"0.46144992",
"0.46140963",
"0.46089935",
"0.45985377",
... | 0.80861825 | 0 |
This function calculates the required bottles for the next 3 months based on one of the beer recipes. It calls functions from above that calculate the growth rate and using last months takings and the growth rate it calculates the total bottles for the next three months for a given recipe. | def upcoming_future_prediction(beer_recipe) -> int:
#Growth Rate for Recipe
recipe_growth = growth_calculations(beer_recipe)
#Get all of last years takings
last_years_takings = amount_gathering(beer_recipe)
#Get last months takings
last_takings = last_years_takings[11]
#Adds on to the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def growth_calculations(user_recipe) -> int:\r\n month_numbers = np.array([1, 2, 3, 4, 5, 6,\r\n 7, 8, 9, 10, 11, 12], dtype=np.float64)\r\n month_amounts = np.array(amount_gathering(user_recipe),\r\n dtype=np.float64)\r\n numerator = ((mean(month_n... | [
"0.6482275",
"0.54774326",
"0.5363693",
"0.52600425",
"0.5252613",
"0.52330035",
"0.516651",
"0.5113685",
"0.5033144",
"0.5029605",
"0.5019373",
"0.49526134",
"0.49328604",
"0.48823443",
"0.487453",
"0.48736995",
"0.48307204",
"0.48246542",
"0.4822522",
"0.48220634",
"0.48115... | 0.5813885 | 1 |
This function calculates the amount of bottles that still need to be made. It calculates the bottles needed for the next three months for a given recipe using the function above. Then it subtracts the bottles ready for delivery ,extracted for the delivery_information dictionary, from amount for the next three months. | def bottles_required(beer_recipe):
bottles_demanded = upcoming_future_prediction(beer_recipe)
bottles_ready = delivery_information[beer_recipe]
if bottles_ready > bottles_demanded:
bottles_needed = 0
else:
bottles_needed = bottles_demanded - bottles_ready
return int(bottles_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount_gathering(user_recipe):\r\n #Forms Dictionary\r\n sales_stats = dictionary_formation()\r\n amount_list = []\r\n month_list = [\"Nov\", \"Dec\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\",\r\n \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\"]\r\n for month in month_list:\r\n ... | [
"0.6197609",
"0.5605118",
"0.5473358",
"0.54049957",
"0.53271455",
"0.53227186",
"0.5292431",
"0.52624625",
"0.5247645",
"0.52191204",
"0.52090365",
"0.51699644",
"0.5148692",
"0.51399654",
"0.5113055",
"0.51095116",
"0.50804985",
"0.5069801",
"0.50607175",
"0.50553834",
"0.5... | 0.58797413 | 1 |
This function adds details about a new invoice It catches data entered by the user on the user interface and stores it under variables. Then, all the data stored under these variables are appended to a list. This list is then passed to a function where the details in the list will be written to the CSV file. At the end... | def add_invoice() -> str:
invoice_details = []
#Catching values user has entered in UI
invoice_number = request.args.get("invoice_number")
invoice_details.append(invoice_number)
customer = request.args.get("customer")
invoice_details.append(customer)
date_required = request.args.get("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_add(invoice_details):\r\n with open(\"beer_data.csv\", \"a\") as data_file:\r\n writer = csv.writer(data_file)\r\n writer.writerow(invoice_details)\r\n data_file.close()",
"def invoice():\n name = raw_input(\"What is your name? \")\n\n subtotal = sub_total()\n discount = di... | [
"0.68037605",
"0.65374506",
"0.6422751",
"0.6384396",
"0.6047288",
"0.6014278",
"0.600207",
"0.5989597",
"0.59575945",
"0.5940474",
"0.5825046",
"0.5809321",
"0.56632847",
"0.5640221",
"0.5639734",
"0.5638385",
"0.5592196",
"0.55879194",
"0.55681986",
"0.5558387",
"0.55309534... | 0.85896266 | 0 |
This function predicts the amount of bottles for a month next year entered by the user. It will also be based on the a beer recipe entered by the user. The function passes the growth rate of the recipe entered by the user and the amount predicted for that month entered by the user to a html template that is returned at... | def prediction_output() -> str:
month_coding = {
"Nov": 1, "Dec": 2, "Jan": 3, "Feb": 4, "Mar": 5,
"Apr": 6, "May": 7, "Jun": 8, "Jul": 9, "Aug": 10,
"Sep": 11, "Oct": 12
}
#Catches beer recipe user has entered on UI
user_recipe = str(request.args.get("recipes"))
#Cat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_sales() -> str:\r\n # HTML tables and list that are filled depending on the user input.\r\n html_gr_month_table = app.config[\"table_monthly_growth\"]\r\n html_gr_week_table = app.config[\"table_weekly_growth\"]\r\n html_csv_list = \"\"\r\n # Empty filename and path to sales forecast gra... | [
"0.66995734",
"0.6553096",
"0.6541084",
"0.6023678",
"0.5922527",
"0.5877795",
"0.5854064",
"0.5853466",
"0.58533525",
"0.5846146",
"0.56645066",
"0.5591008",
"0.55845207",
"0.55632",
"0.54707134",
"0.544221",
"0.5361209",
"0.5345573",
"0.5336715",
"0.5335919",
"0.53218144",
... | 0.79973376 | 0 |
This function creates a scatter graph, based on a recipe entered by the user. Also a line of best fit is calculated and plotted onto the scatter graph. This graphical data analysis is then passed to a html template that is returned at the end of the function. The template allows the user interface to display the graphi... | def projection_output() -> str:
user_recipe = request.args.get("recipes")
#X Axis
month_list = ["Nov 2018", "Dec 2018", "Jan 2019", "Feb 2019", "Mar 2019",
"Apr 2019", "May 2019", "Jun 2019", "Jul 2019", "Aug 2019",
"Sep 2019", "Oct 2019"]
month_numbers = np.arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polynomial():\n\n\n\n # connect to google spreadsheet and get sheet\n scope = ['https://spreadsheets.google.com/feeds']\n credentials = ServiceAccountCredentials.from_json_keyfile_name('oauth-keyfile.json', scopes=scope)\n gc = gspread.authorize(credentials)\n responses = gc.open(\"Homework Hist... | [
"0.5823709",
"0.57975",
"0.574742",
"0.5720905",
"0.5619465",
"0.56087345",
"0.55255985",
"0.55152696",
"0.5507135",
"0.5504733",
"0.54675657",
"0.5456889",
"0.5456696",
"0.5397811",
"0.53649247",
"0.53488004",
"0.5347997",
"0.5327329",
"0.5324005",
"0.52972317",
"0.52747256"... | 0.5876203 | 0 |
This function attempts to starts a batch for fermentation based on details entered by the user. The function will return a string stating whether the brew startup for the batch was successful. This string is passed to a html template that is returned at the end of the function. The html template displays this string on... | def brew_process() -> str:
brew_section = []
batch_recipe = request.args.get("recipe_ask")
batch_tank = str(request.args.get("tank_question"))
if brewer_tanks[batch_tank]["Activity_Status"] == "Nothing":
if "Fermenter" in brewer_tanks[batch_tank]["Capabilities"]:
batch_number =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_brew() -> str:\r\n recipe_names = [\"Organic Red Helles\", \"Organic Pilsner\",\r\n \"Organic Dunkel\"]\r\n return render_template(\"start_brew.html\",\r\n recipes=recipe_names,\r\n tank_options=TANKS)",
"def progress_confirm(... | [
"0.59333044",
"0.5628192",
"0.5350912",
"0.52795595",
"0.50377464",
"0.49850434",
"0.4980872",
"0.49706686",
"0.49688634",
"0.4948777",
"0.4943778",
"0.4927972",
"0.49215582",
"0.49080664",
"0.4878588",
"0.4863439",
"0.48540944",
"0.48485333",
"0.48242295",
"0.48224592",
"0.4... | 0.66273344 | 0 |
This function cancels a brew that the user has created. It catches the batch number that the user has entered and uses this to remove the brew from current_brewings and empty the tanks the batch is stored in. At the end of the function a html template is returned. This states whether the brew has successfully cancelled... | def cancel_brew():
brew_cancelled = False
#Catches batch number entered by user
cancel_batch = request.args.get("cancel_number")
#Searches for list with the batch number entered by the user
for inner_list in current_brewings:
if inner_list[0] == cancel_batch:
current_brewi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brew_process() -> str:\r\n brew_section = []\r\n batch_recipe = request.args.get(\"recipe_ask\")\r\n batch_tank = str(request.args.get(\"tank_question\"))\r\n if brewer_tanks[batch_tank][\"Activity_Status\"] == \"Nothing\":\r\n if \"Fermenter\" in brewer_tanks[batch_tank][\"Capabilities\"]:\... | [
"0.58474344",
"0.56502956",
"0.5442242",
"0.5439776",
"0.5421523",
"0.53156066",
"0.5249981",
"0.5192479",
"0.518687",
"0.5136957",
"0.5090947",
"0.50904787",
"0.50880075",
"0.50880075",
"0.50880075",
"0.50773823",
"0.50699675",
"0.5042065",
"0.50356317",
"0.5024414",
"0.5022... | 0.88011277 | 0 |
This function takes catches the tank entered by the user. The function interrogates the dictionary with the name of the tank entered by the user and stores relevant information about the tank in a list. This list is then passed to a html template which is returned at the end of the function. The html template displays ... | def viewtank_output() -> str:
details_output = []
#Catches tank user has entered on UI
user_tank = request.args.get("tank_ask")
volume_string = ("The volume of the tank is: " +
str(brewer_tanks[str(user_tank)]["Volume"]))
details_output.append(volume_string)
capabilit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def viewtank_input() -> str:\r\n tank_list = [\"Albert\", \"Brigadier\", \"Camilla\",\r\n \"Dylon\", \"Emily\", \"Florence\",\r\n \"Gertrude\", \"Harry\", \"R2D2\"]\r\n return render_template(\"viewtank_input.html\",\r\n tanks=tank_list)",
"def hand... | [
"0.72268605",
"0.61617285",
"0.58731925",
"0.57279265",
"0.56716925",
"0.56348497",
"0.5507576",
"0.5472203",
"0.54264766",
"0.5400911",
"0.53080785",
"0.52976465",
"0.52808446",
"0.52457404",
"0.52341986",
"0.5190934",
"0.5189198",
"0.51608986",
"0.51453936",
"0.5143335",
"0... | 0.6539969 | 1 |
This is the first part of the recommendation to the user. This calls a function that searches for all the tanks currently available and all their capabilites. It then passes this information to a html template that is returned at the end of the function. The html template allows the user interface to display all the av... | def make_first_recommendation() -> str:
available_tanks = tank_search()
fermentation_tanks = available_tanks[0]
conditioning_tanks = available_tanks[1]
fermentation_advice = available_tanks[2]
conditioning_advice = available_tanks[3]
more_beer = available_tanks[4]
return render_templa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tank_search():\r\n more_fermentation = None\r\n more_fermentation = None\r\n fermentation_tanks = []\r\n conditioning_tanks = []\r\n #Search for available tanks that can ferment\r\n for tank_type in TANKS:\r\n if \"Fermenter\" in brewer_tanks[tank_type][\"Capabilities\"]:\r\n ... | [
"0.65310216",
"0.6325169",
"0.60679734",
"0.5968718",
"0.5820628",
"0.578148",
"0.57569426",
"0.55996466",
"0.5597419",
"0.5594505",
"0.55584127",
"0.5540173",
"0.5539492",
"0.548138",
"0.54568136",
"0.54489106",
"0.54305226",
"0.54056174",
"0.54024667",
"0.5389053",
"0.53655... | 0.6866057 | 0 |
This is the second part of the recommendation to the user. This calls a function that calculates the average growth rates of all the recipes and appends them to a list. It also returns the recipe with the highest average growth rate. These are all passed to a html template that is returned at the end of the function. T... | def make_second_recommendation() -> str:
growth_rate_info = highest_growth_rate()
rate_strings = growth_rate_info[0]
most_demand_string = growth_rate_info[1]
return render_template("make_second_recommendation.html",
display_rates=rate_strings,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highest_growth_rate():\r\n growth_mappings = {\r\n \"Organic Red Helles\": 0,\r\n \"Organic Pilsner\": 0,\r\n \"Organic Dunkel\": 0\r\n }\r\n rate_strings = []\r\n #Growth Rate of Organic Red Helles\r\n growth_rate = int(growth_calculations(\"Organic Red Helles\"))\r\n ... | [
"0.64572865",
"0.5966188",
"0.5867491",
"0.5855475",
"0.57042545",
"0.5673424",
"0.558251",
"0.5552458",
"0.5437276",
"0.5285583",
"0.5258498",
"0.52491313",
"0.52489233",
"0.5201799",
"0.52004844",
"0.51558894",
"0.5151049",
"0.51461273",
"0.51452696",
"0.5105309",
"0.508269... | 0.6314808 | 1 |
reads one byte at a time until it finds a key code | def read_RFID(self):
# flushes to remove any remaining bytes
self.serial_conn.flushInput()
self.data = b""
while True:
while self.serial_conn.inWaiting() > 0:
self.data += self.serial_conn.read(1)
if self.data:
str_data = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key():\n\tinput_key: str = \"\"\n\ttry:\n\t\twhile not False:\n\t\t\twith Raw(sys.stdin):\n\t\t\t\tif not select([sys.stdin], [], [], 0.1)[0]: #* Wait 100ms for input on stdin then restart loop to check for stop flag\n\t\t\t\t\tcontinue\n\t\t\t\tinput_key += sys.stdin.read(1) #* Read 1... | [
"0.62371683",
"0.61231524",
"0.6037301",
"0.59661585",
"0.59661585",
"0.5818008",
"0.5803988",
"0.57528806",
"0.5751504",
"0.5742896",
"0.5739591",
"0.57331645",
"0.56970906",
"0.56771183",
"0.5658204",
"0.5645056",
"0.5588414",
"0.55858475",
"0.55694914",
"0.55395055",
"0.55... | 0.6427661 | 0 |
continuously checks to see if the state is true. If so it calls the `lock` method | def check_for_lock_request(self):
while True:
sleep(0.1)
if self.get_state():
sleep(5)
self.lock()
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f_lock(self):\n self._locked = True",
"def is_locked(self):\r\n pass",
"def Locked(self) -> bool:",
"def lock(self):\n\n self.wait = True",
"def gate(self):\n locked = self.is_locked()\n if locked:\n self.PAUSED() # pause at locked gate\n self.fs... | [
"0.65998256",
"0.65871686",
"0.64709055",
"0.63390404",
"0.6293904",
"0.6293187",
"0.6278502",
"0.62072515",
"0.6191699",
"0.6134101",
"0.608665",
"0.6057018",
"0.60178024",
"0.600638",
"0.6001297",
"0.6000419",
"0.59787333",
"0.59475833",
"0.59466517",
"0.59208655",
"0.59162... | 0.757184 | 0 |
should we go deeper or not when we're given the option? | def go_deeper(cls, *args, **kwargs):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def option_is_known(self, opt):\n return opt in self.results",
"def test_verify_recursive_and_transverse_acl_options():",
"def test_default(self):\r\n self.assertEqual(self.option.default, False)",
"def test_subCommandInTwoPlaces(self):\n class SubOpt(usage.Options):\n pass\n ... | [
"0.6017335",
"0.574533",
"0.562415",
"0.5619646",
"0.56111056",
"0.5507321",
"0.5504422",
"0.539718",
"0.53504884",
"0.5323162",
"0.53172046",
"0.5313056",
"0.52671057",
"0.52618486",
"0.52531004",
"0.52468204",
"0.52450746",
"0.5244787",
"0.5235076",
"0.5228694",
"0.52285236... | 0.6445788 | 0 |
Check is an object has units | def hasUnit(val):
return hasattr(val, 'unit') or hasattr(val, 'units') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasUnits(self):\n return _libsbml.ASTNode_hasUnits(self)",
"def is_unit(self):\n return math.isclose(self.magnitude(), 1)",
"def _getunits(x):\n if pb.units.has_units(x):\n \n units = x.units\n \n else:\n \n units = None\n \n return units",
... | [
"0.7100814",
"0.69963205",
"0.68803537",
"0.6473189",
"0.6459203",
"0.64301234",
"0.63573074",
"0.6355131",
"0.6327413",
"0.6316045",
"0.6256038",
"0.62403065",
"0.62251043",
"0.62129647",
"0.62088776",
"0.6194911",
"0.6147151",
"0.6134633",
"0.6133386",
"0.6087609",
"0.60855... | 0.7704637 | 0 |
Set the wavelength units | def set_wavelength_unit(self, unit):
try: # get units from the inputs
self.wavelength_unit = str(self._wavelength.unit)
except AttributeError:
self.wavelength_unit = unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_units(self, units):\n self.units = units",
"def set_wavelength(self, wavelength):\n assert 0 <= wavelength <= 5000\n # Note: When connected via the IC bus of the camera, it is not\n # possible to change the wavelength (or the grating) while the CCD\n # is acquiring. So ... | [
"0.7221544",
"0.7212002",
"0.71422845",
"0.6923469",
"0.6864892",
"0.6786767",
"0.6786767",
"0.6786767",
"0.67282856",
"0.6644866",
"0.6603112",
"0.6562103",
"0.65595156",
"0.65585876",
"0.6548482",
"0.64689153",
"0.6428373",
"0.6418364",
"0.63837624",
"0.63505423",
"0.631165... | 0.7685842 | 0 |
Set the detector type (photon or energy) | def set_dtype(self, dtype):
_d = dtype.lower()
if "phot" in _d:
self.dtype = "photon"
elif "ener" in _d:
self.dtype = "energy"
else:
raise ValueError('Unknown detector type {0}'.format(dtype)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self,typ):\n self._typ = typ\n if typ == 'Sine':\n self._type = 7\n elif typ == 'Sawtooth up':\n self._type = 0\n elif typ == 'Sawtooth down':\n self._type = 1\n elif typ == 'Square':\n self._type = 2\n elif typ == 'Triangle':\n self._type = 3\n elif typ =... | [
"0.62338126",
"0.6194597",
"0.6142397",
"0.59892845",
"0.5955794",
"0.5871953",
"0.5829849",
"0.5829849",
"0.57126755",
"0.5561741",
"0.55549914",
"0.5550556",
"0.5550556",
"0.5530195",
"0.5528219",
"0.5514323",
"0.54873323",
"0.54836535",
"0.5478306",
"0.544601",
"0.5410856"... | 0.7096203 | 0 |
Calculated as the last value with a transmission at least 1% of maximum transmission | def lmax(self):
cond = (self.transmit / self.transmit.max()) > 1./100
return max(self.wavelength[cond]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pwm_max_score(self):\n if self.max_score is None:\n score = 0\n for row in self.pwm:\n score += log(max(row) / 0.25 + 0.01)\n self.max_score = score\n \n return self.max_score",
"def lambda_max(self):\n return const.b_wien / self.tem... | [
"0.6609543",
"0.6574131",
"0.65551525",
"0.63975525",
"0.63943934",
"0.637548",
"0.63664407",
"0.63597524",
"0.633787",
"0.63027173",
"0.63025683",
"0.62856823",
"0.6263263",
"0.6243955",
"0.62412053",
"0.6180545",
"0.6174037",
"0.61661726",
"0.6132282",
"0.6125315",
"0.61147... | 0.71121466 | 0 |
Effective width Equivalent to the horizontal size of a rectangle with height equal to maximum transmission and with the same area that the one covered by the filter transmission curve. W = int(T dlamb) / max(T) | def width(self):
return (self.norm / max(self.transmit)) * Unit(self.wavelength_unit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r_width(self) -> int:\n return math.ceil(self.t_width / REGION_DIM)",
"def width(self):\n xx = self.xx\n return max(xx) - min(xx)",
"def width(self):\n return self.maxx - self.minx",
"def width(self) -> int:\r\n return self.rect_uv.w",
"def width(self):\n retur... | [
"0.6868533",
"0.6825844",
"0.6784033",
"0.6721825",
"0.6578533",
"0.64772767",
"0.64296156",
"0.6405422",
"0.63635635",
"0.6357842",
"0.63051224",
"0.6280122",
"0.6279268",
"0.62352824",
"0.6210149",
"0.620615",
"0.6200275",
"0.61808515",
"0.6174533",
"0.61602485",
"0.6146153... | 0.7162012 | 0 |
the difference between the two wavelengths for which filter transmission is half maximum | def fwhm(self):
vals = self.transmit / self.transmit.max() - 0.5
zero_crossings = np.where(np.diff(np.sign(vals)))[0]
lambs = self.wavelength[zero_crossings]
return np.diff(lambs)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wavelength(self):\n E = -self.E0*(1.0/self.n_low**2 - 1.0/self.n_high**2)\n return SI['hc']*1e12/(E*SI['keV'])",
"def perfectrefl(wavelength):\n return 1.0",
"def lmax(self):\n cond = (self.transmit / self.transmit.max()) > 1./100\n return max(self.wavelength[cond])",
"d... | [
"0.6691251",
"0.6618354",
"0.6488462",
"0.64358723",
"0.6407217",
"0.63611805",
"0.6346797",
"0.63408977",
"0.632557",
"0.6317822",
"0.6293711",
"0.6239505",
"0.62292105",
"0.60955864",
"0.608569",
"0.6050807",
"0.6031777",
"0.60090184",
"0.60058135",
"0.6001849",
"0.59509283... | 0.7084413 | 0 |
Photon distribution based effective wavelength. Defined as lphot = int(lamb 2 T Vega dlamb) / int(lamb T Vega dlamb) which we calculate as lphot = get_flux(lamb vega) / get_flux(vega) | def lphot(self):
if self.wavelength_unit is None:
raise AttributeError('Needs wavelength units')
with Vega() as v:
wave = v.wavelength.value
# Cheating units to avoid making a new filter
f_vega = self.get_flux(v.wavelength, v.flux, axis=-1)
f_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength(energy):\r\n return 2 * np.pi * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy",
"def wavelength_to_photon_energy(wavelength):\n return 1.23984197386209e-06 / wavelength",
"def wavelength(energy):\n return 2 * PI * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy",
"def lphot(self):\n retu... | [
"0.66982585",
"0.6551977",
"0.65308183",
"0.6524413",
"0.6331473",
"0.62921447",
"0.62235355",
"0.59665483",
"0.5963861",
"0.5954776",
"0.58232385",
"0.58174306",
"0.57876545",
"0.5777222",
"0.57658285",
"0.5755611",
"0.57483816",
"0.57271266",
"0.5726317",
"0.57224226",
"0.5... | 0.77599114 | 0 |
getNphot the number of photons through the filter (Ntot / width in the documentation) getflux() leff / hc | def get_Nphotons(self, slamb, sflux, axis=-1):
passb = self.reinterp(slamb)
wave = passb._wavelength
dlambda = np.diff(wave)
# h = 6.626075540e-27 # erg * s
# c = 2.99792458e18 # AA / s
h = Constants.h.to('erg * s').value
c = Constants.c.to('AA/s').value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_Nphotons(self, slamb, sflux, axis=-1):\n mean, samples = self._get_mean_and_samples_attribute('get_Nphotons',\n slamb, sflux,\n axis=axis)\n return mean, samples",
"def Ve... | [
"0.6629086",
"0.6488722",
"0.5874283",
"0.5788668",
"0.5782138",
"0.5659502",
"0.56355333",
"0.56355333",
"0.56355333",
"0.56355333",
"0.56061846",
"0.5581951",
"0.556734",
"0.54917854",
"0.5467787",
"0.5442995",
"0.5435731",
"0.5433242",
"0.54063743",
"0.5383622",
"0.5345135... | 0.7040977 | 0 |
Vega number of photons per wavelength unit | def Vega_zero_photons(self):
with Vega() as v:
return self.get_Nphotons(v.wavelength, v.flux) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension(self):\n return 3*self.genus - 3 + self.n",
"def vol(x):\r\n return pi*(topdia(x)/2000.)**2 * length (x)",
"def n_spectra(self):\n return np.product(self.image_shape)",
"def get_Nphotons(self, slamb, sflux, axis=-1):\n passb = self.reinterp(slamb)\n wave = passb._wa... | [
"0.64019716",
"0.6386464",
"0.6385143",
"0.634752",
"0.63221776",
"0.63221776",
"0.63221776",
"0.63221776",
"0.6238021",
"0.61323863",
"0.61095387",
"0.61074543",
"0.6105769",
"0.609608",
"0.60749775",
"0.6065898",
"0.6042907",
"0.60201883",
"0.59854054",
"0.59539956",
"0.592... | 0.6429391 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.