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
generateHead(self, string) Manipulate the head model to display only the appropriate head
def generateHead(self, headType): # load the multi-head models filePrefix, phase = ModelDict[self.style.body] headModel = loader.loadModel("phase_" + str(phase) + filePrefix + "heads") # search for the appropriate parts headReferences = headModel.findAllMatches("**/" + headType)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_head_line():\n with open(args.out_folder.strip() + \"/files/head_line.txt\", \"a\") as headLine:\n headLine.write(\"#Query ID\\t#Subject\\t#Subject accession\\t#Subject Taxonomy ID\\t#Identity percentage\\t#Coverage\\t#evalue\\t#bitscore\\n\")", "def to_head(self, tag):\n\t\tself.head += tag +...
[ "0.64719725", "0.6360893", "0.63512415", "0.632938", "0.6275035", "0.62248075", "0.6190631", "0.6190104", "0.61498946", "0.59738225", "0.58766633", "0.58433664", "0.58183014", "0.5812411", "0.5783073", "0.57402706", "0.5715511", "0.57105935", "0.56942123", "0.5690859", "0.565...
0.74138296
0
Return the lose geometry and anim for this type of suit as an actor. If we are a skelecog, get that lose actor instead
def getLoseActor(self): if (self.loseActor == None): if not self.isSkeleton: # standard cog filePrefix, phase = TutorialModelDict[self.style.body] loseModel = "phase_" + str(phase) + filePrefix + "lose-mod" loseAnim = "phase_" + str(pha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_lose_game(self):\r\n if self.sad_not_angry:\r\n # Play sad animation\r\n lose_game_anim = ['anim_speedtap_losegame_intensity02_01',\r\n 'anim_fistbump_fail_01',\r\n 'anim_keepaway_losegame_02',\r\n ...
[ "0.54676956", "0.53220683", "0.5269778", "0.51099867", "0.50890464", "0.50691926", "0.50388813", "0.50241894", "0.501541", "0.49059287", "0.48869288", "0.48586565", "0.4838097", "0.48135942", "0.4784663", "0.4774167", "0.47410873", "0.47396883", "0.4733521", "0.473349", "0.47...
0.7196927
0
Convert to skeleton geometry.
def makeSkeleton(self): model = "phase_5/models/char/cog" + string.upper(self.style.body) + "_robot-zero" anims = self.generateAnimDict() # remember the current anim anim = self.getCurrentAnim() # grab the drop shadow dropShadow = self.dropShadow if not dropShad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatrixFromSkeletonToGeometry(self):\n return _osgAnimation.RigGeometry_getMatrixFromSkeletonToGeometry(self)", "def getSkeleton(self, *args):\n return _osgAnimation.RigGeometry_getSkeleton(self, *args)", "def skeleton(self) -> Skeleton:\n return self._skel", "def skeletonize(img):...
[ "0.66187555", "0.6501982", "0.63278997", "0.6049249", "0.60329795", "0.6029426", "0.60022354", "0.5976643", "0.58982885", "0.57798266", "0.5777211", "0.5632916", "0.5576084", "0.5563969", "0.5466039", "0.5460111", "0.54598635", "0.54351515", "0.5399112", "0.5365841", "0.53484...
0.6612617
1
Return the list of stored head parts
def getHeadParts(self): return self.headParts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_heads(self):\n return self.heads[1:]", "def heads(self) -> \"IterableList[Head]\":\n return Head.list_items(self)", "def HeadList(self):\n return [(rname, repo.currenthead) for rname, repo in self.repos.items()\n ]", "def GetListHead(self, *args, **kwargs):\n ...
[ "0.6786356", "0.66833276", "0.6616283", "0.6586515", "0.6430233", "0.63228154", "0.61390525", "0.60039276", "0.5972115", "0.5960231", "0.5932745", "0.5804271", "0.5799714", "0.5782085", "0.57007647", "0.57007647", "0.5689736", "0.5678198", "0.56236684", "0.5621341", "0.561876...
0.8104717
0
Return the CharacterJoint that animates the nametag, in a list.
def getNametagJoints(self): # Not sure what the name is right now. return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_target(self, name):\n target_name = []\n \n for x in [\"FFJ0\", \"FFJ3\", \"FFJ4\",\n \"MFJ0\", \"MFJ3\", \"MFJ4\",\n \"RFJ0\", \"RFJ3\", \"RFJ4\",\n \"LFJ0\", \"LFJ3\", \"LFJ4\", \"LFJ5\",\n \"THJ1\", \"THJ2\", \"THJ3\"...
[ "0.59743893", "0.5930432", "0.58677804", "0.5650536", "0.5500604", "0.5330184", "0.5309172", "0.53077173", "0.530149", "0.52530533", "0.5222782", "0.5140664", "0.5057395", "0.5050352", "0.50074464", "0.49943414", "0.49824607", "0.49422643", "0.49274924", "0.49193978", "0.4918...
0.6503923
0
This method returns the object of the login gateways specified in its argument parameter. This allows for dynamically creating objects of the login gateways as required by the user.
def getLogin(login): if login == 'google': return GoogleLogin() elif login == 'facebook': return FacebookLogin() elif login == 'email': return EmailLogin() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n gateways: List['Gateway']) -> None:\n self.gateways = gateways", "def load_gateways_config(self):\n raise NotImplementedError", "def get(self, request, format=None):\n site_owner = SiteOwner.objects.get(user=self.request.user)\n gateways = Gatewa...
[ "0.544674", "0.49352095", "0.49297822", "0.48741433", "0.48399392", "0.48309493", "0.4809394", "0.4805012", "0.48027733", "0.47458386", "0.47195044", "0.47068235", "0.4704231", "0.4688566", "0.46744692", "0.46522626", "0.46355715", "0.46334955", "0.46227238", "0.46178645", "0...
0.5016447
1
Function that does all of the calculation work independentBaseName path to the base filename of independent time series (no .csv or _01.csv at end) dependentBaseName path to the base filename of dependent time series (no .csv or _01.csv at end) indepedentTSID the independent TSID to use in the IndependentTSID column of...
def main ( independentBaseName, dependentBaseName, independentTSID, dependentTSID, statisticsFile, nEquations ): # Get the logger for diagnostics and print out command line parameters (use str() in case None) logger = logging.getLogger() logger.info ( "independentBaseName='" + str(independentBaseName) + "'"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processSystematic(observable, xsecType, xsecLevel, systematic, histNominal):\n varHists = []\n linkStr = \"\"\n singlePointSystematics = [\"ERDON\", \"ERDONRETUNE\", \"GLUONMOVETUNE\", \"BFRAG_PETERSON\"]\n\n sPS = 0\n\n if any(singlePointSystematic in systematic for singlePointSystematic in sin...
[ "0.5579006", "0.5550356", "0.5533255", "0.5431447", "0.54255444", "0.5417696", "0.54156435", "0.54116017", "0.5393206", "0.53636426", "0.52947694", "0.5292077", "0.5279306", "0.5267111", "0.5243433", "0.52100587", "0.5182742", "0.5171122", "0.5142323", "0.5140549", "0.5136024...
0.70709735
0
Export policy of the qtree.
def export_policy(self): return self._export_policy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_policy_model(\n self,\n export_dir: str,\n policy_id: PolicyID = DEFAULT_POLICY_ID,\n onnx: Optional[int] = None,\n ) -> None:\n self.get_policy(policy_id).export_model(export_dir, onnx)", "def export_policy(self, path: Union[bytes, str]) -> str:\n path = _...
[ "0.6606452", "0.6307716", "0.5994737", "0.57034427", "0.5623567", "0.561144", "0.55912155", "0.55091745", "0.5396062", "0.5340916", "0.5301228", "0.5292617", "0.52867097", "0.52294195", "0.5224731", "0.52003723", "0.51978993", "0.50779176", "0.5055957", "0.49731958", "0.49609...
0.69530725
0
Name of the qtree, blank if qtree is the volume itself
def qtree(self): return self._qtree
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self) -> str:\n return self._root.name", "def get_full_name(self):\n return \"{vol} ({fs})\".format(vol=self.volume_id, fs=self.fs.get_full_name())", "def print_cr_tree(self, tree):\n str = ''\n try:\n if not tree: return \"None\"\n else:\n ...
[ "0.6125385", "0.59962", "0.5984722", "0.5951701", "0.58874846", "0.58269167", "0.5796257", "0.57856476", "0.5775699", "0.5745405", "0.57414305", "0.5692398", "0.5671608", "0.5618463", "0.5610018", "0.56034166", "0.5579191", "0.5563771", "0.55626506", "0.5556651", "0.5554422",...
0.62100613
0
If true, this qtree inherits the export policy of the parent volume.
def is_export_policy_inherited(self): return self._is_export_policy_inherited
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(self):\n return False", "def ignore_parent(self) -> bool:\n return self._strategy.ignore_parent", "def allow_volume_expansion(self) -> Optional[bool]:\n return pulumi.get(self, \"allow_volume_expansion\")", "def allow_volume_expansion(self) -> Optional[bool]:\n retu...
[ "0.58578163", "0.5827211", "0.5741612", "0.5741612", "0.5741612", "0.5741612", "0.5741612", "0.5637727", "0.55808127", "0.55249184", "0.5512349", "0.55097127", "0.5490801", "0.54336846", "0.53777486", "0.53055096", "0.52935666", "0.52821714", "0.52658117", "0.5245743", "0.521...
0.7056977
0
Security style of the qtree. Possible values are "unix", "ntfs", or "mixed".
def security_style(self): return self._security_style
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selinux_mode(self):\n if not self._selinux_mode:\n # Get the SELinux mode from the connected device\n cmd = [\"getenforce\"]\n # TODO: surround with try/except?\n tmp = subprocess.check_output(self.shell + cmd).decode()\n self._selinux_mode = tmp.st...
[ "0.5480538", "0.54163665", "0.47499296", "0.47499296", "0.466042", "0.4534007", "0.4524193", "0.45143804", "0.43981245", "0.43221653", "0.43034348", "0.42927563", "0.42829296", "0.4266972", "0.42634347", "0.42634347", "0.42618826", "0.42585206", "0.42490387", "0.42141512", "0...
0.62499326
0
The vserver in which the volume belongs
def vserver(self): return self._vserver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_vserver_device():\n\n s = commands.getoutput('/bin/mount | /bin/grep tagxid | /usr/bin/head -n 1')\n device = s.split()[0]\n\n return device", "def volume(self):\n return {'lvad': self._v}", "def volume():\n vol = sonos.volume\n return vol", "def getvg(host, disk):\r\n sshC...
[ "0.66506314", "0.64916325", "0.6411498", "0.6266587", "0.61218077", "0.6099549", "0.60773504", "0.60242987", "0.602007", "0.60180783", "0.60180783", "0.60145617", "0.596649", "0.5962195", "0.5945164", "0.5903913", "0.5903913", "0.5903913", "0.5893608", "0.5890687", "0.5890687...
0.822923
1
Name of the vfiler which owns this qtree. This value will be returned only if the request is coming to vfiler0 and MultiStore is licensed.
def owning_vfiler(self): return self._owning_vfiler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moc_vnet_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"moc_vnet_name\")", "def vnet_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vnet_name\")", "def get_name_owner(self): # real signature unknown; restored from __doc__\n return \"\"", "def ge...
[ "0.60422754", "0.58420116", "0.5792644", "0.5778097", "0.57292646", "0.5698643", "0.5697503", "0.5656808", "0.5650505", "0.5641572", "0.5641572", "0.55996424", "0.5584626", "0.55674624", "0.55426574", "0.5531291", "0.55137247", "0.54894155", "0.5482504", "0.5482504", "0.54761...
0.6453278
0
Code the category for ethnicities of interest and remove all other restaurants, assumes that ethnicities don't overlap
def categories(df): print 'going to code categories' print_time() ethnicities = ['Mexican', 'Italian', 'American'] df['num_categories'] = 0 for ethnicity in ethnicities: df.loc[df['categories'].str.contains(ethnicity, flags=re.I, na=False, case=False), 'category'] = ethnicity df.loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_categories(\n\tbusiness,\n\texclude_words=[\"Food\", \"Restaurants\"]\n\t):\n\tline = business[CATEGORIES].split(\", \")\n\tcate_list = [x for x in line if x not in exclude_words]\n\tbusiness[CATEGORIES] = cate_list", "def compressing_ethnicity(data):\n\n data.ethnicity = data.ethnicity.apply(l...
[ "0.59158164", "0.5727013", "0.5562578", "0.5428994", "0.53217006", "0.52729553", "0.5267854", "0.52309716", "0.52244425", "0.52220833", "0.51901084", "0.5169889", "0.5155573", "0.5152254", "0.51384664", "0.5136059", "0.5120735", "0.5115891", "0.5102333", "0.50799596", "0.5076...
0.59087783
1
Parse the given response dictionary from the Google Maps Geocoding API to a valid LatLng instance.
def _parse_geocode_response_dict_to_lat_lng(resp_dict: Dict) -> LatLng: # If invalid input, raise error. if not resp_dict: raise ValueError("Invalid empty input dict") # Get top-level result from results list. results = resp_dict["results"] if not results: raise ValueError("Invalid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_lat_long_dict(result: ResponseObject) -> ResponseObject:\n if 'latitude' in result and 'longitude' in result:\n result['latitude'] = try_float(result['latitude'])\n result['longitude'] = try_float(result['longitude'])\n return result", "def parse_response(response):\n # Use the...
[ "0.6620644", "0.6547382", "0.64718515", "0.6172882", "0.6111691", "0.6100443", "0.60721385", "0.60300076", "0.5942103", "0.5918893", "0.5912751", "0.59104687", "0.5844414", "0.57853353", "0.5749596", "0.5726447", "0.57004166", "0.56362206", "0.56313086", "0.5568094", "0.55432...
0.7988728
0
Given a Zeus HTML page from the database, generate a list of records.
def _generate_records(url: str, html: BeautifulSoup) -> List[Dict]: # Fetch the information table and all of its rows (exclude the header row). records = [] for tr in html.select("tr")[1:]: # Find all tabular data. This isn't a strong check, but make sure the data is how we expect it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_view_page(self):\n for row in self.driver.find_elements_by_css_selector(\"table\"):\n cells = row.find_elements_by_tag_name(\"td\")\n for cell in cells:\n yield cell.text", "def page_html(database, model):\n import json\n import pystache\n\n context ...
[ "0.64693046", "0.59985137", "0.59701353", "0.59679246", "0.5945765", "0.5907718", "0.59063315", "0.59063315", "0.59041816", "0.58850735", "0.5865348", "0.5827755", "0.56776357", "0.56758326", "0.567391", "0.5673611", "0.5650089", "0.5627115", "0.559119", "0.55715156", "0.5569...
0.6355722
1
A thread that handles the connection with the index server. It also is in charge of keeping local files registered with index server
def indexServer(): #connect to index server sock = connectToIndexServer() if not isinstance(sock, socket.socket): print("- Peer Server: Gave up trying to connect to index server. Peer server shutting down.") return 0 print("* Peer Server: Connected to index server") #TODO: make this event driven while 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serve(self):\n\t\timport thread\n\t\tthread.start_new_thread(self._server_thread, tuple())", "def server():\t\n\t# Create connection with index server\n\tprint(\"* Peer Server: connecting to index server...\")\n\tindexServerThread = Thread(target = indexServer)\n\tindexServerThread.start()\n\t\n\t# Wait for ...
[ "0.658611", "0.6523262", "0.6342626", "0.6334381", "0.60488605", "0.60314995", "0.60314995", "0.6030987", "0.60186034", "0.58910215", "0.58894604", "0.58710283", "0.58169645", "0.5799923", "0.5789703", "0.57567036", "0.57508236", "0.5742544", "0.57353836", "0.57298535", "0.57...
0.684645
0
A thread that spawns the indexServer thread and spawns the connectionHandler thread when a client connects
def server(): # Create connection with index server print("* Peer Server: connecting to index server...") indexServerThread = Thread(target = indexServer) indexServerThread.start() # Wait for connection with index server while globals.INDEX_SERVER_CONNECTION == 0: sleep(1) if globals.INDEX_SERVER_CONNECTIO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n #Starting the thread able to handle the administrator request\n t2 = threading.Thread(target=self.handleServer)\n t2.start()\n self.ActiveThreads.append(t2)\n #Listen continously\n while True:\n self.server.listen(50)\n self.Log.log...
[ "0.7177377", "0.690706", "0.6659873", "0.6625031", "0.66101474", "0.6565917", "0.6520203", "0.645728", "0.6455102", "0.644785", "0.6402171", "0.6323131", "0.6315749", "0.62661165", "0.6259867", "0.62596446", "0.6255328", "0.62499624", "0.6243074", "0.6229976", "0.6228632", ...
0.7210381
0
Calculates distance in meters of the ordered list of PointGeometry objects
def _calculate_distance(self, ordered_list): total_distance = 0 previous_point = None for point in ordered_list: if previous_point is not None: angle, distance = previous_point.angleAndDistanceTo(point) # geodesic distance in meters total_dist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distances(self):", "def distances(self):\n self._sort_measurements()\n return self._distances", "def calculate_distances(coords: List[Tuple[float, float]]) -> List[Dict]:\n miles = 0\n od = []\n for idx in range(len(coords)):\n if idx == 0:\n continue\n dist ...
[ "0.6494005", "0.6386538", "0.6374309", "0.6341844", "0.6315808", "0.6258376", "0.625556", "0.61461216", "0.61131877", "0.60936254", "0.60859495", "0.60659534", "0.60619867", "0.6040294", "0.6039889", "0.60221064", "0.60130113", "0.5981516", "0.5918351", "0.59108555", "0.58694...
0.7413209
0
Gets the node instance at the specified port.
def get_node(port, identity: dht.Identity=None, is_bootstrap=False, ipv4:str="", ipv6:str="", config:dht.DhtConfig=None, bootstrap_node=None, logfile=None): log.debug(f"get_node called for port {port}") global nodes if port not in nodes or not nodes[port].isRunning(): n = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDevice(self, port):\n try:\n return self._interactor.devices[port]\n except:\n raise ValueError(f\"No device on port {port} found.\")", "def find_by_port(self, port):\n for client in self.clients.values():\n if client.port == port:\n ret...
[ "0.6480895", "0.64807856", "0.64419115", "0.6389078", "0.6353105", "0.6320285", "0.62026715", "0.6142472", "0.61336726", "0.61187375", "0.6112234", "0.6106796", "0.608909", "0.6064081", "0.6053327", "0.60176706", "0.6007967", "0.59670705", "0.59149075", "0.5888444", "0.587074...
0.70143604
0
Get callback for the DHT get method that appends the value found in the DHT.
def get_cb(self, value): log.debug(f"Value received from DHT get lookup of {self.key}: {value}") self.append(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_get(self, *args):\n\t\tpass", "def get():", "def get():", "def get(self, key):", "def get(self, key):", "def getvalue(self):\n ...", "def getvalue(self):\n ...", "def get(self, key):\n # Your code here \n index = self.hash_index(key) \n cur = self.data[...
[ "0.61671925", "0.6070454", "0.6070454", "0.58265644", "0.58265644", "0.57579726", "0.57579726", "0.56535196", "0.5622632", "0.55751383", "0.55737764", "0.5553371", "0.55135834", "0.5508092", "0.5495248", "0.5487533", "0.5466981", "0.5447299", "0.544697", "0.54409575", "0.5430...
0.8352442
0
Checks whether this doer has started shutting down already.
def shutting_down(self): return self._shutdown.is_set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_shutdown(self):\n return self._in_shutdown", "def running(self):\n return not self._kill_event.is_set()", "def is_fully_stopped(self) -> bool:\n\t\treturn self.is_disconnected() and self.recorder.is_stopped() and not self.__flag_auto_restart", "def is_alive(self):\n\n return no...
[ "0.74359566", "0.71504325", "0.7065761", "0.7055656", "0.6903392", "0.6894518", "0.68753225", "0.67805177", "0.67737854", "0.67309123", "0.6729409", "0.6692879", "0.6688958", "0.668652", "0.6674662", "0.6674662", "0.6674662", "0.6674662", "0.6673122", "0.66613835", "0.6659753...
0.82734495
0
Sets the shutdown threading event so that the doer no longer processes any events in the queue.
def shutdown(self): log.debug(f"Setting shutdown event for {self}.") self._shutdown.set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self):\n self.exit_event.set()", "def shutdown(self):\n self.log.info(\"Purging event queue...\")\n self.kill_all()\n self.log.info(\"done\")\n self.log.info(\"Exiting...\")\n sys.exit()", "def shutdown(self):\n if not self.stop_event.is_set():\n ...
[ "0.72391045", "0.70089924", "0.6714595", "0.6547853", "0.65276194", "0.64720523", "0.6421206", "0.6394174", "0.6315693", "0.6297013", "0.6289411", "0.6283197", "0.6277328", "0.6242885", "0.6213121", "0.6201291", "0.6167081", "0.61661804", "0.61484355", "0.6081461", "0.6045457...
0.7768967
0
Builds the 12byte prefix to use for the given endpoint and method using the current version of the requester.
def build_prefix(cls, endpoint, method, size): return f"DHT{cls.MAJOR}{cls.MINOR}{size:06x}{endpoint}{method}".encode("utf8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_endpoint_prefix(self):\n if not sanity.validate_api_hostname(self.api_host):\n error_message = \"Bad API hostname: %s\" % self.api_host\n raise CloudPassageValidation(error_message)\n prefix = \"https://\" + self.api_host + \":\" + str(self.api_port)\n return pr...
[ "0.63050556", "0.6158913", "0.60717064", "0.5928626", "0.5843781", "0.5843548", "0.5660209", "0.5655769", "0.5643485", "0.5631773", "0.56263924", "0.55881995", "0.5558511", "0.5524724", "0.55084", "0.54952514", "0.5444842", "0.54302704", "0.5415801", "0.54111236", "0.53762543...
0.77212316
0
Close and remove connection given by ca
def closeConnection(self, ca): #log.debug(f"{self.name}: closing connections for.") if ca in self.connections: del self.connections[ca] if ca in self.server.ixes: # remoter still there self.server.ixes[ca].serviceSends() # send final bytes to socket self.server....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _close_connection(self):\n if self.connection:\n self.connection.destroy()\n self.connection = None", "def close(self): \n\t\tself.connection = None", "def disconnect(conn):\n conn.close()", "def __del__(self):\n self.connection.close()\n filename = self.fnam...
[ "0.6789349", "0.67142546", "0.66773546", "0.66042525", "0.6589716", "0.6522399", "0.6502559", "0.6475342", "0.644822", "0.64139336", "0.64088446", "0.6393946", "0.6384751", "0.6373155", "0.6360653", "0.63604236", "0.63565785", "0.6347201", "0.63400936", "0.6327295", "0.631523...
0.81341285
0
New connections get Requester added to .connections
def serviceConnects(self): #log.debug(f"{self.name}: servicing new connections for.") for ca, ix in list(self.server.ixes.items()): if ix.cutoff: self.closeConnection(ca) continue if ca not in self.connections: log.debug(f"Adding n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connections(self):\n return self.connections", "def get_connections(self):\n return self.connections", "def connections_incoming(self):\n return self.client.call('GET', self.name + 'connections/incoming')", "def __init__(self):\n self.connections = {}", "def get_connecti...
[ "0.68661255", "0.68661255", "0.670153", "0.66633636", "0.6640309", "0.6588803", "0.63114804", "0.6274522", "0.624432", "0.61694324", "0.6139953", "0.60623574", "0.6043001", "0.5983998", "0.5933671", "0.5904179", "0.5892802", "0.5890218", "0.58777636", "0.5850142", "0.5802936"...
0.70380867
0
Service connects and rants
def service(self): self.serviceConnects() self.serviceQueries()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():", "def test_connection(self):\n self._bind_to_service()", "def run(self):\n\t\t\n\t\tself.connect(self.config[\"server\"])", "async def connect(self):\n pass", "async def _connect(self):\n pass", "def connect(self):\n\t\tpass", "def run(self):\n self.connect()...
[ "0.69725317", "0.68797696", "0.68348384", "0.6777509", "0.6767883", "0.6728682", "0.67215234", "0.6697699", "0.6600033", "0.6585809", "0.6585809", "0.6585809", "0.6585809", "0.6585809", "0.6585809", "0.6585809", "0.6585809", "0.6561375", "0.6560055", "0.6544026", "0.6537395",...
0.7351759
0
Computes the order of h. Based on the theorem from slide 21.
def compute_order(h: list[permutation]) -> int: # If only the trivial permutation is present in the generating set, the order is 1. if len(h) == 1 and h[0].istrivial(): return 1 # Choose a non-trivial orbit alpha = -1 orbit = [0] while len(orbit) < 2: alpha += 1 orbit =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curve_order(self):\n\t\treturn self.h * self.n", "def order_computation(H: [Permutation]) -> int:\n if len(H) == 1 and H[0].istrivial():\n return 1\n alpha = find_non_trivial_orbit(H)\n if alpha is not None:\n orbit_alpha = compute_orbit(H, alpha, return_transversal=False)\n sta...
[ "0.6854845", "0.6411603", "0.64094514", "0.63554573", "0.63416445", "0.6254596", "0.62399787", "0.62281835", "0.62052834", "0.6143754", "0.60852605", "0.5994727", "0.59663904", "0.5948095", "0.5830102", "0.5803626", "0.580032", "0.5790132", "0.5788832", "0.5737693", "0.572097...
0.68271023
1
Test if f is in permutation group H.
def is_member(h: list[permutation], f: permutation) -> bool: # Choose a non-trivial orbit alpha = -1 orbit = [] while len(orbit) < 2: alpha += 1 # We can't find a non-trivial orbit, so f can't be generated by h if alpha >= f.n: return False orbit, u = Orbit(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_of(f: Permutation, H: [Permutation]) -> bool:\n # Base case: trivial permutation (or non trivial permutation in trivial generator set)\n if len(H) == 0:\n return f.istrivial()\n if f.istrivial():\n return True\n if len(H) == 1 and H[0].istrivial():\n return False\n\n ...
[ "0.76100796", "0.61889553", "0.6178871", "0.5975736", "0.5724221", "0.56370586", "0.56348825", "0.5603665", "0.5601802", "0.5594799", "0.5567784", "0.5556432", "0.5548175", "0.55079633", "0.54824793", "0.54472995", "0.5422669", "0.53929037", "0.5377486", "0.5305646", "0.53038...
0.7127394
1
Counts the number of automorphisms that are present in the graph G.
def count_automorphisms(g: Graph) -> int: def generate_mapping(g: Graph, h: Graph): """ Generates the corresponding mapping from vertex to vertex for the isomorphism between graphs g and h. We map g to h. :param g: A graph :param h: A graph :return: A permutation wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_pathologies(graph):\n return Counter(_pathology_iterator(graph))", "def count_relations(graph):\n return Counter(\n data[RELATION]\n for _, _, data in graph.edges_iter(data=True)\n )", "def count_unique_relations(graph):\n return Counter(itt.chain.from_iterable(get_edge_rela...
[ "0.690151", "0.68574446", "0.66638315", "0.6161389", "0.61542135", "0.6107411", "0.60706353", "0.60482836", "0.600044", "0.5969042", "0.59673154", "0.5964259", "0.59581065", "0.59419197", "0.5926216", "0.5883015", "0.58650196", "0.5862715", "0.58529586", "0.58438826", "0.5836...
0.73623633
0
Generates the corresponding mapping from vertex to vertex for the isomorphism between graphs g and h. We map g to h.
def generate_mapping(g: Graph, h: Graph): mapping = [0] * len(g.vertices) for v_g in g: for v_h in h: if v_g.colornum == v_h.colornum: mapping[v_g.label] = v_h.label return permutation(len(mapping), mapping=mapping)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_mapping(self):\n ...", "def generate_automorphisms(g: Graph, h: Graph, d: list[Vertex], i: list[Vertex]):\n\n # Refine the graphs g and h.\n color_refinement([g, h])\n\n # Make sure that the colors are balanced, and check for a bijection.\n if not is_balanced(g, h):\n ...
[ "0.6560867", "0.65491086", "0.615509", "0.6095281", "0.60841036", "0.599016", "0.59784293", "0.5909542", "0.5865132", "0.5783217", "0.5783217", "0.56733716", "0.56646585", "0.5663108", "0.56464386", "0.5638098", "0.5631108", "0.56097865", "0.55978906", "0.5562389", "0.554445"...
0.70033276
0
Test that tag key data is for the correct time queries.
def test_execute_tags_queries_keys_only(self): test_cases = [ {"value": "-1", "unit": "month", "resolution": "monthly"}, {"value": "-2", "unit": "month", "resolution": "monthly"}, {"value": "-10", "unit": "day", "resolution": "daily"}, {"value": "-30", "unit": "da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_time_field():", "def test_tags_listed(self):\n now_utc = datetime.now().utcnow()\n one_hour_before_utc = now_utc - timedelta(hours=1)\n two_hour_before_utc = now_utc - timedelta(hours=2)\n\n self.t(\"track {:%Y-%m-%dT%H:%M:%S}Z - {:%Y-%m-%dT%H:%M:%S}Z foo\".format(two_hour_be...
[ "0.6445884", "0.64070064", "0.640489", "0.6328197", "0.63095134", "0.6281377", "0.62581855", "0.62066656", "0.6077674", "0.607549", "0.60583717", "0.6056583", "0.60505134", "0.60436994", "0.60249656", "0.60045415", "0.5840124", "0.5837896", "0.58369875", "0.58301276", "0.5812...
0.66283107
0
Test that tag data is for the correct type queries.
def test_execute_tags_type_queries(self): with tenant_context(self.tenant): guid = AzureCostEntryLineItemDailySummary.objects.values("subscription_guid")[0].get("subscription_guid") test_cases = [ {"value": "-1", "unit": "month", "resolution": "monthly", "subscription_guid": guid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_tags_queries(self):\n test_cases = [\n {\"value\": \"-1\", \"unit\": \"month\", \"resolution\": \"monthly\"},\n {\"value\": \"-2\", \"unit\": \"month\", \"resolution\": \"monthly\"},\n {\"value\": \"-10\", \"unit\": \"day\", \"resolution\": \"daily\"},\n ...
[ "0.62527627", "0.6094172", "0.60790795", "0.60326546", "0.5968738", "0.59494305", "0.5873059", "0.5844494", "0.57995117", "0.5751226", "0.5742096", "0.5741226", "0.5713577", "0.57031804", "0.5696688", "0.5688763", "0.5650555", "0.5648719", "0.5644901", "0.562394", "0.56213903...
0.66236985
0
Use MD5 hash to hash a string, convert it to integer and shift right (128 m) places
def hashing_info(string):#KEY HASHING FUNCTION nodeInfo = string.encode('utf-8') #md5 -> 2^7 = 128 bits hash_object = hashlib.md5() hash_object.update(nodeInfo) tmp = hash_object.hexdigest() tmp = int(tmp,16) result = tmp >> (128-16) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_md5(string):\n\treturn md5(string).hexdigest()", "def smallHash(number, text):\n m = hashlib.md5()\n m.update(bytes(number))\n m.update(text.encode('utf-8'))\n return int(m.hexdigest(), 16) % 1000000", "def strhash(s: str) -> int:\n h = hashlib.md5(s.encode('utf-8'))\n h = int(h.hexd...
[ "0.7314471", "0.7105739", "0.7025995", "0.6997791", "0.6976075", "0.69720477", "0.69613916", "0.692903", "0.6897427", "0.68816817", "0.68195206", "0.6805393", "0.67922616", "0.67581165", "0.6739047", "0.67295665", "0.672646", "0.6725513", "0.6717975", "0.6694709", "0.6675408"...
0.7169834
1
Make all values for keys ending with `_path` absolute to dir_.
def make_paths_absolute(dir_, cfg): for key in cfg.keys(): if key.endswith("_path"): cfg[key] = os.path.join(dir_, cfg[key]) cfg[key] = os.path.abspath(cfg[key]) if not os.path.isfile(cfg[key]): logging.error("%s does not exist.", cfg[key]) if type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixpaths(d):\n if isinstance(d, dict):\n if \"path\" in d:\n if \":\" not in d[\"path\"]:\n local_path = os.path.normpath(\n os.path.join(os.getcwd(), basedir, d[\"path\"])\n )\n d[\"location\"] = p...
[ "0.64154714", "0.6228947", "0.61328775", "0.60662955", "0.5895299", "0.5877994", "0.5838319", "0.5828647", "0.58237904", "0.571104", "0.56810504", "0.5591697", "0.55870324", "0.55865014", "0.5541987", "0.55216837", "0.55050313", "0.54903173", "0.5463654", "0.5453247", "0.5442...
0.7339599
0
Get product discount from gRPC service and return its percentage as a float value.
async def get_discount_percentage(product_id: int) -> float: try: async with grpc.aio.insecure_channel(GRPC_SERVER_ADDRESS) as channel: stub = discount_pb2_grpc.DiscountStub(channel) response = await stub.GetDiscount(discount_pb2.GetDiscountRequest(productID=product_id)) except (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_discount(self, price):\r\n pass", "def _get_discount(self):\n\n # For every 2 PENS, one free discount\n number_of_pens = len([x for x in self._products if x.code == 'PEN'])\n discount = 5.0 * int(number_of_pens / 2)\n\n # If there are more than 3 T-Shirts in the basket,...
[ "0.7436767", "0.65825903", "0.64647365", "0.62588793", "0.6246955", "0.6212255", "0.6167191", "0.61502033", "0.61327875", "0.61239094", "0.6101408", "0.60226357", "0.5994564", "0.5963087", "0.588797", "0.5883409", "0.58702344", "0.5855152", "0.582629", "0.579285", "0.5787251"...
0.8386098
0
Add saved queries from a Wizard CSV file.
def cmd(ctx, url, key, secret, input_file, abort, overwrite, export_format, **kwargs): content = ctx.obj.read_stream(stream=input_file) client = ctx.obj.start_client(url=url, key=key, secret=secret) p_grp = ctx.parent.parent.command.name apiobj = getattr(client, p_grp) with ctx.obj.exc_wrap(wraperr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_source_data():\n\n file = csv_file('exercise.csv')\n add_to_csv_file = generate_csv.BuildCsvFile(100000, file)\n add_to_csv_file.add_rows()", "def load_exam(options):\n try:\n csvFile = open(options.get('o'), 'rb')\n except IOError as (errno,strerror):\n print \"I/O error(...
[ "0.5974857", "0.59002006", "0.572498", "0.56366324", "0.56177604", "0.5616823", "0.55892736", "0.5519377", "0.551547", "0.550626", "0.549435", "0.5488089", "0.5483214", "0.548199", "0.5481371", "0.5471626", "0.5465154", "0.54629153", "0.5461911", "0.5455203", "0.5451006", "...
0.68236613
0
Convert tensor to UINT16 Type while keeping maximum information.
def rescale_to_uint16(arr): UINT16MAX = 65535 if isinstance(arr, np.ndarray): arr = np.maximum(arr, 0.0) arr = arr / np.max(arr) * UINT16MAX arr = np.minimum(arr, UINT16MAX) return arr.astype(np.uint32) else: import tensorflow as tf if isinstance(arr, tf.Tenso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_uint(tensor_0to1, target_type='uint8'):\n if isinstance(tensor_0to1, tf.Tensor):\n target_type = tf.as_dtype(target_type)\n tensor_0to1 = _clip_0to1_warn(tensor_0to1)\n tensor_uint = tf.cast(tensor_0to1 * target_type.max, target_type)\n else:\n tensor_0to1 = _clip_0to1_warn...
[ "0.66775984", "0.6609298", "0.6499081", "0.6348919", "0.6281094", "0.6213134", "0.62126976", "0.6174528", "0.5854359", "0.5847997", "0.58083826", "0.5777523", "0.5680306", "0.5671108", "0.5662426", "0.5593559", "0.5547038", "0.5537718", "0.55163264", "0.5483579", "0.5455986",...
0.7397602
0
Show list of movies
def movie_list(): movies = Movie.query.order_by("title asc").all() return render_template("/movie_list.html", movies=movies)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_movie():\n if not MOVIES:\n print('No stored movies yet')\n\n for movie in MOVIES:\n print(f\"{movie['name']} ({movie['year']}) - Director by '{movie['director']}'\")", "def movie_list():\n\n movies = Movie.query.order_by(Movie.title).all()\n\n return render_template(\"movie_li...
[ "0.79822236", "0.7882479", "0.78669477", "0.77664715", "0.75974846", "0.7500889", "0.726088", "0.70620406", "0.69666016", "0.69163746", "0.6870314", "0.6853708", "0.68492967", "0.68129337", "0.6783774", "0.6757762", "0.6730068", "0.67046666", "0.66845554", "0.6661162", "0.663...
0.78980786
1
Returns the original steering vector, averaged steering vector (used in Selest) and a range of avged angles
def get_steering_vector(): # Distance between elements in wavelengths players_distances = [i * ant_dist for i in range(n_antennas)] # Angle function (steering vector) ang_fun = np.empty(shape=(len(all_angles), n_antennas), dtype="complex128") for th in all_angles: ang_fun[th] = [cmath.exp(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getavgvel(self):\n if self.total_time:\n return (6.28)/(self.total_time)", "def offsetToSteeringAngle(value):\n steering = (value / 14) #+ (80 * (1/radius))\n return steering", "def align(self, boids, avg_vector, total):\r\n steering = Vector(*np.zeros(2))\r\n \r\n ...
[ "0.6187274", "0.6088162", "0.6051997", "0.60257655", "0.59644896", "0.5842338", "0.5822197", "0.56880915", "0.5661798", "0.5612146", "0.55692726", "0.55671436", "0.55634946", "0.5521105", "0.5456674", "0.54495305", "0.5396217", "0.53884566", "0.53611004", "0.53599817", "0.535...
0.726561
0
Get vector embedding from PIL image
def get_vec(self, img, tensor=False): image = ( self.normalize(self.to_tensor(self.scaler(img))) .unsqueeze(0) .to(self.device) ) if self.model_name == "alexnet": my_embedding = torch.zeros(1, self.layer_output_size) else: my_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedding(self, images):\n predict = self.model.predict(images)\n return predict", "def calculate_embeddings_from_buffer(_img, _network, verbose=False):\n \n img_buff = Image.open(BytesIO(_img))\n img = _reshape_image(np.array(img_buff))\n descs = calculate_embedding(img, _network, verbose=...
[ "0.6413991", "0.61060756", "0.6099171", "0.606061", "0.59990877", "0.5951202", "0.5851849", "0.58397907", "0.583353", "0.5806154", "0.57788014", "0.57684803", "0.57008797", "0.56777346", "0.5673153", "0.5662666", "0.5657409", "0.5652743", "0.56522775", "0.5651838", "0.5650254...
0.6804416
0
Internal method for getting layer from model
def _get_model_and_layer(self, model_name, layer, model_path): if model_name == "resnet-18": model = models.resnet18() model.load_state_dict(torch.load(model_path)) if layer == "default": layer = model._modules.get("avgpool") self.layer_output_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_layers(self) :\n \n return self._layers", "def get_layer(model, layer_name=None, layer_idx=None):\n\n _validate_args(layer_name, layer_idx, layer=None)\n if layer_idx is not None:\n return model.layers[layer_idx]\n\n layer = [layer for layer in model.layers if layer_name in...
[ "0.7012858", "0.67027503", "0.66968244", "0.6680103", "0.66642064", "0.66558564", "0.66346604", "0.6583788", "0.6583224", "0.65142715", "0.64148736", "0.63179916", "0.6306704", "0.62477165", "0.6193528", "0.61811453", "0.6172382", "0.61646074", "0.6153398", "0.6145659", "0.61...
0.67539865
1
Rotates the owner of this script to the given orientation. 'smoothness' defines the speed of this rotation
def applyrotate(destOr, owner): smoothness = 10 currOr = owner.worldOrientation dZ = [0.0,0.0,0.0] dZ = currOr.to_euler()[2] - destOr.to_euler()[2] # Blender allows multiples of 360 deg and negative angles # this is to get rid of those while(dZ < math.pi): dZ = dZ + 2 * math.pi ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_handler(scene):\n cube_winkel_x = degrees(bpy.data.objects['Cube'].rotation_euler.x)\n cube_winkel_y = degrees(bpy.data.objects['Cube'].rotation_euler.y)\n\n\n # Aktionen auf den servos:\n cube_servo.turnAngle(cube_winkel_x)\n kiefer_servo.turnAngle(cube_winkel_y)", "def rotate_front_wheel(...
[ "0.48910168", "0.46914846", "0.46295315", "0.46227425", "0.46047026", "0.46038526", "0.45445675", "0.4485687", "0.4463704", "0.44477153", "0.4424426", "0.43828174", "0.43821886", "0.43738618", "0.42961872", "0.42959374", "0.4294421", "0.4287113", "0.42783332", "0.42769933", "...
0.5941977
0
Set the Character health.
def set_health(self, health): self._health = health
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_health(self, health):\n self.__health = health", "def set_health(self, new_health):\n if new_health < 0:\n \"\"\"Health points can't be below zero.\"\"\"\n self.health = 0\n elif new_health > 100:\n \"\"\"Health points can't be above 100.\"\"\"\n ...
[ "0.789892", "0.7333357", "0.72957206", "0.72957206", "0.72957206", "0.72957206", "0.7255329", "0.6831179", "0.67846185", "0.66702676", "0.6634106", "0.62850183", "0.6255009", "0.6127105", "0.6123139", "0.6119259", "0.60680616", "0.5981798", "0.59084386", "0.5892141", "0.58903...
0.7844682
1
Takes incoming damage, the Character will attempt to dodge. If dodge fails damage will be deducted from Characters health.
def take_damage(self, damage): if random.random() < self.chance_dodge: self.set_health(self.health - damage) return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_damage(self, dmg, dtype = 1):\n self.game.hit_sound.play()\n \n #DR% = 1 - (100 / x). \n damageMultiplier = 100.0 / float(self.defense)\n #Apply defense buffs/debuffs\n #calculate damage:\n dmg -= self.absorbtion\n dmg *= damageMultiplier\n #a...
[ "0.74690056", "0.74480104", "0.7417468", "0.72840244", "0.72612655", "0.7230523", "0.715311", "0.71502596", "0.71282196", "0.70429003", "0.70007324", "0.6945395", "0.6921077", "0.69088584", "0.6837291", "0.6790631", "0.677335", "0.673811", "0.6714783", "0.67013556", "0.667640...
0.7771166
0
Initialize a Battle Simulator object with the given two characters.
def __init__(self, character_1, character_2): self.character_1 = character_1 self.character_2 = character_2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n character1 = generate_random_character(\"Dr. Bones\", 100, 60, 15, 5)\n character2 = generate_random_character(\"Mr. Meeseeks\", 100, 60,\n 15, 5)\n battle = BattleSimulator(character1, character2)\n battle.simulate()", "def __init__(self, playe...
[ "0.6387656", "0.61199796", "0.5862212", "0.56728464", "0.5633514", "0.5492498", "0.54009104", "0.53709", "0.5341678", "0.5341678", "0.532014", "0.5287973", "0.52810705", "0.527881", "0.5228554", "0.5223448", "0.5220337", "0.521714", "0.5204622", "0.5186126", "0.51500547", "...
0.6858176
0
The attacker takes a turn attempting to damage the taker.
def turn(self, attacker, taker): # checks if the attacker hits a critical damage = attacker.attack() if damage != attacker.strength: print(f'BIG HIT! critical {damage} damage!') print(f'{attacker.name} hits ' f' {damage} hp!') # checks if the taker dodge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __attack(self, target):\n attack_difference = (Warrior.attack(self, target))\n if attack_difference > 5:\n print(\"Second attack with ANGRY!\")\n Warrior.attack(self, target)\n return None", "def attack(self, victim):\n assert victim.is_alive, \"Cannot at...
[ "0.717022", "0.7068104", "0.70355266", "0.677507", "0.67634165", "0.67500985", "0.6742254", "0.66983294", "0.6636185", "0.6600515", "0.6599457", "0.65896595", "0.657607", "0.65546644", "0.65473366", "0.65139806", "0.6477301", "0.6473522", "0.63951045", "0.63910174", "0.637058...
0.8256469
0
Uses random module to set all the character stats and returns a Character object.
def generate_random_character(name, max_health, min_health, max_strength, min_strength): return Character(random.randint(min_strength, max_strength), random.randint(min_health, max_health), name, random.random(), random.random())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getRandChar(self):\n return self.letterbag[random.randint(0,25)]", "def __init__(self, _gameBeingPlayed, _charcter):\n self.name = \"random\"\n random.seed(2)\n self.game = _gameBeingPlayed\n self.character = _charcter\n self.neutralCharacter = self.game.neutralCharact...
[ "0.6978008", "0.6883214", "0.68403435", "0.66532755", "0.6509252", "0.6502714", "0.6381731", "0.62692136", "0.62538266", "0.62515855", "0.62462306", "0.6210672", "0.6135978", "0.60445887", "0.59788424", "0.5954294", "0.59287107", "0.59248483", "0.59083915", "0.58917", "0.5877...
0.72781706
0
Creates two characters and simulates a battle.
def main(): character1 = generate_random_character("Dr. Bones", 100, 60, 15, 5) character2 = generate_random_character("Mr. Meeseeks", 100, 60, 15, 5) battle = BattleSimulator(character1, character2) battle.simulate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate(self):\n while self.character_1.is_alive and self.character_2.is_alive:\n # flip a coin (0,1), if 1 player 1 attacks\n if random.randint(0, 1):\n self.turn(self.character_1, self.character_2)\n else:\n self.turn(self.character_2, se...
[ "0.64023423", "0.59777254", "0.59302", "0.5925901", "0.5890908", "0.58668077", "0.5852245", "0.58479273", "0.5813672", "0.5792674", "0.57561964", "0.5755973", "0.5754133", "0.5744083", "0.57217044", "0.5706953", "0.5689126", "0.56822854", "0.5650692", "0.5647094", "0.5633036"...
0.7255468
0
Generate mid C (f = 263.63 Hz) and write to audio file.
def midC() : num_samples = 44100 duration = 1 # TODO: implement mid C # see http://en.wikipedia.org/wiki/Audio_frequency for reference # audio.writeAudioData( './data/mid-c.wav', data, num_samples)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_wave_file(predicted_mfccs, filename):\n global eng\n predicted_mfccs_transposed = np.transpose(predicted_mfccs)\n\n\n # MFCC features need to be a numpy array of shape (num_coefficients x num_frames) in order to be passed to the invmelfcc function\n inverted_wav_data = eng.invmelfcc(matlab.d...
[ "0.6426796", "0.6245491", "0.62314326", "0.61096454", "0.5965968", "0.5930262", "0.5822757", "0.57759655", "0.5744912", "0.5723107", "0.5649711", "0.5647315", "0.56424993", "0.56261826", "0.55845094", "0.55624056", "0.5541614", "0.5529798", "0.55260104", "0.55099183", "0.5491...
0.8263707
0
Filter high frequencies above bandlimit.
def filterHighs( adata, bandlimit = 5000) : # TODO: compute Fourier representation of data fig = plt.figure() fig.add_subplot(2, 1, 1) plt.plot( np.real(fdata)) plt.xlim( [0,adata.size]) # TODO: filter data fig.add_subplot(2, 1, 2) plt.plot( np.real(fdata)) plt.xlim( [0,adata.siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandstop_filter(data, lowcut, highcut, fs=2000, numtaps=255):\n nyq = fs / 2\n\n # design filter\n fe1 = lowcut / nyq\n fe2 = highcut / nyq\n b = firwin(numtaps, (fe1, fe2), pass_zero=True)\n\n filtered = lfilter(b, 1, data)\n\n return filtered", "def bandpassFilter (self, lowerFreq, upp...
[ "0.7199359", "0.7175768", "0.71339685", "0.67889225", "0.673993", "0.67209727", "0.6619647", "0.65900725", "0.6587383", "0.65561956", "0.6549059", "0.64809513", "0.6440774", "0.6423386", "0.64203054", "0.6385277", "0.6378907", "0.63487524", "0.63411343", "0.6315168", "0.62706...
0.7871506
0
Computes the Manhattan distance. Both rating1 and rating2 are dictionaries
def manhattan(rating1, rating2): distance = 0 commonRatings = False for key in rating1: if key in rating2: distance += abs(rating1[key] - rating2[key]) commonRatings = True if commonRatings: return distance else: return -1 #Indicates no rati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minkowski(r, rating1, rating2):\r\n distance = 0\r\n commonRatings = False \r\n for key in rating1:\r\n if key in rating2:\r\n distance += math.pow((abs(rating1[key] - rating2[key])), r)\r\n commonRatings = True\r\n if commonRatings:\r\n distance = math.pow(dista...
[ "0.7116823", "0.70087904", "0.69750917", "0.6882923", "0.68430424", "0.68425506", "0.68279904", "0.6773202", "0.6710694", "0.66925436", "0.6647773", "0.66455394", "0.6625889", "0.6561457", "0.65571684", "0.65414304", "0.6426201", "0.64207274", "0.6416179", "0.62869745", "0.62...
0.83559436
0
creates a sorted list of users based on their distance to username
def computeNearestNeighbor(r, username, users): distances = [] for user in users: if user != username: if ( r == 1 ) or ( r == 2 ): distance = minkowski(r, users[user], users[username]) distances.append((round(distance, 2), user)) if (r == 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeNearestNeighbor(username, users, distance_algorithm='euclidean'):\n distances = []\n for user in users:\n if user != username:\n if distance_algorithm == 'manhatten':\n distance = manhattan_distance(users[user], users[username])\n elif distance_algorith...
[ "0.6427462", "0.6185283", "0.61312914", "0.59490204", "0.593027", "0.56329113", "0.5624357", "0.5544659", "0.5539899", "0.55385286", "0.553215", "0.5519229", "0.5517393", "0.5455916", "0.5453331", "0.5443839", "0.5409491", "0.53955275", "0.53685987", "0.5359363", "0.5359134",...
0.64689946
0
Computes the Euclidean distance. Both rating1 and rating2 are dictionaries
def minkowski(r, rating1, rating2): distance = 0 commonRatings = False for key in rating1: if key in rating2: distance += math.pow((abs(rating1[key] - rating2[key])), r) commonRatings = True if commonRatings: distance = math.pow(distance, 1/r) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manhattan(rating1, rating2):\r\n distance = 0\r\n commonRatings = False \r\n for key in rating1:\r\n if key in rating2:\r\n distance += abs(rating1[key] - rating2[key])\r\n commonRatings = True\r\n if commonRatings:\r\n return distance\r\n else:\r\n ret...
[ "0.69476944", "0.6885822", "0.68377185", "0.67184186", "0.66731054", "0.66641164", "0.6661894", "0.663646", "0.66290784", "0.66253895", "0.6618596", "0.6575837", "0.6557362", "0.6531032", "0.652744", "0.6516943", "0.6506225", "0.65052104", "0.64964265", "0.6495006", "0.647201...
0.77546686
0
Add the specified video ids to a video list datatype in the cache (only if the cache item exists)
def add_videoids_to_video_list_cache(self, cache_bucket, cache_identifier, video_ids): try: video_list_sorted_data = G.CACHE.get(cache_bucket, cache_identifier) merge_data_type(video_list_sorted_data, self.req_datatype_video_list_byid(video_ids)) G.CACHE.add(cache_bucket, cac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_video_list_ids(self, params):\n guid = self.netflix_session.user_data.get('guid')\n cached_list = self.video_list_cache.get(guid, None)\n if cached_list is not None:\n self.kodi_helper.log(msg='Serving cached list for user: ' + guid)\n return cached_list\n ...
[ "0.6696477", "0.6281084", "0.6242967", "0.5951675", "0.59046364", "0.5862548", "0.5768312", "0.57297844", "0.5724598", "0.5630565", "0.5576765", "0.5562474", "0.5479476", "0.54772854", "0.54745656", "0.5464727", "0.5451702", "0.53523105", "0.5330939", "0.53274006", "0.5322228...
0.86714387
0
Special method used to know if a video id exists in loco continue watching list
def get_continuewatching_videoid_exists(self, video_id): list_id = self.get_loco_list_id_by_context('continueWatching') video_list = self.req_video_list(list_id).videos if video_id else [] return video_id in video_list, list_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_db_for_vid(self):\n with db.cursor() as cursor:\n if self.videoId in db.\n pass", "def search_video_id(broken_link):\n for param in broken_link:\n vid = regex_video_id(param)\n if vid:\n return vid", "def isVideoFolder():", "def if_al...
[ "0.69320494", "0.6693746", "0.6652448", "0.6606083", "0.6544475", "0.6382924", "0.6381113", "0.62165856", "0.6164044", "0.61321974", "0.60410386", "0.6014398", "0.5951464", "0.5925009", "0.5925009", "0.5925009", "0.5925009", "0.59057283", "0.58842856", "0.58842856", "0.585768...
0.7584457
0
A utility convenience function for setting up virtual shelves. Sets self.xform assuming the object is resting in the bin with its center's translational parameters (ux,uy) in the range [0,1]x[0,1] and orientation theta about the z axis. ux goes from left to right and uy goes from front to back.
def set_in_bin_xform(self,shelf_xform,ux,uy,theta): global bin_bounds bmin,bmax = bin_bounds[self.bin_name] tlocal = [bmin[0]+ux*(bmax[0]-bmin[0]),bmin[1]-self.info.bmin[2],bmax[2]+uy*(bmin[2]-bmax[2])] Rlocal = so3.from_axis_angle(([0,1,0],theta)) toShelfCoords = (so3.from_axis_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xform(*args, absolute: bool=True, boundingBox: bool=True, boundingBoxInvisible: bool=True,\n centerPivots: bool=True, centerPivotsOnComponents: bool=True, deletePriorHistory:\n bool=True, euler: bool=True, matrix: Union[List[float, float, float, float, float,\n float, float, float, f...
[ "0.5661216", "0.53041756", "0.5304109", "0.5161619", "0.5144905", "0.5127273", "0.5122199", "0.50917506", "0.50557816", "0.50557816", "0.5031801", "0.49949953", "0.49463785", "0.4945744", "0.49262434", "0.4924418", "0.48912206", "0.4887628", "0.48841026", "0.48757446", "0.481...
0.713049
0
Returns multiplication value and multiplier.
def multiply(value, multiplier): return value*multiplier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(*args):\n\n # TODO: Fill sum with the correct value, based on the\n # args provi...
[ "0.8044475", "0.8044475", "0.8044475", "0.77106375", "0.76648206", "0.76397854", "0.7573166", "0.7425303", "0.73945564", "0.7345266", "0.7345266", "0.72724026", "0.7240057", "0.723607", "0.72142124", "0.72073865", "0.7177395", "0.7170146", "0.71532416", "0.7144866", "0.713446...
0.80473083
0
Method to tell if perm_json has permission or not. This method uses ``accounts.utils.lookup_permission()`` method.
def has_permission(perm_json, perm_key): return lookup_permission(perm_json, perm_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, perm, obj=None):\n\t\treturn True", "def has_perm(self, perm, obj=None):\n return True", "def has_perm(self, perm, obj=None):\n return True", "def has_perm(self, perm, obj=None):\r\n return True", "def has_perm(self, user_obj, perm, obj):\n return None", "def ...
[ "0.750971", "0.7479541", "0.7479541", "0.74786764", "0.74440706", "0.73953116", "0.73805183", "0.7357547", "0.7295791", "0.7285715", "0.7285715", "0.72357976", "0.72357976", "0.72357976", "0.71688354", "0.7164484", "0.7106116", "0.70884234", "0.7065156", "0.70417154", "0.6920...
0.87012947
0
Method to return integer loop range from 1 to given max value.
def range_loop(max_val, step=1): return range(1, max_val+step, step)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int(self, max_=None):\n max_ = self.max_int if max_ is None else max_\n return self.rng.integers(max_).item()", "def simple_range(limit):\n i = 0\n while i < limit:\n yield i\n i += 1", "def get_number(maxValue):\r\n return random.randint(1, maxValue)", "def _max_in_b...
[ "0.6746474", "0.6648463", "0.66250944", "0.6617564", "0.6589031", "0.6541424", "0.65384704", "0.64663595", "0.6458709", "0.6409981", "0.63715553", "0.63606846", "0.63383377", "0.63201046", "0.63195086", "0.63163626", "0.63012975", "0.6297074", "0.6270238", "0.62584645", "0.62...
0.8093453
0
Returns searched posts querying with the parameter passed in
def searched_posts(parameter_to_query_with): return Post.objects.active().filter( Q(title__icontains=parameter_to_query_with) | Q(content__icontains=parameter_to_query_with) | Q(author__first_name__icontains=parameter_to_query_with) | Q(author__last_name__icontains=parameter_to_query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def search_posts(self, ctx: commands.Context, *query):\n async with ctx.typing():\n print(query)\n qstr = ' '.join(query)\n search_results = await self.get_posts_by_query(ctx, qstr)\n\n await ctx.send(\n f\"Found {search_results['total']} resu...
[ "0.7063218", "0.70440143", "0.67780423", "0.6663171", "0.6630574", "0.65667033", "0.65203893", "0.6511039", "0.6500312", "0.6473898", "0.6446503", "0.644535", "0.6396839", "0.6369789", "0.6362711", "0.63442177", "0.63212126", "0.63144004", "0.6313271", "0.6251219", "0.6237046...
0.768449
0
Takes a training data file formatted with lines like (word) (symbol) and returns a tuple of two dictionaries The first is a nested dictionary of symboltosymbol transition counts where the value of d[symbol1][symbol2] is the counts of (word) (symbol1) (word) (symbol2) The second is a dictionary of symbol counts where th...
def get_symbol_symbol_counts(training_data): symbol_symbol_counts = { 'START': {} } for symbol1 in symbols: symbol_symbol_counts[symbol1] = { 'STOP': {} } symbol_symbol_counts[symbol1]['STOP'] = 0 for symbol2 in symbols: symbol_symbol_counts['START'][symbol2] = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_counts(data):\n\n word_count = {}\n syll_count = {}\n\n infile = data.corpus\n try:\n\n open_file = codecs.open(infile, 'r', encoding='utf-16')\n for line in open_file:\n line = line.lower()\n # Remove tablet indexing info and line numbers. Grab only text dat...
[ "0.655314", "0.6167563", "0.61426705", "0.60588586", "0.59850526", "0.5951793", "0.5855894", "0.5831657", "0.5827725", "0.5777943", "0.5772046", "0.57508445", "0.57183367", "0.5715665", "0.57073605", "0.56939745", "0.5678117", "0.56768477", "0.5673838", "0.5661819", "0.565423...
0.749276
0
Returns a nested dictionary of transition probabilities where the value of d[symbol1][symbol2] is the probability of transitioning from symbol1 to symbol2
def estimate_transition_params(symbol_symbol_counts, symbol_counts): transition_probabilities = {} for symbol1 in symbol_symbol_counts: transition_probabilities[symbol1] = {} for symbol2 in symbol_symbol_counts[symbol1]: if symbol_counts[symbol1] == 0: transition_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symbolic_probabilities(symX):\n\n symX = np.array(symX)\n \n # initialize\n p = defaultdict(float)\n n = len(symX)\n\n for xi in symX:\n p[xi] += 1.0 / n\n\n return dict(p)", "def create_probability_object(self):\n self.update_frequencies(self)\n prob_dict = {}\n ...
[ "0.64267564", "0.62050647", "0.616372", "0.57693696", "0.5718339", "0.56954473", "0.5685808", "0.5654338", "0.5643974", "0.5517496", "0.55017287", "0.5498285", "0.54755217", "0.5456299", "0.5450386", "0.54260546", "0.5390678", "0.53476614", "0.53427684", "0.5315933", "0.53054...
0.7332211
0
Sets the file_format_extension of this AutodetectDocumentValidationResult.
def file_format_extension(self, file_format_extension): self._file_format_extension = file_format_extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_extension(self, file_path):\n self._file_path = os.path.abspath(file_path)\n base_name = os.path.basename(file_path)\n self._file_ext = base_name.split('.')[-1]", "def setExtension(self, ext):\n if ext:\n self._writer.extension = ext\n else:\n sel...
[ "0.6630388", "0.63224304", "0.6277101", "0.59676445", "0.5948627", "0.59357643", "0.5877695", "0.58276194", "0.5769262", "0.575383", "0.5712525", "0.5710062", "0.5694665", "0.5616698", "0.561455", "0.5571028", "0.5563968", "0.5528722", "0.5452001", "0.54375994", "0.54150176",...
0.8367381
0
Sets the document_is_valid of this AutodetectDocumentValidationResult.
def document_is_valid(self, document_is_valid): self._document_is_valid = document_is_valid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self, is_valid):\n\n self._is_valid = is_valid", "def is_valid(self, is_valid):\n\n self._is_valid = is_valid", "def SetValid(self, valid):\r\n\r\n self._valid = valid", "def SetValid(self, valid):\r\n\r\n self._valid = valid", "def setValid(self):\n self.val...
[ "0.72529376", "0.72529376", "0.6505535", "0.6505535", "0.61503106", "0.61120653", "0.58343863", "0.5804623", "0.56046987", "0.56046987", "0.56046987", "0.55310506", "0.54801023", "0.54287267", "0.54287267", "0.5332705", "0.530986", "0.519066", "0.5156576", "0.5146066", "0.513...
0.8414632
0
Sets the error_count of this AutodetectDocumentValidationResult.
def error_count(self, error_count): self._error_count = error_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count(self):\n return len(self.errors)", "def getNumErrors(self, *args):\n return _libsbml.SBMLDocument_getNumErrors(self, *args)", "def setErrorMax(self, error_max):\n\t\tself.error_max = error_max", "def getNumErrors(self):\n return _libsbml.XMLErrorLog_getNumErrors(self)", ...
[ "0.6081048", "0.5987648", "0.5690299", "0.55666184", "0.54826427", "0.5481803", "0.5442737", "0.5439933", "0.5439933", "0.5394178", "0.53693044", "0.5346391", "0.5328946", "0.5287597", "0.52519226", "0.52452815", "0.5237477", "0.52228737", "0.52036804", "0.51751804", "0.51453...
0.7866384
0
Sets the warning_count of this AutodetectDocumentValidationResult.
def warning_count(self, warning_count): self._warning_count = warning_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warnings(self, warnings):\n\n self._warnings = warnings", "def _set_insufficient_confidence_warning(\n self): # pragma: no cover\n self.failed_initial_confidence = True\n self.surface_result('LO_INIT_CONF')\n self.warnings.append(\n 'Bisect failed to reproduce the regression with...
[ "0.6541069", "0.575886", "0.5650724", "0.56226194", "0.55030966", "0.5436547", "0.542022", "0.539377", "0.5231269", "0.5219355", "0.51817024", "0.5176746", "0.5173624", "0.51708746", "0.51484257", "0.51397216", "0.5097287", "0.50648504", "0.5041526", "0.501185", "0.5007985", ...
0.8330772
1
Sets the errors_and_warnings of this AutodetectDocumentValidationResult.
def errors_and_warnings(self, errors_and_warnings): self._errors_and_warnings = errors_and_warnings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warnings(self, warnings):\n\n self._warnings = warnings", "def errors(self, errors):\n \n self._errors = errors", "def errors(self, errors):\n\n self._errors = errors", "def validation_errors(self, validation_errors):\n self._validation_errors = validation_errors", "d...
[ "0.57016236", "0.5556713", "0.54482573", "0.5281081", "0.50473565", "0.48261422", "0.48047847", "0.47144577", "0.47088128", "0.46514937", "0.45987955", "0.45123354", "0.4511961", "0.44952434", "0.4461714", "0.44197798", "0.44118357", "0.4401234", "0.43963253", "0.4389321", "0...
0.83677936
0
returns the ith element in the sequence, otherwise returns an empty string
def index(sequence, i): try: return sequence[i] except IndexError: return u""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getitem(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)", "def _silent_get(x, i):\n if i < len(x):\n return x[i]\n else:\n return ''", "def return_first(x):\r\n if x == []:\r\n return ''\r\n else:\r\n return x[0]", "def index(item, i):\...
[ "0.6512861", "0.6484922", "0.6476134", "0.634842", "0.6315457", "0.63108003", "0.6219168", "0.61819625", "0.6060573", "0.6046717", "0.60024315", "0.58221686", "0.58175415", "0.5717458", "0.57147264", "0.5701671", "0.5693254", "0.56161135", "0.5613445", "0.5589253", "0.5582843...
0.74435055
0
filter to return "a" or "an" depending on whether string starts with a vowel sound
def a_or_an(value): # TODO: handle confusing things like "an hour" or "a unicycle" vowel_sounds = ["a", "e", "i", "o", "u"] if value[0].lower() in vowel_sounds: return "an" else: return "a"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def a_or_an(s):\n if s[0].lower() in 'aeiou':\n return 'an'\n return 'a'", "def starts_with_vowel(word):\n return True if word[0] in 'aeiou' else False", "def needs_aou(word):\n return re.search(\"([aouAOU])[^yäöYÄÖ]*$\", word)", "def find_vowels(s):\n \"*** YOUR CODE HERE ***\"", "de...
[ "0.7693258", "0.70764375", "0.6781472", "0.6780587", "0.6366342", "0.6343209", "0.62742394", "0.6221182", "0.62135535", "0.62135535", "0.62135535", "0.62135535", "0.6195829", "0.6193", "0.61467654", "0.61067647", "0.60865515", "0.607362", "0.6063635", "0.60370004", "0.6035984...
0.7362387
1
gets a field from a form based on its name
def get_field_by_name(form, field_name): if field_name in form.fields: return form[field_name] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getfield(form, fieldname):\n try:\n return form[fieldname]\n except KeyError:\n return None", "def get_field(self, name):\n for field_name, field in self._all_fields.iteritems():\n if name == self._sanitize_field_name(field_name):\n return field", "def g...
[ "0.8165098", "0.7674648", "0.7453129", "0.71378535", "0.7134712", "0.7134159", "0.7003686", "0.6990682", "0.69871914", "0.6910617", "0.68932074", "0.66588813", "0.65822023", "0.653063", "0.64751256", "0.64728236", "0.6442034", "0.6441073", "0.64176893", "0.636", "0.63536894",...
0.85977507
0
gets a list of fields from a form based on their names
def get_fields_by_names(form, field_names): fields = [] for field_name in field_names.split(','): field = get_field_by_name(form, field_name) if field: fields.append(field) return fields
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields(form, args):\n bound_fields = {}\n fields = []\n for field in form:\n bound_fields.update({field.name: field})\n for field_name in args.split(','):\n if field_name in bound_fields:\n fields.append(bound_fields[field_name])\n return fields", "def getFormField...
[ "0.7999815", "0.72664", "0.7148749", "0.6959313", "0.6893017", "0.679975", "0.67761", "0.6736716", "0.67148304", "0.65763026", "0.64540225", "0.64517975", "0.64014566", "0.63794136", "0.63665617", "0.63384515", "0.6324435", "0.6305355", "0.6302783", "0.6288462", "0.6283588", ...
0.8055306
0
gets a form from a formset based on a field_name/field_value pair
def get_form_by_field(formset, field_info): field_name, field_value = field_info.split('|') return formset.get_form_by_field(field_name, field_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_forms_by_field(formset, field_info):\n field_name, field_value = field_info.split('|')\n return formset.get_forms_by_field(field_name, field_value)", "def get_formset_form(formset: forms.BaseFormSet) -> forms.BaseForm:\n return formset._construct_form(0, **formset.get_form_kwargs(0)) # type: ig...
[ "0.7815947", "0.75175416", "0.6834162", "0.6523359", "0.59458166", "0.5889114", "0.58866364", "0.5769539", "0.57635564", "0.5745508", "0.57361007", "0.56403196", "0.5615468", "0.5391065", "0.5352071", "0.53370595", "0.53060496", "0.530181", "0.5291351", "0.52863765", "0.52506...
0.8529719
0
gets a list of forms from a formset based on a field_name/field_value pair
def get_forms_by_field(formset, field_info): field_name, field_value = field_info.split('|') return formset.get_forms_by_field(field_name, field_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_by_field(formset, field_info):\n field_name, field_value = field_info.split('|')\n return formset.get_form_by_field(field_name, field_value)", "def get_formset(self, **kwargs):\n return self.formsets[kwargs.get('prefix')](\n data=self.get_form_kwargs().get('data'),\n ...
[ "0.7737669", "0.6752881", "0.67076665", "0.64571047", "0.6230185", "0.6196658", "0.6161314", "0.6159796", "0.5969113", "0.59087384", "0.5892944", "0.58924574", "0.5766631", "0.576133", "0.5720887", "0.56406283", "0.5543609", "0.5515373", "0.55145144", "0.55031633", "0.5446175...
0.86300886
0
Given a value, guess OpenGL type of the corresponding pointer
def arrayToGLType( cls, value ): typeCode = value.dtype constant = ARRAY_TO_GL_TYPE_MAPPING.get( typeCode ) if constant is None: raise TypeError( """Don't know GL type for array of type %r, known types: %s\nvalue:%s"""%( typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_shader_type(varinfo):\n if type(varinfo[\"ndim\"]) == int or type(varinfo[\"ndim\"]) == long:\n if varinfo[\"ndim\"] == 1:\n shader_type = varinfo[\"vartype\"]\n elif varinfo[\"ndim\"] >= 2:\n shader_type = \"vec%d\" % varinfo[\"ndim\"]\n if varinfo[\"vart...
[ "0.6167602", "0.60316646", "0.5989968", "0.5560937", "0.5536619", "0.55311793", "0.55199736", "0.5433396", "0.5397565", "0.5379078", "0.53078747", "0.5173235", "0.5158229", "0.5154993", "0.51379716", "0.5115392", "0.51109666", "0.50906956", "0.5085642", "0.5080972", "0.506935...
0.65130585
0
Convert given value to an array value of given typeCode
def asArray( cls, value, typeCode=None ): if value is None: return value else: return cls.contiguous( value, typeCode )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(lst, typecode ):\n a = array.array( typecode )\n for n,c in lst: \n a.extend( array.array( typecode, (c,) * n ) )\n return a", "def _convert_value(self, value, opt):\n if opt.multi:\n return [opt.type(v) for v in value]\n else:\n return opt.type(valu...
[ "0.6915386", "0.6656472", "0.62545663", "0.6250893", "0.6100669", "0.59714997", "0.5851947", "0.5816774", "0.5758541", "0.5727702", "0.57106775", "0.5698821", "0.56713414", "0.5669967", "0.56470996", "0.55854875", "0.55632836", "0.55632836", "0.5560588", "0.55511796", "0.5529...
0.72632635
0
Get contiguous array from source source numpy Python array (or compatible object) for use as the data source. If this is not a contiguous array of the given typeCode, a copy will be made, otherwise will just be returned unchanged. typeCode optional 1character typeCode specifier for the numpy.array function. All glPoint...
def contiguous( cls, source, typeCode=None ): typeCode = GL_TYPE_TO_ARRAY_MAPPING[ typeCode ] try: contiguous = source.flags.contiguous except AttributeError: if typeCode: return numpy.ascontiguousarray( source, typeCode ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asArray( cls, value, typeCode=None ):\n if value is None:\n return value\n else:\n return cls.contiguous( value, typeCode )", "def ascontiguousarray(a, dtype=None):\n\n if not use_origin_backend(a):\n # we support only c-contiguous arrays for now\...
[ "0.6297156", "0.598876", "0.558664", "0.53859824", "0.5361796", "0.53365684", "0.5330785", "0.5273351", "0.5176413", "0.51001406", "0.50730395", "0.50480163", "0.4929142", "0.48061275", "0.4792793", "0.47741932", "0.4766187", "0.47557694", "0.47384775", "0.47257698", "0.47135...
0.8131357
0
Determine dimensions of the passed array value (if possible)
def dimensions( cls, value, typeCode=None ): return value.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_dimensions(array):\n height = len(array)\n width = len(array[0])\n\n return width, height", "def dims(x):\n return len(x.shape)", "def dimensions():", "def ndims(x):\n return len(x.get_shape())", "def getDimensions():", "def get_length(array):\n return len(list(array))", "def ...
[ "0.7649418", "0.71637666", "0.70871323", "0.7074919", "0.68798935", "0.6804668", "0.67919916", "0.67855215", "0.6750123", "0.67174596", "0.67173696", "0.66905063", "0.66807723", "0.6656756", "0.6610595", "0.653876", "0.6536533", "0.65357566", "0.65027064", "0.6495497", "0.647...
0.7417408
1
Requests TGS tickets for all service users specified in the targets list
def run(self, targets, allhash = False): if not self.kcomm: self.kcomm = KerbrosComm(self.ccred, self.ksoc) self.kcomm.get_TGT() tgss = [] for target in targets: tgs, encTGSRepPart, key = self.kcomm.get_TGS(target, override_etype = [2, 3, 16, 23, 17, 18]) tgss.append(tgs) results = [] for tgs i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def tickets(ctx, user: discord.User=None):\n\n tickets_emb = discord.Embed(\n title=\"Active support tickets\",\n color=EMBED_COLOR\n )\n\n if user is not None:\n tickets_emb.description = \"All open tickets of the given user.\"\n tickets_emb.set_author(\n name...
[ "0.5683676", "0.5644438", "0.5601891", "0.55509686", "0.5544033", "0.55070466", "0.54961663", "0.53772086", "0.53739256", "0.5268215", "0.52656144", "0.51977044", "0.5175178", "0.5175177", "0.5109658", "0.508342", "0.50544757", "0.5041629", "0.50235754", "0.499371", "0.498734...
0.61777467
0
Submit a user point submission to the database. Normalize geometry and activate push notifications.
def postPoint(request, Form): form = Form(request.POST) form.data = form.data.copy() # Convert coords to valid geometry try: form.data['geom'] = normalizeGeometry(form.data['geom']) except(ValueError): # TODO provide error message to user here JsonResponse({'success': False}) # messages.error(request, '<s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_point(x, y, label=\"\"):\n\n conn = None\n cur = None\n\n try:\n # check the point is inside the usa, both point and states must be WGS84\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n #if the point is inside this will return (True,) ...
[ "0.582434", "0.5630224", "0.54836905", "0.5476629", "0.5445697", "0.5385847", "0.5339224", "0.52681226", "0.52327776", "0.5230265", "0.5210323", "0.51792794", "0.5178592", "0.51725996", "0.5165458", "0.51638865", "0.51340175", "0.50793356", "0.50738657", "0.5053701", "0.50270...
0.7058317
0
Convert text string to GEOS Geometry object and correct x y coordinates if out range (180, 180].
def normalizeGeometry(geom): # Convert string GEOSGeometry object to python dict geom = json.loads(geom) # Normalize longitude to range [-180, 180) using saw tooth function c = geom['coordinates'][0] geom['coordinates'][0] = (c+180 - ( math.floor( (c+180)/360 ) )*360) - 180 # Normalize latitude to range [-90, 9...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coordinates(text):\n m = re.search(COORD_PATTERN, text)\n if m:\n neglat = m.groups(0)[0]\n latitude = neglat + m.groups(0)[1]\n neglong = m.groups(0)[2]\n longitude = neglong + m.groups(0)[3]\n return {\n \"lat\": latitude,\n \"lon\": longitud...
[ "0.6295304", "0.59205043", "0.59065646", "0.5882725", "0.580778", "0.57845014", "0.57826614", "0.57768226", "0.57549405", "0.57005495", "0.56962836", "0.5688145", "0.56834704", "0.5645928", "0.5635205", "0.5557854", "0.5488843", "0.54714346", "0.54660076", "0.5455154", "0.545...
0.6860308
0
Output register values for fout output frequency given the phase comparator frequency fpd. fb = Counter feedback position. 0 = Divider, 1 = VCO. M = Fractional modulus. f = (N + F/M)fpd
def freq_to_regs(self, fout, fpd, m=4095, fb=1, apwr=0, rfa_en=1): #Reg4:reserved2 must be 3 self.write_value(reserved2=3) self.write_value(pdp=1) #Positive phase-detector polarity self.write_value(cpl=2) #Charge pump linearity 20% self.write_value(cp=12) #Charge pump current. Ic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frequency(self):\r\n # print '*********in get freq'\r\n self.cntr.run('FREQ 1')\r\n f_0_ = self.cntr.get_measurements(1)\r\n self.f_0 = f_0_[0]\r\n self.cntr.run('FREQ 2')\r\n f_rep_ = self.cntr.get_measurements(1)\r\n self.f_rep = f_rep_[0]", "def fourier...
[ "0.61443156", "0.6064841", "0.5909761", "0.5892132", "0.58738005", "0.57839906", "0.57296646", "0.57296646", "0.5719375", "0.5701335", "0.5665082", "0.56195724", "0.5599554", "0.5591622", "0.5545079", "0.5537364", "0.5535513", "0.55238914", "0.55118406", "0.5511494", "0.54982...
0.70740175
0
Finds register by name
def find_reg(self, reg): for key, val in self.register_def.iteritems(): if reg in val.keys(): return key, val[reg] return None, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(regname):\n global simulator\n if simulator is None:\n print \"Program is not started.\"\n return\n try:\n return simulator.get_register(regname)\n except LookupError, e:\n print e, regname\n except:\n simulation_error()", "def find_regvar(*args):\n ...
[ "0.6933427", "0.6747642", "0.67348623", "0.65624416", "0.65624416", "0.6472942", "0.64511853", "0.6315824", "0.6296914", "0.6282554", "0.626968", "0.6166201", "0.61308205", "0.59705603", "0.59289044", "0.58864653", "0.5792721", "0.57644176", "0.57376266", "0.57341653", "0.569...
0.70105267
0
Establish a connection between MetaTrader 5 and Python through local Sockets with ZeroMQ
def meta_trader_connector(): context = zmq.Context() socket = context.socket(zmq.REQ) socket.connect(SOCKET_LOCAL_HOST) return socket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_worker():\n socket = context.socket(zmq.REQ)\n socket.connect(\"tcp://localhost:5555\")\n return socket", "def __init__(self, ip='127.0.0.1', port='50020'):\n self.ip = ip \n self.port = port\n self.ctx = zmq.Context()\n self.socket = zmq.Socket(self.ctx, zmq.R...
[ "0.70945156", "0.68938726", "0.65622324", "0.6484841", "0.64102113", "0.6301028", "0.628388", "0.6244998", "0.6233575", "0.62165666", "0.62098074", "0.61786884", "0.60686046", "0.60192066", "0.6017799", "0.5978008", "0.5955814", "0.5928927", "0.5850774", "0.5832353", "0.58309...
0.7544968
0
InChIKey from an InChI string
def inchi_to_inchi_key(ich): ick = _rd_chem.inchi.InchiToInchiKey(ich) return ick
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi_to_inchi_key(ich):\n return _rd_chem.inchi.InchiToInchiKey(ich)", "def InchiToInchiKey(inchi):\n ret = rdinchi.InchiToInchiKey(inchi)\n if ret:\n return ret\n else:\n return None", "def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=Fal...
[ "0.666165", "0.66352415", "0.6082091", "0.5775076", "0.5573147", "0.5471747", "0.5346584", "0.532727", "0.5316163", "0.53143", "0.5294029", "0.5290308", "0.52418095", "0.5234684", "0.52194256", "0.520907", "0.5196768", "0.5196768", "0.5166984", "0.5166984", "0.51619345", "0...
0.6639612
1
cartesian geometry from an rdkit molecule object
def geometry(rdm): rdm = _rd_chem.AddHs(rdm) atms = rdm.GetAtoms() natms = len(rdm.GetAtoms()) if natms == 1: asb = atms[0].GetSymbol() xyz = (0., 0., 0.) geo = ((asb, xyz),) else: _rd_all_chem.EmbedMolecule(rdm) _rd_all_chem.MMFFOptimizeMolecule(rdm) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obtain_geometries(self):\n\n assert isinstance(self.ts, TS)\n\n \n symbol_dict = {\n 17: \"Cl\",\n 9: \"F\",\n 8: \"O\",\n 7: \"N\",\n 6: \"C\",\n 1: \"H\",\n }\n atoms = []\n\n parser = ccread(self...
[ "0.6070213", "0.594185", "0.5762066", "0.5756116", "0.5713775", "0.5645808", "0.56362855", "0.56317717", "0.5596153", "0.5530536", "0.5523148", "0.54844695", "0.5483196", "0.5479439", "0.54791147", "0.5466634", "0.5450663", "0.5404142", "0.53768754", "0.53687966", "0.53401303...
0.63665617
0
connection graph from an rdkit molecule object
def connectivity_graph(rdm): rdm = _rd_chem.AddHs(rdm) atms = rdm.GetAtoms() bnds = rdm.GetBonds() asbs = dict(enumerate((rda.GetSymbol(), 0, None) for rda in atms)) cnns = {frozenset([rdb.GetBeginAtomIdx(), rdb.GetEndAtomIdx()]): (1, None) for rdb in bnds} return (asbs, cnns)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_diagram(self):\n nodes = []\n edges = []\n \n for clump in self.clumps:\n new_nodes, new_edges = clump.get_diagram_representation()\n nodes.extend(new_nodes)\n edges.extend(new_edges)\n #nodes.append(backend.JunctionNode(clump))\n ...
[ "0.62231725", "0.62030447", "0.61771965", "0.6125056", "0.60695857", "0.60686374", "0.6058485", "0.6007613", "0.5991259", "0.59804547", "0.5977909", "0.59239215", "0.5887876", "0.58832186", "0.5880064", "0.5863184", "0.58405", "0.5839149", "0.58381486", "0.5834429", "0.580525...
0.6402625
0
Return an ndarray from a fluent solution text file. For loading data from Fluent solution export, which is tab delimited and has 1 header line. The columns follow a general form in which the first three columns are node number and x and y coordinates. The value of the exported variable(s) follow in the subsequent colum...
def loadfluentxy(filename=None): import numpy as np from datetime import datetime from StringIO import StringIO import Tkinter from tkFileDialog import askopenfilename import progressbar as pb if filename is None: root = Tkinter.Tk() root.withdraw() filename = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_txt_file(txtfile):\n array = np.genfromtxt(txtfile)\n return array", "def fromfile(self, path):\n\t\tdata = filetools.read_data(path)\n\t\tprint \"File read: %i lines\" % len(data)\n\t\tself.build_matrix(data)", "def read_from(self, filename):\n self.x, self.y = np.loadtxt(filename, unpa...
[ "0.6285679", "0.6158561", "0.6142524", "0.612591", "0.61055636", "0.603768", "0.6015753", "0.60145277", "0.5993927", "0.5955757", "0.5916781", "0.59138006", "0.5903531", "0.5866501", "0.58529365", "0.5842607", "0.57958204", "0.5779438", "0.57531554", "0.57524073", "0.5750796"...
0.6718223
0
Return data and time arrays from a FLIR ExaminIR output data file. Data from FLIR ExaminIR is tab delimited, and has 1 header line with variable names. The names of the data columns are contained in the data structure. Time is assumed to be in the second column and is parsed to micro second resolution. If a file name i...
def loadROIfile(filename=None): import numpy as np from datetime import datetime from StringIO import StringIO import Tkinter from tkFileDialog import askopenfilename import progressbar as pb if (filename): print "Opening %s..." %(filename) else: root = Tkinter.Tk() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readData(self):\n f = open(self.filename)\n self.time = []\n self.data = []\n for line in f:\n if line.find('BAD FLAG') > 0:\n self.badValue = float(line.split(':')[1].strip())\n if line.find('LONGITUDE') > 0:\n self.lon = line.spl...
[ "0.6588013", "0.6457938", "0.64245695", "0.6404107", "0.6374481", "0.6354253", "0.63445735", "0.6344278", "0.62786865", "0.6227277", "0.6223973", "0.61897963", "0.6104138", "0.60854423", "0.6060932", "0.59611905", "0.5952587", "0.5912109", "0.59100866", "0.58967036", "0.58769...
0.7002223
0
(data,time,names) = loadSS2500() This reads the data file produced by the operating program in the SinterStation2500. It automatically imports the data and plots the part bin surface temperature and part bin heater intensity as a function of time.
def loadSS2500(filename=None): import numpy as np from StringIO import StringIO import Tkinter from tkFileDialog import askopenfilename from matplotlib.pyplot import figure,subplot,plot,xlabel,ylabel,title,legend if (filename): print "Opening %s\n" %(filename) else: root = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LE_SimPlt(b,X,timefac,BW,smooth):\r\n\tme = \"LE_Plot.LE_SimPlt: \"\r\n\t\r\n\tprint \"\\n== \"+me+\"b =\",b,\" X =\",X,\" BW =\",BW,\"==\\n\"\r\n\t\r\n\tt0 = time.time()\r\n\t\r\n\t## Filenames\r\n\ttrafile, rndfile, pdffile, strfile, n = get_filenames(b,X,timefac,BW)\r\n\t\r\n\t## GET_TRADATA\r\n\t## Time-se...
[ "0.60067475", "0.599648", "0.5938755", "0.5753615", "0.574777", "0.57364905", "0.5733118", "0.572269", "0.5711578", "0.57094747", "0.5708316", "0.5704345", "0.57037497", "0.5651153", "0.56350607", "0.5592187", "0.55866504", "0.55642027", "0.5562277", "0.5552104", "0.5528065",...
0.74939203
0
PIDdata(time,temperature,setp) User interface tool to open file and provide inital plot of the results
def PIDdata(time,temperature,setp): from scipy import polyfit from matplotlib.pyplot import figure,subplot,plot,xlabel,ylabel,title l=len(temperature) Pdat = zeros(l) Idat = zeros(l) Ddat = zeros(l) Pdat[0] = setp-temperature[0] for i in range(1,l): epsilon = setp - temperature...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadAndPlot1DMassData(dataFile='movingPointMassData/testPointMassData000.pkl'):\n # Load the data back\n inputDataFile = open(dataFile, \"rb\")\n dataOut = pickle.load(inputDataFile)\n inputDataFile.close()\n # Iterate over the different saved trajectores and plot out the results.\n for i in ...
[ "0.59531826", "0.58052945", "0.57796216", "0.57693225", "0.5762829", "0.57424384", "0.57032704", "0.5696563", "0.5655393", "0.5619689", "0.5618524", "0.5602834", "0.5597427", "0.55743754", "0.55572397", "0.5541676", "0.5523565", "0.54831785", "0.5459835", "0.54562813", "0.545...
0.6471344
0
frame = loadIRframe(f) this function is to load one frame from a large .csv file from the IR camera. The format is semicolon separated temperature values (C), each row of 320 values separated by a \n character. Pass this function a pointer to the csv file.
def loadIRframe(f): import numpy as np from StringIO import StringIO frame = np.zeros((240,320),dtype=float) for i in range(240): s=StringIO(f.readline()) if s: frame[i]=np.genfromtxt(s,delimiter=';') else: print('Did not load the line.\n') ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadIRcsv(f):\n import numpy as np\n from StringIO import StringIO\n frame = np.zeros((240,320),dtype=float)\n for i in range(240):\n l=f.readline()\n s=StringIO(l.strip('\\r\\n'))\n if s:\n frame[i]=np.genfromtxt(s,delimiter=',')\n else:\n print('D...
[ "0.8082398", "0.58673704", "0.5761014", "0.56772965", "0.5662929", "0.5650815", "0.5642224", "0.55764127", "0.5574034", "0.55536413", "0.55103934", "0.5506777", "0.5502075", "0.54817224", "0.5438732", "0.5415564", "0.54142344", "0.5394935", "0.5377851", "0.5375415", "0.535068...
0.7188922
1
frame = loadIRcsv(f) this function is to load one frame from a .csv file from the IR camera. The format is comma separated temperature values (C), each row of 320 values separated by a \r\n character. Pass this function a pointer to the csv file.
def loadIRcsv(f): import numpy as np from StringIO import StringIO frame = np.zeros((240,320),dtype=float) for i in range(240): l=f.readline() s=StringIO(l.strip('\r\n')) if s: frame[i]=np.genfromtxt(s,delimiter=',') else: print('Did not load the l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv():", "def read_csv_ur10(self, csv_file):\r\n df = pd.read_csv(csv_file, sep=';', decimal=',', header=0)\r\n return df", "def loadCSV(input_file):", "def read_csv(self, filepath, header=True):\n BaseSampler.read_csv(self, filepath, header)\n # convert the data to float...
[ "0.63823056", "0.63541377", "0.62863284", "0.62340385", "0.62181646", "0.6146211", "0.611908", "0.6087001", "0.6016221", "0.6003036", "0.59814787", "0.59067446", "0.5898624", "0.5873547", "0.58632815", "0.5860813", "0.5810736", "0.5810568", "0.5804614", "0.5803024", "0.580292...
0.7792412
0
Upsert the post data into elasticsearch.
def add_post_to_es(post, db_conn): from database.topic import get_topic, deliver_topic from database.user import get_user, deliver_user data = json_prep(deliver_post(post)) topic = get_topic({'id': post['topic_id']}, db_conn) if topic: data['topic'] = json_prep(deliver_topic(topic)) us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(body):\n es = Elasticsearch([ELASTIC_SEARCH_HOST], http_auth=ELASTIC_SEARCH_AUTH, scheme=\"https\", port=ELASTIC_SEARCH_PORT)\n\n # Create Index If not present on host\n if not es.indices.exists('newdata'):\n es.indices.create('newdata')\n\n # Create Document in index\n entry = es.in...
[ "0.6743403", "0.65007114", "0.6351744", "0.6347702", "0.6271931", "0.61764693", "0.6078349", "0.60051465", "0.5892643", "0.58820343", "0.5862811", "0.581672", "0.57083654", "0.56756747", "0.5673496", "0.5632827", "0.56246656", "0.5596287", "0.5543834", "0.5525805", "0.5520915...
0.6580382
1
Do some basic sanity checks on a profile_id.
def check_profile_id(profile_id): if profile_id.startswith('profile-'): raise Exception("Please specify the profile_id WITHOUT " "the 'profile-' prefix!") if not len(profile_id.split(':')) == 2: raise Exception("Invalid profile id '%s'" % profile_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verify_profile(self, account_id: str, profile_id: str) -> str:\n profile = self.__ingest_profile\n if profile_id and self.__ip.ProfileExists(account_id=account_id, profile_id=profile_id):\n profile = profile_id\n elif self.__ingest_profile=='':\n response = self.__ip...
[ "0.7104743", "0.6710474", "0.64253753", "0.6109332", "0.6068118", "0.59209025", "0.57881415", "0.56966996", "0.56942314", "0.56297684", "0.56280243", "0.5627996", "0.56241083", "0.56060064", "0.55846685", "0.55225253", "0.55142486", "0.5506875", "0.5488878", "0.54749924", "0....
0.78423077
0
Set the DB version for a particular profile.
def set_profile_version(context, profile_id, version): check_profile_id(profile_id) ps = getToolByName(context, 'portal_setup') ps.setLastVersionForProfile(profile_id, unicode(version)) assert(ps.getLastVersionForProfile(profile_id) == (version, )) print "Set version for '%s' to '%s'." % (profile_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_database_version(db, version):\n if not isinstance(version, int):\n raise TypeError(\"Version must be integer, not %s : %s\" % (\n version, type(version)))\n create_metadata = \\\n \"CREATE TABLE %s (version INT)\" % METADATA_COLUMN_NAME\n execute_sql(db, create_metadata)...
[ "0.6657579", "0.64456165", "0.5989086", "0.5946021", "0.57743526", "0.57260305", "0.56536907", "0.5637825", "0.55805147", "0.5548009", "0.5508719", "0.5459366", "0.53897846", "0.53708965", "0.53434956", "0.5318944", "0.53174645", "0.5261118", "0.5245782", "0.52268285", "0.520...
0.74092275
0
Get the DB version for a particular profile.
def get_profile_version(context, profile_id): check_profile_id(profile_id) ps = getToolByName(context, 'portal_setup') version = ps.getLastVersionForProfile(profile_id) return version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_db_version_int(self):\r\n query = QtSql.QSqlQuery('PRAGMA user_version')\r\n query.first()\r\n return query.value(0).toInt()[0]", "def db_version():\n return IMPL.db_version()", "def _get_version_from_db(dbname):\n with psycopg2.connect(f\"dbname='{dbname}'\") as conn, conn...
[ "0.68553", "0.65708905", "0.64790404", "0.64035016", "0.63195056", "0.62634885", "0.61379784", "0.61193883", "0.60741854", "0.60580164", "0.6056425", "0.58812153", "0.58006555", "0.5788966", "0.57611907", "0.5736787", "0.56965584", "0.5680775", "0.5679926", "0.56439525", "0.5...
0.7227363
0
Returns a function value f(n) where f is a gaussian cdf in range [a, b] and N sampling points
def get_gaussian_axis_sample(a, b, N, dtype): assert a < b, "condition a < b violated!" assert isinstance(N, int), "condition N of type int violated!" data = [] for n in range(N): x = a + get_norm_cdf(N)[n]*(b-a) if dtype is int: data.append(int(x)) elif dtype is flo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdfFunction(f, x, N):\r\n return ssstats.binom.cdf(x, N, f)", "def gaussian_cdf(x, _erf=erf):\n return (1 + _erf(x / math.sqrt(2))) / 2", "def Gaussian_conv(n):\n\n\t# Choose sigma and mu\n\tsigma = 1\n\tmu = 0\n\n\t# Create table\n\tb = sigma * np.random.randn(n) + mu\n\tsum = b.sum()\n\t#b = b/sum\...
[ "0.7049408", "0.6951564", "0.66806775", "0.63988554", "0.6363044", "0.62762994", "0.6269543", "0.6252639", "0.62179327", "0.6215841", "0.6172373", "0.616933", "0.6148319", "0.6119341", "0.6116748", "0.6106222", "0.6098005", "0.6032122", "0.6021396", "0.60120165", "0.60071146"...
0.69556755
1
Returns a function value f(n) where f is logarithmic function e^x sampling the exponent range [log(a), log(b)] linear at N sampling points. The function values returned are in the range [a, b].
def get_logarithmic_axis_sample(a, b, N, dtype): assert a < b, "condition a < b violated!" assert a > 0, "condition a > 0 violated!" assert isinstance(N, int), "condition N of type int violated!" # convert input range into exponent range lexp = np.log(a) rexp = np.log(b) exp_range = np.lins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rangeLog(min, max, n):\n\n logmin, logmax = log(min), log(max)\n return np.exp( np.arange( logmin, logmax, (logmax-logmin)/float(n) ) )", "def log_uniform(a=1, b=np.exp(1)):\n return LogUniformGen(a=a, b=b, name='log_uniform')", "def gibss_sampler_exponential(starting, n, limit, lamb):\n sample...
[ "0.73515105", "0.71076256", "0.6930291", "0.67940587", "0.6789919", "0.6764468", "0.67617077", "0.6626627", "0.6610664", "0.6534819", "0.6531223", "0.6509156", "0.64672506", "0.64547515", "0.63978934", "0.6396201", "0.63810563", "0.63678044", "0.63608927", "0.6349027", "0.633...
0.74704444
0
The constructor accepts a HyppopyProject.
def __init__(self, project=None): HyppopySolver.__init__(self, project)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n project: Optional[pulumi.Input[str]] = None):\n if project is not None:\n pulumi.set(__self__, \"project\", project)", "def __init__(self, compute, project, zone=None, region=None):\n pass", "def __init__(self, solution, **kwargs):\n s...
[ "0.65287846", "0.60117", "0.5958214", "0.5800564", "0.56360596", "0.5632919", "0.5629181", "0.5618138", "0.56113935", "0.5607253", "0.55812067", "0.5562283", "0.55509925", "0.5547766", "0.55213463", "0.5516928", "0.55121785", "0.55116135", "0.5508473", "0.55042696", "0.549982...
0.7619902
0