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
Reads a file until it finds a 'header finalization' line. By standard, such line is '\n' (five )
def skip_file_header(file_pointer, header_end="-----\n"): # Reads file line once line = file_pointer.readline() while line: # Reads until eof # Checks if the line is a header ender if line == header_end: return line = file_pointer.readline() # If EOF is reached wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_gutenberg_header(fp):\n for line in fp:\n if line.startswith('*END*THE SMALL PRINT!'):\n break", "def skip_gutenberg_header(fp):\n for line in fp:\n if line.startswith(''):\n break", "def skip_gutenberg_header(self, fp):\n for line in fp:\n if line.sta...
[ "0.6732128", "0.6703168", "0.65750206", "0.6532136", "0.64251715", "0.6425103", "0.64053565", "0.6342697", "0.61418253", "0.6105702", "0.59541345", "0.5769603", "0.5761424", "0.5737028", "0.5736275", "0.57220525", "0.57138824", "0.5702146", "0.56965077", "0.56569594", "0.5649...
0.7243702
0
Tries to read the output file from argv[argn]. If argv[argn] does not exist, the output file is set to sdt_name, whose standard value is 'output.txt'.
def get_output_file_name(argn=2, std_name='output.txt'): try: name = sys.argv[argn] except IndexError: name = std_name print("Warning: no output file name received. Output will be" " written to '%s'." % name) return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_file():\n if len(sys.argv) < 4:\n return -1\n return sys.argv[3]", "def output_file_name_maker(args):\n log.debug(\"Entering output_file_name_maker()\")\n path = os.getcwd() + '/out_files/'\n if not os.path.isdir(path):\n os.mkdir(path)\n\n if args.output is None:\n...
[ "0.68974876", "0.64077896", "0.6069774", "0.6004914", "0.59959024", "0.5963026", "0.58799326", "0.583073", "0.5725154", "0.56617206", "0.5534797", "0.55120677", "0.5463668", "0.5450547", "0.5433109", "0.5391978", "0.5383544", "0.5372698", "0.53699344", "0.5338002", "0.5331420...
0.78180575
0
Reads a folder path from argv (argv[2] by standard). Adds the separator character (/, \\) if it was forgotten. Checks if the folder exists, and creates it otherwise. If the corresponding position in argv is not informed, asks for the user the path of the folder, starting from a given root folder.
def get_output_folder_name(argi=2, root_folder=""): # First tries to read the output folder name from argv[2] try: output_folder = sys.argv[argi] except IndexError: # If argv[argi] was not passed, asks the user for the output folder. output_folder = root_folder output_folder ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_folder():\n return input(\"Folder: \")", "def ensure_folder(*arg):\n if len(arg) == 0:\n raise Exception(\"No input to ensure_folder\")\n path = get_dir(Path(*arg))\n path.mkdir(parents=True, exist_ok=True)", "def prep_folder(args):\n if(args.save_folder[-1]!='/'):\n args.s...
[ "0.63502616", "0.62756735", "0.6241278", "0.5936637", "0.5681377", "0.55883825", "0.5549787", "0.5519103", "0.5444538", "0.54012996", "0.53955", "0.53797764", "0.537001", "0.53520656", "0.53201383", "0.5316586", "0.5289567", "0.5267681", "0.5265646", "0.5260384", "0.5260384",...
0.6402549
0
Reads multiple strings separated by commas and removes border spaces.
def read_csv_names(string): return [remove_border_spaces(name) for name in string.split(',')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strip_strings_array(strings):\n string_array = strings.strip()\n string_array = string_array.split(',')\n result = []\n for string in string_array:\n string = string.strip()\n if string:\n result.append(string)\n return result", "def _clean_string(self, string):\n ...
[ "0.6063498", "0.59767", "0.5961129", "0.58939993", "0.5801716", "0.56955117", "0.56331944", "0.5605717", "0.5415791", "0.53999573", "0.53361046", "0.53183955", "0.5304728", "0.5300823", "0.52928203", "0.52311575", "0.522873", "0.5206089", "0.5194998", "0.5175699", "0.5159555"...
0.617661
0
create 2 1D gaussian Kernels by taking in same kernel size and sigma value that sigy = 3sigx, and form 2D kernel
def MVgaussian(size,mu1=0,mu2=0, sigma1=3,sigma2 = 1): kernel = np.zeros((size, size), dtype=np.float32) size = int(size) // 2 X = np.arange(-size,size+1) Y = np.arange(-size,size+1) for x in X: for y in Y: Gx = np.exp(-((x-mu1)**2)/(2*(sigma1**2))) Gy = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian2d(filter_size=5, sig=1.0):\n ax = np.arange(-filter_size // 2 + 1., filter_size // 2 + 1.)\n xx, yy = np.meshgrid(ax, ax)\n kernel = np.exp(-0.5 * (np.square(xx) + np.square(yy)) / np.square(sig))\n return kernel / np.sum(kernel)", "def makeGaussianKernel(sigma: float) -> np.ndarray:\n\n...
[ "0.7332826", "0.727613", "0.72481734", "0.7187981", "0.7060818", "0.7011949", "0.6993787", "0.69755137", "0.67996466", "0.67077035", "0.6697541", "0.6688304", "0.66812515", "0.6680533", "0.66462684", "0.66387516", "0.6636602", "0.65469486", "0.6504632", "0.647639", "0.64753",...
0.73550737
0
DoG (Difference of Gaussian) Filter is generated by convolving Sobel Kernel with a Gaussian Kernel under a given size, orientation and scale. ie obtain first derivative of Gaussian Kernel. DoG Filter Bank is a set of DoG filters generated by obtaining first derivative of Gaussian kernels under various orientations and ...
def OrientedDoG(size=7,scales=[1,2],n_orientations=8): filt_count = 0 # declare the sobel kernel sobel_kernel = np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], dtype=np.float32) # pre define a dummy filter bank n_filters = len(scales)*n_orient...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_DOGs(inner_sigma, x, shape):\n DOG = make_DOG(inner_sigma, x)\n result = np.zeros((shape[0]*shape[1], x.size**2))\n for i in range(shape[0]): \n for j in range(shape[1]): \n k = shift_kernel(DOG, shape, (i,j))\n result[i+shape[0]*j,:] = k.flatten()\n \n return re...
[ "0.6555714", "0.6427121", "0.6140465", "0.6132629", "0.6105337", "0.60346574", "0.59940916", "0.59735537", "0.595391", "0.595101", "0.5937852", "0.5931722", "0.5903503", "0.58702475", "0.5850902", "0.58302706", "0.57934594", "0.57778287", "0.57675123", "0.5729597", "0.5715408...
0.6729979
0
Creates a partial role from the given `role_id`. If the role already exists returns that instead.
def create_partial_role_from_id(role_id, guild_id = 0): try: return ROLES[role_id] except KeyError: pass role = Role._create_empty(role_id, guild_id) ROLES[role_id] = role return role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_role(self, role_id, role):\n raise exception.NotImplemented() # pragma: no cover", "def get_role(self, role_id):\n raise exception.NotImplemented() # pragma: no cover", "def get_role(self, role_id: int, /) -> Optional[Role]:\n return self.guild.get_role(role_id) if self._roles...
[ "0.68688715", "0.6774872", "0.6424449", "0.61903214", "0.61115676", "0.60018206", "0.59815186", "0.5958131", "0.59569633", "0.5928142", "0.5925251", "0.5838952", "0.57899237", "0.5773943", "0.57660884", "0.5758392", "0.5740605", "0.5716096", "0.5712389", "0.5708068", "0.56919...
0.8589602
0
If the text is a role mention, returns the respective role if found.
def parse_role_mention(text): parsed = ROLE_MENTION_RP.fullmatch(text) if parsed is None: return role_id = int(parsed.group(1)) return ROLES.get(role_id, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_role(text, guild = None):\n parsed = ID_RP.fullmatch(text)\n if (parsed is not None):\n role_id = int(parsed.group(1))\n try:\n role = ROLES[role_id]\n except KeyError:\n pass\n else:\n return role\n \n role = parse_role_mention(tex...
[ "0.7939911", "0.6218153", "0.6166001", "0.61075884", "0.61075884", "0.61075884", "0.60433793", "0.6028485", "0.602459", "0.60132086", "0.5959827", "0.5903753", "0.58772725", "0.5834123", "0.58187157", "0.5792916", "0.5744908", "0.5739665", "0.5716778", "0.5713221", "0.5666325...
0.8352632
0
Tries to parse a role out from the given text.
def parse_role(text, guild = None): parsed = ID_RP.fullmatch(text) if (parsed is not None): role_id = int(parsed.group(1)) try: role = ROLES[role_id] except KeyError: pass else: return role role = parse_role_mention(text) if (role ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_role_mention(text):\n parsed = ROLE_MENTION_RP.fullmatch(text)\n if parsed is None:\n return\n \n role_id = int(parsed.group(1))\n return ROLES.get(role_id, None)", "def from_string(cls, role: str) -> \"ProjectRole\":\n role = role.lower()\n for r in cls:\n ...
[ "0.77921796", "0.5978904", "0.58639723", "0.55597717", "0.54797274", "0.533363", "0.52843875", "0.52097017", "0.52029", "0.5198293", "0.5160467", "0.5152056", "0.51393384", "0.5109315", "0.51079017", "0.51058346", "0.50979936", "0.50877523", "0.508482", "0.50777274", "0.50777...
0.8224785
0
Fixture to get minigraph facts
def minigraph_facts(duthosts, rand_one_dut_hostname, tbinfo): duthost = duthosts[rand_one_dut_hostname] return duthost.get_extended_minigraph_facts(tbinfo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_setup(self):\n random_vars = ['D', 'I', 'G', 'S', 'L']\n\n for rv in random_vars:\n self.assertTrue(rv in self.Gs.nodes)\n self.assertTrue(isinstance(self.Gs.nodes[rv], DiscreteNetworkNode))", "def test_get_hyperflex_node_by_moid(self):\n pass", "def te...
[ "0.5542392", "0.53636146", "0.53595406", "0.5312273", "0.5284532", "0.521184", "0.5182062", "0.51748407", "0.5132129", "0.5122965", "0.5092739", "0.50812584", "0.50746775", "0.50527835", "0.5052672", "0.5042752", "0.50389737", "0.50388426", "0.5033967", "0.5026703", "0.502106...
0.6679881
0
Parse a blog post comment using `commentmarkup.parse` function.
def parse_comment(value): try: return mark_safe(commentmarkup.parse(value)) except ValueError: return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_comment(comment, postid):\n urls = get_links_from_body(comment.body)\n if urls:\n # Only insert comment into DB if it contains a link\n comid_db = db.insert('Comments',\n (None,\n postid,\n comment.i...
[ "0.7271946", "0.63812876", "0.62457097", "0.606756", "0.59673697", "0.58122927", "0.5781495", "0.5712194", "0.55278826", "0.54838717", "0.5460556", "0.5456942", "0.5434908", "0.5390793", "0.53862107", "0.5372897", "0.53674394", "0.5357156", "0.5336541", "0.53325605", "0.53119...
0.65297025
1
Parse the given text using the markup parser defined in `settings.MARKUP_PARSER` (or `limited.markup.pygtile`, if none was set).
def parse(*args, **kwargs): if hasattr(settings, 'MARKUP_PARSER'): parser = settings.MARKUP_PARSER if not callable(parser): parser = MARKUP_PARSERS.get(parser, 'textile') else: parser = MARKUP_PARSERS['textile'] try: return mark_safe(parser(*args, **kwargs)) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(text):\n md = markdown.Markdown(['codehilite', 'tables', ])\n\n for iref in re.findall(img_ref_re, text):\n img_id = iref[7]\n try:\n image = FlatPageImage.objects.get(pk=int(img_id))\n md.references[img_id] = (image.image_path.url, '')\n except ObjectDoes...
[ "0.63776726", "0.6272165", "0.61974937", "0.61344326", "0.6089678", "0.6000796", "0.5909587", "0.590035", "0.5859011", "0.58447737", "0.58194363", "0.5794619", "0.57134396", "0.5710515", "0.57059056", "0.56801045", "0.56688005", "0.5572823", "0.5505512", "0.5502471", "0.54959...
0.6886756
0
Class method. Instanciates several synapses with various dimensions.
def instantiate(cls, dim_list, **kwargs): instances = (cls(dim=dim, **kwargs) for dim in dim_list) syn_dict = {str(inst.dim):inst for inst in instances} print("Synapses instanciated: {}".format(syn_dict.keys())) return syn_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_synapses(self):\n pass # Ignore if child does not implement.", "def __init__(self, center, leads, connections):\n\n if not center.is_square():\n raise ValueError(\"Center is not a square TightBinding\")\n\n self.center = center.copy()\n self.dims = center.dims\n ...
[ "0.65790576", "0.6057899", "0.59684527", "0.595147", "0.594852", "0.5947397", "0.59022313", "0.5834885", "0.57945764", "0.5773133", "0.5739251", "0.57297397", "0.5662556", "0.5654211", "0.5625765", "0.5613609", "0.56102866", "0.56065047", "0.5592228", "0.5544771", "0.55325526...
0.6679907
0
Class method. Loads a particular synapse which has been previousely saved.
def retrieve_synapse(cls, synindex): try : synapses_register = load_register('all_syn') # Retrieving the desired attributed attrs = synapses_register[synapses_register["Index"]==synindex].drop(['Index'], axis=1).to_dict('records')[0] # Intanciation of the synapse:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_workflow( self, workflow_id ):\n id = self.app.security.decode_id( workflow_id )\n stored = self.app.model.context.query( self.app.model.StoredWorkflow ).get( id )\n return stored.latest_workflow", "def load_inst(self):\n self.sanity_check()\n\n fname_pub_auth_all = '...
[ "0.61228395", "0.54798925", "0.5319807", "0.5294654", "0.52732694", "0.52658606", "0.5130691", "0.5092706", "0.50370383", "0.5030796", "0.50277567", "0.50262105", "0.5024152", "0.5024152", "0.5024152", "0.5024152", "0.50175834", "0.5012333", "0.4983431", "0.49762696", "0.4973...
0.64493716
0
Loads a particular saved response. It fills the dictionary attribute "resp" with different components of the simulation. See the attribute "resp" for more details.
def retrieve_response(self, respindex): try : # Unpacking the data in the .resp attribute: self.indexes['resp'] = respindex path_dir = path_directory('resp', self) self.resp['coords'] = pd.read_csv(os.path.join(path_dir, 'coords.csv'), index_col=0).to_numpy() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_response(self):\n self.indexes['resp'] = attribute_index('resp', self)\n # Checking if the attribute \"resp\" is not empty:\n if not type(self.resp['coords']) == np.ndarray:\n print(\"Response is empty. Please run a simulation.\")\n # Checking if the target response ...
[ "0.67248696", "0.56677526", "0.5657209", "0.56208336", "0.5567731", "0.5557515", "0.54890513", "0.54850507", "0.54704213", "0.5448182", "0.54024094", "0.5309183", "0.52602434", "0.5231793", "0.5204311", "0.51842964", "0.5177023", "0.5176254", "0.515962", "0.5152318", "0.51187...
0.6242779
1
Runs a simulation with the current instance. If the simulation has already been run previousely, the response is retrived in the attribute "resp".
def simulate_stimulation(self, patt): # Defining the response: self.identities['resp'] = identity_summary('resp', patt) respindex = attribute_index('resp', self) # Running the simulation if no response has been computed for this pattern: if respindex == None : print('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_simulation_stores_result(self):\n sim = ss.Simulation()\n assert sim.results == []\n sim.run_simulation(10)\n assert sim.results != []\n assert len(sim.results) == 10", "def _simulation_run(model_instance, observations, actions, rewards):\r\n\r\n for observa...
[ "0.68201935", "0.65608263", "0.64012814", "0.61906785", "0.6135423", "0.60619414", "0.6045807", "0.6036227", "0.6035245", "0.60110086", "0.59889466", "0.59382665", "0.59206253", "0.5891769", "0.5887811", "0.58801687", "0.5842534", "0.5816389", "0.58069575", "0.58062744", "0.5...
0.7099714
0
Saves the response of the current instance, stored in the attribute "resp". It registers the synapse in the register of all synapses, if it has never been saved before. It registers the response in the register of responses of the synapse. It creates a subfolder for the response in the directory of the synapse, to drop...
def save_response(self): self.indexes['resp'] = attribute_index('resp', self) # Checking if the attribute "resp" is not empty: if not type(self.resp['coords']) == np.ndarray: print("Response is empty. Please run a simulation.") # Checking if the target response has already be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save_response(self, method, extras, data):\n\n import os, re\n to = \"/tmp/lex/\"\n if not os.path.exists(to):\n os.mkdir(to)\n\n removeables = re.compile('[/&?:]')\n filename = method + '-' + '_'.join(\"%s=%s\" % kv for kv in extras.iteritems())\n filenam...
[ "0.6496459", "0.63103664", "0.6086072", "0.58819896", "0.5703142", "0.56734663", "0.5585821", "0.5573588", "0.545367", "0.54131037", "0.54019815", "0.53985244", "0.5360619", "0.5357478", "0.53520054", "0.53313655", "0.5265266", "0.5248387", "0.5233007", "0.5187448", "0.516300...
0.79284173
0
Displays the matrixes representing the synapse.
def visualize_synapse(self, print_coords=False): S = self.S.copy() I = self.I.copy() if print_coords : print_matrix(S, I, self.res, print_coords=True, coords=self.resp['coords']) else : print_matrix(S, I, self.res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n\t\tprint(\"Square Matrix:\")\n\t\tfor i in range(0, len(self.lables)):\n\t\t\tprint(self.matrix[i])", "def print_matrices(self):\n\n \"\"\"\n Print Optimal Matrix\n \"\"\"\n print(\"\\n\", \"_\"*7, \"Optimal Matrix\", \"_\"*7)\n print(\"\\t\\t\" + \"\\t\".join...
[ "0.7430056", "0.65280557", "0.6505762", "0.63814694", "0.6345823", "0.6343931", "0.63282037", "0.62735105", "0.6241176", "0.62010705", "0.61724424", "0.6158194", "0.61249804", "0.6123386", "0.60994476", "0.60917485", "0.60899925", "0.60591555", "0.60288167", "0.60245425", "0....
0.6918936
1
Make a proper FQDN from name
def _ensure_fqdn(self, name): if name[-1:] != ".": return "%s." % name else: return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dns_name ( base_name, name ) :\n return create_r53_name( base_name, name) + '.mse-esp.com'", "def create_domain_name(self, name):\n return (\"%s.%s.%s\" % (name, \"net\", self.domain)).lower()", "def create_internal_dns_name ( base_name, name ) :\n name = name + '.internal'\n return cre...
[ "0.75482833", "0.71567446", "0.7055514", "0.6987774", "0.6612602", "0.65653723", "0.65199786", "0.6346808", "0.6328137", "0.62123156", "0.61994225", "0.61923176", "0.6191347", "0.6179072", "0.61620694", "0.61555946", "0.6129054", "0.61018264", "0.6083514", "0.6032847", "0.603...
0.79934853
0
Return a shuffled array with samples and labels
def shuffled_copies(samples, labels): # Check if the samples and labels are from the same format assert len(samples) == len(labels) permu = np.random.permutation(len(samples)) # Get the correct indexes samples = samples[permu] labels = labels[permu] return samples, labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_data(data, labels):\n idx = np.arange(len(labels))\n np.random.shuffle(idx)\n return data[idx], labels[idx]", "def shuffle_data(data, labels):\n idx = np.arange(len(labels))\n np.random.shuffle(idx)\n return data[idx, ...], labels[idx], idx", "def shuffle_data(self):\n images = l...
[ "0.76070595", "0.7447813", "0.7435367", "0.7387749", "0.7372803", "0.73596", "0.73596", "0.73596", "0.73275393", "0.71254265", "0.69440496", "0.67869115", "0.66839826", "0.66317755", "0.6595794", "0.6549036", "0.6538608", "0.65171605", "0.651533", "0.64785296", "0.64736927", ...
0.7508061
1
Return plot of the accuracy during the training of the neural network
def accuracy_plot(training, test, layers, data_size, n_neighbours, learning_rate, dropout_rate): plt.figure() plt.plot(training, label="Training") plt.plot(test, label="Test") plt.xlabel("Iterations", size='medium') plt.ylabel("Accuracy function (%)", size='medium') plt.suptitle("Accuracy funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_accuracy(self):\n plot_title, img_title = self.prep_titles(\"\")\n test_legend = ['training data', 'test data']\n\n # Data for plotting x- and y-axis\n x = np.arange(1, CFG.EPOCHS + 1)\n y = [self.tr_accuracy, self.test_accuracy]\n\n # prints x and y-axis values\n...
[ "0.80476934", "0.7662797", "0.7526127", "0.73480844", "0.73410636", "0.7286691", "0.7255891", "0.71645975", "0.7152331", "0.71372527", "0.71316504", "0.7096229", "0.70912606", "0.70813125", "0.70319337", "0.7012254", "0.69639987", "0.6930249", "0.69032884", "0.6887325", "0.68...
0.78214025
1
Get the data labels that correspond to the data samples
def data_labels(data): # The data consists of a equal number of benign and deleterious samples # The first part of the data are the benign samples (label 0), and the second part the deleterious ones (label 1) n_samples = data.shape[0] n_class_samples = int(n_samples / 2) # Get a numpy array of the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_labels(data):\n\n # The data consists of a equal number of benign and deleterious samples\n # The first part of the data are the benign samples (label 0), and the second part the deleterious ones (label 1)\n n_samples = data.shape[0]\n n_class_samples = int(n_samples / 2)\n\n # Get a numpy ...
[ "0.77301323", "0.76840097", "0.7593941", "0.7593941", "0.758966", "0.7566302", "0.75237405", "0.7513252", "0.7457496", "0.74083877", "0.7381961", "0.7372222", "0.7349228", "0.7336654", "0.7326944", "0.73216856", "0.7282346", "0.72785324", "0.7277561", "0.72750634", "0.7268131...
0.7718853
1
Return a heatmap for metrics that target single qubits.
def heatmap(self, key: str) -> vis.Heatmap: metrics = self[key] assert all(len(k) == 1 for k in metrics.keys()), ( 'Heatmaps are only supported if all the targets in a metric' ' are single qubits.') assert all(len(k) == 1 for k in metrics.values()), ( 'Heatmap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatmap(\n df: pd.DataFrame, figsize: tuple = (10, 10), scale: float = 1.4\n) -> sns.heatmap:\n\n # keep only quantitative features\n df = create_quanti_df(df)\n print(f\"Number of quantitaive columns: {df.shape[1]}\")\n # calcaulate features correlations\n corr = df.corr() * 100\n # creat...
[ "0.60673547", "0.5961135", "0.5927924", "0.5823532", "0.5730508", "0.5681778", "0.5651682", "0.5618253", "0.5593625", "0.55592394", "0.54876494", "0.54307234", "0.54307234", "0.53738236", "0.5353844", "0.53439945", "0.53200763", "0.53121907", "0.5298264", "0.5285847", "0.5278...
0.7633295
0
Return the maximum flux
def max_flux(self): return np.max(self.flux)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_flux(frame):\n return np.max(frame.fluxes[frame.radii <= max_extent_px])", "def max_time(self):\n return self.time[np.argmax(self.flux)]", "def max(self) -> \"Stream[float]\":\n return self.agg(np.max).astype(\"float\")", "def maximum(x):\n return np.maximum(x, 0)", "def max...
[ "0.8347883", "0.74840814", "0.71864057", "0.704579", "0.7015667", "0.69740826", "0.6961083", "0.69556326", "0.69554335", "0.69472003", "0.6935056", "0.6914028", "0.68585455", "0.67920977", "0.6785096", "0.6783946", "0.67707163", "0.67621744", "0.6759031", "0.6694084", "0.6694...
0.89036936
0
Return the time of the maximum flux
def max_time(self): return self.time[np.argmax(self.flux)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_time(self):\n return np.array([self.wftime[ch][self.waveform[ch].argmax()] for ch in range(self.nchannels)])", "def max(self):\n\n return time_stat(self, stat=\"max\")", "def max_flux(self):\n return np.max(self.flux)", "def max_time(self):\n #{{{ function to return time of last samp...
[ "0.75761044", "0.75565094", "0.75416726", "0.75097215", "0.73423856", "0.71438485", "0.7086532", "0.7000203", "0.69391656", "0.68668413", "0.67839086", "0.67351854", "0.66913486", "0.6666073", "0.66316026", "0.6575393", "0.6508536", "0.64425504", "0.64256316", "0.6416781", "0...
0.9051581
0
Return the reference time, defaults to the mid time
def reference_time(self): if hasattr(self, '_reference_time') is False: self._reference_time = self.midtime return self._reference_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ref_time(self):\n from datetime import datetime, timedelta\n\n ref_time = datetime(2010, 1, 1, 0, 0, 0)\n ref_time += timedelta(seconds=int(self.fid['/PRODUCT/time'][0]))\n return ref_time", "def ref_time(self) -> float:\n return ntp_to_system_time(self.ref_timestamp)",...
[ "0.7942926", "0.74960715", "0.7024686", "0.67897993", "0.66483927", "0.65842915", "0.65842915", "0.6584283", "0.6582991", "0.65362465", "0.65336937", "0.65336937", "0.65284216", "0.6519982", "0.65138245", "0.65086", "0.64379597", "0.6436091", "0.64268744", "0.6416861", "0.636...
0.8897539
0
Naive estimate of the pulse time Uses the mean of flux above a fraction f of the maximum fluc
def estimate_pulse_time(self, f=0.75): idxs = np.abs(self.flux) > f * self.max_flux return np.mean(self.time[idxs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testPeakLikelihoodFlux(self):\n # make mp: a flux measurer\n measControl = measAlg.PeakLikelihoodFluxControl()\n schema = afwTable.SourceTable.makeMinimalSchema()\n mp = measAlg.MeasureSourcesBuilder().addAlgorithm(measControl).build(schema)\n \n # make and measure a series o...
[ "0.6198238", "0.6178355", "0.61166596", "0.610102", "0.6081345", "0.60715514", "0.5992787", "0.58948153", "0.5877116", "0.58590066", "0.5851902", "0.5837642", "0.583406", "0.58227193", "0.5817751", "0.5800002", "0.57959425", "0.5790262", "0.57887185", "0.5788051", "0.57787895...
0.81107914
0
Read in the time and flux from a csv The filename must point to a commaseparated file with at least two columns, "time" and "flux". Optionally, an additional "pulse_number" column can exist, if the pulse_number is specified, only data matching the requested pulse number will be loaded.
def from_csv(cls, filename, pulse_number=None): df = pd.read_csv(filename) return cls._sort_and_filter_dataframe(df, pulse_number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv(name):\n\n DATA = []\n for row in csv.reader(open(name), delimiter=','):\n DATA.append((parse_time(row[0]), float(row[1])))\n\n return DATA", "def readData(filename,timeDelay=0.0, ampMult=1.0):\n data = []\n with open(filename,'r') as f:\n for x in range(4):\n ...
[ "0.64431447", "0.63257873", "0.6152354", "0.6150834", "0.61482006", "0.61410695", "0.61265177", "0.61201715", "0.6092382", "0.5975094", "0.5948267", "0.5919354", "0.5901084", "0.58961165", "0.58782846", "0.5832039", "0.5829291", "0.58229786", "0.5819973", "0.57776815", "0.577...
0.67390954
0
Read in the time and flux from a pandas h5 file The filename must point to a h5 dataframe file. The dataframe should have at least two columns, "time" and "flux". Optionally, an additional "pulse_number" column can exist, if the pulse_number is specified, only data matching the requested pulse number will be loaded.
def from_h5(cls, filename, pulse_number=None): df = pd.read_hdf(filename) return cls._sort_and_filter_dataframe(df, pulse_number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(file_path):\n with h5py.File(file_path) as f:\n # load meta info\n fs, channels, p_names, signals = _get_info(f)\n\n # load raw data\n data = [f['protocol{}/raw_data'.format(k + 1)][:] for k in range(len(p_names))]\n df = pd.DataFrame(np.concatenate(data), column...
[ "0.682035", "0.6719041", "0.6556243", "0.6371989", "0.635916", "0.635621", "0.6349493", "0.6265173", "0.6226241", "0.61761767", "0.6165642", "0.6137056", "0.6137056", "0.60813636", "0.60271335", "0.60026705", "0.59815794", "0.59458834", "0.59458834", "0.591166", "0.5883735", ...
0.7634437
0
Send Grafana annotations to various endpoints
def main(annotate_uri, api_key, title, tags, description, start_time, end_time, debug): log_level = logging.INFO if debug: log_level = logging.DEBUG logging.basicConfig(format=' [%(levelname)s] %(message)s', level=log_level) try: if description is None: if not sys.stdin.is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotation_request():\n resp = make_response([])\n return jsonify(resp)", "def annotate(api_key, text, ontologies=[], longest_only=False, expand_mappings=False, include=[]):\n annotations = []\n url = BIOPORTAL_API_BASE + '/annotator'\n\n headers = {\n 'content-type': \"application/json...
[ "0.59798527", "0.5450754", "0.5424835", "0.54219246", "0.52403", "0.51730776", "0.51689434", "0.5130103", "0.50847834", "0.5067602", "0.5056875", "0.5036574", "0.5017098", "0.50098765", "0.4997202", "0.49937025", "0.4971913", "0.4971564", "0.49649894", "0.49378031", "0.493593...
0.55500025
1
create an local command Test Runner object create the log directory
def start_local_cmd(log_path, log_name="localcmd"): log_dir = os.path.abspath(log_path) try: os.makedirs(log_dir) except OSError: pass return CmdRunner.CmdRunner(log_dir, log_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.path = tempfile.mkdtemp()\n self.log = log.Log(self.path)", "def init_log():\n os.system('rm -rf /target/testdriver.log || true')\n os.system('touch /target/testdriver.log')\n os.system(f\"chown {uid_gid_output} /target/testdriver.log\")\n os.system('chmod 664 /t...
[ "0.65183616", "0.6403981", "0.6274537", "0.6198722", "0.6148515", "0.6137054", "0.610452", "0.60814726", "0.6077535", "0.6061433", "0.60586435", "0.59921736", "0.59883654", "0.59766644", "0.5950229", "0.59476614", "0.59351313", "0.5928388", "0.59242725", "0.59242725", "0.5924...
0.6608124
0
Export CTSDG generator for inference
def export_ctsdg(cfg): generator = Generator( image_in_channels=config.image_in_channels, edge_in_channels=config.edge_in_channels, out_channels=config.out_channels ) generator.set_train(False) load_checkpoint(cfg.checkpoint_path, generator) ckpt_path = Path(cfg.checkpoint_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_generator(\n ckpt, is_stylegan1, G_res, out_size, noconst, latent_dim, n_mlp, channel_multiplier, dataparallel, base_res_factor\n):\n if is_stylegan1:\n generator = G_style(output_size=out_size, checkpoint=ckpt).cuda()\n else:\n generator = Generator(\n G_res,\n ...
[ "0.6295087", "0.61204", "0.5873329", "0.5787015", "0.57816166", "0.5729231", "0.5703594", "0.5680445", "0.5666309", "0.56184757", "0.5589947", "0.55868477", "0.5584511", "0.5568219", "0.55620843", "0.5538686", "0.5524669", "0.5524669", "0.5524669", "0.5520368", "0.5519996", ...
0.6933986
0
Calculate the disparity value at each pixel by searching a small patch around a pixel from the left image in the right image.
def calculate_disparity_map( left_img: torch.Tensor, right_img: torch.Tensor, block_size: int, sim_measure_function: Callable, max_search_bound: int = 50, ) -> torch.Tensor: assert left_img.shape == right_img.shape (H,W,C) = left_img.shape H_offset = block_size//2 W_offset = block_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disparity(self, imgL, imgR):\n # SGBM Parameters -----------------\n window_size = 1 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely\n param = {'minDisparity': 0, 'numDisparities': 32, 'blockSize': 5, 'P1': 10, 'P2': ...
[ "0.6900295", "0.60511535", "0.59079045", "0.58602035", "0.57603073", "0.5694905", "0.5694412", "0.5591769", "0.55177313", "0.5496024", "0.5428157", "0.54159725", "0.5392759", "0.539026", "0.5331411", "0.5300562", "0.52894914", "0.5281148", "0.5274349", "0.5271155", "0.5266134...
0.69326293
0
Calculate the cost volume. Each pixel will have D=max_disparity cost values associated with it. Basically for each pixel, we compute the cost of different disparities and put them all into a tensor.
def calculate_cost_volume( left_img: torch.Tensor, right_img: torch.Tensor, max_disparity: int, sim_measure_function: Callable, block_size: int = 9, ): # placeholders H = left_img.shape[0] W = right_img.shape[1] H_offset = block_size//2 W_offset = block_size//2 cost_volume = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeNodeVolumes(self):\n for i in np.arange(0,self.ni):\n for j in np.arange(0,self.nj):\n for k in np.arange(0,self.nk):\n \n V = self.dh[0]*self.dh[1]*self.dh[2]\n if (i==0 or i==self.ni-1): V*=0.5\n if (j==0 ...
[ "0.5892088", "0.5845971", "0.5578201", "0.5558536", "0.54403883", "0.542479", "0.5368592", "0.5283514", "0.5274385", "0.5272654", "0.52501583", "0.5215531", "0.5213679", "0.51815045", "0.5129831", "0.5067275", "0.5061512", "0.50612044", "0.50498176", "0.5039792", "0.50319874"...
0.6094134
0
Verify the init calls the ResponseRetriever and assigns it to a variable.
def test_init_creates_retriever(self, mock_retriever): mediator = GenericMediator() with self.subTest(): mock_retriever.assert_called_once_with() self.assertIsNotNone(mediator.retriever)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_creates_retriever(self, mock_retriever):\n\n mediator = AuthenticationMediator()\n with self.subTest():\n mock_retriever.assert_called_once_with()\n self.assertIsNotNone(mediator.retriever)", "def test_init_creates_retriever(self, mock_retriever):\n\n mediator...
[ "0.6763478", "0.650543", "0.6442508", "0.6405172", "0.6388726", "0.6354988", "0.6319423", "0.62481976", "0.6236849", "0.62093467", "0.6205554", "0.62045234", "0.61486846", "0.61486846", "0.6147114", "0.60797095", "0.6067892", "0.6054257", "0.60442466", "0.60230684", "0.599693...
0.6619355
1
Returns context_lines before and after lineno from file. Returns (pre_context_lineno, pre_context, context_line, post_context).
def _get_lines_from_file(filename, lineno, context_lines): try: source = open(filename).readlines() lower_bound = max(0, lineno - context_lines) upper_bound = lineno + context_lines pre_context = \ [line.strip('\n') for line in source[lower_bound:lineno]] contex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lines_from_file(filename, lineno, context_lines, loader=None, module_name=None):\n source = None\n if loader is not None and hasattr(loader, \"get_source\"):\n with suppress(ImportError):\n source = loader.get_source(module_name)\n if source is not None:\n source =...
[ "0.68238574", "0.66814256", "0.6353968", "0.60285145", "0.56442934", "0.55935204", "0.5548546", "0.55324066", "0.5492608", "0.5492226", "0.5484061", "0.5471936", "0.5433974", "0.54219884", "0.54219884", "0.54219884", "0.54219884", "0.54219884", "0.54219884", "0.5399224", "0.5...
0.75511456
0
Counts the number of mines in the neighboring cells
def count_neighbor_mines(self, i, j): n_neighbor_mines = -1 if not self.mines[i, j]: n_neighbor_mines = np.count_nonzero( self.mines[(i-1 if i > 0 else 0):i+2, (j-1 if j > 0 else 0):j+2]) return n_neighbor_mines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_neighbor_mines(self, x, y):\n\t\treturn sum(self.mines[n][m] for (n, m) in self.get_valid_neighbors(x, y))", "def count_mines(row, col):\r\n total = 0\r\n for r,c in ((-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)):\r\n try:\r\n if mines[row+r][col+c] == 1:\r\n ...
[ "0.7669013", "0.7432709", "0.7387753", "0.73015106", "0.73015106", "0.71925914", "0.717505", "0.717505", "0.717505", "0.717505", "0.717505", "0.717505", "0.7049067", "0.6970313", "0.6896128", "0.6819619", "0.6798525", "0.6792678", "0.6749823", "0.6746723", "0.67394674", "0....
0.75128317
1
Counts the number of flags in the neighboring cells
def count_neighbor_flags(self, i, j): return np.count_nonzero(self.flags[(i-1 if i > 0 else 0):i+2, (j-1 if j > 0 else 0):j+2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_neighbor_flags(self, x, y):\n\t\treturn sum(self.marks[n][m] == FLAG for (n, m) in self.get_valid_neighbors(x, y))", "def count_ones(self):\r\n count = 0\r\n for x in range(self.xspan):\r\n for y in range(self.yspan):\r\n if (self.cells[x][y] == 1):\r\n count = count + 1\r\n ...
[ "0.7226011", "0.70463705", "0.7027355", "0.6893158", "0.68669856", "0.68662775", "0.68303967", "0.6791698", "0.6785953", "0.6753818", "0.6682841", "0.66777", "0.6659068", "0.6614095", "0.66125906", "0.66072136", "0.6595425", "0.6584443", "0.65721947", "0.65716237", "0.6536127...
0.77383655
0
Updates revealed cells by checking i, j cell and, recursevely, the contiguous cells without mines
def update_revealed(self, i, j): if not self.revealed[i, j]: # If not revealed cell if self.mines_count[i, j] < 0: # If wrong guess, games is over self.wrong = ~self.mines & self.flags self.wrong[i, j] = True self.game_over(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_cells(self):\n for row_number in range(self.number_cells_y):\n for col_number in range(self.number_cells_x):\n alive_neighbours = self._get_neighbours(row_number,col_number)\n \n self.to_be_updated[row_number][col_number] = False\n ...
[ "0.6543957", "0.6512995", "0.64951646", "0.6436034", "0.64001656", "0.6396528", "0.6367996", "0.6297945", "0.6249026", "0.6216629", "0.62085146", "0.616299", "0.6137553", "0.6112846", "0.60776544", "0.60543495", "0.6053125", "0.6035872", "0.6023709", "0.6005335", "0.59641814"...
0.7017881
0
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels
def get_labels(model): return model._labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cuda(model):\n\treturn next(model.parameters()).is_cuda", "def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y", "def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n...
[ "0.6806257", "0.669914", "0.65282595", "0.6442955", "0.64141417", "0.6413409", "0.6413409", "0.6398103", "0.6295529", "0.62921506", "0.6242659", "0.62091666", "0.6193946", "0.6167976", "0.61455184", "0.61455184", "0.61455184", "0.61322767", "0.61322767", "0.61322767", "0.6132...
0.70128405
0
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels
def get_labels(model): return model._labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cuda(model):\n\treturn next(model.parameters()).is_cuda", "def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y", "def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n...
[ "0.6810129", "0.6698149", "0.65257776", "0.6438587", "0.64099574", "0.6408952", "0.6408952", "0.6402114", "0.6291775", "0.6290124", "0.6238092", "0.6206064", "0.6190825", "0.61644405", "0.6142085", "0.6142085", "0.6142085", "0.6127087", "0.6127087", "0.6127087", "0.6127087", ...
0.7009926
1
Just a display() helper to print html code
def print_html(html): display(HTML(html))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n import IPython.display\n disp = IPython.display.HTML(self.render())\n return IPython.display.display(disp, display_id=str(id(self)))", "def display(self):\n\n # This will automatically choose the best representation among repr and repr_html\n\n display(self)",...
[ "0.73515886", "0.723867", "0.723867", "0.7181439", "0.7181439", "0.70992374", "0.7065982", "0.7065982", "0.7032903", "0.7032903", "0.69843686", "0.6875104", "0.6814682", "0.67885303", "0.6762089", "0.6761663", "0.67187154", "0.6695939", "0.66857904", "0.6666695", "0.66522455"...
0.7675851
0
Finds the cell in choices that is nearest from the target_cell.
def nearest_hex_cell(target_cell, choices): if choices: return _first(sorted(choices, key=lambda cell: distance_between_hex_cells(target_cell, cell)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest(self, query):\n nearest_trees = list(map(lambda t: t.get_nearest_neighbor(query), self.trees))\n distances_pool = list(zip(map(lambda x: self.dist_fn(x, query), self.pool), self.pool))\n best = None\n best_cost = np.inf\n for cost, near in nearest_trees + distances_po...
[ "0.6510009", "0.6492891", "0.64590746", "0.633086", "0.6319562", "0.62440336", "0.6179793", "0.6140357", "0.6127919", "0.61007917", "0.6088066", "0.6043872", "0.60174316", "0.6001085", "0.5987224", "0.59601593", "0.59468365", "0.59194386", "0.59109855", "0.58930826", "0.58856...
0.7604984
0
Finds the cell in choices that is furthest from the target_cell.
def furthest_hex_cell(target_cell, choices): if choices: return _first(sorted(choices, reverse=True, key=lambda cell: distance_between_hex_cells(target_cell, cell)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_hex_cell(target_cell, choices):\n if choices:\n return _first(sorted(choices,\n key=lambda cell: distance_between_hex_cells(target_cell, cell)))", "def search_best_goal_node(self):\n\n dist_to_goal_list = [self.calc_dist_to_goal(n.x, n.y) for n in self.node...
[ "0.7355767", "0.6371808", "0.6272887", "0.61813295", "0.6043925", "0.6002132", "0.5980083", "0.59294474", "0.5925985", "0.5899022", "0.5879226", "0.5807166", "0.5806372", "0.5797924", "0.5781504", "0.5767348", "0.5766683", "0.57633674", "0.57139504", "0.5713386", "0.57126397"...
0.74614465
0
Tests to see if an object starting at start with a given heading will pass through the target cell
def is_on_course_with(start, heading, target): v = Volant(*(tuple(start) + (heading,))) if start == target: return True for _ in range(distance_between_hex_cells(start, target)): v = v.advance() if v.xyh == (tuple(target) + (heading,)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atHead(self):\n return self.cursor == self.head", "def is_header_part(cell: str) -> bool:\n pattern = '|'.join([\n rf'(?:(?:three|3|six|6|nine|9|twelve|12)\\s+months?(?:\\s+periods?)?|quarters?|year|ytd)(?!ly)',\n rf'\\b(?:{MONTH})\\b',\n rf'^(?:end(?:ed|ing))?(?:20)\\s*[0-2]\\...
[ "0.5828779", "0.5647116", "0.55674917", "0.5562699", "0.5555092", "0.5537959", "0.54243815", "0.5332083", "0.5316014", "0.5296079", "0.5247089", "0.52382934", "0.52101386", "0.5176555", "0.51518446", "0.5150946", "0.5148843", "0.51462966", "0.51339036", "0.5132057", "0.513002...
0.70463324
0
Converts the numpy image saved to 'fn' into a .png The resulting image is saved with the same filename, except with the .png extension (input image must have extension .npy).
def convert(fn): assert fn[-4:] == ".npy", "%s: File extension should match '.npy'" % fn print "Converting file '%s' to .png" % fn numpy_img = np.load(fn) #Rescale to 0-255 and convert to uint8 rescaled = (255.0 / numpy_img.max() * (numpy_img - numpy_img.min())).astype(np.uint8) im = Image.fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, fn):\n plt.imsave(fn, self.image)", "def save_to_png(arr,\n path=None,\n image_mode=None,\n show=True,\n labels=None,\n scale=None):\n if image_mode is None:\n image_mode = _get_image_type_from_array(arr)\n\n im...
[ "0.68175745", "0.6526428", "0.65264", "0.64868677", "0.64535123", "0.63635564", "0.6300293", "0.6246505", "0.6224143", "0.62207234", "0.6219505", "0.62152684", "0.62044156", "0.6155904", "0.6146134", "0.60844654", "0.6057763", "0.6055479", "0.60439825", "0.60439825", "0.60430...
0.7737924
0
Return the name of the Controller.
def name(self) -> str: return "Controller"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return f\"{NAME} {RES_CONTROLLER} {self._controller.controller_index + 1} {RES_MASTER}\"", "def network_fabric_controller_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"network_fabric_controller_name\")", "def show_controller(cls, args, config):\n ...
[ "0.74996763", "0.70226", "0.6873626", "0.6845823", "0.678562", "0.6770048", "0.6729016", "0.6712965", "0.6664675", "0.66610116", "0.66610116", "0.66610116", "0.66610116", "0.66610116", "0.6641972", "0.6631533", "0.6608326", "0.6596609", "0.6596609", "0.65897757", "0.6588887",...
0.870959
0
Set the preset mode; if None, then revert to 'Auto' mode.
def set_preset_mode(self, preset_mode: str | None) -> None: self.svc_set_system_mode(PRESET_TO_TCS.get(preset_mode, SystemMode.AUTO))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_preset_mode(self, preset_mode: str) -> None:\n if self.target_temperature == 0:\n self._data.homestatus.setroomThermpoint(\n self._data.home_id, self._room_id, STATE_NETATMO_HOME,\n )\n\n if (\n preset_mode in [PRESET_BOOST, STATE_NETATMO_MAX]\n...
[ "0.7440283", "0.7355509", "0.73498267", "0.7344056", "0.72323555", "0.7204877", "0.7160711", "0.71337557", "0.70753354", "0.70729864", "0.70568067", "0.70467067", "0.70342845", "0.6982908", "0.68103224", "0.6772423", "0.67633486", "0.6668619", "0.66624355", "0.665485", "0.663...
0.79922223
0
Reset the (native) operating mode of the Controller.
def svc_reset_system_mode(self) -> None: self._call_client_api(self._device.reset_mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svc_reset_zone_mode(self) -> None:\n self._call_client_api(self._device.reset_mode)", "def resetDeviceStates(self):", "def softreset(self):\n try:\n self.device.write(b'\\x03') # abort\n self.device.write(b'\\x04') # reset\n self.device.write(b'\\r')\n ...
[ "0.65417933", "0.6428434", "0.637627", "0.63660645", "0.6290326", "0.62352115", "0.6198992", "0.6187783", "0.6177051", "0.61114603", "0.60926646", "0.6088796", "0.60403967", "0.59939355", "0.5975111", "0.596282", "0.59573853", "0.594717", "0.59382457", "0.5926726", "0.5913849...
0.7390385
0
Return the Zone's current preset mode, e.g., home, away, temp.
def preset_mode(self) -> str | None: if self._device.tcs.system_mode is None: return # unable to determine # if self._device.tcs.system_mode[CONF_SYSTEM_MODE] in MODE_TCS_TO_HA: if self._device.tcs.system_mode[CONF_SYSTEM_MODE] in ( SystemMode.AWAY, SystemMo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preset_mode(self) -> str | None:\n state = self._state\n return state.custom_preset or _PRESETS.from_esphome(\n state.preset_compat(self._api_version)\n )", "def preset_mode(self):\n return self._preset_mode", "def preset_mode(self):\n dps_mode = self._device.g...
[ "0.74566215", "0.74438035", "0.71478873", "0.70889574", "0.70163906", "0.6992599", "0.69559926", "0.6906426", "0.68646806", "0.6750974", "0.6643373", "0.6543945", "0.6502334", "0.6471802", "0.6455682", "0.6405507", "0.6283329", "0.6283329", "0.62627965", "0.62500966", "0.6250...
0.75515884
0
Fake the measured temperature of the Zone sensor.
def svc_put_zone_temp( self, temperature: float, **kwargs ) -> None: # set_current_temp self._device.sensor._make_fake() self._device.sensor.temperature = temperature self._device._get_temp() self.update_ha_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temperature() -> float:", "def get_temperature(self):\n # Fake a random temperature change\n temperature = random.randint(20, 25)\n self.set_temperature(temperature)", "def get_temperature(self):\n pass", "def test_sensor_temperature_fahrenheit(self):\n with patch.dict(...
[ "0.70572984", "0.6964777", "0.68520457", "0.65681976", "0.6562205", "0.64241844", "0.6369297", "0.6343626", "0.6342289", "0.6325718", "0.63102293", "0.6304554", "0.62683314", "0.6252575", "0.62433594", "0.62384284", "0.6211073", "0.6199095", "0.61890876", "0.6184514", "0.6183...
0.7113436
0
Reset the configuration of the Zone.
def svc_reset_zone_config(self) -> None: self._call_client_api(self._device.reset_config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svc_reset_zone_mode(self) -> None:\n self._call_client_api(self._device.reset_mode)", "def reset_config():\r\n # TODO implement configuration reset\r\n pass", "def reset( self ):\n self.conf = self.defaults", "def tearDown(self):\n updateConfigurationCmd = updateConfiguration.u...
[ "0.7075728", "0.67781687", "0.6710553", "0.6671109", "0.6439973", "0.6333401", "0.6261008", "0.62493366", "0.62182164", "0.62151074", "0.6211837", "0.61439663", "0.6118708", "0.61135024", "0.610688", "0.60491854", "0.6011505", "0.6008325", "0.5952107", "0.5927481", "0.5882965...
0.84243864
0
Reset the (native) operating mode of the Zone.
def svc_reset_zone_mode(self) -> None: self._call_client_api(self._device.reset_mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svc_reset_system_mode(self) -> None:\n self._call_client_api(self._device.reset_mode)", "def svc_reset_zone_config(self) -> None:\n self._call_client_api(self._device.reset_config)", "def __mode_reset(self):\n\t\tfor key,val in self.ms_all.iteritems():\n\t\t\tval.reset_restart()", "def rese...
[ "0.7032803", "0.6246101", "0.61618865", "0.61210054", "0.5992715", "0.59177274", "0.58946455", "0.58787835", "0.587655", "0.5838272", "0.5831863", "0.58193153", "0.5774155", "0.56983584", "0.5684187", "0.5671345", "0.5668101", "0.56679434", "0.5648671", "0.5634961", "0.563169...
0.7732747
0
Set the configuration of the Zone (min/max temp, etc.).
def svc_set_zone_config(self, **kwargs) -> None: self._call_client_api(self._device.set_config, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone(self, zone: str):\n\n self._zone = zone", "def set_temperature(self, temperature: float = None, **kwargs) -> None:\n self.svc_set_zone_mode(setpoint=temperature)", "def svc_reset_zone_config(self) -> None:\n self._call_client_api(self._device.reset_config)", "def zones(self, zon...
[ "0.61640877", "0.590769", "0.59051955", "0.58893234", "0.58893234", "0.58371204", "0.5772537", "0.5691023", "0.56861216", "0.56284785", "0.56142485", "0.5595346", "0.5559072", "0.5520208", "0.54665196", "0.5450415", "0.54297817", "0.54261005", "0.5416261", "0.5361676", "0.536...
0.7082057
0
Return Position of p's subtree having key k, or last node searched
def _subtree_search(self, p, k): if k == p.key(): # found match return p elif k < p.key(): # search left subtree if self.left(p) is not None: return self._subtree_search(self.left(p), k) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subtree_search(self, p, k):\n if k == p.key():\n return p\n elif k < p.key():\n if self.left(p) is not None:\n return self._subtree_search(self.left(p), k)\n else:\n if self.right(p) is not None:\n return self._subtree_search(...
[ "0.85987526", "0.7235625", "0.71664894", "0.70371085", "0.70218265", "0.6801036", "0.67528373", "0.6744712", "0.6744712", "0.6713811", "0.6692726", "0.66674405", "0.66482687", "0.6632227", "0.6625981", "0.6618637", "0.65873015", "0.658536", "0.6555594", "0.65537417", "0.65483...
0.80569565
1
Return Position of first item in subtree rooted at p
def _subtree_first_position(self, p): walk = p while self.left(walk) is not None: walk = self.left(walk) # keep walking left return walk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subtree_first_position(self, p):\n \"\"\"will be used by before()\"\"\"\n walk = p\n #recursivly walking to the left child until the left subtree has no child\n while self.left(walk) is not None:\n walk = self.left(walk)\n return walk", "def before(self, p):\n ...
[ "0.8037946", "0.7145369", "0.69503504", "0.68678206", "0.67657113", "0.6577142", "0.6530356", "0.6518154", "0.65114397", "0.6478126", "0.64278555", "0.64125717", "0.63804257", "0.6373036", "0.6373036", "0.6373036", "0.6370875", "0.6368855", "0.636215", "0.6319114", "0.6309234...
0.7995807
1
Return Position of last item in subtree rooted at p
def _subtree_last_position(self, p): walk = p while self.right(walk) is not None: walk = self.right(walk) # keep walking right return walk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subtree_last_position(self, p):\n walk = p\n while self.right(walk) is not None:\n walk = self.right(walk)\n return walk", "def after(self, p):\n self._validate(p)\n if self.right(p):\n return self._subtree_first_position(self.right(p))", "def last(...
[ "0.84641135", "0.74079204", "0.6871047", "0.67420864", "0.6579081", "0.6513731", "0.6434427", "0.63944095", "0.6347665", "0.63426125", "0.6296618", "0.6280108", "0.6273795", "0.6258798", "0.6256129", "0.62405384", "0.6210961", "0.62079275", "0.6204021", "0.6203857", "0.615324...
0.8339861
1
Return the first Position in the tree (or None if empty)
def first(self): return self._subtree_first_position(self.root()) if len(self) > 0 else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first(self) -> object:\n #binary search tree == empty\n if self.root is None:\n return None\n\n # return\n return self.root.value", "def get_first(self) -> object:\n if self.root is None: # If tree is empty\n return None\n\n return se...
[ "0.72985446", "0.7136009", "0.7109405", "0.6841215", "0.6825596", "0.6803908", "0.6718761", "0.6697293", "0.66879636", "0.6653463", "0.65870184", "0.6469372", "0.6462883", "0.6442182", "0.6429032", "0.6427359", "0.64196825", "0.6395568", "0.6392002", "0.63889307", "0.63877964...
0.7791313
0
Return the last Position in the tree (or None if empty)
def last(self): return self._subtree_last_position(self.root()) if len(self) > 0 else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_node(self):\n nodes = self.as_list()\n\n if nodes:\n # If there are nodes return the last one.\n return nodes[-1]\n # No nodes, return None\n return None", "def last_position(self):\n return self.visited_positions[-1]", "def _last_node(self):\n ...
[ "0.77644545", "0.75120115", "0.7474619", "0.7323458", "0.7178632", "0.710007", "0.70557827", "0.7003163", "0.6992566", "0.6982288", "0.69820374", "0.69403404", "0.68176055", "0.67916065", "0.67826104", "0.67346746", "0.6727946", "0.66364545", "0.6623255", "0.65903014", "0.657...
0.83756673
0
Return the Position just after p in the natural order Return None if P is the last position
def after(self, p): self._validate(p) if self.right(p): return self._subtree_first_position(self.right(p))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(self, p):\n node = self._validate(p)\n return self._make_position(node._next)", "def after(self,p):\r\n \r\n current = self.tail #test from the tail node\r\n \r\n if p == current: #if the tail node = p\r\n return 'null' #there cannot be a node after ...
[ "0.690741", "0.6589813", "0.65660757", "0.63753384", "0.6306047", "0.62684643", "0.6233519", "0.6223828", "0.61747414", "0.6174467", "0.61634713", "0.60753924", "0.6069791", "0.6054677", "0.60125583", "0.5986297", "0.5981063", "0.59719", "0.59353846", "0.5913079", "0.58700633...
0.67440933
1
Refresh the visualization session information.
def _refresh(request): # check the session for a vtkweb instance vis = request.session.get('vtkweb') if vis is None or vtk_launcher.status(vis.get('id', '')) is None: # open a visualization instance vis = vtk_launcher.new_instance() request.session['vtkweb'] = vis return dict(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_visualization(self) -> None:\n pass", "def update_plot():\n pass", "def refresh(self):\n pass", "def refresh(self):\n pass", "def refresh_screen(self):\n stdscr = self.stdscr\n stdscr.refresh()", "def plot_refresh():\n figure.canvas.draw()", "def ...
[ "0.71400917", "0.6427015", "0.63905346", "0.63905346", "0.63827485", "0.63614184", "0.63082224", "0.63082224", "0.63082224", "0.6300843", "0.6300843", "0.62704825", "0.6262251", "0.6204581", "0.61797917", "0.6175653", "0.6151583", "0.6135584", "0.61329216", "0.6109207", "0.60...
0.70314527
1
Set duration for test.
def set_duration(self, duration): self.__test_result[Result.__DURATION] = round(duration * 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_set_duration(self, duration):\n self._duration = duration", "def duration(self, duration):\n self._duration = duration", "def duration(self, duration):\n self._duration = duration", "def duration(self, duration):\n\n self._duration = duration", "def duration(self...
[ "0.76691973", "0.75579613", "0.75579613", "0.7402852", "0.7402852", "0.7402852", "0.7402852", "0.7402852", "0.7402852", "0.7402852", "0.7402852", "0.7241233", "0.6952764", "0.69131434", "0.6885508", "0.6839374", "0.6780654", "0.6772885", "0.6649575", "0.6629042", "0.6527529",...
0.83807087
0
Set status and message for specify step.
def set_step_status(self, step_summary: str, status: str = Status.PASSED, message: str = None): temp = {Result.__STEP: step_summary, Result.__STATUS: status, Result.__MESSAGE: message} self.__run.append(temp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_step_progress(self, step):\n dot_status = self.dot_status[step.status.name]\n if step.status == Status.failed:\n if (step.exception and\n not isinstance(step.exception, AssertionError)):\n # -- ISA-ERROR: Some Exception\n dot_stat...
[ "0.6730893", "0.6360367", "0.6348932", "0.6267725", "0.62492114", "0.6235833", "0.6199079", "0.6175628", "0.6044504", "0.60384035", "0.6010956", "0.60092", "0.5985237", "0.59349287", "0.5883274", "0.5878642", "0.58284914", "0.58284914", "0.58284914", "0.58048546", "0.58047265...
0.77131367
0
Add a step to report.
def add_step(self, step): if not step: return temp = {Result.__STEP: step.get_name(), Result.__STATUS: step.get_status(), Result.__MESSAGE: step.get_message()} self.__run.append(temp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addStep(self, step):\n self.stepper.addStep(step)\n return self", "def add_step(self, step, run_by_default=True):\n self.steps[step.name] = step\n if run_by_default:\n self.steps_to_run.append(step.name)", "def addStep( self, stepNum ):\n assert isinstance( stepN...
[ "0.7300454", "0.6940515", "0.68519664", "0.6736752", "0.64998645", "0.6465836", "0.6410942", "0.63787425", "0.6328564", "0.6318966", "0.626205", "0.6222592", "0.6116363", "0.60779536", "0.60434836", "0.5996921", "0.5988934", "0.5988201", "0.59717214", "0.5943704", "0.5937647"...
0.74939346
0
Set status of test to FAILED.
def set_test_failed(self): self.set_result(Status.FAILED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetUnexpectedFailure(test_result):\n test_result['status'] = 'FAIL'\n test_result['expected'] = False\n logging.error('Processing failed for test %s', test_result['testPath'])", "def addFailure(self, test, err):\n test.status = \"failed\"\n self._addError(test, err)", "def set_test_passed(...
[ "0.7404037", "0.710185", "0.70464814", "0.7028599", "0.6924147", "0.6825908", "0.6819086", "0.6817489", "0.6817489", "0.6813257", "0.6722179", "0.66460186", "0.6590278", "0.6567286", "0.6478199", "0.6436117", "0.64310205", "0.6407246", "0.6405758", "0.6396214", "0.6393541", ...
0.87635076
0
Set status of test to PASSED.
def set_test_passed(self): self.set_result(Status.PASSED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_test_failed(self):\n self.set_result(Status.FAILED)", "def addSuccess(self, test):\n test.status = \"success\"", "def excecute(self):\r\n self.initialize()\r\n self.addteststeps()\r\n for teststep in self.test_steps_list:\r\n if teststep.run() == TestStatus...
[ "0.74274033", "0.6862972", "0.67527765", "0.655421", "0.6513621", "0.65119374", "0.6406571", "0.63926363", "0.63095206", "0.62739694", "0.62568843", "0.62145996", "0.61953396", "0.6188526", "0.6136933", "0.613267", "0.6130687", "0.61200535", "0.611168", "0.6091256", "0.602758...
0.8919933
0
Get the status of test.
def get_test_status(self) -> str: return self.__test_result[Result.__RESULT]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_status(self) -> str:\n return self._test_status", "def test_get_status(self):\n pass", "def test_get_status(self):\n pass", "def GetStatus(self):\r\n return self.status", "def get_status(self):\n return self.status", "def get_status(self):\n return self.stat...
[ "0.86555594", "0.82592815", "0.82592815", "0.76769733", "0.75723225", "0.75723225", "0.75723225", "0.7554327", "0.7521762", "0.7490179", "0.74830604", "0.7448991", "0.73775405", "0.7375381", "0.7346149", "0.730579", "0.7288645", "0.7274315", "0.72343546", "0.72274816", "0.722...
0.85337096
1
The MEAM alloy parameters for a pair of symbol models.
def alloy(self, symbols): try: return self.alloys[((self.alloys.Sym1==symbols[0]) & (self.alloys.Sym2==symbols[1]))].iloc[0] except: raise ValueError(f'MEAM parameters for alloy symbols {symbols} not found')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_parameters(self):\n params = {}\n if self.modelname == 'SI':\n # N1: Pop 1 size after split\n # N2: Pop 2 size after splot\n # Ts: Time from split to present, in 2*Na generation units\n names = ['N1', 'N2', 'Ts']\n values = [1, 1, 1]\n ...
[ "0.60898656", "0.5972986", "0.59530956", "0.59530956", "0.5823548", "0.58039397", "0.5769897", "0.57277864", "0.57197624", "0.5719173", "0.56635916", "0.5620125", "0.56128556", "0.5603739", "0.5603092", "0.5579975", "0.5577034", "0.5563761", "0.5550069", "0.5526836", "0.55154...
0.64936644
0
get chat ID and message text of most recent message sent to Bot
def get_last_chat_id_and_text(updates): num_updates = len(updates["result"]) last_update = (num_updates - 1) text = updates["result"][last_update]["message"]["text"] chat_id = updates["result"][last_update]["message"]["chat"]["id"] return text, chat_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_updates():\n url = TELEGRAM_URL + TELEGRAM_TOKEN + '/getUpdates'\n response = requests.get(url).json()\n last_object = response['result'][-1] # -1 = last update\n\n chat_id = last_object['message']['chat']['id']\n message_text = last_object['message']['text']\n message = {\n 'chat...
[ "0.64326054", "0.63464683", "0.63145447", "0.62719935", "0.6155986", "0.6133849", "0.60792387", "0.6071617", "0.60530865", "0.6041852", "0.6027591", "0.60080546", "0.5998038", "0.5993367", "0.59932333", "0.59827834", "0.59706444", "0.59483796", "0.59210986", "0.5912884", "0.5...
0.7100207
0
calculates highest update ID of all the updates we receive from getUpdates.
def get_last_update_id(updates): update_ids = [] for update in updates["result"]: update_ids.append(int(update["update_id"])) return max(update_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_autoid(self):\n maxid = 0\n for i in self.items:\n maxid = max(maxid, i['id'])\n self._autoid = maxid + 1", "def update(self, ids=None):\n handlers = self.dm4l.get_handlers()\n if ids == None:\n ids = handlers.keys()\n assert(isinstance(id...
[ "0.6287191", "0.60834044", "0.6005314", "0.59129643", "0.56950474", "0.5664871", "0.55984014", "0.55454165", "0.5540562", "0.545689", "0.5405162", "0.54039353", "0.5351502", "0.5351502", "0.53288186", "0.5293417", "0.5273402", "0.5241545", "0.5217625", "0.5178107", "0.5147148...
0.7646868
0
for data in projection axe.projection find and mask the overlaps (more 1/2 the axe.projection range) X, Y either the coordinates in axe.projection or longitudes latitudes Z the data operation one of 'pcorlor', 'pcolormesh', 'countour', 'countourf' if source_projection is a geodetic CRS data is in geodetic coordinates a...
def z_masked_overlap(axe, X, Y, Z, source_projection=None): if not hasattr(axe, 'projection'): return Z if not isinstance(axe.projection, ccrs.Projection): return Z if len(X.shape) != 2 or len(Y.shape) != 2: return Z if (source_projection is not None and isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getYesPoints(pshapes, proj, dx, nmax, touch_center=True):\n\n mxmin = 9e10\n mxmax = -9e10\n mymin = 9e10\n mymax = -9e10\n for pshape in pshapes:\n pxmin, pymin, pxmax, pymax = pshape.bounds\n if pxmin < mxmin:\n mxmin = pxmin\n if pxmax > mxmax:\n mxm...
[ "0.57300425", "0.5697506", "0.56191784", "0.55972964", "0.55415964", "0.55406713", "0.552754", "0.55060947", "0.5489971", "0.5464598", "0.53949124", "0.5393436", "0.5373377", "0.53695416", "0.53547066", "0.53487754", "0.5304495", "0.5297561", "0.5294725", "0.5246394", "0.5229...
0.6373255
0
Ingest a packet and put the flow object into the context of the flow that the packet belongs to.
def ingest_packet(self, pkt, pkt_receive_timestamp): #*** Packet length on the wire: self.packet_length = len(pkt) #*** Read into dpkt: eth = dpkt.ethernet.Ethernet(pkt) eth_src = _mac_addr(eth.src) eth_dst = _mac_addr(eth.dst) eth_type = eth.type #*** We ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, packet):\n pass", "def add(self, packet):\n self.fin_cleanse(packet['ts'])\n\n source_key = '%s-%s' % (packet['ip']['src_addr'], \n packet['tcp']['src_port'])\n # If start of handshake create new conversation\n if packet['tcp']['...
[ "0.61794573", "0.58237857", "0.57703227", "0.5730365", "0.5621077", "0.5589428", "0.5550984", "0.55054295", "0.53994757", "0.5372806", "0.53469855", "0.5338839", "0.5329753", "0.5328788", "0.5243158", "0.5215885", "0.52092856", "0.5197102", "0.51952356", "0.5168524", "0.51682...
0.62973535
0
Return the size of the largest packet in the flow (in either direction)
def max_packet_size(self): return max(self.fcip_doc['packet_lengths'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SendPacketsSendSize(self) -> int:", "def __payload_size(self):\n return (\n self.SIZE_LINEUP_ID + self.players_per_lineup * self.SIZE_PLAYER) * self.entries.count()", "def min_packet_size(self):\n return min(self.fcip_doc['packet_lengths'])", "def num_packets(self):\n ...
[ "0.6465985", "0.6387028", "0.63805896", "0.63401634", "0.63100195", "0.6305644", "0.62747097", "0.6207945", "0.6198868", "0.61898345", "0.6187164", "0.61824095", "0.6169856", "0.6160437", "0.6136841", "0.6129285", "0.61256397", "0.6122765", "0.6118093", "0.6095568", "0.609556...
0.7188922
0
Return the size of the smallest packet in the flow (in either direction)
def min_packet_size(self): return min(self.fcip_doc['packet_lengths'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_size(self):\n # Size in arcsec\n size = self.seeing.minimum_size()\n try:\n # Try using `intrinsic` as an object\n size = max(self.intrinsic.minimum_size(), size)\n except AttributeError:\n pass\n return size", "def graph_data_size_m...
[ "0.6597096", "0.6466371", "0.64621466", "0.64613277", "0.63413686", "0.6225217", "0.62156874", "0.6203628", "0.6146065", "0.6108415", "0.6102389", "0.6100753", "0.60866076", "0.6086556", "0.60830045", "0.6077884", "0.6074226", "0.6069019", "0.60408837", "0.60278606", "0.59812...
0.7491888
0
Return the size of the average interpacket time interval in the flow (assessed per direction in flow). .
def avg_interpacket_interval(self): avg_c2s = 0 avg_s2c = 0 count_c2s = 0 count_s2c = 0 prev_c2s_idx = 0 prev_s2c_idx = 0 for idx, direction in enumerate(self.fcip_doc['packet_directions']): if direction == 'c2s': count_c2s += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg_packet_size(self):\n result = 0\n try:\n result = sum(self.fcip_doc['packet_lengths'])/float(len(self.fcip_doc['packet_lengths']))\n except:\n pass\n return result", "def get_naive_size(self) -> int:\n return (self.triples.time_end - self.triples.t...
[ "0.760965", "0.6611826", "0.6488399", "0.6448079", "0.6321379", "0.63145524", "0.62541467", "0.6233074", "0.62164295", "0.62073046", "0.6184405", "0.6179181", "0.6152177", "0.6146496", "0.6124637", "0.61187994", "0.6073599", "0.60345674", "0.6025252", "0.6019595", "0.6007842"...
0.7346629
1
Return the size of the largest interpacket time interval in the flow (assessed per direction in flow). .
def max_interpacket_interval(self): max_c2s = 0 max_s2c = 0 count_c2s = 0 count_s2c = 0 prev_c2s_idx = 0 prev_s2c_idx = 0 for idx, direction in enumerate(self.fcip_doc['packet_directions']): if direction == 'c2s': count_c2s += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxContigLength(self):\n\t\tstats = self.scores()\n\t\treturn stats['largestContig']", "def maxTurbulenceSize(self, arr: List[int]) -> int:\n if len(arr) == 1:\n return 1\n ret = 1\n tmp_ret = 0\n last_flag = None\n for i in range(1, len(arr)):\n if ar...
[ "0.6667583", "0.66518646", "0.6628894", "0.64285105", "0.6397434", "0.6344896", "0.6285462", "0.62777865", "0.6245625", "0.6201934", "0.6187214", "0.6186099", "0.61607647", "0.6120331", "0.60703766", "0.60529447", "0.6047552", "0.60439914", "0.6037402", "0.60335124", "0.60137...
0.71880835
0
Return the size of the smallest interpacket time interval in the flow (assessed per direction in flow) .
def min_interpacket_interval(self): min_c2s = 0 min_s2c = 0 count_c2s = 0 count_s2c = 0 prev_c2s_idx = 0 prev_s2c_idx = 0 for idx, direction in enumerate(self.fcip_doc['packet_directions']): if direction == 'c2s': count_c2s += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_packet_size(self):\n return min(self.fcip_doc['packet_lengths'])", "def minContigLength(self):\n\t\tstats = self.scores()\n\t\treturn stats['smallestContig']", "def get_naive_size(self) -> int:\n return (self.triples.time_end - self.triples.time_begin + 1).sum()", "def max_interpacket_i...
[ "0.66252464", "0.64096874", "0.6360574", "0.63360894", "0.62790656", "0.6177121", "0.6166679", "0.6132873", "0.6110259", "0.6066307", "0.6057291", "0.6012215", "0.598935", "0.5977526", "0.5948044", "0.59432024", "0.5932077", "0.58715415", "0.5861192", "0.58579046", "0.5834204...
0.70118415
0
Set the suppressed attribute in the flow database object to the current packet count so that future suppressions of the same flow can be backed off to prevent overwhelming the controller
def set_suppress_flow(self): self.suppressed = self.packet_count self.fcip.update_one({'hash': self.fcip_hash}, {'$set': {'suppressed': self.suppressed},})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_fe_tcf_suppress(self, suppress_dict):\n ofproto = self.datapath.ofproto\n parser = self.datapath.ofproto_parser\n #*** Check it's TCP:\n if suppress_dict['proto'] != 'tcp':\n self.logger.error(\"Unsupported proto=%s\", suppress_dict['proto'])\n return 0\n\n...
[ "0.5602831", "0.54044235", "0.52294934", "0.5105551", "0.50889367", "0.5087022", "0.50683844", "0.50344235", "0.50178295", "0.50135696", "0.500748", "0.4920166", "0.48919708", "0.48824057", "0.48358688", "0.48272425", "0.48197994", "0.47963083", "0.47859436", "0.47705513", "0...
0.7687831
0
Does the current packet have the TCP FIN flag set?
def tcp_fin(self): return self.tcp_flags & dpkt.tcp.TH_FIN != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_ack(self):\n return self.tcp_flags & dpkt.tcp.TH_ACK != 0", "def EndOfPacket(self) -> bool:", "def eof_received(self):\n self.connection_lost('EOF')\n return False", "def tcp_rst(self):\n return self.tcp_flags & dpkt.tcp.TH_RST != 0", "def tcp_urg(self):\n return ...
[ "0.7094454", "0.7082811", "0.690565", "0.67987853", "0.67850024", "0.67468345", "0.67016333", "0.65382755", "0.64064264", "0.62315774", "0.62288594", "0.61441845", "0.60956466", "0.60806847", "0.6036773", "0.59935206", "0.5980416", "0.59537274", "0.59387845", "0.5922927", "0....
0.8585132
0
Does the current packet have the TCP SYN flag set?
def tcp_syn(self): return self.tcp_flags & dpkt.tcp.TH_SYN != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_tcp_syn(tcp_flags):\n if tcp_flags == 2:\n return 1\n else:\n return 0", "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def is_tcp(self) -> bool:\n return self.proto == IP_TCP", "def tcp_psh(self):\n retur...
[ "0.7690888", "0.7561976", "0.7231197", "0.6869579", "0.66572094", "0.66416705", "0.65288955", "0.6464404", "0.64455825", "0.62220824", "0.6173735", "0.6033871", "0.5989733", "0.58425915", "0.5829437", "0.57948446", "0.57896084", "0.57755846", "0.576857", "0.57579166", "0.5727...
0.81022835
0
Does the current packet have the TCP RST flag set?
def tcp_rst(self): return self.tcp_flags & dpkt.tcp.TH_RST != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_ack(self):\n return self.tcp_flags & dpkt.tcp.TH_ACK != 0", "def tcp_urg(self):\n return self.tcp_flags & dpkt.tcp.TH_URG != 0", "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def tcp_fin(self):\n return self.tcp_flags...
[ "0.7516386", "0.7045244", "0.69934404", "0.67368025", "0.6609426", "0.64979655", "0.6353278", "0.62783927", "0.62588733", "0.6225317", "0.60794926", "0.60549366", "0.5991976", "0.5967841", "0.5873444", "0.577649", "0.5690989", "0.56898624", "0.5684263", "0.56341535", "0.55597...
0.8491029
0
Does the current packet have the TCP PSH flag set?
def tcp_psh(self): return self.tcp_flags & dpkt.tcp.TH_PUSH != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def _is_tcp_syn(tcp_flags):\n if tcp_flags == 2:\n return 1\n else:\n return 0", "def tcp_syn(self):\n return self.tcp_flags & dpkt.tcp.TH_SYN != 0", "def is_valid_ssdp_packe...
[ "0.70700914", "0.683914", "0.65811044", "0.6559025", "0.6541669", "0.6536006", "0.6391766", "0.62555486", "0.6231639", "0.6139662", "0.6119093", "0.6116591", "0.61071205", "0.6080696", "0.6056388", "0.604276", "0.6009697", "0.5996681", "0.59924656", "0.5970526", "0.5923695", ...
0.8219081
0
Does the current packet have the TCP ACK flag set?
def tcp_ack(self): return self.tcp_flags & dpkt.tcp.TH_ACK != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ack(self):\n return (self.status == self.STATUS_ACK)", "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def __is_ack(self, ack) -> bool:\n return ack == ['void']", "def _is_acknowledged(self):\n response = self._port_handle....
[ "0.7713082", "0.7140416", "0.7077276", "0.69622517", "0.68137753", "0.651649", "0.6490735", "0.64123046", "0.6396964", "0.63797945", "0.6331648", "0.63295096", "0.63076216", "0.62877494", "0.62774557", "0.62618184", "0.6235229", "0.6172736", "0.6160738", "0.6155097", "0.61437...
0.82345355
0
Does the current packet have the TCP URG flag set?
def tcp_urg(self): return self.tcp_flags & dpkt.tcp.TH_URG != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_ack(self):\n return self.tcp_flags & dpkt.tcp.TH_ACK != 0", "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def tcp_fin(self):\n return self.tcp_flags & dpkt.tcp.TH_FIN != 0", "def EndOfPacket(self) -> bool:", "def tcp_ece(s...
[ "0.701477", "0.6874184", "0.6629805", "0.6626216", "0.65771645", "0.65479213", "0.65354097", "0.63849026", "0.6335349", "0.6176544", "0.60870785", "0.60784733", "0.604032", "0.60195976", "0.5977013", "0.59698975", "0.59458387", "0.5925076", "0.5887721", "0.587131", "0.582429"...
0.78980297
0
Does the current packet have the TCP ECE flag set?
def tcp_ece(self): return self.tcp_flags & dpkt.tcp.TH_ECE != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_ack(self):\n return self.tcp_flags & dpkt.tcp.TH_ACK != 0", "def tcp_fin(self):\n return self.tcp_flags & dpkt.tcp.TH_FIN != 0", "def EndOfPacket(self) -> bool:", "def is_tcp(self) -> bool:\n return self.proto == IP_TCP", "def tcp_rst(self):\n return self.tcp_flags & dpk...
[ "0.6844938", "0.68352866", "0.63678133", "0.62086725", "0.6162233", "0.61555636", "0.6047426", "0.6042629", "0.5913607", "0.58997405", "0.5880692", "0.5828626", "0.58223116", "0.58136815", "0.5796791", "0.578385", "0.57391435", "0.5718324", "0.56315637", "0.55973816", "0.5597...
0.8452496
0
Does the current packet have the TCP CWR flag set?
def tcp_cwr(self): return self.tcp_flags & dpkt.tcp.TH_CWR != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_urg(self):\n return self.tcp_flags & dpkt.tcp.TH_URG != 0", "def tcp_ack(self):\n return self.tcp_flags & dpkt.tcp.TH_ACK != 0", "def tcp_rst(self):\n return self.tcp_flags & dpkt.tcp.TH_RST != 0", "def tcp_psh(self):\n return self.tcp_flags & dpkt.tcp.TH_PUSH != 0", "de...
[ "0.6661722", "0.6609961", "0.64189065", "0.6226935", "0.61659545", "0.61400944", "0.6062638", "0.6010988", "0.59357214", "0.584563", "0.5844437", "0.5778082", "0.57590437", "0.57227826", "0.56914073", "0.567778", "0.56738836", "0.5669728", "0.5668987", "0.5657275", "0.5636204...
0.85348696
0
Passed a TCP flags object (hex) and return 1 if it contains a TCP SYN and no other flags
def _is_tcp_syn(tcp_flags): if tcp_flags == 2: return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_tcp_synack(tcp_flags):\n if tcp_flags == 0x12:\n return 1\n else:\n return 0", "def test_should_return_the_correct_integer(self):\n\n tcp_flags = TCPControlBits(['SYN', 'ACK'])\n assert_equal(tcp_flags.to_int(), 18)", "def tcp_syn(self):\n return self.tcp_flags ...
[ "0.80560696", "0.69553995", "0.684681", "0.6703667", "0.64354026", "0.64024794", "0.6313623", "0.6251084", "0.62157923", "0.61875", "0.61465245", "0.61416644", "0.61377066", "0.6108251", "0.5836498", "0.5831984", "0.5767398", "0.56820065", "0.5621239", "0.5521131", "0.5484431...
0.82989943
0
Passed a TCP flags object (hex) and return 1 if it contains TCP SYN + ACK flags and no other flags
def _is_tcp_synack(tcp_flags): if tcp_flags == 0x12: return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_tcp_syn(tcp_flags):\n if tcp_flags == 2:\n return 1\n else:\n return 0", "def test_should_return_the_correct_integer(self):\n\n tcp_flags = TCPControlBits(['SYN', 'ACK'])\n assert_equal(tcp_flags.to_int(), 18)", "def test_should_return_a_integer(self):\n\n tcp_f...
[ "0.80400455", "0.7250333", "0.6964621", "0.6685191", "0.6563002", "0.6505053", "0.6482697", "0.64025676", "0.6371088", "0.6360817", "0.62162447", "0.61951274", "0.61621755", "0.61382747", "0.6079574", "0.6032509", "0.6024667", "0.5861897", "0.5688515", "0.56081784", "0.557866...
0.8173602
0
Generate a predictable hash for the 5tuple which is the same not matter which direction the traffic is travelling
def _hash_5tuple(ip_A, ip_B, tp_src, tp_dst, proto): if ip_A > ip_B: direction = 1 elif ip_B > ip_A: direction = 2 elif tp_src > tp_dst: direction = 1 elif tp_dst > tp_src: direction = 2 else: direction = 1 hash_5t = hashlib.md5() if direction == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_function(input_tuple):\n return hash(input_tuple)", "def hash_flow(flow_5_tuple):\n ip_A = flow_5_tuple[0]\n ip_B = flow_5_tuple[1]\n tp_src = flow_5_tuple[2]\n tp_dst = flow_5_tuple[3]\n proto = flow_5_tuple[4]\n if proto == 6:\n #*** Is a TCP flow:\n if ip_A > ip_B:\n ...
[ "0.74605143", "0.7353813", "0.724694", "0.7163682", "0.7123714", "0.6989677", "0.6989158", "0.69504875", "0.69009036", "0.6895851", "0.68934995", "0.6888084", "0.68834597", "0.6875137", "0.6846202", "0.6814702", "0.68129855", "0.6799603", "0.6789932", "0.6789932", "0.67869276...
0.78120553
0
Convert a MAC address to a readable/printable string
def _mac_addr(address): return ':'.join('%02x' % ord(b) for b in address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))", "def mac_addr(address):\n\tprint(':'.join('%02x' % compat_ord(b) for b in address))\n\treturn ':'.join('%s' % format(compat_ord(b), '0>8b') for b in address)", "def get_mac_string():\n mac_int = getnode()\n mac_s...
[ "0.8274901", "0.78023726", "0.7799624", "0.7411498", "0.7411498", "0.7411498", "0.7411498", "0.7393615", "0.72612065", "0.7243841", "0.7214834", "0.71748555", "0.7040925", "0.69946724", "0.6982126", "0.6982003", "0.6913715", "0.67323697", "0.671812", "0.6642322", "0.6640873",...
0.7819506
1
Action partial update test
def test_partial_update(self): action = ActionFactory.create(id=22) data = { 'name': 'Ação para Melhorar', 'institution': 'Vamos Ajudar', } self.assertNotEqual(action.name, data['name']) self.assertNotEqual(action.institution, data['institution']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_partial_update(self):\n self.client.force_authenticate(user=self.admin)\n\n data = {\n 'retreat': reverse(\n 'retreat:retreat-detail', args=[self.retreat.id]\n ),\n 'user': reverse('user-detail', args=[self.user2.id]),\n }\n\n res...
[ "0.7925501", "0.7703755", "0.7453596", "0.7446067", "0.74410087", "0.7411792", "0.7282139", "0.7279346", "0.72573346", "0.72541976", "0.7236859", "0.7230735", "0.7230735", "0.7230735", "0.7216292", "0.7194296", "0.7185747", "0.71731967", "0.7138343", "0.71002716", "0.70846397...
0.8542736
0
Initializing the board and current player.
def __init__(self): self.board = [ BS, BS, BS, BS, BS, BS, BS, BS, BS, BS, BS, EM, EM, EM, WS, WS, WS, WS, WS, WS, WS, WS, WS, WS, WS ] self.curr_player = WHITE_PLAYER
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initBoard(self):\n pass", "def initialize_board(self):\n self.board = np.zeros(shape=(BOARD_SIZE, BOARD_SIZE), dtype=np.int) # another way of defining board: [[for x in range(cm.BOARD_SIZE)] for x in range(cm.BOARD_SIZE)]\n center = int(BOARD_SIZE / 2)\n self.board[center-1][cen...
[ "0.7926913", "0.749798", "0.741034", "0.7391423", "0.72973835", "0.72447056", "0.7236445", "0.7228515", "0.7197612", "0.7186307", "0.71519154", "0.71053326", "0.70884544", "0.7085167", "0.70822626", "0.70528626", "0.69869745", "0.6971108", "0.6967911", "0.6957216", "0.6941116...
0.77943414
1
Calculating all the possible single moves.
def calc_single_moves(self): single_soldier_moves = [(i, j) for (i, j) in SOLDIER_SINGLE_MOVES[self.curr_player] if self.board[i][:1] == SOLDIER_COLOR[self.curr_player] and self.board[j] == EM] single_officer_moves = [(i, j) for (i, j) in O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_all_moves(self,level=0):\n\n capts = [self.op_capture_north, self.op_capture_nwest, self.op_capture_neast, self.op_capture_east, self.op_capture_west]\n jmps = [self.op_jump_north, self.op_jump_nwest, self.op_jump_neast]\n moves = [self.op_move_north,self.op_move_nwest, self.op_move_n...
[ "0.697692", "0.672974", "0.6712475", "0.66967314", "0.66270834", "0.66235846", "0.66208565", "0.6607919", "0.65993315", "0.65738255", "0.65693104", "0.65388745", "0.653464", "0.64876544", "0.64746815", "0.64696103", "0.64522076", "0.6426022", "0.641516", "0.63979876", "0.6394...
0.6921761
1
Calculating all the possible capture moves, but only the first step.
def calc_capture_moves(self): capture_soldier_moves = [(i, j, k) for (i, j, k) in SOLDIER_CAPTURE_MOVES[self.curr_player] if self.board[i][:1] == SOLDIER_COLOR[self.curr_player] and self.board[j][:1] in OPPONENT_COLORS[self.curr_player] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_possible_moves(self):\n possible_capture_moves = self.calc_capture_moves()\n if possible_capture_moves:\n # There is at least one capture move. Let's DFS them!\n self_curr_player = self.curr_player\n next_moves = []\n for capture_move in possible_ca...
[ "0.6862329", "0.65180343", "0.6380384", "0.6203256", "0.6088648", "0.6003288", "0.59560937", "0.5951401", "0.5936796", "0.59350836", "0.5897749", "0.5875835", "0.58558494", "0.58550346", "0.5852458", "0.5844779", "0.58106405", "0.5792629", "0.5773724", "0.57558537", "0.575413...
0.6520749
1
Given a capture move, return all long capture moves following this one. We do recursive DFS. We also don't replicate the board, but use the same self.board to avoid replication time.
def find_following_moves(self, capture_move, move_privilege): # Temporarily changing the board, simulating the move and checking if there are more to follow. floating_piece = self.board[capture_move[1]] self.board[capture_move[1]] = EM self.board[capture_move[2]] = self.board[capture_mov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_possible_moves(self):\n possible_capture_moves = self.calc_capture_moves()\n if possible_capture_moves:\n # There is at least one capture move. Let's DFS them!\n self_curr_player = self.curr_player\n next_moves = []\n for capture_move in possible_ca...
[ "0.68712467", "0.6634379", "0.6587093", "0.61561346", "0.6102893", "0.60196084", "0.5792323", "0.57847136", "0.57644325", "0.5760115", "0.57349503", "0.5699928", "0.56808186", "0.56797403", "0.5657029", "0.56525606", "0.5646975", "0.5603376", "0.5562328", "0.5545172", "0.5540...
0.7262479
0
Tests static method is_heap if it can correctly verify if a list of elements preserves the heap property.
def test_static_is_heap(self): good = [4, 4, 8, 9, 4, 12, 9, 11, 13] bad = [1,2,3,114,5,6,7,8,9,10] self.assertTrue(Heap.is_heap(good), 'should hold the heap property') self.assertFalse(Heap.is_heap(bad), 'should not hold the heap property')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(x):\n pass", "def build_heap(self, alist):\r\n if len(alist) > self.capacity:\r\n return False\r\n else:\r\n i = len(alist) // 2\r\n self.size = len(alist)\r\n self.items = [0] + alist[:] + [None]*(self.capacity+1-len(alist))\r\n ...
[ "0.69610363", "0.69486296", "0.6804351", "0.66430354", "0.6605916", "0.6603965", "0.6579628", "0.6459191", "0.63457316", "0.633452", "0.6319004", "0.6319004", "0.6296606", "0.6261532", "0.6209209", "0.62068355", "0.61780304", "0.6161776", "0.61614645", "0.61578655", "0.614456...
0.78172654
0
Test the removal of a key from the middle of the heap.
def test_remove(self): data = [4, 4, 8, 9, 4, 12, 9, 11, 13] h = Heap(data) h.remove(2) self.assertTrue(Heap.is_heap(data), 'should preserve heap property') self.assertNotIn(8, h.data, 'the value corresponding to the index was removed')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __delitem__(self, key):\n\t\ttry:\n\t\t\tdel self.heap[[item == key for _, item in self.heap].index(True)]\n\t\texcept ValueError:\n\t\t\traise KeyError(str(key) + \" is not in the priority queue\")\n\t\theapq.heapify(self.heap)", "def remove(self, key):\n index = self._hash_mod(key)\n node = s...
[ "0.71460545", "0.6887034", "0.6840105", "0.6774187", "0.6762826", "0.67459995", "0.67459995", "0.6740352", "0.6685591", "0.66796625", "0.66610855", "0.663803", "0.66340905", "0.6587309", "0.65832776", "0.65391386", "0.65278965", "0.65011847", "0.64858145", "0.64825714", "0.64...
0.71519136
0
Test if extracting min and adding a new value at the same time works.
def test_extract_min_and_insert(self): data = [4, 5, 8, 9, 6, 12, 9, 11, 13] h = Heap(data) min_value = h.extract_min_and_insert(2) self.assertEqual(min_value, 4, 'should return the min value') expected = [2, 5, 8, 9, 6, 12, 9, 11, 13] self.assertEqual(h.data, expected, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mini(a, b):\n return min(a, b)", "def min(x):\n pass", "def _min_in_bounds(self, min):\n if min <= self.valmin:\n if not self.closedmin:\n return self.val[0]\n min = self.valmin\n\n if min > self.val[1]:\n min = self.val[1]\n return s...
[ "0.6581571", "0.6492888", "0.64508563", "0.6287588", "0.621782", "0.6203606", "0.6171011", "0.6134213", "0.6038028", "0.6012827", "0.60017294", "0.5988239", "0.5976465", "0.5966177", "0.5962323", "0.59480584", "0.594802", "0.58188283", "0.58188283", "0.5814531", "0.5797752", ...
0.68474996
0
Updates the loop body graph with a subgraph (for body or condition functions)
def update_body_graph(body_graph: Graph, subgraph_proto: dict, body_parameter_names: list, body_results: list): # create a map from a node name in original model to a name in a loop body graph assuming # that names in the original model are unique # initially, the map contains names fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_edges(subgraph, graph_name, bb):\n top_subgraph = get_top_parent(subgraph, graph_name)\n edges = extract_edges(top_subgraph)\n for edge in edges:\n if(edge.get_style() is not None):\n style = edge.get_style()\n if(edge.get_color() is not None):\n color = edge...
[ "0.6166921", "0.5917972", "0.572015", "0.56074136", "0.5480895", "0.54787594", "0.54676795", "0.5410596", "0.5361217", "0.5360984", "0.5354818", "0.53209776", "0.5262267", "0.52560925", "0.5198067", "0.51964974", "0.5164367", "0.51537746", "0.5147732", "0.51466846", "0.514208...
0.7227099
0
check to see if we should apply thresholding to preprocess the image
def preprocess(img): #if "thresh" in args["preprocess"]: image = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] """ make a check to see if median blurring should be done to remove noise """ #if "blur" in args["preprocess"]: #image = cv2.medianBlur(gray, 3) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(self, img, threshold=2.5):\n return (img-self.mu)/numpy.sqrt(self.sigmasqr) > threshold", "def global_threshold(img, threshold_method):\n pass", "def thresh_setup():\n pass", "def apply_thresholding(x):\n return x > threshold_otsu(x)", "def preprocess_image(self, image, g, c, m...
[ "0.6902314", "0.6696663", "0.6598084", "0.62699246", "0.6235991", "0.6163094", "0.60365695", "0.6001765", "0.59255934", "0.59180653", "0.58960956", "0.5891709", "0.5859457", "0.58538556", "0.5842548", "0.5827132", "0.57804036", "0.5778117", "0.56903183", "0.5687083", "0.56831...
0.6849483
1