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
This functions is deprecated. Please use lock_array instead.
def lock_device_ptr(a): import warnings warnings.warn("This function is deprecated. Use lock_array instead.", DeprecationWarning) lock_array(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock_array(a):\n safe_call(backend.get().af_lock_array(a.arr))", "def unlock_device_ptr(a):\n import warnings\n warnings.warn(\"This function is deprecated. Use unlock_array instead.\", DeprecationWarning)\n unlock_array(a)", "def unlock_array(a):\n safe_call(backend.get().af_unlock_array(a....
[ "0.7770754", "0.67321134", "0.6674785", "0.6483737", "0.59291565", "0.58408993", "0.57698244", "0.56718016", "0.55770123", "0.54081184", "0.53127784", "0.52806056", "0.5266324", "0.5266123", "0.5255861", "0.517706", "0.5142269", "0.5138074", "0.50989574", "0.50868136", "0.507...
0.77924067
0
This functions is deprecated. Please use unlock_array instead.
def unlock_device_ptr(a): import warnings warnings.warn("This function is deprecated. Use unlock_array instead.", DeprecationWarning) unlock_array(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlock_array(a):\n safe_call(backend.get().af_unlock_array(a.arr))", "def lock_device_ptr(a):\n import warnings\n warnings.warn(\"This function is deprecated. Use lock_array instead.\", DeprecationWarning)\n lock_array(a)", "def lock_array(a):\n safe_call(backend.get().af_lock_array(a.arr))"...
[ "0.7643954", "0.71890736", "0.6681846", "0.6500263", "0.5908419", "0.57814956", "0.57692033", "0.5737653", "0.5618862", "0.5406694", "0.52867466", "0.52524155", "0.524553", "0.51984084", "0.51875144", "0.514778", "0.51281923", "0.50840515", "0.5060676", "0.5030065", "0.500367...
0.79051065
0
Allocate a buffer on the device with specified number of bytes.
def alloc_device(num_bytes): ptr = ct.c_void_p(0) c_num_bytes = c_dim_t(num_bytes) safe_call(backend.get().af_alloc_device(ct.pointer(ptr), c_num_bytes)) return ptr.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_buf(self, num_bytes, cacheable = 0):\n if self.buf is None:\n self.buf = libxlnk.cma_alloc(num_bytes, cacheable)\n if self.buf == ffi.NULL:\n raise RuntimeError(\"Memory allocation failed.\")\n else:\n libxlnk.cma_free(self.buf)\n ...
[ "0.73614854", "0.6858243", "0.6715217", "0.66608685", "0.65769356", "0.635001", "0.6298993", "0.62014836", "0.61170715", "0.6013201", "0.59895205", "0.5863471", "0.5856059", "0.58321416", "0.57711035", "0.5675294", "0.56616354", "0.56533414", "0.56409615", "0.5626833", "0.562...
0.7631321
0
Allocate a buffer on the host with specified number of bytes.
def alloc_host(num_bytes): ptr = ct.c_void_p(0) c_num_bytes = c_dim_t(num_bytes) safe_call(backend.get().af_alloc_host(ct.pointer(ptr), c_num_bytes)) return ptr.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_buf(self, num_bytes, cacheable = 0):\n if self.buf is None:\n self.buf = libxlnk.cma_alloc(num_bytes, cacheable)\n if self.buf == ffi.NULL:\n raise RuntimeError(\"Memory allocation failed.\")\n else:\n libxlnk.cma_free(self.buf)\n ...
[ "0.7329726", "0.70285016", "0.6995211", "0.651202", "0.6446624", "0.62631834", "0.621866", "0.6212069", "0.6125636", "0.6113529", "0.6089165", "0.5909771", "0.59094495", "0.5845248", "0.58196187", "0.58196187", "0.5756788", "0.57543737", "0.56656617", "0.56580913", "0.5643180...
0.72086143
1
Allocate a buffer on the host using pinned memory with specified number of bytes.
def alloc_pinned(num_bytes): ptr = ct.c_void_p(0) c_num_bytes = c_dim_t(num_bytes) safe_call(backend.get().af_alloc_pinned(ct.pointer(ptr), c_num_bytes)) return ptr.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alloc_host(num_bytes):\n ptr = ct.c_void_p(0)\n c_num_bytes = c_dim_t(num_bytes)\n safe_call(backend.get().af_alloc_host(ct.pointer(ptr), c_num_bytes))\n return ptr.value", "def allocate(n, dtype=numpy.float32):\n return drv.pagelocked_empty(int(n), dtype, order='C', mem_flags=drv.host_alloc_f...
[ "0.71564823", "0.7154553", "0.6971722", "0.6943138", "0.6809374", "0.66557646", "0.6205878", "0.61793494", "0.6167408", "0.587834", "0.5850322", "0.5777571", "0.5742286", "0.5737853", "0.5688501", "0.56693286", "0.5652011", "0.5636566", "0.56322074", "0.5572027", "0.55502206"...
0.838683
0
Free the device memory allocated by alloc_device
def free_device(ptr): cptr = ct.c_void_p(ptr) safe_call(backend.get().af_free_device(cptr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free(self):\n for device_buffer in self.device_buffers.values():\n device_buffer.free()", "def device_gc():\n safe_call(backend.get().af_device_gc())", "def __del__(self):\n if self.buf != None and self.buf != ffi.NULL:\n self.free_buf()\n libdma.XAxiDm...
[ "0.7833676", "0.7135432", "0.706242", "0.7059159", "0.69340175", "0.67821574", "0.67404217", "0.6639688", "0.66176003", "0.65239066", "0.65021175", "0.65021175", "0.64918643", "0.6487607", "0.6487607", "0.64545494", "0.638272", "0.6265319", "0.6260579", "0.62074697", "0.61844...
0.746305
1
Free the host memory allocated by alloc_host
def free_host(ptr): cptr = ct.c_void_p(ptr) safe_call(backend.get().af_free_host(cptr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n if self.hostId_ct.value >= 0:\n self.libcfdll.nccf_free_host(self.hostId_ct)\n self.hostId_ct.value = -1", "def __del__(self):\n # Free the memory in the remote process's address space\n self.CleanUp()", "def free_host(self, context):\n cluster...
[ "0.7751578", "0.73309445", "0.6830156", "0.6694374", "0.64626026", "0.64585835", "0.6332376", "0.63178134", "0.63178134", "0.6288398", "0.6250136", "0.62475675", "0.6218664", "0.6176907", "0.6104181", "0.60744137", "0.6072226", "0.59981", "0.5970896", "0.5968971", "0.59680855...
0.7674597
1
Free the pinned memory allocated by alloc_pinned
def free_pinned(ptr): cptr = ct.c_void_p(ptr) safe_call(backend.get().af_free_pinned(cptr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_int_mem(self):\n self.lib.FreeInternalMemory()", "def free(p):\n return _nfc.free(p)", "def __del__(self):\n\n ipset.ipmap_free(self.map)", "def __del__(self):\n # Free the memory in the remote process's address space\n self.CleanUp()", "def free(self):\n pass...
[ "0.6875538", "0.6527352", "0.63324827", "0.6273221", "0.6129018", "0.6129018", "0.6070638", "0.60294104", "0.60001606", "0.5996925", "0.5984199", "0.59709716", "0.5931767", "0.5930531", "0.59044594", "0.57010293", "0.56973714", "0.5695675", "0.564585", "0.5636624", "0.5613072...
0.80127513
0
initializes class variables pipe, session, and mako lookup Args
def __init__(self, lookup): self.lookup = lookup self.pipe = pipe.Pipe() self.session = app.settings.SESSION_KEY
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **args):\n self.pageConfig = { 'contentType': '', # For plain CGI need: 'Content-type: text/html\\n\\n'\n 'pageName': '',\n 'pageTitle': '',\n 'pageHeaderSnippets': '',\n ...
[ "0.6354993", "0.6294942", "0.6259427", "0.62265193", "0.6160438", "0.61579615", "0.6150426", "0.60886145", "0.60682076", "0.5998155", "0.59663904", "0.5947604", "0.59365755", "0.5935845", "0.59328187", "0.59303516", "0.592194", "0.5919372", "0.5909178", "0.58868915", "0.58818...
0.67022747
0
Gets current url from cherrypy
def url(self): return app.settings.cherrypy.url()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_url():\n return current_url", "def getUrl(self):\n result = self.CORE.current_url\n self.log_info(f\"Browser.getUrl: Current URL is {result}\")\n return result", "def current_url(self):\n return self.browser.current_url", "def get_url(self):\n return self...
[ "0.7548699", "0.7183997", "0.7066521", "0.7019969", "0.6963389", "0.69051445", "0.688064", "0.67549336", "0.6737674", "0.6687634", "0.6532988", "0.65171576", "0.6478735", "0.6469044", "0.63746345", "0.63746345", "0.63637525", "0.6304102", "0.62822783", "0.6256556", "0.6218534...
0.7765586
0
Runs update on all tasks, running the timed events
def _update_all_tasks(self) -> None: for task in self.tasks: task.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_update(self):\n try:\n self.task_stop()\n except:\n pass\n self.update()\n self.task_start()", "def _update_tasks(self, tasks):\n\n self._print('Updating tasks {} with {} ...'.format(self._tasks, tasks))\n\n self._tasks.update(tasks)", "d...
[ "0.72764605", "0.6823289", "0.67396975", "0.6672859", "0.6564836", "0.6502204", "0.6427707", "0.6418535", "0.64175826", "0.6356388", "0.6342157", "0.63381684", "0.6284759", "0.626994", "0.6263942", "0.6261002", "0.62306684", "0.62303674", "0.6189126", "0.6168864", "0.61462444...
0.795436
0
Read the file to look for new entries
def _read_new_entries(self, is_first_read: bool) -> bool: new_text = self.watched_file.read() if new_text: for entry_txt in new_text.split("\n"): if entry_txt: self._register_entry(entry_txt, is_first_read) return len(new_text) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_file(self):\n try:\n f = open(self._file_name, \"r\")\n line = f.readline()\n while len(line) > 0:\n super(RentalHistoryText, self).add_rental(self.string_to_obj(line))\n line = f.readline()\n f.close()\n except IOErro...
[ "0.59001005", "0.5888308", "0.5873727", "0.586724", "0.57569456", "0.5749917", "0.5704375", "0.5680836", "0.56789076", "0.56716615", "0.56376845", "0.56120217", "0.55804825", "0.556127", "0.5551094", "0.5547872", "0.5537474", "0.5525709", "0.5514275", "0.5506423", "0.54934925...
0.7074114
0
Runs all the tasks, watching for file update and running timed events (blocking) Stops on KeyboardInterrupts
def run(self): while True: try: if not self._read_new_entries(False): time.sleep(0.1) self._update_all_tasks() except KeyboardInterrupt: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_inner(self):\n for event in self.inotify.event_gen():\n self.process_inotify_event(event)", "def run(self):\n while not self.stop_event.is_set():\n self.manage_cache_tasks()", "def run(self):\n if len(self.modules) == 0:\n raise ValueError(\"no modu...
[ "0.657493", "0.6518826", "0.6458442", "0.63715094", "0.6267447", "0.62129575", "0.6212182", "0.6164866", "0.6133008", "0.61261255", "0.6102208", "0.608183", "0.6013903", "0.6012976", "0.600675", "0.60060596", "0.5998249", "0.5994159", "0.5979658", "0.5964806", "0.59521025", ...
0.72892773
0
A plugin for healpix probability maps. Allows for joint fitting of positions on the sky. Coordinate system is assumed to be Celestial. this can be changed in the future.
def __init__(self, name, healpix_map, coord='C'): assert coord.upper() in _allowed_coords, 'coord must be G or C' self._coord = coord.upper() self._map = healpix_map # the map should be filled with probabilities # and we will be using the log of them. Let's # go ahead...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n p_xi: float, p_yi: float, p_zi: float,\n p_xx: float, p_yx: float, p_zx: float,\n p_xy: float, p_yy: float, p_zy: float,\n p_xz: float, p_yz: float, p_zz: float,\n p_ix: float, p_iy: float, p_iz: float) -> None:\n ...
[ "0.58046466", "0.55994", "0.54392654", "0.54388106", "0.5288379", "0.52196753", "0.5214295", "0.51771414", "0.5138912", "0.5102177", "0.5095032", "0.5086337", "0.5084034", "0.5055608", "0.50521195", "0.50312424", "0.50134736", "0.50119823", "0.50064504", "0.500015", "0.499969...
0.5699997
1
Construct a HEALPixMapLike from a file name
def from_healpix_file(cls, name, filename, coord='C', **kwargs): hp_map = hp.read_map(filename, **kwargs) return cls(name, hp_map, coord=coord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hershey_load(glyph_file_name, map_file_name=None):\n glyphs = {}\n font = []\n width = 40\n height = 45\n first = 32\n last = 127\n\n # Read the glyphs file\n with open(glyph_file_name, \"r\") as file:\n for line in file:\n key, glyph_data = parse_line(HF_KEYWORDS, lin...
[ "0.6012343", "0.59335184", "0.5609639", "0.5591801", "0.55751103", "0.5542627", "0.54895735", "0.5453329", "0.5406322", "0.5380508", "0.53684604", "0.53626907", "0.5351559", "0.53295666", "0.53259724", "0.5314114", "0.5313798", "0.5312689", "0.5296311", "0.5278228", "0.526912...
0.7018352
0
Evaluates the dialogue created by the model. First we load the user goal of the dialogue, then for each turn generated by the system we look for keywords. For the Inform rate we look whether the entity was proposed. For the Success rate we look for requestables slots
def _evaluateGeneratedDialogue( self, dialog, goal, real_requestables, counts, soft_acc=False, same_eval_as_cambridge=False ): # for computing corpus success #'id' requestables = self.requestables # CHECK IF MATCH HAPPENED provided_requestables = {} venue_off...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n\n \"\"\" First updates the variables values of the current time form the environment \"\"\"\n self.update_crispval(self.env.context)\n\n \"\"\"\n here the decision making of the agent\n to determine which activity to suggest to the patient\n i apply the c...
[ "0.6109059", "0.5859167", "0.5658158", "0.5657302", "0.56513774", "0.5633824", "0.5620179", "0.5611107", "0.55878556", "0.5586535", "0.5575564", "0.5571151", "0.55471003", "0.5539937", "0.55272955", "0.5524691", "0.551342", "0.54877883", "0.5465159", "0.5449234", "0.5444223",...
0.6883602
0
Parses user goal into dictionary format.
def _parseGoal(self, goal, true_goal, domain): goal[domain] = {} goal[domain] = {'informable': {}, 'requestable': [], 'booking': []} if 'info' in true_goal[domain]: if domain == 'train': # we consider dialogues only where train had to be booked! if 'bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_user_dict(self, line):\n pass", "def _goal_info_dict(self) -> dict:\n assert self._goal_info_cache\n return self._goal_info_cache[2]", "def _get_goal_info(self):\n current_state = self.goal_generation.current_state()\n goal_distance = self._calculate_goal_distance(c...
[ "0.6435385", "0.6082134", "0.57273984", "0.56479615", "0.55064654", "0.54974645", "0.5485419", "0.54759574", "0.543402", "0.54029757", "0.5401571", "0.53892636", "0.53892636", "0.5362865", "0.53533363", "0.5304361", "0.52661854", "0.5235574", "0.5233663", "0.52295554", "0.519...
0.6709081
0
Helper function to figure out alphabet of a particular number
def get_alphabet(number): return chr(number + 96)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_num(num: int):\n if abs(num) > 26 or num == 0:\n let = ord('a') + 26 - 1\n else:\n let = ord('a') + abs(num) - 1\n return chr(let)", "def GetAlphabet(self):\n alphabet = list(self._charAlphabet) #Creates a list of the alphabet characters\n numbers = [i for i in ran...
[ "0.7621253", "0.7509396", "0.7389821", "0.7369762", "0.72826624", "0.72773325", "0.72322774", "0.71333027", "0.71138066", "0.70757747", "0.70438623", "0.6924207", "0.6924207", "0.6924207", "0.6893473", "0.6885589", "0.6881394", "0.6877557", "0.68647957", "0.6808535", "0.68006...
0.8367941
1
Check devices category having the ID_INPUT_TOUCHSCREEN property
def _test_DELL_INSPIRON3521_TOUCHSCREEN(self): devices = self.parse("DELL_INSPIRON3521_TOUCHSCREEN") self.assertEqual(len(devices), 59) # Check the Accelerometer device category/product self.assertEqual(devices[36].category, "TOUCHSCREEN") self.assertEqual(devices[36].product, "E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_devices_win(self):\n self._find_xinput()\n self._detect_gamepads()\n self._count_devices()\n if self._raw_device_counts['keyboards'] > 0:\n self.keyboards.append(Keyboard(\n self,\n \"/dev/input/by-id/usb-A_Nice_Keyboard-event-kbd\"))\n...
[ "0.5599005", "0.54362094", "0.53885055", "0.53280866", "0.5071217", "0.5003419", "0.49523497", "0.4922179", "0.49039686", "0.49033368", "0.4894834", "0.48461682", "0.48408756", "0.4833112", "0.4831477", "0.48303944", "0.48283538", "0.47919443", "0.47816104", "0.4779527", "0.4...
0.6403725
0
Verify we have exactly one of each device given in the list, and that product name, category, bus, vendor_id and product_id match. The list contains a tuple with product name, category, bus, vendor and product.
def verify_devices(self, devices, expected_device_list): # See this bug, that prompted for closer inspection of # devices and IDs: # https://bugs.launchpad.net/checkbox/+bug/1211521 for device in expected_device_list: # Match by product and vendor ID indices = [id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_expected_devices():\n\n res = devices()\n error = extract_error_from(res)\n if error:\n if log.isEnabledFor(logging.DEBUG):\n log.debug(\"Check expected devices got error result: {}\".format(res))\n return\n\n expected_usb_devices = __opts__.get(\"expected_usb_devices...
[ "0.64341414", "0.6420363", "0.6243646", "0.6111176", "0.60902125", "0.605116", "0.5899089", "0.5801178", "0.5732541", "0.5673593", "0.56698555", "0.5663927", "0.5609518", "0.55837023", "0.5564208", "0.5515976", "0.55140036", "0.55138326", "0.5496754", "0.5485256", "0.5449645"...
0.7815872
0
Return binary classification tracks.
def load_binary_clf_tracks() -> typing.List[Track]: return [ Track( name="Phishing", dataset=datasets.Phishing(), metric=metrics.Accuracy() + metrics.F1(), ), Track( name="Bananas", dataset=datasets.Bananas(), metric=me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tracks(self):\r\n return None", "def get_tracks(num=1):\n pass", "def tracks(self) -> pd.DataFrame:\n return self._tracks", "def data_tracks_truth(data_binary_truth, tracks_test, id_translator):\n get_ids = id_translator(data_binary)\n tracks = [Track(id=track.id, ids=get_ids(*...
[ "0.6666508", "0.6630405", "0.61517924", "0.61405706", "0.6133815", "0.61336136", "0.6099932", "0.6019503", "0.59117126", "0.5897689", "0.5894595", "0.5812722", "0.57987446", "0.56968445", "0.565759", "0.56485605", "0.56442875", "0.55676323", "0.5560574", "0.5557026", "0.55289...
0.7977772
0
retrieve a list from the datastore. If none found, fall through to content/lists dir.
def get_list(self): list_id = self.request.path[1:] if len(list_id) <= 0: list_id = INDEX_LIST_ID lst = List.gql("where id=:1", list_id).get() if lst is not None: q = Page.all() q.filter('list_id =', list_id) if not users.is_current_user_ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_fs_item(self):\n if self.request.path[1:].rfind('/') > 1:\n list_id = self.request.path[1:self.request.path.rfind('/')]\n item_id = self.request.path[self.request.path.rfind('/')+1:]\n #self.response.out.write(list_id + \";\" +item_id)\n listspec = se...
[ "0.6777946", "0.64201367", "0.640454", "0.6313635", "0.6197793", "0.6004185", "0.59206706", "0.58982307", "0.5860266", "0.5806619", "0.57735145", "0.57669586", "0.5726043", "0.5726043", "0.5726043", "0.5705203", "0.56677026", "0.56168413", "0.56131023", "0.5603525", "0.560352...
0.6744782
1
generate a urlsafe string for a given headline
def get_slug(self, headline): exclude = set(string.punctuation) s = ''.join(ch for ch in headline if ch not in exclude) return s.lower().replace(" ", "-")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headline(self):\r\n return '%s%s %s%s' % (BLUE, self.title,\r\n NORMAL, self.link)", "def make_wiki_url(title):\n urlTitle = '_'.join(word for word in title.split())\n url = f'https://en.wikipedia.org/wiki/{urlTitle}'\n return url", "def _make_url_friendly(title...
[ "0.6581711", "0.6399554", "0.6283472", "0.5934776", "0.58978605", "0.58825505", "0.5763474", "0.5747398", "0.57402945", "0.57390845", "0.57077295", "0.5705762", "0.5694297", "0.56935674", "0.568868", "0.5682626", "0.56125367", "0.55667007", "0.5560909", "0.5554738", "0.554896...
0.6895514
0
generate a page object from an entry dict (usu originating in yaml)
def get_page_from_entry(self, entry): page = Page() if '_uri' not in entry or entry['_uri'] is None: prefix = '' if '_list_id' not in entry or entry['_list_id'] is None else ('/' + entry['_list_id']) entry['_uri'] = prefix + "/" + self.get_slug(entry['_headline']) page.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page(config, page_contents): # noqa\n return Page.from_yaml(page_contents, config=config)", "def init_new_entry(args, page=False):\n\n buildingfor = \"posts\"\n if (page):\n buildingfor = \"pages\"\n\n def _remove_temporary_entries(entries):\n result = {}\n for key, value ...
[ "0.6550484", "0.61793506", "0.5839592", "0.5836046", "0.56778705", "0.55705583", "0.5526202", "0.5472234", "0.54540867", "0.5378768", "0.53678054", "0.52614135", "0.5244367", "0.52178943", "0.51835984", "0.5177936", "0.51587355", "0.5142106", "0.50956106", "0.5041135", "0.503...
0.7113648
0
Creates the genes table and reads the genes from the file fn_genes File with the information for the Genes
def create_genes_table(self, fn_genes): log.info("Creating table with information about the genes ...") gene_record = GeneParser.GeneRecord() names = gene_record.fields_names types = gene_record.fields_types if len(names) != len(types): raise ValueError, "The number o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genes_file_creation(input_folder):\n file_paths = {}\n for file_name in os.listdir(input_folder):\n file_paths[file_name] = input_folder + '/' + file_name\n\n df = pa.DataFrame()\n \n for file_name in file_paths:\n df_temp = pa.read_csv(file_paths[file_name], sep='\\t', hea...
[ "0.68898493", "0.6807274", "0.66574675", "0.6540258", "0.6511857", "0.6444042", "0.6417198", "0.64058566", "0.64040947", "0.6391928", "0.63885427", "0.6364438", "0.6359897", "0.6352459", "0.6254273", "0.62510246", "0.62250155", "0.6206904", "0.61661416", "0.61398476", "0.6124...
0.83905405
0
Store a set of BLAST results in the database Results_list A list of pairs (identifier, blast results). The identifier is the gene id. Blast results is an istance of BlastResult.
def store_blast_results(self, results_list): data = [] for gene_id, r in results_list: data.append([gene_id] + r.get_formatted_for_db()) self.store_data(self.BlastResultsTable, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_blast_results_table(self):\n res = BLASTUtilities.BLASTResult()\n log.info(\"Creating table to store BLAST results ...\")\n fields = [\"gene_id\"] + res.fields_names\n types = [str]+res.fields_types\n self.create_table(self.BlastResultsTable,fields, types)", "def bla...
[ "0.6564822", "0.5716116", "0.5563092", "0.5357984", "0.5324654", "0.52823013", "0.5276308", "0.52495587", "0.5242226", "0.52216023", "0.52109015", "0.5163063", "0.51613784", "0.5149378", "0.51427066", "0.513526", "0.5134554", "0.5134554", "0.5132241", "0.5124537", "0.5123111"...
0.86592853
0
Creates the table to store the scaffold assigments
def create_scaffold_assignments_table(self): log.info("Creating table to store Scaffold genus assignments ...") self.create_table(self.ScaffoldsAssignmentsTable ,self.ScaffoldAssignmentsFields, self.ScaffoldAssignmentsTypes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def setup_table(self):\n\n self.setup.create_basic_table_in_dev()\n self.setup.insert_random_records_into_dev()", "def create_table(self):\n from deployflag.models.metadata import (\n GridSearchParameter,\n ModelFramework,\n ...
[ "0.7680367", "0.7172051", "0.7001753", "0.698574", "0.698574", "0.688265", "0.6855781", "0.680448", "0.67631537", "0.67543006", "0.6752785", "0.6741848", "0.6726612", "0.66916025", "0.66705704", "0.66488016", "0.6634751", "0.6587091", "0.6573168", "0.6537903", "0.65188193", ...
0.75821006
1
Creates and fills a table with the sequences of the scaffols fn_scaffolds A file in FASTA format with the sequences of all the Scaffolds
def fill_scaffolds_table(self,fn_scaffolds, overwrite=True): scaffold_record_pattern = re.compile("(.+?)\s+(.+?)\s+(.+)") tables_names = self.get_tables_names() log.info("Creating and filling table of scaffolds ...") if overwrite and self.ScaffoldsTable in tables_names: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createScaffoldAbundanceProfiles(scaffFilePath, scaffPred, profilesDir, databaseFile, taxonomicRanks, minScaffLen):\n seqIdToBp = fas.getSequenceToBpDict(scaffFilePath)\n seqIdToTaxonId = csv.predToDict(scaffPred)\n taxonomy = Taxonomy(databaseFile, taxonomicRanks)\n errorIdToCount = {}\n entryLi...
[ "0.6574271", "0.6474374", "0.6459084", "0.62203944", "0.61968327", "0.6133176", "0.60561717", "0.601893", "0.59610254", "0.5943906", "0.56829333", "0.56596303", "0.56447345", "0.56401783", "0.5582964", "0.55208254", "0.54981726", "0.5497584", "0.54765385", "0.5455965", "0.545...
0.8034111
0
Add the coverage values to the table containing the Scaffolds fn file with the coverage information. It is expected to be a csv file with the first column naming the scaffold and the second one containing the coverage. The firs line of the file (the title) is discarded
def add_scaffold_coverage(self, fn): if not self.table_exists(self.ScaffoldsTable): raise ValueError("Cannot add scaffold coverage. The table with the scaffolds does "\ "not exist") cnames = self.get_table_column_names(self.ScaffoldsTable) if not "coverage" in cnames:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_test_coverage(self) -> None:\n print_statistics = {}\n total_number_columns = 0\n number_columns_without_tests = 0\n\n for model_name in self.dbt_tests.keys():\n columns = self.dbt_tests[model_name]\n\n model_number_columns = 0\n model_co...
[ "0.5975737", "0.5767049", "0.56756544", "0.55477923", "0.5533817", "0.53990895", "0.539496", "0.53847706", "0.5352464", "0.5341932", "0.5306218", "0.53045017", "0.53041303", "0.5281229", "0.52719986", "0.525491", "0.52539384", "0.52434444", "0.5242927", "0.52420515", "0.52268...
0.7496645
0
Puts all the scaffolds assigned to a genus together and retunrs a dictionary of sequences. The function reads the database to recover the genus given each of the assigned scaffolds. Scaffolds having the same genus are concatenated. The concatenated frankenstein sequences can be used to calculate kmer signatures for eac...
def get_genera_sequences_from(self, table): log.info("Joining the sequences of all the scaffolds with the same genus") if not self.table_exists(table): raise ValueError("The database does not have table {0}".format(table)) # Get all the scaffolds assigned sql_command = """SEL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_scaffolds_table(self,fn_scaffolds, overwrite=True):\n scaffold_record_pattern = re.compile(\"(.+?)\\s+(.+?)\\s+(.+)\")\n tables_names = self.get_tables_names()\n log.info(\"Creating and filling table of scaffolds ...\")\n if overwrite and self.ScaffoldsTable in tables_names:\n ...
[ "0.68760955", "0.63092047", "0.59779084", "0.5795744", "0.5750635", "0.5686459", "0.56418484", "0.5623255", "0.56094563", "0.5561062", "0.5546886", "0.55438864", "0.54213285", "0.54203933", "0.54090405", "0.53924966", "0.53425306", "0.5304037", "0.52992755", "0.52937526", "0....
0.8109562
0
Calculate the kmer spectrums for the scaffolds The sequences of the scaffolds are read from the database and their spectrums are stored as a new column k The size of the kmers
def add_scaffold_spectrums(self,kmer_size): log.debug("Adding a column with the k-mer spectrums to the scaffolds table") if not self.table_exists(self.ScaffoldsTable): raise ValueError("Cannot add k-mer spectrums. Scaffolds table does not exist") if not "spectrum" in self.get_table_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kf_kms(self):\n kfkms = np.array([ self.kf / (ss.velfac * 3.085678e24/ss.units.UnitLength_in_cm) for ss in self.spectrae])\n return kfkms", "def codonfreqs_kmerdf(kmertable): \n codon_counts_kmer = np.zeros(( len(codons_nonstop) ))\n for kmer in kmertable['kmer']:\n ...
[ "0.6171296", "0.5924643", "0.5837802", "0.57807535", "0.5675153", "0.56713724", "0.55829674", "0.5562619", "0.55592567", "0.54942244", "0.5474816", "0.54584265", "0.5432639", "0.5411884", "0.5407475", "0.5402099", "0.5369641", "0.5365154", "0.53594846", "0.5347352", "0.533796...
0.7470558
0
Check that the alarm target is the cloudwatch forwarder
def is_health_monitor_alarm(alarm): is_health_alarm = False if len(alarm["OKActions"]) > 0: action = alarm["OKActions"][0] is_health_alarm = "cloudwatch_forwarder" in action return is_health_alarm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_alarm():\n return _alarm", "def checkUpstreamScheduler():", "def verifyActionCenterFirewall():\n pass", "def _isalarm(self):\n return self.dp.state()==PyTango.DevState.ALARM", "def check(self, target, port):\n pass", "def is_triggered_police(self):\n return self == Armin...
[ "0.61978143", "0.6041544", "0.5970645", "0.5934713", "0.5800295", "0.55926555", "0.5549589", "0.55158037", "0.54804873", "0.53855646", "0.5380497", "0.53318185", "0.53312725", "0.530946", "0.5285363", "0.5267111", "0.5247779", "0.52361804", "0.52165556", "0.52141815", "0.5181...
0.6840731
0
Set state of all configured alarms to the state value
def reset_all_alarm_states(state): valid_states = ["OK", "ALARM"] if state in valid_states: for region in REGIONS: alarms = get_alarms(region) for alarm in alarms: alarm_name = alarm["AlarmName"] is_health_alarm = is_health_monitor_alarm(alarm) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state(self, value, reason, data=None):\r\n return self.connection.set_alarm_state(self.name, reason, value, data)", "def setsignals(self, alarmMode):\n self.immediate = self._immediate_by_state[alarmMode].copy()\n self.delayed = self._delayed_by_state[alarmMode].copy()\n sel...
[ "0.667778", "0.62260205", "0.62105244", "0.619373", "0.6166977", "0.6161669", "0.61283034", "0.60976636", "0.6073555", "0.6071312", "0.60280144", "0.5924343", "0.5906946", "0.58976024", "0.5896116", "0.58929324", "0.5887167", "0.5887167", "0.5874509", "0.5854872", "0.5844955"...
0.7412929
0
Get the state value associated with a list of tf.Variables. This state is commonly going to be a NamedTuple that contains some mapping between variables and the state associated with those variables. This state could be a moving momentum variable tracked by the optimizer.
def get_state(self, var_list): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def State(**variables):\n return pd.Series(variables, name='state')", "def states(self):\n num_states = 2**self.num_vars\n return (int2tuple(s, self.num_vars) for s in range(num_states))", "def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state in...
[ "0.6184776", "0.6174988", "0.58736706", "0.5833465", "0.57011205", "0.5681866", "0.5662184", "0.56602633", "0.56431395", "0.56031317", "0.5575441", "0.5567072", "0.55570275", "0.5542959", "0.55377376", "0.5528781", "0.54936534", "0.54758453", "0.54433525", "0.54328334", "0.54...
0.6935558
0
Returns list of the NNCF operations which were added to the NNCF network.
def nncf_operations(self) -> List[NNCFOperation]: return [op for hook in getattr(self, "_hooks") for op in hook.operations]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operation_list(self):\n return self._operation_list", "def operation_list(self):\n return self._operation_list", "def operation_list(self):\n return self._operation_list", "def operation_list(self):\n return self._operation_list", "def operation_list(self):\n return O...
[ "0.72892004", "0.72892004", "0.72892004", "0.72892004", "0.6969018", "0.69178736", "0.66419774", "0.65941155", "0.65941155", "0.65749043", "0.6561894", "0.6528793", "0.6471523", "0.6288772", "0.6284276", "0.62312585", "0.62312585", "0.62312585", "0.62312585", "0.61890763", "0...
0.8416961
0
Returns input signature of the model.
def input_signature(self) -> InputSignature: return self._input_signature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_signature(self):\n return self._function_spec.input_signature", "def input_signature(self) -> \"gr::io_signature::sptr\":\n return _beamforming_swig.beamformer_sptr_input_signature(self)", "def input_signature(self):\n return _spacegrant_swig.invert_bit_sptr_input_signature(self)", ...
[ "0.82323426", "0.7293295", "0.7289622", "0.72355556", "0.7233116", "0.7231616", "0.7207596", "0.7184618", "0.7156754", "0.7156754", "0.7156754", "0.71118444", "0.7087101", "0.7072055", "0.7058462", "0.7034181", "0.6984277", "0.69729644", "0.69644064", "0.69644064", "0.6956316...
0.8123941
1
Calls the model on new inputs and returns the outputs as tensors. We call the model inside the tracing context to add the NNCF operations to the graph of the model.
def call(self, inputs, **kwargs): xs = self._apply_post_hooks_for_inputs(inputs) with get_current_context().enter(in_call=True, wrap_ops=True, model=self): outputs = self._model(xs, **kwargs) return outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forward(self, inputs):\n if is_tf_available():\n # TODO trace model\n predictions = self.model(inputs)[0]\n else:\n import torch\n with torch.no_grad():\n predictions = self.model(**inputs)[0]\n\n return predictions.numpy()", "d...
[ "0.67814004", "0.65892804", "0.6507224", "0.6428202", "0.63824713", "0.6139003", "0.61002284", "0.6084376", "0.60649854", "0.60032964", "0.59988916", "0.5985153", "0.59805876", "0.5968289", "0.59511125", "0.5949395", "0.5915795", "0.5914051", "0.5907424", "0.59063256", "0.589...
0.70089394
0
Inserts the list of the NNCF operations according to the target point.
def insert_at_point(self, point: TFTargetPoint, ops: List[NNCFOperation]) -> None: ops_weights = {op.name: op.create_variables(self) for op in ops} hook = Hook(ops, point, ops_weights) hooks = getattr(self, "_pre_hooks") if hook.is_pre_hook else getattr(self, "_post_hooks") # TODO(andrey...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_op(self, op):", "def add_cups(self, target_idx, cups_to_insert):\n part_a = self.cups[0 : target_idx + 1]\n part_b = self.cups[target_idx + 1 :]\n print(f\"cups: {self.cups} part_a[{part_a}], part_b[{part_b}]\")\n self.cups = part_a + cups_to_insert + part_b", "def inser...
[ "0.6464975", "0.6013511", "0.5540543", "0.5535739", "0.5431843", "0.53518593", "0.53507036", "0.5325072", "0.5278681", "0.52055055", "0.517867", "0.517229", "0.5163469", "0.51406723", "0.5133036", "0.5125267", "0.5108106", "0.51014507", "0.50893474", "0.5024899", "0.49845177"...
0.6142723
1
Applies posthooks to inputs.
def _apply_post_hooks_for_inputs(self, inputs): input_name_to_post_hook_map = { hook.target_point.op_name: hook for hook in getattr(self, "_hooks") if hook.target_point.op_type_name == "Placeholder" } if not input_name_to_post_hook_map: return inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess(self, inputs: Dict[str, Any], **kwargs) -> Dict[str, Any]:\n return inputs", "def _post_hooks(self):", "def process_inputs(self, inputs):", "def call(self, inputs, **kwargs):\n xs = self._apply_post_hooks_for_inputs(inputs)\n with get_current_context().enter(in_call=True,...
[ "0.68493336", "0.6779223", "0.6742849", "0.6439749", "0.63185704", "0.61403227", "0.613425", "0.5967779", "0.58919793", "0.5881654", "0.57652634", "0.57652634", "0.5759135", "0.5750806", "0.5750121", "0.5750121", "0.5750121", "0.5750121", "0.5736197", "0.5632061", "0.56314796...
0.8012152
0
The number of commands in the pool (an integer).
def num_commands(self): return len(self.commands)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return len(self._commands)", "def length(self):\n return len(self._commands)", "def size(self):\r\n return sum(pool.size() for pool in self.host_to_pool.values())", "def pool_size(self):\n if self.options.pool_size == 0:\n return 2 * len(self._server_...
[ "0.7704482", "0.7159404", "0.71257395", "0.7041065", "0.7011789", "0.6941698", "0.68862003", "0.6849827", "0.68400985", "0.68100166", "0.67510664", "0.67156297", "0.6693615", "0.6670939", "0.6645249", "0.65977025", "0.65976334", "0.65877396", "0.65747404", "0.6573676", "0.657...
0.746406
1
The number of commands in the pool that have already finished, including retries (an integer).
def num_finished(self): return sum(cmd.is_finished_with_retries for id, cmd in self.commands)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_executors(self):\n with self.__threads_lock:\n return self.__number_executors", "def count(self):\n return len(self._commands)", "def get_retry_count(self):\r\n return self.retried_nomax + self.retried_withmax", "def size(self):\r\n return sum(pool.size()...
[ "0.7062302", "0.6928806", "0.6873411", "0.67489773", "0.6657349", "0.65769935", "0.65179515", "0.65179515", "0.65124184", "0.6511193", "0.65034807", "0.6470395", "0.64580035", "0.64303654", "0.6419699", "0.6380403", "0.63743484", "0.6369803", "0.63497466", "0.6339423", "0.633...
0.71838385
0
The number of commands in the pool that failed (an integer).
def num_failed(self): return sum(cmd.failed for id, cmd in self.commands)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return len(self._commands)", "def error_count(self):\n return len(self.errors)", "def count(self):\n # TODO not implemented yet\n return 0", "def fail_counter(self) -> int:\n return self._state_storage.counter", "def num_finished(self):\n return ...
[ "0.6967507", "0.6786323", "0.65832776", "0.65654504", "0.65456307", "0.65443075", "0.6471891", "0.6450651", "0.6415244", "0.64100486", "0.6398556", "0.6388014", "0.6380104", "0.63604194", "0.63447404", "0.6314011", "0.6284484", "0.62786347", "0.62670696", "0.6256193", "0.6209...
0.78216577
0
A set of running command groups.
def running_groups(self): return set( cmd.group_by for id, cmd in self.commands if cmd.is_running and cmd.group_by is not None )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cli_groups():\n\n return get_component(CLIPackage.COMPONENT_NAME).get_cli_groups()", "def groups(self):\n return []", "def list_groups(args):\n\n for group in get_groups(args):\n print(group)", "def groups(self):\n # type: (...) -> Set[str]\n return self._groups", ...
[ "0.7096716", "0.69971144", "0.6599328", "0.64935476", "0.6442436", "0.6434366", "0.6434366", "0.6434366", "0.641408", "0.63858575", "0.6373279", "0.6372804", "0.6355381", "0.63399875", "0.63234127", "0.63159627", "0.6301207", "0.63002414", "0.628694", "0.6206386", "0.6121117"...
0.81384176
0
Keep spawning commands and collecting results until all commands have run.
def run(self): # Start spawning processes to execute the commands. timer = Timer() logger.debug("Preparing to run %s with a concurrency of %i ..", pluralize(self.num_commands, "command"), self.concurrency) try: with self.get_spinner(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def __track_commands(self):\n while True:\n done_cids = []\n for cid in self.__running_commands.keys():\n if self.__running_commands[cid].done():\n self._id_pool.add(cid)\n done_cids.append(cid)\n for cid in done_cid...
[ "0.71453893", "0.66608655", "0.6641542", "0.6481725", "0.62717694", "0.62678844", "0.6202619", "0.60775995", "0.60562485", "0.6039151", "0.6012592", "0.6006588", "0.59540105", "0.59378713", "0.5930316", "0.59285545", "0.59280777", "0.59259814", "0.58934015", "0.5886708", "0.5...
0.6977817
1
Collect the exit codes and output of finished commands.
def collect(self): num_collected = 0 for identifier, command in self.commands: if identifier not in self.collected and command.is_finished: try: command.wait(check=False if self.delay_checks else None) except ExternalCommandFailed as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_end(self, returncode):\n self.stdout.close()\n self.stderr.close()", "def _checker_worker(self):\n results = {}\n for cmd in self.check_cmds:\n res = subprocess.call(cmd.split(), stdout=open('/dev/null', 'w'))\n self.log(\"'%s' finished, result: %s\" % (cm...
[ "0.5905816", "0.5883277", "0.5811078", "0.5787", "0.57808805", "0.57808805", "0.57358027", "0.56998336", "0.56956506", "0.56898475", "0.5609879", "0.55768543", "0.5553519", "0.55483264", "0.5530344", "0.5515181", "0.5504058", "0.54950386", "0.54898506", "0.5478136", "0.547745...
0.6471477
0
An error message that explains which commands failed unexpectedly (a string).
def error_message(self): summary = format("%i out of %s failed unexpectedly:", self.pool.num_failed, pluralize(self.pool.num_commands, "command")) details = "\n".join(" - %s" % cmd.error_message for cmd in self.commands) return summary + "\n\n" +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_failed_error(cmd):\n\n output_1 = colored(' - Error: Failed to run command ', 'red')\n output_2 = command(cmd)\n return output_1 + output_2 + '\\n'", "def error_exit(self, msg):\n wrappedmsg = textwrap.fill(msg, 78)\n fullmsg = \"%s\\n%s\" % (wrappedmsg, self.get_usage_command(...
[ "0.78114533", "0.7160743", "0.7085666", "0.70811224", "0.7079618", "0.7068593", "0.7025788", "0.6980366", "0.6974227", "0.6948617", "0.692762", "0.6906242", "0.68896747", "0.6884603", "0.6807256", "0.68046314", "0.6793079", "0.67832476", "0.67698437", "0.67321587", "0.6717104...
0.81388915
0
Resets the username for the webprofile
def reset_webprofileusername(username): try: url = HOST + '/profile/username' r = requests.delete(url, headers=headers) return r.json() except requests.exceptions.RequestException as e: print("Something went wrong. Could not delete webprofile username:", e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_web_profile_username(self, username):\n endpoint = '/profile/username'\n return self.delete_request(endpoint)", "def Reset_Profile_Name( self ):\r\n self.profile_name_list = [ root_profile_name ]\r\n self.combobox_profile.setlist( self.profile_name_list )\r\n self.Roo...
[ "0.8729853", "0.7183397", "0.7073287", "0.6744639", "0.6683188", "0.65020156", "0.64171636", "0.64081645", "0.63797224", "0.6315369", "0.6260578", "0.61702913", "0.6140072", "0.61316365", "0.612762", "0.6074401", "0.6070117", "0.6052026", "0.6033984", "0.6011907", "0.6006958"...
0.8051354
1
Returns (SQL query, query parameters) that will aggregate from a UCR source to an aggregate table.
def aggregate_query(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregate(modelclass, window_date, supply_point, base_supply_points, fields,\n additonal_query_params=None):\n additonal_query_params = additonal_query_params or {}\n additonal_query_params[\"date\"] = window_date\n return _aggregate_raw(modelclass, supply_point, base_supply_points, fie...
[ "0.5975628", "0.58480895", "0.551002", "0.53418803", "0.5340471", "0.53088844", "0.52996635", "0.52363217", "0.523242", "0.521906", "0.51675385", "0.51466995", "0.51349866", "0.5111212", "0.5081647", "0.5080905", "0.5070058", "0.50674236", "0.5064264", "0.50621796", "0.503513...
0.62472606
0
Used for backend migrations from one data source to another. Returns (SQL query, query parameters) that will return any rows that are inconsistent from the old data to the new.
def compare_with_old_data_query(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbdiff(old, new):\r\n # TODO: check the comparison and add the previous value(s) into the diff table\r\n dir = \"C:/Users/Volodymyr.Turbayevsk/Desktop/Docs/programming/R/indicators/zipDBCopy/\"\r\n logging.info(old + '->' + new)\r\n engine = create_engine('sqlite:///' + dir + old + '.sqlite')\r\n ...
[ "0.61053324", "0.57679933", "0.5766234", "0.5723106", "0.5655177", "0.56233317", "0.55981433", "0.558229", "0.55717003", "0.55482566", "0.5505966", "0.54968566", "0.5495645", "0.5490699", "0.5475832", "0.546017", "0.5419708", "0.5400621", "0.5372838", "0.53656423", "0.5361936...
0.67398393
0
Compares data from the complementary feeding forms aggregate table to the the old child health monthly UCR table that current aggregate script uses
def compare_with_old_data_query(self): month = self.month.replace(day=1) return """ SELECT agg.case_id FROM "{child_health_monthly_ucr}" chm_ucr FULL OUTER JOIN "{new_agg_table}" agg ON chm_ucr.doc_id = agg.case_id AND chm_ucr.month = agg.month AND agg.state_id = chm_ucr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_with_old_data_query(self):\n month = self.month.replace(day=1)\n return \"\"\"\n SELECT agg.case_id\n FROM \"{child_health_monthly_ucr}\" chm_ucr\n FULL OUTER JOIN \"{new_agg_table}\" agg\n ON chm_ucr.doc_id = agg.case_id AND chm_ucr.month = agg.month AND agg.s...
[ "0.6838379", "0.604678", "0.58923805", "0.5890643", "0.57958573", "0.57689846", "0.5761231", "0.56214625", "0.5592634", "0.55771434", "0.5566593", "0.55371994", "0.5472558", "0.5435983", "0.54342383", "0.5417689", "0.54077804", "0.5406385", "0.53828216", "0.5379522", "0.52914...
0.67823964
1
Compares data from the complementary feeding forms aggregate table to the the old child health monthly UCR table that current aggregate script uses
def compare_with_old_data_query(self): month = self.month.replace(day=1) return """ SELECT agg.case_id FROM "{child_health_monthly_ucr}" chm_ucr FULL OUTER JOIN "{new_agg_table}" agg ON chm_ucr.doc_id = agg.case_id AND chm_ucr.month = agg.month AND agg.state_id = chm_ucr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_with_old_data_query(self):\n month = self.month.replace(day=1)\n return \"\"\"\n SELECT agg.case_id\n FROM \"{child_health_monthly_ucr}\" chm_ucr\n FULL OUTER JOIN \"{new_agg_table}\" agg\n ON chm_ucr.doc_id = agg.case_id AND chm_ucr.month = agg.month AND agg.s...
[ "0.6783546", "0.6048492", "0.58938086", "0.58922094", "0.57974744", "0.5769492", "0.5761662", "0.5621456", "0.5593944", "0.557752", "0.5567223", "0.5537434", "0.5473173", "0.5435588", "0.54341185", "0.5419138", "0.54077506", "0.54075027", "0.53836274", "0.5379219", "0.5291398...
0.6839381
0
Determine whether 2digit numbers num and den share a nonzero digit
def share_nonzero_digit(num, den): num_str = str(num) den_str = str(den) if "0" in num_str and "0" in den_str: return False return num_str[0] in den_str or num_str[1] in den_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exactly_two_same_digits(num):\n output = False\n digits = [int(i) for i in str(num)]\n for i, dig in enumerate(digits[:-2]):\n if i == 0:\n if dig == digits[i + 1] and dig != digits[i + 2]:\n output = True\n else:\n if (dig != digits[i - 1] \n ...
[ "0.66573215", "0.6440557", "0.63306004", "0.6274526", "0.6208678", "0.6078219", "0.60541683", "0.5835755", "0.5834841", "0.57886094", "0.57733285", "0.57666516", "0.5715078", "0.5679442", "0.56535006", "0.56464976", "0.5630134", "0.5628537", "0.562554", "0.5621497", "0.560313...
0.86455107
0
For two 2digit numbers num and den sharing a nonzero digit, determines whether these digits can cancel and maintain the value of num/den
def can_cancel(num, den): num_str = str(num) den_str = str(den) if num_str[0] == den_str[0] and den_str[1] != "0": return num / den == int(num_str[1]) / int(den_str[1]) elif num_str[0] == den_str[1] and den_str[0] != "0": return num / den == int(num_str[1]) / int(den_str[0]) elif num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_nonzero_digit(num, den):\n num_str = str(num)\n den_str = str(den)\n if \"0\" in num_str and \"0\" in den_str:\n return False\n return num_str[0] in den_str or num_str[1] in den_str", "def meets_criteria2(num):\n output = True\n if not exactly_two_same_digits(num):\n out...
[ "0.7365665", "0.6274122", "0.5855416", "0.5721313", "0.5691259", "0.5678599", "0.5591612", "0.5562553", "0.5546962", "0.55303293", "0.5479697", "0.54369766", "0.5415545", "0.5414511", "0.53287137", "0.5327776", "0.5327163", "0.53035915", "0.5295303", "0.5291806", "0.52812845"...
0.80766606
0
>>> copy_matrix([[1, 2], [3, 4]]) [[1, 2], [3, 4]] >>> copy_matrix([[1, 2, 3], [4, 5, 6]]) [[1, 2, 3], [4, 5, 6]] >>> copy_matrix([[1, 2], [3, 4], [5, 6], [7, 8]]) [[1, 2], [3, 4], [5, 6], [7, 8]] >>> m = [[1, 0, 0], [0, 2, 0], [0, 0, 3]] >>> copyofm = copy_matrix(m) >>> copyofm [[1, 0, 0], [0, 2, 0], [0, 0, 3]]
def copy_matrix(matrix): import numpy as np copy_of_m = np.copy(matrix) return copy_of_m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_matrix(M):\n rows = len(M)\n cols = len(M[0])\n\n MC = zeros_matrix(rows, cols)\n\n for i in range(rows):\n for j in range(rows):\n MC[i][j] = M[i][j]\n\n return MC", "def copy_matrix(M):\n # Section 1: Get matrix dimensions\n rows = len(M)\n cols = len(M[0])\n ...
[ "0.8298449", "0.8214234", "0.8180469", "0.78663003", "0.75801533", "0.7385383", "0.72383684", "0.6786781", "0.6672086", "0.6635798", "0.65468353", "0.6455198", "0.6453961", "0.64143115", "0.6184675", "0.61568964", "0.60692173", "0.6049272", "0.59903663", "0.5936255", "0.59289...
0.8602525
0
>>> m = [[0, 0], [0, 0]] >>> add_row(m) [[0, 0], [0, 0], [0, 0]] >>> n = [[3, 2, 5], [1, 4, 7]] >>> add_row(n) [[3, 2, 5], [1, 4, 7], [0, 0, 0]] >>> n [[3, 2, 5], [1, 4, 7]]
def add_row(matrix): import numpy as np shape = np.shape(matrix) if matrix is np.zeros(shape): return matrix.append(np.zeros(shape[0]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_row(matrix):\n\tl = len(matrix[0])\n\ttemp = matrix[:]\n\ttemp += [[0]*l]\n\treturn temp", "def add_row(M, a, i1, i2):\n P = zeros(*M.shape)\n P[i2, i1] = 1\n return M + a * P * M", "def _add_from_list(self, row) :\n\n data = [0]\n data.extend(row[:len(self.cols)-1])\n ...
[ "0.7709842", "0.7311569", "0.71244365", "0.68800277", "0.675526", "0.67047834", "0.6645247", "0.6593677", "0.6543051", "0.6494223", "0.64917475", "0.6435035", "0.6421862", "0.6370715", "0.6310367", "0.6286636", "0.6269933", "0.62677544", "0.6223627", "0.6218972", "0.61994624"...
0.77782136
0
>>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 0) 19 >>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 1) 22 >>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 0) 43 >>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 1) 50
def row_times_column(m1, row, m2, column): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_times_column(m1, row, m2, column):\n\tsum = 0\n\tfor i in range(len(m1[0])):\n\t\tsum += (m2[i][column] * m1[row][i])\n\treturn sum", "def row_times_column(m1, row, m2, column):\n\n sum = 0\n for index in range(len(m1)):\n product = m1[row][index] * m2[index][column]\n ...
[ "0.66947174", "0.63198614", "0.5935928", "0.58929735", "0.57411605", "0.55999076", "0.5556041", "0.5544652", "0.5541419", "0.5537987", "0.5346246", "0.5311233", "0.53036255", "0.52338445", "0.5193581", "0.51639426", "0.5156329", "0.5126123", "0.5088879", "0.50753665", "0.5059...
0.7637448
0
>>> matrix_mult([[1, 2], [3, 4]], [[5, 6], [7, 8]]) [[19, 22], [43, 50]] >>> matrix_mult([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 1], [2, 3]]) [[31, 19], [85, 55]] >>> matrix_mult([[7, 8], [9, 1], [2, 3]], [[1, 2, 3], [4, 5, 6]]) [[39, 54, 69], [13, 23, 33], [14, 19, 24]]
def matrix_mult(m1, m2): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_mult(m1, m2):\n\ttemp = []\n\tfor i in range(len(m1)):\n\t\te = []\n\t\tfor j in range(len(m2[0])):\n\t\t\te.append(row_times_column(m1,i,m2,j))\n\t\ttemp.append(e)\n\treturn temp", "def matrix_mult(m1, m2):\n output = []\n for rowIndex, row in enumerate(m1): #go through rows in m1\n new...
[ "0.7858192", "0.77751124", "0.772333", "0.7444002", "0.7204599", "0.7204599", "0.7172639", "0.7136324", "0.7018906", "0.69690716", "0.6952642", "0.6950437", "0.6914572", "0.68874365", "0.68290025", "0.6828844", "0.682187", "0.6774741", "0.6735177", "0.67212486", "0.6716886", ...
0.79986215
0
>>> m = [[3, 4, 6]] >>> transpose(m) [[3], [4], [6]] >>> m [3, 4, 6] >>> m = [[3, 4, 6], [1, 5, 9]] >>> transpose(m) [[3, 1], [4, 5], [6, 9]]
def transpose(m): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose():", "def transpose(matrix):\n return list(zip(*matrix))", "def transpose(matrix: List[List[float]]) -> List[List[float]]:\n return [[row[i] for row in matrix] for i in range(len(matrix[0]))]", "def transpose(lst):\n return list(zip(*lst))", "def transpose(M):\n # Section ...
[ "0.78545713", "0.78184783", "0.7762493", "0.76747763", "0.7595928", "0.75869876", "0.7554728", "0.74451244", "0.74381864", "0.74255687", "0.74158806", "0.7342939", "0.73413056", "0.728475", "0.72593224", "0.7243272", "0.72067064", "0.71994936", "0.7190132", "0.7161368", "0.71...
0.8309938
0
This method must be called immediately after the class is instantiated. It instantiates the serial interface and then performs auto pin discovery. It is intended for use by pymata3 applications that do not use asyncio coroutines directly.
def start(self): # check if user specified a socket transport if self.ip_address: self.socket = PymataSocket(self.ip_address, self.ip_port, self.loop) self.loop.run_until_complete((self.socket.start())) # set the read and write handles self.read = self.so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def start_aio(self):\n\n # pick the desired transport and then setup read and write to\n # point to the correct method for the transport\n\n # check if user specified a socket transport\n if self.ip_address:\n self.socket = PymataSocket(self.ip_address, self.ip_port, se...
[ "0.71163946", "0.6593586", "0.65706074", "0.6442949", "0.63980585", "0.6393315", "0.6241023", "0.6230204", "0.6211324", "0.6196378", "0.61707497", "0.6125618", "0.61022544", "0.6092333", "0.60747683", "0.6067317", "0.60137165", "0.6010233", "0.5977642", "0.5977642", "0.597558...
0.6983214
1
This method must be called immediately after the class is instantiated. It instantiates the serial interface and then performs auto pin discovery. It is intended for use by applications that directly uses asyncio.
async def start_aio(self): # pick the desired transport and then setup read and write to # point to the correct method for the transport # check if user specified a socket transport if self.ip_address: self.socket = PymataSocket(self.ip_address, self.ip_port, self.loop) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n\n # check if user specified a socket transport\n if self.ip_address:\n self.socket = PymataSocket(self.ip_address, self.ip_port, self.loop)\n self.loop.run_until_complete((self.socket.start()))\n # set the read and write handles\n self.re...
[ "0.69000673", "0.66702867", "0.66009367", "0.6561331", "0.63025564", "0.6225096", "0.6225094", "0.6216128", "0.6173869", "0.61725795", "0.61575854", "0.6135195", "0.6128369", "0.6096889", "0.6096889", "0.60782295", "0.5992541", "0.5987086", "0.5949867", "0.5928716", "0.586887...
0.7137012
0
Retrieve the last data update for the specified analog pin.
async def analog_read(self, pin): return self.analog_pins[pin].current_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sensor_last_update(self):\n return self._cam.get_attributes(self._sensor, self._channel)[3]", "async def digital_read(self, pin):\n return self.digital_pins[pin].current_value", "def analog_read(self, pin):\n return self.analog_pins_analog_numbering[pin].current_value", "def getLast...
[ "0.65825766", "0.6400659", "0.6345518", "0.6227712", "0.6153592", "0.6077592", "0.6077592", "0.60370755", "0.59376067", "0.58646375", "0.58646375", "0.5815892", "0.58153135", "0.58153135", "0.5793698", "0.5758885", "0.57250863", "0.5721714", "0.5677745", "0.56348294", "0.5569...
0.64963365
1
Retrieve the last data update for the specified digital pin.
async def digital_read(self, pin): return self.digital_pins[pin].current_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLastUpdate():\n swDB = switchdb.DB()\n lastupdate = swDB.getLastUpdate()\n swDB.close()\n return lastupdate", "async def get_digital_latch_data(self, pin):\n key = 'D' + str(pin)\n if key in self.latch_map:\n entry = self.latch_map.get(key)\n return entry\n ...
[ "0.65765524", "0.62324864", "0.62324864", "0.6122622", "0.6111175", "0.60162896", "0.6008003", "0.5966524", "0.5966221", "0.5951968", "0.5920099", "0.5908105", "0.58184767", "0.58184767", "0.577372", "0.5771797", "0.570966", "0.570877", "0.5707156", "0.5707156", "0.56833774",...
0.6268462
1
Disables analog reporting for a single analog pin.
async def disable_analog_reporting(self, pin): command = [PrivateConstants.REPORT_ANALOG + pin, PrivateConstants.REPORTING_DISABLE] await self._send_command(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_analog_reporting(self, pin):\n self._analog_pins_directly[pin].disable_analog_reporting()", "def disable_reporting(self):\n if self.type == ANALOG:\n self.reporting = False\n msg = chr(REPORT_ANALOG + self.pin_number)\n msg += chr(0)\n self.bo...
[ "0.8604569", "0.7940126", "0.71943736", "0.707542", "0.64645624", "0.63404584", "0.6306555", "0.6291507", "0.6278442", "0.62176526", "0.6186651", "0.61219954", "0.6117424", "0.608285", "0.60789824", "0.6059121", "0.604769", "0.60403407", "0.60292375", "0.60234505", "0.6004056...
0.8465127
1
Enables analog reporting. By turning reporting on for a single pin,
async def enable_analog_reporting(self, pin): command = [PrivateConstants.REPORT_ANALOG + pin, PrivateConstants.REPORTING_ENABLE] await self._send_command(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_analog_reporting(self, pin):\n self._analog_pins_directly[pin].enable_analog_reporting()", "def enable_reporting(self):\n if self.mode is not INPUT:\n raise IOError, \"%s is not an input and can therefore not report\" % self\n if self.type == ANALOG:\n self.r...
[ "0.8712631", "0.7771436", "0.73261374", "0.7302031", "0.7236988", "0.6837426", "0.6793905", "0.67593735", "0.66568065", "0.661", "0.6600416", "0.6540425", "0.6515099", "0.6506523", "0.6487618", "0.6487618", "0.6478574", "0.64607745", "0.6433212", "0.6299081", "0.6221484", "...
0.847114
1
This method requests and returns a Firmata capability query report
async def get_capability_report(self): if self.query_reply_data.get( PrivateConstants.CAPABILITY_QUERY) is None: await self._send_sysex(PrivateConstants.CAPABILITY_QUERY, None) while self.query_reply_data.get( PrivateConstants.CAPABILITY_RESPONSE) is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capability_response(self, data):\n self.capability_query_results = data", "def query_upgrade_capability(self):\n self.response = self.request('GET', self.capability_endpoint, \"\")\n self.log.debug(self.response.status)\n response = self.response.read()\n capability_schema ...
[ "0.61262965", "0.59493124", "0.5944212", "0.5829884", "0.5702148", "0.55688643", "0.55079657", "0.5502304", "0.541631", "0.5401894", "0.5398057", "0.5387376", "0.53791535", "0.53516006", "0.53400385", "0.53378177", "0.53325176", "0.531575", "0.53117085", "0.5309986", "0.53071...
0.72510535
0
This method retrieves a pin state report for the specified pin
async def get_pin_state(self, pin): pin_list = [pin] await self._send_sysex(PrivateConstants.PIN_STATE_QUERY, pin_list) while self.query_reply_data.get( PrivateConstants.PIN_STATE_RESPONSE) is None: await asyncio.sleep(self.sleep_tune) pin_state_report = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pin_state(self, pin):\n port_num = self._convert_pin_port(pin)\n if port_num:\n value = gpio.input(port_num)\n return value", "def digital_read(self, pin):\n self._digital_pins_directly[pin].PinStateQuery()\n return self.digital_pins[pin].current_value", "d...
[ "0.6511629", "0.60029906", "0.58016855", "0.56316274", "0.5597432", "0.5597432", "0.5549708", "0.5545232", "0.5522103", "0.54827315", "0.54827315", "0.53601295", "0.53596234", "0.5331412", "0.5331412", "0.52997583", "0.5266582", "0.52544177", "0.5231351", "0.52120215", "0.517...
0.7929277
0
This method retrieves the PyMata version number
async def get_pymata_version(self): return PrivateConstants.PYMATA_VERSION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n return magpy.get_version()", "def getVersion(self):\n return self.get('Version', type=\"numeric\")", "def get_version():\n return 1", "def _get_version(self):", "def get_version(self):\r\n\r\n return self.versions[0].number", "def get_version(self):\n r...
[ "0.75531626", "0.74852437", "0.7445768", "0.74049973", "0.73910284", "0.7383257", "0.7347241", "0.7345715", "0.7327094", "0.73089445", "0.7298647", "0.72773886", "0.7268581", "0.726314", "0.7243733", "0.72389406", "0.7225985", "0.7192747", "0.7187615", "0.71560353", "0.714933...
0.7615884
0
This method requests the read of an i2c device. Results are retrieved by a call to i2c_get_read_data(). or by callback. If a callback method is provided, when data is received from the device it will be sent to the callback method. Some devices require that transmission be restarted (e.g. MMA8452Q accelerometer). Use C...
async def i2c_read_request(self, address, register, number_of_bytes, read_type, cb=None, cb_type=None): if address not in self.i2c_map: # self.i2c_map[address] = [None, cb] self.i2c_map[address] = {'value': None, 'callback': cb, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def i2c_read_request(self, address, register, number_of_bytes,\n read_type, cb=None):\n if address not in self.i2c_map:\n self.i2c_map[address] = {'value': None, 'callback': cb}\n if register is None:\n data = [address, read_type, number_of_by...
[ "0.7295235", "0.67788655", "0.6382772", "0.61653256", "0.6076552", "0.607234", "0.58719695", "0.58615494", "0.5793012", "0.57696265", "0.56404847", "0.5594884", "0.5533551", "0.5533551", "0.55030257", "0.5429009", "0.5412197", "0.5409701", "0.53928447", "0.52927303", "0.52845...
0.73515487
0
This method will call the Tone library for the selected pin. It requires FirmataPlus to be loaded onto the arduino If the tone command is set to TONE_TONE, then the specified tone will be played. Else, if the tone command is TONE_NO_TONE, then any currently playing tone will be disabled.
async def play_tone(self, pin, tone_command, frequency, duration): # convert the integer values to bytes if tone_command == Constants.TONE_TONE: # duration is specified if duration: data = [tone_command, pin, frequency & 0x7f, (frequency >> 7) & 0x7f, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def play_tone(self, pin, tone_command, frequency=440, duration=0):\n if tone_command == Constants.TONE_TONE:\n self.Tone.play_tone(pin, frequency, duration)\n if tone_command == Constants.TONE_NO_TONE:\n self.Tone.stop_tone(pin)", "def play_tone(self, frequency, duration...
[ "0.7706002", "0.67078865", "0.6423425", "0.5833857", "0.5806098", "0.5686568", "0.56307465", "0.54618907", "0.5385669", "0.53443617", "0.5292306", "0.5264872", "0.52043027", "0.5185597", "0.5120411", "0.51074725", "0.510529", "0.50909114", "0.5087473", "0.50763726", "0.506121...
0.73661745
1
Send a Sysex reset command to the arduino
async def send_reset(self): try: await self._send_command([PrivateConstants.SYSTEM_RESET]) except RuntimeError: exit(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def send_reset(self):\n try:\n await self._send_command([PrivateConstants.SYSTEM_RESET])\n except RuntimeError:\n exit(0) #keep this??", "def reset(self):\n # The camera will give no response to this command\n self._serial_io('\\x55\\x99\\x66\\x11', None)\n...
[ "0.71468157", "0.7040399", "0.6741701", "0.66468793", "0.663851", "0.65718126", "0.65643877", "0.6563338", "0.65588856", "0.6473431", "0.6439296", "0.64391494", "0.63362795", "0.6323157", "0.6318804", "0.62822026", "0.62608296", "0.62436527", "0.6213048", "0.620785", "0.61950...
0.7048984
1
This method sends the desired sampling interval to Firmata.
async def set_sampling_interval(self, interval): data = [interval & 0x7f, (interval >> 7) & 0x7f] await self._send_sysex(PrivateConstants.SAMPLING_INTERVAL, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_data(self, no_of_samples, interval):\r\n\r\n #tempory storage while function is completing\r\n temp_return_list = []\r\n\r\n #colec\r\n for i in range(0,no_of_samples):\r\n\r\n print(i)\r\n sensor_value = self.sen.get_sensor_value()\r\n\r\n te...
[ "0.59516317", "0.5772978", "0.5681881", "0.56568575", "0.5604709", "0.55981964", "0.55600184", "0.55416715", "0.5455843", "0.53845453", "0.53792423", "0.537313", "0.52877396", "0.5257402", "0.5250945", "0.5244629", "0.52391046", "0.52388173", "0.52294207", "0.52244127", "0.52...
0.6949252
0
Configure the pins,ping interval and maximum distance for an HCSR04 type device. Single pin configuration may be used. To do so, set both the trigger and echo pins to the same value. Up to a maximum of 6 SONAR devices is supported If the maximum is exceeded a message is sent to the console and the request is ignored.
async def sonar_config(self, trigger_pin, echo_pin, cb=None, ping_interval=50, max_distance=200, cb_type=None): # if there is an entry for the trigger pin in existence, just exit if trigger_pin in self.active_sonar_map: return if max_distance > 200: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def sonar_config(self, trigger_pin, echo_pin, cb=None,\n ping_interval=50, max_distance=350):\n # if there is an entry for the trigger pin in existence, just exit\n if trigger_pin in self.active_sonar_map:\n return\n\n if max_distance > 350:\n ...
[ "0.6125771", "0.6049606", "0.57593125", "0.5654023", "0.5633545", "0.5626007", "0.5621324", "0.56150955", "0.5613043", "0.5604584", "0.556747", "0.5542686", "0.55393195", "0.5504682", "0.5501008", "0.5480802", "0.5460419", "0.54304427", "0.543029", "0.5428125", "0.54065293", ...
0.60872644
1
Retrieve Ping (HCSR04 type) data. The data is presented as a dictionary. The 'key' is the trigger pin specified in sonar_config() and the 'data' is the current measured distance (in centimeters) for that pin. If there is no data, the value is set to None.
async def sonar_data_retrieve(self, trigger_pin): # sonar_pin_entry = self.active_sonar_map[pin] sonar_pin_entry = self.active_sonar_map.get(trigger_pin) value = sonar_pin_entry[1] return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sonar_data(self, data):\n val = int((data[self.MSB] << 7) + data[self.LSB])\n pin_number = data[0]\n with self.pymata.data_lock:\n sonar_pin_entry = self.active_sonar_map[pin_number]\n # also write it into the digital response table\n self.digital_response_...
[ "0.5757846", "0.56631297", "0.53100425", "0.5292773", "0.5284556", "0.49676174", "0.4843962", "0.47279146", "0.46820545", "0.46342728", "0.45987862", "0.45896164", "0.4588749", "0.4586827", "0.45725977", "0.45540884", "0.45494246", "0.45154992", "0.45147", "0.4513208", "0.449...
0.5717699
1
Move a stepper motor for the number of steps at the specified speed This is a FirmataPlus feature.
async def stepper_step(self, motor_speed, number_of_steps): if number_of_steps > 0: direction = 1 else: direction = 0 abs_number_of_steps = abs(number_of_steps) data = [PrivateConstants.STEPPER_STEP, motor_speed & 0x7f, (motor_speed >> 7) & 0x7f, (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_motor_speed(self, speed=0.0):\r\n self.target_speed = speed", "def move(self, direction, speed):\n self.motor_A(direction, speed)\n self.motor_B(direction, speed)", "def move_set_speed(self, speed):\n # self.motor_set_speed(MOTOR_LEFT, speed)\n # self.motor_set_speed(...
[ "0.74356925", "0.7422742", "0.7410331", "0.7326264", "0.72111297", "0.7129122", "0.7068842", "0.70402956", "0.69775903", "0.69327223", "0.6924832", "0.6924832", "0.6789533", "0.6779411", "0.67299414", "0.6682143", "0.66640556", "0.660605", "0.65840495", "0.65477204", "0.65390...
0.7768489
0
Initialize Pixy and enable Pixy block reporting. This is a FirmataPlusRB feature.
async def pixy_init(self, max_blocks=5, cb=None, cb_type=None): if cb: self.digital_pins[PrivateConstants.PIN_PIXY_MOSI].cb = cb # Pixy uses SPI. Pin 11 is MOSI. if cb_type: self.digital_pins[PrivateConstants.PIN_PIXY_MOSI].cb_type = cb_type data = [PrivateConstants.PIX...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def pixy_init(self, max_blocks=5, cb=None):\n if cb:\n self.digital_pins[PrivateConstants.PIN_PIXY_MOSI].cb = cb # Pixy uses SPI. Pin 11 is MOSI.\n data = [PrivateConstants.PIXY_INIT, max_blocks & 0x7f]\n await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)", "async ...
[ "0.6760806", "0.59936345", "0.597955", "0.5381144", "0.5279574", "0.5209057", "0.5183096", "0.5175518", "0.517442", "0.51362026", "0.5119532", "0.5109712", "0.5055435", "0.50499576", "0.50488627", "0.5032731", "0.50140387", "0.5004947", "0.49803203", "0.49576804", "0.49539122...
0.66810155
1
Sends the setServos Pixy command. This method sets the pan/tilt servos that are plugged into Pixy's two servo ports.
async def pixy_set_servos(self, s0, s1): data = [PrivateConstants.PIXY_SET_SERVOS, s0 & 0x7f, (s0 >> 7) & 0x7f, s1 & 0x7f, (s1 >> 7) & 0x7f] await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def pixy_set_servos(self, s0, s1):\n data = [PrivateConstants.PIXY_SET_SERVOS, s0 & 0x7f, (s0 >> 7) & 0x7f, s1 & 0x7f, (s1 >> 7) & 0x7f]\n await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)", "def set_all_servos(name,servo0,servo1,servo2,servo3): #TODO How does the servos specifically...
[ "0.7166935", "0.57404697", "0.5736213", "0.5485446", "0.5378608", "0.53507066", "0.5176128", "0.51402175", "0.50661147", "0.50440335", "0.50277877", "0.5025785", "0.4961419", "0.49297363", "0.49067754", "0.48171094", "0.48006025", "0.4785658", "0.47832116", "0.47671235", "0.4...
0.7177235
0
Sends the setBrightness Pixy command. This method sets the brightness (exposure) of Pixy's camera.
async def pixy_set_brightness(self, brightness): data = [PrivateConstants.PIXY_SET_BRIGHTNESS, brightness & 0x7f, (brightness >> 7) & 0x7f] await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def pixy_set_brightness(self, brightness):\n data = [PrivateConstants.PIXY_SET_BRIGHTNESS, brightness & 0x7f, (brightness >> 7) & 0x7f]\n await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)", "def setBrightness(self, brightness):\n raise NotImplementedError", "def set_brightne...
[ "0.75010604", "0.6547459", "0.65117484", "0.6366877", "0.63317287", "0.6068381", "0.6000904", "0.5956512", "0.5956134", "0.58914024", "0.58631456", "0.5812762", "0.580074", "0.57600796", "0.5739679", "0.571499", "0.5547261", "0.5537897", "0.5404324", "0.5379203", "0.5364985",...
0.75015837
0
Sends the setLed Pixy command. This method sets the RGB LED on front of Pixy.
async def pixy_set_led(self, r, g, b): data = [PrivateConstants.PIXY_SET_LED, r & 0x7f, (r >> 7) & 0x7f, g & 0x7f, (g >> 7) & 0x7f, b & 0x7f, (b >> 7) & 0x7f] await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def pixy_set_led(self, r, g, b):\n data = [PrivateConstants.PIXY_SET_LED, r & 0x7f, (r >> 7) & 0x7f, g & 0x7f, (g >> 7) & 0x7f, b & 0x7f,\n (b >> 7) & 0x7f]\n await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)", "def set_led(self, *args, **kw):\n return self.exec...
[ "0.68118143", "0.6465637", "0.61987525", "0.5923797", "0.5822135", "0.5785132", "0.5775514", "0.57408094", "0.5733527", "0.5719866", "0.56912297", "0.56309223", "0.5543735", "0.5513265", "0.5509602", "0.54750246", "0.54707825", "0.5467716", "0.5426789", "0.5419386", "0.540944...
0.6840588
0
This is a private message handler method. It is a message handler for the analog mapping response message
async def _analog_mapping_response(self, data): self.query_reply_data[PrivateConstants.ANALOG_MAPPING_RESPONSE] = \ data[1:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analog_mapping_response(self, data):\n self.analog_mapping_query_results = data", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def response_handling(self) -> global___Snippet.SimpleResponseHandling:", "def receiverMapping():", "def _mapping(self):\n return [...
[ "0.7251089", "0.6088922", "0.6088922", "0.60387474", "0.5987247", "0.5920948", "0.5901717", "0.5834299", "0.5776076", "0.57640946", "0.57337976", "0.5717069", "0.5717069", "0.57051957", "0.5700141", "0.5700141", "0.56915224", "0.5669859", "0.56426656", "0.5629464", "0.5629464...
0.7727783
0
This is a private message handler method. It is a message handler for capability report responses.
async def _capability_response(self, data): self.query_reply_data[PrivateConstants.CAPABILITY_RESPONSE] = data[1:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_capability_report(self):\n if self.query_reply_data.get(\n PrivateConstants.CAPABILITY_QUERY) is None:\n await self._send_sysex(PrivateConstants.CAPABILITY_QUERY, None)\n while self.query_reply_data.get(\n PrivateConstants.CAPABILITY_RESP...
[ "0.69483674", "0.69483674", "0.6900844", "0.61221385", "0.60776806", "0.606412", "0.60401744", "0.59805", "0.59362584", "0.5876952", "0.58415097", "0.57425404", "0.5697683", "0.5649355", "0.5546863", "0.5544755", "0.5439381", "0.5431011", "0.54219556", "0.54014605", "0.538772...
0.7361442
0
This is a private message handler method. It handles pixy data messages.
async def _pixy_data(self, data): if len(self.digital_pins) < PrivateConstants.PIN_PIXY_MOSI: # Pixy data sent before board finished pin discovery. # print("Pixy data sent before board finished pin discovery.") return # strip off sysex start and end data = da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _pixy_data(self, data):\n if len(self.digital_pins) < PrivateConstants.PIN_PIXY_MOSI:\n # Pixy data sent before board finished pin discovery.\n # print(\"Pixy data sent before board finished pin discovery.\")\n return\n\n # strip off sysex start and end\n ...
[ "0.64040476", "0.61797094", "0.5982143", "0.59456927", "0.5862708", "0.5829233", "0.57537377", "0.5749705", "0.57228833", "0.57209736", "0.57071275", "0.5691238", "0.5681294", "0.56770635", "0.5673345", "0.5666609", "0.5661415", "0.56375694", "0.5627066", "0.5615776", "0.5579...
0.6449754
0
This is a private message handler method. It handles replies to i2c_read requests. It stores the data for each i2c device address in a dictionary called i2c_map. The data may be retrieved via a polling call to i2c_get_read_data(). It a callback was specified in pymata.i2c_read, the raw data is sent through the callback
async def _i2c_reply(self, data): # remove the start and end sysex commands from the data data = data[1:-1] reply_data = [] # reassemble the data from the firmata 2 byte format address = (data[0] & 0x7f) + (data[1] << 7) # if we have an entry in the i2c_map, proceed ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i2c_reply(self, data):\n\n reply_data = []\n address = (data[0] & 0x7f) + (data[1] << 7)\n register = data[2] & 0x7f + data[3] << 7\n reply_data.append(register)\n for i in range(4, len(data), 2):\n data_item = (data[i] & 0x7f) + (data[i + 1] << 7)\n rep...
[ "0.7382086", "0.709698", "0.6192356", "0.5992547", "0.5992547", "0.58835506", "0.5771722", "0.5639778", "0.561872", "0.55239606", "0.5521145", "0.55118227", "0.54888433", "0.540574", "0.5368104", "0.52976686", "0.5287446", "0.52108765", "0.51815397", "0.517089", "0.5166512", ...
0.71283174
1
This is a private message handler method. It handles pin state query response messages.
async def _pin_state_response(self, data): self.query_reply_data[PrivateConstants.PIN_STATE_RESPONSE] = data[1:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pin_state_response(self, data):\n self.last_pin_query_results = data", "async def get_pin_state(self, pin):\n pin_list = [pin]\n await self._send_sysex(PrivateConstants.PIN_STATE_QUERY, pin_list)\n while self.query_reply_data.get(\n PrivateConstants.PIN_STATE_RESPON...
[ "0.7019445", "0.61411095", "0.61411095", "0.59948134", "0.5572984", "0.5517564", "0.5489521", "0.53963244", "0.5266883", "0.5214355", "0.5194712", "0.51208454", "0.50938094", "0.5088614", "0.5086233", "0.5060977", "0.5055409", "0.5055333", "0.50538427", "0.5039635", "0.503124...
0.7383075
0
This is a private message handler method. This method handles the sysex 'report firmware' command sent by Firmata (0x79). It assembles the firmware version by concatenating the major and minor version number components and the firmware identifier into a string. e.g. "2.3 StandardFirmata.ino"
async def _report_firmware(self, sysex_data): # first byte after command is major number major = sysex_data[1] version_string = str(major) # next byte is minor number minor = sysex_data[2] # append a dot to major number version_string += '.' # append mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _report_firmware(self, sysex_data):\n # first byte after command is major number\n firmware_report_iterator = iter(sysex_data)\n\n major = sysex_data[1]\n version_string = str(major)\n\n # next byte is minor number\n minor = sysex_data[2]\n\n # append a do...
[ "0.8162732", "0.6967436", "0.6458658", "0.6379321", "0.63297653", "0.627884", "0.627884", "0.6274238", "0.62337196", "0.62273055", "0.6120975", "0.60681766", "0.59676677", "0.5935455", "0.59354085", "0.5932939", "0.5840619", "0.58101875", "0.5808295", "0.579443", "0.5742327",...
0.8201452
0
This is a private message handler method. This method reads the following 2 bytes after the report version command (0xF9 non sysex). The first byte is the major number and the second byte is the minor number.
async def _report_version(self): # get next two bytes major = await self.read() version_string = str(major) minor = await self.read() version_string += '.' version_string += str(minor) self.query_reply_data[PrivateConstants.REPORT_VERSION] = version_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _report_firmware(self, sysex_data):\n # first byte after command is major number\n major = sysex_data[1]\n version_string = str(major)\n\n # next byte is minor number\n minor = sysex_data[2]\n\n # append a dot to major number\n version_string += '.'\n\n ...
[ "0.6939373", "0.678197", "0.65643084", "0.6553498", "0.65354437", "0.65262014", "0.64283055", "0.6268968", "0.6168352", "0.6109511", "0.6087746", "0.60797924", "0.60410786", "0.6039331", "0.60295236", "0.6014963", "0.6000962", "0.59347993", "0.5934491", "0.59248865", "0.59102...
0.74486923
0
This is a private utility method. When a data change message is received this method checks to see if latching needs to be processed
async def _check_latch_data(self, key, data): process = False latching_entry = self.latch_map.get(key) if latching_entry[Constants.LATCH_STATE] == Constants.LATCH_ARMED: # Has the latching criteria been met if latching_entry[Constants.LATCHED_THRESHOLD_TYPE] == \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _async_process_data(self):\n _LOGGER.debug(\"Update switch called\")\n\n data = self._api.get_device_data(self._dev_id)\n\n if not data:\n _LOGGER.error(\"Received no data for device %s\", self._name)\n self.async_write_ha_state()\n return\n\n if \"r...
[ "0.6217661", "0.6097379", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.60719794", "0.6039081", "0.6039081", "0.6039081", "...
0.69292855
0
This is a private utility method. This method attempts to discover the com port that the arduino is connected to.
def _discover_port(self): # if MAC get list of ports if sys.platform.startswith('darwin'): locations = glob.glob('/dev/tty.[usb*]*') locations = glob.glob('/dev/tty.[wchusb*]*') + locations locations.append('end') # for everyone else, here is a list of possibl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_arduino(portsfound):\r\n comPort = 'None'\r\n num_of_connection = len(portsfound)\r\n\r\n for i in range(0, num_of_connection):\r\n port = foundPorts[i]\r\n cnvt_str_port = str(port)\r\n\r\n if 'ttyACM' in cnvt_str_port:\r\n splitPort = cnvt_str_port.split(' ')\r\n...
[ "0.758644", "0.70853215", "0.6920808", "0.69023013", "0.6754268", "0.6728616", "0.6641698", "0.6590198", "0.65183216", "0.6506617", "0.6411967", "0.63986033", "0.63902265", "0.6377464", "0.6366309", "0.6349884", "0.63397175", "0.6328939", "0.62883455", "0.6233208", "0.6199125...
0.80911547
0
This is a private utility method. This method formats a capability report if the user wishes to send it to the console. If log_output = True, no output is generated
def _format_capability_report(self, data): if self.log_output: return else: pin_modes = {0: 'Digital_Input', 1: 'Digital_Output', 2: 'Analog', 3: 'PWM', 4: 'Servo', 5: 'Shift', 6: 'I2C', 7: 'One Wire', 8...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_capability_report(self, data):\n\n\n\n pin_modes = {0: 'Digital_Input', 1: 'Digital_Output',\n 2: 'Analog', 3: 'PWM', 4: 'Servo',\n 5: 'Shift', 6: 'I2C', 7: 'One Wire',\n 8: 'Stepper', 9: 'Encoder'}\n x = 0\n pin = 0\n\n ...
[ "0.6574679", "0.60353345", "0.55147713", "0.5298651", "0.5298651", "0.52799845", "0.5188249", "0.5148564", "0.5145264", "0.5035268", "0.50189024", "0.5014753", "0.4984658", "0.49684343", "0.4942429", "0.4940837", "0.49348196", "0.49271014", "0.49147138", "0.49006274", "0.4895...
0.73515016
0
This is a private utility method. This method process latching events and either returns them via callback or stores them in the latch map
async def _process_latching(self, key, latching_entry): if latching_entry[Constants.LATCH_CALLBACK]: # auto clear entry and execute the callback if latching_entry[Constants.LATCH_CALLBACK_TYPE]: await latching_entry[Constants.LATCH_CALLBACK] \ ([key, l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _process_latching(self, key, latching_entry):\n if latching_entry[Constants.LATCH_CALLBACK]:\n # auto clear entry and execute the callback\n if inspect.iscoroutinefunction(latching_entry[Constants.LATCH_CALLBACK]):\n await latching_entry[Constants.LATCH_CALLBAC...
[ "0.6844069", "0.5644246", "0.5523856", "0.52995974", "0.5293641", "0.52830917", "0.52091", "0.52091", "0.5188061", "0.51579756", "0.5072822", "0.5061297", "0.50586766", "0.5039795", "0.50365466", "0.5017518", "0.50173944", "0.49957976", "0.4993239", "0.49874157", "0.49737704"...
0.68799573
0
This is a private utility method. This method sends a sysex command to Firmata.
async def _send_sysex(self, sysex_command, sysex_data=None): if not sysex_data: sysex_data = [] # convert the message command and data to characters sysex_message = chr(PrivateConstants.START_SYSEX) sysex_message += chr(sysex_command) if len(sysex_data): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_sysex(self, sysex_cmd, data=[]):\n self.sp.write(chr(START_SYSEX))\n self.sp.write(chr(sysex_cmd))\n for byte in data:\n try:\n byte = chr(byte)\n except TypeError:\n pass # byte is already a chr\n except ValueError:\n ...
[ "0.83693504", "0.80046785", "0.7972194", "0.6708084", "0.61576617", "0.6000401", "0.582682", "0.58154523", "0.58037454", "0.5469651", "0.5426235", "0.5412461", "0.54029006", "0.53834355", "0.5382216", "0.5361147", "0.52801985", "0.52750903", "0.5273967", "0.52703816", "0.5223...
0.8119734
1
This is a private utility method. This method accumulates the requested number of bytes and then returns the full command
async def _wait_for_data(self, current_command, number_of_bytes): while number_of_bytes: next_command_byte = await self.read() current_command.append(next_command_byte) number_of_bytes -= 1 return current_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_amt(self, byte_count):\n full_msg = bytearray()\n while len(full_msg) < byte_count:\n block = self.request.recv(byte_count - len(full_msg))\n full_msg.extend(block)\n return full_msg", "async def _wait_for_data(self, current_command, number_of_bytes):\n ...
[ "0.64410955", "0.6405288", "0.63253003", "0.6148621", "0.6095113", "0.5998339", "0.5998339", "0.5959274", "0.5931544", "0.5906557", "0.5906557", "0.5788714", "0.5678541", "0.56758416", "0.56406176", "0.5639338", "0.5625114", "0.56148255", "0.5607164", "0.5571484", "0.55390793...
0.64290196
1
Mark a view function as excluded from CommonMiddleware's APPEND_SLASH redirection.
def no_append_slash(view_func): # view_func.should_append_slash = False would also work, but decorators are # nicer if they don't have side effects, so return a new function. @wraps(view_func) def wrapper_view(*args, **kwargs): return view_func(*args, **kwargs) wrapper_view.should_append_sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_middleware_exempt(view_func):\n view_func._auth_middleware_exempt = True\n return view_func", "def not_authenticated(func):\n def decorated(request, *args, **kwargs):\n if request.user.is_authenticated():\n return HttpResponseRedirect(get_next_url(request))\n return fun...
[ "0.67868835", "0.61415625", "0.6090154", "0.608462", "0.60518026", "0.6001027", "0.5968888", "0.585604", "0.56919193", "0.5690675", "0.56773543", "0.5667275", "0.56316024", "0.56260526", "0.56234634", "0.55628556", "0.5547317", "0.5433944", "0.54051054", "0.5391973", "0.53919...
0.71308184
0
Extracts information contained in the extended xyz format
def extended_xyz_parse(xyz_d): s_properties = ['rot_A', 'rot_B', 'rot_C', 'dipole', 'polarizability', 'homo', 'lumo', 'band_gap', 'ese...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_xyz(filename):\n #print('Reading geom from:'),filename\n atoms = []\n coordinates = []\n\t\n xyz = open(filename)\n n_atoms = int(xyz.readline())\n title = xyz.readline()\n for line in xyz:\n\tif len(line.strip()) == 0:\n\t\tpass\n\t\tbreak\t\n\tatom,x,y,z = line.split()\n\tatoms.appe...
[ "0.67689586", "0.67011", "0.6471105", "0.6410974", "0.64043325", "0.636045", "0.61963445", "0.6127615", "0.60656416", "0.60302293", "0.59963924", "0.59505785", "0.59189105", "0.5914801", "0.5892642", "0.58702075", "0.58659744", "0.58460426", "0.582424", "0.5774749", "0.577015...
0.67525584
1
Generates a coulomb matrix representing the ASE atoms object
def to_coulomb_m(mol, max_size=23): mol = to_ase(mol) atomic_nos = mol.get_atomic_numbers() positions = mol.get_positions() bohr_positions = positions/Bohr no_atoms = len(mol) coulomb_m = np.zeros([no_atoms, no_atoms]) for i in range(no_atoms): for j in range(no_atoms): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_coulomb_matrix(molecule, distance_matrix):\n num_atoms = molecule.GetNumAtoms()\n charges = [atom.GetAtomicNum() for atom in molecule.GetAtoms()]\n coulomb = np.zeros((num_atoms, num_atoms))\n for i in range(num_atoms):\n for j in range(num_atoms):\n if i == j:\n ...
[ "0.59630764", "0.58973473", "0.58871275", "0.5862457", "0.585697", "0.5855241", "0.5825474", "0.57585335", "0.57366407", "0.56773067", "0.5670541", "0.5631808", "0.56276864", "0.5618002", "0.55969375", "0.55943376", "0.5586808", "0.55834883", "0.55511093", "0.55362296", "0.55...
0.6041042
0
Generates a coulomb matrix representing the molecule passed in mol if an additional array is passed this is added on to the end of the vector
def to_coulomb_vec(mol, max_size=23, addition=None): cm = to_coulomb_m(mol, max_size=max_size) cm_vec = cm[np.tril_indices(cm.shape[0])] if addition: cm_vec = np.hstack([cm_vec, addition]) return cm_vec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_coulomb_m(mol, max_size=23):\n mol = to_ase(mol)\n atomic_nos = mol.get_atomic_numbers()\n positions = mol.get_positions()\n bohr_positions = positions/Bohr\n no_atoms = len(mol)\n coulomb_m = np.zeros([no_atoms, no_atoms])\n\n for i in range(no_atoms):\n for j in range(no_atoms)...
[ "0.6789167", "0.63536084", "0.5775927", "0.5653269", "0.5629641", "0.56094027", "0.55563414", "0.5516466", "0.5465739", "0.5459852", "0.5437262", "0.5416851", "0.5403486", "0.53986746", "0.5390864", "0.5390212", "0.5347653", "0.5345592", "0.5343905", "0.5343439", "0.53386724"...
0.7132331
0
Converts an mdtraj trajectory object corresponding to snapshots from an openMM simulation to a list of ASE objects each corresponding to one frame
def to_ase_frames(traj): unit_conversion = u.nanometer.conversion_factor_to(u.angstrom) symbols = ([a.element.symbol for a in traj.topology.atoms]) sim_positions = [frame_coords*unit_conversion for frame_coords in traj.xyz] frames = [] for frame_positions in sim_positions: fra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argoverse_get_instance(lines, file_name, args):\n\n global max_vector_num\n vector_num = 0\n id2info = {}\n mapping = {}\n mapping['file_name'] = file_name\n\n for i, line in enumerate(lines):\n\n line = line.strip().split(',')\n if i == 0:\n mapping['start_time'] = f...
[ "0.52816474", "0.5176818", "0.51395714", "0.51279366", "0.5074173", "0.49652937", "0.4954189", "0.4937051", "0.4936363", "0.49134052", "0.49124593", "0.48723468", "0.48602757", "0.48577738", "0.4857536", "0.48378316", "0.48365033", "0.48328593", "0.48321652", "0.4811556", "0....
0.6662292
0
Generated ensemble of solvated molecules
def generate_solvated_ensemble(orig_mol, mol_id, solvent_mol, solvent_id, n_solvent, ensemble_size): #joblib fails, multiprocessing + pool.map fails # maybe need to try using partial + pool.map? # e.g. http://stackoverflow.com/questions/16542261/python-multiprocessing-pool-with-map-async #from job...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, nr_molecules, surface_size):\n self.molecules = []\n for i in range(nr_molecules):\n self.try_add_molecule(100, surface_size)\n print(\"nr_molecules:\", len(self.molecules))", "def featurize(self):\n\n self.make_molecule()\n\n self.described_molecu...
[ "0.6320528", "0.6311299", "0.6127451", "0.6073097", "0.600266", "0.5987974", "0.5961844", "0.5954745", "0.5953599", "0.5927075", "0.59150696", "0.581497", "0.57725173", "0.576041", "0.57019114", "0.5685693", "0.5674406", "0.56516", "0.5649344", "0.56459904", "0.55928206", "...
0.6579835
0
Searches through a .tar.bz2 file extracting data from all .log files that match string argument 'calc_type'. Then pickles the total list of extracted data
def extract_bz2(tar_bz_f, calc_type): # we give the gaussian calculator a label that includes the directory the # log file is contained in, this does not affect the parsing process but # generate a warning as it is not an expected form for the label. To avoid # the profusion of warning messages in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser(path):\n # Initialize empty arrays\n total_arr_10 = []\n docker_arr_10 = []\n orchestration_arr_10 = []\n total_arr_100 = []\n docker_arr_100 = []\n orchestration_arr_100 = []\n total_arr_200 = []\n docker_arr_200 = []\n orchestration_arr_200 = []\n total_arr_300 = []\n ...
[ "0.58577317", "0.57411283", "0.5608924", "0.5433588", "0.5412821", "0.53846467", "0.53775907", "0.53437716", "0.52878326", "0.5245987", "0.5244507", "0.5202693", "0.5199609", "0.51822996", "0.5174325", "0.5157046", "0.5141216", "0.5136057", "0.51271695", "0.51259255", "0.5096...
0.71650547
0
Moves a pytorch tensor to numpy
def _torch_to_numpy(tensor): return tensor.detach().cpu().numpy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_numpy(x):\n if isinstance(x, torch.Tensor):\n x = x.cpu().detach().numpy()\n return x", "def tensor2np(x):\n if x is None:\n return x\n return x.cpu().detach().numpy()", "def numpy(x):\n if isinstance(x, torch.Tensor):\n x = x.detach().cpu().numpy()\n elif isinstan...
[ "0.7354377", "0.7060294", "0.7022258", "0.69619316", "0.6945948", "0.6902278", "0.68996525", "0.67747223", "0.6707401", "0.66482615", "0.658182", "0.6558763", "0.6555622", "0.65293175", "0.6449875", "0.6413521", "0.6346526", "0.6339804", "0.6322197", "0.6279642", "0.627916", ...
0.751714
0
returns an image with values between min and max
def clip_image(img, min=0, max=1): img[img < min] = min img[img > max] = max return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_range(images, min_value=0.0, max_value=1.0, dtype=None):\n assert \\\n np.min(images) >= -1.0 - 1e-5 and np.max(images) <= 1.0 + 1e-5 \\\n and (images.dtype == np.float32 or images.dtype == np.float64), \\\n 'The input images should be float64(32) and in the range of [-1.0, 1.0]!'\n ...
[ "0.738579", "0.6780306", "0.67626846", "0.6738461", "0.66593736", "0.6526574", "0.65036553", "0.6461705", "0.6454201", "0.6398253", "0.63636833", "0.6305038", "0.62495464", "0.6232207", "0.62053704", "0.6123332", "0.611912", "0.60944045", "0.60629493", "0.60378563", "0.603348...
0.7045524
1