query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the target_tensors argumen...
def target_tensors(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def targets(self) -> Tensor:\n data_normalized = self._dataset_values.clone()\n data_normalized -= self._row_min\n data_normalized /= self._row_range\n _, outputs_normalized_transformed = self._transform(\n data_normalized[:, self._input_column_indices],\n data_nor...
[ "0.5898726", "0.565797", "0.55954695", "0.55766785", "0.555807", "0.5468719", "0.53791976", "0.5375494", "0.53694284", "0.53404087", "0.53404087", "0.53265506", "0.5286209", "0.52710843", "0.52633405", "0.5224834", "0.5223838", "0.52131724", "0.5201254", "0.51955396", "0.5181...
0.63880855
0
Tests settings proxies creation and dereferencing
def test_settings_proxies_creation() -> None: settings = Settings() settings_proxy = settings.create_proxy() # We have one proxy assert len(settings._proxies) == 1 second_proxy = settings.create_proxy() # Now we have two proxies assert len(settings._proxies) == 2 # We are creating the third...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_settings_proxy_properties_setting(parameters: Dict[str, Any]) -> None:\n settings = Settings()\n settings_proxy = settings.create_proxy()\n\n for key, value in parameters.items():\n if isinstance(value, (int, float)):\n assert settings.__getattribute__(key) == settings_proxy.__g...
[ "0.70535135", "0.69610393", "0.6671404", "0.6658353", "0.6654484", "0.6590051", "0.6590051", "0.6581018", "0.6452413", "0.6448714", "0.62878704", "0.6280929", "0.6219918", "0.6213459", "0.62046504", "0.6198726", "0.61963135", "0.61654794", "0.61559033", "0.6146009", "0.612649...
0.7889519
0
Returns sorted string permutations >>> solve('hat') 'aht,ath,hat,hta,tah,tha' >>> solve('Zu6') '6Zu,6uZ,Z6u,Zu6,u6Z,uZ6' >>> solve('abc') 'abc,acb,bac,bca,cab,cba'
def solve(in_str): return ','.join(sorted(imap(lambda x: ''.join(x),permutations(in_str))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutation(s):\n if len(s) == 1:\n return [s]\n result = []\n first = s[0]\n ss = s[1:]\n pers = permutation(ss)\n for p in pers:\n for i in range(0,len(p)):\n result.append(p[:i]+first+p[i:])\n return result", "def permute(s):\n output = []\n if len(s) <=...
[ "0.661948", "0.6591128", "0.63372636", "0.62420875", "0.61537945", "0.61418396", "0.6108773", "0.61023647", "0.59346366", "0.59056646", "0.58466256", "0.57606375", "0.57452804", "0.57302254", "0.5710946", "0.56997097", "0.56990546", "0.5698452", "0.56910104", "0.5674147", "0....
0.82966363
0
reconstruct a sg from a scene json file
def recon_sg2(json_file_dir, if_add_bases=True): id2color = { "gray": [87, 87, 87], "red": [173, 35, 35], "blue": [42, 75, 215], "green": [29, 105, 20], "brown": [129, 74, 25], "purple": [129, 38, 192], "cyan": [41, 208, 208], "yellow": [255, 238, 51],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utt_to_scene(file_name):\n with open(file_name, 'r') as file:\n data = file.readlines()\n data = [line.strip().split() for line in data if line.strip() != '']\n data = [[line[0], \" \".join(line[1:])] for line in data]\n preproc_data = [[line[0], list(map(lambda x: x[:x.find(\":\...
[ "0.62307423", "0.61761534", "0.60450804", "0.5899949", "0.57367736", "0.57106173", "0.5701228", "0.5658538", "0.560505", "0.55704886", "0.5564936", "0.55112326", "0.54868126", "0.548616", "0.54856515", "0.54752856", "0.54382986", "0.5383373", "0.5370884", "0.5354638", "0.5324...
0.6196547
1
reconstruct a sg from object names and coordinates
def recon_sg(obj_names, locations, if_return_assigns=False, if_add_bases=True): location_dict = {} objects = [] if type(locations) == torch.Tensor: locations = locations.cpu().numpy() elif isinstance(locations, list): locations = np.array(locations) locations = locations.reshape(-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _construct_new_2d_object(new_xp,\n half_w,\n new_yp,\n half_l):\n\n new_x1 = float(new_xp - half_w)\n new_x2 = float(new_xp + half_w)\n new_y1 = float(new_yp - half_l)\n new_y2 = float(new_yp + half_l)\n\n new_ob...
[ "0.549307", "0.54439116", "0.54079205", "0.53954226", "0.5255821", "0.5238671", "0.5142048", "0.5113373", "0.510141", "0.50817597", "0.5079542", "0.50776017", "0.506408", "0.50393265", "0.502448", "0.50152045", "0.50018567", "0.49921232", "0.49887058", "0.4985654", "0.4964762...
0.6250433
0
returns an empty cuboidal room with source and mic somewhat in center
def empty_room(): room_material = pra.Material(energy_absorption=0.6, scattering=None) room_faces = make_polygon( centre=[0,0,2.5], radius=10, height=5, N=4, rpy=[0,0,np.pi/4] ) # create room walls = [] walls.extend(create_walls(room_faces, room_material)) room = pra.Room(walls, fs=fs, max_order=3, r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_room(config):\n room = np.zeros((3,))\n room[0] = get_sample(config['length'], n_sample=1)[0]\n room[1] = get_sample(config['width'], n_sample=1)[0]\n room[2] = get_sample(config['height'], n_sample=1)[0]\n return room", "def zeros(self):\n super(TimeCube, self).zeros()\n self.dat...
[ "0.5908637", "0.56457776", "0.5444895", "0.5426376", "0.5395292", "0.5354499", "0.5339258", "0.52996683", "0.5294323", "0.5251623", "0.52373815", "0.51490283", "0.51358646", "0.5119024", "0.50912035", "0.5087778", "0.5083692", "0.5081936", "0.50569177", "0.5044609", "0.50421"...
0.6427652
0
Returns cuboidal room with box
def room_with_box(): room_material = pra.Material(energy_absorption=0.6, scattering=None) room_faces = make_polygon( centre=[0,0,2.5], radius=10, height=5, N=4, rpy=[0,0,np.pi/4] ) # define obstacle obstacle_faces = make_polygon( centre=[2.5,0,2.5], radius=1.8, height=3, N=4, rpy=[0,0,np.pi/4]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box(x, y, z):\n global _cmds\n _cmds = (f\"cube({[x,y,z]},\"\n f\"center=false);\\n\\n\") + _cmds", "def cuboid(geometry,\n network,\n propname,\n **params):\n print('cuboid: nothing yet')", "def genCubes():\n offset = vpy.vector(.5, .5, .5)\n ...
[ "0.6676445", "0.6549599", "0.6418574", "0.6388707", "0.63560385", "0.63021725", "0.6228042", "0.62078243", "0.6170989", "0.6027921", "0.60269403", "0.6023139", "0.6019739", "0.5979369", "0.59714824", "0.59581614", "0.59423727", "0.5935897", "0.5934828", "0.59304893", "0.58903...
0.7044862
0
Returns empty room with walls of different materials
def empty_diff_walls(): # 4 side walls are absorptive room_materials = [pra.Material(energy_absorption=0.1, scattering=None)] * 4 # floor and ceiling are reflective room_materials.extend([pra.Material(energy_absorption=0.98, scattering=None)] * 2) room_faces = make_polygon( centre=[0,0,2.5], radius=10, hei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_room():\n\troom_material = pra.Material(energy_absorption=0.6, scattering=None)\n\troom_faces = make_polygon(\n\t\tcentre=[0,0,2.5],\n\t\tradius=10,\n\t\theight=5,\n\t\tN=4,\n\t\trpy=[0,0,np.pi/4]\n\t)\n\n\t# create room\n\twalls = []\n\twalls.extend(create_walls(room_faces, room_material))\n\n\troom = p...
[ "0.8141561", "0.66774863", "0.66051066", "0.65975714", "0.6447375", "0.64353395", "0.6392355", "0.6391305", "0.63583034", "0.6332799", "0.6323636", "0.63046914", "0.62797344", "0.62634623", "0.61977875", "0.6187254", "0.61689997", "0.6131876", "0.61124665", "0.6069279", "0.59...
0.79700404
1
Return number of complementary regions of train track.
def num_complementary_regions(self): g = self._get_puncturefinder_graph() # return g.connected_components_number() return nx.number_connected_components(g)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contours_number(self):\n ncontour = len(self.x)\n logger.info(\"Number of contours: {0}\".format(ncontour))\n return ncontour", "def number_of_new_components(self):\n t_low = self.lower_binary_tree().to_tilting()\n t_up = self.upper_binary_tree().to_tilting()\n r...
[ "0.621802", "0.61952245", "0.61242294", "0.58201116", "0.57810885", "0.5775374", "0.57539856", "0.5722044", "0.5713514", "0.5689252", "0.56840074", "0.56836957", "0.5657429", "0.56544477", "0.5639411", "0.5637723", "0.5621052", "0.560351", "0.56030804", "0.55957466", "0.55931...
0.748708
0
Return the boundary paths of complementary regions. The region is on the right side of the paths.
def complementary_regions(self): g = self._get_puncturefinder_graph() # return g.connected_components() return list(nx.connected_components(g))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundary_polygon_by_edges(self):\n lines=self.boundary_linestrings()\n polys=join_features.lines_to_polygons(lines,close_arc=False)\n if len(polys)>1:\n raise GridException(\"somehow there are multiple boundary polygons\")\n return polys[0]", "def boundary_polygon(self)...
[ "0.609764", "0.60245264", "0.58544064", "0.5849384", "0.57595223", "0.57295775", "0.56954753", "0.5641807", "0.5619031", "0.55793244", "0.5564037", "0.5553801", "0.55465585", "0.554616", "0.545568", "0.54502296", "0.5446974", "0.5438838", "0.5392316", "0.53638506", "0.5322585...
0.6510515
0
Return the surface that is regular neighborhood of ``self``.
def regular_neighborhood(self): euler_char = self.num_switches() - self.num_branches() return Surface(num_punctures=self.num_complementary_regions(), euler_char=euler_char)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface(self):\n return self._surface", "def getSurfAlongZ(self):\n\n return self._surf", "def wireframe_only(self):\n return self._wireframe_only", "def get_surface(self, new: bool = True) -> 'pygame.Surface':\n if new:\n return self.get_crop_rect(self.get_rect())\...
[ "0.61511374", "0.606822", "0.59080124", "0.5831154", "0.5789176", "0.5744674", "0.5698036", "0.56867176", "0.568455", "0.56453556", "0.5628502", "0.5598237", "0.55960137", "0.55879205", "0.55872387", "0.5559835", "0.55027723", "0.5469857", "0.54697555", "0.54540193", "0.54479...
0.7588659
0
Return the number of cusps for each complementary region.
def num_cusps_of_regions(self): G = self._get_puncturefinder_graph() # return [sum(G.subgraph(vertices=region).edge_labels()) # for region in G.connected_components()] return [sum(edge[2]['weight'] for edge in subgraph.edges(data=True)) for subgrap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_complementary_regions(self):\n g = self._get_puncturefinder_graph()\n # return g.connected_components_number()\n return nx.number_connected_components(g)", "def n_cs(self):\n return np.size(self._cs, 0)", "def ncusps(self):\n n = self.level()\n return sum([arit...
[ "0.76018685", "0.69323325", "0.6927314", "0.6893569", "0.643692", "0.6348874", "0.62144196", "0.61052084", "0.61034214", "0.6092677", "0.6069627", "0.6052347", "0.5982089", "0.597497", "0.59650195", "0.5963505", "0.59482235", "0.5927196", "0.5901739", "0.58945924", "0.5891758...
0.7510573
1
Return a graph to determine recurrence.
def _get_recurrence_graph(self): try: return self._recurrence_graph except AttributeError: pass # g = DiGraph() g = nx.DiGraph() for i in range(self.num_switches()): for ii in {-i-1, i+1}: g.add_edges_from([(j, -k) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recurrence(self):\n return self.__recurrence", "def recurrence(self):\n if \"recurrence\" in self._prop_dict:\n if isinstance(self._prop_dict[\"recurrence\"], OneDriveObjectBase):\n return self._prop_dict[\"recurrence\"]\n else :\n self._prop_...
[ "0.65752923", "0.5953535", "0.5814856", "0.5806418", "0.58059746", "0.5798361", "0.5738831", "0.57215935", "0.5717185", "0.5680185", "0.5680185", "0.5676411", "0.5653283", "0.56387323", "0.56341726", "0.5588331", "0.5572233", "0.557046", "0.5558288", "0.55452794", "0.55316305...
0.7925507
0
Test if ``self`` is recurrent. A train track is recurrent if it admits a strictly positive measure. Equivalently, it is recurrent, if it is possible to get from any branch to any other branch (not necessarily in both directions) along train paths.
def is_recurrent(self): G = self._get_recurrence_graph() # C = G.strongly_connected_components() first_component = next(nx.strongly_connected_components(G)) abs_numbers = {abs(x) for x in first_component} # return sorted(list(set([abs(x) for x in C[0]]))) == \ # range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recurrent(self):\n if isinstance(self.network, BaseRNN):\n return True\n else:\n return False", "def recurrent(self):\n return False", "def is_cyclically_reduced(self):\n if not self:\n return True\n return self[0] != self[-1]**-1", "def...
[ "0.70996857", "0.6100841", "0.5575293", "0.5572439", "0.55266136", "0.5422163", "0.53721553", "0.5236663", "0.52052224", "0.52017254", "0.5199006", "0.5194531", "0.5170744", "0.5151156", "0.51300734", "0.5124644", "0.50830173", "0.50633717", "0.5056852", "0.5052298", "0.50262...
0.65484834
1
Find the course location of an input psf by finding the brightest checkbox. This function uses a 2 dimensional image as input, and finds the the brightest checkbox of given size in the image.
def checkbox_2D(image, checkbox, debug=False): # Calculate the checkbox half-width chw = (checkbox - 1) / 2 # Calculate the image size xsize, ysize = image.shape[1], image.shape[0] # Calculate the x and y widths of checkbox region xwidth, ywidth = xsize - checkbox + 1, ysize - che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_1D(image, checkbox, debug=False):\n \n # Collapse input image, currently onto X axis\n # Reshape to reflect collapse onto x axis\n vector = np.sum(image, axis=0)\n print('(checkbox_1D): Image collapsed into 1D vector.')\n print()\n \n # Calculate the checkbox half-width\n ch...
[ "0.66205657", "0.56624645", "0.56198984", "0.5569849", "0.5483061", "0.5444478", "0.543192", "0.53851235", "0.5374986", "0.5329282", "0.5318074", "0.5252045", "0.5229608", "0.5215915", "0.5213296", "0.5213153", "0.5213153", "0.5213136", "0.51987267", "0.5176628", "0.5176628",...
0.6849945
0
Find the course location of an flattened input psf by finding the brightest checkbox. This function uses an image as input, flattens it into a vector and finds the the brightest checkbox of given size in the image.
def checkbox_1D(image, checkbox, debug=False): # Collapse input image, currently onto X axis # Reshape to reflect collapse onto x axis vector = np.sum(image, axis=0) print('(checkbox_1D): Image collapsed into 1D vector.') print() # Calculate the checkbox half-width chw = (checkbox ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_2D(image, checkbox, debug=False):\n \n # Calculate the checkbox half-width\n chw = (checkbox - 1) / 2\n \n # Calculate the image size\n xsize, ysize = image.shape[1], image.shape[0]\n \n # Calculate the x and y widths of checkbox region\n xwidth, ywidth = xsize - checkbox + ...
[ "0.6801461", "0.55033886", "0.55019563", "0.54685766", "0.5424752", "0.53917885", "0.5366351", "0.5366351", "0.5352218", "0.52790505", "0.5261697", "0.52307206", "0.52187544", "0.52073383", "0.51733804", "0.5172248", "0.51645684", "0.5158878", "0.51432467", "0.51419896", "0.5...
0.69018906
0
Fine location of the target by calculating the centroid for the region centered on the brightest checkbox. Performs the centroid calculation on the checkbox region calculated using the function checkbox_2D().
def centroid_2D(image, checkbox_center, checkbox_halfwidth, max_iter=0, threshold=0, debug=False): # First calculate centroid to use for the first iteration c_sum = 0 xsum = 0 ysum = 0 convergence_flag = 'N/A' # Unpack the checkbox_center and checkbox_halfwidth into # their a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_1D(image, checkbox, debug=False):\n \n # Collapse input image, currently onto X axis\n # Reshape to reflect collapse onto x axis\n vector = np.sum(image, axis=0)\n print('(checkbox_1D): Image collapsed into 1D vector.')\n print()\n \n # Calculate the checkbox half-width\n ch...
[ "0.63599515", "0.63562965", "0.62887686", "0.62374955", "0.6117501", "0.60575074", "0.60160685", "0.59349656", "0.5921528", "0.59124064", "0.5907163", "0.5869538", "0.58653986", "0.57672626", "0.57584727", "0.5742122", "0.57366914", "0.57219857", "0.57219857", "0.5709737", "0...
0.76711303
0
Calculate the higher moments of the object in the image. Find the normalized squared and cubed moments with reference to an origin at the centroid, using the centroid and and sum values calculatated previously.
def find2D_higher_moments(image, centroid, halfwidths, c_sum): # Unpack centroid to seperate values xcen, ycen = np.floor(centroid) xhw, yhw = halfwidths xmoment2 = 0 xmoment3 = 0 ymoment2 = 0 ymoment3 = 0 # Set up x and y centroid scanning ranges x_range = np.arra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find1D_higher_moments(image, xcen, xhw, c_sum):\n \n # Collapse input image unto x axis\n vector = np.sum(image, axis=0)\n \n xmoment2 = 0.0\n xmoment3 = 0.0\n \n # Set up x and y centroid scanning ranges\n x_range = np.array((np.floor(xcen - xhw) - 1, np.ceil(xcen + xhw) - 1))\n\n ...
[ "0.6681578", "0.600257", "0.5924344", "0.5806046", "0.578322", "0.5735648", "0.5720438", "0.57188725", "0.5675963", "0.56692505", "0.56374645", "0.56374645", "0.5587799", "0.5568614", "0.5558758", "0.55336404", "0.55336404", "0.55277026", "0.5523867", "0.5521471", "0.5500428"...
0.74053806
0
Calculate the higher moments of the object in the image. Find the normalized squared and cubed moments with reference to an origin at the centroid, using the centroid and and sum values calculatated previously.
def find1D_higher_moments(image, xcen, xhw, c_sum): # Collapse input image unto x axis vector = np.sum(image, axis=0) xmoment2 = 0.0 xmoment3 = 0.0 # Set up x and y centroid scanning ranges x_range = np.array((np.floor(xcen - xhw) - 1, np.ceil(xcen + xhw) - 1)) for ii in xran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find2D_higher_moments(image, centroid, halfwidths, c_sum):\n \n # Unpack centroid to seperate values\n xcen, ycen = np.floor(centroid)\n xhw, yhw = halfwidths\n \n xmoment2 = 0\n xmoment3 = 0\n ymoment2 = 0\n ymoment3 = 0\n \n # Set up x and y centroid scanning ranges\n ...
[ "0.7405449", "0.60013694", "0.5921748", "0.58050823", "0.5781569", "0.5734265", "0.5720013", "0.5717238", "0.5676586", "0.5669695", "0.5635732", "0.5635732", "0.55874103", "0.5567119", "0.555904", "0.5532004", "0.5532004", "0.5526069", "0.5523735", "0.5521724", "0.54989535", ...
0.6681457
1
Iterates over the unknown items in each term, checks if they have become numeric, i.e. have a value now whereas they previously didn't. If so, updates the constant factor by multiplying it with the newly determined value and removes it from the unknowns.
def update(self): terms_toRemove = [] for termIndex, [term_constantFactor, term_unknowns_attributeAddresses] in enumerate(self.LHS): # Check if coefficient is 0 - then no need to process any of the unknowns since term will be 0 anyways if term_constantFactor == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_unknowns(self):\n for label in self.words_labels_counts:\n for word in self.words_labels_counts[label]:\n if self.words_labels_counts[label][word] <= self.UNKNOWN_TOKEN_THRESHOLD:\n self.words_labels_counts[label][self.UNKNOWN_TOKEN] += self.words_labe...
[ "0.5276544", "0.5141085", "0.5104796", "0.5103461", "0.50599724", "0.50108856", "0.5003846", "0.49739787", "0.49336976", "0.49155074", "0.49132082", "0.48991868", "0.48374784", "0.4828213", "0.48211414", "0.4781902", "0.47690916", "0.475525", "0.47551218", "0.474309", "0.4731...
0.61236215
0
Returns a dictionary representation of the equation. Each unknown is a key, and the matching values are their coefficients. RHS (i.e. all constant terms) are tagged with the 'RHS' key.
def get_asDict(self): dictRepresentation = {} for [term_constantFactor, term_unknowns_attributeAddresses] in self.LHS: term_unknowns_attributeAddresses_key = tuple(term_unknowns_attributeAddresses) assert term_unknowns_attributeAddresses_key not in dictRepresentation, 'PrgError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearize(self, params, unknowns, resids):\n\n x = params['x']\n a = self.a\n b = self.b\n J = {}\n\n J['y', 'x'] = 2.0*a*x + b\n return J", "def linearize(self, params, unknowns, resids):\n\n x = hash(params['x'])\n y = params['y']\n J = {}\n\n ...
[ "0.586238", "0.5818951", "0.5657222", "0.56080526", "0.55192053", "0.5433741", "0.54323214", "0.5415554", "0.5337335", "0.5325749", "0.531823", "0.5238016", "0.5237405", "0.5228737", "0.521135", "0.5207039", "0.5191282", "0.5167047", "0.5164668", "0.51615524", "0.51598066", ...
0.75358605
0
Updates the LinearEquations in the list equations if equation contains an unknown from the list updatedUnknowns. Updated all equations if updateAll.
def updateEquations(equations: List, updatedUnknowns: Set, updateAll: bool = False): for equation in equations: if updateAll or any(unknown in equation.get_unknowns() for unknown in updatedUnknowns): equation.update() updatedUnknowns = set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_solvableEquations(equations: List):\n solvedEquations = []\n updatedUnknowns = set()\n\n for equation in equations:\n equation.update()\n if equation.isSolvable():\n solution = equation.solve()\n unknownAddress = list(solution.keys())[0]\n setattr_f...
[ "0.71400636", "0.5981026", "0.5746874", "0.57122636", "0.56178534", "0.5491521", "0.53655064", "0.53652704", "0.53611565", "0.53611565", "0.5353377", "0.52511984", "0.524344", "0.5169635", "0.51264143", "0.5035766", "0.5034198", "0.49286285", "0.49235213", "0.49235213", "0.48...
0.861441
0
Solves the solvable LinearEquations in equations and returns the newly solved unknowns in the updatedUnknowns set.
def solve_solvableEquations(equations: List): solvedEquations = [] updatedUnknowns = set() for equation in equations: equation.update() if equation.isSolvable(): solution = equation.solve() unknownAddress = list(solution.keys())[0] setattr_fromAddress(obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_combination_ofEquations(equations: List, number_ofEquations: int) -> Set:\n updatedUnknowns = set()\n\n for equationCombination in combinations(equations, number_ofEquations):\n\n # If any of the equations got solved in a previous iteration and got removed from _equations, skip this combinat...
[ "0.70187455", "0.69558996", "0.69558996", "0.6913716", "0.6836692", "0.6721397", "0.668759", "0.6643494", "0.6503861", "0.6311069", "0.6079616", "0.6071727", "0.60672903", "0.5963581", "0.5963581", "0.59088594", "0.59088594", "0.58770156", "0.5818542", "0.5798993", "0.5780101...
0.78649527
0
Iterates through combinations of equations (from the equations pool) with the specified number_ofEquations. For each combination, checks if the system is solvable. If so, solves it, assigns the unknowns the solution values and removes the solved equations from the _equations pool.
def solve_combination_ofEquations(equations: List, number_ofEquations: int) -> Set: updatedUnknowns = set() for equationCombination in combinations(equations, number_ofEquations): # If any of the equations got solved in a previous iteration and got removed from _equations, skip this combination ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_solvableEquations(equations: List):\n solvedEquations = []\n updatedUnknowns = set()\n\n for equation in equations:\n equation.update()\n if equation.isSolvable():\n solution = equation.solve()\n unknownAddress = list(solution.keys())[0]\n setattr_f...
[ "0.6905477", "0.6124301", "0.6108061", "0.591164", "0.5895522", "0.5372257", "0.536119", "0.5250545", "0.5245906", "0.52004254", "0.51897514", "0.51829034", "0.5087571", "0.50711465", "0.50709516", "0.50574046", "0.5053622", "0.50343215", "0.50048316", "0.4997917", "0.4987222...
0.8106124
0
get content from url images to download it next
def get_content(url): img=requests.get(url).content return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_url_images(session, url):\n content = await get_page(session, url)\n if not content:\n return []\n soup = BeautifulSoup(content, features=\"html.parser\")\n image_sources = [img['src'] for img in soup.find_all('img')]\n image_sources_fixed = [f'https:{source}' if 'https:' not in...
[ "0.74554664", "0.7305587", "0.72142935", "0.7059712", "0.7036332", "0.70010024", "0.7000979", "0.69411886", "0.6839603", "0.6806571", "0.6789045", "0.6769762", "0.67669344", "0.67415214", "0.6739915", "0.67326695", "0.6728846", "0.6691945", "0.66686773", "0.6667633", "0.66651...
0.7497507
0
Test copy and pickle.
def test_copy_pickle(self): # Test that we can pickle and unpickle # We force a pattern that contains all custom types: # `Selector`, `NullSelector`, `SelectorTag`, `SelectorAttribute`, # `SelectorNth`, `SelectorLang`, `SelectorList`, and `Namespaces` p1 = sv.compile( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__pickle_unpickle(self):\n pass", "def test_clone_scenario(self):\n pass", "def test_self_write(self):\n self.assertFalse(os.path.exists(self.f1))\n self.assertFalse(os.path.exists(self.f2))\n self.sync.pickle_write()\n self.assertTrue(os.path.exists(self.f1))\...
[ "0.74684554", "0.6731694", "0.6722892", "0.67018497", "0.6625926", "0.649761", "0.64614326", "0.64460385", "0.6438617", "0.6370284", "0.6349577", "0.633919", "0.6325789", "0.6300349", "0.62820846", "0.62548345", "0.6244965", "0.621606", "0.612267", "0.607975", "0.60563904", ...
0.73475975
1
Test invalid pseudo class.
def test_invalid_pseudo(self): with self.assertRaises(NotImplementedError): sv.compile(':before') with self.assertRaises(SyntaxError): sv.compile(':nth-child(a)')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_pseudo_open(self):\n\n with self.assertRaises(SyntaxError):\n sv.compile(':is(div')", "def test_invalid_pseudo_close(self):\n\n with self.assertRaises(SyntaxError):\n sv.compile('div)')\n\n with self.assertRaises(SyntaxError):\n sv.compile(':...
[ "0.68971527", "0.6783288", "0.64454436", "0.6112505", "0.6026437", "0.5795469", "0.57921946", "0.57608944", "0.57498455", "0.5723173", "0.5720089", "0.56820285", "0.5644386", "0.56317127", "0.5618471", "0.5617376", "0.5591648", "0.5563214", "0.55580693", "0.55521137", "0.5547...
0.7125582
0
Test invalid pseudo close.
def test_invalid_pseudo_close(self): with self.assertRaises(SyntaxError): sv.compile('div)') with self.assertRaises(SyntaxError): sv.compile(':is(div,)')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCloseFail(t, env):\n c = env.c1\n c.init_connection()\n fh, stateid = c.create_confirm(t.code)\n ops = c.use_obj(fh)\n ops += [c.close_op(c.get_seqid(t.code)+1, stateid)]\n _replay(c, ops, NFS4ERR_BAD_SEQID)", "def test_ignore_close():\n try:\n yield\n except GeneratorExit:...
[ "0.680997", "0.6563538", "0.65439314", "0.64253104", "0.62412703", "0.6232089", "0.61920905", "0.6143005", "0.61108303", "0.606794", "0.6032187", "0.6032187", "0.59965396", "0.5996407", "0.5931704", "0.59279484", "0.5927667", "0.5872422", "0.5868556", "0.5859582", "0.5855965"...
0.6680395
1
Send command at address to HL2, cmd may be bytes or number. Returns a response.
def command(self,addr,cmd): if isinstance(cmd,int): cmd = struct.pack('!L',cmd) res = self._send(bytes([0xef,0xfe,0x05,addr<<1])+cmd) if res: self.wrcache[addr] = cmd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_telnet_command(self, cmd):\n data = bytes(cmd)\n self.send_to_client(data)", "def send_command(self, cmd):\n\n\t\tself.eyetribe._connection.request(cmd)", "def SEND_cmd(self, cmd):\n\n # check for pending command results to be retrieved\n if self.recwaiting != 0: \n ...
[ "0.73290044", "0.687813", "0.6716656", "0.67163163", "0.6493919", "0.6450437", "0.6449417", "0.6435877", "0.63993514", "0.63926345", "0.6376549", "0.6374566", "0.6362477", "0.63120687", "0.6233574", "0.62273973", "0.6221301", "0.6218935", "0.6216378", "0.6206575", "0.62015694...
0.7104647
1
Set buffer latency and ptt hang time in ms.
def config_txbuffer(self,latency=10,ptt_hang=4): cmd = bytes([0x00,0x00,int(ptt_hang)&0x1f,int(latency)&0x7f]) return self.command(0x17,cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inc_latency(self, *_, **__): # pylint: disable=arguments-differ\n pass", "async def async_set_latency(self, latency):\n await self._client.set_latency(latency)\n self.async_write_ha_state()", "def _init_timeouts(self):\n cur_time = time()\n self._chunk_time = cur_time\n ...
[ "0.6061889", "0.5883974", "0.5868308", "0.5705283", "0.56552017", "0.5610477", "0.54945177", "0.54630864", "0.5459672", "0.54183984", "0.53861696", "0.5385074", "0.53232306", "0.53059715", "0.52688515", "0.5237016", "0.52125376", "0.51865286", "0.5185032", "0.5175649", "0.515...
0.7190556
0
Enable CL2 output, copy of clock to AD9866.
def enable_cl2_copy_ad9866(self): self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V self.write_versa5(0x2c,0x01) ## Enable aux output on clock 1 self.write_versa5(0x31,0x0c) ## Use clock1 aux output as input for clock2 self.write_versa5(0x63,0x01) ## Enable clock2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_cl2(self):\n self.write_versa5(0x31,0x80) ## Disable divider output for clock2\n self.write_versa5(0x63,0x00) ## Disable clock2 output", "def enable_cl2_61p44(self):\n self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V\n self.write_versa5(0x2c,0x00) ## Disable aux output on clock 1...
[ "0.7833633", "0.74575394", "0.7012131", "0.6946339", "0.66515845", "0.66254556", "0.6489273", "0.6157492", "0.60730433", "0.595916", "0.59293306", "0.5682851", "0.56691897", "0.5629112", "0.56212586", "0.55156344", "0.54842496", "0.5464774", "0.5436226", "0.54299486", "0.5396...
0.83531237
0
Disable CL2 clock output
def disable_cl2(self): self.write_versa5(0x31,0x80) ## Disable divider output for clock2 self.write_versa5(0x63,0x00) ## Disable clock2 output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_output(self):\n\n self.__rtcconfig = self.__helper.updatebyte(self.__rtcconfig, 7, 0)\n self.__rtcconfig = self.__helper.updatebyte(self.__rtcconfig, 4, 0)\n self.__bus.write_byte_data(\n self.__rtcaddress, self.CONTROL, self.__rtcconfig)\n return", "def disable...
[ "0.6932594", "0.69154507", "0.66963387", "0.6469269", "0.6422932", "0.62550884", "0.6240097", "0.6142875", "0.6009278", "0.5959486", "0.59415823", "0.5938613", "0.5936487", "0.5925635", "0.5921237", "0.5806834", "0.5805442", "0.580352", "0.5793692", "0.5790586", "0.57899404",...
0.8451922
0
Enable CL2 output at 61.44MH
def enable_cl2_61p44(self): self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V self.write_versa5(0x2c,0x00) ## Disable aux output on clock 1 self.write_versa5(0x31,0x81) ## Use divider for clock2 ## VCO multiplier is shared for all outputs, set to 68 by firmware ## VCO = 38.4*68 = 2611.2 MHz ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_cl2_copy_ad9866(self):\n self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V\n self.write_versa5(0x2c,0x01) ## Enable aux output on clock 1\n self.write_versa5(0x31,0x0c) ## Use clock1 aux output as input for clock2\n self.write_versa5(0x63,0x01) ## Enable clock2", "def disable_cl2(s...
[ "0.7363293", "0.7133375", "0.6799634", "0.6786987", "0.66550547", "0.59399265", "0.5891924", "0.5827261", "0.5815432", "0.57599264", "0.574008", "0.56148237", "0.5605408", "0.5511515", "0.5497506", "0.54570615", "0.54495126", "0.54291975", "0.53969467", "0.5371264", "0.537126...
0.7136829
1
Pass CL1 input directly with buffering to AD9866
def enable_cl1_direct(self): self.write_versa5(0x17,0x02) ## Change top multiplier to 0x22 self.write_versa5(0x18,0x20) self.write_versa5(0x10,0xc0) ## Enable xtal and clock self.write_versa5(0x13,0x03) ## Switch to clock self.write_versa5(0x10,0x44) ## Enable clock input only and refmode self.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendBuffer():\n dislin.sendbf()", "def clear_buffer(self):\r\n self.cmd = \"TRAC:CLE\"\r\n self.I_source.write(self.cmd)\r\n self.in_buffer = int(self.I_source.query(\"TRAC:POIN:ACT?\"))", "def copeWithInput(self, s):\n \n if self.debug > 5:\n CPL.log('TCCSh...
[ "0.55064315", "0.5361335", "0.5239564", "0.523027", "0.5139434", "0.5139434", "0.5139434", "0.5129984", "0.5062465", "0.50183797", "0.5008681", "0.49903777", "0.4955058", "0.4947918", "0.49448824", "0.4941468", "0.49169698", "0.4904956", "0.49041283", "0.489346", "0.48889497"...
0.57670486
0
Use CL1 as input to PLL1 and then to AD9866
def enable_cl1_pll1(self): self.write_versa5(0x17,0x02) ## Change top multiplier to 0x22 self.write_versa5(0x18,0x20) self.write_versa5(0x10,0xc0) ## Enable xtal and clock self.write_versa5(0x13,0x03) ## Switch to clock self.write_versa5(0x10,0x40) ## Enable clock input only, won't lock to master
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_cl1_direct(self):\n self.write_versa5(0x17,0x02) ## Change top multiplier to 0x22\n self.write_versa5(0x18,0x20)\n self.write_versa5(0x10,0xc0) ## Enable xtal and clock\n self.write_versa5(0x13,0x03) ## Switch to clock\n self.write_versa5(0x10,0x44) ## Enable clock input only and refmode\...
[ "0.6483886", "0.6363984", "0.63225305", "0.61263555", "0.5904488", "0.58352244", "0.56169915", "0.5590398", "0.54821926", "0.52404267", "0.51905435", "0.5168966", "0.51326644", "0.509936", "0.50831527", "0.50602263", "0.505986", "0.505492", "0.50499403", "0.5048724", "0.50063...
0.674299
0
Stop using CL1 and revert to default xtal oscillator input
def disable_cl1(self): self.write_versa5(0x10,0xc4) ## Enable xtal and clock self.write_versa5(0x21,0x81) ## Use and enable divider self.write_versa5(0x13,0x00) ## Use CL1 input instead of xtal self.write_versa5(0x10,0x80) ## Enable xtal input only self.write_versa5(0x17,0x04) ## Change top multipli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wave_tx_stop():\n return _u2i(_pigpio_command(_control, _PI_CMD_WVHLT, 0, 0))", "def stop():\n set_power(0)", "def stop(self):\n self.change_power(0)", "def stop():\n global running\n global reading\n global zeroed\n if zeroed == False:\n time.sleep(1)\n xy_stage.res...
[ "0.60477453", "0.59301674", "0.5764608", "0.5732112", "0.57145166", "0.5615371", "0.5615371", "0.5615371", "0.5615371", "0.559175", "0.5590022", "0.55622673", "0.5554824", "0.55445796", "0.547578", "0.5452735", "0.54222983", "0.54042745", "0.54038775", "0.5397799", "0.539359"...
0.686816
0
Play a round Arguments =========
def play(self, tround, context):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunTurn( lobound=1, hibound=20 ):\n\tpass", "def newRound():\r\n pass", "def strategy(self, game, args=()):", "def __round__(self, *args, **kwargs): # real signature unknown\n pass", "def __round__(self, *args, **kwargs): # real signature unknown\n pass", "def __round__(self, *args, ...
[ "0.6288704", "0.5847064", "0.57366675", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.5717588", "0.56073916", "0.56053", "...
0.6492613
0
Read evaluation dataset containing arms played, rewards observed, and contexts presented to the arms Arguments =========
def readData(path): try: open(path) dataset = np.loadtxt(path) # arms played by uniformly-random policy as recorded in dataset arms = dataset[:, 0].astype(int) # rewards received by playing arms using a uniformly-random policy as # recorded in dataset ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_analogies(self):\n questions = []\n questions_skipped = 0\n with open(self._options.eval_data, \"rb\") as analogy_f:\n for line in analogy_f:\n if line.startswith(\":\"): # Skip comments.\n continue\n words = line.strip().l...
[ "0.5838571", "0.5668012", "0.55053437", "0.54466045", "0.5328532", "0.532784", "0.52090394", "0.517614", "0.5124689", "0.5050656", "0.5040259", "0.50264454", "0.4981156", "0.49793994", "0.49773458", "0.4972295", "0.4961568", "0.49559405", "0.49510598", "0.49364892", "0.492662...
0.6414555
0
Plot running per round cumulative reward for results on evaluation dataset for EpsilonGreedy, Upper Confidence Bound (UCB), and contextual LinUCB multiarmed bandits Arguments =========
def plot(t): assert isinstance(t, int), "'t' argument should be an integer." assert t > 0, "'t' argument should be a positive integer." # Initialize arrays with zeros to store mean cumulative rewards upto t # rounds for each of the three implemented bandit algorithms EpsGreedy_rewards = np.zero...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cumreward_normalized(reward_cache_qlearning, reward_cache_SARSA):\n cum_rewards_q = []\n rewards_mean = np.array(reward_cache_qlearning).mean()\n rewards_std = np.array(reward_cache_qlearning).std()\n count = 0 # used to determine the batches\n cur_reward = 0 # accumulate reward for the bat...
[ "0.6006481", "0.5967127", "0.5966327", "0.5892455", "0.5861487", "0.58340496", "0.5791899", "0.5786175", "0.56671864", "0.5652789", "0.56424904", "0.5639421", "0.563851", "0.55813694", "0.55700576", "0.55688906", "0.55589575", "0.55489814", "0.55477333", "0.5528384", "0.55223...
0.70368356
0
Returns a date suffix for a given date
def filter_date_suffix(date_str: str): day = int(date_str[-2:]) if 4 <= day <= 20 or 24 <= day <= 30: suffix = "th" else: suffix = ["st", "nd", "rd"][day % 10 - 1] return date_str + suffix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __num_suffix(self, check_in_date):\n date_value = str(check_in_date).split(' ')\n day_value = date_value[0][:-2]\n date_value[0] = day_value\n return ' '.join(date_value)", "def _build_tag_suffix() -> str:\n now = datetime.datetime.now(tz=datetime.timezone.utc).astimezone()\n ...
[ "0.7249425", "0.67349887", "0.6392717", "0.6302706", "0.62556237", "0.6224853", "0.6213826", "0.61899906", "0.6069033", "0.59627014", "0.59461755", "0.5929941", "0.59197515", "0.5891935", "0.58643836", "0.585514", "0.5840551", "0.5837133", "0.58069605", "0.58027524", "0.58025...
0.78005004
0
Pads a number or string with fillchar to the specified width.
def filter_pad(val: Union[int, str], width: int, fillchar: str = '0') -> str: return str(val).rjust(width, fillchar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(number, width=0):\n return str(number).zfill(width)", "def pad(text, width, pad_character=\" \"):\n\n length = len(text)\n if width < 0 and length < -width:\n return text + (-width - length) * pad_character\n elif width > 0 and length < width:\n return (width - length) * pad_cha...
[ "0.7816895", "0.7491213", "0.7455374", "0.72899914", "0.7258319", "0.72047716", "0.71930504", "0.7182079", "0.7174301", "0.7163619", "0.7056676", "0.6992811", "0.6971006", "0.6785328", "0.67768764", "0.67735404", "0.67346054", "0.67320627", "0.6665845", "0.6665845", "0.666584...
0.82074344
0
Override the builtin Jinja default filter to set the `boolean` param to True by default
def filter_default(value, default_value: str = '', boolean: bool = True) -> str: return jinja2.filters.do_default(value, default_value, boolean)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_formatter(self, value):\n if isinstance(value, bool):\n return value and 'true' or None\n return value", "def test_with_value(self):\n t = Template('{% load djblets_utils %}'\n '<span{% attr \"class\" %}\\n'\n '{% if some_bool %}tr...
[ "0.59055126", "0.57202244", "0.5688953", "0.5675066", "0.5647763", "0.5530957", "0.5526335", "0.54568887", "0.54474694", "0.544175", "0.5375499", "0.53713053", "0.5349298", "0.5309314", "0.5227932", "0.5188103", "0.51851726", "0.5111529", "0.51056075", "0.5075433", "0.5073452...
0.64101535
0
Renders a Template with a task as its context.
def render_from_task(template: Union[FlexGetTemplate, str], task: 'Task') -> str: variables = {'task': task, 'task_name': task.name} variables.update(extra_vars()) return render(template, variables)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_template(self, context=None):\n if context is None:\n context = self.get_template_context()\n return self.get_template_object().render(context)", "def render(self, _template, context=None):\n variables = {}\n if context:\n variables.update(context)\n ...
[ "0.7163159", "0.69389516", "0.69019514", "0.684778", "0.67317486", "0.67039704", "0.6675844", "0.66062564", "0.65639883", "0.6550063", "0.65461814", "0.65187407", "0.6497274", "0.6492231", "0.6465071", "0.644912", "0.6448845", "0.64252526", "0.63980466", "0.63831687", "0.6364...
0.7313202
0
Evaluate a jinja `expression` using a given `context` with support for `LazyDict`s (`Entry`s.)
def evaluate_expression(expression: str, context: Mapping) -> Any: if environment is not None: compiled_expr = environment.compile_expression(expression) # If we have a LazyDict, grab the underlying store. Our environment supports LazyFields directly if isinstance(context, LazyDict): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_jinja_context(include_dict=None):\n context = {\n \"app_name\": app_config[\"APP\"][\"app_name\"],\n \"app_version\": app_config[\"APP\"][\"app_version\"],\n \"app_description\": app_config[\"APP\"][\"app_description\"],\n \"app_author\": a...
[ "0.5919327", "0.5836634", "0.5666903", "0.5475967", "0.5411495", "0.5406394", "0.53799814", "0.5325048", "0.53121567", "0.526088", "0.52421707", "0.51469576", "0.5130527", "0.51130056", "0.5075381", "0.50708956", "0.5069272", "0.49246582", "0.4900586", "0.48931527", "0.488943...
0.705329
0
Print settings on console.
def print_settings(config): print("----------------------------------------") print("SETTINGS") print("----------------------------------------") for key, value in config: print("%s=%s" % (key, value)) print("----------------------------------------")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSettings():\n print \">>>\\n>>> SettingsTool: global variables:\"\n for variable, value in globals().items():\n if variable.count('__')>1: continue\n print \">>> %-16s = %s\"%(variable,value)\n print \">>>\"", "def printConfig():\n # Why not log instead? Are we asking user ...
[ "0.7606205", "0.7408411", "0.72713363", "0.7174278", "0.7161238", "0.6935702", "0.68697244", "0.68273026", "0.66850144", "0.6652348", "0.6641773", "0.66384244", "0.6636062", "0.6621884", "0.66079605", "0.6571476", "0.6557688", "0.6518967", "0.64918625", "0.64774805", "0.64208...
0.786409
0
Sets pi(a|s) = 1 and pi(a'|s) = 0 for a' != a.
def update_pi(self, s, a): for a_p in self.env.moves: self.pi[(a_p, s)] = (a == a_p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perm_af_parity(pi):\n n = len(pi)\n a = [0] * n\n c = 0\n for j in xrange(n):\n if a[j] == 0:\n c += 1\n a[j] = 1\n i = j\n while pi[i] != j:\n i = pi[i]\n a[i] = 1\n return (n - c) % 2", "def _make_zero(p):\n\n ...
[ "0.64008385", "0.60723084", "0.5754091", "0.54634887", "0.54298794", "0.5418518", "0.5401177", "0.5367925", "0.53521436", "0.5345882", "0.52901685", "0.52851814", "0.5267636", "0.52551055", "0.52317315", "0.5228241", "0.5217047", "0.5203342", "0.5200641", "0.51997817", "0.516...
0.6752598
0
Returns a list of state estimates at steps `step_list` for MSE.
def estimate_state(self, step_list, start_state=None, seed=0): self.seed(seed) self.importance_sampling(max(step_list), start_state=start_state, step_list=step_list) estimates_arr = np.array(self.estimates) self.estimates = [] return estimates_arr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelpartition_list_expectation_step(vislist, evis_all_list, modelpartition_list, **kwargs):\n\n def make_e(vis, modelpartition, evis_all):\n # Return the estep for a given skymodel\n evis = copy_visibility(vis)\n tvis = copy_visibility(vis, zero=True)\n tvis = predict_skymodel_v...
[ "0.58687896", "0.53922796", "0.5387855", "0.5174597", "0.5147441", "0.5109813", "0.51070565", "0.5071416", "0.5022036", "0.49926993", "0.49717492", "0.4959728", "0.49549443", "0.4910653", "0.49028057", "0.48820263", "0.4873446", "0.4863553", "0.48388338", "0.4818197", "0.4797...
0.6557831
0
input Pixels should be an np.array of 64 integers (valued between 0 to 15) there's no return value, but this should show an image of that digit in an 8x8 pixel square Be sure to run %matplotlib at your ipython prompt before using this!
def show_digit( Pixels ): from matplotlib import pyplot as plt print(Pixels.shape) Patch = Pixels.reshape((8,8)) plt.figure(1, figsize=(4,4)) plt.imshow(Patch, cmap=plt.cm.gray_r, interpolation='nearest') # plt.cm.gray_r # plt.cm.hot plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_digit( Pixels ):\r\n print(Pixels.shape)\r\n Patch = Pixels.reshape((8,8))\r\n plt.figure(1, figsize=(4,4))\r\n plt.imshow(Patch, cmap=plt.cm.gray_r, interpolation='nearest') # cm.gray_r # cm.hot\r\n plt.show()", "def disImg(data=None,colorbar=False):\n size = np.sqrt(len(data[4:]))...
[ "0.7884607", "0.6769907", "0.674633", "0.6648369", "0.6536538", "0.64752847", "0.64704466", "0.6445182", "0.64258", "0.63998693", "0.6364624", "0.6281803", "0.62751114", "0.62262917", "0.62021554", "0.61980116", "0.616065", "0.61412615", "0.6044806", "0.5989991", "0.59517574"...
0.7971584
0
Parse date based on different formats
def parseDate(date): formats = [ "D MMM YY, hh:mm a", "YYYY-MM-DDTHH:mm:ss+00:00", "ddd, D MMM YYYY HH:mm:ss +0530", # NDTV "ddd, D MMM YYYY HH:mm:ss +0100", # skynews "ddd, D MMM YYYY HH:mm:ss -0400", # reuters "D MMM, YYYY", # espn cricket "ddd, D MMM YYY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_date(date_string: str) -> Union[datetime.datetime, str]:\n for date_format in KNOWN_DATE_FORMATS:\n try:\n date = datetime.datetime.strptime(date_string, date_format)\n return date\n except ValueError:\n continue\n return d...
[ "0.7429762", "0.72900164", "0.7274739", "0.72164947", "0.71738756", "0.7167267", "0.71480685", "0.71087646", "0.69975185", "0.6994544", "0.6974348", "0.69636685", "0.696295", "0.6944045", "0.6920026", "0.6899698", "0.68938076", "0.68740517", "0.68342584", "0.6803827", "0.6792...
0.74297434
1
Get aragon voting contract as object.
def get_aragon_voting( net: str, address: str, etherscan_api_key: str, retries: int, ): if not brownie.network.is_connected(): brownie.network.connect(net) abi = get_abi(etherscan_api_key, address, net, retries) impl_address = get_implementation_address( address, abi, net ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vote(self, id: int) -> dict:", "def to_object(cls, query_dict: Dict):\n vote = Vote()\n vote.question = query_dict.get(\"question\")\n vote.user = query_dict.get(\"user_id\")\n vote.value = query_dict.get(\"value\")\n vote.id = query_dict.get(\"id\")\n return vot...
[ "0.5435771", "0.53329545", "0.5219299", "0.5188242", "0.5178088", "0.5061383", "0.5034543", "0.49983376", "0.49737984", "0.49379542", "0.4928847", "0.49039114", "0.4894972", "0.48840657", "0.48681977", "0.4842652", "0.48310107", "0.4791282", "0.478338", "0.47696742", "0.47668...
0.6489815
0
Decode aragon voting with specific number.
def parse_voting( aragon_voting, abi_storage: CachedStorage, vote_number: int ) -> List[Union[Call, str]]: script_code = str(aragon_voting.getVote(vote_number)[-1]) return decode_evm_script(script_code, abi_storage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decodeVigenere(self, key):\n\n key = key.upper().replace(\" \", \"\")\n decode = Vig(key)\n planeText = decode.decode(self.cipherText)\n \n if (self.verbose == 1):\n print(planeText)\n \n return(planeText)", "def decode(self, number: int) -> typ...
[ "0.552153", "0.5235955", "0.5231673", "0.5132123", "0.50863487", "0.50287044", "0.5017056", "0.501696", "0.49951592", "0.49941075", "0.49753332", "0.4963806", "0.49543387", "0.48979822", "0.48958716", "0.48876846", "0.48868448", "0.488496", "0.48771974", "0.48609972", "0.4860...
0.5924441
0
Run multiprocessing of sampledata files. We use multiple threads by splitting the VCF file into chunks and using the vcf_subset function of cyvcf2.
def run_multiprocessing(args, function): vcf_fn = args.data_file num_processes = args.num_threads if num_processes > 1: # Split the VCF into chunks callset = allel.read_vcf(vcf_fn, fields=["variants/CHROM", "variants/POS"]) pos_list = callset["variants/POS"] chroms = callset[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(input_folder, output_folder, bounding_boxes_file, cores, resampling,\n order):\n logger = logging.getLogger(__name__)\n logger.info('Resampling')\n\n if not os.path.exists(output_folder):\n os.mkdir(output_folder)\n print('resampling is {}'.format(str(resampling)))\n bb_df = ...
[ "0.60877764", "0.6062956", "0.6029365", "0.5959184", "0.5855619", "0.5839044", "0.5821658", "0.5806925", "0.5791175", "0.5772094", "0.5660737", "0.564774", "0.54801124", "0.5463999", "0.5415949", "0.5407162", "0.5381161", "0.53543305", "0.5353785", "0.5335812", "0.53349584", ...
0.62807316
0
Returns the variants from this VCF with duplicate sites filtered out. If any site position appears more than once, throw all variants away. If target_sites_pos is not None, only returns variants from this VCF which are present in the target sampledata file.
def filter_duplicates_target(vcf, target_sites_pos=None): if target_sites_pos is not None: def site_in_target(site): return site in target_sites_pos else: def site_in_target(site): return True row = next(vcf, None) bad_pos = -1 for next_row in vcf: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_equivalent_sites(self, site):\n for sites in self.equivalent_sites:\n if site in sites:\n return sites\n\n raise ValueError(\"Site not in structure\")", "def sites(self):\n return self.data.sites.values", "def exclude_duplicates(self, variants):\n ...
[ "0.5047111", "0.48624134", "0.4791929", "0.47910732", "0.47692823", "0.4745043", "0.47057143", "0.469012", "0.469012", "0.46753037", "0.45791847", "0.45689055", "0.4561133", "0.45400792", "0.45036858", "0.4499734", "0.4495113", "0.44825026", "0.44688737", "0.44688693", "0.444...
0.72600794
0
This function creates path to save the training results and weights.
def make_path(data_dir, base, exp_name): train_path = os.path.join(data_dir, 'Train') valid_path = os.path.join(data_dir, 'Validation') if (not os.path.isdir(train_path)) or (not os.path.isdir(valid_path)): print('Please split images into train directory and validation directory.') exit() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_save_directories(self):\n # Set the name for the saved model and training summary directory\n self.model_dir = op.join('../logs', self.name, 'models')\n self.train_summary_dir = op.join('../logs', self.name, 'training_summary')\n\n if not op.exists(self.model_dir):\n ...
[ "0.7026639", "0.68025696", "0.67583746", "0.67400897", "0.67305654", "0.6729066", "0.6711609", "0.671136", "0.6676605", "0.6649801", "0.66478485", "0.6634715", "0.6595856", "0.6550144", "0.6548502", "0.6500597", "0.64827853", "0.6480804", "0.64794177", "0.6461388", "0.6460311...
0.6858212
1
Generate output images for parcel footprints.
def create_output_image(building_footprint, parcel_footprint, file_path): fig, ax = plt.subplots(figsize=(10, 10)) gpd.overlay(building_footprint, parcel_footprint, how="symmetric_difference").plot( ax=ax, color="lightgray" ) parcel_footprint.geometry.exterior.buffer(0.25).plot(ax=ax, color="bla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_input_image(parcel_footprint, file_path):\n fig, ax = plt.subplots(figsize=(10, 10))\n parcel_footprint.plot(ax=ax, color=\"lightgray\")\n parcel_footprint.geometry.exterior.buffer(0.25).plot(ax=ax, color=\"black\")\n\n ax.patch.set_facecolor(\"white\")\n ax.patch.set_edgecolor(\"white\")...
[ "0.66542184", "0.6168913", "0.61026806", "0.6090104", "0.60365087", "0.5999179", "0.5749918", "0.56669164", "0.56426716", "0.56304854", "0.56185645", "0.5585054", "0.55716985", "0.55307716", "0.55136627", "0.55136627", "0.5498659", "0.54859626", "0.54828817", "0.5458757", "0....
0.69139814
0
Returns gdf with bag_gdf that are within a kadaster. Based on perceel_id.
def join_kadaster_bag_info(kadaster_gdf, bag_gdf): return gpd.sjoin(bag_gdf, kadaster_gdf, op="within")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dgbs(self):\n cursor = job(self.logger, partial(find_job, 'find', {'spread': 'dgb'}))\n equities = sorted([item['eq'] for item in cursor])\n dgbs = self._find_dgbs(equities)\n _show_dgbs(dgbs)\n return True", "def find_voting_precincts_in_district(state=48, district=7, ...
[ "0.55878776", "0.49948218", "0.4724546", "0.47188705", "0.46614647", "0.46237472", "0.4620131", "0.46127397", "0.46111575", "0.45959288", "0.45944956", "0.45454195", "0.45318693", "0.45301446", "0.4526814", "0.45172554", "0.44915894", "0.4489763", "0.44570842", "0.44483387", ...
0.6432043
0
Calculate overlap between bag and kadaster geodataframes in percentages.
def calculate_percentage_overlap(bag_sample, kadaster_sample): # calculate percentage intersection ov_output = gpd.overlay(bag_sample, kadaster_sample, how="intersection") percentage_overlap = ( ov_output.geometry.area / kadaster_sample.geometry.area.values[0] ) percentage_overlap.index = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlapPercent(box1, box2):\n xx2 = min(box1[2], box2[2])\n xx1 = max(box1[0], box2[0])\n yy2 = min(box1[3], box2[3])\n yy1 = max(box1[1], box2[1])\n w = max(0, xx2 - xx1 + 1)\n h = max(0, yy2 - yy1 + 1)\n areaBox1 = boundingBoxArea(box1)\n areaBox2 = boundingBoxArea(box2)\n overlap ...
[ "0.69667053", "0.6415947", "0.62875366", "0.62101567", "0.6209373", "0.6169764", "0.6060111", "0.6049341", "0.604258", "0.5956855", "0.59191436", "0.5853579", "0.5817987", "0.5817337", "0.5816945", "0.57941353", "0.5751341", "0.57163626", "0.56830454", "0.5674475", "0.5645978...
0.7542141
0
Validates a file against a sha256 or md5 hash. Arguments
def validate_file(fpath, file_hash, algorithm='auto', chunk_size=65535): if ((algorithm is 'sha256') or (algorithm is 'auto' and len(file_hash) is 64)): hasher = 'sha256' else: hasher = 'md5' if str(_hash_file(fpath, hasher, chunk_size)) == str(file_hash): return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_file(fpath, file_hash, algorithm='auto', chunk_size=65535):\n if (algorithm == 'sha256') or (algorithm == 'auto' and len(file_hash) == 64):\n hasher = 'sha256'\n else:\n hasher = 'md5'\n\n if str(_hash_file(fpath, hasher, chunk_size)) == str(file_hash):\n return True\n ...
[ "0.7924767", "0.74817306", "0.72795886", "0.71345603", "0.6770209", "0.6651307", "0.65227723", "0.65150875", "0.64636904", "0.63894236", "0.6387766", "0.6380768", "0.6302816", "0.62753654", "0.6221864", "0.6216318", "0.6211538", "0.6210252", "0.6190917", "0.6177316", "0.61705...
0.7905711
1
Downloads a file from a URL if it not already in the cache. By default the file at the url `origin` is downloaded to the cache_dir `/tmp/datasets` Files in tar, tar.gz, tar.bz, and zip formats can also be extracted. Passing a hash will verify the file after download. The command line programs `shasum` and `sha256sum` c...
def get_file(origin, fname=None, # untar=False, md5_hash=None, file_hash=None, cache_dir=None, cache_subdir=None, hash_algorithm='auto', extract=False, archive_format='auto'): if fname is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(fname,\n origin,\n untar=False,\n md5_hash=None,\n file_hash=None,\n cache_subdir='datasets',\n hash_algorithm='auto',\n extract=False,\n archive_format='auto',\n cache_dir=None):\n if cache_...
[ "0.7127393", "0.69456184", "0.6733968", "0.66419476", "0.6417536", "0.63657403", "0.6318456", "0.63171995", "0.62680537", "0.6157976", "0.61561304", "0.61438686", "0.61410165", "0.6120135", "0.60910845", "0.60345376", "0.60229146", "0.5977921", "0.59734684", "0.59687644", "0....
0.74226344
0
Transform the information of the timetriggered frame to a string
def __str__(self): return_text = "Time-Triggered Frame information =>\n" return_text += " Sender id : " + str(self.__sender_id) + "\n" return_text += " Receivers ids : " + str(self.__receivers_id) + "\n" return_text += " Path : " + str(self.__paths) + "\n" r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n nframes = len(self.frames)\n if nframes == 0:\n return \"\"\n elif nframes == 1:\n frame, = self.frames\n return str(frame)\n else:\n frames = sorted(self.frames)\n start = prev = frames[0] # First frame.\n ...
[ "0.6260433", "0.61221725", "0.6112356", "0.6092692", "0.6030933", "0.60286427", "0.59961176", "0.591236", "0.5886073", "0.5884544", "0.5821253", "0.58184284", "0.5814035", "0.57295614", "0.57094294", "0.5665555", "0.565353", "0.5652871", "0.56451994", "0.56060076", "0.5603432...
0.65640455
0
Set the sender id of the frame
def __set_sender_id(self, sender_id): if not isinstance(sender_id, int): raise TypeError('It has to be an integer identifier') if sender_id < 0: raise ValueError('There are not negative identifiers') self.__sender_id = sender_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender", "def sender(self, sender):\n\n self._sender = sender"...
[ "0.6736208", "0.6736208", "0.6736208", "0.6736208", "0.6736208", "0.6245707", "0.61775434", "0.61548287", "0.6074172", "0.6006215", "0.5950996", "0.5842727", "0.57942617", "0.5655139", "0.5590423", "0.5571542", "0.54551816", "0.544673", "0.5442492", "0.5391776", "0.53906125",...
0.73018974
0
Get the sender id of the frame
def __get_sender_id(self): return self.__sender_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SenderId(self):\n return self._sender_id", "def get_channel_id(event):\n return event.source.sender_id", "def sender(self) -> str:\n return self._sender", "def showsender(self):\n return self.sender", "def sender(self):\n return self._sender", "def sender(self) -> A...
[ "0.72898585", "0.66977465", "0.6695593", "0.6613553", "0.66016334", "0.6535047", "0.60609436", "0.60208005", "0.5981284", "0.5972186", "0.58671016", "0.58098495", "0.5786878", "0.5773325", "0.5759419", "0.57203734", "0.5719647", "0.57100904", "0.5695645", "0.5668261", "0.5645...
0.76059324
0
Set the list of receivers id
def __set_receivers_id(self, receivers_id): if not isinstance(receivers_id, list): raise TypeError('Receivers id should be a list') if not all(isinstance(receiver_id, int) for receiver_id in receivers_id): # Check if all elements are int raise TypeError('All elements in the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_receivers_id(self):\n return self.__receivers_id", "def ids(self, ids):\n self._ids = ids", "def setId(self, *args):\n return _libsbml.ListOfMembers_setId(self, *args)", "def set_ids(self, item_list):\n self._reset_sequence()\n for item in item_list:\n ...
[ "0.68162084", "0.61993223", "0.6040532", "0.5932464", "0.5899451", "0.58826494", "0.5788359", "0.57493365", "0.57457477", "0.57353175", "0.5734101", "0.57076067", "0.55706054", "0.54016364", "0.5394554", "0.52624714", "0.525897", "0.52536356", "0.5247424", "0.5245702", "0.524...
0.7947489
0
Get the list of receivers id
def __get_receivers_id(self): return self.__receivers_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self) -> List[str]:", "def getIDs():", "def receivers(self):\n keys = ('To', 'Cc', 'Bcc') if not self.resent else \\\n ('Resent-To', 'Resent-Cc', 'Resent-Bcc')\n vals = (v for v in (self.get(key) for key in keys) if v)\n return [addr for _, addr in getaddresses(va...
[ "0.676375", "0.6558249", "0.64179915", "0.64104015", "0.6283956", "0.626986", "0.6142786", "0.6132265", "0.6117434", "0.6115579", "0.60932165", "0.60912985", "0.60734886", "0.60161537", "0.6016079", "0.60060114", "0.60022485", "0.59980255", "0.5988492", "0.5988492", "0.598273...
0.80000204
0
Get the starting time of the frame
def __get_starting_time(self): return self.__starting_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame_time(self):\n return self.get_timings().frame_time", "def getStartTime(self):\n return _osgAnimation.Animation_getStartTime(self)", "def getStartTime(self):\n return _osgAnimation.Channel_getStartTime(self)", "def start_time(self) -> float:\r\n ...", "def start_tim...
[ "0.78929955", "0.7614445", "0.75264573", "0.7499873", "0.7396878", "0.7367973", "0.7346448", "0.73315626", "0.7275492", "0.72647166", "0.7260599", "0.7249851", "0.7245025", "0.72314405", "0.722858", "0.72115505", "0.7198226", "0.7188492", "0.71580946", "0.712532", "0.712532",...
0.7710456
1
Set the deadline of the frame in ns, it should be smaller than the period, if 0 then same as period
def __set_deadline(self, deadline): if not isinstance(deadline, int): raise TypeError('The deadline should be an integer') if deadline < 0: raise ValueError('The deadline should be positive') if deadline > self.__period: raise ValueError('The deadline cannot b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setDeadline(self):\n self.session.setDeadline(13.5)\n self.assertEqual(13.5, self.session.getRemainingTime())", "def test_deadlineChangesAsTimePasses(self):\n self.session.setDeadline(13.5)\n self.runtime.getTimeService().advance(2.0)\n self.assertEqual(11.5, self.sess...
[ "0.6961596", "0.681887", "0.67824566", "0.6683734", "0.66523653", "0.62993157", "0.61421096", "0.6116758", "0.6001748", "0.5914177", "0.5862476", "0.5794072", "0.57932574", "0.5778166", "0.56893766", "0.5676566", "0.5609137", "0.56078696", "0.5586334", "0.55774784", "0.549495...
0.70939225
0
Get the deadline of the frame in ns
def __get_deadline(self): return self.__deadline
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deadline(self):\n\n if self.service and self.service.solution_time:\n return self.created + \\\n timedelta(hours=self.service.solution_time) - \\\n timedelta(seconds=self._time_on_hold)\n else:\n return None", "def get_deadline(self):\n ...
[ "0.71374065", "0.7088324", "0.69267964", "0.6588213", "0.6578111", "0.65595996", "0.6538972", "0.648789", "0.6469537", "0.6462406", "0.63980615", "0.6368143", "0.631343", "0.631343", "0.6300549", "0.6265253", "0.62152845", "0.6122565", "0.60784006", "0.6046691", "0.5992835", ...
0.7362362
0
Evaluate query and save result. Output is saved either to a target directory (current working directory by default) to a file deduced from the query, or to target_file (if specified) Returns a state.
def evaluate_and_save( query, target_directory=None, target_file=None, target_resource_directory=None ): return get_context().evaluate_and_save( query, target_directory=target_directory, target_file=target_file, target_resource_directory=target_resource_directory, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_into_file(self, query, fname=\"\", fields=None, parameters=None):\n target_url = self.build_query(query, fields=fields, parameters=parameters)\n\n with urllib.request.urlopen(target_url) as url:\n content = url.read()\n\n with open(fname, 'wb') as ofs:\n ...
[ "0.6271955", "0.5941349", "0.58987206", "0.5728236", "0.5728066", "0.56052387", "0.5449336", "0.5394666", "0.52985036", "0.52504694", "0.52476597", "0.5220453", "0.5208357", "0.5203255", "0.5198881", "0.51611763", "0.5131378", "0.5129826", "0.51099676", "0.5095326", "0.509482...
0.8222652
0
Evaluate a string template; replace all queries by their values Queries in the template are delimited by prefix and sufix. Queries should evaluate to strings and should not cause errors.
def evaluate_template(template: str, prefix="$", sufix="$"): return get_context().evaluate_template(template, prefix=prefix, sufix=sufix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replacements(input_str, query, replace=\"\", num=0):\n check_parentheses = re.findall(\"\\([^()]*\\)\", query)\n check_replacement = re.findall(r\"\\\\[0-9]+\", replace)\n check_replacement = sorted([int(match[1:]) for match in check_replacement])\n if check_replacement and check_replacement[-1] > ...
[ "0.59523755", "0.57478", "0.564346", "0.56363636", "0.5548136", "0.54896957", "0.5392804", "0.534426", "0.53307384", "0.5292386", "0.5263303", "0.52400285", "0.52348495", "0.52257264", "0.52243674", "0.52145886", "0.5206932", "0.5192216", "0.51901", "0.515437", "0.51394385", ...
0.65676814
0
Iterator. Return opcode, data, pc, new_pc at each step
def get_opcodes(self, script, verify_minimal_data=False, pc=0): while pc < len(script): opcode, data, new_pc, is_ok = self.scriptStreamer.get_opcode( script, pc, verify_minimal_data=verify_minimal_data) yield opcode, data, pc, new_pc pc = new_pc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for i in self.ref:\n yield PythonBytecodeInPreproc(i)", "def __iter__(self) -> Iterator[packets.Packet]:\n for packet in self._packets:\n yield packet\n for pointer in self._packet_pointers:\n yield pointer.get()", "def instruction_ite...
[ "0.5994231", "0.5834547", "0.5778902", "0.56972027", "0.56266713", "0.55741405", "0.5524681", "0.5516168", "0.53814715", "0.5375429", "0.5375429", "0.53654444", "0.53418607", "0.53404146", "0.53236276", "0.5272017", "0.523277", "0.52307564", "0.52223295", "0.5202266", "0.5186...
0.6933305
0
Disassemble the given script. Returns a list of opcodes.
def opcode_list(self, script): opcodes = [] new_pc = 0 try: for opcode, data, pc, new_pc in self.get_opcodes(script): opcodes.append(self.disassemble_for_opcode_data(opcode, data)) except ScriptError: opcodes.append(binascii.hexlify(script[new_pc:]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disassemble(self, script):\n return ' '.join(self.opcode_list(script))", "def dis_to_instructions(disasm):\n\tline_num = None\n\tinstructions = []\n\tfor line in disasm.split(\"\\n\"):\n\t\tmatch = re.search(\n\t\t\tr\"( ?(?P<line_num>\\d+)[ >]+)?(?P<offset>\\d+) (?P<opname>[A-Z_]+)(?:\\s+(?P<arg>\\d+...
[ "0.7977805", "0.6308526", "0.6110257", "0.5981193", "0.57591164", "0.5738575", "0.5584899", "0.557888", "0.5507902", "0.5493241", "0.549239", "0.5449774", "0.5375824", "0.53389883", "0.5307862", "0.52669376", "0.52389264", "0.5218232", "0.5153286", "0.5099107", "0.50559896", ...
0.71088725
1
Disassemble the given script. Returns a string.
def disassemble(self, script): return ' '.join(self.opcode_list(script))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_disassemble(self, args):\n if len(args) != 0:\n args = args.split(' ')\n self.u_start = self.ParseAddressExpr(args[0])\n self.u_size = self.ParseAddressExpr(args[1]) if len(args) > 1 else 0x20\n skip = False\n else:\n # Skip the first instruction if we reuse the last address.\...
[ "0.6129356", "0.5955644", "0.5793927", "0.5649976", "0.55970746", "0.5520527", "0.54753274", "0.54259163", "0.53937024", "0.5353539", "0.5237331", "0.52210057", "0.52193767", "0.5176129", "0.5160617", "0.514914", "0.50190306", "0.5009232", "0.49686974", "0.4957609", "0.493400...
0.7294682
0
Keepalive topic publisher, in very 30sec to the broker.
def thread_function(client): threading.Timer(30.0, thread_function).start() client.publish("serverCommand/keepalive", "0") print("Message Sent. (keepalive)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # pylint: disable=too-many-locals\n parser = init_parser()\n options = parser.parse_args()\n\n host = options.host\n port = options.port\n keepalive = options.keepalive\n client_id = options.client_id\n topic = options.topic\n qos = options.qos\n filename = options.file\...
[ "0.6194819", "0.6047085", "0.60348225", "0.60193574", "0.5993197", "0.5971651", "0.59388137", "0.59254557", "0.5893863", "0.57715595", "0.5753941", "0.5746216", "0.57367104", "0.5735936", "0.56993383", "0.5693414", "0.5682998", "0.5676654", "0.566459", "0.56511974", "0.564611...
0.6438521
0
Read the config xml, convert to string, and send it to the mqtt broker.
def send_config_xml_to_broker(self): xmlObject = xml.dom.minidom.parse("config_setup.xml") pretty_xml_as_string = xmlObject.toprettyxml() self.client.publish("users/everyone/inbox/server/deviceList", pretty_xml_as_string) print("XML config sent.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_mqtt(self, config):\n\t\tif \"mqtt\" in config:\n\t\t\tself._mqtt = config[\"mqtt\"]\n\t\tif not \"host\" in self._mqtt:\n\t\t\traise ValueError(\"MQTT host not set\")\n\t\tif not \"port\" in self._mqtt:\n\t\t\traise ValueError(\"MQTT port not set\")\n\t\tif not \"user\" in self._mqtt:\n\t\t\traise Valu...
[ "0.6071265", "0.606536", "0.55985576", "0.5453353", "0.54124284", "0.5389315", "0.5340085", "0.53380466", "0.530493", "0.5208637", "0.5197179", "0.5167025", "0.513544", "0.51308423", "0.51290375", "0.51168764", "0.5085436", "0.50713146", "0.504145", "0.50359666", "0.5025919",...
0.7361652
0
Identifies if an object is numeric, that is int, float or bool.
def isNumeric(obj): return isinstance(obj, (int, float, bool))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric(obj):\n return isinstance(obj, (int, float, complex))", "def isNumeric(obj):\n # type: (Any) -> bool\n return isinstance(obj, numbers.Number)", "def is_numeric(space, w_obj):\n if w_obj.tp in [space.tp_float, space.tp_int]:\n return space.w_True\n if w_obj.tp == space.t...
[ "0.8730025", "0.8449824", "0.83024406", "0.8183594", "0.80185515", "0.7984723", "0.78311867", "0.77982944", "0.7680896", "0.7653552", "0.75546384", "0.7527674", "0.7505374", "0.74033344", "0.7371881", "0.73513925", "0.7326164", "0.73183155", "0.73108757", "0.7299548", "0.7288...
0.8853641
0
Operator overloading. Generate an expression for addition.
def __add__(self, other): if not (isNumeric(other) or isinstance(other, Expression)): error_msg = ( f'Invalid expression during addition to {self}: [{other}]' ) raise excep.biogemeError(error_msg) return Plus(self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other: Any) -> ColumnOperators:\n return self.operate(add, other)", "def plus(self, a, b):\n return a + b", "def __radd__(self, other):\n if not (isNumeric(other) or isinstance(other, Expression)):\n error_msg = (\n f'Invalid expression during additi...
[ "0.7368789", "0.72432524", "0.7233358", "0.7125167", "0.7071412", "0.6955811", "0.6865642", "0.68313384", "0.68223995", "0.6804402", "0.6791067", "0.6787343", "0.6785731", "0.6785731", "0.67737544", "0.6763604", "0.6743341", "0.6740774", "0.67383057", "0.6683524", "0.66759837...
0.7279723
1
Operator overloading. Generate an expression for unary minus.
def __neg__(self): return UnaryMinus(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unary_operator(op):\n # Only negate is currently supported for all our possible input types.\n valid_ops = {'-'}\n if op not in valid_ops:\n raise ValueError(\"Invalid unary operator %s.\" % op)\n\n def unary_operator(self):\n # This can't be hoisted up a scope because the types retur...
[ "0.7384949", "0.7325116", "0.7280399", "0.7254818", "0.71499866", "0.71430916", "0.6979477", "0.6833238", "0.6832739", "0.6772833", "0.66956836", "0.65985936", "0.6595696", "0.65774065", "0.65257376", "0.6504867", "0.6501448", "0.64852464", "0.6480339", "0.6480339", "0.645264...
0.7887373
0
Recursively extract the variables appearing in the expression, and store them in a dictionary.
def dictOfVariables(self): s = {} for e in self.children: d = e.dictOfVariables() s = dict(s, **d) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(self):\n vars = {}\n for line in self._instrs:\n yield_result = False\n save_result = None\n yield_match = re.match(r\"yield (.*)\", line)\n if yield_match:\n expr = yield_match.group(1)\n yield_result = True\n var_match = re.match(r\"\\$([a-z0-9]+) = (.*)\", l...
[ "0.5945532", "0.5885752", "0.58202237", "0.5805298", "0.57318467", "0.5723188", "0.5675114", "0.56344885", "0.56314737", "0.55876845", "0.5575075", "0.5556912", "0.55559593", "0.55430675", "0.55181867", "0.55167776", "0.5486167", "0.5456266", "0.5422159", "0.53869724", "0.529...
0.63879704
0
Recursively extract the random variables appearing in the expression, and store them in a dictionary.
def dictOfRandomVariables(self): s = {} for e in self.children: d = e.dictOfRandomVariables() s = dict(s, **d) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_variables(md):\n\n # save as dictionaries with searchers as keys\n x_searchers = {}\n b_target = {}\n\n t_max = 0\n\n for var in md.getVars():\n my_var_name = var.varName\n my_var_value = var.x\n # print('%s %g' % (my_var_name, my_var_value))\n\n if 'x' in my_va...
[ "0.5932875", "0.5881359", "0.58104384", "0.5771592", "0.57176113", "0.56042373", "0.557", "0.54678077", "0.54553556", "0.5453515", "0.5445234", "0.54076046", "0.539915", "0.5379454", "0.53549975", "0.53479403", "0.5346211", "0.53291714", "0.5299673", "0.52857965", "0.52682525...
0.6830504
0
Check if the expression contains an expression of type t. Typically, this would be used to check that a MonteCarlo expression contains a bioDraws expression.
def embedExpression(self, t): if self.getClassName() == t: return True for e in self.children: if e.embedExpression(t): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, expr):\n # NOTE: when multiplying out series a lot of queries like\n # O(...).contains(a*x**b) with many a and few b are made.\n # Separating out the independent part allows for better caching.\n c, m = expr.as_coeff_mul(*self.variables)\n if m != (...
[ "0.6354421", "0.6215181", "0.61420554", "0.61094767", "0.6092375", "0.6010836", "0.5990448", "0.58116657", "0.5651406", "0.5560447", "0.5551944", "0.5544172", "0.5540352", "0.55251205", "0.5510958", "0.5440789", "0.54013324", "0.53979707", "0.5379893", "0.5332278", "0.5304918...
0.65743965
0
Count the number of times the PanelLikelihoodTrajectory is used in the formula. It should trigger an error if it is used more than once.
def countPanelTrajectoryExpressions(self): nbr = 0 for e in self.children: nbr += e.countPanelTrajectoryExpressions() return nbr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countPanelTrajectoryExpressions(self):\n return 1 + self.child.countPanelTrajectoryExpressions()", "def num_trials(self):", "def num_trajs(self):\n return len(list(self.run_traj_idx_tuples()))", "def count(self, trace):\n return len(trace)", "def num_run_trajs(self, run_idx):\n ...
[ "0.7567535", "0.65474737", "0.64351207", "0.63596004", "0.6308121", "0.6222953", "0.61417466", "0.6131484", "0.6076631", "0.60758704", "0.606734", "0.60238755", "0.60216856", "0.60216856", "0.5999179", "0.5999179", "0.5995761", "0.5994588", "0.5986202", "0.5981513", "0.594269...
0.72264415
1
Count the number of times the PanelLikelihoodTrajectory is used in the formula.
def countPanelTrajectoryExpressions(self): return 1 + self.child.countPanelTrajectoryExpressions()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countPanelTrajectoryExpressions(self):\n nbr = 0\n for e in self.children:\n nbr += e.countPanelTrajectoryExpressions()\n return nbr", "def num_trajs(self):\n return len(list(self.run_traj_idx_tuples()))", "def num_trials(self):", "def count(self, trace):\n r...
[ "0.78097856", "0.66617143", "0.6469263", "0.644151", "0.63895994", "0.63895994", "0.6379835", "0.6366051", "0.6280522", "0.6234562", "0.6233104", "0.6233104", "0.6197536", "0.6165541", "0.6160118", "0.6159054", "0.6153425", "0.6145203", "0.6144707", "0.6135027", "0.6134179", ...
0.77726966
1
The signature of a string characterizing an expression. This is designed to be communicated to C++, so that the expression can be reconstructed in this environment.
def getSignature(self): if self.uniqueId is None: error_msg = ( f'No id has been defined for elementary expression ' f'{self.name}.' ) raise excep.biogemeError(error_msg) if self.variableId is None: error_msg = f'No id has b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature(function: model.Function) -> str:\n return str(function.signature)", "def signature(self, p_int): # real signature unknown; restored from __doc__\n return \"\"", "def getSignature(self):\n if self.uniqueId is None:\n error_msg = (\n f'No id has been defi...
[ "0.6619273", "0.6473422", "0.6309802", "0.61847234", "0.6073295", "0.6059989", "0.60226774", "0.5935619", "0.5928081", "0.5888818", "0.58887196", "0.5830866", "0.5825439", "0.58098805", "0.5744874", "0.57229364", "0.5679679", "0.56364614", "0.5612615", "0.5531022", "0.5523402...
0.6510526
1
Test the count function.
def test_count(self): self._test_count_func(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_own_count(self):\n self._test_count_func(it_count)", "def count():", "def count() -> int:\n pass", "def test_count_0(self):\n self.assertEqual(count(0), 0, 'Between 0 and 0, there is 0 lucky numbers.')", "def test_count_10(self):\n value: int = 10\n result: int = 2\n...
[ "0.84164256", "0.820292", "0.7990008", "0.78495294", "0.7781927", "0.76635265", "0.76356196", "0.7626337", "0.7626337", "0.7626337", "0.7626337", "0.7524166", "0.7483875", "0.74832076", "0.7470555", "0.746315", "0.746018", "0.7457858", "0.7455038", "0.7362271", "0.7359845", ...
0.9106443
0
Test own count implementation.
def test_own_count(self): self._test_count_func(it_count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count(self):\n self._test_count_func(count)", "def count():", "def Count(self) -> int:", "def Count(self) -> int:", "def Count(self) -> int:", "def Count(self) -> int:", "def count() -> int:\n pass", "def test_count_0(self):\n self.assertEqual(count(0), 0, 'Between 0 and 0, ...
[ "0.8753977", "0.8241986", "0.8033116", "0.8033116", "0.8033116", "0.8033116", "0.7945021", "0.7638478", "0.75200033", "0.7499305", "0.74754155", "0.746561", "0.7461913", "0.7429032", "0.7391608", "0.73801625", "0.73676854", "0.7343682", "0.73298603", "0.73264694", "0.7312503"...
0.8527373
1
Function to get all tasselCap indices
def addAllTasselCapIndices(self,img): def getTasseledCap(img): """Function to compute the Tasseled Cap transformation and return an image""" coefficients = ee.Array([ [0.3037, 0.2793, 0.4743, 0.5585, 0.5082, 0.1863], [-0.2848, -0.2435, -0.5436, 0.7243, 0.0840, -0.1800], [0.1509, 0.1973, 0.3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAllTasselCapIndices(self,img):\n\t\t\n\t\tdef getTasseledCap(img):\n\t\t\t\"\"\"Function to compute the Tasseled Cap transformation and return an image\"\"\"\n\t\t\t\n\t\t\tcoefficients = ee.Array([\n\t\t\t\t[0.3037, 0.2793, 0.4743, 0.5585, 0.5082, 0.1863],\n\t\t\t\t[-0.2848, -0.2435, -0.5436, 0.7243, 0.084...
[ "0.6802761", "0.6170096", "0.6133901", "0.60912454", "0.5845652", "0.5765843", "0.5763669", "0.57543373", "0.5751262", "0.5718671", "0.56785035", "0.56776994", "0.56630826", "0.5637315", "0.56315714", "0.56188244", "0.55988926", "0.5597698", "0.5585836", "0.55607986", "0.5544...
0.6790514
1
Function to compute the Tasseled Cap transformation and return an image
def getTasseledCap(img):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, previousimage):", "def getTasseledCap(img):\n\t\t\t\n\t\t\tcoefficients = ee.Array([\n\t\t\t\t[0.3037, 0.2793, 0.4743, 0.5585, 0.5082, 0.1863],\n\t\t\t\t[-0.2848, -0.2435, -0.5436, 0.7243, 0.0840, -0.1800],\n\t\t\t\t[0.1509, 0.1973, 0.3279, 0.3406, -0.7112, -0.4572],\n\t\t\t\t[-0.8242, 0.0849...
[ "0.6478242", "0.6399425", "0.6175375", "0.60631186", "0.599424", "0.58806276", "0.5850955", "0.58474565", "0.5803862", "0.57794195", "0.57721114", "0.5757488", "0.5738938", "0.57200027", "0.57200027", "0.5703677", "0.5703677", "0.5703677", "0.57029206", "0.56939614", "0.56906...
0.71848303
0
Function to add 30m SRTM elevation and derived slope, aspect, eastness, and northness to an image. Elevation is in meters, slope is between 0 and 90 deg, aspect is between 0 and 359 deg. Eastness and northness are unitless and are between 1 and 1.
def addTopography(self,img): # Import SRTM elevation data elevation = ee.Image("USGS/SRTMGL1_003"); # Calculate slope, aspect, and hillshade topo = ee.Algorithms.Terrain(elevation); # From aspect (a), calculate eastness (sin a), northness (cos a) deg2rad = ee.Number(math.pi).divide(180); aspect = t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_slope_aspect(slope, aspect, wkt, xform, fp, tmpdir):\n w, h = slope.shape\n \n try:\n handle, filename = mkstemp(dir=tmpdir, prefix='slope-aspect-', suffix='.tif')\n close(handle)\n \n driver = gdal.GetDriverByName('GTiff')\n gtiff_options = ['COMPRESS=JPEG', 'J...
[ "0.56199247", "0.5305509", "0.52611077", "0.5192918", "0.51714647", "0.5160872", "0.51578385", "0.51510555", "0.5125877", "0.5098165", "0.50949097", "0.506125", "0.50448906", "0.50039434", "0.49909866", "0.49797404", "0.49714604", "0.49694428", "0.48181123", "0.48124117", "0....
0.5537641
1
Evaluate Delta R between two objects
def delta_r(o1, o2): d_phi = o1.phi - o2.phi if d_phi < -pi: d_phi += pix2 if d_phi > pi: d_phi -= pix2 return hypot(o1.eta - o2.eta, d_phi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __rtruediv__(self, other):\n value = -1 / (self.val * self.val)\n total = {self.var: other * value}\n return AutoDiffReverse(other / self.val, None, total)", "def epsilon_delta(self):", "def __truediv__(self, other):\n try:\n value = -1 / (other.val * other.val)\n ...
[ "0.65177035", "0.6383682", "0.6307158", "0.62640095", "0.6199991", "0.6117177", "0.6008128", "0.5971522", "0.59231496", "0.58871377", "0.5877812", "0.5806873", "0.57781816", "0.5731674", "0.57224244", "0.5720133", "0.5700213", "0.5700213", "0.5693242", "0.5667665", "0.5652177...
0.6505122
1
Processes a gpx route file to assign scariness score to each waypoint
def get_route_with_scariness_from_file(route_file_path): route = read_gpx.read_gpx(route_file_path) route = read_gpx.pad_gpx_dataframe(route) route_bounds = read_gpx.get_route_bounds(route) if not csp.check_route_bounds_fit_location_data(route_bounds): abort(400) altitudes_df = csp.get_compl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gtfs_routes(gtfs, output_f):\n\n\t# Load up the stop times so we can find which are the best routes.\n\t#TODO\n\tstop_times_file = [x for x in gtfs.namelist() if 'stop_times' in x][0]\n\n\tstoptimes_c = csv.reader((gtfs.open(stop_times_file, 'r')))\n\theader = stoptimes_c.next()\n\ttrip_id_col = header.index('...
[ "0.5804729", "0.57079357", "0.56287354", "0.5589738", "0.5480822", "0.54700845", "0.54322046", "0.5416901", "0.53724426", "0.5369428", "0.5328261", "0.5310065", "0.5301427", "0.52883816", "0.52178824", "0.5206266", "0.5193167", "0.5183766", "0.5160514", "0.5158721", "0.514944...
0.6581875
0
Checks that a route matching the route file name is not already in the Routes database
def check_route_not_loaded(route_file): loaded_routes = administer_route_database.get_loaded_routes( administer_route_database.get_route_db_connection() ) route_file_route_name = Path(route_file).name.replace('.gpx', '') for group in loaded_routes: if route_file_route_name in group: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_routes(routes, serverdir):\n for route in routes:\n file_ = os.path.join(serverdir,\n routes[route].lstrip('/'))\n if not os.path.isfile(file_):\n print('no file for route rule:', route+','+file_)\n sys.exit(1)", "def validate_route(sel...
[ "0.6775998", "0.64381325", "0.61428326", "0.5804251", "0.5692228", "0.5555167", "0.5551878", "0.5467528", "0.54438454", "0.537621", "0.5356725", "0.53260255", "0.53109175", "0.5305829", "0.5243538", "0.52422684", "0.52327466", "0.5220092", "0.5192756", "0.5159098", "0.515553"...
0.73544973
0
Translates the fear level given by the application to a minimum scariness rating at which to flag Waypoints
def translate_fear_level(fear_level): if fear_level == 1: scariness_threshold = 6 elif fear_level == 2: scariness_threshold = 5 else: scariness_threshold = 4 return scariness_threshold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_overall_rating(player_dict):\r\n if player_dict[\"position\"].upper() == \"QB\":\r\n throw_power = int(max(min(int(player_dict[\"throw_power\"]), 99), 70))\r\n throw_accuracy = int(max(min(math.ceil(\r\n ((2 * (\r\n int(player_dict[\"throw_accuracy_short\"])...
[ "0.5829933", "0.58176476", "0.5638452", "0.56209517", "0.5589053", "0.5571006", "0.55488455", "0.5503826", "0.547983", "0.5463169", "0.5461306", "0.5446944", "0.538736", "0.5354595", "0.5354105", "0.5351673", "0.5351555", "0.53312486", "0.53265476", "0.52974695", "0.5292194",...
0.683665
0
detect a time series using cusum algorithm
def detect_via_cusum_lg(ts, istart=30, threshold_times=5): S_h = 0 S_l = 0 S_list = np.zeros(istart) # 前面填充的30个空数据 meanArray = talib.SMA(ts,timeperiod = istart) stdArray = talib.STDDEV(np.log(ts/meanArray),timeperiod = istart) for i in range(istart, len(ts)): # 这里是否应该掐头去尾? tslog = np.log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CEPSTRUM(y, t):\n dt = t[2] - t[1]\n #Fs = 1.0 / dt\n L = len(y)\n #Y = fft(y, L)\n #amp = np.abs(Y)/(L/2) # FFT single sided spectrum\n #T = L * dt #1/T=Fs/L\n #freq = np.arange(0, Fs / 2, 1 / T) # list frequencies up to Nyquist frequency\n #C=real(ifft(log(abs(fft(y)))))\n C = np.a...
[ "0.60948336", "0.5735917", "0.54944384", "0.54803497", "0.5476483", "0.54686457", "0.5446705", "0.54417604", "0.539834", "0.5380892", "0.5366723", "0.5334913", "0.53329235", "0.53267103", "0.52999914", "0.52974385", "0.52880305", "0.5285251", "0.52793515", "0.5261482", "0.525...
0.6326485
0
If a Twitter request fails, sleep for 15 minutes. Do this at most max_tries times before quitting.
def robust_request(twitter, resource, params, max_tries=5): for i in range(max_tries): request = twitter.request(resource, params) if request.status_code == 200: return request else: print('Got error %s \nsleeping for 15 minutes.' % request.text) sys.stder...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def robust_request(twitter, resource, params, max_tries=5):\n \n for i in range(max_tries):\n request = twitter.request(resource, params)\n if request.status_code == 200:\n return request\n else:\n print('Got error %s \\nsleeping for 15 minutes.' % request.text)\n ...
[ "0.76129365", "0.64839786", "0.63807046", "0.6314336", "0.62921405", "0.62880915", "0.61898947", "0.6158489", "0.6138314", "0.6099748", "0.6068707", "0.6052159", "0.59786904", "0.59786904", "0.59786904", "0.597821", "0.59454453", "0.5937674", "0.58483416", "0.58388543", "0.58...
0.76959914
0
Retrieve the Twitter user objects for each screen_name.
def get_users(twitter, screen_names): ###TODO-- Completed #create a request for Twitter to fetch data, using robust_request function, limiting to 200 #get the requests for every screen_name and store it in a list requests = [robust_request(twitter,'users/lookup',{'screen_name':screen_name, 'count':200}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_users(twitter, screen_names):\n request = robust_request(twitter, 'users/lookup', {'screen_name': screen_names}, max_tries=5)\n user_info = []\n for user in request:\n \tuser_info.append(user)\n return user_info", "def get_data_user(twitter, screen_names):\n\n data_user = []\n for na...
[ "0.8145805", "0.7709179", "0.7126518", "0.6822808", "0.67804223", "0.6779172", "0.66131747", "0.65748686", "0.65124315", "0.6483101", "0.64769137", "0.63471603", "0.6294934", "0.6165395", "0.61579555", "0.6129354", "0.6095629", "0.60620123", "0.60600054", "0.6058718", "0.6029...
0.78942174
1
Print the number of friends per candidate, sorted by candidate name. See Log.txt for an example.
def print_num_friends(users): ###TODO-- Completed #Creating a new dictionary to store the KEY, VALUE pair for friends of every screen_name i.e. user # and their counts i.e. number of friends per user all_friends_dict = {} for user in users: all_friends_dict[user['screen_name']] = len(user[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_num_friends(users):\n for u_dict in users:\n print (\"%s %d\" %(u_dict['screen_name'], len(u_dict['friends'])))", "def count_friends(users):\n all_friends=[]\n for u_dict in users:\n for items in u_dict['friends']:\n all_friends.append(items)\n count = Counter(...
[ "0.6788219", "0.59221166", "0.56460106", "0.56306136", "0.5574623", "0.5539996", "0.5467627", "0.54092085", "0.5366763", "0.53536737", "0.53502715", "0.53304505", "0.52850896", "0.5251744", "0.5247304", "0.52443355", "0.52171576", "0.520803", "0.5205573", "0.5205573", "0.5190...
0.7238758
0
Count how often each friend is followed.
def count_friends(users): ###TODO-- Completed #Creating a Counter object, to count the mapping c = Counter() c.update(friend_id for user in users for friend_id in user['friends']) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_friends(users):\n all_friends=[]\n for u_dict in users:\n for items in u_dict['friends']:\n all_friends.append(items)\n count = Counter()\n for frnd in all_friends:\n count[frnd]+=1\n return count", "def count_friends(self):\n query = read_query('c...
[ "0.7489338", "0.70336175", "0.70297045", "0.69893944", "0.6874314", "0.67994153", "0.67738897", "0.66341037", "0.6608121", "0.62928677", "0.62310994", "0.6174809", "0.603691", "0.6025284", "0.60199904", "0.59938794", "0.59653294", "0.5948239", "0.59337586", "0.5919943", "0.59...
0.72688586
1
Compute the number of shared accounts followed by each pair of users.
def friend_overlap(users): ###TODO-- Completed #Creating a list of tuples to store the values for number of shared accounts by each of the user overlap_tuples = [] #Trying for all the combination if user's without repetition for outer_idx,_ in enumerate(users): for inner_idx,_ in enumerate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_pairwise_user_similarity(self, user1_preferences, user2_preferences):\r\n\r\n shared_items = set(user1_preferences.indices) & set(user2_preferences.indices)\r\n\r\n all_items = set(user1_preferences.indices) | set(user2_preferences.indices)\r\n\r\n num_agreements = sum(1 for x in...
[ "0.6410819", "0.63967514", "0.6126403", "0.6060102", "0.60091025", "0.5765657", "0.5672716", "0.56712496", "0.5659659", "0.5650826", "0.5642087", "0.5629103", "0.5578294", "0.5570148", "0.54584384", "0.54282904", "0.5406067", "0.5401401", "0.5397055", "0.5396023", "0.5381516"...
0.64838386
0
Find and return the screen_name of the one Twitter user followed by both Hillary Clinton and Donald Trump. Using the TwitterAPI to convert the Twitter ID to a screen_name.
def followed_by_hillary_and_donald(users, twitter): ###TODO-- Completed for user in users: if user['screen_name'] == 'HillaryClinton': friends_Hillary = user['friends'] #print(len(friends_Hillary)) elif user['screen_name'] == 'realDonaldTrump': friends_donald ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def followed_by_hillary_and_donald(users, twitter):\n\n str = ''\n set1 = set()\n set2 = set()\n for u_dict in users:\n \tif u_dict['screen_name'] == 'HillaryClinton':\n \t\tset1 = set(u_dict['friends'])\n \telif u_dict['screen_name'] == 'realDonaldTrump':\n \t\tset2 = set(u_dict['friends']...
[ "0.7442753", "0.675429", "0.62897015", "0.6174623", "0.5731249", "0.57199556", "0.57191813", "0.5523849", "0.5438702", "0.54316574", "0.53900385", "0.5376651", "0.5340155", "0.5266645", "0.5266013", "0.525878", "0.52508754", "0.52349985", "0.5231683", "0.5230022", "0.52211875...
0.7037834
1
Create a networkx undirected Graph, adding each candidate and friend
def create_graph(users, friend_counts): ###TODO-- Completed G = nx.Graph() #For Filtering the Nodes #print(friend_counts) friend_nodes = [friend for friend in friend_counts if friend_counts[friend] > 1] candidate_nodes = [user['screen_name'] for user in users] #print("Nodes: ",len(friend_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(friends: list, mutuals: dict) -> nx.classes.graph.Graph:\n friends_ids = [friend['id'] for friend in friends]\n G = nx.Graph()\n G.add_nodes_from(range(len(friends_ids)))\n\n for idx in tqdm(friends_ids):\n node_id = friends_ids.index(idx)\n G.nodes[node_id]['vk_id'] = idx...
[ "0.7127473", "0.6754733", "0.6723426", "0.66156125", "0.6598361", "0.65796894", "0.6538674", "0.6529904", "0.6496961", "0.64637756", "0.64514536", "0.64246947", "0.64232814", "0.6319336", "0.63178855", "0.6282292", "0.6275593", "0.6268891", "0.6247102", "0.6227013", "0.622087...
0.76689845
0