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
Returns True if the TopoDS_Shape is a plane, False otherwise
def face_is_plane(self, face)->bool: hs = BRep_Tool_Surface(face) downcast_result = Geom_Plane.DownCast(hs) # The handle is null if downcast failed or is not possible, that is to say the face is not a plane if downcast_result is None: return False else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInPlane(self, p) -> bool:\n # Testing for zero is done with math.isclose, to avoid rounding/floating point errors.\n # Since we are testing near zero, abs_tol is set to 1e-09\n return math.isclose(\n math.fabs(\n dot(\n self.normal(),\n ...
[ "0.6673549", "0.63927823", "0.62181467", "0.6199269", "0.6167005", "0.6167005", "0.6121284", "0.6062569", "0.6028104", "0.59673315", "0.5965822", "0.5928757", "0.58391124", "0.5838654", "0.5828592", "0.5811405", "0.57826513", "0.57668734", "0.57552457", "0.575522", "0.5739372...
0.73682
0
Retrieves the list of all State objects
def get_states(): all_states = [] states = storage.all(State).values() for state in states: all_states.append(state.to_dict()) return jsonify(all_states)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_states(self):\n return self._states", "def all_states():\n dict = storage.all(State)\n list = []\n for state in dict.values():\n list.append(state.to_dict())\n return jsonify(list)", "def all_states():\n states = []\n states_values = storage.all(\"State\").values()\n...
[ "0.8137676", "0.8114916", "0.81053764", "0.80541945", "0.79778695", "0.7974168", "0.78558934", "0.77833647", "0.77445245", "0.7663341", "0.765244", "0.7569619", "0.7534709", "0.7502574", "0.74869597", "0.7467144", "0.7464845", "0.732207", "0.7299296", "0.7243289", "0.72340447...
0.79698193
6
Returns initial states of the process.
def initial_action(self): exclude = {a.action for a in self.filter(include={Subprocess})} acts = {a for a in self.behaviour() if not a.my_operator and isinstance(a, Operator) and a not in exclude} assert len(self.behaviour()) > 0, "There is no any actions in the process" assert len(acts)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_states(self):\n return self._initial_states", "def get_initial_states(self):\n raise NotImplementedError()", "def initial_states(self):\n return list(self.iter_initial_states())", "def get_initial_state(self):\n # Clear the state buffer\n self.state_buffer = deq...
[ "0.75010616", "0.74809694", "0.7343089", "0.7237233", "0.69198066", "0.69141394", "0.6859916", "0.6852315", "0.68353754", "0.6804699", "0.6801225", "0.6799004", "0.6758631", "0.66935134", "0.6688838", "0.6688838", "0.66811585", "0.6671975", "0.6671975", "0.6671975", "0.667197...
0.0
-1
Provide a list of required actions for the given process name.
def required_actions(self, name: str): assert name in self._required_processes return self._required_actions.get(name, list())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_actions_requirement(self, name: str, actions: list, replace: bool = False):\n assert isinstance(actions, list)\n assert name in self._required_processes, f\"First add the process requirement for process '{name}'\"\n\n if replace:\n self._required_actions[name] = list(actions...
[ "0.6610253", "0.57943135", "0.57138795", "0.5658052", "0.55046546", "0.5481951", "0.5435069", "0.5433482", "0.5414147", "0.5410867", "0.5410867", "0.5410867", "0.5410867", "0.5392355", "0.53830427", "0.53800213", "0.53541404", "0.5349543", "0.5343522", "0.5327852", "0.532656"...
0.80594575
0
Writes the json dictonary that was created in the write_to_json fuction to a local file
def json_writer(): with open("{}.json".format(sys.argv[3]), "w+") as new_json: print("uploading the jason file... ") json.dump(json_file, new_json) print("file is done")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json(dict_to_write, path, file_name):\n with open(path + \"/\" + file_name + \".json\", \"w\") as fp:\n json.dump(dict_to_write, fp)\n return None", "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepa...
[ "0.81379306", "0.8130502", "0.79316777", "0.79316777", "0.78626174", "0.7846189", "0.78307605", "0.77732015", "0.7764395", "0.77622527", "0.7752725", "0.7732294", "0.77050304", "0.7699383", "0.76979285", "0.7672293", "0.76576483", "0.7654473", "0.7651128", "0.76384205", "0.76...
0.7558078
27
Build the API URL
def format_url(endpoint, cmd): url = base_url + endpoint + cmd + '&key=' + bart_api_key + json return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_api_url(project, method, base_url):\n return API_URL_TEMPLATE.format(\n api_base=base_url, api_version=API_VERSION, project=project, method=method\n )", "def _url_builder(url_root,api_key,path,params):\n params['api_key'] = api_key\n url_end = urlencode(params)\n url = \"%s%s%s\" ...
[ "0.81776506", "0.79765564", "0.7909084", "0.7902459", "0.7694071", "0.76515394", "0.763372", "0.763372", "0.7626016", "0.7555623", "0.75127226", "0.7461599", "0.742999", "0.74122816", "0.7377286", "0.7353061", "0.7327291", "0.72819346", "0.72291374", "0.7191764", "0.7156899",...
0.672533
45
Standard 3D cross product. Order matters, this assumes u cross v.
def outer_product(u: Vector3D, v: Vector3D): cx = u.y * v.z - u.z * v.y cy = u.z * v.x - u.x * v.z cz = u.x * v.y - u.y * v.x return Vector3D(cx, cy, cz, coordinate_system='cartesian')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross(u,v):\n u1, u2, u3 = u\n v1, v2, v3 = v\n return np.array([u2*v3 - u3*v2,\n u3*v1 - u1*v3,\n u1*v2 - u2*v1], dtype=u.dtype)", "def cross(self):\n return self.v.cross(self.z_axis)", "def cross(self, v):\n if (len(self.m...
[ "0.79005086", "0.78392714", "0.78039724", "0.7604803", "0.743928", "0.72732306", "0.7239242", "0.7092726", "0.70573175", "0.70466286", "0.69773895", "0.69704795", "0.6959072", "0.6916926", "0.6829341", "0.6806417", "0.68049353", "0.6751643", "0.6739753", "0.6712903", "0.67048...
0.7238167
7
Return recipe detail url
def detail_url(recipe_id): return reverse('recipe:recipe-detail', args=[recipe_id])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_detail_URL(recipe_id):\n return reverse('recipeapp:recipe-detail', args=[recipe_id])", "def detail_url(recipe_id):\n return reverse('recipe:recipe-detail',args=[recipe_id])", "def recipe_detail_url(recipe_id):\n return reverse('recipes:recipe-detail', args=[recipe_id])", "def detail_url(reci...
[ "0.85382414", "0.8517591", "0.84859174", "0.8467316", "0.7961997", "0.7941735", "0.72007006", "0.6732607", "0.66192394", "0.6614689", "0.65652037", "0.6563333", "0.6547843", "0.6515772", "0.6505839", "0.65000546", "0.6446448", "0.64423203", "0.6431437", "0.64158046", "0.63895...
0.8516094
4
Test creating a recipe with associated ingredients
def test_create_recipe_with_ingredients(self): ingred1 = sample_ingredient(self.user) ingred2 = sample_ingredient(self.user, name='sugar') payload = { 'title': 'cake', 'time_minutes': 39, 'price': 39, 'ingredients': [ingred1.id, ingred2.id] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_recipe_with_ingredients(self):\n ingredient1 = sample_ingredients(user=self.user, name='Prawns')\n ingredient2 = sample_ingredients(user=self.user, name='Garlic')\n\n payload = {\n 'title': 'Avocado lime cheesecake',\n 'time_minutes': 20,\n 'p...
[ "0.87720627", "0.86203724", "0.8512963", "0.85001045", "0.84638023", "0.8406494", "0.8033842", "0.7983141", "0.79061425", "0.7819609", "0.77888405", "0.77425617", "0.7740994", "0.75921726", "0.75397384", "0.7530525", "0.74598104", "0.7414821", "0.74047846", "0.74041647", "0.7...
0.85609585
2
Test updating recipe with put method
def test_put_recipe(self): recipe = sample_recipe(self.user) recipe.tags.add(sample_tag(self.user)) payload = { 'title': 'Ham hack', 'time_minutes': 38, 'price': 33.00 } res = self.client.put(detail_url(recipe.id), payload) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_update_recipe(self):\n recipe = sample_recipe(user=self.user)\n recipe.tag.add(sample_tag(user=self.user))\n payload = {\n 'title':'chicken noodles',\n 'time_minutes':50,\n 'price':12.67,\n }\n url = detail_url(recipe.id)\n se...
[ "0.83096075", "0.818001", "0.8167228", "0.81422305", "0.7988825", "0.79096013", "0.7869864", "0.7859465", "0.7797221", "0.77879477", "0.77452356", "0.77233255", "0.76719016", "0.75228673", "0.751736", "0.7455102", "0.74486804", "0.7389293", "0.73390317", "0.73053706", "0.7264...
0.8216697
1
Test uploading an image to recipe
def test_upload_image(self): url = image_upload_url(self.recipe.id) with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf: img = Image.new('RGB', (10, 10)) img.save(ntf, format='JPEG') ntf.seek(0) # go back to begining of file_path res = self.client.post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_uploading_image_to_recipe(self):\n url = image_upload_url(self.recipe.id)\n with tempfile.NamedTemporaryFile(suffix='.jpg') as ntf:\n img = Image.new('RGB',(10,10))\n img.save(ntf,format='JPEG')\n ntf.seek(0)\n res = self.client.post(url, {'image':...
[ "0.86700606", "0.8635865", "0.8491053", "0.8485353", "0.78114253", "0.7783709", "0.77733296", "0.76543945", "0.7583468", "0.75644386", "0.74843514", "0.7406042", "0.733126", "0.73294336", "0.7199716", "0.71662664", "0.7152698", "0.70980304", "0.70972466", "0.6977602", "0.6969...
0.8499466
2
Test uploading an invalid image
def test_upload_image_bad(self): url = image_upload_url(self.recipe.id) res = self.client.post(url, {'image': 'notimage', format: 'multipart'}) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_bad_file(self):\n url = image_upload_url(self.reteta.id)\n res = self.client.post(url, {'image': 'notimage'}, format='multipart')\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)", "def test_upload_invalid_image_field(self):\n url = create_upload_image_...
[ "0.86194044", "0.8567676", "0.8430187", "0.8360368", "0.83143234", "0.83053386", "0.82901424", "0.82888144", "0.82306975", "0.81376487", "0.7897103", "0.75692457", "0.7536378", "0.74416286", "0.73935485", "0.7353074", "0.72465086", "0.7230261", "0.72119063", "0.72095186", "0....
0.8433633
2
Test returning recipes with specific ingredients
def test_filter_recipes_by_ingredients(self): recipe1 = sample_recipe(self.user, title='Waxy box') recipe2 = sample_recipe(self.user, title='Waxy noodle beans') ingredient1 = sample_ingredient(self.user, name='box') ingredient2 = sample_ingredient(self.user, name='Wet noodle') re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_recipes_by_ingredients(self):\n pass", "def test_get_recipe_ingredients_by_id(self):\n pass", "def test_creating_recipe_with_ingredients(self):\n ingredient1 = sample_ingredients(user=self.user, name='Prawns')\n ingredient2 = sample_ingredients(user=self.user, name='...
[ "0.8336177", "0.78261787", "0.77616054", "0.774864", "0.7600667", "0.75203025", "0.744761", "0.73577106", "0.7295739", "0.7280468", "0.72636646", "0.7255317", "0.71768695", "0.71739113", "0.7104669", "0.708287", "0.70755357", "0.7046724", "0.70242774", "0.69891816", "0.694636...
0.76189923
4
Convert class labels from scalars to onehot vectors.
def dense_to_one_hot(labels_dense, num_classes): num_labels = labels_dense.shape[0] index_offset = numpy.arange(num_labels) * num_classes labels_one_hot = numpy.zeros((num_labels, num_classes)) labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1 return labels_one_hot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)", "def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)", "def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:...
[ "0.8250402", "0.807683", "0.80523187", "0.7977843", "0.7908335", "0.7900327", "0.7892233", "0.7869711", "0.7849721", "0.7849721", "0.7826951", "0.7826122", "0.77677035", "0.7765413", "0.77489346", "0.7742955", "0.7737176", "0.77226317", "0.77123284", "0.7711196", "0.769438", ...
0.77540547
15
Draws empty board to canvas.
def init_board(self) -> None: self.canvas.create_rectangle(0, 0, self.canvas_width, self.canvas_height, fill=self.color_background) for x in range(0, self.canvas_width, self.canvas_width//self.board_size): self.canvas.create_line(x, 0, x, self.canvas_width, fill=self.color_tile_border) for y in range(0, self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_board(self):\n pygame.draw.rect(self.display, self.white, pygame.Rect(0, 0, self.window_x, self.window_y))\n self.draw_grid()", "def draw_board(self):\n self.window.fill(Colors.WHITE.value)\n self.draw_lines()\n self.draw_obstacles()", "def draw_board(board_list):\n...
[ "0.7962817", "0.7657432", "0.73293865", "0.724925", "0.72288215", "0.7132779", "0.71102816", "0.70926815", "0.7034034", "0.6956973", "0.69457096", "0.692338", "0.68607956", "0.6811114", "0.680971", "0.6805128", "0.6798475", "0.6793814", "0.67506194", "0.6696799", "0.6689301",...
0.7254622
3
The number of items to store in the cache.
def limit(self): return self._limit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_cached(self):\n return len(self._item_list)", "def size(self):\n\t\treturn len(self.cache)", "def size(self):\n return len(self.cache)", "def size(self):\n return len(self._cache)", "def cache_size(self):\n return len(self._cache)", "def cache_size(self):\n retu...
[ "0.81340796", "0.8041876", "0.79425967", "0.7899863", "0.7871918", "0.7854065", "0.7831477", "0.77313566", "0.7709165", "0.76358247", "0.74013084", "0.73941267", "0.73657423", "0.7297101", "0.7296042", "0.7272283", "0.72658926", "0.72531897", "0.72531897", "0.7246306", "0.723...
0.0
-1
The number of items currently cached.
def num_cached(self): return len(self._item_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self) -> int:\n if self._cached_items is not None:\n return len(self._cached_items)\n return self.items.count()", "def size(self):\n\t\treturn len(self.cache)", "def cache_size(self):\n return len(self._cache)", "def size(self):\n return len(self.cache)", "d...
[ "0.8532634", "0.82157135", "0.8147997", "0.8129233", "0.81053615", "0.80535746", "0.7951704", "0.79188365", "0.781136", "0.7783268", "0.7755966", "0.7755966", "0.77358633", "0.7681913", "0.758889", "0.74718887", "0.7450744", "0.74469465", "0.74405336", "0.7432642", "0.7432219...
0.8873076
0
Heapify the root element of lst which has n element in total
def max_heapify(lst, n, root): largest = root l = 2 * root + 1 r = 2 * root + 2 if l < n and lst[l] > lst[largest]: largest = l if r < n and lst[r] > lst[largest]: largest = r if largest != root: lst[root], lst[largest] = lst[largest], lst[root] max_heapify(lst,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_max_heap(self, lst):\n self.heap_list = lst\n #start compare node\n node = (len(self.heap_list)-2)/2\n while node >= 0:\n self.sift_down(node, len(self.heap_list)-1)\n node -= 1", "def buildHeap(A):\n n = len(A)\n for i in range(n/2-1, -1, -1)...
[ "0.7314859", "0.70185935", "0.6946231", "0.6838536", "0.6750411", "0.6748887", "0.6681453", "0.65993005", "0.65993005", "0.65816975", "0.654757", "0.6544415", "0.65349746", "0.6521549", "0.65083206", "0.64724004", "0.64552265", "0.6446988", "0.6417058", "0.6406795", "0.640526...
0.73425585
0
Adds the activity ID to the list of activities to be analyzed.
def add_to_queue(self, activity, activity_user_id, data_mgr): if not self.enabled: return try: analysis_task = analyze_activity.delay(dumps(activity)) if data_mgr is not None: data_mgr.track_analysis_task(activity_user_id, analysis_task.task_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(self, id, activity):\n\t\tif id not in self.linkfrom:\n\t\t\tself.linkfrom.append(id)\n\t\tself.activations[id] = activity", "def take(self, id, activity):\n\t\tif id not in self.linkfrom:\n\t\t\tself.linkfrom.append(id)\n\t\tself.activations[id] = activity", "def activities(self, activities):\n ...
[ "0.6372322", "0.6372322", "0.611627", "0.60385364", "0.59964275", "0.59079945", "0.57975847", "0.5686818", "0.5659474", "0.5636882", "0.5563429", "0.55235916", "0.54379", "0.54256856", "0.5326213", "0.5308789", "0.5300362", "0.52903813", "0.52051663", "0.5178158", "0.5143269"...
0.5849091
6
check if the ship was damaged
def damaged(self) -> bool: return len(self._damaged_cells) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_damaged(self):\n return self.damaged", "def ship_took_damage(self, damage: Damage):\n pass", "def is_damaged(self):\n\n return self.all_damaged or bool(self.damaged)", "def shipCollided(self):\n self.shipHealth -= 1\n\n if self.shipHealth > 0:\n self.start...
[ "0.7457794", "0.71651375", "0.6906505", "0.6855768", "0.6839278", "0.6692819", "0.6657729", "0.6595007", "0.657862", "0.65297246", "0.6453142", "0.6434999", "0.6427346", "0.63855124", "0.63288015", "0.63278365", "0.63198465", "0.63118815", "0.63063806", "0.62998736", "0.62909...
0.69132304
2
check if the ship was destroyed at all
def is_destroyed(self) -> bool: return self._coords == self.damaged_cells
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_destroyed_ship(self):\n if self.mark == constants.DEAD_SHIP_MARK:\n return True\n return False", "def hit(self):\n\n self.units.pop()\n return (len(self.units) == 0) # Returns True if the ship has been sunk", "def shipCollided(self):\n self.shipHealth -= 1\n\n ...
[ "0.8307046", "0.6917231", "0.6650898", "0.6524698", "0.64221555", "0.640224", "0.63683337", "0.6346706", "0.63382554", "0.63382274", "0.62731415", "0.61692995", "0.6143225", "0.6140769", "0.6117712", "0.6115912", "0.6105944", "0.6087561", "0.6077184", "0.6033313", "0.60311556...
0.73332524
1
check if given coordinates(or coordinate) intersect with this ship
def is_intersect(self, coord: Union[Coordinate, frozenset[Coordinate]]) -> bool: if isinstance(coord, Coordinate): coord = frozenset((Coordinate,)) return len(self._coords.intersection(coord)) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_inside(self, coordinates: tuple) -> bool:\n if len(coordinates) != 2:\n raise IndexError(\"Coordinates consist of x and y\")\n x, y = coordinates\n if (self.MIN_X <= x <= self.MAX_X) and (self.MIN_Y <= y <= self.MAX_Y):\n return True\n else:\n ret...
[ "0.71345955", "0.71151227", "0.69920886", "0.6935107", "0.6857428", "0.6852486", "0.6813789", "0.67529887", "0.67405844", "0.67401475", "0.6701522", "0.6695316", "0.66952986", "0.669208", "0.6655651", "0.6645321", "0.6599638", "0.6587342", "0.6575695", "0.6525758", "0.6515064...
0.69930166
2
Retrieve the updated attributes from the patch request.
def _get_updates(self, patch): updates = {} for p in patch: attribute = p['path'] if p['path'][0] != '/' else p['path'][1:] updates[attribute] = p['value'] return updates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_update(self, request, pk=None):\n return Response({'http_method':'PATCH'})", "def partial_update(self, request, pk=None):\n\n return Response({'http_method':'PATCH'})", "def partial_update(self, request, pk=None):\n\n return Response({'http_method': 'PATCH'})", "def patch(sel...
[ "0.6722445", "0.66949564", "0.6618996", "0.6584531", "0.6567358", "0.65218616", "0.6485209", "0.6483376", "0.64737415", "0.6432434", "0.64075834", "0.63945186", "0.63905483", "0.63774693", "0.63774693", "0.63774693", "0.632974", "0.63269234", "0.63139254", "0.6308149", "0.630...
0.72766215
0
Calculate boxes IoU in the bird view.
def boxes_iou_bev(boxes_a, boxes_b): ans_iou = boxes_a.new_zeros(torch.Size((boxes_a.shape[0], boxes_b.shape[0]))) iou3d_cuda.boxes_iou_bev_gpu(boxes_a.contiguous(), boxes_b.contiguous(), ans_iou) return ans_iou
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IoUs(box, boxes):\n box_area = (box[2] - box[0]) * (box[3] - box[1])\n area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])\n xx1 = np.maximum(box[0], boxes[:, 0])\n yy1 = np.maximum(box[1], boxes[:, 1])\n xx2 = np.minimum(box[2], boxes[:, 2])\n yy2 = np.minimum(box[3], boxes[:, 3...
[ "0.7604761", "0.72087747", "0.7121982", "0.7094143", "0.7085946", "0.705674", "0.705674", "0.705674", "0.705505", "0.6952981", "0.6938651", "0.6923583", "0.69173056", "0.6895829", "0.68827647", "0.6866625", "0.6866625", "0.6860303", "0.6756855", "0.6736338", "0.6736338", "0...
0.5801775
76
Display the introductory screen of the game
def introduction(): button_width = 290 button_height = 60 play_button = Button(-400, height/(1.5), button_width, button_height, beer, orange, 32, black, white, "PLAY") instructions_button = Button(width+150, height/(1.5)+button_height+10, button_width,button_height, beer, orange, 32, black, white, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayStartScreen(self):\n self.model.buttons.draw(self.screen)\n Title=myfont.render(\"THE WORLD ENDS WITH COINS\", 1, random.choice(all_color))\n self.screen.blit(Title, (550, 300))\n pygame.display.update()", "def livesScreen(self):\n # creates welcome screen if state i...
[ "0.75921845", "0.7428187", "0.73271406", "0.7252836", "0.72365826", "0.7230192", "0.6978214", "0.69761956", "0.6974689", "0.6908753", "0.6853984", "0.67994106", "0.6769669", "0.67685115", "0.67525923", "0.6747221", "0.67395854", "0.6730957", "0.673031", "0.6712138", "0.670075...
0.65766656
30
Return the probability that normally distributed is smaller or equal to x
def cdf_normal(x: float, mean: float = 0, std: float = 1): return (1 / 2) * (1 + erf((x - mean) / (std * sqrt(2))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theoretical_distribution(x):\n a = 0\n b = 1\n if x < a:\n return 0\n elif x > b:\n return 1\n else:\n return float(x - a) / (b - a)", "def prob_distr(self, x):\n return 1.0/x", "def prob(x):\n\treturn 1. * bivariate_normal(x, (0., 1.2), (1., 1.), .8) + \\\n\t ...
[ "0.8040812", "0.78467464", "0.73499554", "0.73380715", "0.6995058", "0.6962952", "0.6932853", "0.69108653", "0.68998045", "0.68659717", "0.686013", "0.68257713", "0.6795551", "0.6790031", "0.6745594", "0.6729206", "0.6711051", "0.6711051", "0.6711051", "0.6711051", "0.6706072...
0.0
-1
Login page for registered users. GET requests serve Login page. POST requests validate and redirect user to dashboard.
def create_tea(): # Bypass if user is logged in form = TeaAddForm() # Validate login attempt if form.validate_on_submit(): tea = Tea( name=form.name.data, price_per_gram=form.price_per_gram.data, ) db.session.add(tea) db.session.commit() # Create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n # Initialise login form\n form = UserLoginForm()\n # Validate and process form data\n if form.validate_on_submit():\n # Get form data\n username = form.username.data\n password = form.password.data\n # Check if username and password is valid\n valid, us...
[ "0.7728975", "0.7576537", "0.7458059", "0.7445223", "0.7434282", "0.73928046", "0.7381617", "0.7379971", "0.7360898", "0.7344657", "0.73307663", "0.7325487", "0.7319165", "0.73055255", "0.72959083", "0.72913784", "0.7279035", "0.7277839", "0.72682554", "0.72493786", "0.724787...
0.0
-1
Login page for registered users. GET requests serve Login page. POST requests validate and redirect user to dashboard.
def log_tea(): # Bypass if user is logged in form = TeaLogForm() form.tea.choices = [(tea.id, tea.name) for tea in Tea.query.all()] # Validate login attempt if form.validate_on_submit(): tea_log = TeaLog( tea_id=form.tea.data, date=form.date.data, user_id=current_user.get_id() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n # Initialise login form\n form = UserLoginForm()\n # Validate and process form data\n if form.validate_on_submit():\n # Get form data\n username = form.username.data\n password = form.password.data\n # Check if username and password is valid\n valid, us...
[ "0.77295256", "0.75777316", "0.74580723", "0.74465734", "0.74346924", "0.739369", "0.73820674", "0.7380469", "0.73613", "0.73447317", "0.73319495", "0.73260385", "0.73201156", "0.730593", "0.7296416", "0.72921574", "0.7278727", "0.72778726", "0.7269158", "0.72504234", "0.7249...
0.0
-1
Generate embedding for an unknown variable.
def forward(self, encoder_state, context, context_lens): attn = self.attention(context, encoder_state.squeeze(0), context_lens) return attn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_embedding_layer(inputs_, vocab_size, embed_size):\n embedding = tf.Variable(tf.random_uniform((vocab_size, embed_size), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, inputs_)\n \n return embed", "def add_unknown_token(self):\n self.load_all()\n sample_idxs = np.random.ra...
[ "0.659613", "0.64272225", "0.62635803", "0.6210808", "0.61941344", "0.5989689", "0.59784687", "0.59712386", "0.59339696", "0.5907081", "0.5875665", "0.58182245", "0.58043075", "0.5789969", "0.57634574", "0.5740238", "0.57245654", "0.5720391", "0.57106084", "0.5697945", "0.564...
0.0
-1
Generate variable embedding with attention.
def forward(self, value, query, lens): relevant_scores = self.relevant_score(value, query, lens) e_relevant_scores = torch.exp(relevant_scores) weights = e_relevant_scores / e_relevant_scores.sum(-1, keepdim=True) attention = (weights.unsqueeze(-1) * value).sum(1) return attentio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedding_layer(self):\n with tf.name_scope(\"Embedding_Layer\"):\n V_size = len(self.vocab)\n embed_dim = len(self.embed[0]) \n W_embed_ = tf.get_variable(\"W_embed\",shape=[V_size, embed_dim],trainable=False).assign(np.asarray(self.embed))\n W_analogy_embed_...
[ "0.68005854", "0.6631543", "0.65261906", "0.6488723", "0.62913173", "0.62646663", "0.6254942", "0.6204353", "0.61975163", "0.61707276", "0.6134732", "0.61026394", "0.6034276", "0.60220057", "0.60138094", "0.5991668", "0.597669", "0.594127", "0.59004426", "0.5840361", "0.58279...
0.0
-1
Pad lists to have same number of elements, and concatenate those elements to a 3d tensor.
def pad_and_cat(tensors, padding): n_tensors = [len(ts) for ts in tensors] pad_size = max(n_tensors) # pad to has same number of operands for each problem tensors = [ts + (pad_size - len(ts)) * [padding] for ts in tensors] # tensors.size() = (batch_size, pad_size, dim_hidden) te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatenate(tensor_list, axis=0):\n concat_size = sum(tt.shape[axis] for tt in tensor_list)\n\n output_shape = ()\n for k in range(axis):\n output_shape += (tensor_list[0].shape[k],)\n output_shape += (concat_size,)\n for k in range(axis + 1, tensor_list[0].ndim):\n output_shape +=...
[ "0.74046457", "0.73843676", "0.7376451", "0.7281536", "0.6777984", "0.6630539", "0.65340453", "0.6497145", "0.64841634", "0.630858", "0.6264628", "0.6244572", "0.6226859", "0.62243617", "0.62243617", "0.62241167", "0.6218886", "0.6179459", "0.6138153", "0.6081441", "0.6073919...
0.71317184
4
Return the path of all files under the given directory.
def get_sorted_filenames_in_dir_with_suffix(dir_path: str, suffix: (str, list)): if isinstance(suffix, str): suffix = [suffix] paths = [] for s in suffix: paths += glob.glob(os.path.join(dir_path, "**", "*." + s), recursive=True) return sorted(paths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFilePaths(directory):\r\n\tfor folder, subs, files in os.walk(directory):\r\n\t\tfor filename in files:\r\n\t\t\tyield os.path.join(folder, filename)", "def read_filepaths(self, directory):\n folder_paths = [os.path.join(directory, folder) for folder in os.listdir(directory) if not folder.startswit...
[ "0.7783525", "0.77339303", "0.76343685", "0.756538", "0.75431025", "0.7537264", "0.75349814", "0.7532401", "0.7513594", "0.75107336", "0.7498144", "0.7474665", "0.7474665", "0.7474665", "0.7428601", "0.73498565", "0.7317474", "0.7314914", "0.72781205", "0.7258773", "0.7256686...
0.0
-1
Convert the dictionary board representation to a string.
def values_to_grid(self): str = [] for r in self.rows: for c in self.cols: v = self.values[r + c] str.append(v if len(v) == 1 else '0') return ''.join(str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_string(self) -> str:\n\n string_list = []\n for key, value in self.__dict__.items():\n if isinstance(value, dict):\n string_list.append(key)\n string_list.extend('\\n'.join([\"Key: {:24}\\tValue: {}\".format(_key, _value) for _key, _value in value.item...
[ "0.69831586", "0.68994325", "0.68626827", "0.68626827", "0.6811388", "0.67897904", "0.6734087", "0.66981626", "0.66943765", "0.6650248", "0.66244406", "0.6621259", "0.66025174", "0.6598134", "0.6572303", "0.6545761", "0.65260077", "0.6495609", "0.64812106", "0.6475985", "0.64...
0.0
-1
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
def variable_summaries(var): with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary.scalar('stddev', stddev) tf.summary.scalar('m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ...
[ "0.70722914", "0.697031", "0.697031", "0.6801214", "0.67882913", "0.6741727", "0.6666848", "0.66591316", "0.66205895", "0.6609842", "0.6597634", "0.6584643", "0.65823466", "0.6553093", "0.6501517", "0.64610195", "0.6415469", "0.6295182", "0.62727547", "0.627217", "0.6266978",...
0.0
-1
Walks a directory tree, and yields tuples consistent of a file path and file name, excluding Git files and thirdparty files under virtual environment, static, build, and test fixture directories (by default).
def walk(top=None, excluded=('.git', '.ve', '_static', 'build', 'fixtures')): if not top: top = os.getcwd() for root, dirs, files in os.walk(top): for directory in excluded: if directory in dirs: dirs.remove(directory) for name in files: yield os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_files():\n\n # TODO: not check twice the same dir or file\n for path in config.targets:\n abs_path = os.path.join(cwd, path)\n\n if not os.path.islink(abs_path) and os.path.isfile(abs_path):\n walked.append(abs_path)\n yield abs_path\n #process_file(abs...
[ "0.7232686", "0.71030277", "0.7074888", "0.6994594", "0.6956061", "0.6863698", "0.6856459", "0.68436587", "0.68352485", "0.68341786", "0.6782162", "0.6708839", "0.66715974", "0.6636346", "0.6620128", "0.66090643", "0.6594447", "0.6590966", "0.658142", "0.6576604", "0.656628",...
0.6892112
5
Get the NXOS version from a switch
def get_version(ip): url='http://{}/ins'.format(ip) myheaders={'content-type':'application/json'} payload={ "ins_api": { "version": "1.0", "type": "cli_show", "chunk": "0", "sid": "1", "input": "show version", "output_format": "json" } } r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_os_version(self):\n\t\treturn call_sdk_function('PrlSrvInfo_GetOsVersion', self.handle)", "def get_os_version(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetOsVersion', self.handle)", "def get_osversion(self):\n\t\treturn call_sdk_function('PrlFoundVmInfo_GetOSVersion', self.handle)", "def version...
[ "0.6661166", "0.65088016", "0.6505643", "0.64939785", "0.6473571", "0.62981117", "0.6237209", "0.6232414", "0.6220948", "0.6211619", "0.61846936", "0.61715883", "0.61653185", "0.6164717", "0.61330104", "0.6126479", "0.6107566", "0.6077845", "0.60551286", "0.60525084", "0.6043...
0.58681357
38
Attaches to the target with given id.
def attach_to_target( targetId: TargetID, flatten: Optional[bool] = None ) -> Generator[dict, dict, SessionID]: response = yield { "method": "Target.attachToTarget", "params": filter_none({"targetId": str(targetId), "flatten": flatten}), } return SessionID(response["sessionId"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_id(self, target_id):\n\n self._target_id = target_id", "def addTargetShip(self, targetID):\n self.targets.append(targetID)", "def target_id(self, target_id: str):\n\n self._target_id = target_id", "def target_element_id(self, target_element_id):\n\n self._target_element...
[ "0.70488876", "0.69905937", "0.6773831", "0.66152114", "0.6184648", "0.6156036", "0.60249186", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113", "0.6004113",...
0.0
-1
Returns all browser contexts created with `Target.createBrowserContext` method. Returns
def get_browser_contexts() -> Generator[dict, dict, list[browser.BrowserContextID]]: response = yield {"method": "Target.getBrowserContexts", "params": {}} return [browser.BrowserContextID(b) for b in response["browserContextIds"]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contexts(self):\n params = self._get_configurational_params()\n builds = self._get_builds()\n\n ctx_params = itertools.product(builds, *params.values())\n ctxs = []\n for cp in ctx_params:\n build = cp[0]\n kwargs = dict(zip(params.keys(), cp[1:]))\n...
[ "0.68190575", "0.6810983", "0.67201966", "0.660584", "0.6472457", "0.6238201", "0.57587034", "0.57249343", "0.5687892", "0.5681812", "0.5573194", "0.5474627", "0.54677474", "0.5433045", "0.5409142", "0.5318011", "0.53071034", "0.5286067", "0.5273093", "0.5265857", "0.52291876...
0.82482046
0
return self's last name
def getLastName(self): return self.lastName
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_name(self) -> str:\n return self.last_name", "def get_last_name(self):\n return self._last_name", "def last_name(self) -> str:\n return self._last_name", "def last_name(self):\n return self._last_name", "def last_name(self):\n return self._last_name", "def ...
[ "0.93766314", "0.9263516", "0.922716", "0.9158696", "0.9158696", "0.9158696", "0.9158696", "0.9083088", "0.90729755", "0.90166974", "0.90166163", "0.8884879", "0.86528724", "0.86528724", "0.84802455", "0.83682954", "0.826881", "0.82314277", "0.82035524", "0.8174124", "0.80861...
0.8926402
15
sets self's birthday to birthDate
def setBirthday(self,month,day,year): self.birthday = datetime.date(year,month,day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBirthday(self, birthdate):\r\n self.birthday = birthdate", "def setBirthday(self, birthdate):\n self.birthday = birthdate", "def setBirthday(self, month, day, year):\n self.birthday = datetime.date(year, month, day)", "def set_birthday(self, year, month, day):\n self.birthd...
[ "0.8706861", "0.86353385", "0.8441529", "0.84147716", "0.7924714", "0.79126865", "0.7742455", "0.721309", "0.7185419", "0.70903826", "0.6888761", "0.68461156", "0.6830783", "0.68007725", "0.6701698", "0.66713697", "0.6623775", "0.65827554", "0.65300834", "0.6417122", "0.64135...
0.84821874
3
returns self's current age in days
def getAge(self): if self.birthday == None: raise ValueError return (datetime.date.today() - self.birthday).days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAge(self):\n if self.setBirthday == None:\n raise ValueError\n return (datetime.date.today() - self.birthday).days", "def get_age(self):\n age = CURRENT_YEAR - self.year\n return age", "def get_age(self):\n if self.birthday is None:\n raise(ValueE...
[ "0.8440793", "0.84045106", "0.8369943", "0.8347924", "0.8347924", "0.82946813", "0.81743854", "0.8166886", "0.8110375", "0.7988831", "0.7945148", "0.7913852", "0.7910254", "0.7882203", "0.78715444", "0.7830504", "0.78049093", "0.7746568", "0.7740574", "0.77257687", "0.7717128...
0.84445804
3
CoordRequestResponseLocationProperties a model defined in Swagger
def __init__(self, distance=None, poi_draw_class_type=None, poi_draw_class=None, poi_hierarchy_key=None, poi_hierarchy_0=None, gis_draw_class_type=None, gis_draw_class=None, gis_niveau=None): # noqa: E501 # noqa: E501 self._distance = None self._poi_draw_class_type = None self._poi_draw_class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n result = {}\n\n for attr, _ in six.iteritems(self.swagger_types):\n value = getattr(self, attr)\n if isinstance(value, list):\n result[attr] = list(map(\n lambda x: x.to_dict() if hasattr(x, \"to_dict\") else x,\n ...
[ "0.59822273", "0.58782935", "0.57851344", "0.57851344", "0.57218593", "0.5589746", "0.55132383", "0.5489386", "0.5479797", "0.54296154", "0.5428807", "0.542071", "0.53768146", "0.5355536", "0.5283848", "0.52817047", "0.5270927", "0.52545273", "0.52545273", "0.5248258", "0.523...
0.0
-1
Sets the poi_draw_class_type of this CoordRequestResponseLocationProperties.
def poi_draw_class_type(self, poi_draw_class_type): allowed_values = ["POINT"] # noqa: E501 if poi_draw_class_type not in allowed_values: raise ValueError( "Invalid value for `poi_draw_class_type` ({0}), must be one of {1}" # noqa: E501 .format(poi_draw_clas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poi_draw_class(self, poi_draw_class):\n\n self._poi_draw_class = poi_draw_class", "def gis_draw_class_type(self, gis_draw_class_type):\n allowed_values = [\"POINT\"] # noqa: E501\n if gis_draw_class_type not in allowed_values:\n raise ValueError(\n \"Invalid va...
[ "0.6666907", "0.6633252", "0.5658808", "0.5412515", "0.5289038", "0.5124786", "0.50981975", "0.49492168", "0.47927248", "0.4792191", "0.47868064", "0.47868064", "0.47575966", "0.4732688", "0.4714824", "0.4644316", "0.46417898", "0.46410882", "0.46309993", "0.46055418", "0.460...
0.7466849
0
Sets the gis_draw_class_type of this CoordRequestResponseLocationProperties.
def gis_draw_class_type(self, gis_draw_class_type): allowed_values = ["POINT"] # noqa: E501 if gis_draw_class_type not in allowed_values: raise ValueError( "Invalid value for `gis_draw_class_type` ({0}), must be one of {1}" # noqa: E501 .format(gis_draw_clas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poi_draw_class_type(self, poi_draw_class_type):\n allowed_values = [\"POINT\"] # noqa: E501\n if poi_draw_class_type not in allowed_values:\n raise ValueError(\n \"Invalid value for `poi_draw_class_type` ({0}), must be one of {1}\" # noqa: E501\n .format...
[ "0.7009017", "0.66701394", "0.6285807", "0.53676665", "0.5208692", "0.50460875", "0.49511433", "0.49511433", "0.49267042", "0.49130166", "0.48990563", "0.48789582", "0.4809509", "0.47988153", "0.4778454", "0.47358048", "0.47081006", "0.4680381", "0.46691328", "0.46468687", "0...
0.7216628
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CoordRequestResponseLocationProperties): 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
Implementation of the gelu activation function.
def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu(x):\n return f_...
[ "0.81878746", "0.81878746", "0.78091353", "0.75566226", "0.75261027", "0.74784553", "0.7371147", "0.7235054", "0.7213163", "0.72079337", "0.71979815", "0.71930933", "0.71736133", "0.7157644", "0.6968456", "0.6956587", "0.69499516", "0.6794776", "0.6789725", "0.677464", "0.677...
0.69697493
19
Preprocess an image for Keras ImageNet model inferencing.
def preprocess(img): if img.ndim != 3: raise TypeError('bad ndim of img') if img.dtype != np.uint8: raise TypeError('bad dtype of img') img = cv2.resize(img, (224, 224)) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = img.astype(np.float32) img *= (2.0/255) # normalize to: 0.0~...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, img):\n img_ = image.load_img(img, target_size=(299, 299))\n img_ = image.img_to_array(img_)\n img_ = np.expand_dims(img_, axis=0)\n img_ = preprocess_input(img_)\n return img_", "def _preprocess_image(self, input_data):\n image = self.preprocessor.prepr...
[ "0.79769623", "0.7666944", "0.7452293", "0.7312889", "0.72496665", "0.7183988", "0.7156501", "0.7121139", "0.70888835", "0.7081045", "0.707221", "0.705979", "0.6991664", "0.6963944", "0.69192004", "0.6834636", "0.6831695", "0.6793135", "0.67597204", "0.6742038", "0.6730946", ...
0.6621368
30
Returns True if a word is in Term table already, False if not.
def check_for_term(cls, word): # TO DO: allow for some kind of broader search so that: # # (1) If a word is really a two-word phrase, check if # either of those words is in the Term table. # # (2) If the stemmed word is in stemmed terms, add it as a match if cls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_word(self, word):\n return word in self.word_set", "def _is_term_exist(self, term):\n return term in self.postingDict", "def contains(self, word: Iterable[Terminal]) -> bool:\n return self._get_final_state(word) is not None", "def contains(self, word: Iterable[Terminal]) -> bool:...
[ "0.7415595", "0.7301837", "0.71115154", "0.71086764", "0.7049113", "0.70244205", "0.6913606", "0.6890116", "0.68722886", "0.68552595", "0.6853935", "0.68396187", "0.67228603", "0.66834074", "0.6659741", "0.66476154", "0.6643442", "0.66416997", "0.66245866", "0.66224736", "0.6...
0.742991
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(sonar_vip, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.distance_front is None: self.distance_front = 0. if self.angle_front is None: self.angle_front =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77937967", "0.77195275", "0.77195275", "0.7685702", "0.762502", "0.7562939", "0.74384665", "0.7416083", "0.73515767", "0.73078126", "0.7280228", "0.723719", "0.72265446", "0.72230625", "0.72230625", "0.7218876", "0.721051", "0.721051", "0.721051", "0.721051", "0.721051", ...
0.0
-1
Computes the average elongation rate of actively translating ribosomes given the model parameters.
def elongation_rate(R, r_AA, V=1E-15, K_D=5E-3, t=1, f_a = 1, rt_max=17.1): N_A = 6.022E23 # Avogadro's number prefix = K_D * N_A * V + R * f_a * rt_max * t + r_AA * t sqrt_a = (K_D * N_A * V)**2 + (r_AA * t)**2 + (R * f_a * rt_max * t)**2 sqrt_b = 2 * (K_D * N_A * R * V * f_a * rt_max* t + K_D * N_A *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emission_rate_per_aerosol_per_person_when_present(self) -> _VectorisedFloat:\n return self.known_individual_emission_rate", "def emission_rate_per_person_when_present(self) -> _VectorisedFloat:\n return (self.emission_rate_per_aerosol_per_person_when_present() *\n self.aerosols()...
[ "0.6083838", "0.6075803", "0.60388404", "0.59627146", "0.59338695", "0.59153765", "0.59085494", "0.5902767", "0.5894942", "0.58666754", "0.5821652", "0.57766867", "0.57368183", "0.57093716", "0.5690109", "0.56520396", "0.5626951", "0.56179434", "0.5609885", "0.5607778", "0.55...
0.543817
37
img = tf.expand_dims(img, 0)
def resize(img, size): img = cv2.resize(img, tuple(size[::-1])) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape_function(image, label):\n# image = tf.expand_dims(image, axis=0)\n image = tf.expand_dims(image, axis=-1)\n return image, label", "def postprocess(X, image_shape=(28, 28)):\n return tf.reshape(X, image_shape) * 255", "def image_batch():\n return np.zeros((2, 1, 4, 4))", "def neur...
[ "0.7111985", "0.7014918", "0.66572666", "0.66088676", "0.6596083", "0.6526974", "0.6477157", "0.6424134", "0.6393439", "0.6387207", "0.6377124", "0.6366018", "0.63100916", "0.63006616", "0.6281583", "0.62712836", "0.6268378", "0.6258064", "0.6251894", "0.6236332", "0.6231088"...
0.0
-1
Calcualtes the energy of the 2 body system, composed of one single body and a the center of mass of a pair treated. (In the language of 3body systems, this is the outerorbit / outer binary energy).
def binary_single_energy(R,V,M,G): N = R.shape[0] Ebs = np.zeros(int(N*(N-1)*(N-2)/2)) triplet_index = int(0) for n in range(N-1): for nn in range(n+1,N): for k in range(N): if (k != n) & (k!= nn): mu = M[k]*(M[nn]+M[n])/ (M[n]+M[nn]+...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_energy(self, box):\n\n sum1 = 0\n\n for i in range(self.n):\n for j in range(self.n):\n # sum all nearest neighbors, impose boundary conditions of torus\n # current site spin\n s = box[i, j]\n # Neighboring spins to the r...
[ "0.6449939", "0.64000154", "0.63371205", "0.6330184", "0.6299684", "0.6282205", "0.62481934", "0.6228648", "0.60868526", "0.60799193", "0.60616666", "0.6050506", "0.60408187", "0.6020842", "0.60178715", "0.60059804", "0.5989594", "0.59796226", "0.59474534", "0.5943877", "0.59...
0.0
-1
Calculate total energy of an N body system, w.r.t the centerofmass rest frame
def total_energy(R,V,M,G): N = R.shape[0] # number of bodies E = 0 # initialize energy V0 = np.zeros(3) # initialize center of mass velocity, for n in range(N): V0 = V0 + V[n,:]*M[n] V0 = V0/np.sum(M) # find overall energy for n in range(N): # add kinetic energy of n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy(self):\n energy = -0.5*np.sum(self.phi)+0.5*np.sum(self.mass*np.sqrt(self.particles.momentum[:,0]**2+self.particles.momentum[:,1]**2)**2)\n return energy", "def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))", "def energy(...
[ "0.72940683", "0.7157494", "0.7144973", "0.7061171", "0.6958318", "0.689005", "0.68744797", "0.68009305", "0.6791255", "0.67618686", "0.6694111", "0.66806257", "0.66548765", "0.66498905", "0.6648613", "0.65915763", "0.65876406", "0.6566909", "0.65528363", "0.65528136", "0.654...
0.71462137
2
Uses action to obtain next state, reward, done.
def step(self, rotor_speeds): reward = 0 pose_all = [] for _ in range(self.action_repeat): done = self.sim.next_timestep(rotor_speeds) # update the sim pose and velocities reward += self.get_reward(done) pose_all.append(self.sim.pose) v_length = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n possible_states, probs = zip(*self.get_next_states(self._current_state, action).items())\n next_state = weighted_choice(possible_states, p=probs)\n reward = self.get_reward(self._current_state, action, next_state)\n is_done = self.is_terminal(next_state)\n ...
[ "0.8106777", "0.8081674", "0.79318964", "0.788988", "0.7873674", "0.7870752", "0.7751757", "0.7744235", "0.76798654", "0.7671487", "0.76401347", "0.76312447", "0.7612135", "0.7603414", "0.75804955", "0.7557466", "0.7556608", "0.75313103", "0.7524345", "0.7512973", "0.74929035...
0.0
-1
Return the current model state.
def getState(self): return self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_model_state(self) -> dict:\n raise NotImplementedError", "def state(self):\n return self.get_state()", "def model_state(self) -> Optional[PyTree]:\n return self._model_state", "def get_state(self):\n return self.controller.get_state()", "def get_state(self) -> Optional[...
[ "0.8106587", "0.7960822", "0.79274964", "0.7922173", "0.790536", "0.78053606", "0.7803518", "0.7803518", "0.7788346", "0.7770957", "0.774722", "0.7723139", "0.77219796", "0.77218944", "0.7694311", "0.7694311", "0.7694311", "0.7694311", "0.7694311", "0.76676816", "0.7645604", ...
0.7689712
21
Returns an iterstream that samples from the subsets of this source.
def get_iter_sampler( self, probs: list[float] | None = None, rng: random.Random | None = None, seed: int | None = None, **kwargs, ) -> Composable: return IterableSamplerSource( iterables=[self.get_iter(subset=k, **kwargs) for k in self.subsets], probs=pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\r\n if self._shuffle:\r\n perm = torch.randperm(self._subset_size)\r\n return iter(self._subset[perm].tolist())\r\n return iter(self._subset)", "def __iter__(self):\n for sample in self.samples:\n yield sample", "def __iter__(self):\n # det...
[ "0.7316769", "0.67642367", "0.6722124", "0.6559035", "0.65548253", "0.6461405", "0.6447391", "0.6265569", "0.62641674", "0.6180908", "0.6162046", "0.61476195", "0.61069554", "0.60664743", "0.6057748", "0.6008092", "0.5968836", "0.59295064", "0.58820754", "0.580514", "0.579925...
0.65823126
3
r"""Returns the environment specifications.
def env_spec(self): return self._env_spec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env(self): # type: () -> t.List[str]\n return self.config['Env']", "def get_all_environments():\n return ENVIRONMENTS", "def get_env():\n from platform import python_version\n versions = {}\n versions['iris'] = iris.__version__\n versions['matplotlib'] = matplotlib.__version__\n v...
[ "0.7211066", "0.6996826", "0.6768933", "0.67425674", "0.6687016", "0.6676447", "0.6619993", "0.6604096", "0.65974516", "0.6593154", "0.65624285", "0.6518126", "0.6507828", "0.65031093", "0.6490152", "0.64588654", "0.645331", "0.6453203", "0.6434917", "0.64329076", "0.6417289"...
0.70133734
2
take a list of unicode words and a tag and return a lemmatised list.
def lemmatiser(list_of_words, tag): output = [] for entry in list_of_words: if phrases: # just get the rightmost word word = entry[-1] entry.pop() else: word = entry if translated_option.startswi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatiser(list_of_words, tag):\n output = []\n for word in list_of_words:\n if translated_option.startswith('u'):\n word = taglemma.get(word.lower(), 'Other')\n else:\n word = wordlist.get(word, lmtzr.lemmatize(word, tag))\n if not p...
[ "0.80873185", "0.72884524", "0.72741467", "0.693105", "0.6862739", "0.6846097", "0.6596768", "0.6590141", "0.655235", "0.6493086", "0.6485697", "0.6461486", "0.6429179", "0.64272195", "0.6377061", "0.6374018", "0.63689035", "0.6355982", "0.6345935", "0.6316029", "0.6279165", ...
0.7994621
1
Initializes Clova app by setting configuration variables, loading templates, and maps Clova route to a flask view.
def init_app(self, app, path='templates.yaml'): if self._route is None: raise TypeError("route is a required argument when app is not None") app.clova = self app.add_url_rule(self._route, view_func=self._flask_view_func, methods=['POST']) app.jinja_loader = ChoiceLoader([ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_app():\n app = Flask(__name__)\n\n with app.app_context():\n # Import parts of our core Flask app\n from . import routes\n\n from .plotlydash.index import init_dashboard\n app = init_dashboard(app)\n\n return app", "def configure_app(self):\n self.app.rout...
[ "0.7195183", "0.7191776", "0.6954776", "0.6934823", "0.69181865", "0.69088686", "0.68557674", "0.68225414", "0.6735075", "0.67283434", "0.67046034", "0.67003536", "0.66752183", "0.66275287", "0.6612809", "0.66106385", "0.6580331", "0.6562947", "0.65102565", "0.65033495", "0.6...
0.8109496
0
Initialize a Flask Blueprint, similar to init_app, but without the access to the application config.
def init_blueprint(self, blueprint, path='templates.yaml'): if self._route is not None: raise TypeError("route cannot be set when using blueprints!") # we need to tuck our reference to this Clova instance into the blueprint object and find it later! blueprint.clova = self #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_app(db_name=None):\n\n # create a Flask app, force SSL when debug is False\n app = Flask(__name__, static_folder='./ui/static')\n app.config.from_pyfile('config.py')\n\n # load custom config file\n custom_config = app.config['CUSTOM_CONFIG_PATH']\n if os.environ.get(custom_config) is not...
[ "0.75844955", "0.75201744", "0.7474951", "0.74530274", "0.74053913", "0.73524797", "0.7337384", "0.7298106", "0.7287799", "0.7280228", "0.7223292", "0.7198993", "0.7146236", "0.7100485", "0.70681393", "0.7052139", "0.7045326", "0.7039902", "0.7039572", "0.7036174", "0.7035675...
0.6741939
42
Checks if a user has permission to acess a view.
def has_permission(self): org_id = self.kwargs.get("pk1", False) # i'm checking the org_id is truthy here since some org user views don't # have `/org/pk1/` for example the initial publish landing page. if org_id and not self.request.user.organisations.filter(id=org_id).exists(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_permission(self, request, view):\n if request.user.is_authenticated():\n return True\n return False", "def can_view(self, user):\r\n return True", "def has_permission(self, request, view):\n return True", "def has_permission(self, request, view):\n return...
[ "0.83323", "0.82153666", "0.8180783", "0.815997", "0.8124855", "0.8105465", "0.8100267", "0.80805457", "0.7995942", "0.790836", "0.79030555", "0.7898604", "0.7874363", "0.78530693", "0.7834312", "0.7809898", "0.7782064", "0.7741782", "0.7732151", "0.7730203", "0.7724212", "...
0.7293539
46
Get the text entered into the first name input textbox.
def get_first_name(self): element = self.driver.find_element(*self.firstname_textbox_selector) return element.get_attribute("value")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_first_name(self, name):\n self.send_keys_to_element(self.firstname_textbox_selector, name)", "def first_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"first_name\")", "def first_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"first_n...
[ "0.7497088", "0.691269", "0.691269", "0.68188787", "0.680342", "0.67814946", "0.6714059", "0.6636605", "0.6636605", "0.66087335", "0.6564602", "0.653228", "0.6513729", "0.64451593", "0.64367014", "0.64162815", "0.64011604", "0.6352901", "0.6350807", "0.6319087", "0.63061285",...
0.7970192
0
Get the text entered into the last name input textbox.
def get_last_name(self): element = self.driver.find_element(*self.lastname_textbox_selector) return element.get_attribute("value")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_last_name(self, name):\n self.send_keys_to_element(self.lastname_textbox_selector, name)", "def last_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"last_name\")", "def last_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"last_name\")...
[ "0.79137796", "0.72730327", "0.72730327", "0.70704395", "0.6969003", "0.6897302", "0.68800414", "0.6859876", "0.68251103", "0.668894", "0.6663428", "0.6663428", "0.6663428", "0.6663428", "0.6582699", "0.6564292", "0.65447015", "0.6538517", "0.6538517", "0.6538517", "0.6538517...
0.81788933
0
Initialize the normalizing flow integrator.
def __init__(self, dist, optimizer, loss_func='chi2', **kwargs): self.global_step = 0 self.dist = dist self.optimizer = optimizer self.divergence = divergences.Divergence(**kwargs) self.loss_func = self.divergence(loss_func) self.ckpt_manager = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\r\n N = self.N\r\n self.mean = array(self.x0, copy=True)\r\n self.sigma = self.sigma0\r\n self.sigmai = np.ones(N)\r\n self.ps = np.zeros(N) # path for individual and globalstep-size(s)\r\n self.r = np.zeros(N)\r\n self.pr = 0 # cumula...
[ "0.6347316", "0.61864156", "0.6164714", "0.6139591", "0.60530764", "0.60429037", "0.6032506", "0.5989239", "0.5983132", "0.597753", "0.5975211", "0.5963562", "0.59464246", "0.594313", "0.5935474", "0.5844793", "0.5842004", "0.5839952", "0.5824168", "0.5823124", "0.5776078", ...
0.0
-1
Function to save a checkpoint of the model and optimizer, as well as any other trackables in the checkpoint. Note that the network architecture is not saved, so the same network architecture must be used for the same saved and loaded checkpoints (network arch can be saved if required).
def save(self): if self.ckpt_manager is not None: save_path = self.ckpt_manager.save() print("Saved checkpoint at: {}".format(save_path)) else: print("There is no checkpoint manager supplied for saving the " "network weights, optimizer, or other tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model_checkpoint(model, optimizer, global_step, epoch_info, file_name):\n output = {\n \"model\" : model.state_dict(),\n \"optimizer\" : optimizer.state_dict(),\n \"global_step\" : global_step + 1,\n \"epoch_info\" : epoch_info\n }\...
[ "0.7856408", "0.775991", "0.7739301", "0.768411", "0.76565427", "0.76309335", "0.7616487", "0.7581446", "0.7572039", "0.75245607", "0.75007075", "0.74745417", "0.74558896", "0.74533737", "0.7444074", "0.7435845", "0.7399365", "0.7388428", "0.73692334", "0.73469716", "0.733051...
0.78867453
0
Return True if number is zero (initial value).
def _is_zero(self): return (len(self._digits) == 1) and\ (self._digits[0] == self.Symbols.ZERO.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_zero(self):\n return (self._num == 0)", "def isZero(self, num):\n if num == 0 or num is None:\n return 1\n else:\n return num", "def equals_zero(self, number):\n return abs(number) < self.zero_sensitivity", "def is_zero(self) -> bool:\n return s...
[ "0.85456467", "0.8433005", "0.81886107", "0.8094658", "0.780685", "0.78031677", "0.77452916", "0.76901853", "0.7661104", "0.76289445", "0.7444121", "0.74371475", "0.7345929", "0.7340081", "0.72912574", "0.71838385", "0.7166024", "0.70132256", "0.69949627", "0.6994007", "0.698...
0.8132355
3
Convenience method for logging an ERROR with exception information.
def exception(self, msg, *args): self._log(logging.ERROR, msg, args, {'exc_info': 1})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ERROR_LOG(msg, *args, **kwargs):\n logger.error(msg, *args, **kwargs)", "def error_traceback():\n Logger.log('ERROR', traceback.format_exc())", "def error(self, *args, **kwargs):\n\n message = self.get_message(*args, **kwargs)\n self.logger.error(message)", "def log_error(self, er...
[ "0.75277656", "0.7495265", "0.74621296", "0.7457315", "0.7448969", "0.73367095", "0.7327733", "0.7327733", "0.7290667", "0.7188297", "0.717454", "0.7158626", "0.71553147", "0.71433985", "0.7111715", "0.70909685", "0.7087521", "0.70724046", "0.6951319", "0.6947651", "0.6943790...
0.75255525
1
Returns a DiagLinearOperator with the absolute value of all diagonal entries.
def abs(self) -> LinearOperator: return self.__class__(self._diag.abs())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abs(self) -> LinearOperator:\n return ConstantDiagLinearOperator(self.diag_values.abs(), diag_shape=self.diag_shape)", "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtype=np.float_)\n ...
[ "0.8402863", "0.61552787", "0.607638", "0.60606474", "0.6047075", "0.6035501", "0.594049", "0.5908175", "0.58900255", "0.5792735", "0.5682215", "0.56706697", "0.56541157", "0.56402653", "0.55852246", "0.55773056", "0.5559545", "0.5536921", "0.55157673", "0.55136096", "0.55120...
0.8145211
1
Returns a DiagLinearOperator with all diagonal entries exponentiated.
def exp(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return self.__class__(self._diag.exp())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(self: Float[LinearOperator, \"*batch M N\"]) -> Float[LinearOperator, \"*batch M N\"]:\n return ConstantDiagLinearOperator(self.diag_values.exp(), diag_shape=self.diag_shape)", "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n ...
[ "0.7211509", "0.69971734", "0.66151434", "0.6300579", "0.6253412", "0.6223991", "0.6205295", "0.6168975", "0.61482584", "0.6124073", "0.61090237", "0.6086106", "0.60322815", "0.6029163", "0.60105073", "0.59989965", "0.5972123", "0.5962808", "0.5908485", "0.5896572", "0.588136...
0.62768877
4
Returns a DiagLinearOperator with the log of all diagonal entries.
def log(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return self.__class__(self._diag.log())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self: Float[LinearOperator, \"*batch M N\"]) -> Float[LinearOperator, \"*batch M N\"]:\n return ConstantDiagLinearOperator(self.diag_values.log(), diag_shape=self.diag_shape)", "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n ...
[ "0.80749536", "0.649823", "0.64240664", "0.6089867", "0.6071329", "0.59175634", "0.5883302", "0.58437335", "0.58296096", "0.58276725", "0.57856184", "0.57720155", "0.57679164", "0.5710625", "0.569863", "0.56703264", "0.5667271", "0.5665087", "0.56565607", "0.5638314", "0.5624...
0.72428846
1
Returns a DiagLinearOperator with the square root of all diagonal entries.
def sqrt(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return self.__class__(self._diag.sqrt())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtype=np.float_)\n diag_matrix[index, index] = diag_elements\n return self.identity_wrap(diag_matrix, subsystem)", "def sqrt(self: Float[...
[ "0.6947696", "0.67451525", "0.6737936", "0.65112984", "0.64361334", "0.63641876", "0.6306983", "0.61414057", "0.6136696", "0.6027886", "0.60249054", "0.60013914", "0.5997707", "0.59773344", "0.5947686", "0.59467226", "0.5937052", "0.5916051", "0.59052485", "0.5894122", "0.588...
0.60995466
9
Returns a DiagLinearOperator with the absolute value of all diagonal entries.
def abs(self) -> LinearOperator: return ConstantDiagLinearOperator(self.diag_values.abs(), diag_shape=self.diag_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abs(self) -> LinearOperator:\n return self.__class__(self._diag.abs())", "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtype=np.float_)\n diag_matrix[index, index] = diag_element...
[ "0.8145127", "0.61573577", "0.6075905", "0.60609215", "0.60484576", "0.6037606", "0.59417856", "0.59072226", "0.5889911", "0.5793731", "0.56807727", "0.56723636", "0.5654011", "0.5641195", "0.55853254", "0.557572", "0.5559802", "0.5538109", "0.5517008", "0.55130553", "0.55127...
0.8403237
0
Returns a DiagLinearOperator with all diagonal entries exponentiated.
def exp(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return ConstantDiagLinearOperator(self.diag_values.exp(), diag_shape=self.diag_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtype=np.float_)\n diag_matrix[index, index] = diag_elements\n return self.identity_wrap(diag_matrix, subsystem)", "def diag(cls, element...
[ "0.69971734", "0.66151434", "0.6300579", "0.62768877", "0.6253412", "0.6223991", "0.6205295", "0.6168975", "0.61482584", "0.6124073", "0.61090237", "0.6086106", "0.60322815", "0.6029163", "0.60105073", "0.59989965", "0.5972123", "0.5962808", "0.5908485", "0.5896572", "0.58813...
0.7211509
0
Returns a DiagLinearOperator with the log of all diagonal entries.
def log(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return ConstantDiagLinearOperator(self.diag_values.log(), diag_shape=self.diag_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self: Float[LinearOperator, \"*batch M N\"]) -> Float[LinearOperator, \"*batch M N\"]:\n return self.__class__(self._diag.log())", "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtyp...
[ "0.7241235", "0.6500317", "0.64255816", "0.60907876", "0.60720265", "0.5920157", "0.58842194", "0.5840215", "0.58310723", "0.5829049", "0.57868755", "0.5773242", "0.5769998", "0.5711981", "0.5700768", "0.5672088", "0.5669055", "0.5666141", "0.56578434", "0.5636742", "0.562648...
0.8074048
0
Returns a DiagLinearOperator with the square root of all diagonal entries.
def sqrt(self: Float[LinearOperator, "*batch M N"]) -> Float[LinearOperator, "*batch M N"]: return ConstantDiagLinearOperator(self.diag_values.sqrt(), diag_shape=self.diag_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diag_operator(self, diag_elements, subsystem):\n dim = subsystem.truncated_dim\n index = range(dim)\n diag_matrix = np.zeros((dim, dim), dtype=np.float_)\n diag_matrix[index, index] = diag_elements\n return self.identity_wrap(diag_matrix, subsystem)", "def get_diagonal(self...
[ "0.694708", "0.673749", "0.65112805", "0.6436449", "0.6365065", "0.63084733", "0.61383474", "0.6132893", "0.6103015", "0.60243255", "0.60231984", "0.599804", "0.59979725", "0.59738165", "0.59462583", "0.59442955", "0.5935121", "0.5913187", "0.5904583", "0.5892475", "0.5882519...
0.6747616
1
Returns an instance of the store. By default, the returned implementation is a fake cake.
def get_store(self, uri, content): doc = "My message" return FakeStore(documents={uri: content})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _teststore():\n return Store(config['server_store'][0], config['server_store'][1],\n environ={'tiddlyweb.config': config})", "def _get_store(self):\n return self._store", "def state_store(decoy: Decoy) -> StateStore:\n return decoy.mock(cls=StateStore)", "def get_store(cls):\n ...
[ "0.69159955", "0.6656949", "0.6629574", "0.6604973", "0.6275661", "0.62632316", "0.61945224", "0.61689794", "0.6116484", "0.6115566", "0.6107242", "0.60198915", "0.59674275", "0.5861831", "0.5845549", "0.58195364", "0.58195364", "0.57967466", "0.5687058", "0.56807345", "0.567...
0.6386023
4
Refresh this place using the API.
def refresh_from_api(self): self.populate_from_api(self.get_from_api())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh(self):\n resp = self._cb.get_object(self._build_api_request_uri())\n self._info = resp\n self._last_refresh_time = time.time()\n return True", "def _refresh(self):\n resp = self._cb.get_object(self._build_api_request_uri())\n self._info = resp\n self....
[ "0.6889107", "0.6889107", "0.68103015", "0.6669802", "0.6669802", "0.6669802", "0.6646054", "0.6640354", "0.65965044", "0.65345556", "0.65345556", "0.653043", "0.653043", "0.652089", "0.64585984", "0.64388835", "0.64106023", "0.6407534", "0.6363921", "0.6270581", "0.62463355"...
0.70008063
0
Return the flow cell version name.
def get_version_name(self): if self.have_metadata is False: self._get_metadata() self.have_metadata = True try: return self.keyinfo['context_tags'].attrs['version_name'] except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_name(self) -> str:\n return pulumi.get(self, \"version_name\")", "def column_version_name(self, file_path, row):\n return self.version_name", "def get_version(self):\n return self.cur_config['version']['name']", "def version_name(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.7211952", "0.6947191", "0.6741173", "0.6719258", "0.6520205", "0.63778275", "0.63663054", "0.63651246", "0.6353358", "0.63050705", "0.62706083", "0.62487555", "0.6246892", "0.6239884", "0.622161", "0.61878854", "0.61876357", "0.6175693", "0.6175693", "0.6175693", "0.617569...
0.67571115
2
Return the flow cell version name.
def get_minknow_version(self): if self.have_metadata is False: self._get_metadata() self.have_metadata = True try: return self.keyinfo['context_tags'].attrs['verssion'] except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_name(self) -> str:\n return pulumi.get(self, \"version_name\")", "def column_version_name(self, file_path, row):\n return self.version_name", "def get_version_name(self):\n\t\tif self.have_metadata is False:\n\t\t\tself._get_metadata()\n\t\t\tself.have_metadata = True\n\n\t\ttry:\n\t\...
[ "0.7211952", "0.6947191", "0.67571115", "0.6741173", "0.6719258", "0.6520205", "0.63778275", "0.63663054", "0.63651246", "0.6353358", "0.63050705", "0.62706083", "0.62487555", "0.6246892", "0.6239884", "0.622161", "0.61878854", "0.61876357", "0.6175693", "0.6175693", "0.61756...
0.0
-1
Return the flowcell's ASIC id.
def get_asic_id(self): if self.have_metadata is False: self._get_metadata() self.have_metadata = True try: return self.keyinfo['tracking_id'].attrs['asic_id'] except: return None if self.have_metadata is False: self._get_metadata() self.have_metadata = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commcell_id_hex(self):\n ccid = self._commcell_id\n if ccid == -1:\n return 'FFFFF'\n return hex(ccid).split('x')[1].upper()", "def commcell_id(self):\n return self._commcell_id", "def _ecc_id(self, ecc_type_name):\n return self.ecc_lookup[ecc_type_name]", "d...
[ "0.67637825", "0.6578249", "0.62910044", "0.62899786", "0.6213026", "0.6197097", "0.6089738", "0.60881084", "0.6003548", "0.5983827", "0.5863385", "0.58588606", "0.58065975", "0.5786458", "0.57864106", "0.5726899", "0.571094", "0.56645733", "0.56540936", "0.5632659", "0.56305...
0.5971475
10
Compares the local time and drive time. Since drive file time's timezone is not same as local time, the localization is required for comparing.
def _compare_times(drive_file_time, local_file_time): local_time_zone = get_localzone() localized_drive_file_time = drive_file_time.astimezone(local_time_zone) localized_local_file_time = local_time_zone.localize(local_file_time) if localized_drive_file_time > localized_local_file_time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_localeIndependent(self):\n # A point about three months in the past.\n then = self.now - (60 * 60 * 24 * 31 * 3)\n stat = os.stat_result((0, 0, 0, 0, 0, 0, 0, 0, then, 0))\n\n # Fake that we're in a language where August is not Aug (e.g.: Spanish)\n currentLocale = local...
[ "0.58285487", "0.576344", "0.5714645", "0.5665143", "0.55288506", "0.5506845", "0.5469439", "0.546857", "0.5324352", "0.5312388", "0.5276229", "0.5249808", "0.5142772", "0.51056725", "0.5080128", "0.5066875", "0.50503534", "0.5042963", "0.5034671", "0.5026415", "0.49861228", ...
0.88521075
0
Test dtype support of the metric on CPU.
def test_binary_hamming_distance_dtype_cpu(self, inputs, dtype): preds, target = inputs if (preds < 0).any() and dtype == torch.half: pytest.xfail(reason="torch.sigmoid in metric does not support cpu + half precision") self.run_precision_test_cpu( preds=preds, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multilabel_hamming_distance_dtype_cpu(self, inputs, dtype):\n preds, target = inputs\n if (preds < 0).any() and dtype == torch.half:\n pytest.xfail(reason=\"torch.sigmoid in metric does not support cpu + half precision\")\n self.run_precision_test_cpu(\n preds=pr...
[ "0.6671716", "0.6476288", "0.6264771", "0.626046", "0.6202559", "0.61926574", "0.61536235", "0.6057086", "0.59737873", "0.5953496", "0.59470695", "0.58799165", "0.5833545", "0.5816694", "0.57663745", "0.5754158", "0.5739324", "0.57263625", "0.5680664", "0.56737757", "0.563940...
0.6782669
0
Test dtype support of the metric on CPU.
def test_multiclass_hamming_distance_dtype_cpu(self, inputs, dtype): preds, target = inputs if (preds < 0).any() and dtype == torch.half: pytest.xfail(reason="torch.sigmoid in metric does not support cpu + half precision") self.run_precision_test_cpu( preds=preds, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binary_hamming_distance_dtype_cpu(self, inputs, dtype):\n preds, target = inputs\n if (preds < 0).any() and dtype == torch.half:\n pytest.xfail(reason=\"torch.sigmoid in metric does not support cpu + half precision\")\n self.run_precision_test_cpu(\n preds=preds,...
[ "0.678325", "0.6672251", "0.62700945", "0.62623906", "0.62049294", "0.61962974", "0.61528313", "0.60597885", "0.59755", "0.595839", "0.595094", "0.5885507", "0.5837626", "0.5814671", "0.57702476", "0.5758127", "0.57457054", "0.57253784", "0.5685141", "0.5672672", "0.5635992",...
0.6476696
2
Test dtype support of the metric on CPU.
def test_multilabel_hamming_distance_dtype_cpu(self, inputs, dtype): preds, target = inputs if (preds < 0).any() and dtype == torch.half: pytest.xfail(reason="torch.sigmoid in metric does not support cpu + half precision") self.run_precision_test_cpu( preds=preds, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binary_hamming_distance_dtype_cpu(self, inputs, dtype):\n preds, target = inputs\n if (preds < 0).any() and dtype == torch.half:\n pytest.xfail(reason=\"torch.sigmoid in metric does not support cpu + half precision\")\n self.run_precision_test_cpu(\n preds=preds,...
[ "0.6782669", "0.6476288", "0.6264771", "0.626046", "0.6202559", "0.61926574", "0.61536235", "0.6057086", "0.59737873", "0.5953496", "0.59470695", "0.58799165", "0.5833545", "0.5816694", "0.57663745", "0.5754158", "0.5739324", "0.57263625", "0.5680664", "0.56737757", "0.563940...
0.6671716
1
Initialize Backbone Model. You can choose between MobileNetV2,ResNet50 and InceptionV3.
def __init__(self, backbone_name, config): backbone_config = Schema( { Required("input_shape"): Schema((int, int, int)), Required("include_top"): bool, Required("weights"): str, Optional("alpha"): float, } ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_model(self):\r\n\r\n self.model = ResNet152V2(weights='imagenet')", "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def load_model():\r\n model = MobileNetV2(weights=\"imagenet\")\r\n print(\"Model loaded\")\r\n return model", "def init_model(s...
[ "0.7381156", "0.695697", "0.6862052", "0.6761621", "0.6749967", "0.6696608", "0.65881485", "0.6581076", "0.6463364", "0.64491016", "0.6404976", "0.63923234", "0.6387457", "0.63797295", "0.63697296", "0.6349571", "0.63468593", "0.63131875", "0.6286078", "0.6286078", "0.6284275...
0.6881998
2
Get color table lines
def get_lines(self) -> list[str]: chars = self.get_char("border") assert isinstance(chars, list) left_border, _, right_border, _ = chars lines = super().get_lines() last_line = lines.pop() for line in range(256 // self.grid_cols): buff = left_border ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ActiveHlt2Lines(self) :\n return []", "def __get_color_table(self):\n #Color: Green Yellow Orange Red Distance:\n return [[0.70, 0.15, 0.1, 0.05], # 0\n [0.17, 0.6, 0.17, 0.06], # 1\n [0.06, 0.17, 0.6, 0.17], # 2\n [0.05, 0...
[ "0.6738147", "0.67063123", "0.6629689", "0.64858073", "0.6478039", "0.6444736", "0.641455", "0.62281203", "0.61893487", "0.61785924", "0.6053854", "0.6038785", "0.59639454", "0.58735514", "0.58635545", "0.58551794", "0.58551794", "0.5845936", "0.5834347", "0.577767", "0.57517...
0.626013
7
Connect to the database with details in config file, drop existing tables in db and recreate the schema
def main(): config = configparser.ConfigParser() config.read('dwh.cfg') conn = psycopg2.connect("host={} dbname={} user={} password={} port={}".format(*config['STAGE'].values())) cur = conn.cursor() #remove the existing tables drop_tables(cur, conn) #replace the tables with new on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_db():\n drop_db()\n create_db()\n populate_db()", "def set_up_db():\n DATABASE.drop_tables([Customer])\n DATABASE.close()\n DATABASE.create_tables([Customer])\n DATABASE.close()", "def recreate_db():\n drop_db()\n create_db()", "def recreate_db():\n db.session.execu...
[ "0.732028", "0.72233063", "0.7215826", "0.7189857", "0.713639", "0.71264684", "0.70840794", "0.7071295", "0.70049983", "0.69967276", "0.6958789", "0.6914802", "0.6898435", "0.68908036", "0.68874884", "0.68874705", "0.6887435", "0.6854753", "0.684876", "0.68439156", "0.6843915...
0.6488376
79
Function to turn segmentation PREDICTION (not probabilities) to colormap.
def seg_to_colormap(seg, channels_first): h, w = seg.shape color_image = palette[seg.ravel()].reshape(h, w, 3) if channels_first: color_image = color_image.transpose(2, 0, 1) return color_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_segmap(seg_pred):\r\n pred = seg_pred.data.cpu().numpy()\r\n pred = np.argmax(pred, axis=0)\r\n img = mask2color(pred)\r\n img = np.transpose(img, (2, 0, 1)) # h, w, c -> c, h, w\r\n return img", "def create_label_colormap():\n colormap = np.array([\n [128, 64, 128],\n ...
[ "0.65141106", "0.6502614", "0.6447717", "0.64027977", "0.6382889", "0.63810605", "0.63810605", "0.6375507", "0.63453066", "0.63453066", "0.6333851", "0.6333851", "0.63313335", "0.62390023", "0.62214917", "0.6187624", "0.6022115", "0.59593135", "0.592761", "0.5927315", "0.5908...
0.63822454
5
Function to read lines from file
def read_lines_from_file(filename): with open(filename) as f: content = f.readlines() content = [x.strip() for x in content] return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_lines_from_file(fname):\n return []", "def read_lines(filename):\n with open(filename, 'r') as f:\n lines = f.readlines()\n return lines", "def __read_lines__(self):\r\n fd = open(self.input_file, \"r\")\r\n lines = fd.readlines()\r\n fd.close()\r\n return l...
[ "0.80048156", "0.79476285", "0.7920235", "0.79118335", "0.78405654", "0.7779292", "0.76865137", "0.7683207", "0.7647907", "0.7629093", "0.7583371", "0.75528365", "0.75248027", "0.75162566", "0.7499144", "0.74941", "0.7491597", "0.7390333", "0.7359436", "0.7332574", "0.7318992...
0.71976
25
Stitch together N input images into a bigger frame, using a grid layout. Input images can be either color or grayscale, but must all have the same size.
def stitch_together(input_images, layout, resize_dim=None, off_x=None, off_y=None, bg_color=(0, 0, 0)): if len(set([img.shape for img in input_images])) > 1: raise ValueError('All images must have the same shape') if len(set([img.dtype for img in input_images])) > 1: raise ValueError('All imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid(images, cols = 2, save = False, filename = \"\", show = False):\n \n rows = ceil(len(images) / cols)\n \n fig, ax = plt.subplots(rows, 1)\n\n index = 0\n element = []\n for row in range(rows):\n for col in range(cols): \n if index < len(images):\n ...
[ "0.67243683", "0.66818607", "0.6493662", "0.6477263", "0.64257956", "0.64193517", "0.6407079", "0.64040124", "0.63605505", "0.6348587", "0.63341165", "0.6215291", "0.6162206", "0.6162206", "0.6154721", "0.6152132", "0.61267614", "0.61221933", "0.61215425", "0.6120335", "0.611...
0.6265471
11
Clear stored state about this spawner (pid)
def clear_state(self): super().clear_state() self.pid = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n\t\tself._pc.gid_clear()", "def clear(self, pids=None):\r\n if pids is None:\r\n self._raw = {}\r\n self._pids = set()\r\n self._pid_to_parent = {}\r\n self._pid_to_children = defaultdict(set)\r\n self._handles = {}\r\n else:\r\n for pid, ppid in self._pid_...
[ "0.6876261", "0.6667687", "0.64866483", "0.64866483", "0.64866483", "0.648", "0.648", "0.64544106", "0.64381754", "0.6375115", "0.63458943", "0.63453615", "0.63389456", "0.633539", "0.63307095", "0.6314581", "0.63143075", "0.6281365", "0.6267901", "0.6267183", "0.6257918", ...
0.7963727
0
Get the front element.
def peek(self): self.stack.peek(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.0
-1
Returns whether the queue si empty.
def empty(self): return self.stack == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.__queue) > 0", "def ...
[ "0.9130152", "0.9125211", "0.9125211", "0.9119811", "0.90944725", "0.90389067", "0.90296763", "0.90054417", "0.89861685", "0.8965343", "0.8934758", "0.8921873", "0.8871642", "0.8826807", "0.8815041", "0.8815041", "0.8794075", "0.8793098", "0.878644", "0.866272", "0.8622614", ...
0.0
-1
This function computes the maximum total branching ratio for all decay chains. In order to make the event generation as efficient as possible when studying very rare processes, it is necessary to rescale the branching ratios, while enforcing the invariant that any total branching ratio must remain lower that unity. Thi...
def compute_max_total_br(decay_chains): # For each top-level charmed particle, sum BR over all its decay chains top_level_particles = get_top_level_particles(decay_chains) total_branching_ratios = [compute_total_br(particle, decay_chains) for particle in top_level_particles] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_total_br(particle, decay_chains):\n return sum(np.prod(branching_ratios)\n for (top, branching_ratios) in decay_chains\n if top == particle)", "def bern_max_metric(pipe_diameter, delta_p):\n\n rho = 1000 # density of water kg/m^3\n flow_rate_max = ((math.pi * (pi...
[ "0.73684853", "0.6107828", "0.5690732", "0.56471145", "0.5589155", "0.5568019", "0.55589247", "0.55043906", "0.5449422", "0.5412642", "0.5345016", "0.5325086", "0.5280849", "0.52357584", "0.5210272", "0.5209596", "0.52019876", "0.5176665", "0.51419574", "0.51407814", "0.51377...
0.8079208
0
Returns the character index of the nth occurence of the word in the sentence.
def find_nth(sentence, word, n): start = sentence.find(word) while start >= 0 and n > 1: start = sentence.find(word, start+len(word)) n -= 1 return start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nth_word(value: str, n: int) -> str:\n return value.split()[n]", "def get_word_with_index(index):\n return reverse_word_index[index-3]", "def index(self, word):\n return self.tokens.index(word)", "def words_before_index(text, idx):\n while text[idx] != ' ':\n idx -= 1\n if idx <...
[ "0.705064", "0.69660586", "0.6464716", "0.6362853", "0.63461655", "0.62787044", "0.6254428", "0.6253345", "0.6225773", "0.62244374", "0.6200625", "0.6121787", "0.61014897", "0.60938895", "0.6013942", "0.59505993", "0.5944006", "0.59086907", "0.5855237", "0.581475", "0.5809829...
0.77595973
0
Tests that you can't delete other users' posts with URL fiddling
def test_post_delete_security(client_with_identity: Client, other_identity: Identity): other_post = Post.objects.create( content="<p>OTHER POST!</p>", author=other_identity, local=True, visibility=Post.Visibilities.public, ) response = client_with_identity.get(other_post.urls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_post_by_user(self):\n\n response = self.client.delete(reverse('api:posts-detail', kwargs={'pk': self.post1.id}))\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def test_delete_post_by_another_user(self):\n url = reverse(\n 'post-detail',\n ...
[ "0.8208299", "0.8114492", "0.79751694", "0.7843181", "0.78409946", "0.7754379", "0.7745481", "0.75700957", "0.75560427", "0.7515503", "0.74672747", "0.7460908", "0.7412757", "0.73942906", "0.73083794", "0.7228", "0.7173662", "0.7141673", "0.7057188", "0.69670767", "0.6958661"...
0.75432026
9
Sets the group_name_hierarchy of this SiteResultResponseSites.
def group_name_hierarchy(self, group_name_hierarchy): self._group_name_hierarchy = group_name_hierarchy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_group(group_name):\n group_config = env.groups[group_name]\n set_role_defs(\n web=group_config['servers'][WEB_ROLE],\n db=group_config['servers'][DB_ROLE],\n )\n env.branch = group_config['branch']\n env.subdomain = group_config.get('subdomain', 'www')", "def set_group(self, ...
[ "0.56719595", "0.5584561", "0.5522971", "0.5500457", "0.53528905", "0.5219639", "0.5185531", "0.5185531", "0.5185531", "0.5170963", "0.51456976", "0.51368934", "0.51282656", "0.51282656", "0.51282656", "0.51282656", "0.50668585", "0.50560194", "0.50525296", "0.49959296", "0.4...
0.7295185
0
Sets the display_name of this SiteResultResponseSites.
def display_name(self, display_name): self._display_name = display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)", "def display_name(self, display_name: str):\n\n self._display_name = display_name", "def display_name(self, display_name):\n self._display_name = display_name", "def display_name(self,...
[ "0.73971456", "0.7200667", "0.70525426", "0.70525426", "0.70525426", "0.70525426", "0.70525426", "0.70525426", "0.6648977", "0.63822395", "0.62211627", "0.6116397", "0.57078433", "0.56725144", "0.5658176", "0.56475", "0.5630316", "0.56160104", "0.55197483", "0.5434004", "0.54...
0.71440554
3
Sets the name of this SiteResultResponseSites.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def set_name(self, name: str):\n json = {**self.get_data(), \"name\": name}\n return await self.easee.put(f\"/api/sites/{self.id}\", json=json)", "def setResultsName(self, name, **kwargs):\n self.structure.set_name(name)\n return self", "def setResultsName(self, name, **kwargs...
[ "0.6997884", "0.69687814", "0.6724042", "0.62193173", "0.6187104", "0.60372585", "0.5897413", "0.5883381", "0.58808804", "0.58058536", "0.5787922", "0.5787922", "0.5787922", "0.5787922", "0.5787922", "0.57711226", "0.5749117", "0.5732986", "0.56869966", "0.56833947", "0.56801...
0.5262232
96