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
Uses matrices to find each value of Ci for which An(supply) ~ An(demand) on the transpiration stream.
def mtx_minimize(p, trans, all_Cis, photo): demand, __, __, __ = calc_photosynthesis(p, np.expand_dims(trans, axis=1), all_Cis, photo) supply = A_trans(p, np.expand_dims(trans, axis=1), all_Cis) # closest match to ~ 0. (i.e. supply ~ demand) idx = bn.nanarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stain_matrix(I):", "def cte_matrix(npix, cti, ntransfers=20, nexact=30):\n ntransfers = min(npix, ntransfers)\n nexact = min(nexact, ntransfers)\n my_matrix = np.zeros((npix, npix), dtype=np.float)\n for i in range(1, npix):\n jvals = np.concatenate((np.arange(1, i+1), np.zeros(npix-i)...
[ "0.6130194", "0.55923396", "0.5559916", "0.5542966", "0.5462324", "0.5426047", "0.54107964", "0.539597", "0.53010005", "0.5286778", "0.52807546", "0.5269499", "0.5264915", "0.52369905", "0.52284205", "0.5205779", "0.51965654", "0.5193511", "0.51887774", "0.5173953", "0.517362...
0.58178633
1
Splits a list or array into Nroughly equal parts.
def split(a, N): integ = int(len(a) / N) remain = int(len(a) % N) splitted = [a[i * integ + min(i, remain):(i + 1) * integ + min(i + 1, remain)] for i in range(N)] return splitted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(a, n):\n k, m = divmod(len(a), n)\n ret = [a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)]\n return ret", "def split(a, n):\n n = min(n, len(a))\n k, m = divmod(len(a), n)\n return [a[i * k + min(i, m) : (i + 1) * k + min(i + 1, m)] for i in range(n)]", "async def split_list...
[ "0.74788773", "0.7475919", "0.7155433", "0.7128346", "0.7127985", "0.7089341", "0.6969382", "0.6964347", "0.6945037", "0.69449633", "0.6896252", "0.683744", "0.68288326", "0.6799261", "0.67976665", "0.679685", "0.67872566", "0.67658234", "0.6754291", "0.67444706", "0.6696926"...
0.7552224
0
Calculates the photosynthetic C gain of a plant, where the photosynthetic rate (A) is evaluated over the array of leaf water potentials (P) and, thus transpiration (E), and normalized by the instantaneous maximum A over the full range of E.
def photo_gain(p, trans, photo, res, parallel, solstep, symbolic): # accounting for canopy and leaf conductances is needed further __, gs, gb = leaf_energy_balance(p, trans) # mol m-2 s-1 # ref. photosynthesis for which the dark respiration is set to 0 A_ref, __, __, __ = calc_photosynthesis(p, trans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Cycle_Averaging_Factor(Uion,E):\n\treturn np.sqrt(3.0/np.pi) * np.sqrt(E) / (2*Uion)**0.75", "def gaus(x,A,B,C):\n return A * np.exp( -(x-B)**2 / (2*C**2))", "def capenergy(C, V):\n energy = 1 / 2 * C * V ** 2\n return energy", "def gain_opt(machine, T):\n res = (np.arange(T)+1)\n return...
[ "0.5936435", "0.58739793", "0.5872261", "0.5812164", "0.55842763", "0.5573023", "0.5539233", "0.5535628", "0.55277884", "0.5494537", "0.5487115", "0.5461761", "0.5438761", "0.5432664", "0.5431753", "0.5426743", "0.5426254", "0.5402286", "0.5382715", "0.5378071", "0.5372978", ...
0.5922274
1
Create a mat3 from three vec3 by taking them as columns.
def three_vec3_to_mat3(f: vec3, l: vec3, u: vec3) -> mat3: return mat3(f[0], l[0], u[0], f[1], l[1], u[1], f[2], l[2], u[2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMat3(self):\r\n m11,m12,m13,m14,m21,m22,m23,m24,m31,m32,m33,m34,m41,m42,m43,m44 = self.mlist\r\n return _mat3(m11,m12,m13,\r\n m21,m22,m23,\r\n m31,m32,m33)", "def vector3(x, y, z):\n return np.array([x, y, z], dtype=float)", "def vector3(x, y, z)...
[ "0.69429797", "0.67079175", "0.6656125", "0.64689475", "0.6413699", "0.6411789", "0.6236136", "0.61622447", "0.61589396", "0.6035048", "0.6026264", "0.6024904", "0.6005236", "0.6000067", "0.5996003", "0.59812057", "0.5907016", "0.58996314", "0.58707803", "0.5864417", "0.58078...
0.805996
0
Set the value if the key is not present in the cache. If the cache is at capacity remove the oldest item.
def set(self, key, value): try: assert self.capacity > 0 if key not in self.cache: node = Node(key, value) self.cache[key] = node self._enqueue(node) self.num_elements += 1 if self._full_capacity(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self, key, value):\n # type: (_K, _V) -> None\n if key not in self:\n if len(self) >= self.cache_size:\n self.popitem(last=False)\n OrderedDict.__setitem__(self, key, value)", "def set(self, key, value):\n # First, look for the key in the cach...
[ "0.7219126", "0.7099477", "0.70691246", "0.69140404", "0.68703777", "0.6866885", "0.681393", "0.6541478", "0.6505194", "0.6487043", "0.6472104", "0.6388046", "0.6382259", "0.63659716", "0.63503", "0.6345161", "0.6342557", "0.63196516", "0.6307991", "0.6255729", "0.62493557", ...
0.7114944
1
Helper function to get a character by ID.
def get_character(id): return human_data.get(id) or droid_data.get(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_character(self, name=None, id=None):\n\n if name is None and id is None:\n if len(self.characters) > 1:\n raise TooManyCharactersError(\"There are too many characters to choose from\")\n if len(self.characters) is 0:\n return None\n retu...
[ "0.78857386", "0.7277257", "0.702159", "0.6846066", "0.6612507", "0.65150666", "0.6465", "0.6465", "0.64645123", "0.6453374", "0.6453374", "0.6453374", "0.63439304", "0.62733173", "0.61560345", "0.6120783", "0.6021589", "0.59423375", "0.58755404", "0.58744806", "0.5850197", ...
0.77361876
1
Allows us to query for a character's friends.
def get_friends(character, _info): return map(get_character, character.friends)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friends():\n\n acct = get_current_account(session[\"acct\"])\n get_user_friends(acct, GR_KEY, GR_SECRET)\n search = False\n\n return render_template(\"index.html\", acct=acct, search=search)", "def get_my_friends(self):\n query = read_query('content exploration/my_friends')\n re...
[ "0.6518857", "0.6479965", "0.64617723", "0.63634366", "0.6311715", "0.63036174", "0.6286487", "0.62557346", "0.6228334", "0.6211274", "0.6207985", "0.62061346", "0.61779517", "0.6166127", "0.6140223", "0.61185676", "0.6003432", "0.6001165", "0.59902835", "0.59795916", "0.5977...
0.75598407
0
Allows us to fetch the undisputed hero of the trilogy, R2D2.
def get_hero(root, _info, episode): if episode == 5: return luke # Luke is the hero of Episode V return artoo # Artoo is the hero otherwise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hero(self, uuid, hero):\n\n # I can't wait for case statements in python (3.10)\n if hero == Heroes.BULK:\n return Bulk(self.api_key, uuid)\n\n elif hero == Heroes.GENERAL_CLUCK:\n return GeneralCluck(self.api_key, uuid)\n\n elif hero == Heroes.CAKE_MONSTER...
[ "0.58030725", "0.56142896", "0.50956094", "0.4873844", "0.48610187", "0.48471308", "0.4828985", "0.47979692", "0.47733366", "0.4772596", "0.47679102", "0.47579518", "0.47457954", "0.47345772", "0.47205684", "0.4719958", "0.4691983", "0.46911335", "0.4688468", "0.46847045", "0...
0.5789425
1
Allows us to query for the human with the given id.
def get_human(root, _info, id): return human_data.get(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, id):\n return self._select_one('''\n select\n *\n from\n {table}\n where\n {primary_key} = %s\n '''.format(table=self.__class__._table,\n primary_key=self.__class__._primary_key), [id])", "def ge...
[ "0.6236366", "0.6149525", "0.61479026", "0.61479026", "0.60268325", "0.6024141", "0.5992653", "0.59858006", "0.59569484", "0.5941175", "0.5920189", "0.59193754", "0.5917488", "0.588674", "0.5883929", "0.584256", "0.5834919", "0.5825775", "0.5814027", "0.5788083", "0.57564694"...
0.65673816
0
Allows us to query for the droid with the given id.
def get_droid(root, _info, id): return droid_data.get(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(cls, id):\n\n return cls.query.get(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get(self, _id):", "def get_by_id(cls, id):\n return cls.query().get(id)", "def get(self, id):\n return self.__model__.query.get(id)", "def at(cls, _id):\n return cls....
[ "0.6528943", "0.6528943", "0.6519368", "0.6309202", "0.6266213", "0.619076", "0.6105189", "0.6104573", "0.6093983", "0.60920644", "0.60549563", "0.60122293", "0.59570736", "0.59525156", "0.5936037", "0.5933944", "0.5903943", "0.5893819", "0.588835", "0.5875529", "0.58678114",...
0.6565091
0
Raise an error when attempting to get the secret backstory.
def get_secret_backstory(_character, _info): raise RuntimeError("secretBackstory is secret.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error():\r\n raise RuntimeError('admin ticket generator at your service')", "def test_secret():\r\n try:\r\n straxen.get_secret('somethingnonexistent')\r\n except ValueError:\r\n # Good we got some message we cannot load something that does\r\n # not exist,\r\n pass", "...
[ "0.6440979", "0.59451795", "0.59007984", "0.5792526", "0.5716887", "0.56629056", "0.56356", "0.55507153", "0.5542984", "0.5532152", "0.55268043", "0.5526256", "0.55215913", "0.55132943", "0.551187", "0.5505851", "0.5501027", "0.5491438", "0.54257023", "0.5392606", "0.5391823"...
0.679789
0
Allows us to do ["foo"] instead of .secrets.get("foo")
def __getitem__(self, key): value = self.secrets.get(key) if value is None: log.warning(f"Value for '{key}' was not found in the secrets file. Returning 'None'.") return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secret(setting, secrets=secrets):\n return secrets[setting]", "def get_secret(name):\n config = ConfigParser()\n config.read('/srv/oclubs/secrets.ini')\n return config.get('secrets', name)", "def get_secret(setting, secrets=secrets):\n try:\n return secrets[setting]\n except Ke...
[ "0.7381274", "0.69996417", "0.69771975", "0.6838172", "0.67747796", "0.6767287", "0.6743944", "0.6698747", "0.6693381", "0.6687855", "0.6681964", "0.6681964", "0.6653629", "0.66505694", "0.6638268", "0.66191036", "0.6562992", "0.6560076", "0.63869643", "0.6365881", "0.6336029...
0.7074329
1
Recursively walks the dictionary of values, and decrypts values if necessary
def traverse_and_decrypt(self, config): for key, value in config.items(): if isinstance(value, dict): self.traverse_and_decrypt(value) else: config[key] = self.decrypt_string(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt_obj(value, profile=DEFAULT_PROFILE, store=DEFAULT_STORE,\n passphrase=None, key=None):\n def recurse(val):\n return decrypt_obj(val, profile=profile, store=store,\n passphrase=passphrase, key=key)\n if hasattr(value, 'items'):\n if 'value' in...
[ "0.6161085", "0.5628623", "0.54929227", "0.5474014", "0.5472324", "0.5437518", "0.5296254", "0.5258193", "0.52270204", "0.5190544", "0.51885223", "0.5166847", "0.5151185", "0.51307994", "0.51230353", "0.51229274", "0.51088226", "0.5095841", "0.50895303", "0.50832695", "0.5018...
0.71410525
0
Fixture that mocks RFXtrx connection.
async def rfxtrx_dsmr_connection_fixture(hass): transport = MagicMock(spec=asyncio.Transport) protocol = MagicMock(spec=RFXtrxDSMRProtocol) async def connection_factory(*args, **kwargs): """Return mocked out Asyncio classes.""" return (transport, protocol) connection_factory = MagicMo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection():\n return _MockConnection()", "def test_connection(self) -> None:\n test_connection_fn = get_test_connection_fn(self.service_connection)\n test_connection_fn(self.engine)", "def test_get_connection_established(self):\n module = MagicMock()\n connection = slxos.ge...
[ "0.68883884", "0.6608178", "0.63906056", "0.6377455", "0.6320253", "0.62997365", "0.6194019", "0.61207837", "0.6112414", "0.61089355", "0.6056245", "0.60321164", "0.60254645", "0.6020347", "0.5989023", "0.5955133", "0.59535885", "0.59499955", "0.5901632", "0.5893595", "0.5882...
0.67165256
1
find a window by its class_name
def find_window(self, class_name, window_name=None): self._handle = win32gui.FindWindow(class_name, window_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_window_w(lp_class_name=None, lp_window_name=None):\n _find_window_w = WINDLL.user32.FindWindowW\n _find_window_w.argtypes = [LPWSTR, LPWSTR]\n _find_window_w.restype = HWND\n\n h_wnd = _find_window_w(lp_class_name, lp_window_name)\n if not h_wnd:\n errcode = get_last_error()\n ...
[ "0.7167921", "0.70210576", "0.70135576", "0.6814564", "0.6452541", "0.6426358", "0.6374066", "0.63362783", "0.63362783", "0.6336065", "0.6162178", "0.6141816", "0.6128793", "0.6104631", "0.60619915", "0.60002756", "0.597427", "0.5931612", "0.59205425", "0.5908678", "0.5886738...
0.82377094
1
put the window in the foreground
def set_foreground(self): shell = win32com.client.Dispatch("WScript.Shell") shell.SendKeys('%') win32gui.SetForegroundWindow(self._handle)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_foreground(self):\n win32gui.SetForegroundWindow(self._handle)", "def window_tasks(self):\n if self._handle != win32gui.GetForegroundWindow():\n #print \"not in foreground\"\n self.restore_window()\n self.fix_ui()\n self.set_foreground()\n\n se...
[ "0.82139164", "0.7709144", "0.7519241", "0.69029146", "0.68510795", "0.6833985", "0.67739475", "0.6770504", "0.6766987", "0.66932356", "0.6504573", "0.6503325", "0.648314", "0.6470725", "0.642099", "0.6412616", "0.6412309", "0.63737744", "0.63731086", "0.63673925", "0.6359188...
0.77210176
1
Returns the Equinox Hunt's PID
def find_e_hunt_pid(): for proc in psutil.process_iter(): try: pinfo = proc.as_dict(attrs=['pid', 'name', 'username']) except psutil.NoSuchProcess: pass else: if pinfo["name"] == "The Equinox Hunt.exe": return pinfo['pid'] raise Environ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_PID(self):\n return self.PID", "def ppid(self):", "def pidGet(self) -> float:\n ...", "def pidGet(self) -> float:\n ...", "def pid(self):\n\t\treturn self.__pid", "def pid(self):\n return self.__pid", "def pid(self):", "def pid(self):\n return self._pid", ...
[ "0.72760457", "0.71612424", "0.7089378", "0.7089378", "0.70093113", "0.68635106", "0.686095", "0.67920107", "0.67920107", "0.67920107", "0.67841154", "0.6773217", "0.6648229", "0.6609195", "0.65851593", "0.6582593", "0.6531398", "0.6470766", "0.6470766", "0.63605034", "0.6323...
0.7628912
0
Get or set ticks per second.
def ticks_per_second(self): return self._ticks_per_second
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_ticks_per_second(self, ticks_per_second: Optional[int] = None) -> None:\n if ticks_per_second is not None:\n self.ticks_per_second = ticks_per_second\n self.clock = pygame.time.Clock()\n else:\n self.ticks_per_second = None\n self.clock = None", "...
[ "0.7621946", "0.6548346", "0.6366569", "0.62731147", "0.62659174", "0.61058354", "0.61058354", "0.6064958", "0.6042131", "0.5957172", "0.5942777", "0.5938813", "0.5884953", "0.58422005", "0.57919836", "0.57813495", "0.5722832", "0.5696492", "0.5628321", "0.561832", "0.5602573...
0.76627254
0
Get or set max_fps.
def max_fps(self): return self._max_fps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fps(self, fps=25):\n raise NotImplementedError(\"set_fps is not implemented\")", "def get_fps(self):\n return self.fps", "def set_fps(self, fps=25):\n # self._root.knob('fps').setValue(fps)\n pass", "def get_fps(self):\n #return int(self._root.knob('fps').get...
[ "0.6831086", "0.67870563", "0.6732127", "0.6720848", "0.66506356", "0.66024804", "0.65262645", "0.6333982", "0.6333982", "0.6296573", "0.6292673", "0.62639904", "0.62498754", "0.6099087", "0.6088866", "0.6083708", "0.6063188", "0.6051399", "0.6029648", "0.60222644", "0.602095...
0.8426581
0
Get or set use_wait.
def use_wait(self): return self._use_wait
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_no_wait(self) -> bool:\n # read the original value passed by the command\n no_wait = self.raw_param.get(\"no_wait\")\n\n # this parameter does not need dynamic completion\n # this parameter does not need validation\n return no_wait", "def config_wait_time(config):\n ...
[ "0.63215435", "0.6177527", "0.5844257", "0.58021736", "0.57818407", "0.5772699", "0.5563346", "0.54159015", "0.53643453", "0.53524697", "0.53275347", "0.53166246", "0.5311804", "0.5286332", "0.5285241", "0.52840495", "0.5260252", "0.52563673", "0.5217324", "0.51967806", "0.50...
0.8196749
0
Get or set max_frame_skip.
def max_frame_skip(self): return self._max_frame_skip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_skip_interval(self):\n if not self.frame_skipping_allowed:\n return 0\n skip = (self.frame_rate_ctrl_sup >> 1) & 0x7\n if skip == 0:\n return -1\n return skip * 0.5", "def get_max_frames(self):\n return 8", "def capture_limit(self):\n retu...
[ "0.6708408", "0.6518767", "0.6184949", "0.58162093", "0.5772068", "0.5741289", "0.57290554", "0.5702153", "0.56506157", "0.5638185", "0.5628019", "0.56244713", "0.5580224", "0.5580224", "0.5577683", "0.55365443", "0.55287576", "0.5512605", "0.5510468", "0.5507034", "0.5507034...
0.8373689
0
Game loop timer. Call once per game loop to calculate runtime values. After calling, check the update_ready() and frame_ready() methods. Sleep cycles are injected if use_wait=True. Returns the number of milliseconds that have elapsed since the last call to tick().
def tick(self): TIME = self._get_ticks() DT = self._ticks = (TIME - self.time) / self.dilation self._elapsed += self._ticks self.time = TIME # Update runtime stats and counters every second. if self._elapsed >= 1.0: self._elapsed %= 1.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time(self) -> float:\n return self.state.game_loop / 22.4 # / (1/1.4) * (1/16)", "def tick(self):\n prev_last_tick = self.last_tick_\n self.last_tick_ = timeit.default_timer()\n latest_tick_period = self.last_tick_ - prev_last_tick\n return latest_tick_period", "def getTime():\n retu...
[ "0.6810632", "0.5964899", "0.59482884", "0.59482884", "0.59482884", "0.59482884", "0.59482884", "0.59482884", "0.5920492", "0.5899017", "0.5894558", "0.58260745", "0.5802846", "0.57682085", "0.57583404", "0.57018745", "0.56833005", "0.5677626", "0.56753534", "0.56499445", "0....
0.619022
1
Schedule an item to be called back each time tick() is called.
def schedule(self, func, *args, **kwargs): self.unschedule(func) item = _Item(func, 0, args, kwargs) self.schedules.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tick(self, tick):\n pass", "def tick(self, tick):\n pass", "def add(self, item):\n self.sleeping.reveille() # wake items whose sleep timer has expired\n self.stack.push(item)", "def tick(self):\n self.times.append(timeit.default_timer())", "def schedule_update(self, ...
[ "0.6440459", "0.6440459", "0.64294416", "0.6279127", "0.6116449", "0.6103339", "0.60885495", "0.607613", "0.60586387", "0.60586387", "0.60440946", "0.6002624", "0.59929556", "0.58760977", "0.58653486", "0.584892", "0.5842768", "0.5806917", "0.57697654", "0.57586956", "0.57362...
0.6448069
0
Schedule an item to be called back each time update_ready is True.
def schedule_update(self, func, *args, **kwargs): self.unschedule(func) item = _Item(func, -1, args, kwargs) self.update_schedules.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maybe_schedule_update(self):\n if self.hass and not self._update_scheduled:\n self.hass.add_job(self._schedule_update)", "def _scheduled_update(now):\n _LOGGER.debug(\"%s: executing scheduled update\", self.entity_id)\n self.async_schedule_update_ha_state(True)...
[ "0.6413885", "0.63510156", "0.594186", "0.59070164", "0.58506775", "0.58425564", "0.5797839", "0.57880026", "0.57852685", "0.57160807", "0.56975317", "0.56975317", "0.56800675", "0.56561315", "0.56462914", "0.5636342", "0.56320727", "0.56292164", "0.56221145", "0.5608105", "0...
0.65977514
0
Schedule an item to be called back each time update_ready is True. Items are called in order of priority, low to high. If the clock's update_callback is not None, its priority is always 0.0.
def schedule_update_priority(self, func, pri, *args, **kwargs): self.unschedule(func) new_item = _Item(func, pri, args, kwargs) for i,sched in enumerate(self.update_schedules): if sched.pri > new_item.pri: self.update_schedules.insert(i, new_item) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_update(self, func, *args, **kwargs):\n self.unschedule(func)\n item = _Item(func, -1, args, kwargs)\n self.update_schedules.append(item)", "def _update_callback(self, msg):\n _LOGGER.debug(\"Callback signal from: %s\", msg)\n\n if self._delay > 0 and not self.is_on...
[ "0.6125544", "0.5796297", "0.5785513", "0.5777199", "0.55863917", "0.5579675", "0.5569398", "0.5569398", "0.553669", "0.5438193", "0.53975827", "0.5310145", "0.5310145", "0.5305881", "0.5290799", "0.5279625", "0.5262041", "0.5212441", "0.52121687", "0.5211911", "0.51993924", ...
0.5854984
1
Schedule an item to be called back each time frame_ready is True.
def schedule_frame(self, func, *args, **kwargs): self.unschedule(func) item = _Item(func, 0.0, args, kwargs) self.frame_schedules.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\n self.sleeping.reveille() # wake items whose sleep timer has expired\n self.stack.push(item)", "def schedule(self):\r\n n = self.next()\r\n if n is not None:\r\n if self.clock:\r\n self.cl = self.clock.callLater(n, self.run)\r\n ...
[ "0.61180556", "0.59293985", "0.5835084", "0.58059955", "0.56547296", "0.5571642", "0.55654603", "0.5560505", "0.5495326", "0.54900795", "0.5482192", "0.54774576", "0.54264015", "0.54027116", "0.5373826", "0.5364034", "0.5363627", "0.53592104", "0.53555024", "0.53548527", "0.5...
0.6506982
0
Schedule an item to be called back each time frame_ready is True. Items are called in order of priority, low to high. If the clock's frame_callback is not None, its priority is always 0.0.
def schedule_frame_priority(self, func, pri, *args, **kwargs): self.unschedule(func) new_item = _Item(func, pri, args, kwargs) for i,sched in enumerate(self.frame_schedules): if sched.pri > new_item.pri: self.frame_schedules.insert(i, new_item) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_frame(self, func, *args, **kwargs):\n self.unschedule(func)\n item = _Item(func, 0.0, args, kwargs)\n self.frame_schedules.append(item)", "def run_callbacks():\n while len(_sorted_scheduled_events) > 0:\n event = heapq.heappop(_sorted_scheduled_events)\n if pyga...
[ "0.6107425", "0.5773594", "0.5773343", "0.55256045", "0.545233", "0.5414526", "0.5404905", "0.5252532", "0.52228343", "0.5200206", "0.51985127", "0.51853275", "0.51533216", "0.51477325", "0.51319176", "0.5119042", "0.51099426", "0.5086536", "0.50723577", "0.50547326", "0.5032...
0.5780196
1
Unschedule a managed function.
def unschedule(self, func): for sched in ( self.schedules, self.update_schedules, self.frame_schedules, self.interval_schedules, ): for item in list(sched): if item.func == func: sched.remove(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unschedule(function_pointer: Callable):\n pyglet.clock.unschedule(function_pointer)", "def unblock( self, fn ):\n\n self._once.remove( fn )", "def unschedule(self, handle):\n if self.is_scheduled(handle):\n self.schedule(handle.cancel)", "def schedule_remove(retval=None):\n _...
[ "0.7875083", "0.67871004", "0.67861027", "0.65179455", "0.6517018", "0.59970367", "0.5992793", "0.5965841", "0.5876637", "0.5706996", "0.5673632", "0.5670934", "0.5660852", "0.5641798", "0.5641137", "0.5632214", "0.5623871", "0.55469143", "0.55397826", "0.5504206", "0.5481354...
0.7121986
1
Set window caption for both Pygame clock and GameClock.
def set_caption(): if USE_PYGAME_CLOCK: pygame.display.set_caption( 'Loop=Pygame Kill=%s MaxFPS=%d Runtime:[FPS=%d Balls=%d]' % ( DO_KILL, PYGAME_FPS, pygame_clock.get_fps(), len(sprite_group))) else: pygame.display.set_caption( ' '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_caption(self, title=None, icon=None):\n pygame.display.set_caption(title if title is not None else \"Game\")\n\n if icon is not None:\n pygame.display.set_icon(self.__manager.get_image(icon))", "def display_fps(self):\n template = \"{} - FPS: {:.2f}\"\n caption = te...
[ "0.7012242", "0.6379176", "0.6298891", "0.6189515", "0.6189515", "0.61771625", "0.6154267", "0.61143386", "0.6017634", "0.593406", "0.5787212", "0.57735145", "0.5733958", "0.57310814", "0.5718029", "0.5701014", "0.57004046", "0.56815714", "0.56677616", "0.56650573", "0.564746...
0.78642577
0
Test case for the validate_str_substitution function when there are too many specifiers for a single value.
def test_single_specifier_needed(self): template = '{0} one too many {1}' value_count = 1 msg = ('The formatter should only contain one ' '"{}" specifier for the source field.') with six.assertRaisesRegex(self, ValidationError, msg): validate_str_substitution(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mult_specifiers_missing(self):\n template = '{0} too few {1}'\n value_count = 3\n msg = ('The formatter contains too few \"{}\" '\n 'specifiers for the number of source fields.')\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_s...
[ "0.77646595", "0.7500104", "0.73616403", "0.6970654", "0.6868888", "0.6491566", "0.62034374", "0.61241984", "0.5873548", "0.57501364", "0.5677455", "0.5671187", "0.5659901", "0.56492203", "0.5617618", "0.56097096", "0.56035393", "0.5596766", "0.5594853", "0.5587412", "0.55796...
0.75196844
1
Test case for the validate_str_substitution function when there are too many specifiers for a multiple values.
def test_too_many_specifiers(self): template = '{0} too {1} many {2}' value_count = 2 msg = ('The number of "{}" specifiers in the formatter ' 'exceeds the number of source fields.') with six.assertRaisesRegex(self, ValidationError, msg): validate_str_substitut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mult_specifiers_missing(self):\n template = '{0} too few {1}'\n value_count = 3\n msg = ('The formatter contains too few \"{}\" '\n 'specifiers for the number of source fields.')\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_s...
[ "0.77387667", "0.704363", "0.70252943", "0.6271981", "0.6192022", "0.6164257", "0.60407287", "0.60207987", "0.5852523", "0.58169687", "0.57305413", "0.5712452", "0.5707186", "0.57060534", "0.5697903", "0.56634915", "0.5498339", "0.549623", "0.54948443", "0.5450721", "0.544724...
0.75915784
1
Test case for the validate_str_substitution function when no specifier is provided for a single value.
def test_single_specifier_missing(self): template = 'missing' value_count = 1 msg = 'The formatter should contain one "{}" specifier.' with six.assertRaisesRegex(self, ValidationError, msg): validate_str_substitution(template, value_count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_specifier_needed(self):\n template = '{0} one too many {1}'\n value_count = 1\n msg = ('The formatter should only contain one '\n '\"{}\" specifier for the source field.')\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_s...
[ "0.7739168", "0.6911853", "0.6755585", "0.6411304", "0.6260792", "0.61990166", "0.61211854", "0.60277146", "0.59797823", "0.5950124", "0.5916125", "0.58552134", "0.58064044", "0.574167", "0.57399917", "0.57194877", "0.56394297", "0.56376594", "0.56360185", "0.5617676", "0.560...
0.7781741
0
Test case for the validate_str_substitution function when not enough specifiers are provided for multiple values.
def test_mult_specifiers_missing(self): template = '{0} too few {1}' value_count = 3 msg = ('The formatter contains too few "{}" ' 'specifiers for the number of source fields.') with six.assertRaisesRegex(self, ValidationError, msg): validate_str_substitution(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid(self):\n template = '{0} just right {1}'\n value_count = 2\n try:\n validate_str_substitution(template, value_count)\n except ValidationError:\n self.fail('Name raised ValidationError unexpectedly')", "def test_too_many_specifiers(self):\n t...
[ "0.69698447", "0.6856272", "0.6759019", "0.6544559", "0.628785", "0.62780464", "0.6217296", "0.61721414", "0.5824541", "0.5708207", "0.5690233", "0.56453663", "0.56332076", "0.5587687", "0.5559537", "0.5558822", "0.5539237", "0.549828", "0.54273105", "0.54128116", "0.54120934...
0.745676
0
Test case for the validate_str_substitution function when there is no template and no values.
def test_no_template_or_value(self): template = None value_count = 0 try: validate_str_substitution(template, value_count) except ValidationError: self.fail('Name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_template(self):\n template = ''\n value_count = 2\n msg = 'No template has been provided for formatting multiple fields.'\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_substitution(template, value_count)", "def test_valid(self):\n ...
[ "0.8025326", "0.7213716", "0.66683763", "0.6602274", "0.65322155", "0.6060067", "0.6018206", "0.5960316", "0.5847992", "0.570882", "0.56862307", "0.567754", "0.56409764", "0.5636499", "0.56009597", "0.5564967", "0.5553976", "0.55412734", "0.5510677", "0.5449642", "0.54129136"...
0.8559954
0
Test case for a timeframe when the start is before the end.
def test_start_before_end(self): start = timezone.now() end = start + timedelta(seconds=1) actual = validate_timeframe(start, end) expected = None self.assertEqual(actual, expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_before_start(self):\n start = timezone.now()\n end = start - timedelta(seconds=1)\n with six.assertRaisesRegex(self, ValidationError, self.msg):\n validate_timeframe(start, end)", "def test_start_and_end_equal(self):\n start = timezone.now()\n end = star...
[ "0.7566547", "0.6772126", "0.6374332", "0.6198739", "0.61928725", "0.6118859", "0.6113975", "0.6095883", "0.6001959", "0.5977857", "0.59771687", "0.5961913", "0.59552705", "0.5921858", "0.59106416", "0.5891409", "0.58473384", "0.5836007", "0.5831282", "0.58233166", "0.5806467...
0.8474545
0
Test case for a timeframe when the start is the same as the end.
def test_start_and_end_equal(self): start = timezone.now() end = start with six.assertRaisesRegex(self, ValidationError, self.msg): validate_timeframe(start, end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_start_before_end(self):\n start = timezone.now()\n end = start + timedelta(seconds=1)\n actual = validate_timeframe(start, end)\n expected = None\n self.assertEqual(actual, expected)", "def test_end_before_start(self):\n start = timezone.now()\n end = sta...
[ "0.83038056", "0.72508883", "0.6654572", "0.6626513", "0.651134", "0.6492415", "0.6485801", "0.64331234", "0.6424238", "0.64222044", "0.6339417", "0.63011914", "0.629199", "0.62886703", "0.6282754", "0.6269981", "0.6264812", "0.62266916", "0.62221265", "0.6221919", "0.6183134...
0.7507385
1
Test case for a timeframe when the end is before the start.
def test_end_before_start(self): start = timezone.now() end = start - timedelta(seconds=1) with six.assertRaisesRegex(self, ValidationError, self.msg): validate_timeframe(start, end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_start_before_end(self):\n start = timezone.now()\n end = start + timedelta(seconds=1)\n actual = validate_timeframe(start, end)\n expected = None\n self.assertEqual(actual, expected)", "def test_start_and_end_equal(self):\n start = timezone.now()\n end = ...
[ "0.85345876", "0.6971865", "0.635861", "0.6285669", "0.6264843", "0.62459284", "0.6157854", "0.6150074", "0.61289024", "0.6084559", "0.60785186", "0.6041756", "0.602175", "0.60216665", "0.60183614", "0.60110635", "0.59780777", "0.5965191", "0.59603524", "0.5960095", "0.593960...
0.7669659
1
Test case for a name that starts with '$'.
def test_starts_with_dollar_sign(self): with self.assertRaises(ValidationError): db_name_validator('$id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ends_with_dollar_sign(self):\n try:\n field_name_validator('id$')\n except ValidationError:\n self.fail('Field name raised ValidationError unexpectedly')", "def test_starts_with_dollar_sign(self):\n with self.assertRaises(ValidationError):\n field_na...
[ "0.67136925", "0.6705001", "0.6503789", "0.64547306", "0.58266824", "0.57201684", "0.5717212", "0.56998605", "0.56683135", "0.56396186", "0.5612776", "0.56053567", "0.558402", "0.55130583", "0.5489437", "0.5462594", "0.5441972", "0.54047763", "0.5355089", "0.53339887", "0.532...
0.68603
0
Test case for a name that ends with '$'.
def test_ends_with_dollar_sign(self): with self.assertRaises(ValidationError): db_name_validator('id$')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ends_with_dollar_sign(self):\n try:\n field_name_validator('id$')\n except ValidationError:\n self.fail('Field name raised ValidationError unexpectedly')", "def have_dollar_symbol(l):\r\n if \"$\" in str(l):\r\n return 1\r\n else:\r\n return 0", ...
[ "0.70746607", "0.6329763", "0.6173928", "0.5921726", "0.5699177", "0.5615877", "0.5560913", "0.55183434", "0.55144906", "0.5423579", "0.5397252", "0.5385472", "0.53206605", "0.5320603", "0.5317933", "0.5299136", "0.529233", "0.5287899", "0.52750707", "0.5248921", "0.5236096",...
0.6680976
1
Test case for a name that contains an underscore.
def test_underscore(self): try: db_name_validator('logstash_') except ValidationError: self.fail('Name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_reserved_with_trailing_underscore(name):\r\n if name.endswith('_') and not name.endswith('__'):\r\n return is_reserved_name(name[:-1])\r\n return False", "def have_underscore_symbol(l):\r\n if \"_\" in str(l):\r\n return 1\r\n else:\r\n return 0", "def _is_sunder(name):\n ret...
[ "0.7310088", "0.7255307", "0.71017885", "0.70589805", "0.70496494", "0.70447224", "0.70156693", "0.6951466", "0.69273514", "0.6796302", "0.6788309", "0.6767957", "0.676568", "0.6753369", "0.6676394", "0.6644562", "0.6632465", "0.66263527", "0.65816164", "0.6540488", "0.648323...
0.75166786
0
Test case for a field name with an 'at' sign.
def test_at_sign(self): with self.assertRaises(ValidationError): db_name_validator('@timestamp')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_at_sign(self):\n try:\n field_name_validator('@timestamp')\n except ValidationError:\n self.fail('Name raised ValidationError unexpectedly')", "def test_asterisk(self):\n with self.assertRaises(ValidationError):\n field_name_validator('logstash*')", ...
[ "0.71612364", "0.5746143", "0.57394135", "0.5733935", "0.52968377", "0.5245689", "0.51280147", "0.51110286", "0.5063854", "0.5013594", "0.4999617", "0.4996094", "0.4996094", "0.4996094", "0.49822336", "0.49699822", "0.49314225", "0.49305493", "0.4911007", "0.49025157", "0.490...
0.60910565
1
Test case for a reserved field name.
def test_reserved_name(self): with self.assertRaises(ValidationError): field_name_validator('_id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nonreserved_name(self):\n try:\n field_name_validator('_identifier')\n except ValidationError:\n self.fail('Field name raised ValidationError unexpectedly')", "def test_name_mandatory(self):\n field = self.base_field\n del field['name']\n with sel...
[ "0.8109194", "0.68794477", "0.6793862", "0.6606592", "0.66057515", "0.6411735", "0.64036286", "0.6303401", "0.62960964", "0.62956566", "0.6294458", "0.6293811", "0.62098557", "0.6209307", "0.61939204", "0.61682105", "0.6147084", "0.6137859", "0.60870963", "0.606437", "0.60434...
0.7502591
1
Test case for a nonreserved field name.
def test_nonreserved_name(self): try: field_name_validator('_identifier') except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reserved_name(self):\n with self.assertRaises(ValidationError):\n field_name_validator('_id')", "def test_name_mandatory(self):\n field = self.base_field\n del field['name']\n with self.assertRaises(FieldSchemaError):\n SchemaField(field)\n # no b...
[ "0.72460914", "0.6701481", "0.6628979", "0.65502286", "0.6514606", "0.63691247", "0.63495415", "0.63348657", "0.632878", "0.6328437", "0.6308756", "0.6253894", "0.62217385", "0.6212709", "0.61388445", "0.6131755", "0.61158323", "0.61143875", "0.61016154", "0.6090909", "0.6083...
0.8317225
0
Test case for a field name that starts with '$'.
def test_starts_with_dollar_sign(self): with self.assertRaises(ValidationError): field_name_validator('$id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ends_with_dollar_sign(self):\n try:\n field_name_validator('id$')\n except ValidationError:\n self.fail('Field name raised ValidationError unexpectedly')", "def test_starts_with_dollar_sign(self):\n with self.assertRaises(ValidationError):\n db_name_...
[ "0.739166", "0.70614517", "0.668346", "0.59609854", "0.5552025", "0.5541403", "0.54322046", "0.5410676", "0.5407751", "0.54066396", "0.54008925", "0.5384027", "0.5364445", "0.5271534", "0.5243414", "0.5210324", "0.5125371", "0.5116661", "0.5108867", "0.5093756", "0.509032", ...
0.73847854
1
Test case for a field name that ends with '$'.
def test_ends_with_dollar_sign(self): try: field_name_validator('id$') except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ends_with_dollar_sign(self):\n with self.assertRaises(ValidationError):\n db_name_validator('id$')", "def test_starts_with_dollar_sign(self):\n with self.assertRaises(ValidationError):\n field_name_validator('$id')", "def test_starts_with_dollar_sign(self):\n ...
[ "0.689882", "0.6759295", "0.65150255", "0.5870502", "0.5331195", "0.5307354", "0.52927977", "0.5290257", "0.51580924", "0.5131376", "0.50939983", "0.50779057", "0.5045454", "0.50211877", "0.49893743", "0.49558002", "0.49265686", "0.49226952", "0.49097547", "0.48915064", "0.48...
0.77276367
0
Test case for a field name with an asterisk.
def test_asterisk(self): with self.assertRaises(ValidationError): field_name_validator('logstash*')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_name_field(self):\n self.assertIn(\"name\", self.fields)", "def test_asterisk(self):\n with self.assertRaises(ValidationError):\n db_name_validator('logstash*')", "def test_name_field(self):\n field = self.record.find('field[@name=\\'name\\']')\n self.asse...
[ "0.63491094", "0.62696713", "0.616396", "0.5865025", "0.5830085", "0.5807977", "0.58045506", "0.576975", "0.57355", "0.56819177", "0.5648997", "0.560842", "0.5590669", "0.5585814", "0.55374426", "0.54930514", "0.54852134", "0.54837966", "0.5409892", "0.5374981", "0.53576005",...
0.7305447
0
Test case for a field name with an 'at' sign.
def test_at_sign(self): try: field_name_validator('@timestamp') except ValidationError: self.fail('Name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_at_sign(self):\n with self.assertRaises(ValidationError):\n db_name_validator('@timestamp')", "def test_asterisk(self):\n with self.assertRaises(ValidationError):\n field_name_validator('logstash*')", "def is_attname(name):\n test = re.search(\"^@[a-z]+\", name)\...
[ "0.6091334", "0.5745363", "0.5737729", "0.57325655", "0.52944916", "0.52459604", "0.51255804", "0.5109877", "0.5062047", "0.5012249", "0.49980783", "0.49967083", "0.49967083", "0.49967083", "0.4980967", "0.49687672", "0.4929378", "0.4928652", "0.4909248", "0.49009785", "0.489...
0.7161428
0
Test case for a field name with a space.
def test_white_space(self): with self.assertRaises(ValidationError): field_name_validator('user id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_name_field(self):\n field = self.record.find('field[@name=\\'name\\']')\n self.assertEqual(field.text, 'GUH-ADT', 'Incorrect Name Field')", "def test_white_space(self):\n with self.assertRaises(ValidationError):\n db_name_validator('http log')", "def test_nonreserved_na...
[ "0.70056397", "0.67619824", "0.6710414", "0.6692096", "0.66895425", "0.6589791", "0.6458364", "0.64133483", "0.6384269", "0.6309959", "0.6281411", "0.6173597", "0.61537987", "0.6149685", "0.61195415", "0.6065407", "0.60509354", "0.60304695", "0.5992413", "0.5987188", "0.59464...
0.7365769
0
Test case for a .pem file.
def test_pem(self): mock_fieldfile = Mock() mock_fieldfile.name = 'good_file_name.pem' try: key_file_validator(mock_fieldfile) except ValidationError: self.fail('Key file raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _use_privatekey_file_test(self, pemfile, filetype):\n key = PKey()\n key.generate_key(TYPE_RSA, 1024)\n\n with open(pemfile, \"wt\") as pem:\n pem.write(dump_privatekey(FILETYPE_PEM, key).decode(\"ascii\"))\n\n ctx = Context(SSLv23_METHOD)\n ctx.use_privatekey_file...
[ "0.6764598", "0.6654246", "0.65583926", "0.65270674", "0.6426582", "0.6288692", "0.62809217", "0.61941195", "0.6150361", "0.60924125", "0.59778744", "0.5926885", "0.59179485", "0.58784014", "0.58767575", "0.5843147", "0.58300567", "0.5826571", "0.5797535", "0.57444847", "0.57...
0.76506793
0
Test case for a .pub file.
def test_pub(self): mock_fieldfile = Mock() mock_fieldfile.name = 'good_file_name.pem' try: key_file_validator(mock_fieldfile) except ValidationError: self.fail('Field name raised ValidationError unexpectedly')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_file(self):\n settings = get_settings(\n PANDOC_EXTENSIONS=PANDOC_EXTENSIONS, PANDOC_ARGS=PANDOC_ARGS\n )\n\n pandoc_reader = PandocReader(settings)\n source_path = os.path.join(TEST_CONTENT_PATH, \"valid_content.md\")\n output, metadata = pandoc_reader....
[ "0.5919157", "0.58491045", "0.58459884", "0.58253276", "0.5812408", "0.5735533", "0.5733202", "0.56880325", "0.5683151", "0.56800216", "0.5660098", "0.5637591", "0.55662555", "0.5529598", "0.5516419", "0.5495245", "0.54909027", "0.5478644", "0.5478047", "0.54745203", "0.54655...
0.599949
0
Normalize log_prob over axis
def log_normalize(log_prob, axis): log_sum = logsumexp(log_prob, axis=axis) if not isinstance(log_sum, np.ndarray): log_sum = np.array([log_sum]) if log_prob.shape[0] == log_sum.shape[0]: # column normalize return (log_prob.transpose() - log_sum).transpose() else: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_normalize(a, axis=None):\n if axis is not None and a.shape[axis] == 1:\n # Handle single-state GMMHMM in the degenerate case normalizing a\n # single -inf to zero.\n a[:] = 0\n else:\n with np.errstate(under=\"ignore\"):\n a_lse = logsumexp(a, axis, keepdims=Tru...
[ "0.7553575", "0.7284376", "0.7028193", "0.6839602", "0.6715142", "0.6681284", "0.6613623", "0.6613623", "0.65957856", "0.655713", "0.65440196", "0.652305", "0.652224", "0.6522236", "0.6514482", "0.6496028", "0.6485858", "0.6477462", "0.64623874", "0.64553666", "0.64433086", ...
0.84213656
0
Solve the discrete problem for the |Parameter| `mu`.
def solve(self, mu=None, **kwargs): mu = self.parse_parameter(mu) return self.cached_method_call(self._solve, mu=mu, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _solve(self, mu=None):\n pass", "def eval_mu(self, mu, T, Du, Dx):\n sample_u = mu[:, slice(Dx, Dx + Du)]\n l = 0.5 * np.sum(self._hyperparams['wu'] * (sample_u ** 2), axis=1)\n lu = self._hyperparams['wu'] * sample_u\n lx = np.zeros((T, Dx))\n luu = np.tile(np.diag(...
[ "0.62211555", "0.59894115", "0.576564", "0.57021385", "0.55860966", "0.55664134", "0.554284", "0.55242383", "0.5522931", "0.5518341", "0.54923797", "0.54923797", "0.54923797", "0.54923797", "0.54818887", "0.54818887", "0.5465948", "0.5459351", "0.5453252", "0.5444801", "0.543...
0.6229741
0
Download film file associated with deviation to working direcotry
def download(self): # os.open *should* give a thread-safe way to exlusivly open files filepath = self.film try: # os.O_BINARY is only avilable and needed on windows flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY | os.O_BINARY except: flags = os.O_CREAT ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_movie(self, filmid):\n self.logger.debug('download_movie')\n if not self._test_download_path(self.settings.getDownloadPathMovie()):\n return\n film = self.database.retrieve_film_info(filmid)\n if film is None:\n return\n (filmurl, extension,) = ...
[ "0.74047387", "0.6802818", "0.6492933", "0.63272357", "0.6325188", "0.6306504", "0.6279032", "0.6233885", "0.6201966", "0.6183323", "0.6183052", "0.6154932", "0.61464465", "0.614376", "0.61219966", "0.61205304", "0.611035", "0.60901654", "0.60821956", "0.6044683", "0.6029404"...
0.72750807
1
Call current tab's activate().
def handle_tab(self, index): self.current_tab = index self.views[index].activate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate(self):\n View.activate(self, parent)\n if len(self.tabs) == 0:\n raise \"No tabs are defined \" # FIXME: raising strings is deprecated\n # Create tab name list from tabs sequence\n self.tab_menu = [item[0] for item in self.tabs]\n # Put all views to anothe...
[ "0.79805166", "0.7071411", "0.7055319", "0.7055319", "0.70152354", "0.68649316", "0.68264556", "0.67104304", "0.66880375", "0.6673496", "0.6613994", "0.6575249", "0.6563388", "0.65508574", "0.64936495", "0.64433587", "0.6404007", "0.6380425", "0.6329285", "0.63151354", "0.630...
0.72531104
1
Makes varexercises using book, and makes varexercise_numbers. Its structure is like structure of exercise_numbers, but varexercises replaces codes.
def make_varexercises(self, number): for group_number in range(len(self.varexercise_numbers)): for item_number in range( 1, len(self.varexercise_numbers[group_number]) ): item = self.varexercise_numbers[group_number][item_number] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opcion1_automatica(v):\n v_range = len(v)\n\n for i in range(v_range):\n tit = ('Harry Potter', 'Percy Jackson', 'El Principito', 'Cien años de soledad',\n 'El señor de los anillos', 'Un mundo feliz', 'Orgullo y prejuicio',\n 'Crimen y castigo', 'Lolita', 'Ulises', 'E...
[ "0.5544544", "0.5331488", "0.53252894", "0.5180477", "0.5149555", "0.5140754", "0.49389717", "0.48791838", "0.48749995", "0.4869138", "0.48637033", "0.48598498", "0.480628", "0.4785081", "0.47846156", "0.477382", "0.47538576", "0.472438", "0.47215456", "0.4713934", "0.4709370...
0.6769661
0
r""" Returns with the text of all variations in one text separated with \newpage
def all(self, frame=0): text = [] for number in range(1, self.number_of_variations+1): text.extend(self.one(number)) text.append('\n\n\\newpage') return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_excerpt():", "def generate_new_book(text):\n\n for paragraph in text:\n for sentence in paragraph:\n for word in sentence:\n print(word, end=' ')\n print()\n print()", "def showlist(liste):\n lines = []\n for configuration in liste:\n ...
[ "0.6711007", "0.65808743", "0.609241", "0.58317274", "0.5734826", "0.5534859", "0.54976785", "0.5462358", "0.5455184", "0.5430324", "0.53986835", "0.53669924", "0.53657526", "0.53469855", "0.53398955", "0.52718943", "0.52573687", "0.52496773", "0.5238683", "0.52319825", "0.52...
0.7470387
0
Returns with the values of the variations of a group as a latex text. If there is no variations, it returns with empty string ("").
def group_list(self, group_number=1): text = [] group = self.varexercise_numbers[group_number-1] group_name = _('Group %s') % group[0] text.append('\n\\subsection*{%s}\n' % group_name) for number in range(1, self.number_of_variations+1): print("---------", number) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_plain(self, num):\n if not self.list:\n return \"\"\n values, erased_elements = self.list[num - 1]\n string_list = self.latex_string_list(values, erased_elements)\n if not string_list:\n raise ValueError('There is not values for the variation')\n ...
[ "0.6397545", "0.605309", "0.5697189", "0.55907047", "0.5567366", "0.54121137", "0.5403941", "0.53388005", "0.5335477", "0.53257376", "0.5308608", "0.5244872", "0.5237614", "0.5237179", "0.51937526", "0.51812685", "0.5152086", "0.5135319", "0.5132878", "0.5132257", "0.5121792"...
0.70125437
0
Returns with a fancy ASCII format of the groups.
def groups(self): groups_text = '\n' for group in self.exercise_numbers: txt = ' %s:\t' % group[0] for exercise in group[1:]: if isinstance(exercise, int): txt += '%d. ' % exercise else: txt += '\n\t%s\n\t' %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_to_string(groups: List[List]) -> str:\n\tgroups_str = \"\"\n\tcount = 1\n\tfor group in groups:\n\t\tgroups_str += f\"Group {count}: {group} \\n\"\n\t\tcount += 1\n\treturn groups_str", "def construct_groups_string(nodes):\n groups = get_groups(nodes)\n if len(groups) <= 1:\n return \"\"\...
[ "0.7505938", "0.72989285", "0.72470206", "0.6943679", "0.67600465", "0.67220414", "0.6567086", "0.6501805", "0.65007514", "0.6459657", "0.64337957", "0.64087206", "0.6393383", "0.6393383", "0.6354593", "0.6305523", "0.6294027", "0.6272086", "0.6272086", "0.6272086", "0.627208...
0.7759309
0
It will give the frame of the testpapers. It makes preambulum and \\begin{document}...
def frame(text, preamble_file='magyarpreambulum', pagesize='a4paper', fontsize=11, lhead='-', rhead='-', lfoot='-', rfoot='-', cfoot=None, definitions=None, doc_type='testpaper', ): preamble_text = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame(self):", "def setUp(self):\r\n self.caption = \"mirra extending classes\" # window name\r\n self.size = 640, 480 #window size\r\n self.pos = 100,100 # window top left location\r\n self.fullScreen = 0 # if fullScreen is on it will overwrite your pos and size to match the disp...
[ "0.5653824", "0.5485206", "0.53564596", "0.5304328", "0.5258339", "0.5252326", "0.5233434", "0.5168269", "0.51534927", "0.5150381", "0.5145552", "0.5141495", "0.5135204", "0.5130915", "0.51246834", "0.51125383", "0.5108519", "0.5073825", "0.50603205", "0.5039046", "0.503722",...
0.6416818
0
r""" Returns with the text in a LaTeX frame (preamble, \begin{document} etc) text can be a string or a list of strings (lines of the file), preamble_text must be list.
def general_frame(text, class_type='article', class_argument="", preamble_text=None ): whole_text = ["\\documentclass%s{%s}\n" % (class_argument, class_type)] whole_text.append('\n') if isinstance(preamble_text, str): preamble...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame(text,\n preamble_file='magyarpreambulum',\n pagesize='a4paper',\n fontsize=11,\n lhead='-',\n rhead='-',\n lfoot='-',\n rfoot='-',\n cfoot=None,\n definitions=None,\n doc_type='testpaper',\n ):\n\n pream...
[ "0.69117886", "0.5490636", "0.5485827", "0.51334095", "0.51157916", "0.50500745", "0.5046867", "0.48857522", "0.48777068", "0.48761898", "0.48656923", "0.48174325", "0.47641125", "0.4740196", "0.47326535", "0.47236276", "0.47094363", "0.47010326", "0.46964833", "0.46782908", ...
0.70507646
0
It searches for control words, and append them to the matching list and their names to the self.variable_list if it is empty.
def find_control_words(self): row_number = 0 for row in self.text: row_number += 1 row = delete_remark(row) element_types = { "interval": dict( regexp0=self.intervalp0, regexp=self.intervalp, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(self):\n wordlist = self.words_box.get().split()\n for word in wordlist:\n self.words[word] = False\n self.logic.set_words_to_find(self.words)", "def add_search_words(self,\r\n index,\r\n entrytext):\r\n\r\n\r\n ...
[ "0.5948187", "0.5807472", "0.56301636", "0.56161875", "0.5463833", "0.53586537", "0.53124034", "0.52780557", "0.5253675", "0.5206123", "0.5184049", "0.5171564", "0.5157617", "0.5153398", "0.51497215", "0.51383173", "0.512478", "0.512449", "0.5108643", "0.5101439", "0.50543994...
0.6562073
0
Returns with the logical value of 'there is interval(s) in the exercise'.
def is_interval(self): return len(self.interval_list) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_interval(self):\n return True", "def test_full(self):\n x = np.array([-5, -3, -2, -2, 100])\n self.assertEqual(\n npinterval.interval(x, 1),\n (-5, 100, 0, 5))", "def test_intervals(self):\n x = np.array([-5, -3, -2, -2, 100])\n self.assertEqual(\...
[ "0.6631536", "0.653667", "0.64884096", "0.6386589", "0.6306378", "0.62866914", "0.62842894", "0.62758464", "0.62490463", "0.62084836", "0.61674124", "0.6126066", "0.60420614", "0.5969346", "0.5945842", "0.59290206", "0.5902912", "0.5874909", "0.5849079", "0.5838904", "0.58232...
0.66247797
1
Returns with the logical value of 'there is ecChoose(es) in the exercise'.
def is_ecChoose(self): return len(self.ecChoose_list) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decide():", "def algo_selection(algos: tuple):\n print_header()\n print_list_algos(algos)\n print(\"Your choice: \", end='')\n return get_num_algo(algos)", "def evaluate(self,gene):\n return prng.choice(gene.allele_set)", "def opponent_checker(self):\n\n if self.checker == 'O':\...
[ "0.60847586", "0.5733719", "0.572348", "0.5693358", "0.56821287", "0.5642488", "0.5614249", "0.5564066", "0.55600315", "0.55517966", "0.5547838", "0.5530174", "0.55137396", "0.5494722", "0.5453672", "0.54303324", "0.5399318", "0.5396401", "0.53884476", "0.53642225", "0.535307...
0.6200309
0
It creates the text with the values of the numth variation. If full = 0 it writes the values according erased_elements, else writes all the values. If there is no interval in the text, it returns with the base_text.
def vartext(self, num, full=0): if not self.is_interval() and not self.is_ecChoose(): return self.text values, erased_elements = self.list[num] vtext = self.text[:] space = "\spacer" # It is at the place of an erased element. element_list = (self.interval_list + se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_plain(self, num):\n if not self.list:\n return \"\"\n values, erased_elements = self.list[num - 1]\n string_list = self.latex_string_list(values, erased_elements)\n if not string_list:\n raise ValueError('There is not values for the variation')\n ...
[ "0.5108491", "0.50498855", "0.49701723", "0.49449825", "0.49412444", "0.49320793", "0.49019018", "0.49019018", "0.48887914", "0.4886533", "0.48415688", "0.48284483", "0.47971684", "0.475274", "0.47337496", "0.47256368", "0.47223228", "0.47214004", "0.47168553", "0.47005257", ...
0.7634538
0
Returns with list of the values of the variables in LaTeX format. The erased_elements are with question mark.
def latex_string_list(self, values, erased_elements=[], sizes=('large', 'small')): if not self.variable_list: return '' string_list = [] large, small = sizes for var in self.variable_list: erased = var in erased_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_explanatory_variables(self):\n return list(self._explanatory_variables)", "def latex_plain(self, num):\n if not self.list:\n return \"\"\n values, erased_elements = self.list[num - 1]\n string_list = self.latex_string_list(values, erased_elements)\n if not st...
[ "0.6008642", "0.5700232", "0.5642651", "0.5501694", "0.5391645", "0.53597015", "0.53372526", "0.52843827", "0.527685", "0.5274077", "0.5266483", "0.5257974", "0.5225993", "0.5191741", "0.5150827", "0.51358664", "0.5133133", "0.51248026", "0.5121777", "0.5111254", "0.5092984",...
0.7332331
0
Returns with a plain latex format of the nth variation, as latexrow (not in table format).
def latex_plain(self, num): if not self.list: return "" values, erased_elements = self.list[num - 1] string_list = self.latex_string_list(values, erased_elements) if not string_list: raise ValueError('There is not values for the variation') # return '-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markdown_row(self, ncol, which):\n if which == 'C':\n dat = self.C\n elif which == 'c':\n dat = self.d1\n elif which == 'f':\n dat = self.d2\n line = '|%d|' % (self.N*2)\n for i in range(1,self.N+1):\n line = line + ' $%s$ |' % (dat...
[ "0.6618691", "0.6070384", "0.5969445", "0.58566827", "0.5682454", "0.5663348", "0.561119", "0.55647975", "0.5547138", "0.5543002", "0.5538607", "0.5519833", "0.55188465", "0.55165124", "0.5512393", "0.5508666", "0.5506805", "0.54886913", "0.5485747", "0.5480672", "0.54616517"...
0.65805227
1
It converts a value to LaTeX format.
def latex_number(value): if isinstance(value, str): return value vstring = '%.4g' % value if vstring.find('e+0') > -1: vstring = vstring.replace('e+0', times + '10^{') + '}' elif vstring.find('e-0') > -1: vstring = vstring.replace('e-0', times + '10^{-') + '}' elif 'e' in vs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_plain(self, num):\n if not self.list:\n return \"\"\n values, erased_elements = self.list[num - 1]\n string_list = self.latex_string_list(values, erased_elements)\n if not string_list:\n raise ValueError('There is not values for the variation')\n ...
[ "0.67715603", "0.6675772", "0.65582216", "0.6503839", "0.6463353", "0.63243175", "0.6306905", "0.62547964", "0.6242212", "0.62054306", "0.61262876", "0.61166084", "0.6112766", "0.61125535", "0.61065334", "0.61004555", "0.60960007", "0.60960007", "0.6092518", "0.60917705", "0....
0.71467924
0
yield item i and item i+1 in lst. e.g. (lst[0], lst[1]), (lst[1], lst[2]), ..., (lst[1], None)
def pairwise(lst): if not lst: return for i in range(len(lst)-1): yield lst[i], lst[i+1] yield lst[-1], None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield2(l):\n\n l = list(l)\n\n for x in range(0,len(l),2):\n try:\n yield [l[x],l[x+1]]\n except IndexError:\n yield [l[x],None]", "def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]", "def pairs(lst):\n i = iter(lst)\n prev = ...
[ "0.69197124", "0.65074486", "0.64222676", "0.6343582", "0.6273688", "0.62291616", "0.6153805", "0.61379105", "0.5998668", "0.5965969", "0.5960291", "0.5940389", "0.5915628", "0.59025604", "0.5889104", "0.58803034", "0.5879002", "0.58734626", "0.5846317", "0.58102834", "0.5778...
0.6985501
0
Creates a directed edge pointing from 'tail' to 'head' and assigns 'dist' as its weight.
def add_edge(self, head, tail, dist): if tail not in self.nodes: self.add_node_pairs(head,None) if head not in self.nodes: self.add_node_pairs(head,tail) self.parents_length[head][tail]=dist self.edges += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEdge(self, tail, head, weight = None):\n weight = self.DefaultWeight if weight is None else weight\n \n # Add edge\n idx = self.__edgeCount\n self.__edges.append((tail, head, weight))\n \n # Add edge reference to nodes\n self.__nodes[head][\"heads\"].a...
[ "0.6667312", "0.62492687", "0.6143969", "0.6102092", "0.6037159", "0.6020094", "0.58860403", "0.5881167", "0.5685735", "0.5585233", "0.53725284", "0.5369754", "0.5311963", "0.52438104", "0.52148557", "0.52089596", "0.5208583", "0.5191479", "0.51715654", "0.5155043", "0.514820...
0.7548583
0
Classical Stops, when there is no better neighbor or the number of max iterations was achieved.
def _check_classical_stop_conditions(self, changed): searching = changed and (self._iteration < self._max_iterations) if not changed: self._notify(message=LocalSearchMessage.StoppedPrematurely) elif not searching: self._notify(message=LocalSearchMessage.Stopped) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n return not self.iteration < self.options['max_iters']", "def stop_conditions(self, G, E, T, P, I, known_winners, stats):\r\n\r\n in_deg = G.in_degree(I)\r\n possible_winners = [x[0] for x in in_deg if x[1] == 0]\r\n\r\n # Stop Condition 2: Pruning. Possible winners a...
[ "0.59913194", "0.5945561", "0.59046793", "0.58700895", "0.56864554", "0.56802803", "0.5628319", "0.55340874", "0.5492079", "0.5490388", "0.5486171", "0.5379612", "0.53599524", "0.532995", "0.53182477", "0.53022116", "0.529599", "0.52517056", "0.52317077", "0.52312714", "0.522...
0.6114224
0
make_parser() just generates the expert_system.py arguments parser.
def make_parser(): parser = argparse.ArgumentParser(description='Inference engine.') subparsers = parser.add_subparsers(dest="subcommand") subparsers.required = True solver_subparser = subparsers.add_parser('run') solver_subparser.add_argument( '-v', '--verbose', help='enable verbose mode.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parser(self, parser: ArgumentParser) -> None:", "def make_parser():\n parser = argparse.ArgumentParser(description='')\n parser.add_argument('-p', '--platform', dest='platform', type=str, required=False, default='')\n return parser", "def get_parser():\n parser = argparse.ArgumentParser(\...
[ "0.7339289", "0.72989213", "0.72359926", "0.72170365", "0.7084527", "0.70815355", "0.7067885", "0.7022615", "0.7015465", "0.6961379", "0.6957067", "0.6928461", "0.6898653", "0.68972975", "0.6877406", "0.68662924", "0.68332976", "0.682762", "0.6820871", "0.6820529", "0.681908"...
0.7300665
1
Compare parsed data from 'data/.org' and its correct answer 'data/.py'
def check_data(dataname): oname = data_path(dataname, "org") data = load_data(data_path(dataname, "py")) root = load(oname) for (i, (node, kwds)) in enumerate(zip(root[1:], data)): for key in kwds: val = value_from_data_key(node, key) eq_(kwds[key], val, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_one(data: str) -> int:\n\n def matches_p1(info: Mapping[str, int],\n test_result: Mapping[str, int]) -> bool:\n \"\"\"True if the info matches the test result.\"\"\"\n for key, value in info.items():\n if test_result[key] != value:\n return Fals...
[ "0.5453884", "0.54297304", "0.51756495", "0.5128516", "0.51006764", "0.506022", "0.50312287", "0.5004374", "0.5001393", "0.49696127", "0.49418846", "0.4936581", "0.4917701", "0.4915577", "0.49096048", "0.48870677", "0.48591587", "0.4848059", "0.48430166", "0.48426393", "0.483...
0.5778076
0
Combine several byte values to an integer
def combine_to_int(values): multibyte_value = 0 for byte_id, byte in enumerate(values): multibyte_value += 2**(4 * byte_id) * byte return multibyte_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_bits(byteseq) -> int:\n return reduce(lambda acc, bit: (acc << 1) | int(bit), byteseq)", "def combine_bytes(data):\n copy = data[:]\n copy.reverse()\n return sum(x << n*8 for n, x in enumerate(copy))", "def bytes_to_int(obj):\n return functools.reduce(lambda x, y: x << 8 | y...
[ "0.74009126", "0.7155913", "0.6995629", "0.6976125", "0.6892535", "0.68572396", "0.67954195", "0.6730761", "0.6557506", "0.64817655", "0.6480515", "0.6394394", "0.6384819", "0.6374511", "0.6367997", "0.6367997", "0.6343304", "0.63073856", "0.6288199", "0.6263672", "0.6253409"...
0.8158722
0
Read an unsigned integer from stream
def read_uint(stream, indent=INDENT): global _TMP_CACHE value = combine_to_int(streambyte_to_int(stream, 4)) formats = list(convert(value)) _TMP_CACHE = formats[3] output = str(formats[3]) + " (" + formats[0] + ", " + formats[1] if formats[2]: output += ', ascii:"' + formats[2] + '"' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyte = ord(stream.read(1))\n\t\tvalue = (value << 8) | byte\n\treturn value", "def read_unsigned_int(data):\n s_type = \"=%s\" % get_type(\"unsigned_int\")\n return struct.unpack(s_type, data.read(4))[0]", "def re...
[ "0.8487832", "0.7921936", "0.7279569", "0.6906661", "0.6898565", "0.6855954", "0.6704886", "0.6684063", "0.66748273", "0.6595611", "0.65646887", "0.6563214", "0.6541512", "0.6531965", "0.6524736", "0.64987266", "0.6464701", "0.639428", "0.6364297", "0.6361727", "0.6344467", ...
0.79351115
1
Creates a picture file of a specified frame from a movie file. Returns the filename of the picture file and the resolution of the picture.
def get_movie_frame(movie_file, frame=0): movie = cv2.VideoCapture(movie_file) _, image = movie.read() height, width, _ = image.shape filename = os.path.splitext(movie_file)[0] + f'_{frame}.jpg' cv2.imwrite(filename, image) return filename, height, width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_movie(name, folder):\n cmd = [\"ffmpeg\", \"-framerate\", \"1\", \"-i\", folder + \"/pic%04d.png\", \"-c:v\",\n \"libx264\", \"-r\", \"30\", \"-pix_fmt\", \"yuv420p\", name]\n return subprocess.call(cmd)", "def generate_frame(video_path, video_name, second, label, dest_path):\n prin...
[ "0.64213306", "0.6180451", "0.61662143", "0.61292905", "0.5967412", "0.59391665", "0.5868147", "0.5852572", "0.583748", "0.58128595", "0.5754962", "0.5685752", "0.5667884", "0.5650534", "0.5596453", "0.5583347", "0.55816", "0.5557348", "0.55293703", "0.5512724", "0.5508874", ...
0.7556119
0
find user by comment pattern
def find_comment_by_user(self, pat): return [com for th in self for com in th['comment'] if pat in com['user']]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_user_comments(username):\n # comment = [\n # comment for comment in commentslist if comment[\"username\"] == username\n # ]\n return commentslist", "def all_user_comments(username):\n return commentslist", "def do_get_user_comments(parser, token):\r\n error_message = \"%r tag must...
[ "0.63126326", "0.5819406", "0.5702445", "0.5675357", "0.56422603", "0.56422603", "0.56102854", "0.5577965", "0.5576352", "0.5525575", "0.5476471", "0.54152066", "0.53939104", "0.53700864", "0.5350155", "0.5285035", "0.52628917", "0.5246869", "0.5244756", "0.5238313", "0.52375...
0.7989754
0
get all title in object.
def get_title(self): return [i['title'] for i in self]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_title() -> list:\n return [i[\"title\"] for i in Blogs_Manager.TablePost.all_query()]", "def get_title(self, obj):\n title = obj.habit.title\n return title", "def Titles(self, default=[{}]):\n tmp = self.data.get('metadata', {}).get('titles', default)\n re...
[ "0.7709734", "0.74078983", "0.733542", "0.7251194", "0.72361875", "0.7054243", "0.69260806", "0.6910706", "0.6898647", "0.68741524", "0.68402195", "0.6833088", "0.6765569", "0.6748402", "0.67440933", "0.6733272", "0.67111826", "0.67089796", "0.67089796", "0.67089796", "0.6705...
0.8342249
0
Perform place name cleanup and optional substitution for bulk edits
def clean_place(place, places): result = place result = result.replace(" ", " ") for match in places: result = result.replace(match, places[match]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanupAddress(self, address):\n clean = []\n \n # This is sort of a desultory effort but I'm not convinced \n # that these cleanups will actually result in cleaner searches\n for word in address.split(None):\n lower = word.lower()\n \n # Som...
[ "0.5786155", "0.57768613", "0.5692057", "0.5659837", "0.5583913", "0.5575577", "0.55560493", "0.55483913", "0.5466927", "0.5454838", "0.54088426", "0.5286594", "0.5237372", "0.51936316", "0.51838994", "0.5176377", "0.5176342", "0.5172068", "0.5161752", "0.5147288", "0.5124723...
0.6472594
0
Read in requested APID files and push on queue until told to exit
def read_apids(local_queue, local_lock, remote_queue, remote_lock): while True: local_lock.acquire() if not local_queue.empty(): file_data = local_queue.get() local_lock.release() else: local_lock.release() time.sleep(0.01) continue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recv_loop():\n\n if not os.path.isdir(tq_dir):\n os.mkdir(tq_dir)\n if not os.path.isdir(rq_dir):\n os.mkdir(rq_dir)\n\n while True:\n time.sleep(1)\n #print ('polling')\n try:\n files = os.listdir(rq_dir)\n except:\n print ('Could not ge...
[ "0.6323818", "0.6304677", "0.57885736", "0.5685431", "0.5615635", "0.54791087", "0.5464241", "0.54186374", "0.53929704", "0.5357314", "0.5344923", "0.5337896", "0.532199", "0.5316566", "0.52678597", "0.524889", "0.52359426", "0.52292633", "0.5214855", "0.52005935", "0.5195116...
0.7389972
0
Read in all the APID objects for reference using asynchronous workers
def get_apid_objects(queue, media_base, args, absolute=False): work_lock = Lock() work_queue = Queue() readers = os.cpu_count() read_lock = Lock() read_queue = Queue() read_processes = [] for number in range(readers): read_process = Process( target=read_apids, args=(read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_apids(local_queue, local_lock, remote_queue, remote_lock):\n while True:\n local_lock.acquire()\n if not local_queue.empty():\n file_data = local_queue.get()\n local_lock.release()\n else:\n local_lock.release()\n time.sleep(0.01)\n ...
[ "0.6155659", "0.60204107", "0.587751", "0.564038", "0.56133544", "0.5512685", "0.5505457", "0.54800045", "0.5427209", "0.54132915", "0.54088765", "0.53685343", "0.5349989", "0.53343546", "0.5326083", "0.5318044", "0.5311771", "0.5308123", "0.52900517", "0.5249697", "0.5224048...
0.63363236
0
Read in all the person URLs for later reference
def get_people_urls(gedcom_data, apid_full_map): people = {} found = False logging.info("Extracting person specific URL information") for line in gedcom_data.split("\n"): if len(line) > 5: tag = line.split(" ")[1] if "@P" in tag: person = tag ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def read_urls(filename):\n # +++your code here+++\n\n res=utility(filename)\n for i in res:\n \tprint i", "def load_links(self) -> Tuple[List[str], List[str]]:\n\n with open(URL_FILE, 'r') as txt_file:\n lines = txt_file.read().split()\n\n urls = []\n for l...
[ "0.70426035", "0.64418465", "0.62663215", "0.61901027", "0.60748374", "0.6055872", "0.6048259", "0.59703493", "0.5958344", "0.5953617", "0.5951106", "0.592673", "0.5882076", "0.5855703", "0.58396393", "0.5832711", "0.5832409", "0.5831165", "0.5822159", "0.58152395", "0.580517...
0.68221956
1
Write out a line of Gedcom data insuring it does not exceed allowed length
def emit_line(handle, data): if len(data) > 254: if " PAGE " in data: data = data.replace("Record Group Title", "Record Group") data = data.replace("Series Title", "Series") data = data.replace( "Washington, D.C.; Washington, D.C.;", "Washington, D.C.;" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_data_line(line, max_name, max_roomcode, max_type):\n print(\"|\", end='')\n print(line[0], end='')\n print(\"|\", end='')\n print(line[1], end='')\n print(\" \" * (max_name - len(line[1])), end='')\n print(\"|\", end='')\n print(line[4], end='')\n print(\" \" * (max_type - len(lin...
[ "0.56903803", "0.5489665", "0.54523206", "0.5378752", "0.5349408", "0.53379905", "0.52652675", "0.5249946", "0.52357846", "0.52295005", "0.51805323", "0.51701444", "0.5162959", "0.5162894", "0.51591486", "0.5157437", "0.5155583", "0.5123629", "0.51112854", "0.50998205", "0.50...
0.66104794
0
Takes the value of two cells and adjusts them accordingly.
def interact(self,cell1,cell2): difference = math.fabs(cell1-cell2) if difference<=self.t: #if both cells are close enough: if cell1>cell2: # print "Case 1" return (cell1-difference/2.0,cell2+difference/2.0) else: # print "Case 2" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(self):\n for i in range(len(self.main_grid_values)):\n for j in range(len(self.main_grid_values) - 1):\n if self.main_grid_values[i][j] == self.main_grid_values[i][j+1]:\n self.score_value.set(str(int(self.score_value.get()) + self.main_grid_values[i][j...
[ "0.6038205", "0.5996258", "0.5829854", "0.5771477", "0.5723827", "0.5544646", "0.54631525", "0.5455503", "0.5447687", "0.54307187", "0.5390833", "0.5390833", "0.53664184", "0.535484", "0.52980626", "0.5271178", "0.526774", "0.5264504", "0.5250048", "0.5231069", "0.5182544", ...
0.6145935
0
Manager Status Pool Members Enable/Disabled By Pool
def manager_pools(request): try: pool_id = request.DATA.get('server_pool_id') pool_members = request.DATA.get('server_pool_members', []) # List to validate pool member status valid_status = [0, 1, False, True] pool_members_id = [member.get('id') for member in pool_members]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_On(self):\n if not(self._locked):\n self.__dict__['statusOn']=True\n self._do_action()\n else:\n self._log.info('The JobProperty %s is blocked', self.__name__)", "def is_enabled(self):", "async def admin_enable(self, ctx: commands.Context):\n if ctx.gui...
[ "0.5972825", "0.5882451", "0.5846002", "0.576952", "0.57574105", "0.5755515", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.568081", "0.5608541", "0.55335087", "0.5524982", "0.5500714", "0.5495525"...
0.63845223
0
Calculates the clustering coefficient for each node in the graph. The values are stored in a new attribute named 'cc'.
def calc_cc(graph): clustering_coeffs = {} for node in graph.nodes(): clustering_coeffs[node] = { "cc" : nx.clustering(graph, node)} nx.set_node_attributes(graph, clustering_coeffs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_cal(self):\n self.Cluster = []\n for i in range(self.nodenum):\n neighborhood_node = self.neighbor_node(i)\n Node_num = len(neighborhood_node)\n Count = self.neighbor_edge(neighborhood_node)\n if(Node_num == 0 or Node_num == 1):\n ...
[ "0.7375496", "0.6681537", "0.65261406", "0.63784915", "0.632297", "0.6303684", "0.62366426", "0.61979914", "0.6184349", "0.6158771", "0.612508", "0.6091614", "0.60914373", "0.6069798", "0.6000489", "0.59578973", "0.5938521", "0.5933415", "0.588119", "0.5852891", "0.5821287", ...
0.8281281
0
Calculates the clustering coefficient for each node in the graph. The values are then plotted as a histogram.
def plot_cc(graph): clustering_coeffs = [] for node in graph.nodes(): clustering_coeffs.append(nx.clustering(graph, node)) plt.axvline(x=np.mean(clustering_coeffs), color='r', linestyle='-') plt.hist(clustering_coeffs, bins=100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_cal(self):\n self.Cluster = []\n for i in range(self.nodenum):\n neighborhood_node = self.neighbor_node(i)\n Node_num = len(neighborhood_node)\n Count = self.neighbor_edge(neighborhood_node)\n if(Node_num == 0 or Node_num == 1):\n ...
[ "0.7625881", "0.6849659", "0.6656916", "0.66148716", "0.6472956", "0.644384", "0.6349821", "0.6341826", "0.6276322", "0.61957955", "0.6153638", "0.61169475", "0.5934344", "0.5846062", "0.5820086", "0.57986057", "0.579354", "0.57883286", "0.57248896", "0.57124126", "0.57108563...
0.746184
1
Caches OMDb API response json on disk.
def cache_movie_json(title: str, json_response: Dict) -> None: fpath = os.path.join(OMDB_JSONS_DIR, title) with open(fpath, 'a+') as fp: json.dump(json_response, fp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cached_response(self) -> None:\n if self.get_caching_duration() > 0: # if caching is enabled for this request\n json_response = self._request_result.json()\n with open(self.cache_file_name, 'w') as json_file:\n json.dump(json_response, json_file, indent=4)", "...
[ "0.6876007", "0.6522492", "0.6492315", "0.63387483", "0.6337903", "0.6236551", "0.62285954", "0.6199549", "0.6189966", "0.61678773", "0.60736793", "0.6035631", "0.5948868", "0.5943278", "0.59335274", "0.58905095", "0.58657914", "0.5864758", "0.5830223", "0.5787745", "0.572220...
0.6622096
1
Fetches the movie json from disk, if available.
def load_movie_json_from_cache(title: str) -> Optional[Dict]: fpath = os.path.join(OMDB_JSONS_DIR, title) if os.path.exists(fpath): with open(fpath, 'r') as fp: return json.load(fp) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_file():\r\n urlretrieve(URL, PATH)\r\n return PATH", "def json_file():\r\n urlretrieve(URL, PATH)\r\n return PATH", "def get_and_cache_movie_json(title: str) -> Dict:\n cached = load_movie_json_from_cache(title)\n if cached:\n return cached\n rsp = requests.get(url='http://...
[ "0.6494401", "0.6494401", "0.6475377", "0.6409212", "0.62731344", "0.62499857", "0.61754566", "0.61698765", "0.61523175", "0.5960386", "0.5959849", "0.5950304", "0.59249324", "0.58719826", "0.5846558", "0.5820963", "0.5818969", "0.5774229", "0.57567364", "0.57481164", "0.5746...
0.69290215
0
Fetches json for the movie titled |title| from omdapi.com or from local cache. If the json response is not cached yet, caches it on disk.
def get_and_cache_movie_json(title: str) -> Dict: cached = load_movie_json_from_cache(title) if cached: return cached rsp = requests.get(url='http://www.omdbapi.com', params={ 't': title, 'plot': 'full', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_movie_json_from_cache(title: str) -> Optional[Dict]:\n fpath = os.path.join(OMDB_JSONS_DIR, title)\n if os.path.exists(fpath):\n with open(fpath, 'r') as fp:\n return json.load(fp)\n return None", "def fetch_movie(title: str) -> Union[None, dict]:\n\n url = '{base_url}?apik...
[ "0.802759", "0.7772897", "0.7702282", "0.73983467", "0.6875741", "0.655665", "0.6518106", "0.63151324", "0.62010515", "0.6199477", "0.6192997", "0.61869437", "0.61589605", "0.6130619", "0.60600305", "0.5981807", "0.5956489", "0.5930423", "0.591873", "0.5851872", "0.58518136",...
0.88662964
0
Preprocesses the movie json from OMDb API to optimize the resulting contexts for vectorization.
def preprocess_movie_json(json_dict: Dict) -> Dict: json_dict['Ratings'] = list(map(lambda elem: {elem['Source']: elem['Value']}, json_dict['Ratings'])) for obj in json_dict['Ratings']: if 'Metacritic' in obj: obj['Metacritic'] = ' / '.join(obj['Metacritic'].split('/')) return json_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self):\r\n file_name = os.path.join(self.raw_path, \"amazon-amazon-instant-video.json.gz\")\r\n print(f\"file_name: {file_name}\")\r\n if not os.path.exists(file_name):\r\n self.download()\r\n\r\n # parse json data\r\n data = self.get_data_frame_from_gzi...
[ "0.59400994", "0.5717198", "0.55811983", "0.55584913", "0.54126775", "0.54126775", "0.54126775", "0.53938264", "0.5378241", "0.5317608", "0.52581203", "0.5171884", "0.515429", "0.5110954", "0.5107839", "0.5051084", "0.5045347", "0.50321424", "0.5017804", "0.5013012", "0.49955...
0.58627486
1
BJONTEGAARD Bjontegaard metric calculation Bjontegaard's metric allows to compute the average gain in psnr between two ratedistortion curves [1]. rate1,psnr1 RD points for curve 1 rate2,psnr2 RD points for curve 2 returns the calculated Bjontegaard metric 'dsnr'
def bdsnr(metric_set1, metric_set2): rate1 = [x[0] for x in metric_set1] psnr1 = [x[1] for x in metric_set1] rate2 = [x[0] for x in metric_set2] psnr2 = [x[1] for x in metric_set2] log_rate1 = map(lambda x: math.log(x), rate1) log_rate2 = map(lambda x: math.log(x), rate2) # Best cubic poly fit for graph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bdrate(metric_set1, metric_set2):\n rate1 = [x[0] for x in metric_set1]\n psnr1 = [x[1] for x in metric_set1]\n rate2 = [x[0] for x in metric_set2]\n psnr2 = [x[1] for x in metric_set2]\n\n log_rate1 = map(lambda x: math.log(x), rate1)\n log_rate2 = map(lambda x: math.log(x), rate2)\n\n # Best cubic pol...
[ "0.67012316", "0.61520374", "0.6125892", "0.5854409", "0.5728218", "0.56234306", "0.5541663", "0.54110897", "0.53992426", "0.53967667", "0.53620905", "0.5353045", "0.53527695", "0.53336406", "0.5302401", "0.5296993", "0.52581674", "0.52486175", "0.522415", "0.52038", "0.52024...
0.716817
0
BJONTEGAARD Bjontegaard metric calculation Bjontegaard's metric allows to compute the average % saving in bitrate between two ratedistortion curves [1]. rate1,psnr1 RD points for curve 1 rate2,psnr2 RD points for curve 2
def bdrate(metric_set1, metric_set2): rate1 = [x[0] for x in metric_set1] psnr1 = [x[1] for x in metric_set1] rate2 = [x[0] for x in metric_set2] psnr2 = [x[1] for x in metric_set2] log_rate1 = map(lambda x: math.log(x), rate1) log_rate2 = map(lambda x: math.log(x), rate2) # Best cubic poly fit for grap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bdsnr(metric_set1, metric_set2):\n rate1 = [x[0] for x in metric_set1]\n psnr1 = [x[1] for x in metric_set1]\n rate2 = [x[0] for x in metric_set2]\n psnr2 = [x[1] for x in metric_set2]\n\n log_rate1 = map(lambda x: math.log(x), rate1)\n log_rate2 = map(lambda x: math.log(x), rate2)\n\n # Best cubic poly...
[ "0.6383348", "0.6098073", "0.585354", "0.58204496", "0.58165455", "0.57749337", "0.57745576", "0.5752903", "0.5697786", "0.5641248", "0.5571546", "0.5560683", "0.5552073", "0.55416924", "0.5534041", "0.5498988", "0.5461577", "0.54605436", "0.5458923", "0.5457215", "0.5454744"...
0.67239475
0
This function substitutes all matches of the command string //%% ... %%// with the variable represented by ... .
def FillForm(string_for_substitution, dictionary_of_vars): return_string = string_for_substitution for i in re.findall("//%%(.*)%%//", string_for_substitution): return_string = re.sub("//%%" + i + "%%//", dictionary_of_vars[i], return_string) return return_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute_macros(text):\n f_text = text\n for (pattern,replacement) in context.environment.items():\n replacement = replacement.replace(os.path.sep,'/')\n f_text = f_text.replace('$(%s)' % pattern.upper(), replacement)\n return f_text", "def exp...
[ "0.62112534", "0.59826636", "0.5958819", "0.5950015", "0.5752494", "0.571099", "0.5707838", "0.5682728", "0.5641463", "0.5615115", "0.560229", "0.5584913", "0.55823714", "0.55597454", "0.55482215", "0.5544765", "0.55424446", "0.5502012", "0.54822093", "0.54639417", "0.5443165...
0.6505988
0
Compares two data files and determines which is better and by how much. Also produces a histogram of how much better, by PSNR. metric_column is the metric.
def FileBetter(file_name_1, file_name_2, metric_column, method): # Store and parse our two files into lists of unique tuples. # Read the two files, parsing out lines starting with bitrate. metric_set1_sorted = ParseMetricFile(file_name_1, metric_column) metric_set2_sorted = ParseMetricFile(file_name_2, metric_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_mi_histograms(outfile, infile1, infile2, maxv=None):\n data1 = file_columns_to_list(infile2, 0, 1)\n data2 = file_columns_to_list(infile1, 0, 1)\n # print \"{} values read from {}\\n{} values read from {}\".format(len(data1), infile1, len(data2), infile2)\n # print data1\n # print data2\...
[ "0.6057343", "0.57366204", "0.5611105", "0.5606635", "0.55441916", "0.5534631", "0.5529128", "0.55162174", "0.54891115", "0.54773545", "0.5474303", "0.545391", "0.5449866", "0.5439635", "0.5427919", "0.53524166", "0.5326327", "0.5322214", "0.52985394", "0.5292396", "0.5288102...
0.6713742
0
Transcribe the given audio file.
def transcribe_file(speech_file): client = speech.SpeechClient() # [START speech_python_migration_sync_request] # [START speech_python_migration_config] with io.open(speech_file, 'rb') as audio_file: content = audio_file.read() audio = types.RecognitionAudio(content=content) config = ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transcribe_audio_file(filename):\n url = 'https://api.nexiwave.com/SpeechIndexing/file/storage/' + USERNAME +'/recording/?authData.passwd=' + PASSWORD + '&auto-redirect=true&response=application/json'\n\n # To receive transcript in plain text, instead of html format, comment this line out (for SMS, for e...
[ "0.78248394", "0.7398992", "0.7290615", "0.70276856", "0.69510454", "0.6877462", "0.68724436", "0.67233807", "0.6587347", "0.6500316", "0.64872146", "0.64400893", "0.642459", "0.6407884", "0.63816243", "0.6294307", "0.62426466", "0.623615", "0.6137749", "0.61309946", "0.61234...
0.75156033
1
Send feedback about the bot. ~ {prefix}feedback this bot is very good. {prefix}feedback I have a command idea...
async def feedback(self, ctx, *, feedback): url = os.environ.get("FEEDBACK_WEBHOOK", None) if url: webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter()) embed = discord.Embed(description=feedback, colour=discord.Colour.teal()) embed.set_author(name=f"{ctx....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback(ctx, message):\n client = ctx.obj[\"client\"]\n\n if len(message) > 0:\n message = \" \".join(message)\n else:\n message = click.edit(\n text=\"Type your message here. \" + \"Save and exit to send, or just exit to abort.\",\n require_save=True,\n )\n...
[ "0.7480151", "0.70995945", "0.67622775", "0.6705195", "0.6685891", "0.66345656", "0.662006", "0.6612595", "0.65957254", "0.6570445", "0.65471214", "0.6520901", "0.64887464", "0.64525855", "0.6448991", "0.64439625", "0.6428348", "0.64151114", "0.6389258", "0.6355255", "0.63476...
0.7884984
0
Simplify potentially variable ways to write out a reference name by lowercasing it and replacing all dashes and spaces with underscores.
def normalize_reference_name(name): return name.strip().lower().replace("-", "_").replace(" ", "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alias(name):\n name = name.strip().replace(\" \", \"_\").replace(\"-\", \"_\")\n while \"__\" in name:\n name = name.replace(\"__\", \"_\")\n return \"\".join(x for x in name if x.isalnum() or x == \"_\").lower()", "def standardize_name_for_look_up(name: Any) -> str:\n if not isinstance(na...
[ "0.70998156", "0.7003269", "0.6665515", "0.6640907", "0.6600399", "0.6583076", "0.6553574", "0.65327954", "0.6518479", "0.64910334", "0.6475837", "0.6472342", "0.64669734", "0.6464317", "0.63989496", "0.6360557", "0.63560957", "0.6332419", "0.6319861", "0.63196796", "0.631410...
0.8024314
0
Is the given genome name one of the known UCSC genomes?
def is_ucsc_reference_name(name): return (normalize_reference_name(name) in normalized_ucsc_reference_names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_other_chromosome(chromosome_name):\n if is_cassette_chromosome(chromosome_name): return False\n if chromosome_name.startswith('chr') or chromosome_name.startswith('scaffold'): return False\n else: ...
[ "0.69598854", "0.65797675", "0.6408928", "0.6234476", "0.61418325", "0.613772", "0.5937815", "0.58789945", "0.5813106", "0.57147247", "0.57124645", "0.566361", "0.5655239", "0.56369895", "0.56239724", "0.5580579", "0.55737114", "0.54856974", "0.54623044", "0.5455868", "0.5444...
0.707976
0
Combine the dictionary of Ensembl reference name aliases with the UCSC reference names (which also get included as aliases). Returns dict
def _merge_ensembl_aliases_with_ucsc(): result = {} for ucsc_name, ensembl_name in ucsc_to_ensembl_reference_names.items(): result[ensembl_name] = [ucsc_name] + \ ensembl_reference_aliases.get(ensembl_name, []) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases():\n fetch(\"PropertyValueAliases.txt\")\n longforms = {}\n shortforms = {}\n re1 = re.compile(r\"^ *sc *; *(\\w+) *; *(\\w+)\")\n for line in fileinput.input(os.path.basename(\"PropertyValueAliases.txt\")):\n m = re1.match(line)\n if m:\n l = m.group(2).strip()\...
[ "0.6652346", "0.6339452", "0.59882975", "0.59799945", "0.5969476", "0.5886957", "0.57875973", "0.5781445", "0.5747085", "0.5613226", "0.5564919", "0.55310863", "0.5479056", "0.546304", "0.5438136", "0.5368198", "0.5339732", "0.5336141", "0.533225", "0.52910334", "0.5268792", ...
0.8551453
0
Given list of (in this case, matched) assemblies, identify the most recent, where "recency" is determined by sorting based on the numeric element of the assembly name.
def most_recent_assembly_name(assembly_names): match_recency = [ int(re.search(r'\d+', assembly_name).group()) for assembly_name in assembly_names ] sorted_list_of_names = [ assembly for (number, assembly) in sorted(zip(match_recency, assembly_names), reverse=True)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_best_assembly_name(assembly_names):\n assembly_names = set(assembly_names)\n\n if len(assembly_names) == 1:\n return list(assembly_names)[0]\n\n assembly_names_ucsc = {\n name for name in assembly_names if is_ucsc_reference_name(name)}\n assembly_names_ensembl = assembly_names....
[ "0.64348733", "0.6002033", "0.5500519", "0.54322505", "0.54054475", "0.53802925", "0.53716606", "0.5368761", "0.518061", "0.5138246", "0.51265377", "0.5111307", "0.50589097", "0.50443345", "0.50428873", "0.5027242", "0.50229055", "0.49980673", "0.49654183", "0.4945018", "0.49...
0.75582594
0