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
A call to /subtract/a/b yields a b, for a < b
def test_subtract_negative_result(self): a = random.randint(100, 1000) b = random.randint(10000, 100000) path = "/subtract/{}/{}".format(a, b) response = self.get_response(path) self.assertEqual(200, response.getcode()) self.assertIn(str(a - b).encode(), response.read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(a, b):\n return a - b", "def subtract(a, b):\n return a - b", "def subtraction(a, b):\n return a - b", "def minus(self, a, b):\n return a - b", "def subtract(first, second):\n return first - second", "def sub(self, a, b):\n return a - b", "def subtract(a, b):\n pri...
[ "0.79402685", "0.79402685", "0.78126335", "0.7720317", "0.7627804", "0.7620604", "0.75992376", "0.75113356", "0.74423736", "0.7404574", "0.7381209", "0.7375842", "0.7375842", "0.7375842", "0.7321055", "0.72378105", "0.72308564", "0.72291607", "0.7209949", "0.7177835", "0.7177...
0.68664914
37
The index page at the root of the server shall include instructions on how to use the page.
def test_index_instructions(self): response = self.get_response('/') self.assertEqual(200, response.getcode()) # We're just testing if the word "add" is present in the index self.assertIn("add".encode(), response.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n print('This is the root of the app, should have something better')\n return 'Root, this is where some front end would go on a server'", "def index():\n isoko = get_sources('general')\n\n head = \"ALLOVER THE WORLD NEWS\"\n return render_template('index.html', title = head, isoko = i...
[ "0.7623259", "0.7359942", "0.7349391", "0.73357177", "0.7294751", "0.72802347", "0.72632897", "0.71725523", "0.7168174", "0.71561223", "0.714585", "0.7126417", "0.71068513", "0.71068513", "0.7103854", "0.7103854", "0.7103854", "0.70944047", "0.7091539", "0.7086335", "0.706888...
0.0
-1
Return action with highest probability
def chooseAction(self, gameState): probabilities = self.assignProbablities(gameState) #print probabilities prob, bestProbabilityAction = max(probabilities) return bestProbabilityAction
{ "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 getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for termin...
[ "0.7648295", "0.7495396", "0.7428889", "0.73734206", "0.73101646", "0.71037084", "0.7102478", "0.70933664", "0.7049176", "0.70447606", "0.7041163", "0.70229703", "0.70172846", "0.69849265", "0.697603", "0.6971595", "0.6964426", "0.6960023", "0.69165444", "0.6914481", "0.69053...
0.82061726
0
Replace any length white spaces in the given string with a replacement.
def replace_whitespace(s, rep=' '): s = re.sub(r'\s+', rep, s) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_whitespace(input: str, *, replace_str: str = '') -> str:\n return WHITESPACE_REGEX.sub(replace_str, input)", "def normalize_space (text):\n return RE_WS.sub (' ', text.strip ())", "def normalize_whitespace(text):\n return NORMALIZE_WHITESPACE_REGEX.sub(' ', text)", "def strip_space(strin...
[ "0.7091415", "0.67047095", "0.6697442", "0.6544741", "0.65237546", "0.6492337", "0.64796394", "0.6393973", "0.63939565", "0.63260424", "0.63126695", "0.62759525", "0.61797035", "0.61797035", "0.61601454", "0.61490405", "0.6122402", "0.61191076", "0.6111925", "0.61067057", "0....
0.76148945
0
Return split words of a string including the nonword tokens.
def split_preserve_tokens(s): return re.split(r'(\W)', s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_words(s):\n s = re.sub(r\"\\W+\", \" \", s)\n s = re.sub(r\"[_0-9]+\", \" \", s)\n return s.split()", "def split_into_words(s):\n s = re.sub(r\"\\W+\", \" \", s)\n s = re.sub(r\"[_0-9]+\", \" \", s)\n return s.split()", "def get_words(s):\n return tokenize(lower_without_diacritics(s))",...
[ "0.790145", "0.790145", "0.75671256", "0.7552346", "0.75232416", "0.7476419", "0.74410003", "0.7384879", "0.7384764", "0.7227358", "0.7226007", "0.7214209", "0.7210724", "0.71471393", "0.7142224", "0.709704", "0.70740175", "0.7061054", "0.7051394", "0.70336044", "0.70333153",...
0.75778073
2
Gets losses, variables, and gradients for each network.
def get_network_losses_variables_and_gradients(self, real_images): with tf.GradientTape() as gen_tape, tf.GradientTape() as dis_tape: # Get fake logits from generator. (fake_images, fake_logits, generator_loss) = self.generator_loss_phase(training=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_get_variables(self) -> Callable:\n\n def get_variables():\n networks = (self.representation_network, self.value_network, self.policy_network,\n self.dynamic_network, self.reward_network)\n return [variables\n for variables_list in map(la...
[ "0.6133671", "0.6089181", "0.6082883", "0.6042032", "0.59740996", "0.59423256", "0.59195125", "0.58766013", "0.5847659", "0.581931", "0.5779143", "0.57660484", "0.57512766", "0.574551", "0.5724206", "0.56788737", "0.5660472", "0.5657707", "0.5645659", "0.56367177", "0.5636319...
0.66366255
0
Given user_id, return the associated User object.
def load_user(user_id): return User.query.get(user_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(user_id):\n\n return User.query.get(user_id)", "def get(self, user_id):\n return User.get(user_id)", "def get_user_from_id(user_id):\n return Users.query.filter_by(id=user_id).first()", "def get_user(self, user_id):\n User = get_user_model()\n try:\n ...
[ "0.84723973", "0.8393383", "0.83698905", "0.8285045", "0.8247994", "0.8244847", "0.82433355", "0.82264954", "0.8179295", "0.8178196", "0.8178196", "0.8151988", "0.8151988", "0.8151988", "0.8151988", "0.7943583", "0.7909672", "0.787124", "0.78475416", "0.78186816", "0.77860373...
0.7675426
28
return the static path to a CatEyes sample dataset.
def sample_data_path(name): import os.path as op data_dir = op.join(op.dirname(__file__), "data") data_path = op.join(data_dir, name + ".csv") return op.abspath(data_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_path(cls):\n basepath = os.path.dirname(__file__)\n filepath = os.path.abspath(\n os.path.join(basepath, \"..\", \"datasets\", get_env('DATA_FILENAME')))\n return filepath", "def get_sample_data_dir():\n \n return resource_filename('cdat_lite.test.test_cdms', 'sa...
[ "0.73300564", "0.7159863", "0.6527848", "0.6474556", "0.644209", "0.6410078", "0.6402141", "0.6395644", "0.63866097", "0.63466156", "0.63278776", "0.63220537", "0.62885326", "0.62877905", "0.62776434", "0.62581956", "0.6240348", "0.6228252", "0.6199317", "0.6186844", "0.61843...
0.6545871
2
Calculate the movement distance from start to end of a segment. This function can be used to calculate Saccade distance.
def get_segment_distance(x, y, times, segments, from_discrete=False, return_start_end_pos=False): # check if continuous segments match length msg = "For continuous segments, len(segments) must be equal to " \ "len(times). If you are using a discrete segment array, please " \ "pas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_segment_distance(start1, end1, start2, end2):\n assert end1 >= start1\n assert end2 >= start2\n if start1 <= start2 <= end1:\n return 0\n elif start1 <= start2:\n return start2 - end1\n elif start2 <= start1 <= end2:\n return 0\n else:\n return start1 - end2",...
[ "0.652445", "0.62961763", "0.61612964", "0.6146212", "0.6135663", "0.61208385", "0.6056257", "0.60528666", "0.5953203", "0.5920773", "0.58549035", "0.5848489", "0.58078426", "0.5800109", "0.57877564", "0.5783329", "0.57732254", "0.5740463", "0.5718229", "0.57170326", "0.56471...
0.6606548
0
x.__eq__(y) x == y
def __eq__(self, x): assert isinstance(x, AxisDistance), 'incorrect type of arg x: should be type AxisDistance, is type {}'.format(type(x)) return self.__cmp__(x) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(x, y):\n return x == y", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "...
[ "0.8611628", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "0.8127378", "...
0.0
-1
Converts the distance to the nearest pixel as an int
def toPixels(self): return (self.tile * AxisDistance.tilesize) + self.pixel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_int(num):\n return int(np.round(num))", "def _get_nearest_point(self, position):\n nearest_inds = np.round(position / self._maze.grid_side - 0.5)\n return nearest_inds.astype(int)", "def distance_to_int(mi):\n return round(change_precision(mi, 2))", "def distanceToNearestEdge(...
[ "0.711711", "0.6827673", "0.6724163", "0.63511956", "0.61147606", "0.60571015", "0.6026315", "0.6018019", "0.6005629", "0.6002571", "0.59961796", "0.59870875", "0.59737223", "0.597201", "0.594756", "0.59427315", "0.5911971", "0.5900264", "0.58719933", "0.5857902", "0.585711",...
0.0
-1
Returns the direction opposite this one, or Center if it's Center
def opposite(self): if self.direction == 8: return Direction(8) n = self.direction + 4 if n >= 8: n -= 8 return Direction(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opposite(self):\n if self == self.EAST:\n return self.WEST\n elif self == self.WEST:\n return self.EAST\n elif self == self.NORTH:\n return self.SOUTH\n elif self == self.SOUTH:\n return self.NORTH", "def direction(self):\r\n retu...
[ "0.7395317", "0.7160236", "0.701048", "0.68796414", "0.68268293", "0.66856116", "0.6618606", "0.6582053", "0.6579854", "0.65670365", "0.65511304", "0.64990944", "0.646922", "0.64430994", "0.6358651", "0.6351403", "0.6326813", "0.6323978", "0.6274093", "0.62597454", "0.6254371...
0.69072956
3
Returns the x displacement of the direction
def dx(self): return self._dx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_x__(self):\n return self.Direction['x']", "def _get_x(self):\n return self.position.x", "def x(self):\r\n return self.position.x", "def calculate_position_x(cls, position_x, direction):\n cls.raise_exception_if_invalid_direction(direction)\n return position_x + cls.DI...
[ "0.78957367", "0.7539288", "0.73847145", "0.73237586", "0.7164627", "0.70678705", "0.7063477", "0.70541364", "0.69704926", "0.69337696", "0.68979454", "0.687176", "0.68615544", "0.6838318", "0.6833156", "0.6794025", "0.6791481", "0.67834914", "0.6768529", "0.676571", "0.67627...
0.67701393
19
Returns the y displacement of the direction
def dy(self): return self._dy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_y__(self):\n return self.Direction['y']", "def calculate_position_y(cls, position_y, direction):\n cls.raise_exception_if_invalid_direction(direction)\n return position_y + cls.DIRECTION_MAPPER[direction][1]", "def _get_y(self):\n return self.position.y", "def y(self):\r...
[ "0.80015856", "0.76717573", "0.7403422", "0.73008484", "0.7171839", "0.7075675", "0.70137197", "0.700862", "0.69861263", "0.69860595", "0.69706947", "0.69665074", "0.69584465", "0.6937537", "0.692584", "0.6904585", "0.6904295", "0.69002134", "0.6894101", "0.68832505", "0.6863...
0.6852999
24
Returns this instances distance to the given coordinate. If total is False, returns a new Coordinate object
def distTo(self, coord, total=True): assert isinstance(coord, Coordinate), "incorrect type of arg coord: should be Coordinate, is {}".format(type(coord)) assert isinstance(total, bool), "incorrect type of arg total: should be bool, is {}".format(type(total)) x1, y1 = self.x, self.y x2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _distance_to(self, coordinates):\n\n return abs(coordinates[0]) + abs(coordinates[1])", "def get_distance(self, coords):\n return distance.distance(coords, (self.lat, self.long)).m", "def dist(self, other: Coordinate) -> int:\n return abs(other.x - self.x) + abs(other.y - self.y)", "...
[ "0.6613083", "0.63747084", "0.6238564", "0.6205374", "0.61127734", "0.60994977", "0.6053412", "0.605253", "0.6040284", "0.603024", "0.59856087", "0.5982101", "0.59296453", "0.59035623", "0.59004843", "0.5887883", "0.5885589", "0.58798707", "0.5878029", "0.58193916", "0.581460...
0.81149167
0
Returns whether this rectangle will intersect
def intersection(self, x): _x = self._intersection(self.xArea, x.xArea) _y = self._intersection(self.yArea, x.yArea) return _x and _y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect(self, rectangle):\n return self.contains(rectangle.corner) or rectangle.contains(self.corner)", "def intersects(self, rect):\n\t\treturn ( rect.right >= self.left and rect.left < self.right\n\t\t\tand rect.bottom >= self.top and rect.top < self.bottom )", "def _rect_intersects(self, rect):...
[ "0.8487399", "0.82497424", "0.821199", "0.7652416", "0.76160353", "0.76125234", "0.7592472", "0.74875426", "0.7465025", "0.74267256", "0.7364686", "0.7347008", "0.7329725", "0.73282987", "0.7266523", "0.7262529", "0.72568536", "0.7237176", "0.71423334", "0.70168257", "0.69811...
0.6548645
66
Recursive function to create a binary tree
def CreateTree(d,list_L): d_new = defaultdict(dict) #labels corresponding to minimum evolutionary distance in Matrix a,b = minInDict(d) n = ['(',a,',',b,')'] new_cluster = ''.join(n) #remove the entries in newly formed cluster from our list for k in list_L: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_tree():\n root = TreeNode(5)\n root.left = TreeNode(3)\n root.right = TreeNode(8)\n root.left.left = TreeNode(2)\n root.left.right = TreeNode(4)\n root.right.left = TreeNode(7)\n return root", "def build():\n r = TreeNode(1)\n r.left = TreeNode(2)\n r.left.left = TreeN...
[ "0.76095176", "0.7589695", "0.75249445", "0.74824035", "0.74582726", "0.72702265", "0.7217349", "0.7214562", "0.7141989", "0.71055114", "0.70928293", "0.70512927", "0.7043162", "0.70138705", "0.69493407", "0.6940104", "0.6934134", "0.6915628", "0.68834627", "0.68833166", "0.6...
0.0
-1
to find the minimum value/distance in our dictionary and returning the corresponding to this minimum value
def minInDict(dist): m = float('inf') for p in dist: for q in dist[p]: if dist[p][q] < m: m = dist[p][q] a,b = p,q return a,b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(self):\n if self.is_empty():\n return None\n else:\n p = self.first()\n return (p.key(), p.value())", "def keywithminval(d): \r\n v=list(d.values())\r\n k=list(d.keys())\r\n return k[v.index(min(v))]", "def min(self):\n p = self._find_min...
[ "0.73691416", "0.7309376", "0.72491604", "0.71362597", "0.7134431", "0.7092636", "0.70713985", "0.7008079", "0.69488275", "0.6899812", "0.6899812", "0.68590105", "0.68122965", "0.6751939", "0.67278594", "0.67271215", "0.6727028", "0.67188066", "0.67021996", "0.66560125", "0.6...
0.7732689
0
This function to replace the loser parent in the population by the new offspring, the loser individual is the individual is the one with lower fitness
def replaceLoser(self, parents, newoffspring): loser = min(parents, key=self.applyFitness) for index, individual in enumerate(self.currentGeneration): if (individual == loser): self.currentGeneration[index] = newoffspring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_new_population(self, parents_offspring: Population):\n # Get fitness\n parents_offspring_fitness = parents_offspring.fitness\n\n # Get individual indices sorted by fitness\n indices = np.argsort(parents_offspring_fitness)[:(self._population.size - 1):-1]\n\n # Get best i...
[ "0.67574143", "0.6735563", "0.66986865", "0.66741997", "0.66667867", "0.6625717", "0.6590667", "0.6586559", "0.65788937", "0.6537534", "0.65192854", "0.6489191", "0.64616317", "0.64470416", "0.64443046", "0.6425785", "0.6407018", "0.64054525", "0.6294508", "0.6240264", "0.621...
0.80425453
0
check if the lattice has a good shape.
def good_lattice(struc, maxvec=25.0, minvec=1.2, maxang=150, minang=30): para = struc.lattice.get_para(degree=True) if (max(para[:3])<maxvec) and (min(para[:3])>minvec)\ and (max(para[3:])<maxang) and (min(para[3:])>minang): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_lattice(self):\n return hasattr(self,\"uc\") and len(self.maximals())==1 and type(self.get_meet())!=str and type(self.get_join())!=str", "def is_valid(self) -> bool:\r\n try:\r\n self.shape\r\n return True\r\n except ValueError:\r\n return False", "d...
[ "0.7111411", "0.70262915", "0.6918204", "0.68648237", "0.64018166", "0.63829756", "0.6359982", "0.6325148", "0.63046", "0.62925625", "0.62891304", "0.6282721", "0.6282721", "0.6273234", "0.62512136", "0.6238588", "0.61411923", "0.6140296", "0.6131813", "0.6130223", "0.6120512...
0.0
-1
symmetrize the structure from spglib.
def symmetrize(pmg, tol=1e-3, a_tol=5.0, style='pyxtal', hn=None): numbers = [site.species.elements[0].Z for site in pmg.sites] atoms = (pmg.lattice.matrix, pmg.frac_coords, numbers) dataset = get_symmetry_dataset(atoms, tol, angle_tolerance=a_tol) if hn is None: hn = Hall(dataset['number'], sty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symmetrize(F, *gens, **args):\n allowed_flags(args, ['formal', 'symbols'])\n\n iterable = True\n\n if not hasattr(F, '__iter__'):\n iterable = False\n F = [F]\n\n R, F = sring(F, *gens, **args)\n gens = R.symbols\n\n opt = build_options(gens, args)\n symbols = opt.symbols\n ...
[ "0.60753167", "0.6007776", "0.59097177", "0.5699873", "0.5694103", "0.54829", "0.5404972", "0.54047513", "0.52612895", "0.52612275", "0.52362776", "0.5211854", "0.51892626", "0.51727134", "0.51634705", "0.5154356", "0.50892234", "0.50871396", "0.50797606", "0.50406325", "0.49...
0.5672918
5
Returns path to mount point NFS share.
def _get_mount_point_for_share(self, nfs_share): nfs_share = nfs_share.encode('utf-8') return os.path.join(self.configuration.nexenta_mount_point_base, md5(nfs_share, usedforsecurity=False).hexdigest())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_local_share_path(self, share):\n local_vol_path = self._get_mount_point_for_gluster_vol()\n if not os.access(local_vol_path, os.R_OK):\n raise exception.GlusterfsException('share path %s does not exist' %\n local_vol_path)\n ret...
[ "0.7795988", "0.77838475", "0.7597644", "0.72917444", "0.7049242", "0.6989462", "0.6980395", "0.6805012", "0.6778835", "0.669241", "0.6650866", "0.66389495", "0.6342373", "0.633498", "0.63081914", "0.62626815", "0.6234679", "0.6230863", "0.6215162", "0.6195222", "0.6195222", ...
0.8357346
0
Returns volroot property value from NexentaStor appliance.
def _get_volroot(self, nms): if not self.nms_cache_volroot: return nms.server.get_prop('volroot') if nms not in self._nms2volroot: self._nms2volroot[nms] = nms.server.get_prop('volroot') return self._nms2volroot[nms]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self) -> Optional[Any]:\n return self.get(\"/V\")", "def root_volume(self):\n return self._root_volume", "def root_value(self):\n return self.__root.get_value()", "def volume(self):\n v = {'art': self._vart, 'ven': self._vven}\n if self._lvad is not None:\n ...
[ "0.61601096", "0.5949537", "0.58422107", "0.5703597", "0.5703597", "0.5703597", "0.5559454", "0.5505063", "0.5468166", "0.5460711", "0.5445286", "0.53854096", "0.53415215", "0.5280505", "0.5268969", "0.52529585", "0.5228251", "0.5221805", "0.5202413", "0.51986957", "0.5191742...
0.7106413
0
Return a string representing the type of vehicle this is.
def print_abs_type(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n ...
[ "0.8265305", "0.8170253", "0.7995276", "0.7995276", "0.7995276", "0.7840752", "0.7840752", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0.73868793", "0....
0.0
-1
Return a string representing the type of vehicle this is.
def print_abs_type(self): return 'Generic'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n ...
[ "0.8264676", "0.81698346", "0.7994656", "0.7994656", "0.7994656", "0.78400844", "0.78400844", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", ...
0.0
-1
Return a string representing the type of vehicle this is.
def print_abs_type(self): return 'SubSystem'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n ...
[ "0.8265945", "0.8171127", "0.79946303", "0.79946303", "0.79946303", "0.78402793", "0.78402793", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936"...
0.0
-1
Create a 2D texture
def _texture_2d(self, data): # Start by resolving the texture format try: format_info = pixel_formats[self._dtype] except KeyError: raise ValueError( f"dype '{self._dtype}' not support. Supported types are : {tuple(pixel_formats.keys())}" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupTexture( self ):\n glEnable(GL_TEXTURE_2D)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)\n glBindTexture(GL_TEXTURE_2D, se...
[ "0.7188117", "0.6842773", "0.6832628", "0.67901695", "0.6532243", "0.6433", "0.63820785", "0.63820785", "0.6320794", "0.62327886", "0.61053205", "0.6101057", "0.6012965", "0.5975836", "0.59536195", "0.5940448", "0.593926", "0.58872813", "0.58433676", "0.58386964", "0.581251",...
0.74682844
0
If this is a depth texture.
def depth(self) -> bool: return self._depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_depth_image(self):\n return False", "def is_depth(self):\n return self._is_depth", "def depth_check(self, depth):\r\n if depth >= self.ply:\r\n return True\r\n return False", "def texture_mode_enabled():\n for area in bpy.context.screen.areas:\n if area...
[ "0.7505039", "0.63483423", "0.6055799", "0.60521936", "0.6038747", "0.58123887", "0.5785416", "0.57703376", "0.57436144", "0.5625199", "0.55462575", "0.5533299", "0.5440087", "0.53834677", "0.5357321", "0.53262186", "0.53225833", "0.5321339", "0.5300496", "0.52915186", "0.528...
0.56667644
9
Get or set the ``(min, mag)`` filter for this texture. These are rules for how a texture interpolates. The filter is specified for minification and magnification. Default value is ``LINEAR, LINEAR``. Can be set to ``NEAREST, NEAREST`` for pixelated graphics. When mipmapping is used the min filter needs to be one of the...
def filter(self) -> Tuple[int, int]: return self._filter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_image(image: Image, image_filter: str) -> Image:\n if image_filter == 'max':\n image = image.filter(ImageFilter.MaxFilter())\n elif image_filter == 'min':\n image = image.filter(ImageFilter.MinFilter())\n elif image_filter == 'median':\n image = image.filter(ImageFilter.Med...
[ "0.524342", "0.5039486", "0.50042534", "0.497876", "0.497876", "0.497876", "0.4935877", "0.48312286", "0.4788593", "0.47638324", "0.47199175", "0.46718085", "0.46673957", "0.46536615", "0.4643039", "0.4626729", "0.45967704", "0.4587776", "0.45475543", "0.45431992", "0.4514759...
0.0
-1
Get a handle for bindless texture access. Once a handle is created its parameters cannot be changed. Attempting to do so will have no effect. (filter, wrap etc). There is no way to undo this immutability. Handles cannot be used by shaders until they are resident. This method can be called multiple times to move a textu...
def get_handle(self, resident: bool = True) -> int: handle = gl.glGetTextureHandleARB(self._glo) is_resident = gl.glIsTextureHandleResidentARB(handle) # Ensure we don't try to make a resident texture resident again if resident: if not is_resident: gl.glMakeTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def texture( self, mode ):\n texture = mode.cache.getData( self, 'texture' )\n if texture is None:\n texture = glGenTextures( 1 )\n holder = mode.cache.holder( self, texture, 'texture' )\n return texture", "def new_handle(self):\n\n raise NotImplementedError('new...
[ "0.55944216", "0.5345217", "0.53050876", "0.5206766", "0.5206766", "0.5206766", "0.5180088", "0.5144606", "0.51241904", "0.5064889", "0.5064889", "0.50330245", "0.499311", "0.4986729", "0.4986729", "0.49717417", "0.49468327", "0.4944732", "0.4930265", "0.49168468", "0.4914705...
0.6405713
0
Columns not categorical are numeric.
def is_numeric_and_not_ignored(column): if column not in categorical_columns and column not in ignore_columns: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_numerical(self, df):\n # categorical = [key for key in df.keys() if df.dtypes[key] == np.dtype('O')]\n numeric = [key for key in df.keys() if df.dtypes[key] != np.dtype('O')]\n # correct naive expectations\n actual_categoric = ['MSSubClass']\n numeric = list(set(numeric)...
[ "0.7231478", "0.7231478", "0.71891004", "0.7033247", "0.69128186", "0.68907744", "0.68339336", "0.68084824", "0.67879426", "0.67816305", "0.67736906", "0.6771879", "0.6668778", "0.66226965", "0.6556335", "0.6551606", "0.6540514", "0.64810956", "0.64642143", "0.6456399", "0.63...
0.6656425
13
Sets the cash_flows of this CashFlowList.
def cash_flows(self, cash_flows): if cash_flows is None: raise ValueError("Invalid value for `cash_flows`, must not be `None`") # noqa: E501 self._cash_flows = cash_flows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flows(self, flows):\n\n self._flows = flows", "def cash_transactions(self, cash_transactions):\n\n self._cash_transactions = cash_transactions", "def cash(self, cash: float):\n if cash is None:\n raise ValueError(\"Invalid value for `cash`, must not be `None`\") # noqa: E50...
[ "0.6503148", "0.62438166", "0.545946", "0.5454699", "0.5216654", "0.51502836", "0.5088359", "0.50755364", "0.4959282", "0.4867318", "0.4782161", "0.46714813", "0.46688834", "0.46656358", "0.46624285", "0.46424636", "0.46328622", "0.45433024", "0.4542396", "0.45193258", "0.450...
0.82056403
0
Sets the total_income of this CashFlowList.
def total_income(self, total_income): if total_income is None: raise ValueError("Invalid value for `total_income`, must not be `None`") # noqa: E501 self._total_income = total_income
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_amount(self, total_amount):\n\n self._total_amount = total_amount", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total ...
[ "0.6431345", "0.59588367", "0.59588367", "0.59588367", "0.59588367", "0.59588367", "0.59588367", "0.59588367", "0.59588367", "0.58867455", "0.5797784", "0.57963246", "0.5755417", "0.5627125", "0.5616459", "0.55919397", "0.55724037", "0.55422646", "0.54104125", "0.5386278", "0...
0.76999545
0
Sets the total_spending of this CashFlowList.
def total_spending(self, total_spending): if total_spending is None: raise ValueError("Invalid value for `total_spending`, must not be `None`") # noqa: E501 self._total_spending = total_spending
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self,...
[ "0.55875266", "0.55875266", "0.55875266", "0.55875266", "0.55875266", "0.55875266", "0.55875266", "0.55875266", "0.5534092", "0.54833645", "0.541818", "0.5382489", "0.5371437", "0.5328672", "0.5287935", "0.5245904", "0.51732576", "0.51732314", "0.5140538", "0.51266545", "0.50...
0.77776664
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CashFlowList): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Initialize the weights of modules in single object tracker.
def init_weights(self): # We don't use the `init_weights()` function in BaseModule, since it # doesn't support the initialization method from `reset_parameters()` # in Pytorch. if self.with_backbone: self.backbone.init_weights() if self.with_neck: for m i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "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 # Initialize weights\n self.apply(self._init_weights)", "def in...
[ "0.74742", "0.7341231", "0.7238096", "0.71375203", "0.7133267", "0.71006024", "0.70233965", "0.70233965", "0.70233965", "0.69861645", "0.6968602", "0.69675523", "0.6951536", "0.69277126", "0.69186366", "0.68975216", "0.6886146", "0.6855509", "0.68230784", "0.681541", "0.67955...
0.69196343
14
Clip the bbox with [cx, cy, w, h] format.
def _bbox_clip(self, bbox, img_h, img_w): bbox[0] = bbox[0].clamp(0., img_w) bbox[1] = bbox[1].clamp(0., img_h) bbox[2] = bbox[2].clamp(10., img_w) bbox[3] = bbox[3].clamp(10., img_h) return bbox
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_box(bbox, clip_box, alpha):\n ar_ = (bbox_area(bbox))\n x_min = np.maximum(bbox[:, 0], clip_box[0]).reshape(-1, 1)\n y_min = np.maximum(bbox[:, 1], clip_box[1]).reshape(-1, 1)\n x_max = np.minimum(bbox[:, 2], clip_box[2]).reshape(-1, 1)\n y_max = np.minimum(bbox[:, 3], clip_box[3]).reshape(...
[ "0.7313244", "0.70429015", "0.70189553", "0.6883469", "0.6825649", "0.67743737", "0.6728525", "0.6686819", "0.6645149", "0.6609351", "0.65695226", "0.65587974", "0.6503888", "0.6412028", "0.63957345", "0.6377559", "0.6323363", "0.6306833", "0.6304818", "0.6238774", "0.6180341...
0.7783148
0
Registers UI home page
def register_home(route): global _home _home = route
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(self, *args, **kwargs):\n pass", "def home():\n\n return render_template('home_page.html')", "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def registration():\n registration_page = Registration()\n registration_page.re...
[ "0.67956895", "0.6708905", "0.66374415", "0.66158766", "0.66043884", "0.6580823", "0.6572928", "0.6559342", "0.65399474", "0.64996564", "0.6496449", "0.6494188", "0.6485153", "0.64734685", "0.64628464", "0.64628464", "0.645504", "0.64517254", "0.6445883", "0.6445883", "0.6444...
0.69619066
1
Checks if the user is in the retina admins group
def is_in_retina_admins_group(user): return user.groups.filter(name=settings.RETINA_ADMINS_GROUP_NAME).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_retina_group(user):\n return is_in_retina_graders_group(user) or is_in_retina_admins_group(user)", "def is_admin(user):\n return user.groups.filter(name='Profesores').exists()", "def is_admin(self,user):\n if user.is_superuser:\n return True\n\n if user.groups.filter(na...
[ "0.784455", "0.76779366", "0.73881423", "0.73478335", "0.7151855", "0.7018923", "0.6996919", "0.6914185", "0.68897706", "0.68798167", "0.68609184", "0.67808235", "0.67541564", "0.6690944", "0.66619605", "0.66282266", "0.66166395", "0.6616568", "0.6616457", "0.66022515", "0.65...
0.86453336
0
Creates a tf Dataset containing pairs extracted image features and tokenized caption vectors
def create_dataset(image_paths, tokenized_captions, img_features_dir): def map_func(img_name, cap): img_feature_filename = img_features_dir / \ (img_name.decode('utf-8').split('/')[-1] + '.npy') img_tensor = np.load(img_feature_filename) return img_tensor, cap ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_parser(self, value):\n keys_to_features = {\n 'image/encoded':\n tf.io.FixedLenFeature((), tf.string, ''),\n 'image/format':\n tf.io.FixedLenFeature((), tf.string, 'jpeg'),\n 'image/class/label':\n tf.io.FixedLenFeature([], tf.int64, -1),\n ...
[ "0.6684262", "0.66397846", "0.6508675", "0.6405396", "0.6400918", "0.6358375", "0.632083", "0.6303496", "0.62590766", "0.62338936", "0.621265", "0.62059116", "0.61887246", "0.6157544", "0.61569893", "0.6142628", "0.6117018", "0.61029035", "0.61001074", "0.6096749", "0.6092561...
0.76842475
0
Get templated field for a TaskInstance from the RenderedTaskInstanceFields table.
def get_templated_fields(cls, ti: TaskInstance, session: Session = None) -> Optional[dict]: result = ( session.query(cls.rendered_fields) .filter( cls.dag_id == ti.dag_id, cls.task_id == ti.task_id, cls.execution_date == ti.execution_date ) .one_or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_field_name(self, instance):\n fields = getattr(instance, \"_fields\")\n return fields[self.id]", "def get_field(entry, field):\n\n if field.name in entry.field_dict:\n if field.choices:\n return getattr(entry.object, \"get_%s_display\" % field.name)()\n return e...
[ "0.6241508", "0.5894879", "0.54714096", "0.54267204", "0.54264456", "0.5402755", "0.528257", "0.52103925", "0.5182086", "0.51770705", "0.51310015", "0.51098365", "0.5071629", "0.5061883", "0.50584024", "0.50435716", "0.50399226", "0.50218254", "0.5020443", "0.50161093", "0.50...
0.69858354
0
Initializes a new simulation model.
def __init__(self, base_comp = None): self._base_comp = base_comp self._pragmas = set() self._package_imports = set() self._package_locations = set() self._extra_deps = set() self._module_imports = set() self._actions = [] self._sources = [] self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_simulation(self) -> Simulation:\n pass", "def initialise_sim(self):\n pass", "def __init__(self, simulator):\r\n self.initialize(simulator)", "def initialize_model(self):\n pass", "def make_simulation(self):\n pass", "def init_model(self):\n pass",...
[ "0.763308", "0.7469408", "0.69350505", "0.6819763", "0.67672014", "0.671706", "0.66981095", "0.66505426", "0.6590059", "0.6573131", "0.65613145", "0.65528184", "0.65487564", "0.6531799", "0.6497613", "0.64877695", "0.648553", "0.646149", "0.6457929", "0.6446355", "0.6432066",...
0.0
-1
Add a new variable with the specified definition.
def add_var(self, name, comp): if name in self._var_names: raise InvalidVariableException('Variable ' + name + ' is already defined') elif name in self._lazy_var_names: action = name + ' <- ' + comp self._lazy_var_names.remove(name) self._var_names.add(nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variable(self, var):\n self.var_list.append(var)\n self.var_dict[var.name] = var", "def addVariable(self, varName, file, var, axesArgString):\n # If the variable is defined, replace existing variable, else create a new variable\n if self.isVariableDefined(varName):\n ...
[ "0.7372167", "0.71997195", "0.7104465", "0.70572597", "0.70572597", "0.7055764", "0.7042302", "0.7026974", "0.7019386", "0.69695", "0.687286", "0.6862491", "0.68154716", "0.6762516", "0.67523783", "0.66896003", "0.6612306", "0.6569806", "0.64301944", "0.6410666", "0.6357172",...
0.6221269
26
Add a new variable that will be defined lazily.
def add_lazy_var(self, name): if name in self._var_names: raise InvalidVariableException('Variable ' + name + ' is already defined') elif name in self._lazy_var_names: raise InvalidVariableException('Variable ' + name + ' is already added as lazy') else: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_lazy_var(self, name):\n self._main_model.add_lazy_var(name)", "def addVariable(self, name, value, save = False):\r\n setattr(self, name, value)\r\n if save and name not in self.variables:\r\n self.variables.append(name)", "def add(self, variable):\n var = copy(variable)\n\n if ...
[ "0.76545525", "0.66393924", "0.6595601", "0.6568951", "0.6247137", "0.62453395", "0.61838925", "0.5997919", "0.5997919", "0.5961082", "0.58474183", "0.5791899", "0.57212055", "0.5718378", "0.5668894", "0.56538415", "0.5638421", "0.5606852", "0.56036854", "0.5597571", "0.55961...
0.7712045
0
Initializes a new submodel.
def __init__(self, model, name = None): self._main_model = model.get_main_model() self._model = model self._name = name self._var_prefix = '_sub_' + str(SubModel._next_id) SubModel._next_id += 1 if (name is None) or model.is_source_prefix_mangled(): self._sour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_model(self):\n pass", "def initialize_model(self):\n pass", "def __init__(self, *args):\n this = _libsbml.new_Model(*args)\n try: self.this.append(this)\n except: self.this = this", "def instantiate(self):\n return _libsbml.Submodel_instantiate(self)", "de...
[ "0.6998372", "0.6960137", "0.6704588", "0.6630076", "0.6606655", "0.6579245", "0.6506945", "0.6487281", "0.64839053", "0.64817387", "0.647923", "0.647923", "0.64633405", "0.6438492", "0.63814646", "0.63814646", "0.63814646", "0.63814646", "0.6349379", "0.63449574", "0.6327848...
0.67143744
2
Add a new variable with the specified definition.
def add_var(self, name, comp): self._main_model.add_var(name, comp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variable(self, var):\n self.var_list.append(var)\n self.var_dict[var.name] = var", "def addVariable(self, varName, file, var, axesArgString):\n # If the variable is defined, replace existing variable, else create a new variable\n if self.isVariableDefined(varName):\n ...
[ "0.7372167", "0.71997195", "0.7104465", "0.70572597", "0.70572597", "0.7055764", "0.7042302", "0.7026974", "0.7019386", "0.69695", "0.687286", "0.6862491", "0.68154716", "0.6762516", "0.67523783", "0.66896003", "0.6612306", "0.64301944", "0.6410666", "0.6357172", "0.6352309",...
0.6569806
17
Add a new variable that will be defined lazily.
def add_lazy_var(self, name): self._main_model.add_lazy_var(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_lazy_var(self, name):\n if name in self._var_names:\n raise InvalidVariableException('Variable ' + name + ' is already defined')\n elif name in self._lazy_var_names:\n raise InvalidVariableException('Variable ' + name + ' is already added as lazy')\n else:\n ...
[ "0.7712045", "0.66393924", "0.6595601", "0.6568951", "0.6247137", "0.62453395", "0.61838925", "0.5997919", "0.5997919", "0.5961082", "0.58474183", "0.5791899", "0.57212055", "0.5718378", "0.5668894", "0.56538415", "0.5638421", "0.5606852", "0.56036854", "0.5597571", "0.559612...
0.76545525
1
Gets the experiment id for the session corresponding to a desired stimulus within an experiment.
def get_ophys_experiment_id(self, experiment_id, stimulus_name): # see visual coding overview on Allen Institute website if stimulus_name == 'drifting_gratings': key = 'three_session_A' elif stimulus_name == 'static_gratings': key = 'three_session_B' else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_experiment_id(experiment_name: str, config: SQAConfig) -> Optional[int]:\n exp_sqa_class = config.class_to_sqa_class[Experiment]\n with session_scope() as session:\n sqa_experiment_id = (\n session.query(exp_sqa_class.id) # pyre-ignore\n .filter_by(name=experiment_name)...
[ "0.71532655", "0.6378471", "0.63194567", "0.59795403", "0.5965008", "0.58918595", "0.5830722", "0.5771757", "0.5769766", "0.57486475", "0.5739815", "0.5717964", "0.56790876", "0.5650996", "0.5649797", "0.56194174", "0.5611385", "0.5587483", "0.55863225", "0.55659956", "0.5559...
0.7846635
0
Gets the experiment id for the session corresponding to a desired stimulus within an experiment.
def get_design_matrix(self, experiment_id, stimulus_name, stimulus_key, design): # get ophys data object ophys_experiment_id = self.get_ophys_experiment_id( experiment_id=experiment_id, stimulus_name=stimulus_name ) data = self.boc.get_ophys_experiment_data(ophys_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ophys_experiment_id(self, experiment_id, stimulus_name):\n # see visual coding overview on Allen Institute website\n if stimulus_name == 'drifting_gratings':\n key = 'three_session_A'\n elif stimulus_name == 'static_gratings':\n key = 'three_session_B'\n el...
[ "0.78465253", "0.71517205", "0.63784236", "0.6319727", "0.5979363", "0.5963021", "0.58907986", "0.5830224", "0.5770818", "0.5770364", "0.5749562", "0.57401663", "0.5718255", "0.56794155", "0.56511706", "0.56510377", "0.56180716", "0.5611736", "0.5587608", "0.55865383", "0.556...
0.0
-1
Test creating a new user without an email raises an error
def test_new_user_invalid_email(self): with self.assertRaises(ValueError): get_user_model().objects.create_user(None, '123')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_a_new_user_without_email(self):\n\n with self.assertRaises(ValueError):\n get_user_model().objects.create_user(None, \"Test1234\")", "def test_new_user_invalid_email(self):\n with self.assertRaises(ValueError):\n get_user_model().objects.create_user(None, \"t...
[ "0.9088418", "0.8959542", "0.89563155", "0.89563155", "0.89563155", "0.89563155", "0.89563155", "0.8954783", "0.89477336", "0.8945835", "0.89191824", "0.8913073", "0.89104134", "0.8884908", "0.8842249", "0.8800853", "0.8769576", "0.8759867", "0.8725888", "0.8683777", "0.86610...
0.89684045
1
Convert a 1dimensional argument that is either a list, array or matrix to an array.
def arg2array(arg): if isinstance(arg, (matrix, ndarray)): s = arg.shape if len(s) == 1: return array(arg) if min(s) == 1: return array(arg).flatten() elif isinstance(arg, list): return array(arg) elif isinstance(arg, (int, float, float32, fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _asarray1d(arr, copy=False):\n if copy:\n return asarray(arr).flatten()\n else:\n return asarray(arr).ravel()", "def to_numpy(x):\n if isinstance(x, list):\n return [to_numpy(e) for e in x]\n elif isinstance(x, np.ndarray):\n return x\n elif isinstance(x, (pd.DataFr...
[ "0.7183965", "0.68208325", "0.6803325", "0.6730968", "0.6730968", "0.6725568", "0.67174804", "0.66403395", "0.6640206", "0.65919584", "0.6575156", "0.65119815", "0.6417575", "0.63539165", "0.63468343", "0.6343524", "0.63367087", "0.63364476", "0.6336378", "0.63127023", "0.630...
0.82650495
0
Create or decompose translational homogeneous transformations. Create a homogeneous transformation =================================== T = transl(v) T = transl(vx, vy, vz) The transformation is created with a unit rotation submatrix. The translational elements are set from elements of v which is a list, array or matrix...
def transl(x, y=None, z=None): if y == None and z == None: x = mat(x) try: if ishomog(x): return x[0:3, 3].reshape(3, 1) else: return concatenate((concatenate((eye(3), x.reshape(3, 1)), 1), mat([0, 0, 0, 1]))) except AttributeError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_homogeneous_transform_from_vectors(r_vector, t_vector):\n r_vector = np.array(r_vector)\n if r_vector.shape == (3, 3):\n if isRotationMatrix(r_vector):\n r_gt = r_vector\n else:\n assert EOFError\n t = np.eye(4)\n t[0:3, 0:3] = r_gt\n t[0:3, 3]...
[ "0.6853959", "0.66387844", "0.6307596", "0.62538147", "0.6244158", "0.61653316", "0.61261743", "0.6102071", "0.5989559", "0.5944427", "0.59428275", "0.58906615", "0.58902925", "0.58013606", "0.57699513", "0.5766213", "0.5766213", "0.57649034", "0.5759939", "0.57446074", "0.57...
0.59805954
9
Set whether to hide secrets in logs.
def set_log_hide_secrets(value: bool = True) -> None: logs.HideFormatter.HIDE_ENABLED = tools.coerce_bool(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def omit_secret(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"omit_secret\")", "def omit_secret(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"omit_secret\")", "def omit_secret(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"omit...
[ "0.6221321", "0.61572707", "0.61572707", "0.59958506", "0.56645834", "0.559342", "0.55162275", "0.54833597", "0.5463412", "0.545951", "0.5410135", "0.5400235", "0.5397044", "0.5397044", "0.53723836", "0.53712004", "0.53383625", "0.53378147", "0.53245175", "0.5313688", "0.5293...
0.87042135
0
Set the log level for this client's console output.
def set_log_level_console( self, value: t.Union[str, int] = LOG_LEVEL_CONSOLE, ) -> None: if isinstance(self.ARGS_HANDLER_CON, dict): self.ARGS_HANDLER_CON["level"] = logs.str_level(value) if self.HANDLER_CON: logs.set_log_level(obj=self.HANDLER_CON, level=val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n level = logging.DEBUG\n if level == 'error':\n level = logging.ERROR\n self._log.setLevel(level)", "def level(self, log_level):\n self.logger.s...
[ "0.7317818", "0.7246532", "0.7224944", "0.71976995", "0.715652", "0.7134887", "0.7111482", "0.7060585", "0.700732", "0.69953936", "0.6890429", "0.68614644", "0.6856318", "0.68364364", "0.67952967", "0.6767017", "0.6750857", "0.67237127", "0.671836", "0.658383", "0.6583767", ...
0.7291099
1
Set the log level for this client's file output.
def set_log_level_file(self, value: t.Union[str, int] = LOG_LEVEL_FILE) -> None: if isinstance(self.ARGS_HANDLER_FILE, dict): self.ARGS_HANDLER_FILE["level"] = logs.str_level(value) if self.HANDLER_FILE: logs.set_log_level(obj=self.HANDLER_FILE, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log(self, level=logging.INFO, file=\"\"):\n\n self._logging_level = level\n\n if file:\n self._log_file = file", "def setLogLevel(self,value):\n self.PDFreactorConfiguration.in1[\"logLevel\"] = value", "def set_loglevel(self, loglevel=logging.DEBUG):\n self._logge...
[ "0.7567276", "0.7186663", "0.69810635", "0.6873454", "0.6872623", "0.6866347", "0.6775976", "0.673851", "0.66855156", "0.6684229", "0.66636443", "0.6651963", "0.65893966", "0.65424436", "0.63576317", "0.63309294", "0.6328965", "0.63226485", "0.6307529", "0.62971115", "0.62519...
0.7267733
1
Set the log level for this client's api objects.
def set_log_level_api(self, value: t.Union[str, int] = LOG_LEVEL_API) -> None: self.API_LOG_LEVEL: str = logs.str_level(value) for obj in self.API_CACHE.values(): if isinstance(obj, api.ModelMixins): logs.set_log_level(obj=obj.LOG, level=self.API_LOG_LEVEL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n level = logging.DEBUG\n if level == 'error':\n level = logging.ERROR\n self._log.setLev...
[ "0.7018329", "0.69324386", "0.68981826", "0.6809772", "0.6756352", "0.67073035", "0.65988535", "0.6485142", "0.6482158", "0.64750326", "0.64733326", "0.6448323", "0.64314735", "0.6364664", "0.63555914", "0.62614816", "0.6248847", "0.6236759", "0.6236413", "0.6191833", "0.6154...
0.76888084
0
Set the log level for this client.
def set_log_level_connect(self, value: t.Union[str, int] = "debug") -> None: if self.LOG: logs.set_log_level(obj=self.LOG, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level(self, log_level):\n self.logger.setLevel(log_level)", "def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n level = logging.DEBUG\n if level == 'error':\n level = logging.ERROR\n self._l...
[ "0.78398436", "0.7809668", "0.7766019", "0.7668132", "0.7589104", "0.7537596", "0.74525845", "0.7424326", "0.7348185", "0.7269961", "0.7242892", "0.72419655", "0.7236507", "0.7098433", "0.70542294", "0.70506114", "0.7050412", "0.7040524", "0.6970202", "0.69349676", "0.6928322...
0.68059367
26
Set the log level for this client's http object.
def set_log_level_http(self, value: t.Union[str, int] = Http.LOG_LEVEL) -> None: if isinstance(self.HTTP, Http): logs.set_log_level(obj=self.HTTP.LOG, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_loglevel(self, loglevel=logging.DEBUG):\n self._loggerLevel = loglevel\n\n # set logging levels\n self._logger.setLevel(self._loggerLevel)\n self._logger_file_handler.setLevel(self._loggerLevel)\n self._logger_stream_handler.setLevel(self._loggerLevel)", "def set_log_le...
[ "0.70187664", "0.69832474", "0.6964545", "0.68905675", "0.6821331", "0.66715455", "0.66705346", "0.6621394", "0.65199566", "0.6502086", "0.64850664", "0.63804597", "0.63691986", "0.6352352", "0.6351242", "0.63417125", "0.63286376", "0.63241845", "0.6285955", "0.6283318", "0.6...
0.78385943
0
Set the log level for this client's auth objects.
def set_log_level_auth(self, value: t.Union[str, int] = LOG_LEVEL_AUTH) -> None: for obj in self.AUTH, self.AUTH_NULL: if isinstance(obj, AuthModel): logs.set_log_level(obj=obj.LOG, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level(self, log_level):\n self.logger.setLevel(log_level)", "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def set_log_level(self, level: str) -> None:\n self.logger.setLevel(self._logging.log_levels[level])\n self.err.setLevel(self._logging.log_levels[level])\n ...
[ "0.7144422", "0.71096617", "0.7096222", "0.70275515", "0.70096564", "0.6916756", "0.67616636", "0.6722413", "0.6709545", "0.66398126", "0.658436", "0.6579582", "0.6480546", "0.6475217", "0.64576316", "0.6422604", "0.6419675", "0.6408452", "0.6393067", "0.6346162", "0.632881",...
0.74358505
0
Set the log level for this client's package.
def set_log_level_package( self, value: t.Union[str, int] = LOG_LEVEL_PACKAGE, ) -> None: logs.set_log_level(obj=self.LOG_LOGGER, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def level(self, log_level):\n self.logger.setLevel(log_level)", "def set_level(self, level: str):\n self._logger.setLevel(getattr(logging, level))", "def set_log_level(self, level):\n if level == 'info':\n leve...
[ "0.7641955", "0.75701886", "0.7411116", "0.73930454", "0.733629", "0.7331972", "0.7296994", "0.7260108", "0.7142604", "0.7117622", "0.70883846", "0.69590694", "0.6944136", "0.6909345", "0.68982935", "0.6891534", "0.6848197", "0.68271655", "0.6815476", "0.6814544", "0.68140364...
0.7958153
0
Set the log level for this client's endpoints.
def set_log_level_endpoints(value: t.Union[str, int] = LOG_LEVEL_ENDPOINTS) -> None: from axonius_api_client.api.api_endpoint import ( LOGGER as LOGGER_ENDPOINT, ) logs.set_log_level(obj=LOGGER_ENDPOINT, level=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLevel(self, level):\n handlers = self.logger.handlers\n for handler in handlers:\n handler.setLevel(level)", "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if...
[ "0.6970138", "0.6784279", "0.6746737", "0.67449576", "0.66633886", "0.66076595", "0.65386885", "0.65098596", "0.65046346", "0.63627404", "0.636215", "0.6348286", "0.63429534", "0.6254157", "0.62403345", "0.6239079", "0.6232738", "0.6222551", "0.6124422", "0.61018413", "0.6060...
0.78522563
0
Get the number of days left until the SSL certificate expires.
def ssl_days_left(self) -> t.Optional[int]: value = None if isinstance(self.HTTP, Http): cert: t.Optional[cert_human.Cert] = self.HTTP.get_cert() if isinstance(cert, cert_human.Cert): value = tools.dt_days_ago(cert.not_valid_after, from_now=False) return v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl_valid_time_remaining(domainname):\n expires = ssl_expiry_date(domainname)\n return expires - datetime.datetime.utcnow().date()", "def ssl_valid_time_remaining(domainname):\n expires = ssl_expiry_date(domainname)\n return expires - datetime.datetime.utcnow().date()", "def ssl_valid_time_rema...
[ "0.7374371", "0.7374371", "0.72503936", "0.72468376", "0.7213501", "0.67759794", "0.6684371", "0.6671422", "0.6667981", "0.65986747", "0.6587299", "0.65009737", "0.64926064", "0.6491342", "0.6422436", "0.63511086", "0.6317951", "0.6272271", "0.6256316", "0.6231645", "0.618479...
0.816152
0
Initialize this object with the mesh in which the points are supposed to be generated. 'axis' should be 0, 1 or 2 depending on whether you want to mirror the generated point along the x, y or z axis.
def __init__(self, vtk_mesh, axis): if not isinstance(vtk_mesh, vtk.vtkPolyData): try: vtk_mesh = vtk_mesh.visual_representation.vtk_poly_data except AttributeError: raise if not vtk_mesh.GetPoints() or not vtk_mesh.GetPolys(): raise ValueError("input argument 'vtk_mesh' has n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mesh):\n self._mesh = mesh", "def __init__(self, mesh: Mesh):\n self.mesh = mesh\n self.f = [0]*len(mesh.delaunay.simplices)", "def __init__(self, axis=-1):\n self.axis = axis", "def __init__(self, mesh, V):\n super().__init__(mesh, V)\n self.sourc...
[ "0.6846195", "0.6288602", "0.6276825", "0.6071847", "0.60040265", "0.5991342", "0.59729433", "0.5845726", "0.5828688", "0.5808024", "0.57933277", "0.5789157", "0.57784635", "0.5698888", "0.56961036", "0.56961036", "0.56768084", "0.5675836", "0.5654066", "0.56448627", "0.56287...
0.71309936
0
Returns a set of all variable attributes in a template. This returns variable attribute names, not the toplevel variable names. Attributes are included if they belong to undeclared variables in the
def GetVariableAttributes(template_src, env=None): env = env or jinja2.Environment() abstract_syntax_tree = env.parse(template_src) node_visitor = _GetattrNodeVisitor() node_visitor.visit(abstract_syntax_tree) output = set() undeclared_variables = meta.find_undeclared_variables(abstract_syntax_tree) used...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(cls):\n for key in dir(cls):\n if key.startswith('var_'):\n yield key[4:]", "def variables(self):\n return {u for u in self if u.type == 'var'}", "def _get_var_attrs(var):\n\n generic_dict = {'instrument': '', 'valid_range': (-1e+35,1e+35),\n ...
[ "0.6763315", "0.6664784", "0.6261302", "0.6255669", "0.6148872", "0.6147505", "0.6137372", "0.60964197", "0.6089824", "0.6050387", "0.6043047", "0.60388696", "0.60388696", "0.60388696", "0.60286754", "0.6018427", "0.5991243", "0.59507036", "0.5930742", "0.59075505", "0.590754...
0.797745
0
Plot attention weights from wordlevel decoder to characterlevel decoder.
def plot_nested_attention_weights(aw, token_list=[], label_list_sub=[], save_path=None, figsize=(10, 4)): plt.clf() plt.figure(figsize=figsize) # Plot attention weights sns.heatmap(awmap='viridis', xticklabels=label_list_sub, yticklabels...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_attention(attn_dict, target_word, image):\n\n\tw_headmap = 5\n\th_headmap = w_headmap\n\n\tw_image = 1\n\tn_heads = 4\n\n\tt_length = w_headmap * n_heads + w_image\n\n\tw_ratio = ((t_length - w_image) / n_heads) / t_length\n\th_ratio = 0.7\n\n\tseaborn.set(font_scale=2.8)\n\n\tdraw_encoder_self_atten...
[ "0.68640035", "0.6540849", "0.626942", "0.6170195", "0.6043992", "0.5989947", "0.59744924", "0.5928654", "0.5898577", "0.5898577", "0.5893898", "0.58798087", "0.58535415", "0.57480985", "0.57214576", "0.5639947", "0.55988914", "0.55883217", "0.55531013", "0.5549879", "0.54922...
0.70652187
0
check whether both word number are in the same chunk
def same_chunk(self, wn1, wn2): if self.chunk_map[wn1] == self.chunk_map[wn2]: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word_distance(word1: str, word2: str) -> bool:\n\n letters_different = 0\n for x, y in zip(word1, word2):\n if x != y:\n letters_different += 1\n if letters_different > 1:\n return False\n\n return True", "def checkPermutation(string1, string2):\n ...
[ "0.65811664", "0.6526033", "0.64589506", "0.6452941", "0.63516617", "0.63353676", "0.63211596", "0.6244283", "0.62417436", "0.62391704", "0.6230359", "0.6150306", "0.612734", "0.6103871", "0.6084791", "0.6082693", "0.60738516", "0.6055954", "0.6036147", "0.6036147", "0.602428...
0.7175171
0
Gets a configuration value.
def get_value(key:str): value = environ.get(key) if value == None or len(str(value)) == 0: raise ValueError('Missing env: '+key) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def _get_config_value(self, section, key):\n return config.get(section, key)", "def get_value(self, key):\n if key not in self._config:\n raise ValueError(\"%s ...
[ "0.8093911", "0.7880288", "0.7849273", "0.78130317", "0.7598823", "0.75980926", "0.74018896", "0.73694825", "0.7297921", "0.72871184", "0.7270116", "0.72638726", "0.71853787", "0.71588224", "0.7156604", "0.71385837", "0.7133483", "0.71117854", "0.7098566", "0.7093364", "0.707...
0.0
-1
The readonly state of the new transactions started on the connection.
def read_only(self) -> Optional[bool]: return self._read_only
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_open_transactions(self):\n return self.__open_transactions[:]", "def enter_transaction():\n _state.transactions = get_transactions() + 1", "def transactions(self):\r\n return tx.Transactions(self)", "def start_transaction(self): # type: ignore[no-untyped-def]\n return self._d...
[ "0.63947886", "0.6389561", "0.6275447", "0.61791474", "0.61553895", "0.61553895", "0.61499816", "0.61302966", "0.6117075", "0.6101664", "0.60908467", "0.6090756", "0.60814446", "0.60690325", "0.60690325", "0.60690325", "0.60458505", "0.60458505", "0.60458505", "0.60458505", "...
0.0
-1
Close the database connection.
def close(self) -> None: if self.closed: return self._closed = True self.pgconn.finish()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_connection(cls):\n db.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def close(self):\n if...
[ "0.8823254", "0.8553475", "0.8422749", "0.8399332", "0.838896", "0.82840264", "0.81800705", "0.81762004", "0.81495583", "0.798094", "0.798094", "0.798094", "0.7980928", "0.7978066", "0.7977289", "0.79737633", "0.7938943", "0.7933802", "0.79221076", "0.79041046", "0.78885204",...
0.0
-1
Interval assuming gaussian posterior.
def mean_interval(self, name, alpha=_alpha, **kwargs): data = self.get(name,**kwargs) return ugali.utils.stats.mean_interval(data,alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grd_posterior_gaussian(self, ) -> Tuple[np.ndarray, np.ndarray]:\n xmin, xmax = self.x_range\n ymin, ymax = self.y_range\n\n mu = np.array([0, 0])\n sigma = np.zeros((2, 2))\n\n _sample = self._sample\n _prior = self.prior\n\n def mean_x(x: float, y: float):\n ...
[ "0.6723144", "0.6338444", "0.6203812", "0.6128702", "0.6118113", "0.60984814", "0.5971382", "0.59434754", "0.5933151", "0.59130377", "0.5886216", "0.58651847", "0.58315235", "0.5779581", "0.57700604", "0.57651645", "0.57390493", "0.57134604", "0.5705321", "0.567228", "0.56603...
0.0
-1
drop the schema repo
def drop_schema(self): connRepo = self.connect(self.cxRepo) sql = f"""drop schema if exists {self.schemaRepo} cascade""" with connRepo: with connRepo.cursor() as curs: curs.execute(sql)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown_schema(self):\n models.Base.metadata.drop_all(self.session.bind)", "def drop_schema(self, schema):\n sql = f'set role {self.write_role}; ' \\\n + f'DROP SCHEMA IF EXISTS {schema};'\n return sql", "def drop():\n if prompt_bool(\"Are you sure you want to lose all...
[ "0.7428918", "0.7175731", "0.71128386", "0.7089602", "0.7058645", "0.69070524", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6885146", "0.6879206", "0.6879118", "0.686319", "0.6829718", "0.6754396", "0.6749702", ...
0.8285261
0
Plots flux from curvilinear detector.
def plot_radial(data, name, fig, piH=1): det = data.detectors[name] r = np.array([line[0] for line in det.grids['R']]) vdetector = np.roll(r, -1)**2-r**2 vdetector[-1] = det.grids['R'][-1][1]**2 - det.grids['R'][-1][0]**2 vdetector *= piH/2 val = det.tallies val = val/vdetector G = len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualizeObs():\n fcontourf(fObs, [-2, 2], [-1, 1], [0, 10])", "def plot(self, fig=None, ax=None):\n\n self._plot_setup(fig, ax)\n\n if self.stokes == 'v':\n self.cmap = plt.cm.coolwarm\n\n absmax = max(self.data.max(), self.data.min(), key=abs)\n rms = np.sqrt(np.me...
[ "0.653858", "0.65271705", "0.6144276", "0.60780406", "0.6070361", "0.60107523", "0.5992259", "0.5951744", "0.5883708", "0.5880851", "0.5850221", "0.57902396", "0.5697216", "0.5694458", "0.5690815", "0.56870484", "0.5668371", "0.5658697", "0.56381637", "0.56210256", "0.5618676...
0.0
-1
Log information with given level.
def log(self, msg, level='INFO'): if level == Logger.DEBUG: self.__logger.debug(msg) elif level == Logger.INFO: self.__logger.info(msg) elif level == Logger.WARN: self.__logger.warning(msg) elif level == Logger.ERROR: self.__logger.error(ms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __log(level, message):\n if level == 1:\n logging.info(\" \" + str(datetime.datetime.now()) + \" \" + message)\n if level == 2:\n logging.error(\" \" + str(datetime.datetime.now()) + \" \" + message)\n if level == 3:\n logging.critical(\" \" + str(datetime.datetime.now()) + \" \" ...
[ "0.78113174", "0.7424989", "0.7410517", "0.7324955", "0.73191756", "0.7277051", "0.72350293", "0.70979047", "0.70909584", "0.70517755", "0.7051295", "0.70455617", "0.7030493", "0.70273834", "0.69897604", "0.6974052", "0.6972972", "0.69587034", "0.6923443", "0.69118255", "0.69...
0.7319363
4
Return the maximum value near a given wavelength; also the local continuum level.
def get_peak_cont(hdulist, wavelength, search): data = hdulist[0].data header = hdulist[0].header wavelength_location = get_wavelength_location(header, wavelength) peak_location = find_line_peak(data, wavelength_location, search) peak = data[peak_location] cont = get_continuum(peak_location, dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lmax(self):\n cond = (self.transmit / self.transmit.max()) > 1./100\n return max(self.wavelength[cond])", "def __get_max_peak(x_value, raw_values):\n\n\n raw_values_index = raw_values[raw_values[\"m/z\"] == x_value].index[0]\n\n value, index = float(raw_values.loc[raw_values_index - 5, \"...
[ "0.6930999", "0.67248696", "0.62238395", "0.6199048", "0.6186528", "0.61756396", "0.6165719", "0.6163217", "0.61483973", "0.614795", "0.6140631", "0.6123139", "0.6122978", "0.61148643", "0.6104502", "0.6082121", "0.6071215", "0.6032786", "0.60127944", "0.59880733", "0.5980454...
0.5520354
90
Verify api key set in constructor
def __enter__(self): # if the user account is not activated then no go if not self.user.activated: raise HTTPForbidden('Deactivated Account') if not AuthHelper.check_api(self.check_key, self.user.api_key): raise HTTPForbidden('Invalid Authorization')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, api_key):\r\n self.api_key = api_key", "def __init__(self, api_key: str):\n self.api_key = api_key", "def __init__(self, api_key=None):\n self.api_key = api_key", "def __init__(self, api_key='YOUR_API_KEY'):\n self.api_key = api_key", "def __init__(self, key=N...
[ "0.801202", "0.7966922", "0.78836507", "0.7790473", "0.77882993", "0.76791227", "0.75237316", "0.7501553", "0.736055", "0.72949636", "0.727813", "0.7275507", "0.7209936", "0.7200999", "0.7185989", "0.71332407", "0.7067683", "0.7035365", "0.70080453", "0.69818354", "0.6970327"...
0.0
-1
Verify api key set in constructor
def __enter__(self): if not AuthHelper.check_login(self.request, self.username): raise HTTPForbidden('Invalid Authorization')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, api_key):\r\n self.api_key = api_key", "def __init__(self, api_key: str):\n self.api_key = api_key", "def __init__(self, api_key=None):\n self.api_key = api_key", "def __init__(self, api_key='YOUR_API_KEY'):\n self.api_key = api_key", "def __init__(self, key=N...
[ "0.801202", "0.7966922", "0.78836507", "0.7790473", "0.77882993", "0.76791227", "0.75237316", "0.7501553", "0.736055", "0.72949636", "0.727813", "0.7275507", "0.7209936", "0.7200999", "0.7185989", "0.71332407", "0.7067683", "0.7035365", "0.70080453", "0.69818354", "0.6970327"...
0.0
-1
Note that a user has exported their bookmarks
def export(for_user, current_user): get_status = lambda x: Log.WARNING if x else Log.INFO your_export = False if current_user and current_user == for_user: your_export = True elif current_user is None: current_user = "None" status = get_status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __addBookmarked(self):\n an = self.getActiveName()\n if an is not None and an not in self.bookmarked:\n self.bookmarked.append(an)", "def __showBookmarkMenu(self):\n bookmarksFound = 0\n filenames = self.getOpenFilenames()\n for filename in filenames:\n ...
[ "0.64746654", "0.62598836", "0.6136975", "0.6112221", "0.60539156", "0.59048915", "0.5872273", "0.5794399", "0.5791337", "0.57692957", "0.57588696", "0.57497853", "0.5743809", "0.5718467", "0.5673107", "0.56333095", "0.5630633", "0.56262386", "0.55483806", "0.5513604", "0.550...
0.69976723
0
Create a new activation
def __init__(self, created_system): self.code = Activation._gen_activation_hash() self.created_by = created_system self.valid_until = datetime.utcnow() + ACTIVATION_AGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.activation = Activation(u'signup')\r\n self.activated = False", "def generate_activation(act_par):\n\n if type(act_par) == list:\n if len(act_par) == 2:\n atype, par = act_par\n if atype == 'elu':\n return ELU(alpha=par)\n ...
[ "0.70946974", "0.6788832", "0.6641264", "0.6427444", "0.6369652", "0.6351276", "0.6270455", "0.6264622", "0.62599975", "0.61813074", "0.61672974", "0.6165589", "0.61645174", "0.6123049", "0.6055434", "0.60029244", "0.5998134", "0.59851533", "0.5965238", "0.5908239", "0.587433...
0.5803372
26
Generate a random activation hash for this user account
def _gen_activation_hash(): # for now just cheat and generate an api key, that'll work for now return User.gen_api_key()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hash(self):\n return os.urandom(32).encode('hex')", "def generate_activation_token(username):\n salt = hashlib.sha1(str(random.random()).encode('utf-8')).hexdigest()[:5]\n encoded_string = salt + username\n token = hashlib.sha1(encoded_string.encode('utf-8')).hexdigest()\n try:\n ...
[ "0.725804", "0.71615696", "0.6894295", "0.68171316", "0.6700406", "0.65015423", "0.6432743", "0.6424827", "0.63368046", "0.6330398", "0.6319952", "0.63199455", "0.631472", "0.6310597", "0.6281988", "0.6277274", "0.62694436", "0.6256704", "0.62348896", "0.62034327", "0.6167505...
0.81525487
0
Verify that the password is acceptable Basically not empty, has more than 3 chars...
def acceptable_password(password): LOG.debug("PASS") LOG.debug(password) if password is not None: LOG.debug(len(password)) if password is None: return False if len(password) < 3: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_pass(password):\r\n if len(password) >= 8 and len(password) <= 25 and password != \"forgot\":\r\n return True\r\n\r\n else:\r\n print(\"This is not a vaid password\")\r\n print(\"Password should be between 8 and 25 letters\")\r\n\r\n return False", "def validate_passwo...
[ "0.8027525", "0.79460615", "0.79388845", "0.7818809", "0.7798877", "0.7795867", "0.7791895", "0.7779259", "0.77747995", "0.7757279", "0.7748918", "0.7747629", "0.77397156", "0.7712654", "0.7707802", "0.76564646", "0.7640219", "0.7570458", "0.75463706", "0.7542401", "0.7525617...
0.843343
0
Hash password on the fly.
def _set_password(self, password): hashed_password = password if isinstance(password, unicode): password_8bit = password.encode('UTF-8') else: password_8bit = password # Hash a password for the first time, with a randomly-generated salt salt = b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(self, password):\n self.password_hash = generate_password_hash(password)", "def hash_password(self):\n self.__password = self.str_to_hash(self.__password)", "def hash_password(self, password):\n self.password = pwd_context.encrypt(password)", "def hash_passwd(password, ...
[ "0.8297696", "0.8283136", "0.82334286", "0.81123114", "0.7999423", "0.7890198", "0.7885831", "0.78848606", "0.77578676", "0.7733201", "0.771621", "0.7690652", "0.7680754", "0.7642587", "0.7574327", "0.7567942", "0.75485516", "0.7534737", "0.7526732", "0.75134426", "0.74824774...
0.0
-1
Does the user have any invitations left
def has_invites(self): return self.invite_ct > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_invincible(self):\n\t\treturn self._invincible", "def has_invited_to_poll(self, poll_id):\n\n has_invited_to_poll = False\n invited_poll = PollUser.objects.filter(user=self, poll=Poll(poll_id))\n\n if len(invited_poll) >= 1:\n has_invited_to_poll = True\n else:\n has_invited_to_p...
[ "0.6759341", "0.674537", "0.66661197", "0.66074467", "0.66074467", "0.6508884", "0.64351714", "0.6348357", "0.6320074", "0.6319612", "0.6209567", "0.62074584", "0.6198943", "0.61746484", "0.61184454", "0.6092542", "0.6070288", "0.6070288", "0.5939317", "0.5912993", "0.5909024...
0.81022036
0
How deep is the queue at the moment
def size(): qry = ImportQueue.query.filter(or_( ImportQueue.status != COMPLETE, ImportQueue.status != ERROR)) return qry.count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curr_queue(self):\n pass", "def show_queue(Q):\n print(\"(Size of the queue:\", Q.qsize(), \")\", end=\" \")\n for n in list(Q.queue):\n print(n, end=\" \")\n print()", "def test_the_queue_size(the_queue):\n the_queue.enqueue(1)\n the_queue.enqueue(2)\n the_queue.enqueue(3)\...
[ "0.65826154", "0.6264838", "0.61748004", "0.6143073", "0.6083699", "0.6080623", "0.5984726", "0.5984726", "0.5978362", "0.5909926", "0.5905296", "0.5904336", "0.58685106", "0.58513933", "0.58513933", "0.58513933", "0.58513933", "0.5846355", "0.5837541", "0.58237517", "0.58233...
0.0
-1
Generates a random string from urandom.
def random_string(length=None): chars = string.ascii_uppercase + string.digits str_length = length if length is not None else random_int() return unicode(u''.join(random.choice(chars) for x in range(str_length)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def get_random_str(len):\n return base64.urlsafe_b64encode(os.urandom(len))[0:len]", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def generate_random_string():\n return \"\".join(ra...
[ "0.81918633", "0.77840203", "0.75190336", "0.7462854", "0.7417727", "0.7277282", "0.72276753", "0.72242945", "0.70818174", "0.70335346", "0.7021029", "0.7007555", "0.69763917", "0.6966098", "0.6949514", "0.6949514", "0.6908086", "0.6907423", "0.6904722", "0.68815714", "0.6820...
0.7024683
10
Test we can set the invite count for the user
def test_set_invite_ct(self): # for now just make sure we can get a 200 call on it. params = { 'api_key': self.api_key } res = self.testapp.post('/api/v1/a/accounts/invites/admin/10', params=params, status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invite_ct(self):\r\n # for now just make sure we can get a 200 call on it.\r\n params = {\r\n 'api_key': self.api_key\r\n }\r\n res = self.testapp.get('/api/v1/a/accounts/invites',\r\n params=params,\r\n sta...
[ "0.7608187", "0.6800737", "0.66166955", "0.64456946", "0.6422321", "0.6379684", "0.6353169", "0.6271311", "0.62055916", "0.61357594", "0.61084896", "0.60806197", "0.60660267", "0.60454017", "0.5946261", "0.594614", "0.5939949", "0.5934468", "0.59170854", "0.59147316", "0.5899...
0.7659417
0
Test that we can hit the api and get the list of users.
def test_user_list(self): self._add_demo_import() params = { 'api_key': self.api_key } res = self.testapp.get('/api/v1/a/users/list', params=params, status=200) # we should get back dict of count,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_can_get_all_users(self):\n response = self.client().get('/api/v1/user/')\n self.assertTrue(response.status_code, 200)", "def test_fetch_all_user(self):\n\n payload = self.get_req('api/v1/users')\n self.assertEqual(payload.status_code, 200)\n self.assertEqual(payloa...
[ "0.8837316", "0.85251606", "0.8383559", "0.8309518", "0.8259985", "0.8137213", "0.80719006", "0.8071022", "0.8056002", "0.8051482", "0.80380976", "0.80380976", "0.7987055", "0.79525125", "0.79251534", "0.7895928", "0.7895363", "0.7892854", "0.7882907", "0.78788203", "0.781537...
0.83882266
2
Test getting a user's bookmark count when start_date is the first day of the month
def test_start_of_month(self): test_dates = self._setup_user_bookmark_count() res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount', params={u'api_key': API_KEY, u'start_date': u'2013-11-1'}, sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_start_end_defined(self):\r\n test_dates = self._setup_user_bookmark_count()\r\n res = self.testapp.get(u'/api/v1/admin/stats/bmarkcount',\r\n params={u'api_key': API_KEY,\r\n u'end_date': u'2013-12-29'},\r\n ...
[ "0.723588", "0.7182594", "0.70669115", "0.6876183", "0.6786869", "0.65058416", "0.6411001", "0.5640781", "0.56260633", "0.5471509", "0.5462111", "0.5435627", "0.5410272", "0.5376589", "0.5290892", "0.5249518", "0.5218119", "0.5192954", "0.5142267", "0.509371", "0.5083504", ...
0.79181725
0
If no API_KEY is present, it is unauthorized request
def user_bookmark_count_authorization(self): self.testapp.get(u'/api/v1/admin/stats/bmarkcount', status=403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_api_key(x_api_key: str = Security(api_key_header_auth)):\n\n if x_api_key != API_KEY:\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n detail=\"Invalid API Key\",\n )", "def test_incorrect_api_key(self):\n with self.subTest(\"Missing API...
[ "0.7512446", "0.71513677", "0.7066473", "0.6719931", "0.6651098", "0.6565355", "0.6536003", "0.64923275", "0.64923275", "0.6470506", "0.64362836", "0.64094704", "0.6408586", "0.6373597", "0.6349021", "0.63389117", "0.6329039", "0.63175744", "0.6306474", "0.6300578", "0.629499...
0.0
-1
Test getting a user's account information
def test_account_information(self): res = self.testapp.get(u'/api/v1/admin/account?api_key=' + API_KEY, status=200) # make sure we can decode the body user = json.loads(res.body) self.assertEqual( user['username'], 'admin', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_retrieve(self):\n self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.get_token())\n response = self.client.get(reverse(\"account:user-profile\"))\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n self.assertEqual(response.data.get('user').get('email'),...
[ "0.7898494", "0.7712678", "0.76938325", "0.7657421", "0.7627328", "0.7570366", "0.7561234", "0.75491786", "0.75209016", "0.7462751", "0.7377925", "0.73224294", "0.7298772", "0.72874874", "0.72624475", "0.72172105", "0.71948797", "0.71050453", "0.7077029", "0.7077019", "0.7045...
0.798841
0
Reset User's api key
def test_account_reset_apikey(self): # Create a fake user test_user = factory.make_user(username='test_user') # Set and Get the current api key # make_user doesn't set the api key of user so set it explicitly current_apikey = test_user.api_key = "random_key" test_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_api_key(request):\r\n user = request.user\r\n # Generate new api key and assign it to user's api key\r\n user.api_key = User.gen_api_key()\r\n return _api_response(request, {\r\n 'api_key': user.api_key,\r\n 'message': 'Api Key was successfully changed',\r\n })", "def reset...
[ "0.87136835", "0.8589262", "0.80824155", "0.73575616", "0.73120266", "0.7153743", "0.6882455", "0.67387056", "0.6668595", "0.65747714", "0.65396184", "0.6533261", "0.6533261", "0.6484351", "0.64802265", "0.63981545", "0.63794404", "0.62901545", "0.62392884", "0.6194224", "0.6...
0.7661354
3
clear out all the testing DB data
def tearDown(self): empty_db()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n testing.tearDown()\r\n empty_db()", "def tearDown(self):\r\n testing.tearDown()\r\n empty_db()", "def tearDown(self):\r\n testing.tearDown()\r\n empty_db()", "def tearDown(self):\r\n testing.tearDown()\r\n empty_db()", "def tea...
[ "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8544528", "0.8475647", "0.82678235", "0.82678235", "0.8251746", "0.81190884", "0.8023434", "0.8008456", "0.79353", "0.79253083", "0.7918123", "0.7884794", "0.7869651", ...
0.86394465
0
Properly error on an unparseable url.
def test_parse_malformed_url(self): url = u'http://whttp://lucumr.pocoo.org/2012/8/5/stateless-and-proud/' read = readable.ReadUrl.parse(url) self.assertEqual(read.status, 901)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_bad_url(self):\n self._error(400, \"Bad Request\")", "def _validate_url(url):\n if urlparse.urlparse(url).scheme not in VALID_SCHEMES:\n _fail(url, \"Invalid URL\")", "def url_error():\n try:\n from urllib.error import URLError\n except ImportError:\n from urllib2...
[ "0.7351578", "0.72573334", "0.72208107", "0.715448", "0.71484196", "0.7100525", "0.70864093", "0.706175", "0.7036573", "0.7009583", "0.6972679", "0.696795", "0.6924453", "0.6884707", "0.6844923", "0.68434894", "0.6824983", "0.6655338", "0.66199607", "0.66186446", "0.65193313"...
0.761295
0
Set the number of invites a user has available.
def accounts_invites_add(request): rdict = request.matchdict username = rdict.get('username', None) if username: username = username.lower() count = rdict.get('count', None) if username is not None and count is not None: user = UserMgr.get(username=username) if us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_count(self, user_count):\n\n self._user_count = user_count", "def user_count(self, user_count):\n\n self._user_count = user_count", "def set_number_of_sentences(self):\n self.number_of_sentences = int(self.num_sentences.get())", "def test_set_invite_ct(self):\r\n # for no...
[ "0.6230518", "0.6230518", "0.6028947", "0.6017563", "0.59394825", "0.59065425", "0.58722883", "0.58458465", "0.5643595", "0.56175905", "0.55492735", "0.5543944", "0.5542238", "0.54863745", "0.54644036", "0.5451856", "0.5412409", "0.54078764", "0.53840846", "0.5378958", "0.537...
0.6109802
2
Display a custom 404 page when the HTTPNotFound fired
def resource_not_found(exc, request): request.response_status = "404 Not Found" return {'message': str(exc)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_not_found(e):\n return render_template(\"404.html\"), 404", "def page_not_found(e):\n return render_template('404.html'), 404", "def page_not_found(e):\n return render_template('404.html'), 404", "def page_not_found(e):\n\n return render_template('404.html'), 404", "def not_found(e):\n...
[ "0.84662336", "0.84641427", "0.84641427", "0.84147197", "0.84031504", "0.8401291", "0.8361121", "0.83290833", "0.8326735", "0.83161306", "0.83080614", "0.8293001", "0.8271358", "0.8220069", "0.8184209", "0.817906", "0.817906", "0.817906", "0.817906", "0.817906", "0.817906", ...
0.8105298
34
return true if the character is a letter, digit, underscore, dollar sign, or nonASCII character.
def isAlphanum(c): return ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or (c >= 'A' and c <= 'Z') or c == '_' or c == '$' or c == '\\' or (c is not None and ord(c) > 126));
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __valid_char(self, char: str) -> bool:\r\n if char.isdigit():\r\n raise ValueError('Characters can\\'t be numbers')\r\n\r\n return char.isalpha() or char.isspace()", "def is_allowed_char(ch):\n\treturn ch.isalnum() or ch in \"#.>+*:$-_!@\"", "def is_valid_char(src):\n\n return s...
[ "0.78336596", "0.7726883", "0.75429755", "0.72106546", "0.7169826", "0.7107826", "0.70925313", "0.7032445", "0.699354", "0.69532526", "0.69446826", "0.6934456", "0.68897206", "0.6866034", "0.6865833", "0.68560296", "0.6853215", "0.68439865", "0.6806619", "0.67916507", "0.6784...
0.79479194
0
Init method based on N(0, sigma).
def init_method_normal(sigma): def init_(tensor): return torch.nn.init.normal_(tensor, mean=0.0, std=sigma) return init_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, sigma=0.0001):\n self.sigma = sigma", "def __init__(self, sigma):\n self.sigma = float(sigma)\n super().__init__(domain=functional.domain,\n range=functional.domain, linear=False)\n\n # Setting up parameters\n ...
[ "0.7587747", "0.7377149", "0.7034432", "0.69798046", "0.69374764", "0.6787513", "0.6787513", "0.66484886", "0.6601178", "0.6529468", "0.6524285", "0.65146327", "0.6509698", "0.64890236", "0.64574766", "0.6441963", "0.64405966", "0.6425482", "0.64194316", "0.6378599", "0.63413...
0.6749473
8
Simple linear layer with weight initialization.
def get_linear_layer(rows, columns, init_method): layer = torch.nn.Linear(rows, columns) init_method(layer.weight) with torch.no_grad(): layer.bias.zero_() return layer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_layer(self, W, b, x, use_relu=True):\n\n if use_relu is True:\n return np.maximum(W @ x + b, 0)\n return W @ x + b", "def init_layer(layer):\n \n if layer.weight.ndimension() == 4:\n (n_out, n_in, height, width) = layer.weight.size()\n n = n_in * height * wid...
[ "0.6994702", "0.68868995", "0.682761", "0.6820912", "0.67597985", "0.6742202", "0.6725242", "0.67205775", "0.6697782", "0.6661064", "0.66333073", "0.66202044", "0.65676683", "0.6556666", "0.64622575", "0.6460984", "0.64281887", "0.6420554", "0.6380955", "0.6380955", "0.637893...
0.67957014
4
Divide params into withweightdecay and withoutweightdecay groups. Layernorms and biases will have no weight decay but the rest will.
def get_params_for_weight_decay_optimization( model: Union[torch.nn.Module, List[torch.nn.Module]], ) -> Dict[str, torch.nn.Parameter]: modules = listify_model(model) weight_decay_params = {'params': []} no_weight_decay_params = {'params': [], 'weight_decay': 0.0} for module in modules: for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_weights(net):\n\n decay = [p for name, p in net.named_parameters() if ('bias' not in name and 'bn' not in name)]\n no_decay = [p for name, p in net.named_parameters() if ('bias' in name or 'bn' in name)]\n\n assert len(list(net.parameters())) == len(decay) + len(no_decay)\n return [dict(param...
[ "0.75072235", "0.7119427", "0.7034717", "0.6654485", "0.6641055", "0.6374985", "0.6313265", "0.6222679", "0.61934745", "0.6116462", "0.61039656", "0.6014104", "0.597081", "0.5962828", "0.5953511", "0.59434265", "0.59434265", "0.59434265", "0.59434265", "0.59434265", "0.594057...
0.623395
7
Use all params for weight decay.
def get_all_params_for_weight_decay_optimization( model: Union[torch.nn.Module, List[torch.nn.Module]], ) -> Tuple[Dict[str, List[torch.nn.Parameter]]]: modules = listify_model(model) weight_decay_params = [ p for module in modules for module_ in module.modules() for p in module_._parameters.values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weights_decay(self):\n for param_group in self.optimizer.param_groups:\n for param in param_group['params']:\n param.data = param.data.add(-1.*self.weights_decay * param_group['lr'], param.data)", "def setWeights(self, decay):\n for i in range(15):\n self.mo...
[ "0.74099517", "0.710918", "0.705239", "0.69835836", "0.696269", "0.6937486", "0.685764", "0.68451077", "0.68308866", "0.6686286", "0.6681478", "0.66543263", "0.6596148", "0.6581204", "0.6578639", "0.6568041", "0.65622747", "0.6556179", "0.65558773", "0.65547764", "0.65547764"...
0.0
-1