query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Computes the air density
def RHO(p,tv): _rd=287.053 # Gas constant for dry air _tv=tv*1. if np.nanmax(_tv)<100: _tv +=273.15# NB: C-->K if np.nanmax(p)<2000: p*=100 # hPa to Pa rho=np.divide(p,np.multiply(_rd,_tv)) return rho
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def air_density(self):\n return self.flow_field.air_density", "def density_of_air(self) -> float:\n\n return self.pressure / (SPECIFIC_GAS_CONSTANT_OF_AIR * self.ambient_temperature)", "def air_density(altitude):\n p = pressure(altitude) # psf\n t = temperature(altitude) # R\n rho = p/...
[ "0.8088788", "0.7575788", "0.7532649", "0.70429206", "0.6925253", "0.6691889", "0.6489299", "0.64233905", "0.6404493", "0.634534", "0.6317666", "0.62641746", "0.624726", "0.6225272", "0.6224025", "0.61777043", "0.61749846", "0.6173771", "0.6144194", "0.61093634", "0.60729814"...
0.0
-1
initialize weights and threshold based on input arguments.
def __init__(self, weights=np.array([1]), threshold=0): self.weights = weights self.threshold = threshold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def init_weights_(self):\n raise NotImplementedError", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()", "def init_weights(self):\n # Initi...
[ "0.74358875", "0.74069947", "0.7295503", "0.722618", "0.7069061", "0.6869385", "0.68263906", "0.67593724", "0.67395127", "0.6722039", "0.6721932", "0.67041874", "0.66074723", "0.6598126", "0.6566606", "0.6559926", "0.6559485", "0.65505767", "0.6538249", "0.65252817", "0.65252...
0.82167745
0
Get the last error value, then turn it into a nice string. Return the string.
def get_last_error(): error_id = kernel32.GetLastError() # No actual error if error_id == 0: return None # Gonna need a string pointer buf = ffi.new("LPWSTR") chars = kernel32.FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLastExceptionString():\n (exc, error) = sys.exc_info()[0:2]\n exc_msg = str(exc)\n if '<class' in exc_msg:\n exc_msg = exc_msg.split(\"'\")[1]\n\n exc_msg = exc_msg.replace('dns.exception.', '')\n error = '%s %s' % (exc_msg, error)\n # We need to remove the trailing space at some point.\n return e...
[ "0.7328513", "0.7111968", "0.7021454", "0.70003325", "0.69528633", "0.6913359", "0.6690948", "0.6670149", "0.6569769", "0.6548604", "0.6537746", "0.6513374", "0.6488014", "0.64193314", "0.63823825", "0.63724697", "0.63373506", "0.63226837", "0.63206697", "0.63149035", "0.6314...
0.70455366
2
Translates window screen coordinates to client coordinates.
def screen_to_client(self, h_wnd): return screen_to_client(h_wnd, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, h_wnd_from=HWND_DESKTOP, h_wnd_to=HWND_DESKTOP):\n points = [(self.left, self.top), (self.right, self.bottom)]\n return map_window_points(h_wnd_from, h_wnd_to, points)", "def client_to_screen(self, h_wnd):\n topleft = client_to_screen(h_wnd, (self.left, self.top))\n ...
[ "0.6911647", "0.687672", "0.6724786", "0.64854413", "0.6424445", "0.63403136", "0.6247594", "0.6226036", "0.6134524", "0.60914207", "0.60803926", "0.6073212", "0.59958386", "0.5940359", "0.59166497", "0.5830678", "0.5787844", "0.5780775", "0.5737968", "0.56814885", "0.5678975...
0.6230344
7
Translates window client coordinates to screen coordinates.
def client_to_screen(self, h_wnd): return client_to_screen(h_wnd, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, h_wnd_from=HWND_DESKTOP, h_wnd_to=HWND_DESKTOP):\n points = [(self.left, self.top), (self.right, self.bottom)]\n return map_window_points(h_wnd_from, h_wnd_to, points)", "def client_to_screen(self, h_wnd):\n topleft = client_to_screen(h_wnd, (self.left, self.top))\n ...
[ "0.6988184", "0.67997557", "0.65164655", "0.64731133", "0.6253972", "0.621387", "0.6190013", "0.61088026", "0.61063373", "0.60343206", "0.602864", "0.59666455", "0.59329396", "0.5781834", "0.56813246", "0.5679642", "0.56572706", "0.5637912", "0.55977017", "0.55974686", "0.559...
0.61267453
7
Translates window screen coordinates to client coordinates.
def screen_to_client(self, h_wnd): topleft = screen_to_client(h_wnd, (self.left, self.top)) bottomright = screen_to_client(h_wnd, (self.bottom, self.right)) return Rect(topleft.x, topleft.y, bottomright.x, bottomright.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, h_wnd_from=HWND_DESKTOP, h_wnd_to=HWND_DESKTOP):\n points = [(self.left, self.top), (self.right, self.bottom)]\n return map_window_points(h_wnd_from, h_wnd_to, points)", "def client_to_screen(self, h_wnd):\n topleft = client_to_screen(h_wnd, (self.left, self.top))\n ...
[ "0.6911647", "0.687672", "0.64854413", "0.6424445", "0.63403136", "0.6247594", "0.6230344", "0.6226036", "0.6134524", "0.60914207", "0.60803926", "0.6073212", "0.59958386", "0.5940359", "0.59166497", "0.5830678", "0.5787844", "0.5780775", "0.5737968", "0.56814885", "0.5678975...
0.6724786
2
Translates window client coordinates to screen coordinates.
def client_to_screen(self, h_wnd): topleft = client_to_screen(h_wnd, (self.left, self.top)) bottomright = client_to_screen(h_wnd, (self.bottom, self.right)) return Rect(topleft.x, topleft.y, bottomright.x, bottomright.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, h_wnd_from=HWND_DESKTOP, h_wnd_to=HWND_DESKTOP):\n points = [(self.left, self.top), (self.right, self.bottom)]\n return map_window_points(h_wnd_from, h_wnd_to, points)", "def screen_to_client(self, h_wnd):\n topleft = screen_to_client(h_wnd, (self.left, self.top))\n ...
[ "0.6988184", "0.65164655", "0.64731133", "0.6253972", "0.621387", "0.6190013", "0.61267453", "0.61088026", "0.61063373", "0.60343206", "0.602864", "0.59666455", "0.59329396", "0.5781834", "0.56813246", "0.5679642", "0.56572706", "0.5637912", "0.55977017", "0.55974686", "0.559...
0.67997557
1
Load in slip systems from file. 3 integers for slip plane normal and 3 for slip direction. Returns a list of list of slip systems grouped by slip plane.
def load(name, crystalStructure, cOverA=None, groupBy='plane'): # try and load from package dir first try: fileExt = ".txt" packageDir, _ = os.path.split(__file__) filepath = f"{packageDir}/slip_systems/{name}{fileExt}" slipSystemFile = open(filepath) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLsystemFromFile( filename ):\n\tfp = open(filename, \"r\")\n\tlines = fp.readlines()\n\tfp.close()\n\tlsys = init()\n\tfor line in lines:\n\t\twords = line.split()\n\t\tif words[0] == 'base':\n\t\t\tsetBase(lsys, words[1])\n\t\telif words[0] == 'rule':\n\t\t\taddRule(lsys, words[1:])\n\treturn lsys", "...
[ "0.6289391", "0.5827481", "0.57126117", "0.5691731", "0.5610091", "0.5580039", "0.55767643", "0.53915215", "0.5347351", "0.5343848", "0.53318816", "0.53284085", "0.52800757", "0.5276263", "0.52678186", "0.52649075", "0.52390105", "0.522971", "0.52043563", "0.52033377", "0.519...
0.6828519
0
Generates random colors. Color.RED with 1/3 and Color.BLACK with 2/3 probability.
def _get_random_color(self): random_number = random.random() if random_number <= 1 / 3.0: return Color.RED else: return Color.BLACK
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]", "def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)", "def _genRandomColor():\n b = random.randint(0, 255)\n g = random.randint(0, ...
[ "0.8339735", "0.8075161", "0.7885394", "0.788348", "0.7826575", "0.77174824", "0.7710736", "0.76617014", "0.76451856", "0.76421994", "0.76181316", "0.756889", "0.7560552", "0.7509352", "0.7487519", "0.74852407", "0.7431164", "0.74289817", "0.74040896", "0.7403635", "0.7372824...
0.7603502
11
Returns the best action possible in state s.
def choose_best_action(self, s): raise NotImplemented()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _best_action(self, state):\n actions_rewards = list(self.Q[state].items())\n return max(actions_rewards, key=lambda x: x[1])[0]", "def getBestAction(self, state):\n best_action = 0\n max_Q = -9999\n\n for action in self.getLegalActions(state):\n Q = self.getQValu...
[ "0.84041375", "0.83494097", "0.82477665", "0.8184842", "0.81075436", "0.80925196", "0.7850672", "0.78151333", "0.77984", "0.7759665", "0.77576095", "0.7745814", "0.7676397", "0.76517326", "0.76159114", "0.7610927", "0.75898933", "0.75406533", "0.7539394", "0.7524829", "0.7496...
0.8097551
5
check if a new chunk started between the previous and current word
def is_chunk_start(prev_tag, tag): prefix1, chunk_type1 = split_tag(prev_tag) prefix2, chunk_type2 = split_tag(tag) if prefix2 == 'O': return False if prefix1 == 'O': return prefix2 != 'O' if chunk_type1 != chunk_type2: return True return prefix2 in ['B', 'S'] or prefi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hasMore(self): #$NON-NLS-1$\r\n found = False\r\n self._setIeWord(None)\r\n self._setIeSentence(None)\r\n moveCount = 1 # number of words moved. If this is 0, then there is no 'next word'\r\n if self.currRange and self.endRange and self.startRange:\r\n # end of do...
[ "0.64714223", "0.64157623", "0.62573755", "0.6216005", "0.6201482", "0.59428453", "0.58791757", "0.58472997", "0.58375716", "0.58274645", "0.57998115", "0.5741804", "0.56975996", "0.5682696", "0.5679295", "0.56639445", "0.56394476", "0.5635118", "0.5628108", "0.560133", "0.56...
0.6540808
0
A short representation of the object
def repr(self): raise InterpreterError("Unimplemented repr()")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringify_short(self):\n return self.stringify()", "def __str__(self):\n return str(self.__dict__['_obj'])", "def to_short_string(self):\n return f'{self.name} - {self.resource_type}'", "def __str__(self):\n return str(self.serialize())", "def __repr__(self):\n ...
[ "0.7715198", "0.7068685", "0.7034965", "0.69751126", "0.69612944", "0.6950877", "0.69289017", "0.68919617", "0.6837801", "0.6837801", "0.6837801", "0.6837801", "0.6837801", "0.6825278", "0.6814406", "0.67487365", "0.6735115", "0.6727017", "0.6727017", "0.6727017", "0.6727017"...
0.0
-1
Get an attribute by reference Implements e.g. ... =& $x>attr Returns the new value of $x and the reference.
def getattr_ref(self, interp, name, contextclass=None): interp.warn('Attempt to modify property of non-object') return interp.space.empty_ref()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ref(element):\n return int(element['attrs']['ref'])", "def ref(self, attribute):\n attribute_to_field = {\n 'title': 'T',\n 'username': 'U',\n 'password': 'P',\n 'url': 'A',\n 'notes': 'N',\n 'uuid': 'I',\n }\n ...
[ "0.6214337", "0.5825381", "0.5822674", "0.56593996", "0.5570551", "0.55653614", "0.55328864", "0.55160964", "0.5503773", "0.54645044", "0.5459306", "0.5450127", "0.5429975", "0.5425124", "0.5396926", "0.53945214", "0.5367309", "0.53460824", "0.53449917", "0.5343275", "0.53378...
0.514099
38
Returns the dictionary of test variables. If the library is invoked as a standalone executable, return a mockup dictionary, otherwise return the RobotFramework test variable dictionary.
def _get_test_variables(): if __name__ == "__main__": return _MOCKUP_TEST_VARIABLES else: return BuiltIn().get_variables()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variables_get(self):\n pass", "def tests(self):\n\n return {\n 'variable_boolean': self.variable_boolean\n }", "def required_test_config_variables(cls) -> Tuple[str, ...]:\n return (\"shell_cmd\", \"expect\", \"known_logline\")", "def set_vars():\n return di...
[ "0.6096", "0.5887758", "0.58755654", "0.5809661", "0.57905895", "0.56500524", "0.56343985", "0.561235", "0.5582134", "0.5547837", "0.55462337", "0.55300826", "0.5528229", "0.5518903", "0.5513444", "0.55087733", "0.55087733", "0.54964024", "0.54746264", "0.5436337", "0.5433624...
0.80904293
0
Compares the given password in a secure way with a value stored in database to determine if the password is correct or not.
def authenticate(self, password): try: proposed = password.encode('utf-8') hashed = self.password.encode('utf-8') return verify_scryptsalsa208sha256(hashed, proposed) except Exception as ex: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, username, password):\n\n try:\n self.c.execute('SELECT password FROM profiles WHERE name=(?)', (username,))\n\n db_pw = self.c.fetchone()[0]\n print(password)\n\n return db_pw == password\n\n except TypeError:\n return F...
[ "0.78731614", "0.78306586", "0.77533066", "0.7669572", "0.76548934", "0.7596522", "0.7585206", "0.75842786", "0.7559725", "0.7552213", "0.7513887", "0.7511698", "0.7511095", "0.75033915", "0.7453581", "0.74502766", "0.7415836", "0.74145097", "0.74098754", "0.7404953", "0.7403...
0.0
-1
Attach to an existing lease by ID. When using in conjunction with the context manager, it will not delete the lease at the end.
def from_existing(cls, keystone_session, id): return cls(keystone_session, _preexisting=True, _id=id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve(cls, id):\n q = {'_id': id}\n post = Database.find_one(collection='pending_trailers', query=q)\n Database.insert(collection='queued_trailers', data=post)\n Database.delete_one(collection='pending_trailers', query=q)", "def lease_path(self, filesystem_identifier, path, head...
[ "0.5806472", "0.53215486", "0.5289764", "0.5205676", "0.5205676", "0.5205676", "0.5205676", "0.5205676", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0.51937735", "0....
0.0
-1
Given the updated C0 and rho, the previous gamma, and the updated gamma, returns the updated t_prime t_prime is the time elapsed in the muon's reference frame
def alternate_get_t_prime(C0, rho, gamma1, gamma2): t_prime = m*c/(rho*C0)*(gamma1 * (gamma1**2 - 1)**(-3/2) - gamma2 * (gamma2**2 - 1)**(-3/2)) return t_prime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Step_Profile(NC,X0,traits,S,gamma,T=TS,dt = 0.01):\n\n\t## Extraction of substrate concentrations !! Memory efficient?\n\tfor i in range(0,len(S)):\n\t\tif S[i] < 1e-100:\n\t\t\tS[i] = 1e-100\n\tH = S[0]\n\tC = S[1]\n\tN = S[2]\n\tG = S[3]\n\n\t## Traits extraction !! This could be a waste of time and memory ...
[ "0.5871047", "0.578687", "0.5700725", "0.5663817", "0.56599563", "0.5644158", "0.56219983", "0.5615904", "0.56118596", "0.56011987", "0.56011707", "0.5562016", "0.55521184", "0.5407914", "0.533332", "0.53032327", "0.52722394", "0.525737", "0.52447623", "0.52414197", "0.524141...
0.7798841
0
Changes velocity x when hitting an object
def set_velocity_x(self): self.__dx *= -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vel_x(self, *args, **kwargs) -> Any:\n pass", "def setVelocity(self, xvel, yvel):\n self.xvelocity = xvel\n self.yvelocity = yvel", "def update(self):\n self.x += self.velocity_x\n if self.x < 0 or self.x + self.width > 640:\n self.velocity_x = 0", "def set_v...
[ "0.7495039", "0.70301", "0.6877174", "0.6773192", "0.67445487", "0.66338277", "0.6592792", "0.65633154", "0.656296", "0.65332645", "0.65089077", "0.64937323", "0.6477043", "0.64235127", "0.6418332", "0.6400769", "0.6388023", "0.638295", "0.6382915", "0.6377059", "0.6312399", ...
0.7280352
1
Changes ball's direction when hitting the paddle
def bounce(self): self.__dx = random.randint(1, MAX_X_SPEED) self.__dy = -abs(self.__dy) if random.random() > 0.5: self.__dx = -self.__dx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit_paddle(self):\n pass\n\n #Implement if collision with paddle is detected\n\n #Add randomness to how ball direction will change and return value", "def update_ball(self):\n\t\tself.ball_x += self.velocity_x\n\t\tself.ball_y += self.velocity_y\n\t\tif self.ball_y < 0:\n\t\t\tself.ball_...
[ "0.7587691", "0.7352522", "0.69009835", "0.68982434", "0.6843783", "0.6738381", "0.67141676", "0.66157234", "0.6597591", "0.65484", "0.6536513", "0.65207756", "0.6457713", "0.6444708", "0.64362913", "0.6391172", "0.6390471", "0.63849556", "0.63635474", "0.63528454", "0.633417...
0.0
-1
Checking if the ball hit the paddle
def check_collision(self): if self.window.get_object_at(self.ball.x,self.ball.y+self.radius*2) is self.paddle: self.bounce() if self.window.get_object_at(self.ball.x+self.radius*2,self.ball.y+self.radius*2) is self.paddle: self.bounce()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit_paddle(self):\n pass\n\n #Implement if collision with paddle is detected\n\n #Add randomness to how ball direction will change and return value", "def detectPaddleCollision(self, paddle):\n if paddle.contains(self.left,self.top) and self._vy < 0:\n self.bouncesound....
[ "0.8591229", "0.8056836", "0.8020083", "0.77586263", "0.77236736", "0.7362593", "0.7290314", "0.7284007", "0.72161925", "0.7001375", "0.69952947", "0.68564844", "0.6746317", "0.6745626", "0.67251056", "0.6690283", "0.6663458", "0.6661547", "0.6625274", "0.66014457", "0.658517...
0.7807907
3
Drops a random item that may shorten the paddle for limited rounds
def random_item_sp(self): if random.random() < 0.3: self.window.add(self.shorten_paddle, x=self.ball.x+self.objects_length/2, y=self.ball.y) self.shorten_paddle_exist = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(self, pitem):\n\n #if the item is not inside the item list, can't drop it \n if pitem not in self.items:\n print('The player does not carry the item')\n\n #if not, remove the item \n else:\n self.items.remove(pitem)", "def popitem(self):\n all_ite...
[ "0.65682304", "0.6537298", "0.6385646", "0.6309748", "0.6228441", "0.62270457", "0.60924864", "0.6080497", "0.6008909", "0.6001737", "0.5989179", "0.5971677", "0.59682345", "0.5967807", "0.59657407", "0.59515166", "0.593082", "0.58605486", "0.5852083", "0.5829403", "0.5816003...
0.7511028
0
Restores the model and optimizer states This helper function restores the model's state to a given iteration so that a user can resume training at any epoch.
def _restore_training_state(self, restore_state): self.load_state_dict(restore_state["model"]) self.optimizer.load_state_dict(restore_state["optimizer"]) self.lr_scheduler.load_state_dict(restore_state["lr_scheduler"]) start_iteration = restore_state["iteration"] + 1 if self.conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_model(self, resume_iters):\n print('Loading the trained models from step {}...'.format(resume_iters))\n G_path = os.path.join(self.model_save_dir, '{}-G.ckpt'.format(resume_iters))\n self.G.load_state_dict(torch.load(G_path, map_location=lambda storage, loc: storage))", "def rest...
[ "0.7254063", "0.71848124", "0.70208925", "0.69592184", "0.6915095", "0.68498456", "0.68313843", "0.66074514", "0.6552805", "0.65403545", "0.6533953", "0.6466362", "0.64618224", "0.64539486", "0.6422329", "0.6388614", "0.6375843", "0.63736147", "0.6329389", "0.6312831", "0.627...
0.72677165
0
Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray; also handles converting sparse input to dense.
def _to_numpy(Z): if Z is None: return Z elif issparse(Z): return Z.toarray() elif isinstance(Z, np.ndarray): return Z elif isinstance(Z, list): return np.array(Z) elif isinstance(Z, torch.Tensor): return Z.cpu().numpy()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_numpy(x: Union[torch.Tensor, np.ndarray, Any, None]) -> Union[np.ndarray, None]:\n if x is None:\n return None\n elif torch.is_tensor(x):\n return x.data.cpu().numpy()\n elif isinstance(x, np.ndarray):\n return x\n elif isinstance(x, (Iterable, int, float)):\n return ...
[ "0.76773345", "0.7233963", "0.7173584", "0.716279", "0.7142096", "0.7061303", "0.7032503", "0.7032503", "0.70195454", "0.69758123", "0.69744414", "0.6958734", "0.6917689", "0.6917689", "0.69000363", "0.6894789", "0.6866577", "0.67931455", "0.67750895", "0.67735124", "0.676101...
0.7002494
9
User pressed OK button
def ok(self): # Save parameters self.runschematisations = ['geen'] schematisationModel = self.listSchematisations.model() for index in range(schematisationModel.rowCount()): item = schematisationModel.item(index) if item.isCheckable() and item.checkState() == QtCo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnButtonAboutOKButton(self, event):\r\n\t\tself.OnButtonOKButton()", "def okay_button1(self, i):\n if i.text() == \"OK\":\n print(\"Entry added\")", "def okButton(self):\n \n self.answer=\"ok\"\n self.top.destroy()", "def buttonOK_Clicked( self, event ):\n\t\tself.E...
[ "0.80168444", "0.786827", "0.7807484", "0.7736293", "0.7610414", "0.75357693", "0.73405415", "0.73405415", "0.73405415", "0.732669", "0.72668827", "0.72544056", "0.7163284", "0.7145008", "0.71215755", "0.7076128", "0.7052186", "0.7009362", "0.6997362", "0.6942393", "0.6915014...
0.0
-1
Initializes a test workspace by creating a temporary directory for it.
def test_workspace(tmp_path, request): yield Workspace(tmp_path, request.config.getoption('--bin-dir'), request.config.getoption('--lib-dir'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()\n if not os.path.exists(self.workspace_dir):\n os.makedirs(self.workspace_dir)", "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def s...
[ "0.79310685", "0.781631", "0.781631", "0.781631", "0.781631", "0.781631", "0.781631", "0.781631", "0.7707678", "0.7198403", "0.7191681", "0.7098867", "0.7074984", "0.695244", "0.6890569", "0.6888354", "0.6876332", "0.6876332", "0.6870755", "0.6864816", "0.6837567", "0.68019...
0.70295
13
Evaluate a Gaussian profile at x, given the profile parameters. y = amplitude exp((x position)2 / (2.0 sigma2))
def gaussian(x, *parameters): position, sigma, amplitude, background = parameters return amplitude * np.exp(-(x - position)**2 / (2.0 * sigma**2)) + background
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimateGaussian(X):\n\tmu = np.mean(X, axis=0)\n\tsigma2 = np.std(X, axis=0) ** 2\n\treturn mu, sigma2", "def gaussian(x, mean, sigma):\n return np.exp(-np.square(x-mean)/(2*np.square(sigma))) / (np.sqrt(2*np.pi*sigma**2))", "def Gaussian(x, mu=0, sigma=26.4, A=1, y0=0):\r\n #width = sigma*(2*np.sqr...
[ "0.6495758", "0.6491235", "0.64024776", "0.6383537", "0.637135", "0.63533294", "0.63418245", "0.6341676", "0.62667817", "0.6265572", "0.62360567", "0.62020063", "0.62014705", "0.6151087", "0.6125277", "0.60939956", "0.60737383", "0.6054487", "0.60086715", "0.6003975", "0.6000...
0.6753406
0
Evaluate the derivative of the MARS interpolant at x
def deriv(self, x, d=None): if self.weights is None: self.compute_weights() val = 0.0 for i in range(self.M): val += self.weights[i]*self.model_list[i].deriv(x, d) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_with_derivative(self, x):\n z = np.asarray(x)\n y, dydx = self._evalAndDer(z.flatten())\n return y.reshape(z.shape), dydx.reshape(z.shape)", "def _evalAndDer(self, x):\n m = len(x)\n fx = np.zeros((m, self.funcCount))\n for j in range(self.funcCount):\n ...
[ "0.78760386", "0.75173146", "0.75173146", "0.73359746", "0.7282882", "0.7276047", "0.72053844", "0.72053844", "0.7121522", "0.7110428", "0.7083183", "0.7039563", "0.6991064", "0.6938784", "0.6918987", "0.6796998", "0.67168504", "0.670519", "0.67048144", "0.67048144", "0.66782...
0.62320125
55
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Reds): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Updates metric state by accumulating the variables.
def update_state(self, y_true: tf.Tensor, y_pred: tf.Tensor): if self.sparse_y_true: # Shape: (..., num_classes, ...) y_true = tf.one_hot( tf.cast(y_true, dtype=tf.int32), self.num_classes, axis=self.axis, on_value=True, off_value=False, ) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_state(self):\n if self._coordinator.data:\n # get consumption value\n value_list = self._coordinator.data['values']\n values = [v['value'] for v in value_list]\n self._state = f\"{sum(values):.2f}\"", "def update_state(self, **kwargs):\n\n for ...
[ "0.6553084", "0.65116304", "0.6480227", "0.63618547", "0.63167506", "0.63015777", "0.61579233", "0.6127702", "0.60753965", "0.6062084", "0.60589623", "0.6026772", "0.6020309", "0.6001727", "0.59968036", "0.59858155", "0.5970429", "0.59650236", "0.59607506", "0.59604686", "0.5...
0.0
-1
Returns the serializable config of the metric.
def get_config(self) -> Dict[str, Any]: return { 'num_classes': self.num_classes, 'name': self.name, 'dtype': self.dtype, 'sparse_y_true': self.sparse_y_true, 'sparse_y_pred': self.sparse_y_pred, 'axis': self.axis, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self):\n config = self._kwargs.copy()\n config.update({\n 'metric': self.__class__.__name__,\n 'name': self.name,\n 'output_names': self.output_names,\n 'label_names': self.label_names})\n return config", "def get_config(self):\n ...
[ "0.71470386", "0.68104744", "0.6746141", "0.67385936", "0.67385936", "0.67378443", "0.66127694", "0.66092986", "0.66083086", "0.65892947", "0.6586016", "0.6555168", "0.6545104", "0.64308745", "0.64308745", "0.64308745", "0.64308745", "0.64308745", "0.64308745", "0.64308745", ...
0.0
-1
Find root directory of project.
def _find_reporoot(self, reporoot_opt, relnotessubdir_opt): reporoot = os.path.abspath(reporoot_opt) # When building on RTD.org the root directory may not be # the current directory, so look for it. try: return repo.Repo.discover(reporoot).path except Exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_root() -> pathlib.Path:\n cwd = pathlib.Path.cwd()\n while not (\n pathlib.Path(cwd, \"pyproject.toml\").exists() or\n pathlib.Path(cwd, \"poetry.lock\").exists() or\n pathlib.Path(\"/\") == cwd\n ):\n cwd = cwd.parent\n return cwd", "def project_root() -> Path:\...
[ "0.8293513", "0.815047", "0.8148224", "0.8136446", "0.8025839", "0.7947668", "0.7891882", "0.7891882", "0.78869134", "0.7880807", "0.78408545", "0.78408545", "0.78408545", "0.78408545", "0.7833131", "0.7799999", "0.77990746", "0.7793968", "0.77714366", "0.77528095", "0.767173...
0.69286495
47
At the end of the web request, this makes sure to close the database connection. If you don't the database could run out of memory!
def teardown_request(exception): try: g.conn.close() except Exception as e: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_request():\n db.close()", "def close(self):\r\n self.conn.close()\r\n gc.collect()", "def cleanup(_):\n self.db.close()", "def close(self): \n self.connection.close()", "def close(self):\n\t\tself.db.close()", "def after_request(response):\n g.db.close(...
[ "0.79800886", "0.78219384", "0.76396084", "0.7537861", "0.74763024", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.74483776", "0.7435468", "0.7435468", "0.74213195", "0.74184453", ...
0.0
-1
Compare this reference to another.
def __eq__(self, other): other_ref = other if isinstance(other, tuple): other_ref = self.__class__(*other) elif not isinstance(other, IRIReference): try: other_ref = self.__class__.from_string(other) except TypeError: raise Type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __cmp__(self, other):\n _, _ = self, other\n return 0", "def compare(self, other):\n # all redefinitions of __cmp__ method should start with the\n # following lines:\n if self is other:\n return 0\n n1 = self.__class__\n n2 = other.__class__\n c ...
[ "0.7201796", "0.71304446", "0.7101162", "0.7047165", "0.7032989", "0.7024927", "0.70207924", "0.6938044", "0.69235224", "0.6918194", "0.6873511", "0.68704987", "0.68701327", "0.6853344", "0.6844247", "0.6844247", "0.6844247", "0.68301713", "0.68280697", "0.68280697", "0.68280...
0.0
-1
returns theano implementation of function func_name is either 'relu', 'sigmoid', 'tanh', 'softmax', 'linear'
def get_activation_function(func_name): return { 'linear': lambda x: x, 'relu': lambda x: x * (x > 0), 'elu': lambda x: x * (x >= 0) + (T.exp(x) - 1) * (x < 0), 'softmax': T.nnet.softmax, 'tanh': T.tanh, 'log_softmax': log_softmax, 'sigmoid': T.nnet.sigmoid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activation_fn(name: Optional[str]):\n if name in (None, 'linear'):\n return lambda x: x\n elif name in ('sigmoid', 'tanh'):\n return getattr(torch, name)\n else:\n return getattr(F, name)", "def activation_factory(name):\n if name == 'relu':\n return nn.ReLU(inplac...
[ "0.7163165", "0.70450497", "0.69873726", "0.6959398", "0.69545597", "0.68011796", "0.6779878", "0.6661059", "0.66009206", "0.6521031", "0.6481226", "0.6390445", "0.63719976", "0.6280136", "0.6269302", "0.625469", "0.6254442", "0.6247554", "0.6239254", "0.62021536", "0.6200585...
0.7446129
0
Register a user. user will be assigned a session id
def post(self): self.finish(self.register())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user():\n pass", "def register_user(self):\n User.add_user(User(self.email.data, self.password.data))", "def register():\n insert_user(json_body())\n try:\n db.session.commit()\n except IntegrityError:\n raise exc.CouldNotCreateEntry()\n\n return jsonify({'messa...
[ "0.8143407", "0.80467325", "0.7752725", "0.75790393", "0.7549946", "0.74663204", "0.74383515", "0.74009556", "0.739184", "0.7383206", "0.7362326", "0.7347286", "0.7324185", "0.73134017", "0.7281073", "0.7267179", "0.7245193", "0.72216827", "0.7205791", "0.7203419", "0.7199138...
0.0
-1
Converts a dot product into an `Einsum`.
def dot_as_einsum(x: JaxExpression, y: JaxExpression, params: Params) -> Einsum: dimension_numbers = params['dimension_numbers'] (x_contract, y_contract), (x_batch, y_batch) = dimension_numbers x_ndim, y_ndim = len(x.shape), len(y.shape) letter_iter = einsum.einsum_letters() x_dims = ''.join(it.islice(letter_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))", "def dotproduct(x, y):\n return sum(imap(operator.mul, x, y))", "def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))", "def dot(a, b):\n return sum([a[i]*b[i] for i in range(2)])", "def dot(x,y):\n\treturn sum([x...
[ "0.6300768", "0.6202338", "0.6178872", "0.61547214", "0.6152906", "0.61438024", "0.6139741", "0.61156595", "0.60799295", "0.607694", "0.6057838", "0.6051067", "0.6044876", "0.60022324", "0.5995402", "0.5993264", "0.59914434", "0.595684", "0.5925157", "0.59184045", "0.58900076...
0.7109156
0
Lemmatize verbs in list of tokenized words
def lemmatize_verbs(self, words): lemmatizer = WordNetLemmatizer() lemmas = [] for word in words: lemma = lemmatizer.lemmatize(word, pos='v') lemmas.append(lemma) return lemmas
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens", "def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p...
[ "0.8030228", "0.79704237", "0.7929821", "0.78893256", "0.78252596", "0.7756634", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.77332175", "0.7703726", "0.7699928", "0.76371783", "0.7631672", "0.75700194", "0.7544735", "0.7536392", "0.7522604...
0.77103
13
Lemmatize verbs in list of tokenized words
def lemmatize_nouns(self, words): lemmatizer = WordNetLemmatizer() lemmas = [] for word in words: lemma = lemmatizer.lemmatize(word, pos='n') lemmas.append(lemma) return lemmas
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens", "def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p...
[ "0.8030228", "0.79704237", "0.7929821", "0.78893256", "0.78252596", "0.7756634", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.7741538", "0.77332175", "0.77103", "0.7703726", "0.7699928", "0.76371783", "0.7631672", "0.75700194", "0.7544735", "0.7536392",...
0.67795396
65
Lemmatize verbs in list of tokenized words
def lemmatize_adjectives(self, words): lemmatizer = WordNetLemmatizer() lemmas = [] for word in words: lemma = lemmatizer.lemmatize(word, pos='a') lemmas.append(lemma) return lemmas
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens", "def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p...
[ "0.80288726", "0.7971245", "0.79286313", "0.7890332", "0.7825369", "0.77554196", "0.77416253", "0.77416253", "0.77416253", "0.77416253", "0.77416253", "0.77416253", "0.77338827", "0.7710709", "0.7703906", "0.7699137", "0.7638337", "0.7630645", "0.75690055", "0.7545449", "0.75...
0.6722515
67
Forwardmode pushforward analogous to the pullback defined by tf.gradients. With tf.gradients, grad_ys is the vector being pulled back, and here d_xs is the vector being pushed forward.
def fwd_gradients(ys, xs, d_xs): v = tf.placeholder_with_default(np.zeros(ys.get_shape(), dtype=np.float32), shape=ys.get_shape()) # dummy variable g = tf.gradients(ys, xs, grad_ys=v, gate_gradients=True) return tf.gradients(g, v, grad_ys=d_xs, gate_gradients=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_and_gradient(self, inputs):\n raise NotImplementedError", "def forward(self, inputs: Tensor) -> Tensor:\n # save the inputs for the backward pass\n self.inputs = inputs\n return inputs @ self.w + self.b", "def backward_gradient(\n self, input: np.ndarray, head_gra...
[ "0.66093916", "0.6260517", "0.6203519", "0.6099338", "0.6076721", "0.6063734", "0.5994405", "0.5972849", "0.59590906", "0.59428406", "0.59128237", "0.5911637", "0.58836234", "0.5866258", "0.5861849", "0.58401406", "0.58346903", "0.58326226", "0.583119", "0.5824074", "0.582230...
0.7529103
0
Takes in a list of rewards for each timestep in an episode, and returns a list of the sum of discounted rewards for each timestep. Refer to the slides to see how this is done.
def discount(rewards, discount_factor=.99): # Compute discounted rewards (trust me this works and hopefully it's super fast) timesteps = len(rewards) # make into matrix rewards = tf.convert_to_tensor([rewards],dtype=tf.float32) # create lower triangular matrix of discount_factor weights T = tf.conv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount(rewards):\n sum_so_far = 0.0\n rewards_so_far = []\n for r in rewards[::-1]:\n sum_so_far = sum_so_far * gamma_discount + r\n rewards_so_far.append(sum_so_far)\n return rewards_so_far[::-1]", "def discount_and_normalize_rewards(self, episode_rewards):\n # Get empty a...
[ "0.7318004", "0.71212083", "0.7074243", "0.70572597", "0.7029099", "0.69638443", "0.69231766", "0.6774244", "0.66538954", "0.664611", "0.6608329", "0.64343405", "0.63544387", "0.63373727", "0.6291445", "0.6271778", "0.62690884", "0.6256094", "0.6249298", "0.6215773", "0.61826...
0.57212853
41
Split the message and clean the tokens 1. Tokenize text using word_tokenize 2. Lemmetize the tokens 3. Normalize the tokens 4. Strip any white spaces INPUT Disaster Message OUTPUT list of processed tokens
def tokenize(text): tokens = word_tokenize(text) lemmatizer = WordNetLemmatizer() clean_tokens = [] for tok in tokens: clean_tok = lemmatizer.lemmatize(tok).lower().strip() clean_tokens.append(clean_tok) return clean_tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_process(self, raw_text):\n # remove the space or other symbols\n word_lists = re.split(r'\\s+', raw_text.strip())\n if len(word_lists) < 2:\n print(word_lists)\n # exit(1)\n sent_index = word_lists[0]\n word_lists = ''.join(word_lists[1:])\n # ...
[ "0.686459", "0.6775587", "0.67578614", "0.67010355", "0.66956043", "0.66933405", "0.6589228", "0.6567017", "0.65641457", "0.6501551", "0.6501551", "0.64927274", "0.64617354", "0.64170957", "0.63853174", "0.63328636", "0.6330338", "0.6311813", "0.6307169", "0.6292793", "0.6286...
0.62757283
21
Get a Pipe's instance or remote rowcount.
def get_rowcount( self, begin : Optional['datetime.datetime'] = None, end : Optional['datetime.datetime'] = None, remote : bool = False, params : Optional[Dict[str, Any]] = None, debug : bool = False ) -> Optional[int]: from meerschaum.utils.warnings import warn ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_row_count(self) :\n\n count_sql = 'SELECT count(*) FROM \"%s\"' % (self.name,)\n cur = self.con.cursor()\n cur.execute(count_sql)\n return cur.fetchone()[0]", "def get_pipe_length(self, pipe):\n\n if pipe not in self.components:\n raise KeyError(\n ...
[ "0.6452065", "0.6436908", "0.634522", "0.62102914", "0.6173379", "0.6167278", "0.6148683", "0.6136996", "0.6066057", "0.60653806", "0.597468", "0.5957729", "0.5955991", "0.59475875", "0.59291667", "0.5906066", "0.59003234", "0.58895546", "0.58632606", "0.58339155", "0.5832181...
0.69679713
0
Returns movie suggestions. The algorithm returns a list of 3 top ranked movies that the user has not yet booked.
def user_suggested(username): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_suggestions(self, user_id, neighbor_id, movies_per_neighbor):\n # Get movies not seen by user\n neighbor_movies = self._get_user_movies(neighbor_id, list=True)\n movies_watched = self._get_user_movies(user_id, list=True)\n unseen_movies = list(set(neighbor_movies) - set(movies_w...
[ "0.6745193", "0.66017944", "0.6185729", "0.6173945", "0.60172224", "0.5980249", "0.5917425", "0.58562285", "0.5853059", "0.57843834", "0.57323664", "0.5702145", "0.5694656", "0.5686776", "0.5684055", "0.5623437", "0.56148285", "0.55345994", "0.55301017", "0.5522628", "0.55164...
0.0
-1
Saves the given alt texts as an image file.
def save_alttext(alttext_name: str, alttext_value: str) -> None: fonts_folder = 'C:\\Windows\\Fonts' arial_font = ImageFont.truetype(os.path.join(fonts_folder, 'arial.ttf'), 14) im = Image.new('RGBA', (760, 50), (204, 204, 204, 255)) draw = ImageDraw.Draw(im) draw.text((20, 20), alttext_value, fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_save(self):\n file_name, extension = return_folder_file_extension(self.img_name)[1:]\n image_name_save = \"%s_D=%s_Rs=%s_size=%s_offset=%i%s\" % (file_name, self.D, self.Rs, self.axe_X, self.offset_X+self.offset_X2, extension)\n\n if self.img2 is not None:\n self.img2.save(i...
[ "0.6562202", "0.6354374", "0.6319728", "0.6143411", "0.61004937", "0.6005273", "0.60011435", "0.5998456", "0.5980719", "0.5913645", "0.5903174", "0.5893342", "0.5891473", "0.5866061", "0.58589846", "0.5838241", "0.58359104", "0.58204097", "0.5793038", "0.5779073", "0.57719684...
0.72551155
0
Test if User is a subclass of BaseModel
def test_issubclass(self): self.assertTrue(issubclass(User()), BaseModel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inheritance(self):\n self.assertTrue(issubclass(type(self.user_1), BaseModel))", "def test_inherit(self):\n self.assertTrue(issubclass(User, BaseModel))", "def test_father(self):\n user1 = User()\n self.assertTrue(issubclass(user1.__class__, BaseModel))", "def test_User_i...
[ "0.8323618", "0.8271952", "0.7439454", "0.7008781", "0.6906585", "0.6869338", "0.68035644", "0.67865294", "0.67341983", "0.65876937", "0.6515926", "0.64259875", "0.64112544", "0.63965535", "0.6333314", "0.63235986", "0.6287007", "0.62540644", "0.6215195", "0.6124555", "0.6086...
0.80868745
2
Return the string representation of the class.
def __str__(self): return f'{self.date} - {self.opponent_abbr}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def toString(self):\n\n sMembers = '';\n for sAttr in ...
[ "0.80645394", "0.77991605", "0.77425414", "0.7736074", "0.77175874", "0.77108413", "0.76376235", "0.7586018", "0.7578492", "0.7578492", "0.7578492", "0.7552135", "0.7530942", "0.75245845", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.750655...
0.0
-1
Return the string representation of the class.
def __repr__(self): return self.__str__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def toString(self):\n\n sMembers = '';\n for sAttr in ...
[ "0.80645394", "0.77991605", "0.77425414", "0.7736074", "0.77175874", "0.77108413", "0.76376235", "0.7586018", "0.7578492", "0.7578492", "0.7578492", "0.7552135", "0.7530942", "0.75245845", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.750655...
0.0
-1
Returns a ``string`` constant indicating whether the game is a regular season or playoff matchup.
def type(self): return self._type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_special_season(season_str):\n return season_str == 'S00'", "def has_winner(self):\n\n if self.num_black_pieces == 0 or len(self.get_all_valid_moves(Player.black)) == 0:\n return Player.white\n elif self.num_white_pieces == 0 or len(self.get_all_valid_moves(Player.white)) == 0:\...
[ "0.6390185", "0.6028939", "0.5729132", "0.5633129", "0.5560593", "0.55298054", "0.5500374", "0.543675", "0.54113406", "0.53739643", "0.53430355", "0.5342112", "0.53362197", "0.53208286", "0.5220047", "0.5219263", "0.5214436", "0.5200196", "0.5192847", "0.5191863", "0.51839846...
0.0
-1
Returns a datetime object representing the date the game was played.
def datetime(self): year = self._year # Check if the first word of the date (the month) is either january or # february, and increase the year by 1. if self._date.split(' ')[0].lower() in ['january', 'february']: year = int(year) + 1 date_string = '%s %s %s' % (self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def date(self) -> dt.date:\n now = await self.AD.sched.get_now()\n return now.astimezone(self.AD.tz).date()", "def run_date(self) -> datetime.date:\n return self.timestamp.date()", "def datetime(self):\n\n time = self.time()\n if time is None or time < 0 or time >= 24:...
[ "0.69339913", "0.67045623", "0.65697056", "0.65534484", "0.6501158", "0.6491822", "0.6489066", "0.6484371", "0.63813704", "0.6333396", "0.631952", "0.6310479", "0.63055307", "0.6270538", "0.62510324", "0.62455964", "0.62137884", "0.62113535", "0.62113535", "0.62113535", "0.62...
0.5637986
96
Returns an ``int`` of the number of points scored by the team.
def points_scored(self): return self._points_scored
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_round_score(self, team: int, match_round: int) -> int:\n assert self.rounds, \"There are no rounds or the requested round doesn't exist\"\n\n team_score = 0\n\n if team == 1:\n for player in self.rounds[match_round - 1].team1.players:\n team_score += play...
[ "0.650953", "0.6412968", "0.63851243", "0.63635737", "0.6340322", "0.6265577", "0.62515724", "0.6242156", "0.62396014", "0.6235806", "0.618143", "0.6169404", "0.61192906", "0.6102266", "0.60757285", "0.6054911", "0.6031756", "0.6000274", "0.5993302", "0.59804165", "0.59734464...
0.0
-1
Returns an ``int`` of the number of yards the team gained as a result of passing plays.
def pass_yards(self): return self._pass_yards
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self, player: int) -> int:\n score = 0\n i = 0\n while i < len(self.leylines):\n score += 1 if self.leylines[i].player == player else 0\n score += 1 if self.rights[i].player == player else 0\n score += 1 if self.lefts[i].player == player else 0\n ...
[ "0.6767864", "0.65094954", "0.6475881", "0.6449191", "0.6360982", "0.63479304", "0.6344744", "0.6331775", "0.62957263", "0.6270209", "0.6261521", "0.62538797", "0.6248452", "0.62440646", "0.62430286", "0.6226068", "0.62195605", "0.62183374", "0.62154794", "0.6211096", "0.6188...
0.0
-1
Returns a ``float`` of the percentage of passes that were completed by the team. Percentage ranges from 0100.
def pass_completion_rate(self): return self._pass_completion_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_passing(self) -> float:\n num_meas = Enumerable(self.mlc_meas).select_many(lambda m: m.passed).count()\n num_pass = (\n Enumerable(self.mlc_meas)\n .select_many(lambda m: m.passed)\n .count(lambda p: bool(p) is True)\n )\n return float(100 * ...
[ "0.77650774", "0.732818", "0.7319111", "0.7121634", "0.7121634", "0.6986963", "0.6972811", "0.67837316", "0.6778286", "0.67581075", "0.6728178", "0.6720955", "0.6711566", "0.66997933", "0.65958935", "0.65898126", "0.65335447", "0.65335447", "0.6504822", "0.65008724", "0.64523...
0.5802963
93
Returns an ``int`` of the total number of times the team attempted a rushing play.
def rush_attempts(self): return self._rush_attempts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumberOfSuccesses(rolls, difficulty):\n s = len(rolls[rolls>=difficulty])\n if isLucky(rolls, difficulty) :\n s *= 2\n return s", "def count_games(self) -> int:\n return len(self.rating_history) - 1", "def number_moves(game, player):\n return float(len(game.get_legal_moves(play...
[ "0.6643705", "0.6496212", "0.6480337", "0.63706136", "0.6339106", "0.63050735", "0.6270147", "0.6263389", "0.6155077", "0.61414105", "0.61022776", "0.61014795", "0.6086421", "0.6071127", "0.60591847", "0.6043841", "0.604289", "0.6003174", "0.5993012", "0.5982697", "0.5971994"...
0.5815987
55
Returns an ``int`` of the total number of field goals the team scored.
def field_goals_made(self): return self._field_goals_made
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScore(self):\n return sum(self.field)", "def score(self):\n return sum(len(i) for i in self.firework)", "def total_count(self) -> int:\n return self.__total_count", "def get_goal_done(self, season=None, stage=None):\n cnt = 0\n matches = self.get_matches(season=seaso...
[ "0.65045774", "0.6183458", "0.6182892", "0.6147484", "0.61058325", "0.60718566", "0.60567904", "0.60435116", "0.60415316", "0.60282373", "0.6012219", "0.59948117", "0.59766686", "0.5974691", "0.59713197", "0.59448177", "0.5939096", "0.59276515", "0.5907207", "0.58918804", "0....
0.562434
59
Returns a ``string`` of the total time the team spent with the ball.
def time_of_possession(self): return self._time_of_possession
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nice_score(self):\n return ('{0.away_team} ({0.away_team_runs}) at '\n '{0.home_team} ({0.home_team_runs})').format(self)", "def pretty_str(self, unit_time):\n return \"{}: {} left and {}% done\".format(self.name, get_time_str(self.time * unit_time), round((self.total_time - self...
[ "0.6527877", "0.6481079", "0.63187665", "0.63034874", "0.6275019", "0.62470984", "0.62288934", "0.62028235", "0.6100321", "0.6054219", "0.6023037", "0.6020882", "0.6001787", "0.6001524", "0.5987517", "0.5963675", "0.5953064", "0.5924238", "0.5889757", "0.5880072", "0.58635116...
0.0
-1
Return the string representation of the class.
def __str__(self): games = [f'{game.date} - {game.opponent_abbr}'.strip() for game in self._games] return '\n'.join(games)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def toString(self):\n\n sMembers = '';\n for sAttr in ...
[ "0.80645394", "0.77991605", "0.77425414", "0.7736074", "0.77175874", "0.77108413", "0.76376235", "0.7586018", "0.7578492", "0.7578492", "0.7578492", "0.7552135", "0.7530942", "0.75245845", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.750655...
0.0
-1
Return the string representation of the class.
def __repr__(self): return self.__str__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def toString(self):\n\n sMembers = '';\n for sAttr in ...
[ "0.80645394", "0.77991605", "0.77425414", "0.7736074", "0.77175874", "0.77108413", "0.76376235", "0.7586018", "0.7578492", "0.7578492", "0.7578492", "0.7552135", "0.7530942", "0.75245845", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.7506556", "0.750655...
0.0
-1
Create an invalid product where its price is higher than 999
def test_create_invalid_price_higher_than_999(self): product_name = "Swift Iris" size = Size.SIZE_4_5 colour = "Red" price = 1001 product_type = ProductType.SHOE product_code = "A" department = Department.LADIES product = Product( name=product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_with_negative_price(self):\n good = GoodInfo(\"яйцо 1 кат.\", \"-30\", \"40\", \"2020-12-30\", \n \"14\", \"2020-12-30\")\n check_product_data = self.database.add(good)\n\n self.assertFalse(check_product_data)", "def test_add_with_negative_amount(self):\n ...
[ "0.73257244", "0.68258667", "0.67257065", "0.6616273", "0.6603935", "0.6526655", "0.6420664", "0.6307311", "0.62781006", "0.6223214", "0.61144805", "0.598776", "0.5978524", "0.5935586", "0.58983546", "0.58368427", "0.5828391", "0.57588285", "0.57490164", "0.5745316", "0.57408...
0.7821557
0
Gets whether the Metrics Monitor Service is running.
def is_monitor_process_live(pid_file=None): try: check_windows_service_status("AmbariMetricsHostMonitoring") ams_monitor_process_running = True except: ams_monitor_process_running = False return ams_monitor_process_running
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_monitored(self):\n return self._is_monitored", "def __call__(self):\n status = self.os.popen('circusctl status monitor').read().strip()\n\n if status == 'active':\n return True\n elif status == 'stopped':\n return False", "def _engineServicesRunning():\n...
[ "0.7363286", "0.7182875", "0.71234727", "0.706124", "0.70145607", "0.7007384", "0.7007384", "0.7004752", "0.7004752", "0.7004752", "0.7004025", "0.7004025", "0.69956255", "0.6969722", "0.69617563", "0.69485295", "0.6937054", "0.69241387", "0.6912574", "0.6881745", "0.68742454...
0.6875424
20
Gets and returns id of the model.
def get_model_id(model_name, workspace, header, user): uri = "https://api.anaplan.com/1/3/workspaces/{}/models/".format(workspace) response = requests.get(uri, headers = header) response_json = json.loads(models.text.encode("utf-8")) for model in response_json: if model[u"name"] == unicode(model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getId(self):\n return _libsbml.Model_getId(self)", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self...
[ "0.8354609", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8051232", "0.8017695", "0.8017695", "0.79474795", ...
0.0
-1
Gets and returns the id of the import.
def get_import_id(import_name, model, workspace, header, user): uri = ("https://api.anaplan.com/1/3/workspaces/{}/models/{}/" "imports/").format(workspace, model) response = requests.get(uri, headers = header) response_json = json.loads(response.text.encode("utf-8")) for imp in response_json: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self) -> FileID:\n _args: list[Arg] = []\n _ctx = self._select(\"id\", _args)\n return _ctx.execute_sync(FileID)", "def id(self):\n return self.get_data(\"id\")", "def _get_id(self):\n return self.id", "def id(self):\n return self.metadata[\"id\"]", "def get...
[ "0.6832741", "0.67210203", "0.6655809", "0.66551197", "0.6550059", "0.6550059", "0.6550059", "0.6550059", "0.6550059", "0.6550059", "0.6542373", "0.65340126", "0.65028954", "0.6499806", "0.6499806", "0.6499806", "0.6499806", "0.6499806", "0.6499806", "0.6499806", "0.6499806",...
0.7757628
0
Return true if obj has exactly type tpe. isinstance(obj, tpe) will always be true if has_exactly_type(obj, tpe) is true. However the converse is not true; isinstance(obj, tpe) may be true when has_exactly_type(obj, tpe) is false. This must work on all objects and types.
def has_exactly_type(obj, tpe): return type(obj) == tpe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_type(self, obj):\n return isinstance(obj, self.type_)", "def is_type(obj):\n return type(obj) is type or type(obj) is types.ClassType", "def is_type(obj: Any) -> bool:\n return type(obj).__name__ == \"type\"", "def is_kind_of_class(obj, a_class):\n if isinstance(obj, a_class) is Tr...
[ "0.75560755", "0.70967317", "0.6865697", "0.65851974", "0.6551187", "0.6549715", "0.650977", "0.650977", "0.650977", "0.650977", "0.650977", "0.650977", "0.6503337", "0.6503337", "0.6500848", "0.64997196", "0.64983577", "0.64904886", "0.64641255", "0.64400786", "0.64317375", ...
0.88530856
0
Hash the provided password with a randomlygenerated salt and return the salt and hash to store in the database.
def hash_new_password(password: str) -> Tuple[bytes, bytes]: salt = os.urandom(16) pw_hash = hashlib.pbkdf2_hmac("sha256", password.encode(), salt, 100000) return salt, pw_hash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(self, password):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), \n salt, 100000)\n pwdhash = binascii.hexlify(pwdhash)\n return (salt + pwdhash)....
[ "0.7987839", "0.76126194", "0.75837535", "0.7560013", "0.75298184", "0.75020325", "0.74784184", "0.7451228", "0.7451228", "0.7451228", "0.74427974", "0.7439727", "0.74279463", "0.741351", "0.7406363", "0.7390142", "0.7335646", "0.7334585", "0.7304599", "0.72953564", "0.726752...
0.723087
22
Returns the minimax action using self.depth and self.evaluationFunction
def getAction(self, gameState): "*** YOUR CODE HERE ***" return self.alphabetapruning(gameState, self.depth * 2,float("-inf"),float("inf"), 0, True)[1] util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o...
[ "0.74847376", "0.7383727", "0.71829283", "0.71108687", "0.7088656", "0.7071207", "0.7068773", "0.7050045", "0.70049655", "0.69666225", "0.69659954", "0.6962957", "0.6945715", "0.68998194", "0.68978226", "0.6885565", "0.6828719", "0.67668444", "0.67587835", "0.6753867", "0.670...
0.0
-1
Gets a User object from the Cache, or try to get it from the DB, or return a None object if it does not exist. Receives the User Id as the parameter.
def get_cached_user(user_id): cache_key = app_settings.CACHED_USER_KEY_TEMPLATE.format( site_id=settings.SITE_ID, user_id=user_id ) user = cache.get(cache_key, None) if user is None: try: user = User.objects.get(pk=user_id) cache.set( cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(model_class, id):\n key = build_key(model_class, id)\n user = cache.get(key)\n if user is None: # Not in cache\n logger.info(\" CACHE MISS key=%s\", key)\n user = User.objects.filter(id=id).first()\n if user is not None: # Found in DB\n logger.info(\" CACHE POPU...
[ "0.83063644", "0.7723678", "0.7723678", "0.7723678", "0.7695297", "0.7693531", "0.7692297", "0.7688308", "0.76371324", "0.76243615", "0.75464725", "0.75106466", "0.74681735", "0.74316466", "0.7429689", "0.7407273", "0.74064165", "0.73794764", "0.73693997", "0.73473305", "0.73...
0.791304
1
Get the training dir or checkpoint path to be used by the model.
def get_checkpoint(): if ((FLAGS.run_dir or FLAGS.checkpoint_file) and FLAGS.bundle_file and not should_save_generator_bundle()): raise sequence_generator.SequenceGeneratorException( 'Cannot specify both bundle_file and run_dir or checkpoint_file') if FLAGS.run_dir: train_dir = os.path.join(os...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_saved_model_path(training_ckpt_base):\n ckpt_dir = os.path.dirname(training_ckpt_base)\n # If using a checkpoint from the best_exporter, return its saved_model.\n if os.path.basename(ckpt_dir) == 'variables':\n return os.path.join(\n os.path.dirname(ckpt_dir),\n tf.saved_model.constants...
[ "0.7422323", "0.7356403", "0.7326797", "0.73252016", "0.72976756", "0.72253144", "0.7174686", "0.7136747", "0.70630324", "0.69971365", "0.6936867", "0.6777481", "0.67625815", "0.67129177", "0.6608981", "0.6554913", "0.6519152", "0.6501779", "0.6494808", "0.6494154", "0.649415...
0.7906165
0
Converts steps to seconds. Uses the current flag value for steps_per_quarter.
def _steps_to_seconds(steps, qpm): return steps * 60.0 / qpm / get_steps_per_quarter()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_steps_per_quarter():\n return FLAGS.steps_per_quarter", "def _STEPS2TIME(step):\n return step/1000.", "def _TIME2STEPS(time):\n return int(time*1000)", "def time_step(self) -> float:\n return self._timestep", "def t_sec(self):\n return self.t/self.parameters['time_conversion']"...
[ "0.6450985", "0.6448373", "0.59911215", "0.58455706", "0.58398646", "0.5781241", "0.575255", "0.5705983", "0.56229484", "0.5555474", "0.5552169", "0.55352217", "0.5524708", "0.5522003", "0.5503381", "0.5480404", "0.5459194", "0.5457656", "0.5434685", "0.5380065", "0.53788096"...
0.7568327
0
Sets log level to the one specified in the flags.
def setup_logs(): tf.logging.set_verbosity(FLAGS.log)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLogLevel(self,value):\n self.PDFreactorConfiguration.in1[\"logLevel\"] = value", "def set_logger_level(lgr, level):\n if isinstance(level, int):\n pass\n elif level.isnumeric():\n level = int(level)\n elif level.isalpha():\n level = getattr(logging, level)\n else:\n...
[ "0.73729235", "0.72556925", "0.707973", "0.6998659", "0.6979626", "0.69653356", "0.69607157", "0.6939101", "0.6928872", "0.6903067", "0.6898", "0.6840624", "0.6811989", "0.6799592", "0.67681986", "0.67500293", "0.6744028", "0.67188054", "0.67175853", "0.6686371", "0.6665746",...
0.0
-1
Unify representations of two multivariate polynomials.
def unify(f, g): if not hasattr(g, '__iter__'): if f.lev == g.lev and f.dom == g.dom: return f.lev, f.dom, f.per, f.rep, g.rep else: raise UnificationFailed("can't unify %s with %s" % (f, g)) else: lev, dom, reps = f.lev, f.dom, [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _canonical_sub(poly1, poly2):\r\n return _canonical_add(poly1, -poly2)", "def bivariate_type(f, x, y, **kwargs):\n u = Dummy('u', positive=True)\n\n if kwargs.pop('first', True):\n p = Poly(f, x, y)\n f = p.as_expr()\n _x = Dummy()\n _y = Dummy()\n rv = bivariate_t...
[ "0.6122074", "0.5767269", "0.5737469", "0.5607416", "0.5588697", "0.55255955", "0.5511764", "0.54358566", "0.54310673", "0.53472495", "0.53466886", "0.5326147", "0.529149", "0.5234352", "0.5221434", "0.520023", "0.51876676", "0.51778126", "0.5172678", "0.516654", "0.51490295"...
0.0
-1
Construct a onepolynomial with appropriate properties.
def one(cls, lev, ord, dom): return cls(dmp_one(lev, dom), dom, lev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n self.polynomials = {}\n\n if len(args) == 1 and isinstance(args[0], list): # Polynomials represented as list\n index = 0\n for polynomial in args[0]:\n self.polynomials[index] = polynomial\n index += 1\n ...
[ "0.62509274", "0.61500716", "0.6071207", "0.59341973", "0.5930927", "0.5920896", "0.5873463", "0.5818323", "0.5783495", "0.57384235", "0.5686021", "0.56774116", "0.56692106", "0.56462836", "0.5633416", "0.5623596", "0.56159204", "0.56057364", "0.5536002", "0.5523472", "0.5523...
0.0
-1
Create dense representation from a ``dict`` with native coefficients.
def from_dict(cls, rep, lev, ord, dom): return cls(dmp_from_dict(rep, lev, dom), dom, lev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dict_to_sparse(matrix_dict):\n return scipy.sparse.coo_matrix(\n (matrix_dict['data'], (matrix_dict['row'], matrix_dict['col'])),\n shape=matrix_dict['shape'])", "def _from_dict_to_sparse(self, adj_dict):\n indices = list(adj_dict.keys())\n values = [1] * len(indices)\n\n ...
[ "0.59595174", "0.58738387", "0.5814745", "0.57759327", "0.56844586", "0.5679524", "0.56371874", "0.5630497", "0.5610239", "0.55509394", "0.5505784", "0.5499444", "0.5488767", "0.5473672", "0.5462821", "0.5376081", "0.53755736", "0.536964", "0.5354653", "0.5352139", "0.5351266...
0.52387625
32
Convert dense representation to a ``list`` with native coefficients.
def to_list(f): return dmp_to_dict(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_list(self):\n return [bits.value for bits in self.data]", "def tolist (self) :\r\n if self.complex :\r\n result = []\r\n for x in xrange(0,len(self)) :\r\n result.append(self[x])\r\n return result\r\n else :\r\n return self.im...
[ "0.65733325", "0.63245213", "0.6159511", "0.6082712", "0.6063117", "0.5988606", "0.5963848", "0.5937633", "0.5919432", "0.59074837", "0.5889247", "0.58882785", "0.5841861", "0.58326757", "0.57309306", "0.56943065", "0.5623215", "0.56097525", "0.5602645", "0.5554601", "0.55469...
0.5538718
21
Convert dense representation to a ``list`` with SymPy's coefficients.
def to_sympy_list(f): return dmp_to_sympy_dict(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tolist (self) :\r\n if self.complex :\r\n result = []\r\n for x in xrange(0,len(self)) :\r\n result.append(self[x])\r\n return result\r\n else :\r\n return self.impl.tolist()", "def list_syms():\n\tSymStringVec=[];\n\tSymStringVec.appen...
[ "0.6020631", "0.5856981", "0.5807865", "0.57532704", "0.5689818", "0.5643059", "0.55598503", "0.5549278", "0.5509776", "0.5489939", "0.5445799", "0.542829", "0.5405683", "0.53641313", "0.53546786", "0.53546786", "0.53400403", "0.53381383", "0.53327155", "0.5324757", "0.530096...
0.65636885
0
Return the leading coefficient of `f`.
def LC(f): return dmp_ground_LC(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coeffs(f):\n return dmp_coeffs(f.rep, f.lev, f.dom)", "def coefficient(self) -> float:\n ...", "def iir_firstorder_freq_to_coef(f = 0.1):\n a = np.cos(f) - 1 - np.sqrt(np.cos(f)**2 - 4 * np.cos(f) + 3)\n a = np.abs(a)\n b = 1 - a\n return b, a", "def f1(x):\n return x**3 - 2*...
[ "0.66059804", "0.6419174", "0.6368182", "0.61947644", "0.61735934", "0.6129855", "0.6114145", "0.6069889", "0.60611683", "0.6037855", "0.6019118", "0.5992027", "0.5982766", "0.59690094", "0.5949553", "0.5898381", "0.5880347", "0.5875505", "0.5875056", "0.5864777", "0.5848769"...
0.0
-1
Return the leading monomial of `f`.
def LM(f): return dmp_ground_LM(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monic(f):\n return f.per(dmp_ground_monic(f.rep, f.lev, f.dom))", "def to01(f):\n def wrap(x, *args, **kwargs):\n y = x * 2 - 1\n z = f(y, *args, **kwargs)\n return (z + 1) / 2\n return wrap", "def monoms(f):\n return dmp_monoms(f.rep, f.lev, f.dom)", "def M(f):\n...
[ "0.62005746", "0.6159172", "0.6129861", "0.60667115", "0.5970246", "0.58578324", "0.58190674", "0.5818636", "0.562918", "0.55689067", "0.5523732", "0.5513309", "0.549481", "0.5491128", "0.5469161", "0.5461911", "0.5438033", "0.5414519", "0.5407779", "0.540609", "0.53946364", ...
0.0
-1
Return the trailing coefficient of `f`.
def TC(f): return dmp_ground_TC(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(y):\n \n\n k = 1.0\n return y*(1-y)", "def zzx_strip(f):\n if not f or f[0]:\n return f\n\n k = 0\n\n for coeff in f:\n if coeff:\n break\n else:\n k += 1\n\n return f[k:]", "def evaluate(f, a):\n if f == []:\n return 0\n result...
[ "0.5766146", "0.57579887", "0.5576755", "0.5554005", "0.5545048", "0.549544", "0.5485422", "0.5482978", "0.5481857", "0.54728526", "0.54728526", "0.5466632", "0.544384", "0.54378146", "0.54265016", "0.5420198", "0.54087", "0.53891927", "0.5388137", "0.53807664", "0.5379609", ...
0.0
-1
Return the trailing monomial of `f`.
def TM(f): return dmp_ground_TM(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f_mw(f):\n return np.power(f, 2)", "def monic(f):\n return f.per(dmp_ground_monic(f.rep, f.lev, f.dom))", "def f(x):\n return x**2", "def monoms(f):\n return dmp_monoms(f.rep, f.lev, f.dom)", "def f(x):\n return ((x[0] - 1) ** 2) + ((x[1] + 3) ** 2)", "def f(y):\n \n\n k ...
[ "0.5852079", "0.584781", "0.5641473", "0.5504839", "0.53141844", "0.53090924", "0.5286969", "0.52824277", "0.52795106", "0.52784127", "0.5256435", "0.51469594", "0.51426715", "0.5123691", "0.5118813", "0.50838053", "0.507853", "0.5065737", "0.5054071", "0.5053343", "0.5043757...
0.0
-1
Return the trailing coefficient of `f`.
def TT(f): return dmp_ground_TT(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(y):\n \n\n k = 1.0\n return y*(1-y)", "def zzx_strip(f):\n if not f or f[0]:\n return f\n\n k = 0\n\n for coeff in f:\n if coeff:\n break\n else:\n k += 1\n\n return f[k:]", "def evaluate(f, a):\n if f == []:\n return 0\n result...
[ "0.57671046", "0.5758219", "0.5579558", "0.5553758", "0.5548341", "0.5496453", "0.5487752", "0.5482529", "0.5482393", "0.54733384", "0.54733384", "0.54654884", "0.5449232", "0.5438078", "0.5427966", "0.54191256", "0.54111403", "0.5390586", "0.5390245", "0.53803396", "0.537972...
0.0
-1
Return the last nonzero monomial of `f`.
def EM(f): return dmp_ground_EM(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonzero_last(arr, *, axis):\n def nonzero_last_1d(arr):\n try:\n return np.nonzero(arr)[0][-1]\n except IndexError:\n return -1\n return np.apply_along_axis(nonzero_last_1d, axis, arr)", "def poly_TC(f):\n if not f:\n return INT_ZERO\n else:\n ret...
[ "0.58162326", "0.57229507", "0.5607902", "0.55758774", "0.55136704", "0.5462685", "0.54513663", "0.5411818", "0.53247046", "0.5278097", "0.5266838", "0.523139", "0.5220799", "0.5218536", "0.5207568", "0.5206863", "0.5205471", "0.5205193", "0.52046186", "0.51981664", "0.518062...
0.0
-1
Return all nonzero coefficients of `f`.
def coeffs(f): return dmp_coeffs(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_coeffs(f):\n return dmp_all_coeffs(f.rep, f.lev, f.dom)", "def zzX_zeros_of(f, k, d=0):\n if poly_univariate_p(f):\n return [INT_ZERO]*k\n\n l = poly_level(f)-d\n\n if not k:\n return []\n else:\n return [ zzX_zero(l) for i in xrange(k) ]", "def zzx_neg(f):\n ...
[ "0.74650294", "0.6726744", "0.63929725", "0.6286326", "0.62318325", "0.62218064", "0.6030031", "0.59772474", "0.59676075", "0.58539116", "0.5796744", "0.5795498", "0.57697946", "0.57239544", "0.57171404", "0.56399703", "0.5628603", "0.5618683", "0.5607316", "0.55585843", "0.5...
0.6611585
2
Return all nonzero monomials of `f`.
def monoms(f): return dmp_monoms(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_monoms(f):\n return dmp_all_monoms(f.rep, f.lev, f.dom)", "def zzX_zeros_of(f, k, d=0):\n if poly_univariate_p(f):\n return [INT_ZERO]*k\n\n l = poly_level(f)-d\n\n if not k:\n return []\n else:\n return [ zzX_zero(l) for i in xrange(k) ]", "def zzX_zero_p(f):\n ...
[ "0.6847891", "0.60395426", "0.5915679", "0.58741033", "0.57392544", "0.5651231", "0.5638499", "0.5584996", "0.5563333", "0.5524678", "0.5509391", "0.5468892", "0.5432276", "0.54295903", "0.5429141", "0.5356473", "0.5308215", "0.5219569", "0.5216859", "0.521333", "0.518574", ...
0.67935807
1
Return all nonzero terms from `f`.
def terms(f): return dmp_terms(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_terms(f):\n return dmp_all_terms(f.rep, f.lev, f.dom)", "def zzX_zeros_of(f, k, d=0):\n if poly_univariate_p(f):\n return [INT_ZERO]*k\n\n l = poly_level(f)-d\n\n if not k:\n return []\n else:\n return [ zzX_zero(l) for i in xrange(k) ]", "def nonzero_values(a):\...
[ "0.66184014", "0.6561733", "0.6526532", "0.6150954", "0.61088616", "0.603613", "0.5912672", "0.58985025", "0.582266", "0.57368237", "0.57262033", "0.5716012", "0.5689737", "0.56123954", "0.56123954", "0.55776155", "0.55463606", "0.5524581", "0.5510509", "0.5509112", "0.550636...
0.58526665
8
Return all coefficients of `f`.
def all_coeffs(f): return dmp_all_coeffs(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coeffs(f):\n return dmp_coeffs(f.rep, f.lev, f.dom)", "def zzx_mul_const(f, c):\n if not c or not f:\n return []\n else:\n return [ c * coeff for coeff in f ]", "def coefficients(self) :\n raise NotImplementedError", "def zzX_eval(f, x):\n if hasattr(x, '__iter__'):\n...
[ "0.7309399", "0.6482024", "0.64716834", "0.63792527", "0.6307338", "0.6307338", "0.6235673", "0.61747074", "0.61417425", "0.61201155", "0.61201155", "0.611212", "0.61013764", "0.60949326", "0.60933137", "0.6058441", "0.60128605", "0.60039085", "0.60016847", "0.59816825", "0.5...
0.7859224
0
Convert algebraic coefficients to rationals.
def lift(f): return f.per(dmp_lift(f.rep, f.lev, f.dom), dom=f.dom.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_coeff_convert():\n assert np.allclose(\n fcoeffs2coeffs(np.array([1.0, 2, 1, 1])), P.polymul([1, 1, 2], [1, 1])\n )\n assert np.allclose(\n fcoeffs2coeffs(np.array([1.0, 2, 1.2])), P.polymul([1, 1, 2], 1.2)\n )\n assert np.allclose(fcoeffs2coeffs(np.array([1.0, 2])), P.polymul...
[ "0.55224395", "0.5424415", "0.54147935", "0.5378911", "0.53736603", "0.53649193", "0.5354702", "0.531304", "0.5270486", "0.5228278", "0.52027315", "0.51892364", "0.5157922", "0.5143347", "0.51286", "0.51238143", "0.50942785", "0.50717103", "0.5036238", "0.50324523", "0.500183...
0.0
-1
Invert `f` modulo `g`, if possible.
def invert(f, g): lev, dom, per, F, G = f.unify(g) return per(dmp_invert(F, G, lev, dom))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PolyMod(f, g):\n return f % g", "def zzx_rem(f, g):\n return zzx_div(f, g)[1]", "def inverse_gc(g):\n i = g\n j = 1\n while j<N:\n i = i ^ (g >> j)\n j = j + 1\n return i", "def zzX_rem(f, g):\n return zzX_div(f, g)[1]", "def rem(f, g):\n lev, dom, per, F, G = ...
[ "0.7221911", "0.6624812", "0.6531245", "0.64518374", "0.6422406", "0.6389244", "0.6361787", "0.6353625", "0.6342133", "0.63340366", "0.6235075", "0.62115633", "0.6183492", "0.61596906", "0.6126605", "0.6107974", "0.6105071", "0.610071", "0.6095828", "0.60769033", "0.60431147"...
0.69777673
1
Compute GCD of `f` and `g` and their cofactors.
def cofactors(f, g): lev, dom, per, F, G = f.unify(g) h, cff, cfg = dmp_cofactors(F, G, lev, dom) return per(h), per(cff), per(cfg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcd(f, g):\n lev, dom, per, F, G = f.unify(g)\n return per(dmp_gcd(F, G, lev, dom))", "def zzX_gcd(f, g, **flags):\n return zzX_cofactors(f, g, **flags)[0]", "def zzx_gcd(f, g, **flags):\n return zzx_cofactors(f, g, **flags)[0]", "def zzx_cofactors(f, g, **flags):\n return zzx_heu_...
[ "0.81714576", "0.80049723", "0.78643054", "0.7728282", "0.73601127", "0.7306442", "0.72060037", "0.70242584", "0.6956259", "0.681788", "0.6780819", "0.67631483", "0.67021376", "0.65596586", "0.64909834", "0.64727557", "0.63796854", "0.6329083", "0.6328711", "0.6326784", "0.63...
0.76602465
4
Compute polynomial LCM of `f` and `g`.
def lcm(f, g): lev, dom, per, F, G = f.unify(g) return per(dmp_lcm(F, G, lev, dom))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcd(f, g):\n lev, dom, per, F, G = f.unify(g)\n return per(dmp_gcd(F, G, lev, dom))", "def mul(f, g):\n lev, dom, per, F, G = f.unify(g)\n return per(dmp_mul(F, G, lev, dom))", "def zzX_gcd(f, g, **flags):\n return zzX_cofactors(f, g, **flags)[0]", "def _lcm_f(a, b):\n ret...
[ "0.6806505", "0.6507675", "0.64856017", "0.6469824", "0.64156127", "0.6379891", "0.6366189", "0.63646215", "0.6244977", "0.6226124", "0.6225724", "0.6200419", "0.6180115", "0.6178858", "0.6178858", "0.6178858", "0.6161679", "0.6120246", "0.61110556", "0.61075044", "0.6091539"...
0.7720529
0
Reduce `f` modulo an element of the ground domain.
def trunc(f, p): return f.per(dmp_ground_trunc(f.rep, f.dom.convert(p), f.lev, f.dom))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fmod(x, y):\n return 0.0", "def PolyMod(f, g):\n return f % g", "def rem(f, g):\n lev, dom, per, F, G = f.unify(g)\n return per(dmp_rem(F, G, lev, dom))", "def fpart(x):\n return x - math.floor(x)", "def modReduce(self, x):\n\n assert 0 <= x < pow(self.mod, 2), 'out of ran...
[ "0.65090626", "0.6467659", "0.6332121", "0.62232906", "0.6169413", "0.61642146", "0.6139566", "0.6128289", "0.6008308", "0.5970176", "0.5969701", "0.5948262", "0.5938702", "0.5938091", "0.58765", "0.58637816", "0.58479124", "0.5842898", "0.5839511", "0.57852304", "0.5775152",...
0.0
-1
Returns ``True`` if `f` is equivalent to zero.
def is_zero(f): return dmp_zero_p(f.rep, f.lev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zzX_zero_p(f):\n if poly_univariate_p(f):\n return not f\n else:\n if len(f) == 1:\n return zzX_zero_p(f[0])\n else:\n return False", "def is_zero(self) -> bool:\n return self.field.zero == self", "def iszero(a: float) -> bool:\n return np.isclose(...
[ "0.68627155", "0.68321836", "0.6829095", "0.66861373", "0.66580784", "0.6646886", "0.66446394", "0.65123105", "0.64821994", "0.6450247", "0.6421283", "0.6403154", "0.6375742", "0.63626796", "0.63572216", "0.6343458", "0.63421607", "0.62852013", "0.6237728", "0.6227138", "0.61...
0.82312423
0
Return ``True`` if `f` has zero trailing coefficient.
def is_homogeneous(f): return dmp_homogeneous_p(f.rep, f.lev, f.dom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_zero(f):\n return dmp_zero_p(f.rep, f.lev)", "def zzX_zero_p(f):\n if poly_univariate_p(f):\n return not f\n else:\n if len(f) == 1:\n return zzX_zero_p(f[0])\n else:\n return False", "def iszero(a: float) -> bool:\n return np.isclose(a, 0.0, at...
[ "0.70650417", "0.66157144", "0.6415445", "0.63003606", "0.62573594", "0.61306244", "0.60404515", "0.5986724", "0.5955625", "0.5919853", "0.58975965", "0.5879079", "0.5855871", "0.58355117", "0.58319634", "0.58083016", "0.580651", "0.5805895", "0.57963556", "0.57779497", "0.57...
0.0
-1
convert normal timestamp to integer timestamp
def time_extractor(time_div): now = datetime.now(timezone) if "giờ" in time_div: delta = int(re.search('\d{1,2}').group()) return int(datetime.timestamp(now - timedelta(hours=delta))) if "lúc" in time_div: time = re.search("(?<= )\d{1,2}:\d{1,2}", time_div).group() if "Hôm qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_timestamp(self, timestamp):\n return int(timestamp * 1e6)", "def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600", "def date_to_timestamp(date):\n return int(calendar.timegm(date.utctimetuple()))", "def time...
[ "0.7704156", "0.7226174", "0.7167579", "0.70981246", "0.708771", "0.70694554", "0.70527333", "0.70431846", "0.6984574", "0.69801474", "0.6964149", "0.69581187", "0.6931208", "0.6908212", "0.68865085", "0.6883597", "0.68598557", "0.68565315", "0.6851186", "0.6830723", "0.67971...
0.0
-1
Initializes `ResourceManagingExecutorFactory`. `ResourceManagingExecutorFactory` manages a mapping from `cardinalities` to `executor_base.Executors`, closing and destroying the executors in this mapping when asked.
def __init__( self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]] = None): py_typecheck.check_callable(executor_stack_fn) self._executor_stack_fn = executor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super(Executor, self).__init__()\n self.__scheduler = _scheduler.Scheduler()\n self.__procedures_lock = threading.RLock()\n self.__procedures = WeakValueDictionary()\n self.__threads_lock = threading.RLock()\n self.__executors = []\n self.__num...
[ "0.59641737", "0.5913751", "0.5838488", "0.5786392", "0.57544863", "0.57422686", "0.56361204", "0.55896586", "0.5280068", "0.52781945", "0.5177498", "0.5092387", "0.5090342", "0.50892085", "0.50529647", "0.5030522", "0.50236547", "0.4990004", "0.4987313", "0.49792656", "0.493...
0.62560743
0
Creates an executor hierarchy of maximum width `self._max_fanout`. First creates a flat list of executors to aggregate, using the `flat_stack_fn` passed in at initialization. Then composes this list into a hierarchy of width at most `self._max_fanout`.
def create_executor( self, cardinalities: executor_factory.CardinalitiesType ) -> executor_base.Executor: executors = self._flat_stack_fn(cardinalities) return self._aggregate_stacks(executors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregate_stacks(\n self,\n executors: Sequence[executor_base.Executor],\n ) -> executor_base.Executor:\n if len(executors) <= 1:\n return reference_resolving_executor.ReferenceResolvingExecutor(\n self._create_composing_stack(target_executors=executors))\n while len(executors) ...
[ "0.7038833", "0.660228", "0.6479736", "0.5151284", "0.49770188", "0.4903775", "0.4770318", "0.47636992", "0.47501507", "0.4703066", "0.46829724", "0.46696302", "0.4572329", "0.44979513", "0.44887832", "0.44757384", "0.44733563", "0.44526994", "0.44457334", "0.44153833", "0.44...
0.6299105
3
Get the duration for this ExportTaskRecord.
def duration(self): started = self.started_at finished = self.finished_at if started and finished: return str(finished - started) else: return None # can't compute yet
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n return self._duration", "def get_duration(self):\n return self.duration", "def duration(self):\n return self._get('duration')", "def duration(self):\n return self._get(\"duration\")", "def duration(self):\n return self._duration", "def duration...
[ "0.7330607", "0.722008", "0.70875984", "0.7068969", "0.7040436", "0.7040436", "0.7040436", "0.7040436", "0.7040436", "0.7040436", "0.7040436", "0.7040436", "0.7014009", "0.6987497", "0.6826969", "0.6826969", "0.67713547", "0.6734279", "0.6703747", "0.6681958", "0.66615355", ...
0.66107684
25
Return an option defaults module, containing default overrides as the 'options_default' value. By default this will be discovered based on the kolibri_options property.
def option_defaults_module(self): if self.kolibri_option_defaults: module = self._return_module(self.kolibri_option_defaults) if module is None: logging.warning( "{plugin} defined {module} kolibri option defaults but the module was not found".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_default_options():\n return {\n \"library_folders\": [],\n \"verbose\": False,\n \"check_balanced\": True,\n \"mtime_check\": True,\n \"cache\": False,\n \"codegen\": False,\n \"expand_mx\": False,\n \"unroll_loops\": True,\n \"inline_funct...
[ "0.72297364", "0.6994755", "0.67126906", "0.66852456", "0.66505", "0.6613466", "0.66012967", "0.6578986", "0.65687126", "0.65598536", "0.6557565", "0.65210766", "0.65106964", "0.65106964", "0.6484937", "0.6481155", "0.6481155", "0.64747983", "0.6472846", "0.64651245", "0.6428...
0.82514477
0
function used to convert heatmaps to bounding boxes (batch wise)
def getBoxFromHeatMap(heatmap): boxes_batch = [] heatmap = heatmap.detach().cpu().numpy().astype(np.uint8) for gray in heatmap: thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1] cnts = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cnt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatmap_to_labeled_bboxes(heatmap: NdArray,\n score_threshold: float = 0.5,\n ) -> Tuple[List[np.ndarray], List[np.ndarray]]:\n xp = cuda.get_array_module(heatmap)\n N = len(heatmap)\n\n values, indices = F.max_pooling_2d(\n heatmap[:, 0:...
[ "0.68734914", "0.6679655", "0.6617095", "0.6521179", "0.6444042", "0.643972", "0.6428377", "0.63893396", "0.637411", "0.637171", "0.63717", "0.6367261", "0.63521093", "0.6329034", "0.63287985", "0.62770826", "0.62763524", "0.62763524", "0.6275485", "0.6203071", "0.6190359", ...
0.6756906
1
Callback for '/obstacles'. Calculates directional obstacle risk factor and indicator for obstacles.
def obstacles_callback(self, data): obs_pos = [(obs.ObsPosition.x, obs.ObsPosition.y, obs.ObsPosition.z) for obs in data.obs] obs_yaw = np.array([obs.ObsTheta for obs in data.obs]) if len(obs_pos)==0: self.obs_risk = 0.0 self.min_obs_dist = self.detect_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _detect_obstacles(self):\n def _distance(point, line_point1, line_point2):\n \"\"\"calcuate the distance between a point and a line\"\"\"\n vec1 = line_point1 - point\n vec2 = line_point2 - point\n distance = np.abs(np.cross(vec1,vec2)) / np.linalg.norm(line_p...
[ "0.6006229", "0.59831464", "0.59676105", "0.5895385", "0.5861162", "0.58480954", "0.57113296", "0.56835693", "0.56673706", "0.56472874", "0.562744", "0.554277", "0.5479771", "0.54709125", "0.5457258", "0.5455121", "0.5406178", "0.5397039", "0.5394005", "0.5380201", "0.5363121...
0.7002966
0
Sets the account_id of this Account.
def account_id(self, account_id): self._account_id = account_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAccount(self, account_id):\n self.data_struct['_setAccount'] = account_id", "def account_id(self, account_id):\n self._account_id = account_id", "def account_id(self, account_id: str):\n if account_id is None:\n raise ValueError(\"Invalid value for `account_id`, must not ...
[ "0.87249315", "0.87208027", "0.8242886", "0.81835634", "0.7223229", "0.7059459", "0.7050165", "0.7050165", "0.7050165", "0.7050165", "0.6984745", "0.68363744", "0.66445804", "0.66445804", "0.66127974", "0.6467379", "0.64107895", "0.63521343", "0.62496644", "0.62413317", "0.61...
0.8788047
4
Sets the type of this Account.
def type(self, type): allowed_values = [ "BANK", "EMPLOYERSNIC", "NICLIABILITY", "PAYEECONTRIBUTION", "PAYELIABILITY", "WAGESPAYABLE", "WAGESEXPENSE", "None", ] # noqa: E501 if type: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_type(self, account_type):\n\n self._account_type = account_type", "def account_type(self, account_type):\n\n self._account_type = account_type", "def account_type(self, account_type):\n\n self._account_type = account_type", "def account_type(self, account_type):\n\n se...
[ "0.84160495", "0.84160495", "0.84160495", "0.84160495", "0.78631777", "0.78631777", "0.78404707", "0.74956423", "0.7327187", "0.7292451", "0.7229779", "0.72196895", "0.72196895", "0.72196895", "0.72196895", "0.72196895", "0.72196895", "0.72196895", "0.72196895", "0.72196895", ...
0.7136352
39