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
Create each ability, to ensure no errors are encountered.
def testabilities(self): for ability in AmuletAbility.typelist: a = AmuletAbility(ability) self.assertEqual(a.type, ability) if ability != 'Attribute': self.assert_(ability in str(a)) self.assertTrue(isinstance(a.AC, int)) self.assertTr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_with_permissions(self):\n permissions = Permission.objects.filter(name__in=('Can add course mode', 'Can change course mode'))\n for permission in permissions:\n self.user.user_permissions.add(permission)\n\n self.assert_can_create_course()", "def test_control_acl_n...
[ "0.65154845", "0.6027863", "0.60043085", "0.5975127", "0.59668714", "0.58903754", "0.5886313", "0.5862154", "0.5807895", "0.574079", "0.5737699", "0.57014215", "0.5621218", "0.5620973", "0.56114036", "0.5607721", "0.54945326", "0.54680264", "0.5420151", "0.5416647", "0.541130...
0.6188402
1
Provide an invalid element, to generate an error.
def testinvalidelement(self): self.assertRaises(AbilityError, AmuletAbility, 'Proof', element='Invalid') self.assertRaises(AbilityError, AmuletAbility, 'Proof', element='') self.assertRaises(AbilityError, AmuletAbility, 'Control NPC', element...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(self, msg, elem):\n if elem is not None:\n msg += \" (line %d)\" % elem.sourceline\n if self.ignore_errors:\n return self.warn(msg, elem)\n raise ParserException(msg)", "def test_invalid_xml(self):\r\n with self.assertRaises(Exception):\r\n s...
[ "0.69439214", "0.6649658", "0.6549366", "0.6526067", "0.6515148", "0.64893574", "0.63802725", "0.6375399", "0.6375399", "0.6375399", "0.6375399", "0.6364096", "0.6347471", "0.63307416", "0.62093705", "0.6206851", "0.6202528", "0.6188424", "0.61858267", "0.61582255", "0.608500...
0.6935137
1
Ensure random abilities may be generated without error.
def testrandom(self): for i in range(100): AmuletAbility()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testrandom(self):\n for i in range(100):\n WeaponAbility()", "def random_die():\n return randrange(1, 6)", "def test_insufficient_shuffle(self):\n self.deck._deal(1)\n with self.assertRaises(ValueError):\n self.deck.shuffle()", "def luck_check(chance):\n r...
[ "0.66446924", "0.6261142", "0.6225658", "0.61589783", "0.61494786", "0.61290914", "0.61236346", "0.61155415", "0.6106622", "0.60941434", "0.60484105", "0.6033411", "0.60260797", "0.60189956", "0.59546584", "0.59362406", "0.59291255", "0.59213823", "0.58713335", "0.5846206", "...
0.71204704
0
Create each Animated weapon range, to ensure no errors occur.
def testrange(self): for range_ in range(1, 5): a = WeaponAbility('Animated', range=range_) self.assert_(str(range_) in str(a))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRange(self):\n # first determine ranges\n if len(self.activeWeapons) > 0:\n myPrimaryWeapon = self.activeWeapons[0]\n self.range = myPrimaryWeapon.myWeaponData.range * 1.0\n else:\n # no weapons left RUN\n self.mode = 'escape'\n sel...
[ "0.6210735", "0.5866768", "0.58583087", "0.578064", "0.57570106", "0.56918156", "0.5606103", "0.5557127", "0.5484591", "0.5478335", "0.53735477", "0.53352934", "0.53319234", "0.5275543", "0.5247675", "0.5247172", "0.5241505", "0.5228203", "0.52197033", "0.52137804", "0.521354...
0.66504484
0
Exercise the specification of abilities for Enhanced weapons.
def testenhancements(self): list = [MentalAbility('Fireball', 3),] a = WeaponAbility('Enhanced', abilities=list) self.assertEqual(a.abilities, list) self.assertEqual(a.AC, list[0].AC) list *= 5 a = WeaponAbility('Enhanced', abilities=list) self.assertEqual(a.abili...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testabilities(self):\n for ability in WeaponAbility.typelist:\n a = WeaponAbility(ability)\n self.assert_(ability in str(a))\n self.assertTrue(isinstance(a.AC, int))\n self.assertTrue(isinstance(a.description(), str))", "def _handlespecials(self, secondary, ...
[ "0.63859636", "0.62416124", "0.62350196", "0.60346496", "0.60204816", "0.59555095", "0.57886255", "0.5700426", "0.56838894", "0.5664235", "0.56232107", "0.5617325", "0.5582766", "0.5571561", "0.55504894", "0.5511715", "0.5506456", "0.54907763", "0.54576594", "0.54487455", "0....
0.7143327
0
Provide invalid mental abilities, to generate errors.
def testinvalidenhancements(self): self.assertRaises(AbilityError, WeaponAbility, 'Enhanced', abilities=[]) list = [MentalAbility('Fireball', 3),] * 6 self.assertRaises(AbilityError, WeaponAbility, 'Enhanced', abilities=list) list = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testinvalidability(self):\n self.assertRaises(AbilityError, AmuletAbility, 'Invalid')\n self.assertRaises(AbilityError, AmuletAbility, '')", "def testinvalidability(self):\n self.assertRaises(AbilityError, WeaponAbility, 'Invalid')\n self.assertRaises(AbilityError, WeaponAbility, ...
[ "0.69706166", "0.6763972", "0.64050066", "0.63184166", "0.62757283", "0.61525935", "0.59503865", "0.5758525", "0.57436514", "0.5706633", "0.5680509", "0.55470926", "0.5533897", "0.5517258", "0.55008376", "0.5483395", "0.5479991", "0.54770255", "0.5465361", "0.5460375", "0.544...
0.69791776
0
Ensure random abilities may be generated without error.
def testrandom(self): for i in range(100): WeaponAbility()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testrandom(self):\n for i in range(100):\n AmuletAbility()", "def random_die():\n return randrange(1, 6)", "def test_insufficient_shuffle(self):\n self.deck._deal(1)\n with self.assertRaises(ValueError):\n self.deck.shuffle()", "def luck_check(chance):\n r...
[ "0.71204704", "0.6261142", "0.6225658", "0.61589783", "0.61494786", "0.61290914", "0.61236346", "0.61155415", "0.6106622", "0.60941434", "0.60484105", "0.6033411", "0.60260797", "0.60189956", "0.59546584", "0.59362406", "0.59291255", "0.59213823", "0.58713335", "0.5846206", "...
0.66446924
1
Reads the table and returns a dataframe. This is basically just a short script that lets users import data without having to worry about filetype.
def read_table(file_name: Union[str, Path], **kwargs): file_name = Path(file_name) extension = file_name.suffix default_args = { '.csv': {'delimiter': ','}, '.tsv': {'delimiter': '\t'} } # arguments = self._cleanArguments(extension, arguments) file_name = str(file_name.absolute()) if extension in {'.xls', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n if self.filename.endswith('.gz'):\n compression = 'gzip'\n elif self.filename.endswith('.bz2'):\n compression = 'bz2'\n else:\n compression = None\n df = pd.read_table(self.filename, compression=compression)\n\n # drop empty col...
[ "0.73241764", "0.7220796", "0.7152453", "0.7099584", "0.7081273", "0.6864048", "0.6840184", "0.67669684", "0.67324567", "0.67061985", "0.66576475", "0.6655316", "0.6607207", "0.65883917", "0.65197957", "0.65108925", "0.6483658", "0.64634323", "0.6460126", "0.64505523", "0.642...
0.72589296
1
Saves the table as an Excel spreadsheet, where multiple tables can be given..
def to_spreadsheet(tables: Dict[str, pandas.DataFrame], filename: Path) -> Path: writer = pandas.ExcelWriter(str(filename)) include_index = False # python 3.5 or 3.6 made all dicts ordered by default, so the sheets will be ordered in the same order they were defined in `tables` for sheet_label, df in tables.items()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_excel(self, filename):\n # convert table to array of rows\n rows = [self.headings]\n for y in range(self.rowcount):\n row = []\n for h in self.headings:\n row.append(self.table[h][y])\n rows.append(row)\n \n sheet = pyexc...
[ "0.7324861", "0.7021304", "0.7011961", "0.69541585", "0.68894243", "0.6813231", "0.67438275", "0.6703414", "0.670096", "0.6673346", "0.6641729", "0.66115904", "0.65920734", "0.6574278", "0.65613693", "0.65596414", "0.6499027", "0.64789695", "0.64779127", "0.6472889", "0.64052...
0.70738363
1
Connect to the PostGreSQL database,run selected query and return the result
def psql_connection(query): try: conn = psycopg2.connect(database=DB) cur = conn.cursor() cur.execute(query) except Exception: ("Error connecting to database") else: print("Calling database...") print("") results = cur.fetchall() conn.close() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_query(query):\n try:\n # enter your code here to get a database connection and cursor,\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n # execute the query\n c.execute(query)\n # store the resul...
[ "0.717092", "0.7003607", "0.6933716", "0.69042325", "0.6886534", "0.6875132", "0.6873246", "0.6821606", "0.6772765", "0.6757581", "0.67341745", "0.67148185", "0.6697957", "0.6689113", "0.6687928", "0.66876215", "0.6682956", "0.66637564", "0.6613967", "0.6611754", "0.66006875"...
0.74556375
0
bike_stations contains array of station objects {name, stationId, bikesAvailable, lat, lon}
def sort_bike_stations(bike_stations, location): stations = bike_stations.copy() for index, station in enumerate(stations): station_location = (station["lat"], station["lon"]) dist = distance.distance(station_location, location).m stations[index]["distance"] = dist stations = sort...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def get_bikes_for_week(cls, dbsession, station_id):\n station = [(\"Day\", \"Available Bikes\")]\n station_data = dbsession.query(func.weekday(cls.last_update),\n func.avg(cls.available_bikes)) \\\n .filt...
[ "0.691254", "0.68177104", "0.66731423", "0.6667146", "0.6630423", "0.64471847", "0.64053655", "0.6382136", "0.62274975", "0.62242377", "0.61863405", "0.6173621", "0.6167462", "0.61557275", "0.61210793", "0.61108625", "0.610515", "0.6101489", "0.60884637", "0.6054263", "0.6051...
0.69216037
0
Build speech for yes intent, takes array of two next stations. By default after this speech session is ended.
def build_next_stations(stations): station_0_bikes = stations[0]['bikesAvailable'] station_1_bikes = stations[1]['bikesAvailable'] return f"On station {stations[0]['name']} is {station_0_bikes} " \ f"bike{'s' if station_0_bikes > 1 else ''} available and on station" \ f"{stations[1]['name'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_next_speech(self):\n self.bot.loop.call_soon_threadsafe(self.play_next_speech.set)", "def get_speech(self, phrase):\n src = os.path.join(constants.CONFIG_PATH, self.voice)\n text = phrase\n\n def preprocess(syllables):\n temp = []\n for syllable in syl...
[ "0.5466116", "0.53381044", "0.5165462", "0.5158772", "0.5136469", "0.5119758", "0.51051253", "0.50937116", "0.50589454", "0.50452626", "0.49854103", "0.4973108", "0.4939487", "0.48700067", "0.48483983", "0.48335534", "0.48153678", "0.48100355", "0.47805727", "0.47753873", "0....
0.541555
1
Main function of filtering events. Parse in user input of url and auth token and use them to create an example archivist connection and passedin properties attributes to filter all events of the selected properties and attributes through function get_matching_events.
def main(): with open(".auth_token", mode="r") as tokenfile: authtoken = tokenfile.read().strip() # Initialize connection to Archivist aconn = Archivist( "https://soak-0-avid.engineering-k8s-stage-2.dev.wild.jitsuin.io", auth=authtoken, ) # Get all assets with required attr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_query_events(self):\n query_list = {\n 'q': 'test',\n 'type': 'show'\n }\n results = query_events(query_list)\n events = list(results['events'])\n showcase = list(results['showcase_events'])\n self.assertTrue(self.event_show1 in events)\n ...
[ "0.53511065", "0.51666886", "0.5161581", "0.5099042", "0.5078286", "0.50425583", "0.5039122", "0.4984391", "0.49639994", "0.49617496", "0.49603945", "0.49006483", "0.48956084", "0.48830333", "0.48448077", "0.48447883", "0.48361924", "0.4832409", "0.48313853", "0.47923324", "0...
0.5174677
1
Calculate the upstream distance and downstream distance to the nearest DNA TE from the specified gene.
def calculate_distance(geneid, genes, tes): # Get which chromosome for c in genes: if geneid in genes[c]: chromosome = c break # Get the gene position genestart, geneend = genes[chromosome][geneid] # if the gene chromosome does not have any TEs, return NA if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(gene1, gene2):\n return abs(len(gene1.goal) - len(gene2.goal))", "def get_distance_pandas(_gene, apeak):\n if _gene['4'] < apeak.left:\n return apeak.left - _gene['4']\n if apeak.right < _gene['3']:\n return apeak.right - _gene['3']\n return 0", "def get_distance_pand...
[ "0.6199831", "0.61004704", "0.61004704", "0.5746319", "0.5437211", "0.54337853", "0.5426136", "0.541698", "0.541698", "0.53653735", "0.5341924", "0.5341924", "0.5321905", "0.5310927", "0.5270482", "0.52228695", "0.5202737", "0.52025795", "0.52016085", "0.5196722", "0.51792306...
0.7312722
0
Downloads the data and saves it to a zip file.
def download_data(self): headers = {'User-Agent': 'Mozilla/5.0',} #Request for html data of url page r = requests.get(self.url, headers = headers, allow_redirects=True) soup = BeautifulSoup(r.text, "html.parser") #Checking if folder path exists, if not, creats it i=0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data():\n url = 'https://www.dropbox.com/s/h9ubx22ftdkyvd5/ml-latest-small.zip?dl=1'\n urllib.request.urlretrieve(url, 'ml-latest-small.zip')\n zfile = zipfile.ZipFile('ml-latest-small.zip')\n zfile.extractall()\n zfile.close()", "def download_data():\n\n if not os.path.exists(zipf...
[ "0.7695943", "0.7471872", "0.72585493", "0.7096487", "0.70846176", "0.70634305", "0.706217", "0.70549625", "0.7003874", "0.67468005", "0.67194486", "0.66552013", "0.66520566", "0.66331756", "0.66310894", "0.662298", "0.65793407", "0.6567851", "0.6541638", "0.65338546", "0.651...
0.7915135
0
Returns name of csv file of a region.
def getCsvFileByRegion(self, region): result = "" if region == "PHA": result = "00.csv" elif region == "STC": result = "01.csv" elif region == "JHC": result = "02.csv" elif region == "PLK": result = "03.csv" elif region == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_region_filename(self, region):\r\n \r\n return {\r\n 'PHA': '00.csv',\r\n 'STC': '01.csv',\r\n 'JHC': '02.csv',\r\n 'PLK': '03.csv',\r\n 'KVK': '19.csv',\r\n 'ULK': '04.csv',\r\n 'LBK': '18.csv',\r\n 'HK...
[ "0.7729703", "0.64638746", "0.6337415", "0.6190413", "0.6148976", "0.6008073", "0.5954937", "0.57771087", "0.5749584", "0.5748628", "0.5714495", "0.5634323", "0.5593007", "0.5579389", "0.5565088", "0.5473224", "0.54680103", "0.5429127", "0.5419594", "0.5419594", "0.5419594", ...
0.79758877
0
Build an uniform triangular mesh on unit square.
def square_mesh(N): xs,ys = np.meshgrid(np.linspace(0,1,N),np.linspace(0,1,N)) xs = xs.flatten(1) ys = ys.flatten(1) _,_,t,_ = triang.delaunay(xs,ys) p = np.vstack((xs,ys)).T return Trimesh(p,t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces", "def create_single_triangle_mesh():\n vert...
[ "0.6988665", "0.61453784", "0.6137518", "0.6123684", "0.6085948", "0.604803", "0.60441124", "0.6016392", "0.5986559", "0.59620947", "0.59336704", "0.593075", "0.58841795", "0.58742106", "0.580949", "0.5796873", "0.5764584", "0.57548827", "0.5731663", "0.5716954", "0.57152927"...
0.7298217
0
Load the input file (a lineseperated list of numbers).
def load_input(input_name): with open(input_name) as input_file: input_list = list(map(int,input_file.readline().split(","))) return input_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_input() -> List[List[int]]:\n filepath = os.path.join(os.getcwd(), os.path.dirname(__file__), INPUT_FILE)\n f = open(filepath, 'r')\n data = f.read()\n f.close()\n\n raw_input = data.strip().split('\\n')\n input = [list(ri) for ri in raw_input]\n return [[int(i) for i in line] for li...
[ "0.72228956", "0.71041244", "0.7010073", "0.6906203", "0.67904806", "0.67290246", "0.6650171", "0.66440064", "0.66392255", "0.66032666", "0.65971136", "0.65716565", "0.6549218", "0.65480024", "0.6500772", "0.64960253", "0.64960253", "0.6484692", "0.64831895", "0.64763206", "0...
0.73727155
0
Prints some additional node/edge sets Set hide(node) (hidden nodes) Set novelGene(node)(unknown + hidden) Set h(node)(hits hidden, if hiding hits) Set intNode(node) (interfaces hidden, if hiding interfaces) Set intEdge(edge) (interface edges in paths)
def print_node_edge_sets(labels, aside, paths, mode, outf): #print_gams_set("hide(node)", "hidden nodes", aside) #print "" # genes without labels novel=set.union(labels["unknown"], aside) print_gams_set("novelGene(node)", "unlabeled or hidden genes", novel, out=outf) outf.write("\n") # interface nodes and edge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_edges(self):\n for element in self.graph:\n print(element, self.graph[element])", "def output(self):\n\t\t# Sort graph nodes by id\n\t\tnodes = list(self.nodes.values())\n\t\tnodes.sort(key=lambda n:n.id)\n\n\t\tfor n in nodes:\n\t\t\t# Get all edges\n\t\t\tedges = []\n\t\t\tfor edge i...
[ "0.6214952", "0.613745", "0.60090965", "0.59988785", "0.581472", "0.58066213", "0.57610726", "0.5760247", "0.573816", "0.5723644", "0.5704321", "0.56841236", "0.5680305", "0.5650115", "0.5615147", "0.5604487", "0.56031686", "0.5579508", "0.5568939", "0.5564694", "0.55471396",...
0.767322
0
Open projects page if it isn't opened.
def _page_projects(self): return self._open(self.app.page_projects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openproject():\n\n # POST\n if request.method == \"POST\":\n\n # Validate form submission\n if not request.form.get(\"projectname\"):\n return apology(\"missing project name\")\n elif not request.form.get(\"link\"):\n return apology(\"missing project link\")\n\n...
[ "0.731947", "0.70801455", "0.70608085", "0.66960037", "0.6594605", "0.65892035", "0.6571664", "0.65079004", "0.6379645", "0.6317886", "0.6307796", "0.63034767", "0.6256844", "0.61474514", "0.6115373", "0.61066955", "0.60768175", "0.60427994", "0.6040594", "0.603822", "0.60297...
0.78490776
0
Step to filter projects.
def filter_projects(self, query, check=True): page_projects = self._page_projects() page_projects.field_filter_projects.value = query page_projects.button_filter_projects.click() if check: def check_rows(): is_present = False for row in page...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_projects_filters(fc: fetcher.Fetcher, test_project_name):\n projects = fc.get_projects(test_project_name)\n assert isinstance(projects, list)\n assert len(projects) == 1\n assert projects[0].name == test_project_name", "def _get_filtered_projects(filters):\n projects_itr = (projects_l...
[ "0.6948827", "0.65609", "0.65237945", "0.6309058", "0.61236054", "0.6022066", "0.6016844", "0.59866375", "0.5947311", "0.5868932", "0.5776334", "0.57750094", "0.57653195", "0.57625276", "0.5737932", "0.5719922", "0.5698445", "0.56475973", "0.5637165", "0.5617174", "0.5617174"...
0.65843356
1
Step for trying to disable current project.
def check_project_cant_disable_itself(self): page_projects = self._page_projects() project_name = self.app.current_project with page_projects.table_projects.row( name=project_name).dropdown_menu as menu: menu.button_toggle.click() menu.item_edit.click() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):\n self.error_code = 'DISABLED'\n self.running = False", "def StopProject (paser):\n\tModKeyProjectProtection = Project.status()\t\t#Status del proyecto\n\n\tif ModKeyProjectProtection == False:\n\t\trepositorio.stopChanges()", "def on_disable(self) -> None:\n self._cance...
[ "0.65031326", "0.62058604", "0.6188016", "0.6126871", "0.61137885", "0.60983574", "0.60533607", "0.6040284", "0.60343134", "0.601686", "0.6012566", "0.59643465", "0.59616554", "0.593261", "0.5905234", "0.58999574", "0.58820313", "0.5857903", "0.5816048", "0.5810383", "0.58069...
0.7005946
0
Step to manage project members.
def manage_project_members(self, project_name, admin_project_resources, check=True): page_projects = self._page_projects() with page_projects.table_projects.row( name=project_name).dropdown_menu as menu: menu.item_default.click() with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_project_member(self):\n pass", "async def add(self, ctx, project_name: str,\n members: commands.Greedy[discord.Member]) -> None:\n project = project_name\n if not ctx.projects.find_project(project_name):\n await ctx.send(\"This project doesn't exist.\...
[ "0.6774335", "0.6523073", "0.6445679", "0.6356567", "0.6110086", "0.6039119", "0.5738103", "0.5666908", "0.56620085", "0.56442386", "0.563256", "0.55870676", "0.55030304", "0.5493451", "0.5483998", "0.5423954", "0.54072183", "0.540391", "0.5349906", "0.53472126", "0.53173715"...
0.71600276
0
Step to update project name.
def update_project_name(self, project_name, new_project_name, check=True): page_projects = self._page_projects() with page_projects.table_projects.row( name=project_name).dropdown_menu as menu: menu.button_toggle.click() menu.item_edit.click() with page_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_project_name(self, curr_proj, proj_new_name):\r\n for proj in self.__projects:\r\n if proj == curr_proj: # Find the project with the same current name\r\n proj.update_name(proj_new_name) # Update the project's name\r", "def update_project(self, name):\n se...
[ "0.71789324", "0.70686406", "0.691698", "0.67916363", "0.6765881", "0.6631026", "0.65020585", "0.6319885", "0.62859344", "0.62705225", "0.6221078", "0.61977655", "0.61945593", "0.61657494", "0.61657494", "0.6118281", "0.61064047", "0.60236293", "0.5981603", "0.5951724", "0.59...
0.717039
1
Pad x with zeros to total digits.
def pad_zeros(x, total): num_pad = total - len(x) for idx in range(num_pad): x = '0' + x return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_digits(x, width):\n if pd.notnull(x):\n return '{0:0{1}d}'.format(int(x), width)\n else:\n return x", "def pad(number, width=0):\n return str(number).zfill(width)", "def pad_with_border(x, n_pad):\n x_pad_list = [x[0:1]] * int(n_pad) + [x] + [x[-1:]] * int(n_pad)\n return n...
[ "0.7705322", "0.6957708", "0.67513067", "0.67392343", "0.6692656", "0.6670947", "0.66124976", "0.6442183", "0.6426501", "0.64234763", "0.6382758", "0.63817555", "0.6342493", "0.62942547", "0.62548393", "0.62539077", "0.6236442", "0.62061024", "0.61991197", "0.6173912", "0.612...
0.8166357
0
Build shards in a loop.
def create_shards( it_shards, shard_dir, key, files, labels, targets, im_size, label_size, preprocess, store_z, normalize_im): all_files = files[key] all_labels = labels[key] total_data = len(all_files) / it_shards m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shard(dataset, num_shards):\n input_chips, label_chips = [], []\n for item in tqdm(dataset):\n # not using chip_id and chip_for_display fields\n input_chips.append(item['chip'])\n label_chips.append(item['chip_label'])\n\n # debugging\n # if len(input_chips) > 20...
[ "0.6430954", "0.6155751", "0.5515195", "0.5419035", "0.5399036", "0.53467405", "0.5314759", "0.5262373", "0.52089936", "0.51875865", "0.51793534", "0.516469", "0.5127667", "0.5127667", "0.50922453", "0.50574", "0.50531745", "0.5042628", "0.50401515", "0.50333697", "0.5030738"...
0.66212094
0
Processes the event if it matches the aggregator. Returns "NEW" when the event has become the group_leader of a new group, "AGGR" when it has been added to an existing, active group or "CLEAR" if it is the clear event for a group
def process(self, event): matchgroups = {} try: self.lock.acquire() # matchgroups are not thread safe, but we need to be reentrant here if not self.matcher.matches(event): return "PASS" matchgroups = self.matcher.get_match_groups() finally: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_groups_changed(event):\n permission_backend = event.request.registry.permission\n\n for change in event.impacted_objects:\n if \"old\" in change:\n existing_record_members = set(change[\"old\"].get(\"members\", []))\n else:\n existing_record_members = set()\n\n ...
[ "0.5848911", "0.5695644", "0.5646584", "0.5636374", "0.5563719", "0.55539626", "0.5505983", "0.5474636", "0.5439717", "0.5439534", "0.53875905", "0.5384203", "0.52943784", "0.52490634", "0.5216275", "0.5209896", "0.51932746", "0.5185326", "0.51836437", "0.517594", "0.51704055...
0.7965338
0
returns the md5 hash of a string
def hash(self, string): h = md5() h.update(string) return h.digest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5hash(string):\n return hashlib.md5(string).hexdigest()", "def calc_md5(string):\n\treturn md5(string).hexdigest()", "def md5(string: str) -> str:\n\treturn str(hashlib.md5(string.encode()).hexdigest())", "def digest(string):\n return md5(string.encode(\"utf-8\")).hexdigest()", "def md5(input_s...
[ "0.9092539", "0.88171506", "0.87841374", "0.8736102", "0.8721026", "0.86720395", "0.86507165", "0.85748506", "0.8516772", "0.8485681", "0.8442403", "0.84263587", "0.8423831", "0.82837284", "0.82373786", "0.8200525", "0.8188318", "0.8168509", "0.80750155", "0.8010676", "0.7874...
0.88464713
1
Creates the different matchers for this aggregator (General matcher, clear matcher)
def create_matcher(self): self.matcher = None if "matcher" in self.config: self.matcher = matcher.Matcher(self.config["matcher"]) else: self.matcher = matcher.TrueMatcher() self.use_fields_for_id = [] if "matcherfield" in self.config: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init_matcher(self):\n\t\tmatcher = Matcher()\n\t\tmatcher.set_mentors(self.mentors.find())\n\t\tmatcher.set_migrants(self.migrants.find())\n\t\tprint(matcher.migrants)\n\t\t\n\t\treturn matcher", "def __init__(self, matcher, generate):\n self.matcher = matcher\n self._generate = generate", ...
[ "0.6749215", "0.64610773", "0.60556746", "0.58584523", "0.56751424", "0.54838455", "0.5467794", "0.54370964", "0.54370964", "0.54370964", "0.5433247", "0.54226667", "0.5415843", "0.5362952", "0.5348948", "0.53339624", "0.527907", "0.523279", "0.5200776", "0.5183958", "0.51480...
0.70251894
0
if an alternative aggregation message is defined, it will be created here. FIELD is substituted with the event field FIELD $VAL is substituted with the regular expression group VAL
def create_aggregation_message(self, event, matchgroups): msg = self.config["aggregatemessage"] tokens = re.findall("[$#]\w+", msg) for token in tokens: if token[0] == '#': msg = msg.replace(token, str(event[token[1:]])) continue if token[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, event):\n matchgroups = {}\n try:\n self.lock.acquire() # matchgroups are not thread safe, but we need to be reentrant here\n if not self.matcher.matches(event):\n return \"PASS\"\n matchgroups = self.matcher.get_match_groups()\n ...
[ "0.57208526", "0.55492425", "0.53983456", "0.5122011", "0.50036806", "0.49361655", "0.48909393", "0.4872973", "0.4860018", "0.48352015", "0.4787186", "0.47677344", "0.47655874", "0.4763589", "0.47585917", "0.47466496", "0.47291303", "0.47284135", "0.47131282", "0.4673214", "0...
0.75149137
0
Creates the aggregation group_id
def set_aggregation_group_id(self, event, matchgroups): id = str(self.id) for field in self.use_fields_for_id: field = field.strip() id = id + str(event[field]) attributes = matchgroups for i in attributes: id = id + i + attributes[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_new_group_id():\n new_group = data_types.TestcaseGroup()\n new_group.put()\n return new_group.key.id()", "def create_group(self, group):\n if self.dryrun:\n self.logger.info(\"Would create group %s\", group)\n return FakeGroupId()\n result = self.conn.usergroup.cre...
[ "0.6823393", "0.6713226", "0.6573045", "0.6502546", "0.6305557", "0.6275136", "0.6239701", "0.6216121", "0.6216121", "0.61537755", "0.61489487", "0.6143351", "0.6088015", "0.6088015", "0.6088015", "0.60435104", "0.60379666", "0.5998496", "0.598665", "0.59851414", "0.5975809",...
0.7299634
0
Calculate the volume of a sphere with radius r.
def sphere_volume(r): return 4/3. * math.pi * r ** 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sphere_volume(r):\n return (4/3) * 3.14159 * r**3", "def calcul_v_sphere(r):\n volume = 4/3 * math.pi * (r ** 3)\n return volume", "def sphere_volume(radius : number) -> number:\n volume = 4/3*(pi*radius*radius*radius)\n return volume", "def sphereVolume(radius):\n volume = (4 / 3) * ma...
[ "0.89431643", "0.8776244", "0.86990744", "0.8546791", "0.85032845", "0.82493275", "0.8208103", "0.7859043", "0.74497455", "0.7399191", "0.73894525", "0.7307988", "0.7204269", "0.71425915", "0.7116606", "0.6987146", "0.68633825", "0.67712337", "0.67578685", "0.6645747", "0.661...
0.895751
0
Validates the user's email address, given the verification token
def post(self): data = EmailAddressValidationSchema().load(request.json) email_lowercase = data["email"].lower() verification_token = data["verificationToken"] UserRegistrationService.validate_email_address_verification_token(email_lowercase, verification_token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_email(uid, token):\n return True", "def validate_email(self, token):\n decoded_token = manage_tokens.decode(token)\n if decoded_token is None:\n return {'error': 'Token is invalid'}\n\n self.user_in_db = User.users_db.get(self.email)\n if not self.user_in_db:\...
[ "0.76968575", "0.7643206", "0.7167939", "0.7090168", "0.7051217", "0.7026804", "0.70227796", "0.7012395", "0.7004058", "0.6945708", "0.692403", "0.68979686", "0.6817104", "0.68054706", "0.68007165", "0.6797659", "0.67840916", "0.67610574", "0.6718849", "0.66913974", "0.669088...
0.78256726
0
Sends Record using a SerializingProducer & AvroSerializer
def send_record(args): topic = args.topic.rstrip() schema_registry_config = { 'url': args.schema_registry } schema_registry_client = SchemaRegistryClient(schema_registry_config) avro_serializer = AvroSerializer( schema_registry_client, DATA_SCHEMA, data_to_dict) pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(topicname, records, schema):\n # Parse the schema file\n #schema_definition = fastavro.schema.load_schema(schemafile)\n\n # Write into an in-memory \"file\"\n\n import fastavro\n import confluent_kafka\n\n out = BytesIO()\n fastavro.writer(out, schema, records)\n out.seek(0) # go b...
[ "0.6517671", "0.6180423", "0.61635876", "0.5895322", "0.5895322", "0.5895322", "0.585719", "0.5777968", "0.57018113", "0.5643523", "0.5643523", "0.5637681", "0.55201244", "0.55000967", "0.5456839", "0.54533917", "0.5436357", "0.54286325", "0.5375399", "0.53668606", "0.5354680...
0.7554016
0
Restore policy parameters from saved checkpoint.
def restore(self, checkpoint): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)", "def _restore_checkpoint(self, checkpoint_path):\n self.logger.info(\"Loading checkpoint: {} ...\".format(checkpoint_path))\n checkpoint = torch...
[ "0.7186363", "0.70417887", "0.698167", "0.6969412", "0.6942512", "0.68953955", "0.6884264", "0.67852926", "0.6671625", "0.6624348", "0.6529385", "0.6500647", "0.64891875", "0.6488359", "0.6476572", "0.6403476", "0.6291075", "0.6262366", "0.62580115", "0.62240016", "0.6164733"...
0.7252105
0
Return Q function graph functor for building training/inference graph.
def get_q_func(self, is_training=False, reuse=False, scope='q_func'): return functools.partial(self.q_func, scope=scope, reuse=reuse, is_training=is_training)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tf_graph(self):\n raise NotImplementedError", "def _build_graph(self,\n question_word,\n question_word_mask,\n question_subword,\n question_subword_mask,\n question_char,\n questio...
[ "0.6407784", "0.6063661", "0.5972204", "0.58639354", "0.5774932", "0.57135445", "0.56873643", "0.56436694", "0.5618003", "0.5546803", "0.55211556", "0.55197084", "0.5515311", "0.5491966", "0.54637355", "0.5455583", "0.5406591", "0.54064405", "0.5396603", "0.5387212", "0.53796...
0.6294904
1
Tests the config key parser with both string and full email formats.
def test_config_keys() -> None: with pytest.raises(ConfigFileError): f = StringIO(""" configs: has.periods: urls: - json://localhost """) load_config(_logger, f) with pytest.raises(ConfigFileError): f = StringIO(""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email_address(self):\n key = api.portal.get_registry_record(\n 'plone.email_from_address'\n )\n self.assertEqual(u'site@briefy.co', key)", "def test_is_valid_email(self):\n self.assertTrue(is_valid_email('abc@example.com'))", "def test_invalid_email_when_logging_...
[ "0.6463005", "0.60613185", "0.59752065", "0.5969907", "0.5942804", "0.5908352", "0.58468086", "0.58437914", "0.58130974", "0.5798833", "0.5770068", "0.57455426", "0.5729695", "0.57266825", "0.57260585", "0.5720321", "0.572013", "0.56889856", "0.5688259", "0.56671464", "0.5617...
0.6221637
1
List all app routes
def list_routes(): import urllib output = [] for rule in app.url_map.iter_rules(): options = {} for arg in rule.arguments: options[arg] = "[{0}]".format(arg) methods = ','.join(rule.methods) url = url_for(rule.endpoint, **options) line = urllib.parse.unqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_routes(app):\n output = []\n for rule in app.url_map.iter_rules():\n options = {}\n for arg in rule.arguments:\n options[arg] = \"[{0}]\".format(arg)\n\n methods = ','.join(rule.methods)\n line = urllib.parse.unquote(\"{:50s} {:20s} {}\".format(rule.endpoint, m...
[ "0.78200454", "0.73298335", "0.7275701", "0.7271532", "0.7183193", "0.71806", "0.71694124", "0.6954345", "0.6920193", "0.6845532", "0.6817044", "0.6804565", "0.67709076", "0.6767728", "0.67519045", "0.67482877", "0.67421955", "0.66663814", "0.65690017", "0.6515906", "0.649691...
0.76650923
1
Returns tuple of the mouse's x and y position.
def getMousePosition(self): return (self.mouseData.x, self.mouseData.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mousePos():\n data = display.Display().screen().root.query_pointer()._data\n return data[\"root_x\"], data[\"root_y\"]", "def mouse_coords(desktop=False):\n x, y = c_int(0), c_int(0)\n if desktop:\n mouse.SDL_GetGlobalMouseState(byref(x), byref(y))\n else:\n mouse.SDL_GetMouseSta...
[ "0.8341588", "0.8308028", "0.8275377", "0.79267716", "0.7811369", "0.78063816", "0.77965844", "0.7750217", "0.7621062", "0.7612835", "0.7541511", "0.75267994", "0.752542", "0.74809784", "0.7469829", "0.7467763", "0.744493", "0.7417471", "0.7417471", "0.73869586", "0.73104537"...
0.8774161
0
Will only return true once per left mouse button press.
def getMouseLeftDown(self): if self.mouseData.leftNewlyActive: self.mouseData.leftNewlyActive = False return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_left_click(event):\n return (event.type == pygame.MOUSEBUTTONDOWN\n and event.button == MOUSE_LEFT)", "def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_BUTTON)", "def mouse_left_down(self):\n pass", "def left(event: EventType, widget: WidgetType) -> bo...
[ "0.8006754", "0.76775587", "0.7675541", "0.74690914", "0.7183292", "0.7112333", "0.7002191", "0.6991126", "0.6943883", "0.69427043", "0.6892363", "0.6866597", "0.68091565", "0.67808914", "0.6759235", "0.67316145", "0.67145634", "0.6712375", "0.6689281", "0.66657394", "0.66433...
0.8029612
0
Will only return true once per right mouse button press.
def getMouseRightDown(self): if self.mouseData.rightNewlyActive: self.mouseData.rightNewlyActive = False return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rightButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.RIGHT_BUTTON)", "def mouse_right_down(self):\n pass", "def right(event: EventType, widget: WidgetType) -> bool:\n return event.key == KEY_RIGHT", "def RightClick(self):\n self._PressRightButton()\n self._ReleaseAllButto...
[ "0.7968415", "0.7648867", "0.75920916", "0.7204233", "0.7191432", "0.71218544", "0.6907627", "0.67827153", "0.6778556", "0.6776632", "0.6702281", "0.6695338", "0.6671457", "0.6664631", "0.6655712", "0.6652684", "0.6624108", "0.66104114", "0.6571914", "0.654676", "0.6544498", ...
0.8019463
0
return a list of TODOs owned by current user
def get_own_todos(current_user: models.User = Depends(get_current_user), db: Session = Depends(get_db)): todos = blogcrud.get_user_todos(db, current_user.id) return todos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n current_user = fjwte.get_current_user()\n return Todo.get_items_by_user_id(current_user.id)", "def get_queryset(self):\n user = self.request.user\n return Task.objects.filter(author=user)", "def getResponsibleUsers():", "def todo_list_view(request):\n\n context...
[ "0.7174186", "0.67827654", "0.6410615", "0.63974357", "0.6377105", "0.63201666", "0.6319978", "0.6306578", "0.62478435", "0.6237057", "0.6183957", "0.59976774", "0.59974366", "0.5940442", "0.5880697", "0.5879238", "0.5871809", "0.5840541", "0.5830627", "0.5805847", "0.5798051...
0.77829075
0
Create triangle that is triangle in XZ coordinages, with Y beeing the thickness"
def create_triangle( xsize, ysize, zsize, place=(0,0,0), rotate=(1,0,0,0) ): b1 = create_box( (xsize,ysize,zsize), place=(0,0,0 ) ) ms = max( xsize, zsize ) angle = math.atan( zsize / xsize ) * 180 / math.pi b2 = create_box( (2*ms, 2*ysize, 2*ms), place=(0,-EPS,0), rotate=(0,1,0,-angle) ) tr = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_triangle(tup):\n x, y, z = tup[0], tup[1], tup[2]\n t_draw = turtle.Turtle()\n for index in range(3):\n t_draw.forward()", "def triangle_shape(height):\n mot = str()\n if height == 0:\n return str()\n else :\n for i in range (height):\n esp = height-1-i\...
[ "0.67842567", "0.66823167", "0.6456786", "0.6393206", "0.6376432", "0.6367165", "0.6350288", "0.6309972", "0.62916946", "0.6245929", "0.61663145", "0.61014986", "0.6092199", "0.60713196", "0.6067632", "0.60645217", "0.6037411", "0.60368097", "0.6018011", "0.5999398", "0.59797...
0.7213213
0
Return a directory for tag on branch or raise BuildNotFound
def find_build(branch, tag, build_path=None, old_build_path=None): for directory_format in [build_path, old_build_path]: if directory_format is None: continue loc = directory_format % (branch, tag) if isdir(loc): return loc raise BuildNotFound(branch, tag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b2d(homedir, branch):\n return os.path.join(homedir, 'integ', branch, 'integ')", "def tag(referencefile):\n dirpath = path.abspath(referencefile)\n\n if path.isdir(dirpath):\n dircontents = listdir(dirpath)\n else:\n dirpath = path.split(dirpath)[0]\n dircontents = listdir(di...
[ "0.5977417", "0.5876411", "0.5687731", "0.567183", "0.560582", "0.54256225", "0.5397359", "0.5381051", "0.52119887", "0.51686037", "0.5160606", "0.5136722", "0.51248574", "0.51212746", "0.5051708", "0.5051698", "0.5049382", "0.50226355", "0.5020252", "0.50200105", "0.5010866"...
0.7497679
0
Part of the public interface for a MetricWatcher. Should take a rule config (from soaconfigs) + some additional metadata (e.g., auth information) and return a fullyformed MetricWatcher subclass
def from_config( cls: Type[MetricWatcherT], config: BaseRule, on_failure_callback: Callable[['MetricWatcher'], None], auth_callback: Optional[Callable[[], Any]] = None, ) -> MetricWatcherT: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_metric(self) -> EvalMetric:\n pass", "def new(ruletype, **kwargs):\n try:\n ruleclass = TYPE_MAP[ruletype]\n except KeyError:\n raise error.InvalidRule('Unrecognized rule type: %s' % ruletype)\n\n try:\n return ruleclass(**kwargs)\n except TypeError:\n lo...
[ "0.52101", "0.5050569", "0.50056726", "0.49772125", "0.4909664", "0.48076355", "0.4777214", "0.4777214", "0.47341272", "0.47207183", "0.47207183", "0.47207183", "0.47207183", "0.47207183", "0.47016814", "0.4695809", "0.46777844", "0.46469286", "0.4639769", "0.4592974", "0.458...
0.74009496
0
Create a new instance of the UpdateTrigger Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
def __init__(self, temboo_session): super(UpdateTrigger, self).__init__(temboo_session, '/Library/Xively/Triggers/UpdateTrigger')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_update_trigger(self):\n self.execute(self.commands.update_function(\n self.name,\n self._equals(\n self.intersection.dest_columns,\n 'NEW',\n self.intersection.origin_columns\n ),\n self.primary_key_column\n ...
[ "0.55399466", "0.4846183", "0.4789044", "0.47353917", "0.46725985", "0.44396847", "0.39952904", "0.3906584", "0.390634", "0.388709", "0.3831259", "0.37764362", "0.37753603", "0.3763408", "0.37489897", "0.37427178", "0.37355223", "0.3697208", "0.3646685", "0.3630165", "0.36292...
0.49308053
1
Set the value of the ThresholdValue input for this Choreo. ((optional, string) Threshold that will cause the trigger to activate. Include input only if changing Threshold Value.)
def set_ThresholdValue(self, value): super(UpdateTriggerInputSet, self)._set_input('ThresholdValue', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThreshold(self, value):\n return self._set(threshold=value)", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n ...
[ "0.7035364", "0.5995165", "0.5995165", "0.5995165", "0.5995165", "0.5995165", "0.5991856", "0.586901", "0.5700665", "0.53603107", "0.52978474", "0.5290875", "0.52556384", "0.52308434", "0.5228519", "0.51740694", "0.51740694", "0.51740694", "0.5158728", "0.5143797", "0.5082036...
0.75535905
0
Set the value of the TriggerID input for this Choreo. ((required, integer) TriggerID for the trigger that you wish to update.)
def set_TriggerID(self, value): super(UpdateTriggerInputSet, self)._set_input('TriggerID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_id(self, trigger_id):\n\n self._trigger_id = trigger_id", "def delete_trigger(self, trigger_id):\n self._delete(path=\"triggers/{}\".format(trigger_id))", "def get_trigger_by_id(self, trigger_id):\n return self.triggers[trigger_id]", "def trigger_id(self) -> pulumi.Input[str]...
[ "0.6884074", "0.5484074", "0.51305044", "0.49737403", "0.4899946", "0.48826936", "0.46575096", "0.44376594", "0.4368194", "0.43429962", "0.42614675", "0.4221972", "0.4156011", "0.415287", "0.4144462", "0.41385454", "0.4132832", "0.41177928", "0.41103038", "0.40706295", "0.405...
0.6217905
1
Retrieve the value for the "ResponseStatusCode" output from this Choreo execution. ((integer) The response status code returned from Xively. For a successful trigger update, the code should be 200.)
def get_ResponseStatusCode(self): return self._output.get('ResponseStatusCode', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_code(self):\n return self._response_code", "def response_code(self):\n return self._response_code", "def get_status_code(self, response):\n if hasattr(response, 'status_int'):\n return response.status_int\n return response.status", "def get_status_code(self...
[ "0.67395395", "0.67395395", "0.66692615", "0.6604862", "0.6604862", "0.65936613", "0.6561299", "0.64286965", "0.6367107", "0.636263", "0.634679", "0.6177823", "0.61737144", "0.6155878", "0.6047667", "0.6047667", "0.5972856", "0.5878245", "0.58305305", "0.5826923", "0.57805556...
0.8141129
0
Fetched packs' data from context and formats it to an installable object.
def get_packs_data_from_context(): instance_context = demisto.context() context_packs_data = instance_context.get('ContentData') if isinstance(context_packs_data, list): context_entries = [ { 'packid': pack['packID'], 'packversion': 'latest', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_data(self, data):\n pass", "def get_data(self, context):\n # Things to do\n return context", "def getPackageInfo(self, pid):\n if pid == self.ROOT_PACKAGE:\n pack = RootPackage(self, OWNER).toInfoData()\n elif pid in self.packages:\n pack = s...
[ "0.5854237", "0.57914305", "0.5674762", "0.56493485", "0.5541139", "0.5541139", "0.5541139", "0.5541139", "0.5501793", "0.5384755", "0.53700507", "0.53397727", "0.5255681", "0.5255681", "0.5247963", "0.5226133", "0.5220658", "0.5211134", "0.51883596", "0.5187239", "0.51723456...
0.73318
0
Redetect faces on images.
def detectFaces(): faceEngine = VLFaceEngine() detector = faceEngine.createFaceDetector(DetectorType.FACE_DET_V3) imageWithOneFace = VLImage.load(filename=EXAMPLE_O) pprint.pprint(detector.detectOne(imageWithOneFace, detect5Landmarks=False, detect68Landmarks=False).asDict()) detection = detector.de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self,image):\r\n \r\n self._faces=[]\r\n \r\n if util.isgray(image):\r\n image=cv2.equalizeHist(image)\r\n \r\n else:\r\n \r\n image=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)\r\n cv2.equalizeHist(image,image)\r\n ...
[ "0.7132961", "0.705328", "0.6980958", "0.68435824", "0.6793622", "0.6746617", "0.6708263", "0.6608204", "0.65846044", "0.65693116", "0.6552808", "0.655144", "0.6540004", "0.6527223", "0.6510737", "0.6488948", "0.644064", "0.6420578", "0.64109945", "0.6405241", "0.64046896", ...
0.7460728
0
Async redetect faces on images.
async def asyncRedetectFaces(): faceEngine = VLFaceEngine() detector = faceEngine.createFaceDetector(DetectorType.FACE_DET_V3) imageWithSeveralFaces = VLImage.load(filename=EXAMPLE_SEVERAL_FACES) severalFaces = detector.detect([imageWithSeveralFaces], detect5Landmarks=False, detect68Landmarks=False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_face_task(img):\n\n # paramter for detect\n # image_size = 160\n # margin = 44\n minsize = 20 # minimum size of face\n threshold = [0.6, 0.7, 0.7] # three steps's threshold\n factor = 0.709 # scale factor\n\n # caffe model\n pnet = caffe_model.get_pnet()\n rnet = caffe_model....
[ "0.64969593", "0.6364005", "0.6304755", "0.6286546", "0.6172801", "0.61590046", "0.61203325", "0.60647845", "0.6005734", "0.5988241", "0.5965875", "0.5962146", "0.5954071", "0.59476674", "0.5939201", "0.5933306", "0.5929238", "0.59187454", "0.591381", "0.5893143", "0.58397377...
0.86137897
0
Get status of EC2 spot request
def get_status(ec2,spot_request_id): current = ec2.describe_spot_instance_requests(SpotInstanceRequestIds=[spot_request_id,]) instance_id = current[u'SpotInstanceRequests'][0][u'InstanceId'] if u'InstanceId' in current[u'SpotInstanceRequests'][0] else None return instance_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_spot_instance_state() -> Response:\n retry_session = requests_retry_session()\n response = retry_session.get(INSTANCE_ACTION_URL)\n return response", "def remote_status():", "async def get_status():", "def status():\n (code, message) = rest_api.status(request)\n if (code == 200):\n ...
[ "0.6296138", "0.6140248", "0.60616577", "0.588999", "0.5862307", "0.5762618", "0.5736567", "0.5726555", "0.57067794", "0.56971884", "0.5692415", "0.56664914", "0.5663505", "0.5642255", "0.5640854", "0.56370384", "0.5602836", "0.5599503", "0.5592363", "0.5583365", "0.5575961",...
0.7878497
0
A helper script to launch a spot P2 instance running Deep Video Analytics To use this please change the keyname, security group and IAM roles at the top
def launch_spot(): ec2 = boto3.client('ec2') ec2r = boto3.resource('ec2') ec2spec = dict(ImageId=AMI, KeyName = KeyName, SecurityGroupIds = [SecurityGroupId, ], InstanceType = "p2.xlarge", Monitoring = {'Enabled': True,}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_instance():\n ami_id = \"ami-04876f29fd3a5e8ba\" # AMI Id\n instance_type = \"t2.micro\" # Instance Type\n tag_specs = [\n {\n 'ResourceType': 'instance',\n 'Tags': [\n {\...
[ "0.5938847", "0.58754605", "0.5437055", "0.5432101", "0.54282796", "0.53524303", "0.53459686", "0.5296672", "0.52392614", "0.51798517", "0.50719494", "0.5044687", "0.5031047", "0.5015609", "0.4999175", "0.4978533", "0.49736512", "0.49699563", "0.49691266", "0.49682745", "0.49...
0.6438622
0
Translates edges of histogram bins to bin centres.
def bin_edges_to_centres(edges): if edges.ndim == 1: steps = (edges[1:] - edges[:-1]) / 2 return edges[:-1] + steps else: steps = (edges[1:, 1:] - edges[:-1, :-1]) / 2 centres = edges[:-1, :-1] + steps return centres
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_centers_from_bins(bins):\n return 0.5 * (bins[:-1] + bins[1:])", "def bin_edges_to_center(edges):\n df = np.diff(edges)\n if isinstance(df[0], datetime.timedelta) and sys.version_info[0:2]<=(3,2):\n return edges[:-1] + df//2\n else:\n return edges[:-1] + df/2", "def find_bin_e...
[ "0.7115142", "0.6772283", "0.6753914", "0.6714895", "0.64245945", "0.63743883", "0.6348091", "0.6348091", "0.63018626", "0.6241863", "0.62182707", "0.61705595", "0.6123319", "0.6078565", "0.5994055", "0.597821", "0.59385145", "0.5935507", "0.5913347", "0.59129584", "0.5912303...
0.7626651
0
Construct a graphical linearlyspaced grid within a ternary space.
def ternary_grid( data=None, nbins=10, margin=0.001, force_margin=False, yscale=1.0, tfm=lambda x: x ): if data is not None: data = close(data) if not force_margin: margin = min([margin, np.nanmin(data[data > 0])]) # let's construct a bounding triangle bounds = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_grid(self):\n for k in range(0, NUM + 1):\n self.create_line(k * UNIT, 0, k * UNIT, SIZE, width=THICKNESS)\n self.create_line(0, k * UNIT, SIZE, k * UNIT, width=THICKNESS)", "def make_grid(N):\n\n x = np.linspace(-2. , 2 , N)\n y = np.linspace(-2. , 2 , N)\n # two e...
[ "0.6353607", "0.6309061", "0.61757565", "0.6122297", "0.6120471", "0.6088273", "0.6082796", "0.6081821", "0.60757345", "0.6066482", "0.60520643", "0.6011054", "0.5992132", "0.5968607", "0.59675235", "0.59593165", "0.59503216", "0.59470177", "0.59250623", "0.5922438", "0.59206...
0.63151515
1
Limit speed in range [1000,1000]
def limit_speed(speed): if speed > 1000: speed = 1000 elif speed < -1000: speed = -1000 return speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_speed(speed):\n if speed > 900:\n speed = 900\n elif speed < -900:\n speed = -900\n return -speed", "def speed(self, value: int, /) -> None:", "def set_speed(self,value):\n if (value>self.get_max_speed()):\n print \"asked to set the speed to %f but the max speed is %f\\...
[ "0.8183303", "0.71591496", "0.6988229", "0.698505", "0.6964697", "0.6929783", "0.69163376", "0.68221915", "0.67862874", "0.6731271", "0.67008835", "0.6679034", "0.663012", "0.6583044", "0.6583044", "0.65218097", "0.65210927", "0.648919", "0.6475178", "0.64562607", "0.644576",...
0.8521427
0
Performs Biopython based motif matching and writes the results to a dictionary indexed by chromosome.
def biopythonMM(pwmFileName,genomeDict,mpbsDict,scoringMethod,tempLocation,pseudocounts=0.1,bitscore=12.0,fpr=0.01,precision=10**4,highCutoff=0.7,functionalDepth=0.9): # Reading PWM pwm = readPwmFile(pwmFileName,tempLocation,pseudocounts) pwmName = pwmFileName.split("/")[-1].split(".")[0] pwmLen = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_RE(self, index):\n if index is None:\n self.logger.error(\"The bowtie genome index must be specified to \"\n \"map restriction enzyme sites\")\n return None\n self.logger.info(\"Mapping restriction enyzme recognition sites\")\n # Start...
[ "0.59078485", "0.57317793", "0.56751376", "0.5561408", "0.54683334", "0.5306675", "0.53015906", "0.52467316", "0.52461946", "0.52367425", "0.520722", "0.5146601", "0.51458216", "0.5112829", "0.5058424", "0.50535494", "0.50508714", "0.5004539", "0.49987587", "0.4996127", "0.49...
0.62142134
0
Reads a PWM file in Jaspar format and returns a Biopython PWM object.
def readPwmFile(pwmFileName, outputLocation, pseudocounts=0.0): # Adding pseudocounts pwmFile = open(pwmFileName,"r"); tempFileName = outputLocation+pwmFileName.split("/")[-1]+"temp" pwmFileT = open(tempFileName,"w") for line in pwmFile: pwmFileT.write(" ".join([str(float(e)+pseudocounts) for e in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goal_pwm(self):\n return self._read(MX_GOAL_PWM)", "def read_pfm(filename):\n\n\twith open(filename, \"r\") as handle:\n\t\tmotif = motifs.read(handle, \"pfm\")\n\tmotif.pseudocounts = .25\n\tmotif.background = {'A':0.3,'C':0.2,'G':0.2,'T':0.3}\n\n\treturn motif", "def read(self):\n\n # Load ...
[ "0.56788427", "0.5495728", "0.5376343", "0.53577346", "0.5160215", "0.5143681", "0.50724196", "0.502228", "0.49792627", "0.49575832", "0.4956543", "0.48406678", "0.47284013", "0.47217077", "0.4717854", "0.4705762", "0.46920034", "0.46860862", "0.46798915", "0.4671482", "0.465...
0.6233586
0
Test various retrieval utilities on a single list of Artifact.
def testGetFromSingleList(self): artifacts = [standard_artifacts.Examples()] artifacts[0].uri = '/tmp/evaluri' artifacts[0].split_names = '["eval"]' self.assertEqual(artifacts[0], artifact_utils.get_single_instance(artifacts)) self.assertEqual('/tmp/evaluri', artifact_utils.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_artifact(self):\n pass", "def get_single_instance(artifact_list: List[Artifact]) -> Artifact:\n if len(artifact_list) != 1:\n raise ValueError('expected list length of one but got {}'.format(\n len(artifact_list)))\n return artifact_list[0]", "def test_get_experiment_artifact(s...
[ "0.662036", "0.62965786", "0.62030226", "0.60663354", "0.593072", "0.5918591", "0.58616775", "0.57673883", "0.5732222", "0.57250345", "0.57193136", "0.57103896", "0.56704307", "0.56461483", "0.5623771", "0.56043285", "0.558357", "0.5563329", "0.55472404", "0.5546737", "0.5538...
0.6868066
0
Test various retrieval utilities on a list of split Artifact.
def testGetFromSplits(self): artifacts = [standard_artifacts.Examples()] artifacts[0].uri = '/tmp' artifacts[0].split_names = artifact_utils.encode_split_names( ['train', 'eval']) self.assertEqual(artifacts[0].split_names, '["train", "eval"]') self.assertIs(artifact_utils.get_single_instan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetFromSingleList(self):\n artifacts = [standard_artifacts.Examples()]\n artifacts[0].uri = '/tmp/evaluri'\n artifacts[0].split_names = '[\"eval\"]'\n self.assertEqual(artifacts[0],\n artifact_utils.get_single_instance(artifacts))\n self.assertEqual('/tmp/evaluri', artifa...
[ "0.7153729", "0.6059467", "0.602834", "0.6018038", "0.5820629", "0.55848837", "0.55712974", "0.5540031", "0.5540031", "0.5531399", "0.5525339", "0.5524753", "0.54710245", "0.54397416", "0.54397416", "0.54349387", "0.54349387", "0.54316485", "0.54262596", "0.541444", "0.540349...
0.694926
1
Tests that current nmrplot.add_signals output agrees with an accepted dataset. The original dataset was generated before line broadening scaling_factor was added to nmrplot.lorentz. Therefore Y has been scaled to half to convert this data to work with the new lorentz function.
def test_add_signals(): x = np.linspace(390, 410, 200) doublet = [(399, 1), (401, 1)] y = add_signals(x, doublet, 1) X = np.array([x for x, _ in ADD_SIGNALS_DATASET]) Y = np.array([y / 2 for _, y in ADD_SIGNALS_DATASET]) # scale to match print(y) print(Y) assert np.array_equal(x, X) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_spreads():\n fig, (ax_prior, ax2_post) = plt.subplots(\n nrows=2, figsize=figsize(aspect=1.2))\n\n # train margin-dependent Elo model\n melo = Melo(lines=np.arange(-49.5, 50.5), commutes=False, k=1e-4)\n melo.fit(league.times, league.labels1, league.labels2, league.spreads)\n\n #...
[ "0.5300914", "0.5199778", "0.50814444", "0.50585854", "0.5034965", "0.50297797", "0.5011559", "0.48441267", "0.4837573", "0.48363823", "0.48164424", "0.4816253", "0.4811083", "0.47844577", "0.4780375", "0.47778818", "0.47764048", "0.47515702", "0.47412965", "0.473127", "0.469...
0.623664
0
function to read gcode as raw text
def read_gcode(filename): ##TODO: parse/read file line by line for memory considerations with open(filename, 'r') as fh_in: gcode_raw = fh_in.readlines() gcode_raw = [gcode.rstrip(';\n') for gcode in gcode_raw] # stripping off trailing semicolon and newlines return gcode_raw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcode_interpreter(file_gcode):\n\tgcode_raw = read_gcode(file_gcode)\n\n\tdim = (11, 11)\n\tarray = convert_gcode_to_array(gcode_raw, dim)\n\n\tprint array", "def gcode_text(self):\n return os.linesep.join(map(str, self.gcode))", "def _read_grammar(filename):\r\n with open(filename, 'r') as file:...
[ "0.654129", "0.64190435", "0.63276243", "0.6285701", "0.6201393", "0.59650147", "0.58513474", "0.58321035", "0.5811857", "0.5757731", "0.57542074", "0.5736658", "0.5722496", "0.5673059", "0.5661055", "0.5611945", "0.55907106", "0.55634713", "0.5559533", "0.5539514", "0.553741...
0.68218833
0
extract X and Y position from gcode "G" letter address
def get_xy_position(gcode_command): pattern = re.compile(r"^G\dX(\d+(?:\.\d*)?|\.\d+)Y(\d+(?:\.\d*)?|\.\d+)F(\d+)$") # using non-capturing groups m = pattern.match(gcode_command) # no need for re.search() because we have a complete pattern (x, y) = m.group(1,2) try: x = float(x) y = float(y) except: raise Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinates(self):\n logging.debug('Get coordinates from text')\n result = []\n blocks = self.del_comm(blocks=True)\n coor = re.compile('[FXYZ][+-]?[0-9]+(\\.[0-9]+)?')\n for line in blocks:\n coord_line = False\n comm = line.split()\n temp = ...
[ "0.61152065", "0.61036426", "0.59763837", "0.5961071", "0.59122723", "0.5863732", "0.5756867", "0.57562524", "0.5756186", "0.5736474", "0.5735927", "0.57350487", "0.56665355", "0.5650005", "0.56383294", "0.5629794", "0.5627465", "0.5599105", "0.5595129", "0.5590702", "0.55860...
0.73354113
0
Get custom template loader
def template_loader(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_loader_vanilla():\n return template_loader_vanilla", "def get_template(loader, template_name):\n return loader.get_template(template_name)", "def create_template_loader(self, template_path):\n raise NotImplementedError()", "def loader(self):\n return self.loader_class()", "de...
[ "0.737304", "0.72793007", "0.7253313", "0.6933869", "0.67708385", "0.61881804", "0.6157388", "0.5983813", "0.597341", "0.5949879", "0.5875685", "0.58639973", "0.5863923", "0.58493626", "0.5842449", "0.58355576", "0.5831463", "0.5823081", "0.5786827", "0.57619715", "0.5755552"...
0.83160263
0
Binary mapping should return a ZPFBoundarySets object
def test_binary_mapping(load_database): dbf = load_database() my_phases = ['LIQUID', 'FCC_A1', 'HCP_A3', 'AL5FE2', 'AL2FE', 'AL13FE4', 'AL5FE4'] comps = ['AL', 'FE', 'VA'] conds = {v.T: (1200, 1300, 50), v.P: 101325, v.X('AL'): (0, 1, 0.2)} zpf_boundaries = map_binary(dbf, comps, my...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_band_maps(self):\n band_maps = []\n source_band_index = 1\n target_band_index = self.starting_target_band\n for band in self.image['bands']:\n band_maps.append({\n 'source': source_band_index,\n 'target': target_band_index\n ...
[ "0.6035268", "0.5507288", "0.54482836", "0.5369027", "0.536103", "0.53413874", "0.5334319", "0.5321949", "0.5288576", "0.5270437", "0.5252339", "0.5250869", "0.5245525", "0.52396154", "0.5179", "0.5110166", "0.50924635", "0.5092054", "0.50727254", "0.50721407", "0.50680166", ...
0.70849204
0
A CompsetPair with very different temperature should not belong in the TwoPhaseRegion
def test_two_phase_region_outside_temperature_tolerance_does_not_belong(): compsets_300 = CompsetPair([ BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]), BinaryCompset('P2', 300, 'B', 0.8, [0.2, 0.8]), ]) compsets_500 = CompsetPair([ BinaryCompset('P1', 500, 'B', 0.5, [0.5, 0.5]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_phase_region_expands_as_compsets_are_added():\n compsets_300 = CompsetPair([\n BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]),\n BinaryCompset('P2', 300, 'B', 0.8, [0.2, 0.8]),\n ])\n\n compsets_305 = CompsetPair([\n BinaryCompset('P1', 305, 'B', 0.5, [0.5, 0.5]),\n ...
[ "0.63824725", "0.61983526", "0.60765725", "0.58474624", "0.55372393", "0.5528594", "0.5406215", "0.5398616", "0.5267037", "0.5245239", "0.5206635", "0.5178668", "0.5114043", "0.511152", "0.51114476", "0.5090678", "0.50795275", "0.5068768", "0.506794", "0.5047619", "0.50468045...
0.67047006
0
A CompsetPair with very different temperature should not belong in the TwoPhaseRegion
def test_two_phase_region_expands_as_compsets_are_added(): compsets_300 = CompsetPair([ BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]), BinaryCompset('P2', 300, 'B', 0.8, [0.2, 0.8]), ]) compsets_305 = CompsetPair([ BinaryCompset('P1', 305, 'B', 0.5, [0.5, 0.5]), BinaryComps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_phase_region_outside_temperature_tolerance_does_not_belong():\n compsets_300 = CompsetPair([\n BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]),\n BinaryCompset('P2', 300, 'B', 0.8, [0.2, 0.8]),\n ])\n\n compsets_500 = CompsetPair([\n BinaryCompset('P1', 500, 'B', 0.5, [0.5...
[ "0.67047006", "0.61983526", "0.60765725", "0.58474624", "0.55372393", "0.5528594", "0.5406215", "0.5398616", "0.5267037", "0.5245239", "0.5206635", "0.5178668", "0.5114043", "0.511152", "0.51114476", "0.5090678", "0.50795275", "0.5068768", "0.506794", "0.5047619", "0.50468045...
0.63824725
1
A new pair of compsets with different phases should not be in the TwoPhaseRegion
def test_two_phase_region_new_phases_does_not_belong(): compsets_298 = CompsetPair([ BinaryCompset('P1', 298.15, 'B', 0.5, [0.5, 0.5]), BinaryCompset('P2', 298.15, 'B', 0.8, [0.2, 0.8]), ]) compsets_300_diff_phases = CompsetPair([ BinaryCompset('P2', 300, 'B', 0.5, [0.5, 0.5]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_phase_region_expands_as_compsets_are_added():\n compsets_300 = CompsetPair([\n BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]),\n BinaryCompset('P2', 300, 'B', 0.8, [0.2, 0.8]),\n ])\n\n compsets_305 = CompsetPair([\n BinaryCompset('P1', 305, 'B', 0.5, [0.5, 0.5]),\n ...
[ "0.72638243", "0.66531706", "0.5972164", "0.5763779", "0.5614874", "0.5568291", "0.5500854", "0.5419175", "0.5378876", "0.5364433", "0.5332054", "0.52813214", "0.5249226", "0.524922", "0.5237803", "0.52325755", "0.521825", "0.5183979", "0.5174692", "0.5155056", "0.51443166", ...
0.73919016
0
Test that new composition sets can be added to ZPFBoundarySets successfully.
def test_adding_compsets_to_zpf_boundary_sets(): compsets_298 = CompsetPair([ BinaryCompset('P1', 298.15, 'B', 0.5, [0.5, 0.5]), BinaryCompset('P2', 298.15, 'B', 0.8, [0.2, 0.8]), ]) compsets_300 = CompsetPair([ BinaryCompset('P1', 300, 'B', 0.5, [0.5, 0.5]), BinaryCompset('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rebulding_zpf_boundary_sets_regions():\n\n compsets_298 = CompsetPair([\n BinaryCompset('P1', 298.15, 'B', 0.5, [0.5, 0.5]),\n BinaryCompset('P2', 298.15, 'B', 0.8, [0.2, 0.8]),\n ])\n\n compsets_310 = CompsetPair([\n BinaryCompset('P1', 310, 'B', 0.5, [0.5, 0.5]),\n B...
[ "0.7422872", "0.6564256", "0.6453201", "0.61937606", "0.61298454", "0.6103981", "0.5989328", "0.59409636", "0.59300935", "0.59042823", "0.5739416", "0.5732022", "0.5718276", "0.5715971", "0.56820273", "0.56806755", "0.56332743", "0.56332743", "0.5622735", "0.5620251", "0.5605...
0.8190679
0
Test that three regions generated by ZPFBoundarySets can correctly be rebuilt to two regions
def test_rebulding_zpf_boundary_sets_regions(): compsets_298 = CompsetPair([ BinaryCompset('P1', 298.15, 'B', 0.5, [0.5, 0.5]), BinaryCompset('P2', 298.15, 'B', 0.8, [0.2, 0.8]), ]) compsets_310 = CompsetPair([ BinaryCompset('P1', 310, 'B', 0.5, [0.5, 0.5]), BinaryCompset('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_build_genomic_regions(self):\n\n CDS = pybedtools.BedTool(\"\"\"chr1\\t7700\\t7900\\tfoo\\t0\\t+\\n\n chr1\\t7999\\t8500\\tfoo\\t0\\t+\\n\"\"\", from_string = True)\n UTR5 = pybedtools.BedTool(\"\"\"chr1\\t7499\\t7700\\tfoo\\t0\\t+\\n\"\"\", from_string = Tr...
[ "0.6851561", "0.6647029", "0.66334915", "0.6579759", "0.65599364", "0.6482568", "0.633641", "0.62562704", "0.6254943", "0.6175007", "0.61622155", "0.61461675", "0.6125849", "0.6115511", "0.60688263", "0.5916412", "0.58777696", "0.58770466", "0.5841907", "0.5833076", "0.582616...
0.7825171
0
Create new neighbor within acceptable bounds
def neighbor(self, start): x = start[0] + random.uniform(-20, 20) y = start[1] + random.uniform(-20, 20) x = max(min(x, xbounds[1]), xbounds[0]) y = max(min(y, ybounds[1]), ybounds[0]) return [x,y]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_neighborhood(self):\n if len(self.available_building_cells) == 0:\n return False\n # Pick cell\n shuffle(self.available_building_cells)\n\n neighborhood_origin = self.available_building_cells[0]\n if not self.creates_valid_building(neighborhood_origin):\n ...
[ "0.63055634", "0.61515677", "0.6088113", "0.6036705", "0.59358096", "0.5916102", "0.5905298", "0.59038895", "0.57757497", "0.5760618", "0.5752663", "0.57353127", "0.5683542", "0.5659537", "0.56424284", "0.56122315", "0.56095177", "0.5567989", "0.5559961", "0.5527063", "0.5464...
0.6255202
1
>>> decimal_to_time(1.0) datetime.time(1, 0) >>> decimal_to_time(23.450) datetime.time(23, 27)
def decimal_to_time(decimal_time): hours = int(decimal_time) minutes = (decimal_time * 60) % 60 seconds = (decimal_time * 3600) % 60 args = [int(n) for n in [hours, minutes, seconds]] return datetime.time(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __float_to_time(float_value):\n time_ms = int(float_value*24*60*60*1e3)\n return (datetime.datetime.min + datetime.timedelta(milliseconds=time_ms)).time()", "def convert_time(t):\n return datetime.fromtimestamp(t / 1e7 - 11644473600)", "def _time_to_datetime(value):\r\n assert isinstanc...
[ "0.6740458", "0.6462992", "0.64223194", "0.639058", "0.6273709", "0.6182896", "0.6182896", "0.6151217", "0.6147378", "0.6122597", "0.5932671", "0.59254336", "0.58498394", "0.5765848", "0.569216", "0.5691907", "0.56543106", "0.5623327", "0.55985504", "0.5585881", "0.5555204", ...
0.82775223
0
Tests the init funtion of the ship
def test_init(self): self.assertEqual(self.location, Ship(self.location).location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\r\n self.spaceship = SpaceShipGame()\r\n self.spaceship.init()", "def setUp(self):\r\n self.spaceship = SpaceShipGame()", "def setUp(self):\r\n self.spaceship = SpaceShipGame()", "def setUp(self):\r\n self.spaceship = SpaceShipGame()", "def setUp(self):\r...
[ "0.8001722", "0.7689143", "0.7689143", "0.7689143", "0.7689143", "0.7689143", "0.74255955", "0.74255955", "0.73445696", "0.7143339", "0.71065366", "0.7025921", "0.6844173", "0.6808563", "0.6744077", "0.67212474", "0.67182875", "0.67056423", "0.6699834", "0.6693226", "0.669231...
0.7780014
1
Tests whether a ship can be hit
def test_hit(self): ship = Ship(self.location) self.assertEqual(self.location, ship.location) self.assertEqual(1, ship.check_hit(self.hit)) self.assertEqual(1, len(ship.location))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_miss(self):\n ship = Ship([self.hit])\n self.assertEqual([self.hit], ship.location)\n self.assertEqual(0, ship.check_hit((1, 1)))\n self.assertEqual(1, len(ship.location))", "def is_ship_sunk(self, x, y):\n marker = self.markers[x][y]\n total_hits = self.ship_hi...
[ "0.7271281", "0.70827186", "0.704767", "0.7041984", "0.7026214", "0.6968032", "0.6933917", "0.68898654", "0.68886876", "0.6832401", "0.6804325", "0.6801222", "0.6788589", "0.67883235", "0.67757285", "0.6768699", "0.66971505", "0.66723", "0.666582", "0.6664523", "0.66624606", ...
0.7323437
0
Selects the mean data if the flag is true
def select_data( self, flag_mean: bool ) -> np.ndarray[tuple[Ifm, Chn], np.float64]: return self.mean if flag_mean else self.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_mean(x: torch.FloatTensor, m: torch.BoolTensor):\n if m.bool().sum() == len(m):\n return torch.full((1, ), fill_value=float('inf'), device=x.device)\n return x[m.bool()].mean()", "def reset_mean(cls, sensor):\n if sensor == 't':\n cls.mean_t.clear()\n ...
[ "0.6278715", "0.6039226", "0.59565204", "0.5857826", "0.5752508", "0.56542146", "0.5637328", "0.5604804", "0.5561127", "0.5551796", "0.5551796", "0.55310106", "0.5478316", "0.54347473", "0.54059947", "0.54058695", "0.5385061", "0.53676134", "0.5334629", "0.53160447", "0.53139...
0.75266117
0
Main function for validating CFN templates
def main(): VALIDATE_TEMPLATE(TEMPLATES)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, template: str, func: Callable):\n raise NotImplementedError", "def test_valid(self):\n args = [SIMPLE_TEMPLATE, SIMPLE_CANDIDATE]\n result = self.runner.invoke(main, args)\n self.assertEqual(0, result.exit_code)", "def test_starting_template(checker):\n content...
[ "0.64297616", "0.63258636", "0.6283338", "0.6172829", "0.6088516", "0.59951484", "0.59484035", "0.59463793", "0.591722", "0.58468133", "0.58309555", "0.5799353", "0.57959706", "0.5764867", "0.5684891", "0.568023", "0.56518626", "0.56301785", "0.56172353", "0.55345136", "0.553...
0.811457
0
Ensures that two allocations close to each other are not mistaken when using scheduler.reserve. If they do then they bleed over, hence the name.
def test_no_bleed(scheduler): d1 = (datetime(2011, 1, 1, 15, 0), datetime(2011, 1, 1, 16, 0)) d2 = (datetime(2011, 1, 1, 16, 0), datetime(2011, 1, 1, 17, 0)) a1 = scheduler.allocate(d1)[0] a2 = scheduler.allocate(d2)[0] scheduler.commit() assert not a1.overlaps(*d2) assert not a2.overlaps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addToReservation():\n\n def fits(x, y):\n \"\"\"\n Check if a job shape's resource requirements will fit within a given node allocation\n \"\"\"\n return y.memory <= x.memory and y.cores <= x.cores and y.disk <= x.disk\n\n def su...
[ "0.5574495", "0.54888433", "0.54477704", "0.53917575", "0.53531617", "0.5304206", "0.5289244", "0.5287738", "0.5266306", "0.5228824", "0.5228126", "0.52268434", "0.5102959", "0.50496024", "0.50263566", "0.50198996", "0.50185126", "0.4980343", "0.49549127", "0.49506003", "0.49...
0.70153683
0
The event's start time, as a timezoneaware datetime object
def start(self): if self.start_time is None: time = datetime.time(hour=19, tzinfo=CET) else: time = self.start_time.replace(tzinfo=CET) return datetime.datetime.combine(self.date, time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_start(self):\n return self.get_t_sect()['datetime_start']", "def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()", "def get_start_time(self):\n start = datetime.strptime(\n self.get_handler().SOURCE_START_DATE.sp...
[ "0.76968586", "0.76729155", "0.7643306", "0.75934434", "0.7549188", "0.7539281", "0.7499669", "0.74902815", "0.744862", "0.7445907", "0.7349264", "0.7282488", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7235539", ...
0.78941786
0
Is true if the event only spans one day
def one_day(self): return self.end.date() == self.date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_advent() -> bool:\n # Run the code from the 1st to the 24th\n return datetime.now(EST).day in range(1, 25) and datetime.now(EST).month == 12", "def runs_today(self,s_id,day):\n if self.schedule_keys[s_id][day]==1:\n return True\n else:\n return False", "def g...
[ "0.72662985", "0.6719103", "0.65884805", "0.6551146", "0.6338677", "0.63329256", "0.63131696", "0.6304339", "0.62870234", "0.62826914", "0.6255161", "0.6226396", "0.6218282", "0.6174885", "0.61583", "0.6103819", "0.6099032", "0.6082656", "0.60797435", "0.6077559", "0.6072566"...
0.77704716
0
Yield the next planned occurrences after the date "since" The `since` argument can be either a date or datetime onject. If not given, it defaults to the date of the last event that's already planned. If `n` is given, the result is limited to that many dates; otherwise, infinite results may be generated. Note that less ...
def next_occurrences(self, n=None, since=None): scheme = self.recurrence_scheme if scheme is None: return () db = Session.object_session(self) query = db.query(Event) query = query.filter(Event.series_slug == self.slug) query = query.order_by(desc(Event.date)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_days_ahead(self, startdate, n, fmt=None):\n return startdate + datetime.timedelta(days=n)", "def limit(iterator, n=None):\n for i, v in enumerate(iterator):\n yield v\n if i + 1 == n:\n break", "def next_n(self, n, fast_forward=False):\n return list(it.islice...
[ "0.56236297", "0.55622554", "0.54129523", "0.537688", "0.5366716", "0.5216922", "0.5207121", "0.5206607", "0.51612425", "0.5151308", "0.50954014", "0.5094701", "0.49745113", "0.497114", "0.49553135", "0.4943986", "0.49304563", "0.4926645", "0.48990518", "0.48948643", "0.48934...
0.7174086
0
constructor function of the RSA Key Pair Class directories must point to a valid path
def __init__(self, type_encryption, directory_key_private, directory_key_public): # class variables self.type_encryption = type_encryption self.directory_key_private = directory_key_private self.directory_key_public = directory_key_public # check keys self._publicKey = '' self._privateKey = '' self.ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rsa_key):\r\n if isinstance(rsa_key, tuple):\r\n self.keypair = Crypto.PublicKey.RSA.construct(rsa_key)\r\n else:\r\n self._InitFromString(rsa_key)", "def __init__(self):\n self._keypair = RSA.generate(2048)\n self.public_key = self._keypair.publickey().exportKey(...
[ "0.71339846", "0.6748313", "0.6385755", "0.6383883", "0.63711643", "0.63697726", "0.6332745", "0.6278031", "0.6252205", "0.62220544", "0.62062967", "0.6199969", "0.6193358", "0.61794245", "0.6143205", "0.6122479", "0.61166006", "0.6099306", "0.5994502", "0.595804", "0.5955951...
0.7002548
1
Load a headmodel. read the geometry, conductivities and sources eventually.
def load_headmodel(name, prefix='data'): cond_file = op.join(prefix, name, name + '.cond') geom_file = op.join(prefix, name, name + '.geom') patches_file = op.join(prefix, name, name + '.patches') dip_file = op.join(prefix, name, name + '.dip') tdcs_file = op.join(prefix, name, name + '.hdtdcs') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self):\n self.__model = tf.keras.models.load_model(\n os.path.join(self.model_path, \"model.h5\")\n )\n print(\"[INFO] Model loaded!\")\n\n tok_pth = os.path.join(self.model_path, \"tokenizer.json\")\n with open(tok_pth, \"r\") as f:\n self.__...
[ "0.6497414", "0.64208055", "0.638878", "0.62695634", "0.62652946", "0.6117369", "0.60547155", "0.6034862", "0.6033276", "0.6026985", "0.60228074", "0.6008137", "0.5997371", "0.59949976", "0.59703386", "0.5954361", "0.5948874", "0.5944537", "0.59402436", "0.5931371", "0.592757...
0.7715285
0
Compute a Forward problem given a model with geometry and sources.
def forward_problem(m): hm = om.HeadMat(m['geometry']) hm.invert() # invert in place (no copy) dsm = om.DipSourceMat(m['geometry'], m['dipsources']) return hm * dsm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n sources = list()\n new_sources = list()\n\n # apply lds to the initial image\n x_pool = self.lds(x)\n\n # apply vgg up to conv4_3\n for k in range(22):\n x = self.features[k](x)\n conv4_3_bn = self.ibn1(x)\n x_pool1_skip, x_...
[ "0.63526386", "0.61341417", "0.60225815", "0.59443873", "0.5940945", "0.5875347", "0.5855688", "0.5813345", "0.57249606", "0.5699427", "0.5691829", "0.5668313", "0.5632994", "0.56215024", "0.5613032", "0.55930996", "0.559111", "0.5573722", "0.55649126", "0.55364203", "0.55294...
0.6507115
0
creates a proxy for the given class
def _create_class_proxy(cls, theclass): def make_method(name): def method(self, *args, **kw): if not object.__getattribute__(self, "_track_on")[0]: return getattr( object.__getattribute__(self, "_obj"), name)(*args, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_class_proxy(cls, theclass):\n \n def make_method(name):\n def method(self, *args, **kw):\n return getattr(object.__getattribute__(self, \"_obj\"), name)(*args, **kw)\n return method\n \n namespace = {}\n for name in cls._special_na...
[ "0.74995166", "0.68043464", "0.66746736", "0.66074884", "0.6450246", "0.6450246", "0.644239", "0.644239", "0.6424365", "0.6309202", "0.6299057", "0.6143022", "0.60028124", "0.59988916", "0.5965285", "0.59586173", "0.59504575", "0.5923421", "0.5914526", "0.5888929", "0.5888668...
0.7449586
1
creates an proxy instance referencing `obj`. (obj, args, kwargs) are passed to this class' __init__, so deriving classes can define an __init__ method of their own.
def __new__(cls, obj, *args, **kwargs): try: cache = cls.__dict__["_class_proxy_cache"] except KeyError: cls._class_proxy_cache = cache = {} try: theclass = cache[obj.__class__] except KeyError: cache[obj.__class__] = theclass = cls._create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(cls, obj, *args, **kwargs):\n try:\n cache = cls.__dict__[\"_class_proxy_cache\"]\n except KeyError:\n cls._class_proxy_cache = cache = {}\n try:\n theclass = cache[obj.__class__]\n except KeyError:\n cache[obj.__class__] = theclas...
[ "0.81124973", "0.76509285", "0.7615072", "0.7615072", "0.67413515", "0.6698327", "0.6490171", "0.6413535", "0.63807136", "0.6225159", "0.6205126", "0.6191848", "0.6100808", "0.6100808", "0.60938245", "0.6087132", "0.5924417", "0.59213203", "0.5883061", "0.5853467", "0.5848173...
0.81025034
1
Get the filenames corresponding to all the different mu values
def mean_filenames(filename, means): return [filename + "(mu=" + str(round(mean, 2)) + ", loc=1.0).csv" for mean in all_means]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filenames():\r\n datadir = \"./phase3_data/\"\r\n samples = os.listdir(datadir)\r\n all_files = []\r\n for i in range(len(samples)):\r\n sampfiles = []\r\n datadir = \"./phase3_data/\" + samples[i]\r\n files = os.listdir(datadir)\r\n for file in files:\r\n ...
[ "0.6712646", "0.6223864", "0.61738175", "0.6093145", "0.60859245", "0.60529107", "0.5950844", "0.5918755", "0.58327836", "0.58327836", "0.5822635", "0.58209854", "0.5809355", "0.5786707", "0.5783648", "0.57702667", "0.5742246", "0.5739868", "0.5720252", "0.5719575", "0.570484...
0.6487578
1
Create the dataframe of all the statistics for a given filename, for example for all the Levy statistics use "Levy" as the filename
def create_df(filename): column_dict = [] for fn in mean_filenames(filename, all_means): path = STAT_PATH + fn if os.path.exists(path): df = pd.read_csv(path) print(len(df.consumedFoodCount)) # print(df) # df = df[-180:] # prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_df_metrics():\n DATA_DIR = 'metrics'\n search_pattern = '*.pkl'\n filename = 'stats'\n\n iteration_results = glob.glob(os.path.join(DATA_DIR, search_pattern))\n aggregated_results = os.path.join(DATA_DIR, filename)\n\n df = load_stats_dataframe(iteration_results, aggregated_results)\n ...
[ "0.67464304", "0.67458373", "0.63676864", "0.62926716", "0.62889355", "0.62432015", "0.62411124", "0.6119994", "0.6097927", "0.6080698", "0.6067551", "0.6028105", "0.6010443", "0.5999743", "0.59316117", "0.5918771", "0.59170926", "0.5911152", "0.58809793", "0.58537763", "0.58...
0.6960381
0
get the special conditions for a given x,y on the board. returns values based on context, or a tuple of multiple contexts valid contexts are multiplier the int muliplier of said tile mod_type whether the multiplier is for the letter or the whole word bgcolor the bg color for the tile points values relevant to scoring (...
def getTileModifier(x,y,context="points"): ret = (1,None,"") # default if x == 0 or x == 14: if y == 0 or y == 7 or y == 14: ret = (3,"word",TRIP_WORD_COLOR) elif y == 3 or y == 11: ret = (2,"ltr",DOUB_LTR_COLOR) elif x == 1 or x == 13: if y == 1 or y == 13:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGameState(self):\n row1 = [0, 0, 0]\n row2 = [0, 0, 0]\n row3 = [0, 0, 0]\n tilePosStatement = Statement()\n posTerm1 = Term('?x')\n posTerm2 = Term('?y')\n posTerm3 = Term('?tile')\n tilePosStatement.terms = (posTerm1, posTerm2, posTerm3)\n til...
[ "0.53613746", "0.51822996", "0.51312876", "0.5097705", "0.50885594", "0.50869316", "0.4989999", "0.49350446", "0.49140304", "0.49015668", "0.47930938", "0.47618896", "0.47190344", "0.47127545", "0.46902323", "0.46751982", "0.46719325", "0.46577978", "0.46197823", "0.46173385", ...
0.6842048
0
for each x,y you place, spider horiz + vertically to find all the words. Word scores are calculated tile by tile. returns (score,placed_tiles) for the move or False,False for failure
def checkWords(x,y,across_or_down,word,first_move): print "checking all crosswords..." tile_coords=list() # tiles in the word you placed (includes tiles you're connecting to) placed_tile_coords=list() # tiles you personally placed (excludes tiles you're connecting to) x2 = x y2 = y word_size = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_word(self):\n new_tiles = {}\n placed_tiles_computer = []\n\n # from the rack, get the word to be played, and add the score\n computer_rack = self.rack\n self.board.generate_moves(computer_rack)\n # tiles that make up the word in the board\n word_tiles = se...
[ "0.632966", "0.62599075", "0.62542665", "0.61993295", "0.6190933", "0.6091917", "0.60526085", "0.6044552", "0.6018634", "0.5890883", "0.5811492", "0.58039117", "0.5795048", "0.57586914", "0.57189506", "0.5687535", "0.5678156", "0.5638673", "0.5599674", "0.5583667", "0.5525906...
0.7477762
0
Function to calculate the LL for an array of fluxes in a given energy bin
def calc_flux_array(self): # First determine the associated spectrum self.compute_template_spectrum() # Calculate baseline counts to normalise fluxes we scan over # Go from 10**(bin_min)*mean up to 10**(bin_max)*mean in nbins steps b = self.setup_b_instance(0,add_ps_mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_lims(self, day):\n lmda, flux = self.data[day]\n ind_min = np.argpartition(flux, 3)[:3]\n mean_min = np.mean(flux[ind_min])\n lmda_min = float(lmda[np.where(flux == np.amin(flux))])\n return [mean_min, 0.4 + 0.6*mean_min, 0.001, 0.05, lmda_min - 0.02, lmda_min + 0.02]", "def compute_llfr(...
[ "0.6446283", "0.6150002", "0.60571516", "0.59681475", "0.5960083", "0.59101176", "0.58506566", "0.5835133", "0.57849824", "0.5698113", "0.5681642", "0.5586205", "0.5581096", "0.5571262", "0.55535036", "0.5538423", "0.5537508", "0.55365354", "0.55365354", "0.5528996", "0.55288...
0.6197937
1
Function that is called whenever the AI is supposed to make a move. Requires the board as a parameter. The board is a copy of the board dict used by the tictactoe game board. Also requires the player's mark as a parameter. This is 'o' by default.
def move(self, board, player_mark='o'): # First things first, let's check if the board is full first before we # make a move full = 1 for location in board.keys(): if board[location] == '-': full = 0 if not full: # Storm Spirit is a dumb y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_move(self, board):\n pass", "def move(self, board):\n raise NotImplementedError", "def do_move(self, board):\n raise NotImplementedError(\"do_move method not implemented for Player: {}\".format(self))", "def make_move(self, board: Block) -> int:\n raise NotImplementedE...
[ "0.7398969", "0.717974", "0.7096175", "0.7025511", "0.6846444", "0.68410504", "0.6791851", "0.67604375", "0.67156684", "0.67131007", "0.67055535", "0.6701758", "0.6698193", "0.6682788", "0.66431797", "0.65866613", "0.65660536", "0.6501024", "0.649859", "0.6494082", "0.6484072...
0.7213819
1
Calculate series resistance from a jV list
def find_rs(v, j): v_s, j_s = np.sort([v, j], axis=1) m = np.polyfit(v_s[-10:], j_s[-10:], 1) return 1/abs(m[0]) * 1000 #[Ohm cm^2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_s11(rs):\n freq = []\n resist = []\n react = []\n\n for f in rs:\n fs = f.split(\" \")\n fs = list(filter(None, fs))\n freq.append(float(fs[0]))\n resist.append(float(fs[5]))\n react.append(float(fs[6]))\n\n #print('freq',freq,'resist',resist,'react',react...
[ "0.57512945", "0.55763984", "0.5393082", "0.53737885", "0.53721565", "0.5360579", "0.5360513", "0.53144544", "0.5287248", "0.52655554", "0.523811", "0.52313983", "0.5228463", "0.52057403", "0.51803756", "0.5156343", "0.5149992", "0.5149992", "0.5138027", "0.5129928", "0.51286...
0.5693607
1
Calculate shant resistance from a jV list
def find_rsh(v, j): zp = sp.where(v[:-1] * v[1:] <= 0)[0][0] #make a list of A[x] * A[x -1] without usinf "for" loop in original python. m = np.polyfit(v[(zp - 5):(zp + 5)], j[(zp -5):(zp + 5)], 1) return 1/abs(m[0]) * 1000 #[Ohm cm^2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateR(sapienses: list) -> float:\n r = 0\n for i in sapienses:\n r = r + i.numberInfected\n r=r/I0\n r = r*S/(S+R+D)\n return r", "def get_total_fuel_requirements_part2(mass_lst: List[int]) -> int:\n total_fuel = 0\n for mass in mass_lst:\n while True:\n if ...
[ "0.5403019", "0.5291932", "0.5259825", "0.52283496", "0.5211883", "0.51628804", "0.51541704", "0.5146375", "0.5139574", "0.5136119", "0.513204", "0.5131023", "0.511907", "0.5116268", "0.5108971", "0.51066464", "0.510313", "0.5085152", "0.5072366", "0.5072023", "0.5070843", ...
0.61245406
0
If this instruction is selected or not.
def selected(self): return self.infodock.is_instruction_selected(self.addr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_selected(self) -> bool:\n return self.proto.is_selected", "def is_selected(self) -> bool:\r\n return self.selected", "def is_selected(self):\n return self.container['is_selected']", "def is_in_cmd(self):\r\n return self.select_cmd is not None", "def IsSelected(self):\r\n\...
[ "0.73396176", "0.7214151", "0.72019464", "0.71467733", "0.7037371", "0.7018988", "0.7018988", "0.68195313", "0.6804341", "0.67748004", "0.6731266", "0.66472644", "0.6607464", "0.65271384", "0.65178984", "0.6441089", "0.64344895", "0.6430764", "0.6391337", "0.637323", "0.63291...
0.8597773
0
Lookup all valid routes for an address
def lookup_routes(self, daddr): outroutes = [] for entry in self.routes: # split netmask and daddr by the IP dots netmask_split = entry[NMSK].split('.') daddr_split = daddr.split('.') # bitwise ANd the netmask with the daddr result = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_addresses(self, root=None):", "def lookup_routes(self, daddr):\n outroutes = []\n for entry in self.routes:\n for varat in entry[\"varats\"]:\n ip = varat[\"network\"].split(\".\")\n netmask = varat[\"netmask\"].split(\".\")\n\n mask_...
[ "0.6619424", "0.61736727", "0.609861", "0.59860164", "0.5949275", "0.5928671", "0.5904322", "0.58720094", "0.5834335", "0.58248335", "0.58065253", "0.577405", "0.57536596", "0.5716622", "0.56800824", "0.56762975", "0.5647484", "0.56378794", "0.5623062", "0.5596893", "0.558408...
0.6262349
1
select the route with the highest localPref
def get_highest_preference(self, routes): # filter out any routes that don't have the highest localPref outroutes = routes.copy() outroutes.sort(reverse=True, key=lambda r: r[MESG][LPRF]) highest = outroutes[0][MESG][LPRF] outroutes = list(filter(lambda r: r[MESG][LPRF] == highes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_highest_preference(self, routes):\n if len(routes) == 1: \n return routes\n if len(routes) == 0: \n return []\n prefList = []\n for val in routes: \n prefList.append(val[\"msg\"][\"localpref\"]) \n highestVal = max(prefList) \n outr...
[ "0.7739929", "0.76304084", "0.759504", "0.6923462", "0.62135226", "0.59675246", "0.59384817", "0.59176296", "0.5840786", "0.5819175", "0.5819175", "0.56594867", "0.55900145", "0.5547393", "0.5547266", "0.5503074", "0.54446244", "0.53964007", "0.5369732", "0.53554595", "0.5287...
0.77910876
0
There should be at least an active document.
def IsActive(self): return not FreeCAD.ActiveDocument is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_document(self):\n pass", "def startDocument(self):\n pass", "def startDocument(self):\n pass", "def current_document(self):\n return self.current_buffer.document", "def has_doc() -> None:", "def document_exists(self, docid):\n raise NotImplementedError", "def...
[ "0.65061957", "0.6093264", "0.6093264", "0.6007754", "0.5975979", "0.5963389", "0.59061444", "0.58995444", "0.579283", "0.57361865", "0.5707996", "0.5682608", "0.5675246", "0.5667107", "0.5646221", "0.5572093", "0.55599684", "0.5558164", "0.5511485", "0.549962", "0.549701", ...
0.6904055
1
Uses 'func_name' graph generator of NetworkX library to create a NetworkX graph which can be used as topology.
def get_networkx_func (func_name, seed=0, **kwargs): nx_func = getattr(importlib.import_module("networkx"), func_name) generated_graph = nx_func(seed=seed, **kwargs) return generated_graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_graph_func(name):\n if name == \"chain\":\n f = generate_chain\n elif name == \"bidiag\":\n f = generate_bidiag\n elif name == \"collider\":\n f = generate_collider\n elif name == \"jungle\":\n f = generate_jungle\n elif name == \"full\":\n f = generate_ful...
[ "0.71898025", "0.65309864", "0.6433408", "0.6324329", "0.6269729", "0.6199446", "0.6140116", "0.60027516", "0.58967483", "0.58881515", "0.5823595", "0.5820199", "0.5809142", "0.58074343", "0.579847", "0.579281", "0.5770418", "0.57583", "0.5748758", "0.57378566", "0.5734552", ...
0.7829313
0
test clickerstate class in the program
def test_class(ClickerState): #create the test suite suite = poc_simpletest.TestSuite() # create game (current initial state) state1 = ClickerState() # we initialize the game and then do nothing state2 = ClickerState() # ... we will somethings to rest of the games .. work out expected state...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self):\r\n pass", "def _get_click_state(self, event):\n raise NotImplementedError", "def take_action(self, state):", "def test_class_started(self, cls):", "def test_gameHandleEvents(self):\n # this kinda gonna be reiterating the other tests??\n # the tests of all the i...
[ "0.674187", "0.6613401", "0.62807655", "0.6226961", "0.61802983", "0.61757636", "0.61757636", "0.61757636", "0.6106897", "0.60738784", "0.60738784", "0.60738784", "0.60738784", "0.60738784", "0.6005138", "0.5963129", "0.59450465", "0.59245735", "0.59171283", "0.5907409", "0.5...
0.6928895
0