query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Apply given input values to simulation.
def _set_variables(self, b_input_vals: Dict[str, Any] = {}): # Ensure model has been initialized at least once self._model_has_been_initialized("_set_variables") # Ensure dict is not empty if not len(b_input_vals.items()) > 0: #print("[_set_variables] Provided input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, inputs):\n raise NotImplementedError()", "def compute(self, node, input_vals):\r\n raise NotImplementedError", "def compute(self, node, input_vals):\n assert False, \"Implemented in subclass\"", "def __call__(self, parameter_values, random_state=None):\n self.train...
[ "0.6627281", "0.6060569", "0.58538496", "0.5823898", "0.5751707", "0.570151", "0.56622785", "0.56247663", "0.5606498", "0.5578345", "0.5575155", "0.5567629", "0.5546263", "0.55450714", "0.5542741", "0.55375254", "0.54610884", "0.5451027", "0.54509836", "0.5417239", "0.5412084...
0.0
-1
Get var indices for each var name provided in list.
def _var_names_to_indices(self, var_names: List): if type(var_names) is not type([]): # Return empty array if input is not 'list' type print("[_var_names_to_indices] Provided input is not of type list.") return [] indices_array = [] names_array = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j", "def index(self, variables):\n return [self._variables.index(v) for v in variables]", "def vars(self):\n return [Var(i,self.dims[i]) for i in...
[ "0.74116653", "0.6916294", "0.61451054", "0.611666", "0.59596854", "0.5946558", "0.5905192", "0.5892637", "0.58531195", "0.5848885", "0.5842754", "0.5840236", "0.58368546", "0.5804591", "0.5756725", "0.5740407", "0.57103246", "0.56983846", "0.56811184", "0.5670195", "0.565843...
0.72467065
1
Get unique id for instance name (identifier).
def _get_unique_id(self): now = datetime.now() u_id = now.second + 60*(now.minute + 60*(now.hour + 24*(now.day + 31*(now.month + 366*(now.year))))) return "instance" + str(u_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")", "def instance_identifier(self):\n return self._instance_identifier", "def instance_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_id\")", "def instance_id(self) -> pulumi.Output[str]:\n ...
[ "0.7969054", "0.7793897", "0.7737086", "0.7737086", "0.7737086", "0.7737086", "0.7737086", "0.7737086", "0.7641148", "0.763706", "0.7468007", "0.7468007", "0.7468007", "0.7468007", "0.7468007", "0.7468007", "0.7405071", "0.7405071", "0.7405071", "0.7374773", "0.7366122", "0...
0.7873312
1
Ensure model has been initialized at least once.
def _model_has_been_initialized(self, method_name: str = ""): if not self._is_initialized: error_log = "Please, initialize the model using 'initialize_model' method, prior " error_log += "to calling '{}' method.".format(method_name) raise Exception(error_log)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def __post_init_check(self):\n try:\n t = self.time\n m = self.metadata\n except AttributeError as e:\n clsname = self.__class__.__name__\n raise TypeError(f\"Model not initialized. Please call 'SupernovaModel....
[ "0.77975667", "0.77463055", "0.7591309", "0.7468816", "0.7323544", "0.7186178", "0.7042854", "0.66940314", "0.6631886", "0.6612586", "0.6558713", "0.6518255", "0.6508796", "0.6459824", "0.64515436", "0.6401412", "0.6394201", "0.63834184", "0.6379764", "0.6347489", "0.63283247...
0.7517133
3
Ensure model has been initialized at least once.
def _terminate_model(self): # Ensure model has been initialized at least once self._model_has_been_initialized("_terminate_model") if not self._is_initialized: print("[_terminate_model] Model hasn't been initialized or has already been terminated. Skipping termination.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def __post_init_check(self):\n try:\n t = self.time\n m = self.metadata\n except AttributeError as e:\n clsname = self.__class__.__name__\n raise TypeError(f\"Model not initialized. Please call 'SupernovaModel....
[ "0.77975667", "0.77463055", "0.7591309", "0.7517133", "0.7468816", "0.7323544", "0.7186178", "0.7042854", "0.66940314", "0.6631886", "0.6612586", "0.6558713", "0.6518255", "0.6508796", "0.6459824", "0.64515436", "0.6401412", "0.6394201", "0.63834184", "0.6379764", "0.6347489"...
0.0
-1
Returns distance between 2 threedimensional points
def distance_checker(xyz1, xyz2): return math.sqrt((xyz1[0] - xyz2[0])**2 + (xyz1[1] - xyz2[1])**2 + (xyz1[2] - xyz2[2])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n return np.sqrt(np.sum(np.square(point1 - point2)))", "def distance(pt1, pt2):\n\tx1, y1 = pt1\n\tx2, y2 = pt2\n\tx = x2 - x1\n\ty = y2 - y1\n\ts = x**2 + y**2\n\treturn np.sqrt(s)", "def distance(point1, point2):\n return math.sqr...
[ "0.8303541", "0.8230539", "0.818016", "0.81776935", "0.817378", "0.816805", "0.8153026", "0.8151497", "0.812631", "0.81180215", "0.81151736", "0.8079807", "0.80791247", "0.80715865", "0.80449116", "0.80381876", "0.8034465", "0.8034465", "0.8027342", "0.80119705", "0.8006168",...
0.0
-1
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians. Taken from
def rotation_matrix(axis, theta): axis = np.asarray(axis) axis = axis / math.sqrt(np.dot(axis, axis)) a = math.cos(theta / 2.0) b, c, d = -axis * math.sin(theta / 2.0) aa, bb, cc, dd = a * a, b * b, c * c, d * d bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d return np.arra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rotation_matrix(axis, theta):\n axis = np.asarray(axis)\n axis = axis / math.sqrt(np.dot(axis, axis))\n a = math.cos(theta / 2.0)\n b, c, d = -axis * math.sin(theta / 2.0)\n aa, bb, cc, dd = a * a, b * b, c * c, d * d\n bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d\n ...
[ "0.8012121", "0.80068713", "0.79570246", "0.77939034", "0.77708095", "0.7761298", "0.7736163", "0.772264", "0.771542", "0.7709953", "0.7646859", "0.7623367", "0.7618973", "0.7603185", "0.74786633", "0.7430578", "0.7408576", "0.73897994", "0.737963", "0.73772186", "0.7360726",...
0.7736297
8
Make sure all elements are in bond_len_dict, and return the value
def check_bond_len(dict, el_a, el_b): if el_a in dict: if el_b in dict[el_a]: return dict[el_a][el_b] print() print(el_a + " and " + el_b + " bond length currently unsupported. Add value to the csv file.") sys.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bond_checker(atom, dict, bond_dict):\n bound = []\n for item, values in dict.items():\n bond_range = check_bond_len(bond_dict, atom[0], values[\"element\"]) + 0.2\n if distance_checker(atom[1:], values[\"coor\"]) <= bond_range:\n bound.append(item)\n return bound", "def get_...
[ "0.6285508", "0.6202662", "0.59115434", "0.5817686", "0.5773312", "0.5631281", "0.5628951", "0.5608762", "0.559284", "0.5581179", "0.5579353", "0.5575587", "0.5575587", "0.5575587", "0.5542769", "0.55310816", "0.55075777", "0.5494907", "0.5452239", "0.54492265", "0.5444122", ...
0.70560527
0
Transforms the bond_lengths.csv to a dict
def csv2dict(filename): dis_dict = {} with open(filename) as csvfile: reader = csv.DictReader(csvfile) for row in reader: el_a = row["Element Name"] dis_dict[el_a] = {} for entry in row: if entry != "Element Name": dis_dict[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_csv_to_dict(filename):\n row_len = list()\n result = dict()\n with open(filename, 'r') as csvfile:\n reader = csv.reader(csvfile)\n for row in reader:\n key = row[0].strip()\n values = [v.strip() for v in row[1:]]\n result[key] = values\n ...
[ "0.5976831", "0.59062386", "0.58041346", "0.5635251", "0.53035337", "0.526938", "0.52367777", "0.5232653", "0.52167684", "0.5213694", "0.5197275", "0.5179703", "0.5157237", "0.51463", "0.51407754", "0.5114579", "0.5102922", "0.50914264", "0.5088494", "0.5048615", "0.50422263"...
0.53779644
4
Check for all atoms in bonding range
def bond_checker(atom, dict, bond_dict): bound = [] for item, values in dict.items(): bond_range = check_bond_len(bond_dict, atom[0], values["element"]) + 0.2 if distance_checker(atom[1:], values["coor"]) <= bond_range: bound.append(item) return bound
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlaps(self, atom, check_up_to, get_all_overlapping_atoms=True):\n if (check_up_to == 0):\n return True, []\n distances = self.structure.get_distances(atom, [i for i in range(0, check_up_to)], mic=True)\n minimum_percentage_allowed = 0.99\n valid = True\n overlap...
[ "0.6651107", "0.6298358", "0.6284692", "0.61737514", "0.6166369", "0.61443436", "0.6105336", "0.61047226", "0.6011335", "0.5903171", "0.5824142", "0.5755893", "0.5749033", "0.57480836", "0.57447016", "0.57203454", "0.5719759", "0.57171327", "0.5711364", "0.5645471", "0.563580...
0.6625112
1
Builds simple dict out of .xyz file, containing just id, elements and coordinates
def file2dict(file, dict, start_id): id = start_id line_number = 0 file.seek(0) for line in file: if line_number == 0: n_atoms = int(float(line.strip())) if line_number >= 2 and line_number < n_atoms + 2: values_list = line.split() for i in range(1, 4)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_xyz(filename):\n\n config = {}\n\n with open(filename, 'r') as f:\n # number of atoms (spins)\n config['nat'] = int(re.findall('\\S+', f.readline())[0])\n\n # box parameters (type, dimension, shape, periodicity)\n sarr = re.findall('\\S+', f.readline())\n config['l...
[ "0.6741865", "0.6446248", "0.6438073", "0.6401948", "0.63958985", "0.6354653", "0.63371855", "0.6229292", "0.6175838", "0.61544806", "0.60554904", "0.6042597", "0.6027119", "0.6022489", "0.6022132", "0.60192966", "0.5980198", "0.59645903", "0.59530187", "0.5934969", "0.592913...
0.6203149
8
Takes an atom dict and writes it to an .xyz file in foldername in /Created_QD with filename as name for the file
def dict2file(dict, filename, foldername): if foldername: if not os.path.exists("../Created_QD/" + foldername): os.makedirs("../Created_QD/" + foldername) file = open("../Created_QD/" + foldername + "/" + filename + ".xyz", "w") else: file = open("../Created_QD/" + filename +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_xyz(self, filename): \n with open( filename, 'a' ) as F:\n F = open( filename, 'a' )\n F.write( '%d\\n'%self.num_atoms )\n F.write( \"XYZ\\n\" )\n for num,row in enumerate(self.atoms):\n try:\n F.write('%s '%self.species[num])\n except:\n F.write(...
[ "0.64304036", "0.63667876", "0.6360757", "0.6177127", "0.60185474", "0.59346175", "0.58930415", "0.5840039", "0.58249146", "0.5794842", "0.57787114", "0.5749572", "0.5735917", "0.5710008", "0.57033205", "0.5697638", "0.56691194", "0.56664854", "0.56631005", "0.5657911", "0.56...
0.75428385
0
Finds atoms at the origin in a dict, returns its id
def base_atom(dict): for atom, values in dict.items(): xyz = values["coor"] if xyz[0] == xyz[1] == xyz[2] == 0: return atom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_demand_id(demand_dict, vn_id, fvr_id, svr, nbr):\n #print vn_id, fvr_id, svr, nbr\n for demand_id in demand_dict:\n if vn_id == demand_dict[demand_id]['vn_id'] and \\\n fvr_id == demand_dict[demand_id]['fnode_id'] and \\\n svr == demand_dict[demand_id]['svr'] and \\\n ...
[ "0.5926452", "0.5634988", "0.5295975", "0.5282709", "0.52257067", "0.5161398", "0.508171", "0.5079885", "0.5073828", "0.5048743", "0.5029526", "0.50288653", "0.5028559", "0.5015856", "0.5008036", "0.49915805", "0.49639514", "0.4963865", "0.49622545", "0.4933749", "0.4920927",...
0.6143067
0
Converts strings y and n to boolean
def y2true(text): while True: if text == 'y': return True elif text == 'n': return False else: text = input("Wrong input, try again: ")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bool(s: str):\n if s.strip().lower() == \"y\":\n return True\n else:\n return False", "def _get_bool(string):\n string = string.lower()\n return True if string == 'y' else False", "def eval_y_n(self, question):\n answer = raw_input(question + \" [y/n] : \")\n retu...
[ "0.7319038", "0.69107634", "0.6700293", "0.66846", "0.6606526", "0.6605776", "0.65743244", "0.65112495", "0.65079075", "0.62479234", "0.62007165", "0.61767143", "0.6154451", "0.6152505", "0.61269474", "0.61194664", "0.611237", "0.6106023", "0.6097604", "0.60594904", "0.604145...
0.6958512
1
Returns a matrix of map tiles
def createTiles(): Renderer.Clear() map = [] w, h = len(testmap[0]), len(testmap) x, y = 0, 0 for row in testmap: for char in row: map.append(makeTile(char, x, y)) x += 1 y += 1 x = 0 return map, w, h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tiles(self) -> list:\n n_rows = self.mosaic_dimensions[0]\n n_columns = self.mosaic_dimensions[1]\n return [\n self.get_tile(i_row, i_column)\n for i_row in range(n_rows)\n for i_column in range(n_columns)\n ]", "def __init__tiles__(self):\n ...
[ "0.707192", "0.7048794", "0.6917319", "0.6899672", "0.67853016", "0.6704365", "0.6704365", "0.6682728", "0.66672593", "0.6522762", "0.6433973", "0.63403666", "0.6328379", "0.63274586", "0.6298421", "0.62948275", "0.62924397", "0.62750506", "0.6272464", "0.62414765", "0.623640...
0.75113404
0
This method parses poetic movements as specified in the movements_to_scrape list, follows each movement link and yields a request using parse_movement method
def parse(self, response): movements_to_scrape = ["Beat","Black Arts","Black Mountain","Conceptual Poetry","Concrete Poetry", "Confessional Poetry","Contemporary","Dark Room Collective","Formalism","Futurism", "Harlem Renaissance","Jazz Poetry","Lang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_movement(self, response):\n movement_name = response.meta['movement_name']\n movement_url = response.meta['movement_url']\n\n sresponse = scrapy.Selector(response)\n\n #Because each movement page contains a table that has maximum of ten rows, we need to go to the next page\n ...
[ "0.75489324", "0.71242", "0.5760647", "0.5611293", "0.55545515", "0.55472314", "0.5544202", "0.5456553", "0.5455188", "0.5418424", "0.54031754", "0.5396842", "0.53465706", "0.53382075", "0.5328522", "0.53110784", "0.529639", "0.52911603", "0.52840555", "0.5279618", "0.5242923...
0.74549824
1
This method looks at each movement page and creates a new PoetItem for each poet found in page's table
def parse_movement(self, response): movement_name = response.meta['movement_name'] movement_url = response.meta['movement_url'] sresponse = scrapy.Selector(response) #Because each movement page contains a table that has maximum of ten rows, we need to go to the next page #in or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_poet(self, response):\n item = response.meta['item']\n\n sresponse = scrapy.Selector(response)\n poetdata = sresponse.xpath('//div[@class=\"view-content\"]')\n\n #TODO: Clear empty strings from poet item fields\n\n item['poet_basicbio'] = poetdata[0].xpath('div/span//te...
[ "0.6383938", "0.62331283", "0.548556", "0.5451658", "0.52535385", "0.5233169", "0.51950914", "0.5124749", "0.5098735", "0.50874716", "0.5037494", "0.5027248", "0.49692222", "0.4942993", "0.49003536", "0.48962796", "0.48873606", "0.48739573", "0.4872106", "0.48439267", "0.4840...
0.71895266
0
This method scrapes data (bio, url of all poems) from each poet page to continue creating the poet item
def parse_poet(self, response): item = response.meta['item'] sresponse = scrapy.Selector(response) poetdata = sresponse.xpath('//div[@class="view-content"]') #TODO: Clear empty strings from poet item fields item['poet_basicbio'] = poetdata[0].xpath('div/span//text()').extract(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_poet_poems(self, response):\n poet_poems_url = response.meta['poet_poems_url']\n\n sresponse = scrapy.Selector(response)\n\n #like the movement pages, this page contains a table that has maximum of ten rows, we need to go to the next\n # page in order to extract all of the poe...
[ "0.7948013", "0.68461853", "0.67603666", "0.66625357", "0.61643696", "0.6150909", "0.5885224", "0.5870858", "0.58600146", "0.578315", "0.5738709", "0.57362324", "0.57036006", "0.5684646", "0.5677119", "0.5675798", "0.56603056", "0.565232", "0.5634309", "0.56316173", "0.562194...
0.82065254
0
This method parses the poems found in the page of all poems available for a specific poet The poet poems url is the foreign key to poets collection
def parse_poet_poems(self, response): poet_poems_url = response.meta['poet_poems_url'] sresponse = scrapy.Selector(response) #like the movement pages, this page contains a table that has maximum of ten rows, we need to go to the next # page in order to extract all of the poems associat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_poet(self, response):\n item = response.meta['item']\n\n sresponse = scrapy.Selector(response)\n poetdata = sresponse.xpath('//div[@class=\"view-content\"]')\n\n #TODO: Clear empty strings from poet item fields\n\n item['poet_basicbio'] = poetdata[0].xpath('div/span//te...
[ "0.76509404", "0.6316497", "0.6232622", "0.60066766", "0.59613264", "0.55365926", "0.5433117", "0.5388524", "0.53653985", "0.5345765", "0.5338251", "0.5269565", "0.52671176", "0.5202305", "0.51900584", "0.51822567", "0.51615363", "0.5134702", "0.5116707", "0.5097585", "0.5093...
0.80227727
0
This method parses each poem on poem pages and finally yields the poemitems
def parse_poet_poem(self, response): poemitem = response.meta['poemitem'] sresponse = scrapy.Selector(response) poemitem['poem_text'] = sresponse.xpath('//div[@property = "content:encoded"]//text()').extract() poemitem['poem_copyright'] = sresponse.xpath('//div[@class = "poem-credit"]//p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_poet_poems(self, response):\n poet_poems_url = response.meta['poet_poems_url']\n\n sresponse = scrapy.Selector(response)\n\n #like the movement pages, this page contains a table that has maximum of ten rows, we need to go to the next\n # page in order to extract all of the poe...
[ "0.7213079", "0.71406233", "0.6475927", "0.59090114", "0.5766759", "0.5761037", "0.5740958", "0.57350755", "0.57176733", "0.56667167", "0.5645379", "0.56218153", "0.56191784", "0.5588704", "0.5571916", "0.5538668", "0.5532088", "0.55089444", "0.55086166", "0.54917306", "0.548...
0.7146734
1
Coroutine wrapper around `time.sleep`.
async def time_sleep_coro(secs: float): await asyncio.sleep(secs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def sleep(cls, delay: float) -> None:", "def sleep(seconds):\n\n return Sleep(seconds)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(sleep_time=0.250):\n time.sleep(sleep_time)", "def sleep(self, amount: float):\n time.sleep(am...
[ "0.8156352", "0.7878079", "0.7722192", "0.7722192", "0.76466715", "0.7640406", "0.76396054", "0.7581276", "0.7509755", "0.75091183", "0.7489297", "0.73604864", "0.73423356", "0.7341434", "0.73147935", "0.72658235", "0.7215652", "0.721547", "0.7106817", "0.70747185", "0.705582...
0.74316525
11
Wrapper around `time.sleep` to match the signature of the main case below.
def sleep(secs: float) -> Coroutine[None, None, None]: return time_sleep_coro(secs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(seconds):\n\n return Sleep(seconds)", "def sleep(secs=1.0):\n time.sleep(secs)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(seconds):\n time.sleep(seconds)", "def sleep(interval):\n time.sleep(interval) # pragma: no cover", "def sleep(sleep_time=0.250):\n time.sle...
[ "0.8015693", "0.79522854", "0.78925645", "0.78925645", "0.7880162", "0.787606", "0.7862382", "0.7760143", "0.77381194", "0.7715846", "0.75665635", "0.7347547", "0.7336346", "0.7207538", "0.71536756", "0.7153226", "0.7124681", "0.7122617", "0.7072964", "0.70454055", "0.7032891...
0.6706254
39
Creates a coroutine that does nothing for when no sleep is needed.
async def no_sleep_coro(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awaitable(obj):\n yield from asyncio.sleep(0)\n return obj", "def run_no_args(self):\n while True:\n if self.cancelled:\n return\n self.func()\n time.sleep(self.sleep_time / 1000.00)", "def without_wait(self):\n return self.temp_implicit_w...
[ "0.62436175", "0.6190582", "0.61719257", "0.6137821", "0.5900524", "0.58804405", "0.5874823", "0.58503664", "0.58102584", "0.57648695", "0.57648695", "0.5745751", "0.5739838", "0.57116777", "0.5652093", "0.5645594", "0.5622938", "0.56145954", "0.5602458", "0.55889374", "0.558...
0.8199025
0
A replacement sleep for Windows. Note that unlike `time.sleep` this may sleep for slightly less than the specified time. This is generally not an issue for Textual's use case. In order to create a timer that _can_ be cancelled on Windows, we need to create a timer and a separate event, and then we wait for either of th...
def sleep(secs: float) -> Coroutine[None, None, None]: # Subtract a millisecond to account for overhead sleep_for = max(0, secs - 0.001) if sleep_for < 0.0005: # Less than 0.5ms and its not worth doing the sleep return no_sleep_coro() timer = kernel32.CreateWait...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sleep(self, sleep_time: float = 10) -> None:\n sleep_until_interrupt(sleep_time, lambda: self.stopped, interval=0.5)", "def sleep(sleep_time=0.250):\n time.sleep(sleep_time)", "def sleep(secs=1.0):\n time.sleep(secs)", "def set_sleep_timer(self, option, time):\n params = [\n ...
[ "0.6478523", "0.6467439", "0.62972337", "0.62152714", "0.61905533", "0.61398786", "0.6105847", "0.61010325", "0.6100269", "0.609553", "0.6091412", "0.6091412", "0.6072209", "0.60244656", "0.6000396", "0.59438556", "0.59020305", "0.5901713", "0.5888825", "0.58390737", "0.58360...
0.6513097
0
Sets the cancel event so we know we can stop waiting for the timer.
def cancel_inner(): kernel32.SetEvent(cancel_event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cancel(self):\n self.waiter.set_result_if_pending(None)\n \n timer = self.timer\n if (timer is not None):\n self.timer = None\n timer.cancel()", "def cancel(self):\n self.waiter.set_result_if_pending(True)\n \n timer = self.timer\n ...
[ "0.7676816", "0.7467314", "0.7397475", "0.733986", "0.7244259", "0.71759206", "0.71301645", "0.71301645", "0.7041629", "0.70007837", "0.6995933", "0.6995933", "0.69819576", "0.6949455", "0.69289273", "0.68336475", "0.68163085", "0.67847276", "0.6758899", "0.67556834", "0.6755...
0.7688794
0
Cancels the timer by setting the cancel event.
async def cancel(): await asyncio.get_running_loop().run_in_executor(None, cancel_inner)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel(self):\n if self._timer:\n self._timer.cancel()\n self._timer = None\n else:\n raise Exception('Cannot cancel timer. No timer started.')", "def cancel_time(self, cancel_time):\n\n self._cancel_time = cancel_time", "def cancel(self):\n self...
[ "0.7522803", "0.749893", "0.7431519", "0.73576546", "0.73336273", "0.71443474", "0.71443474", "0.7121317", "0.7092865", "0.7011581", "0.69738644", "0.69738644", "0.69659966", "0.69072753", "0.6883524", "0.6879814", "0.68764305", "0.6869267", "0.6869267", "0.6869267", "0.68427...
0.0
-1
Function responsible for waiting for the timer or the cancel event.
def wait_inner(): if ( kernel32.WaitForMultipleObjects( 2, ctypes.pointer((HANDLE * 2)(cancel_event, timer)), False, INFINITE, ) == WAIT_FAILED ): time_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self, timeoout=None, state=\"C-completed\"):", "async def wait_for_cancel(self):\n await self._cancel", "def _wait_for_completion(self):\n if self.do_timing:\n self.timer.start(\"Running.\")\n\n while self.state != State.COMPLETED:\n self._update_state()\n\n ...
[ "0.7174734", "0.71252257", "0.68507195", "0.68419737", "0.67769885", "0.67605805", "0.67037636", "0.66891533", "0.66845816", "0.66050535", "0.65404123", "0.65313905", "0.64974064", "0.6473606", "0.64717025", "0.64504385", "0.6397383", "0.63804114", "0.63804114", "0.63766485", ...
0.76650566
0
Wraps the actual sleeping so we can detect if the thread was cancelled.
async def wait(): try: await asyncio.get_running_loop().run_in_executor(None, wait_inner) except asyncio.CancelledError: await cancel() raise finally: kernel32.CloseHandle(timer) kernel32.CloseHandle(canc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(self):\n for i in range(10):\n if cancelled: return False\n time.sleep(1)\n return True", "def _sleep(self, sleep_time: float = 10) -> None:\n sleep_until_interrupt(sleep_time, lambda: self.stopped, interval=0.5)", "def interruptableSleep(self, seconds):\n remainingSecon...
[ "0.6566912", "0.6495458", "0.63694894", "0.62619054", "0.6237809", "0.62232906", "0.62187064", "0.61902666", "0.6129422", "0.60156125", "0.5976705", "0.5935192", "0.5897987", "0.58867836", "0.5874236", "0.58713585", "0.580062", "0.580062", "0.5785263", "0.5755012", "0.5750527...
0.0
-1
You are given weights and values of items, put these items in a knapsack of capacity weight_limit to get the maximum total value in the knapsack.
def fill_knapsack(raw_items, weight_limit): table = [ [0]*(weight_limit+1) for _ in range(len(raw_items)) ] # initialise first row value_item = raw_items[0][0] weight_item = raw_items[0][1] for j in range(min([weight_item, weight_limit+1])): table[0][j] = 0 for j in range(weight_item, w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knapsack(items, capacity):\r\n pass", "def knapsack(items, capacity):\n if len(items) == 0 or capacity <= 0:\n return 0\n \n name, weight, value = items[0]\n val_without = knapsack(items[1:], capacity)\n\n if weight > capacity:\n return val_without\n val_with = value + knap...
[ "0.8320686", "0.8263009", "0.80508375", "0.80328536", "0.7927791", "0.79154485", "0.7832968", "0.78256446", "0.7670298", "0.75953615", "0.7571719", "0.7546358", "0.7382605", "0.73721385", "0.7364689", "0.73359287", "0.72694445", "0.7251536", "0.72451264", "0.7225005", "0.7219...
0.7732081
8
Create sysapps test class.
def test(): zkclient = context.GLOBAL.zk.conn cell_name = context.GLOBAL.cell admin_cell = admin.Cell(context.GLOBAL.ldap.conn) # get cell attribute from ldap object cell = admin_cell.get(cell_name) sysproid = cell['username'] running = zkclient.get_children(z.RUNNING) # prefilter tre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_app_is_created(app):\n assert app.name == \"myapp.app\"", "def test_create_app():\n assert not create_app().testing\n assert create_app({'TESTING': True}).testing", "def check_sysapps():\n return sysapps.test", "def test_app_construction(s):\n empty_app = s['empty-app']\n simpl...
[ "0.67739576", "0.67633355", "0.6659141", "0.6566691", "0.64639604", "0.644535", "0.6410979", "0.64051825", "0.6400125", "0.6329741", "0.62414545", "0.6233027", "0.6218463", "0.62092364", "0.6205732", "0.6158133", "0.6139749", "0.6121102", "0.608798", "0.60838187", "0.60797936...
0.6751296
2
Check {sysproid}.{appname}.{cell} is running.
def _test_app_running(self, running_set, sysproid, cell, appname): full_app_name = '%s.%s.%s' % (sysproid, appname, cell) self.assertIn(full_app_name, running_set)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running(program):\n \n #cmd = [\"xdotool\", \"search\", \"--name\", program]\n cmd = [\"xdotool\", \"search\", \"--name\", \"--class\", \"--classname\", program]\n try:\n subprocess.check_output(cmd)\n return True\n except:\n return False", "def is_sm_running() -> bool:...
[ "0.66739565", "0.6461373", "0.6416072", "0.63748014", "0.6368051", "0.6345569", "0.6295888", "0.62739915", "0.62605065", "0.6186457", "0.61560464", "0.609521", "0.60186034", "0.6016657", "0.6009209", "0.6008331", "0.6001014", "0.59857357", "0.5974706", "0.595932", "0.5954081"...
0.6727489
0
This method is called during a move's `action_done`. It'll actually move a quant from the source location to the destination location, and unreserve if needed in the source location. This method is intended to be called on all the move lines of a move. This method is not intended to be called when editing a `done` move...
def _action_done(self): # First, we loop over all the move lines to do a preliminary check: `qty_done` should not # be negative and, according to the presence of a picking type or a linked inventory # adjustment, enforce some rules on the `lot_id` field. If `qty_done` is null, we unlink ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loot_enq_move(self, item, toloc):\n itemloc = item.Location.ToLocation()\n self.pqi.enq(2, ['move', [[itemloc.X, itemloc.Y, itemloc.Z],\n item.Id, itemloc.Z,\n [toloc.X, toloc.Y, toloc.Z],\n item.Count\n ...
[ "0.6281393", "0.6151487", "0.6090694", "0.60468554", "0.6036133", "0.5997963", "0.5967796", "0.59452647", "0.59211004", "0.58850086", "0.5854653", "0.5854297", "0.58422697", "0.5832115", "0.5814126", "0.5808458", "0.5793776", "0.5744125", "0.57013524", "0.569954", "0.5652009"...
0.6330825
0
The response iterable as writeonly stream.
def stream(self): return ResponseStream(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_as_stream(self) -> Any:\n raise NotImplementedError # pragma: no cover", "def stream(self, write, request):\n raise NotImplementedError(\"%s.stream\" % reflect.qual(self.__class__))", "def getOutputStream(self):\r\n self._setHeaders()\r\n return self._response.getOutpu...
[ "0.7330909", "0.6544413", "0.64807034", "0.6401678", "0.6401678", "0.6224532", "0.59967285", "0.59855986", "0.5966709", "0.594459", "0.58853096", "0.5849615", "0.58353543", "0.57926196", "0.5761642", "0.5744629", "0.5694836", "0.5675186", "0.56467724", "0.5643159", "0.5639434...
0.6642246
1
Modify the specified group defaults.
def config(gvar): mandatory = [] required = [] optional = ['-cc', '-ckv', '-CSEP', '-CSV', '-g', '-H', '-h', '-NV', '-ok', '-r', '-s', '-V', '-VC', '-v', '-x509', '-xA'] if gvar['retrieve_options']: return mandatory + required + optional # Check for missing arguments or help required. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults(self, **kw):\n group = kw.pop('group', None)\n for o, v in kw.items():\n self.cfg_fixture.set_default(o, v, group=group)", "def _getGroupDefaults(self):\n defaults = self.getDefaultGroupContainer(\n _name = \"defaults\",\n diff_command = self...
[ "0.7184848", "0.6596516", "0.6438077", "0.6252312", "0.6243312", "0.6232612", "0.62150013", "0.59281456", "0.59254956", "0.59022254", "0.589668", "0.587396", "0.58705354", "0.58090675", "0.58086026", "0.5792662", "0.5790622", "0.5790524", "0.5772414", "0.5770209", "0.57333934...
0.0
-1
pyc files are compiled python files
def ignore_pyc(root,names): return [name for name in names if name.endswith('pyc')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyo():\n local('python -O -m compileall .')", "def pyo():\n local('python -O -m compileall .')", "def dump_to_pyc(co, python_version, output_dir):\n # assume Windows path information from the .exe\n pyc_basename = ntpath.basename(co.co_filename)\n pyc_name = f'{pyc_basename}.pyc'\n\n if p...
[ "0.76460916", "0.76460916", "0.6611577", "0.65328807", "0.65157396", "0.64948845", "0.6453072", "0.6333553", "0.63172144", "0.6250905", "0.62331843", "0.61961657", "0.61082584", "0.6089736", "0.6059642", "0.5937924", "0.5929911", "0.5920827", "0.5914817", "0.5861231", "0.5777...
0.5252192
84
Sets the defaults for the application
def _set_defaults(self): self.api_protocol = 'https' self.api_host = 'nhl-score-api.herokuapp.com' self.current_score = 0 self.sleep_seconds = 30 # Time to sleep after calling the API self.desired_game_state = 'LIVE' # Desired game state is LIVE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setdefaults(self):\n self.config = {\n 'dbuser': Infopage.DEFAULT_DBUSER,\n 'dbname': Infopage.DEFAULT_DBNAME,\n 'dbpassword': Infopage.DEFAULT_DBPASSWORD,\n 'dbhost': Infopage.DEFAULT_DBHOST\n }", "def set_app_defaults(self):\n self.curve_rend...
[ "0.7357145", "0.7231974", "0.72296315", "0.72133297", "0.72133297", "0.72133297", "0.71464986", "0.70750517", "0.69881386", "0.68930227", "0.68891907", "0.6831446", "0.6802917", "0.67972445", "0.6766449", "0.673461", "0.67219883", "0.6717343", "0.66930187", "0.6652306", "0.66...
0.63886625
37
Returns any live games currently happening with the API
def _get_live_games(self): response = requests.get(self._get_score_url()) if response.status_code == 200: return [g for g in response.json()['games'] if g['status']['state'] == self.desired_game_state]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_games(self):\n return await self.http.get_game_list()", "def get_games_from_database (self):\n r = requests.get (self.url_endpoint)\n if (r.status_code != 200):\n print (\"Failed to get games:\\n\", r.text)\n return r\n \n games = json.load...
[ "0.7730199", "0.7471135", "0.7325539", "0.7287605", "0.7253883", "0.71185577", "0.71165675", "0.69969124", "0.68289065", "0.6684004", "0.6620107", "0.65803075", "0.6573545", "0.6527177", "0.6521868", "0.6480549", "0.6474347", "0.6449517", "0.6438656", "0.64343774", "0.6428631...
0.84799916
0
Gets the current team's score from the API
def _get_current_teams_score(self): for game in self._get_live_games(): teams_playing = [x['abbreviation'] for index, x in game['teams'].items()] if self.team in teams_playing: # Our team is playing in this game, get the score return int(ga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self):\n return self.client.call('GET', self.name + 'score')", "def getScore(data):\n return score", "def get_score(self):\n return self.score", "def get_scores(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n ret...
[ "0.7527059", "0.72310585", "0.6813954", "0.681293", "0.675793", "0.675793", "0.675793", "0.66784096", "0.66253316", "0.6584562", "0.6568987", "0.6539687", "0.6478145", "0.6478145", "0.6478145", "0.64599675", "0.6432476", "0.63932824", "0.63802594", "0.6361858", "0.6353685", ...
0.7543717
0
A callback for when the score has changed
def _score_has_changed(self): print('The score for {} has changed'.format(self.team)) self.relay_controller.activate_solenoid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score():\n pass", "def set_score(self, change):\n self._score = self._score + change", "def change_score(self, change: float=1):\n self._score += change", "def updateScore(self, score):\n self.__score += score", "def change_score(self, change: float = 1):\n sel...
[ "0.8341499", "0.74432063", "0.73771644", "0.7372784", "0.734759", "0.73033684", "0.72073954", "0.71673465", "0.7100169", "0.70697486", "0.7063373", "0.69999087", "0.6984844", "0.6956813", "0.6926817", "0.6926514", "0.69130313", "0.69130313", "0.69130313", "0.6872642", "0.6860...
0.7795641
1
Run the app and watch for changes
def run(self): try: while True: print('Getting score from API...') latest_score = self._get_current_teams_score() if latest_score is None: print('No score available, waiting') else: print('Current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # for running indefinitely if 'watch' is passed\n if self._arguments.watch:\n while True:\n self.watch(self.main(), int(self._arguments.watch))\n else:\n self.main()", "def run(self):\n self.app.run()", "def run(self):\n s...
[ "0.7283297", "0.7230205", "0.7230205", "0.695691", "0.69266194", "0.6910289", "0.67840403", "0.67665446", "0.6617058", "0.66033804", "0.65981317", "0.6581717", "0.65502757", "0.65164596", "0.65155524", "0.65133655", "0.6426817", "0.63905853", "0.63619006", "0.6324085", "0.628...
0.0
-1
Convert amber force to phenix's order
def reorder_force_amber_to_phenix(frc, new_indices): frc = np.asarray(frc) n_atoms = int(frc.shape[0]/3) new_frc = frc.reshape(n_atoms, 3)[new_indices] return new_frc.flatten()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_normalization_order(self):\n self._cache[\"input\"][\"order\"] = int(self.order.currentText())\n self.reset_input_style_defaults()\n self.fit_continuum(True)\n self.draw_continuum(True)\n return None", "def order_ideal(self, gens):", "def reorder(self, new_order):\...
[ "0.60155886", "0.5705022", "0.56526685", "0.5433478", "0.5433478", "0.5353595", "0.53525275", "0.53117526", "0.5296383", "0.5288029", "0.5170808", "0.512681", "0.51214826", "0.5099078", "0.5092627", "0.5066978", "0.5058092", "0.5050407", "0.50501", "0.5036617", "0.5033469", ...
0.52579266
10
Convert phenix site_cart to amber format Paramters
def reorder_coords_phenix_to_amber(coords, new_indices): coords_2d = np.asarray(coords) return coords_2d[new_indices]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pol_to_cart():\n pass", "def cart_to_pol():\n pass", "def update_cart_args(request):\n cart = Cart(request)\n context = {}\n context['cart_total_item'] = cart.get_total_item()\n context['cart_total_price'] = cart.get_total_price()\n return context", "def update_cart_args(request):\n ...
[ "0.62890846", "0.5937737", "0.5834528", "0.5834528", "0.5453803", "0.51159734", "0.50862145", "0.5032178", "0.49987817", "0.4918404", "0.48844433", "0.48670283", "0.48539582", "0.47867537", "0.47828287", "0.4775699", "0.47695547", "0.47377214", "0.47122937", "0.47092468", "0....
0.0
-1
return a dict(a2p=arr0, p2a=arr1). Key "a2p" means converting amber order to phenix order Key "p2a" means converting phenix order to amber order
def get_indices_convert_dict(fn): pdb_inp = pdb.input(file_name=fn) pdb_hierarchy = pdb_inp.construct_hierarchy() newids = OrderedDict((atom.id_str(), idx) for (idx, atom) in enumerate(pdb_hierarchy.atoms())) oldids= OrderedDict((atom.id_str(), idx) for (idx, atom) in enumerate(pdb_inp.atoms())) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paramz_to_dict(p):\n return dict([(k.name, np.array(k)) for k in p])", "def convert_arrpart_to_dict(particles):\n partdict = {}\n partdict['m'] = particles[:,0]\n partdict['Z'] = particles[:,2]\n partdict['rho'] = particles[:,5]\n partdict['R'] = particles[:,7]\n partdict['vphi'] = p...
[ "0.6365707", "0.59968275", "0.5911731", "0.5696765", "0.5571321", "0.55429137", "0.54785323", "0.54684395", "0.54655355", "0.5458638", "0.54449743", "0.5401446", "0.53939253", "0.5382905", "0.5363385", "0.5341607", "0.53321666", "0.53309155", "0.53248113", "0.53123164", "0.53...
0.6150025
1
Perform a style check on an ontology By default repairs will be performed if necessary
def lint_ontology( oi: BasicOntologyInterface, dry_run=False, entities: Iterable[CURIE] = None ) -> Iterable[ISSUE]: for actionable, change in _lint_ontology_dry_run(oi, entities): if actionable and not dry_run: if isinstance(oi, PatcherInterface): oi.apply_patch(change) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def style(command, checkonly=False):\n black(command, checkonly=checkonly)\n isort(command, checkonly=checkonly)\n lint(command)\n # Only prints if doesn't exit from the above not failing out\n print(\n \"\"\"\nAll Style Checks Passed Successfully\n====================================\n\"\"\"...
[ "0.62346035", "0.5760028", "0.56449413", "0.54283404", "0.5408951", "0.5408253", "0.53761643", "0.5217938", "0.5173615", "0.5134347", "0.51237994", "0.51134735", "0.50752974", "0.50604635", "0.50281394", "0.5015283", "0.4996412", "0.49574563", "0.49012482", "0.48945314", "0.4...
0.5457959
3
Decorate a test method to run it as a set of subtests. Modeled after pytest.parametrize.
def parameterize(names, value_groups): def decorator(func): @functools.wraps(func) def wrapped(self): for values in value_groups: resolved = map(Invoked.eval, always_iterable(values)) params = dict(zip(always_iterable(names), resolved)) wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self, func):\r\n @wraps(func)\r\n def wrapper():\r\n with nested(self._contexts) as context:\r\n context = [c for c in context if c is not None]\r\n argc = len(inspect.getargspec(func)[0])\r\n args = []\r\n for arg in con...
[ "0.6848636", "0.6483684", "0.63185793", "0.6195601", "0.615952", "0.61097777", "0.61015517", "0.6099582", "0.6064761", "0.6016524", "0.5978094", "0.59725267", "0.59543383", "0.59543383", "0.5920831", "0.59197617", "0.5894361", "0.5870087", "0.5840146", "0.57989144", "0.576454...
0.5828212
19
capture image from camera
def rpi_capture_image(project, number): import picamera #now = datetime.datetime.now() #now_str = now.strftime('%Y%m%d:%H:%M:%S') #print now_str name = project.name #print name if not os.path.exists(IMAGE_PATH): call(["mkdir", IMAGE_PATH]) image_number = str(number).zfill(7) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture_image():\n global img_tk\n r, img_cam = cam.read()\n img_pil = Image.fromarray(cv2.cvtColor(img_cam, cv2.COLOR_BGR2RGB))\n img_tk = ImageTk.PhotoImage(img_pil)\n tk_cam.create_image(0, 0, image=img_tk, anchor='nw')\n return img_pil", "def capture_image():\n\n endpoint = CAMERA_CA...
[ "0.7795241", "0.7729087", "0.757988", "0.75707597", "0.7435194", "0.73699677", "0.73294467", "0.72867817", "0.7243392", "0.72147304", "0.717186", "0.7163452", "0.713739", "0.70919883", "0.69702286", "0.6968026", "0.6967313", "0.69081175", "0.69081175", "0.68981284", "0.686327...
0.690993
17
Sets the complex amplitude.
def getIntensityS(self): return self._Esigma.intensity()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _amp_ ( self , x ) :\n v = self.amplitude ( x )\n #\n return complex( v.real () , v.imag () )", "def amplitude(self, channel, amp):\n chan = self.channels[channel]\n\n assert abs(amp) <= 1.5, 'Amplitude has to be less than 1.5V'\n err = chan.connection.channelAmplitude(chan.chan...
[ "0.6375799", "0.6256541", "0.62201387", "0.6191588", "0.6053649", "0.60339534", "0.6031569", "0.5922736", "0.57384294", "0.5695767", "0.5644062", "0.5571589", "0.55101675", "0.5470523", "0.5453427", "0.5446871", "0.5431867", "0.542857", "0.5420551", "0.54123116", "0.5397047",...
0.0
-1
Sets the complex amplitude.
def getIntensityP(self): return self._Epi.intensity()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _amp_ ( self , x ) :\n v = self.amplitude ( x )\n #\n return complex( v.real () , v.imag () )", "def amplitude(self, channel, amp):\n chan = self.channels[channel]\n\n assert abs(amp) <= 1.5, 'Amplitude has to be less than 1.5V'\n err = chan.connection.channelAmplitude(chan.chan...
[ "0.6375799", "0.6256541", "0.62201387", "0.6191588", "0.6053649", "0.60339534", "0.6031569", "0.5922736", "0.57384294", "0.5695767", "0.5644062", "0.5571589", "0.55101675", "0.5470523", "0.5453427", "0.5446871", "0.5431867", "0.542857", "0.5420551", "0.54123116", "0.5397047",...
0.0
-1
Sets the complex amplitude.
def getIntensity(self): return self.getIntensityS() + self.getIntensityP()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _amp_ ( self , x ) :\n v = self.amplitude ( x )\n #\n return complex( v.real () , v.imag () )", "def amplitude(self, channel, amp):\n chan = self.channels[channel]\n\n assert abs(amp) <= 1.5, 'Amplitude has to be less than 1.5V'\n err = chan.connection.channelAmplitude(chan.chan...
[ "0.6375799", "0.6256541", "0.62201387", "0.6191588", "0.6053649", "0.60339534", "0.6031569", "0.5922736", "0.57384294", "0.5695767", "0.5644062", "0.5571589", "0.55101675", "0.5470523", "0.5453427", "0.5446871", "0.5431867", "0.542857", "0.5420551", "0.54123116", "0.5397047",...
0.0
-1
Determines if two polarized photons are identical (same energy, direction and polarization).
def __eq__(self, candidate): if ((self.energy() == candidate.energy() and self.unitDirectionVector() == candidate.unitDirectionVector()) and self._Esigma.complexAmplitude() == candidate._Esigma.complexAmplitude() and self._Epi.complexAmplitude() == candidate._Epi....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_similar_with(self, other):\n\n # corresponding angles are congruent\n if self.angles != other.angles:\n return False\n # corresponding sides are proportional\n proportion = self.perimeter() / other.perimeter()\n for i in range(len(self.lengths)):\n if...
[ "0.68101615", "0.6614083", "0.65789586", "0.64757085", "0.64612556", "0.6421079", "0.6401745", "0.63870627", "0.63730395", "0.6364115", "0.6333348", "0.6290905", "0.6201502", "0.6198665", "0.6136013", "0.6116805", "0.6093822", "0.6086045", "0.60715705", "0.606903", "0.6060494...
0.5732779
84
Determines if two polarized photons are not identical (same energy, direction and polarization).
def __ne__(self, candidate): return not (self == candidate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_similar_with(self, other):\n\n # corresponding angles are congruent\n if self.angles != other.angles:\n return False\n # corresponding sides are proportional\n proportion = self.perimeter() / other.perimeter()\n for i in range(len(self.lengths)):\n if...
[ "0.67724645", "0.6738176", "0.65756047", "0.6330637", "0.63286847", "0.6316591", "0.63129854", "0.6303219", "0.62443715", "0.62213105", "0.61847687", "0.61709136", "0.6159082", "0.61590666", "0.6127881", "0.6122283", "0.60869306", "0.607861", "0.6044467", "0.6021837", "0.6010...
0.0
-1
Concatenate conditioning vector on feature map axis.
def conv_cond_concat(x, y): ones_y = fluid.layers.fill_constant_batch_size_like( x, [-1, y.shape[1], x.shape[2], x.shape[3]], "float32", 1.0) return fluid.layers.concat([x, ones_y * y], 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_cond_concat(x, y):\n return T.concatenate([x, y*T.ones((x.shape[0], y.shape[1], x.shape[2], x.shape[3], x.shape[4]))], axis=1)", "def add_feature(x, x1):\n if x is None:\n x = x1\n else:\n x = np.concatenate((x, x1), axis=1)\n return x", "def buildConditionalPriorTerm(self):\...
[ "0.58339125", "0.5492559", "0.54484504", "0.5387228", "0.53704846", "0.5263228", "0.52565724", "0.52355707", "0.5155966", "0.5096469", "0.50964016", "0.5069878", "0.5039265", "0.5006411", "0.49536952", "0.4943956", "0.4934806", "0.49287412", "0.4924495", "0.49115935", "0.4903...
0.5475793
2
a network in network layer (1x1 CONV)
def nin(x, num_units, name=None, param_attr=None, act=None, reuse=False): if name is None: name = get_parent_function_name() s = list(map(int, x.shape)) #print([np.prod(s[:-1]),s[-1]]) x = reshape(x, [-1, np.prod(s[2:]), s[1]]) #x = reshape(x, [np.prod(s[:-1]),s[-1]])#the position change and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def complex_network_mapping(graph):\n vect = []\n\n n = nx.number_of_nodes(graph)\n e = nx.number_of_edges(graph)\n print n, e\n\n# adj = nx.adjacency_matrix(graph).toarray()\n# adj_bin = np.where(adj > 0, 1., 0.)\n# adj_conn = 1 - adj\n adj_bin = nx.adjacency_matrix(gr...
[ "0.64673615", "0.6333042", "0.62303203", "0.62081575", "0.6189894", "0.6160035", "0.61567533", "0.6140798", "0.6115296", "0.61127985", "0.61087465", "0.6017349", "0.5999597", "0.59709346", "0.59705466", "0.5901008", "0.5869905", "0.5866736", "0.5856518", "0.58457196", "0.5842...
0.0
-1
Emit a deprecation warning about a gnomerelated reactor.
def deprecatedGnomeReactor(name: str, version: Version) -> None: stem = DEPRECATION_WARNING_FORMAT % { "fqpn": "twisted.internet." + name, "version": getVersionString(version), } msg = stem + ". Please use twisted.internet.gireactor instead." warnings.warn(msg, category=DeprecationWarni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deprecation(self, message, *args, **kws):\n self._log(DEPRECATION, message, args, **kws)", "def guarded_deprecation_warning(*args, **kwargs):\n if os.environ.get(\"SERVE_WARN_V1_DEPRECATIONS\", \"0\") == \"1\":\n from ray._private.utils import deprecated\n\n return deprecated(*args, **kwa...
[ "0.63709056", "0.6337697", "0.61615217", "0.6083312", "0.6040545", "0.59742963", "0.58868295", "0.5778024", "0.5695411", "0.563647", "0.56345797", "0.5613319", "0.55875045", "0.5550916", "0.5532492", "0.5523634", "0.5511823", "0.5491791", "0.5482633", "0.546482", "0.54356366"...
0.75850695
0
reads an image file and converts it into given representation.
def read_image(file_name, representation=GRAY_SCALE): im = np.array(imread(file_name)) img_float = im.astype(np.float32) if representation == 1: # return grayscale image if len(im.shape) == TWO_DIM: # image was given in grayscale return img_float elif len(im.shape) == THREE_DIM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(filename, representation):\n img = imread(filename)\n img = int2float(img)\n if representation == GS_REP:\n img = rgb2gray(img)\n return img", "def read_image(filename, representation):\n image = imread(filename)\n new_image = image.astype(np.float64)\n new_image /= 255...
[ "0.7694408", "0.76537734", "0.7615849", "0.75888735", "0.75616884", "0.7551129", "0.7456566", "0.74403816", "0.73565173", "0.72619706", "0.71915746", "0.71527964", "0.6961384", "0.67848295", "0.67825335", "0.6656239", "0.6641373", "0.6592539", "0.6588783", "0.6508807", "0.649...
0.73874223
8
clears noise from given image using bilateral Filter.
def filter_image(img): return cv2.bilateralFilter(img, 9, 50, 50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtering(image):\n output = np.array(image)\n for x in xrange(0,1):\n bilateralFilter_img = cv2.bilateralFilter(output,5, 75, 75)\n\n return bilateralFilter_img", "def remove_noise(image):\n filtered = cv2.absdiff(image.astype(np.uint8), 255,\n cv2.ADAPTIVE_THRES...
[ "0.6837545", "0.66253495", "0.6352146", "0.6252205", "0.6215135", "0.6187826", "0.60780174", "0.60614115", "0.6018258", "0.5996656", "0.5905434", "0.59041035", "0.58784217", "0.581671", "0.5788512", "0.57701117", "0.5768871", "0.5768721", "0.57474273", "0.57364833", "0.568226...
0.6760517
1
thresholds a grayscale image to a binary image.
def threshold_image(img, threshold=THRESHOLD): return cv2.threshold(img, threshold, MAX_GRAY_SCALE, cv2.THRESH_BINARY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(self, image, threshold):\n\n bin_img = image.copy()\n [h, w] = bin_img.shape\n opt_threshold = threshold\n print(opt_threshold)\n for row in range(h):\n for col in range(w):\n if bin_img[row, col] > opt_threshold: #greater than threshld whit...
[ "0.7555683", "0.73864496", "0.71793264", "0.7158029", "0.70775515", "0.69993556", "0.69715166", "0.6928067", "0.68441004", "0.68359464", "0.6771333", "0.6745976", "0.6704027", "0.6582386", "0.65818775", "0.65701693", "0.6550687", "0.65359485", "0.6466406", "0.63850933", "0.63...
0.68359834
9
find contours in image, filters external (not 100%!!)
def find_contours(thresh): thresh = thresh.astype(np.uint8) contours, hierarchy = cv2.findContours(thresh, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE) # filter outer contours filtered_cont = [] for i in range(len(contours)): if hierarchy[0, i, 3] == NO_PARENT: filtered_cont.append(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(self, img):\n [a, contours, c] = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)\n return contours", "def find_contour(ctx: Context):\n cv2.copyTo(ctx.filter_image, np.ones_like(ctx.temp_image1), ctx.temp_image1)\n contours, _ = cv2.findContours(ctx.temp_image1...
[ "0.77753466", "0.7717092", "0.7498471", "0.74524987", "0.7381892", "0.73541546", "0.73451114", "0.7322127", "0.73151344", "0.7306261", "0.7302151", "0.72858834", "0.7281763", "0.7228213", "0.71711946", "0.7154602", "0.7140557", "0.71032584", "0.7058505", "0.70153964", "0.7006...
0.68330437
26
marks the contours on the image and crops them.
def mark_contours(contour_arr, img, symmetry, _plot=False): marg, flag = 7, 0 # fig, ax = plt.subplots() # ax.imshow(img, cmap="gray") sub_images = [] # init array for pictures for contour in contour_arr: lower_dim = contour[:, 0] x, y = lower_dim[:, 0], lower_dim[:, 1] min...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_contours(self, image, maskImg):\r\n # Required variables..\r\n x, y, width, height = 0, 0, 0, 0\r\n # Find contours..\r\n contours, hierarchy = cv2.findContours(image=maskImg, mode=cv2.RETR_EXTERNAL, method=cv2.CHAIN_APPROX_NONE) # Playable Parameters..\r\n # Draw the c...
[ "0.630481", "0.62921685", "0.62199384", "0.6207988", "0.611618", "0.60492754", "0.59384584", "0.58942974", "0.5874997", "0.5870931", "0.58539474", "0.5836506", "0.5829273", "0.5828158", "0.5815946", "0.5809596", "0.57762873", "0.57565564", "0.5724893", "0.57062984", "0.569092...
0.5319842
57
resizes the given image to size width X height, doesnt edit the original image.
def resize_image(img, width, height): return cv2.resize(img, (width, height))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(image):\n image = resize(image)\n return image", "def resize_image(self, width=200):\n self.new_width = width\n aspect_ratio = self.original_height/float(self.original_width)\n self.new_height = int(aspect_ratio * self.new_width)\n\n resized_image = self.image....
[ "0.7676757", "0.74949396", "0.74371797", "0.73887146", "0.73574597", "0.73138", "0.73090416", "0.72722024", "0.72504354", "0.7237081", "0.7225623", "0.71851814", "0.7157568", "0.7135699", "0.71342456", "0.7129016", "0.7115038", "0.71092075", "0.7105796", "0.710538", "0.710450...
0.7310563
6
Receives two images to compare, img1 being the original. and a string indictating which error function to use. doesnt assume images are the same size.
def compare_img(img1, img2, err_function="ALL"): # make sure images are the same shape # height1, width1, height2, width2 = img1.shape[0], img1.shape[1], img2.shape[0], img2.shape[1] if img1.shape != img2.shape: if width1 * height1 > width2 * height2: img1 = resize_image(img1, width2, h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_images(self, img1, img2):\n if self.debug:\n cv2.imshow('img1', img1)\n cv2.imshow('img2', img2)\n cv2.waitKey(5)\n time.sleep(2)\n\n # find the mean squared difference between the images\n # http://www.pyimagesearch.com/2014/09/15/python...
[ "0.7262324", "0.72613925", "0.7194562", "0.71092004", "0.69404185", "0.6802441", "0.66210765", "0.6609339", "0.66056174", "0.65600413", "0.646752", "0.6427402", "0.6348418", "0.63423145", "0.6291259", "0.62624484", "0.6253601", "0.6207154", "0.6180912", "0.6175744", "0.613465...
0.81464946
0
calculates the mean squared diffrence between two given images. assumes the images have the same size image
def mse(img1, img2): err = (np.square(img1 - img2)).mean(axis=None) # return the MSE, the lower the error, the more "similar" # the two images are return err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mean_squared_error(img1, img2):\n err = np.sum((img1.astype(\"float\") - img2.astype(\"float\")) ** 2)\n err /= float(img1.shape[0] * img1.shape[1])\n return err", "def mse(image1: np.ndarray, image2: np.ndarray) -> np.ndarray:\n return np.sqrt(np.power((image1 - image2), 2).mean(axis=(-1, -2)))...
[ "0.77920526", "0.7781945", "0.744914", "0.7409409", "0.7259769", "0.7251279", "0.720005", "0.71611667", "0.70970553", "0.7089986", "0.7034388", "0.70342225", "0.6963611", "0.6932556", "0.68521976", "0.68270266", "0.6822264", "0.67950255", "0.67466533", "0.64840686", "0.648016...
0.70962375
9
Initialize all valid properties.
def __init__(self, jsondict=None, strict=True): self.abnormalCodedValueSet = None """ Value set of abnormal coded values for the observations conforming to this ObservationDefinition. Type `FHIRReference` (represented as `dict` in JSON). """ self.category = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *properties):\n self._properties = properties", "def _initFields(self):\n pass", "def initProperties(self):\n self.setFoldComments(Preferences.getEditor(\"CssFoldComment\"))\n self.setFoldCompact(Preferences.getEditor(\"AllFoldCompact\"))\n try:\n ...
[ "0.69967675", "0.6955605", "0.68935335", "0.6740379", "0.67131793", "0.67067623", "0.66696674", "0.6666951", "0.66482884", "0.66469395", "0.6634272", "0.66187406", "0.6607808", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6553997", "0.6553997", "0.65535...
0.0
-1
Initialize all valid properties.
def __init__(self, jsondict=None, strict=True): self.age = None """ Applicable age range, if relevant. Type `Range` (represented as `dict` in JSON). """ self.appliesTo = None """ Targetted population of the range. List of `CodeableConcept` items (represe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *properties):\n self._properties = properties", "def _initFields(self):\n pass", "def initProperties(self):\n self.setFoldComments(Preferences.getEditor(\"CssFoldComment\"))\n self.setFoldCompact(Preferences.getEditor(\"AllFoldCompact\"))\n try:\n ...
[ "0.69967675", "0.6955605", "0.68935335", "0.6740379", "0.67131793", "0.67067623", "0.66696674", "0.6666951", "0.66482884", "0.66469395", "0.6634272", "0.66187406", "0.6607808", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6553997", "0.6553997", "0.65535...
0.0
-1
Initialize all valid properties.
def __init__(self, jsondict=None, strict=True): self.conversionFactor = None """ SI to Customary unit conversion factor. Type `float`. """ self.customaryUnit = None """ Customary unit for quantitative results. Type `CodeableConcept` (represented as `dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *properties):\n self._properties = properties", "def _initFields(self):\n pass", "def initProperties(self):\n self.setFoldComments(Preferences.getEditor(\"CssFoldComment\"))\n self.setFoldCompact(Preferences.getEditor(\"AllFoldCompact\"))\n try:\n ...
[ "0.69967675", "0.6955605", "0.68935335", "0.6740379", "0.67131793", "0.67067623", "0.66696674", "0.6666951", "0.66482884", "0.66469395", "0.6634272", "0.66187406", "0.6607808", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6603329", "0.6553997", "0.6553997", "0.65535...
0.0
-1
Function to log an event with the given key. If the ``key`` has not exceeded their allotted events, then the function returns ``False`` to indicate that no limit is being imposed. If the ``key`` has exceeded the number of events, then the function returns ``True`` indicating ratelimiting should occur.
def limit(self, key): if self._debug: return False counter = self.database.List(self.name + ':' + key) n = len(counter) is_limited = False if n < self._limit: counter.prepend(str(time.time())) else: oldest = counter[-1] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate_limited(self, key_function=None):\n if key_function is None:\n def key_function(*args, **kwargs):\n data = pickle.dumps((args, sorted(kwargs.items())))\n return hashlib.md5(data).hexdigest()\n\n def decorator(fn):\n @wraps(fn)\n ...
[ "0.6314541", "0.6014755", "0.577914", "0.5500181", "0.54538137", "0.5354464", "0.5334985", "0.5245052", "0.5227737", "0.5022069", "0.4968157", "0.49460158", "0.49370098", "0.49285924", "0.49258116", "0.48979118", "0.48943257", "0.48854864", "0.4861771", "0.48335403", "0.47916...
0.6515088
0
Function or method decorator that will prevent calls to the decorated function when the number of events has been exceeded for the given time period. It is probably important that you take care to choose an appropriate key function. For instance, if ratelimiting a webpage you might use the requesting user's IP as the k...
def rate_limited(self, key_function=None): if key_function is None: def key_function(*args, **kwargs): data = pickle.dumps((args, sorted(kwargs.items()))) return hashlib.md5(data).hexdigest() def decorator(fn): @wraps(fn) def inner(*ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timed(limit):\n def decorate(func):\n def newfunc(*arg, **kw):\n start = time.time()\n func(*arg, **kw)\n end = time.time()\n if end - start > limit:\n raise TimeExpired(\"Time limit (%s) exceeded\" % limit)\n newfunc = make_decorator(...
[ "0.65584713", "0.65495706", "0.6525419", "0.6494096", "0.6299879", "0.61791515", "0.6172259", "0.61206627", "0.6065372", "0.59967524", "0.5996692", "0.59204817", "0.5900531", "0.58844846", "0.5834017", "0.57783157", "0.5757396", "0.57387686", "0.57096756", "0.56504446", "0.56...
0.7474835
0
Delete the indicated file or directory
def delete(path, recursive=False): fs.delete(path, recursive)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_file(path):\n return files.delete_file(path)", "def delete(self, filename):\n pass", "def delete(self):\n\n try:\n remove(self.file)\n except OSError:\n pass", "def delete_file(path):\n if os.path.isfile(path):\n os.remove(path)...
[ "0.79165214", "0.77798307", "0.7766277", "0.77237564", "0.76830983", "0.76725525", "0.7647804", "0.7647804", "0.7614907", "0.7521688", "0.7468159", "0.74504274", "0.743215", "0.7413891", "0.74093837", "0.7405605", "0.73836875", "0.7336581", "0.7334107", "0.7325344", "0.732099...
0.7445668
12
Return free space on disk, like the UNIX df command Returns
def df(): fs.df()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_free_disk_space():\n cmd = 'df -h'\n p = Popen(cmd, shell=True, stdout=PIPE)\n res = p.communicate()\n if res[0]:\n res = res[0]\n else:\n res = res[1]\n logger.warning('Disk usage statisticks:')\n logger.warning(res)", "def get_space_used():\n fs.get_space_used()", ...
[ "0.83536917", "0.8184584", "0.81557757", "0.8076139", "0.79408926", "0.79404783", "0.78855693", "0.7732318", "0.7624371", "0.76026833", "0.753872", "0.7527869", "0.7521188", "0.74863976", "0.7448919", "0.7448538", "0.7434289", "0.7422073", "0.7413368", "0.7412355", "0.7378212...
0.0
-1
Compute bytes used by all contents under indicated path in file tree
def disk_usage(path): fs.disk_usage(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(path):", "def _disk_usage(path: pathlib.Path):\n if path.is_file():\n return path.stat().st_size\n elif path.is_dir():\n size_bytes = 0\n for file in path.iterdir():\n size_bytes += _disk_usage(file)\n return size_bytes\n else:\n raise NotImplementedError(\"What filetype is {file}...
[ "0.7304568", "0.6749809", "0.66927916", "0.6687458", "0.6680808", "0.6633082", "0.65648973", "0.6540471", "0.6517419", "0.6423607", "0.63529855", "0.6349727", "0.6347756", "0.63181674", "0.62784153", "0.625136", "0.6243889", "0.62026674", "0.61959136", "0.61555153", "0.613638...
0.6480013
9
Returns True if the path is known to the cluster, False if it does not (or there is an RPC error)
def exists(path): fs.exists(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_path(self, hdfs_path):\n c = self.get_conn()\n return bool(c.status(hdfs_path, strict=False))", "def is_managed_path(self, path):\n if self._config is None:\n return False\n fields = path.split(':', 1)\n return len(fields) == 2 and fields[0] in self._co...
[ "0.7158687", "0.68224347", "0.6790576", "0.6722285", "0.65580213", "0.65009516", "0.6497719", "0.6422786", "0.64082927", "0.6384369", "0.63785017", "0.6365407", "0.6360442", "0.6326955", "0.63169855", "0.6286864", "0.62844235", "0.62693346", "0.6265129", "0.62452525", "0.6220...
0.58613884
64
Get reported total capacity of file system Returns
def get_capacity(): fs.get_capacity()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_space_used():\n fs.get_space_used()", "def get_space_used():\n files = jobtracker.query(\"SELECT * FROM files \" \\\n \"WHERE status IN ('added', 'downloaded', 'unverified')\")\n\n total_size = 0\n for file in files:\n total_size += int(file['size'])\n re...
[ "0.7905383", "0.7686586", "0.76265246", "0.7514304", "0.740728", "0.7393012", "0.73364675", "0.73107606", "0.72528416", "0.72520536", "0.71825486", "0.71104777", "0.7035991", "0.70202947", "0.7017264", "0.6983544", "0.6979307", "0.6925965", "0.6920043", "0.6917545", "0.689413...
0.8695405
0
Get space used on file system Returns
def get_space_used(): fs.get_space_used()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSpaceUsage(path):\n st = os.statvfs(path)\n \n flash = { \"free\" : st.f_bavail * st.f_frsize, \"used\":(st.f_blocks - st.f_bfree) * st.f_frsize }\n \n #free = st.f_bavail * st.f_frsize\n #total = st.f_blocks * st.f_frsize\n #used = (st.f_blocks - st.f_bfree) * st.f_frsize\n return f...
[ "0.8161204", "0.7796477", "0.7787275", "0.7772227", "0.7726032", "0.7704461", "0.762351", "0.7598784", "0.7515085", "0.74991655", "0.7485404", "0.7462633", "0.7449219", "0.7406714", "0.73842853", "0.73459834", "0.73239464", "0.72179013", "0.720543", "0.72001547", "0.7185789",...
0.9013167
0
Retrieve directory contents and metadata, if requested.
def ls(path, detail=False): fs.ls(path, detail)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directory(self, directory: str) -> List[Dict]:\n raise NotImplementedError", "def read_directory(self, dirpath):\n raise NotImplementedError", "def getDirectoryMetadata( self, path ):\n res = self.__checkArgumentFormat( path )\n if not res['OK']:\n return res\n urls = res['V...
[ "0.6451851", "0.6447971", "0.6434475", "0.60306376", "0.60244876", "0.6013241", "0.59675", "0.59375036", "0.5927382", "0.58912545", "0.5890785", "0.58385384", "0.5747953", "0.5713665", "0.5681259", "0.5652997", "0.5644693", "0.56401676", "0.5618892", "0.5595484", "0.5586005",...
0.0
-1
Create directory in HDFS
def mkdir(path, **kwargs): fs.mkdir(path, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dfs_mkdir(self, path):\n return self.execute_command(\"hdfs dfs -mkdir \" + path)", "def fs_create_dir(self, path):\n\t\treturn Job(SDK.PrlSrv_FsCreateDir(self.handle, path)[0])", "def fs_mkdir(self, dirname: str) -> None:\n self.exec_(\"import uos\\nuos.mkdir('%s')\" % dirname)", "def mkdi...
[ "0.8143611", "0.76000506", "0.7166708", "0.7083679", "0.7044642", "0.7024804", "0.6985183", "0.6893272", "0.6882638", "0.6849721", "0.67279965", "0.6700775", "0.66672105", "0.66664934", "0.66499156", "0.66083074", "0.6599711", "0.6597963", "0.65964985", "0.65955585", "0.65940...
0.66066265
16
Open HDFS file for reading or writing
def opens(path, mode='rb', buffer_size=None, replication=None, default_block_size=None): fs.open(path, mode, buffer_size, replication, default_block_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_hdfs(self):\n\t\traise NotImplementedError()", "def open (self, path, mode):\r\n pass", "def client():\n return hdfs.connect()", "def hdfs(self, *args, **kwargs):\n return self.hadoop(*args, **kwargs)", "def test_open_read(self, remote_mock_dir):\n\n file_path = posixpath....
[ "0.69550383", "0.6203255", "0.6135038", "0.60283446", "0.59872985", "0.59727913", "0.58762646", "0.585251", "0.58396345", "0.57984585", "0.5775946", "0.5772025", "0.5750017", "0.57352865", "0.5732434", "0.5729949", "0.571854", "0.56686", "0.5661521", "0.56384385", "0.5623737"...
0.6181232
2
Rename file, like UNIX mv command
def rename(path, new_path): fs.rename(path, new_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RenameFile(self, oldname: str, newname: str) -> None:\n ...", "def rename(self, src, dst):\n os.rename(src, dst)", "def rename(oldname, newname):", "def rename_file (self):\n\t\tassert self.__filename, \"Renaming could not complete because the new filename could not be determined, one or mo...
[ "0.7883169", "0.776845", "0.76150286", "0.75697446", "0.7554254", "0.7393611", "0.73767304", "0.73767304", "0.7201459", "0.71401316", "0.70594615", "0.69519454", "0.6929053", "0.6919271", "0.68715525", "0.6865904", "0.68450224", "0.6837736", "0.6837722", "0.67226464", "0.6715...
0.7404169
5
Upload filelike object to HDFS path
def upload(path, stream, buffer_size=None): fs.upload(path, stream, buffer_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_object_as_file(self, ctx):\n req = ctx.req\n\n virtual_path = urllib_parse.unquote(req.path)\n put_location_req = rpc.put_location_request(virtual_path)\n\n request_etag = req.headers.get(\"ETag\", \"\")\n hasher = hashlib.md5()\n wsgi_input = SnoopingInput(req.env...
[ "0.69630384", "0.69315165", "0.68763965", "0.6768473", "0.67281955", "0.6682803", "0.66771275", "0.65934604", "0.6584578", "0.6503615", "0.64935505", "0.64916545", "0.6434837", "0.643003", "0.6352392", "0.6344959", "0.6341716", "0.62886834", "0.6281264", "0.622571", "0.620040...
0.67595905
4
Determine the box grid, the row 'x' and column 'y' are in and return the box grid boundaries (top left, bottom right).
def get_box_grid(x, y): for grid in GRIDS: if x >= grid[0][0] and y >= grid[0][1] and \ x <= grid[1][0] and y <= grid[1][1]: return grid return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(x: Bounds, y: Bounds, grid_spacing: int) -> (Bounds, Bounds):\n # Check if requested grid size is allowable\n if grid_spacing not in Grid._SUPPORTED_SIZES:\n raise RuntimeError(f'Grid spacing should be one of {Grid._SUPPORTED_SIZES} to keep grids of different spacing align...
[ "0.7276697", "0.7249602", "0.7174105", "0.7131322", "0.70830506", "0.69582266", "0.69582236", "0.6817992", "0.6778762", "0.6744852", "0.6739384", "0.6738154", "0.67366695", "0.67229617", "0.6694428", "0.66317385", "0.66051924", "0.6581854", "0.65696084", "0.65642273", "0.6550...
0.82200074
0
Check through the puzzle array in the range delimited by top left (tl) and bottom right (br) for values in 'potential'. Any value found that is in 'potential' is removed so only missing values remain when it is returned.
def rm_pot(potential, puzzle, tl, br): for y in range(tl[1], br[1]+1): for x in range(tl[0], br[0]+1): if puzzle[y][x] in potential: potential.remove(puzzle[y][x]) return potential
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchDeadEnd(self):\n boundaries = []\n if not self.red:\n i = self.midWidth - 1\n else:\n i = self.midWidth + 1\n boudaries = [(i, j) for j in range(self.height)]\n validPositions = []\n for i in boudaries:\n if not (i[0], i[1]) in se...
[ "0.588401", "0.5613431", "0.5605046", "0.5547881", "0.544818", "0.5424087", "0.53872746", "0.5362563", "0.53606844", "0.53606844", "0.53370255", "0.5326348", "0.53133196", "0.5296384", "0.52813685", "0.5255672", "0.52168256", "0.52042156", "0.5199848", "0.51857", "0.51857", ...
0.66826487
0
Cette fonction permet de construire une fusee
def fusee(): #Configuration de la fenetre et de la vitesse d'execution window = Screen() hideturtle() window.setup(600, 600) window.bgcolor("black") pencolor("white") speed("normal") #On va utiliser un dictionnaires pour stocker les positions (simple precaution) positions = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _BRepAlgo.BRepAlgo_Fuse_swiginit(self,_BRepAlgo.new_BRepAlgo_Fuse(*args))", "def falcon():", "def __init__(self, use=True):\n self.use = use", "def __init__():", "def __init__(self, dist ,focalLength,ccdWidth, ccdHeigth):\n self.dist = dist #Distance betwee...
[ "0.64367664", "0.5987766", "0.59837556", "0.5877464", "0.5865099", "0.58392453", "0.5760259", "0.57456326", "0.57456326", "0.57456326", "0.571365", "0.5706213", "0.57004625", "0.5689079", "0.5668011", "0.5656841", "0.5654774", "0.5635367", "0.56317806", "0.5621027", "0.561996...
0.0
-1
assert that calling func(args, kwargs) triggers a DeprecationWarning.
def deprecated_call(func, *args, **kwargs): warningmodule = py.std.warnings l = [] oldwarn_explicit = getattr(warningmodule, 'warn_explicit') def warn_explicit(*args, **kwargs): l.append(args) oldwarn_explicit(*args, **kwargs) oldwarn = getattr(warningmodule, 'warn') def warn(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deprecate_args(self):\n @deprecate(arguments={\"bar\": \"use foo instead\"})\n def foo(a, foo=None, bar=None):\n return 2*a\n\n with warnings.catch_warnings(record=True) as w:\n self.assertEqual(foo(1, bar=True), 2,\n \"Decorated funct...
[ "0.76134264", "0.7457519", "0.69317734", "0.68314976", "0.6774156", "0.67599773", "0.6758293", "0.6725724", "0.67210484", "0.6709473", "0.66816026", "0.6671405", "0.6668715", "0.66650754", "0.65562075", "0.6553829", "0.6536344", "0.6527607", "0.6516987", "0.6516459", "0.64884...
0.7718524
0
Returns all files required by some base files.
def required_files(self, args): args_set = set(args) edge_list = self.__transform_pre(self.__include_deps_supply.get_file_include_deps()) targets = chain((target for (source, target) in edge_list if source in args_set), args_set) return self.__transform_post(targets)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_base_files(self):\n setup_file = path.join(self.PyCogentDirectory, 'setup.py')\n #reqs_file = path.join(self.PyCogentDirectory, 'cogent-requirements.txt')\n #return [(setup_file, 'Python'), (reqs_file, 'Properties')]\n return [(setup_file, 'Python')]", "def gather_required_fi...
[ "0.73063654", "0.67563796", "0.6696825", "0.66219485", "0.6517494", "0.64967936", "0.6473607", "0.6456208", "0.64487964", "0.6447214", "0.6430212", "0.6390996", "0.6387727", "0.6385078", "0.6382932", "0.6338609", "0.6332042", "0.6308531", "0.62689346", "0.6263379", "0.6257691...
0.67471623
2
Processes product data for the system.
def process_product_data(cls, pricing_info): if 'prices' not in pricing_info or 'vat_bands' not in pricing_info: raise PricingException('Json data does not contain required ' 'product and vat band information') product_prices = pricing_info['prices'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_product_infos(self):\n\n # PRODUCT NAME\n try:\n product_name = self.product['product_name'].capitalize()\n except KeyError:\n product_name = None\n\n # PRODUCT CODE\n try:\n product_code = self.product['code'].capitalize()\n e...
[ "0.6721084", "0.6714183", "0.65735006", "0.6500077", "0.6248321", "0.60824895", "0.6079448", "0.6038689", "0.5998337", "0.599525", "0.59744954", "0.5959825", "0.5957547", "0.5954584", "0.5899196", "0.5898683", "0.58757275", "0.5869557", "0.5860635", "0.5835009", "0.5780648", ...
0.6405894
4
Guess the bean name from a WSDL type. Assume the bean name is equal to the type having the first letter capitalized.
def guessbeanname(self): t = self.name return t[0].upper() + t[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_type_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_type_name\")", "def get_type_name(type):\n name = type.name\n if type.is_simple:\n return _get_simple_type_mapping(name)\n elif type.is_enum:\n return _get_simple_type_mapping('str')\n ...
[ "0.6055587", "0.59900916", "0.5906633", "0.5842989", "0.5832207", "0.57966083", "0.5786233", "0.5717361", "0.56284714", "0.56159526", "0.54767513", "0.5473429", "0.5454887", "0.5423297", "0.5414507", "0.5383779", "0.5352961", "0.5352691", "0.5325332", "0.5307059", "0.52658063...
0.6790827
0
Return the names of certain fields in the entity info.
def getfieldnames(self, relType=None): if relType is None: names = [str(f.name) for f in self.info.fields] else: names = [str(f.name) for f in self.info.fields \ if f.relType == relType] return frozenset(names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_names(self):\n ...", "def field_names(self):\n return self.base_field_names() + list(self.data.keys())", "def get_fields(self):\n \n return self.metadata.keys()", "def fields(cls):\n return cls._nameToValue", "def get_field_names(self):\n return {rv[0] fo...
[ "0.77328897", "0.7461978", "0.735866", "0.72412884", "0.72297305", "0.71845204", "0.7180779", "0.7167365", "0.71628743", "0.71035343", "0.7060575", "0.70289564", "0.70243216", "0.7011391", "0.6979408", "0.6976091", "0.6965264", "0.6961422", "0.69358796", "0.69321954", "0.6887...
0.6067711
83
Return the attributes (relType == ATTRIBUTE).
def getattrs(self): # ICAT 4.5.0 also lists the meta attributes as attributes in # the entity info. Need to remove them here, as they should # not be added to InstAttr. return self.getfieldnames('ATTRIBUTE') - Entity.MetaAttr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAttributes(self):\n pass", "def getAttributes(self):\n return self.attributes", "def getAttributes(self):\n return self.attributes", "def GetAttributes(self):\r\n\r\n return self._attr", "def get_attributes(self):\n return self.attributes", "def get_attributes(se...
[ "0.7124617", "0.7084474", "0.7084474", "0.706891", "0.70204544", "0.6988809", "0.6971989", "0.68999547", "0.6874058", "0.6874058", "0.6872412", "0.6830542", "0.68200505", "0.68036985", "0.6800715", "0.673431", "0.6647135", "0.6600955", "0.6600955", "0.6600955", "0.6571482", ...
0.7044305
4
Return the many to one relations (relType == ONE).
def getrelations(self): return self.getfieldnames('ONE')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_related_one2one(self, rel):\n field = rel.field\n if isinstance(field, models.OneToOneField):\n if self._join_allowed(rel.parent_model, rel.model, field):\n return rel", "def relationship(cls):\n return relationship.many_to_one(cls, 'relationship')", "...
[ "0.67867416", "0.6581883", "0.60937566", "0.6083249", "0.6047415", "0.603017", "0.58113414", "0.5705639", "0.55900675", "0.55657053", "0.5440979", "0.54282725", "0.5387697", "0.53740245", "0.5348175", "0.5317037", "0.53037167", "0.5272414", "0.5238443", "0.51848626", "0.51807...
0.7039067
0
Return the one to many relations (relType == MANY).
def getmanyrelations(self): return self.getfieldnames('MANY')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getrelations(self):\n return self.getfieldnames('ONE')", "def relations(self):\n return set(self.triples()[\"relation\"])", "def relationships(self):", "def get_relations(self):\n triples = list(self.get_triples())\n\n for s, p, o in triples:\n if not p.startswith(\...
[ "0.7096476", "0.655924", "0.6366319", "0.61227846", "0.60044825", "0.5877629", "0.58542055", "0.5840653", "0.5739393", "0.5713277", "0.56678456", "0.56351084", "0.56170446", "0.55665904", "0.54818785", "0.5468127", "0.5463287", "0.5452604", "0.54127836", "0.53986883", "0.5376...
0.72177327
0
Check whether the entity is consistent with this entity info. The entity is supposed to be a subclass of Entity. Report any abnormalities as warnings to the logger. Return the number of warnings emitted.
def check(self, entity): nwarn = 0 if entity is None: return nwarn if not issubclass(entity, Entity): raise TypeError("invalid argument %s, expect subclass of Entity" % entity) cname = entity.__name__ beanname = self.beanna...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self):\n\n nwarn = 0\n\n # Check that the set of entity types is the same as in the\n # schema.\n schemanames = set(self.schema.keys())\n clientnames = set(self.client.typemap.keys())\n missing = schemanames - clientnames\n if missing:\n log.war...
[ "0.7488003", "0.59518033", "0.5554449", "0.5366329", "0.5356038", "0.52137417", "0.51991415", "0.5177108", "0.51752853", "0.51362544", "0.5122849", "0.5115364", "0.5110129", "0.5092445", "0.5081767", "0.5057919", "0.50373167", "0.50053465", "0.4978771", "0.49643213", "0.49566...
0.7879822
0
Generate Python source code that matches this entity info.
def pythonsrc(self, baseclass=None): classname = self.classname baseclassname = 'object' classcomment = getattr(self.info, 'classComment', None) beanname = self.beanname addbeanname = True constraint = self.getconstraint() attrs = self.getattrs() rels = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateCode(self):\n print \"Generating code...\"\n for type in self.getObjectTypes():\n generator = __import__(\"codegen.Cpp\" + type, globals(), locals(), [''])\n print \"Generating code for objects of type: %s\" % type\n generator.GenerateCode(self)", "def p...
[ "0.6679202", "0.6412018", "0.63619685", "0.63239324", "0.6240753", "0.61866945", "0.6157373", "0.61450505", "0.6134166", "0.61248934", "0.61220515", "0.6111966", "0.60819286", "0.60318035", "0.60003656", "0.5964006", "0.5953856", "0.59330505", "0.5929046", "0.59027636", "0.59...
0.63368255
3
Return a list of the types defined in the WSDL.
def gettypes(self): return [str(self.sd.xlate(t[0])) for t in self.sd.types]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTypesList():\n return Gw2Spidy._request('types')['results']", "def getTypes(self):\n return self._doRequest(self.httpClient.getTypes)", "def get_types(self):\n return self.types", "def get_all_typedefs(self):\n results = None\n atlas_endpoint = self.endpoint_url + \"...
[ "0.78909266", "0.7311105", "0.6980529", "0.69686353", "0.6921955", "0.67903304", "0.67817074", "0.64911914", "0.6482584", "0.64383173", "0.6416266", "0.6387607", "0.6387607", "0.63486254", "0.63159", "0.62426966", "0.6187318", "0.61764884", "0.6115866", "0.6105615", "0.599553...
0.66607785
7
Search for entities defined at the server. Return a dict with type names as keys and EntityInfo objects as values.
def getentities(self): entities = {} # The following will create lots of errors in suds.client, one # for every type that is not an entity. Disable their logger # temporarily to avoid cluttering the log. sudslog = logging.getLogger('suds.client') sudssav = sudslog.disab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readEntities(self):\r\n entities = {}\r\n \r\n # Regexes must be greedy to prevent matching outer entity and end_entity strings\r\n # Regexes have re.DOTALL to match newlines\r\n for m in re.finditer(\"ENTITY (.*?)END_ENTITY;\", self.data, re.DOTALL):\r\n entity = ...
[ "0.654492", "0.63510257", "0.6295548", "0.61492395", "0.5928663", "0.58731294", "0.581502", "0.580751", "0.579876", "0.5771325", "0.57671726", "0.5759269", "0.57302684", "0.5673989", "0.5636686", "0.55597204", "0.55591005", "0.5551724", "0.55411315", "0.55391514", "0.55371106...
0.7634091
0
Check consistency of the ICAT client with the server schema. Report any abnormalities as warnings to the logger. Returns the number of warnings emitted.
def check(self): nwarn = 0 # Check that the set of entity types is the same as in the # schema. schemanames = set(self.schema.keys()) clientnames = set(self.client.typemap.keys()) missing = schemanames - clientnames if missing: log.warning("missing e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkExceptions(self):\n\n nwarn = 0\n\n icatExceptionType = self.client.factory.create('icatExceptionType')\n schemaexceptions = set(icatExceptionType.__keylist__)\n clientexceptions = set(icat.exception.IcatExceptionTypeMap.keys())\n missing = schemaexceptions - clientexcep...
[ "0.62300956", "0.5898869", "0.5719125", "0.5677171", "0.56404877", "0.5635841", "0.56192327", "0.55733836", "0.5571429", "0.551054", "0.54961216", "0.54919946", "0.54901636", "0.54901636", "0.54901636", "0.54901636", "0.54901636", "0.54901636", "0.54901636", "0.54901636", "0....
0.6281774
0
Check consistency of exceptions. Check that all icatExceptionTypes defined in the WSDL have a corresponding exception class defined in icat.exception. Report missing exceptions as a warning to the logger. Return the number of warnings emitted.
def checkExceptions(self): nwarn = 0 icatExceptionType = self.client.factory.create('icatExceptionType') schemaexceptions = set(icatExceptionType.__keylist__) clientexceptions = set(icat.exception.IcatExceptionTypeMap.keys()) missing = schemaexceptions - clientexceptions ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_error_types(graph: BELGraph) -> typing.Counter[str]:\n return Counter(exc.__class__.__name__ for _, exc, _ in graph.warnings)", "def check(self):\n\n nwarn = 0\n\n # Check that the set of entity types is the same as in the\n # schema.\n schemanames = set(self.schema.keys(...
[ "0.6489571", "0.5932624", "0.57542944", "0.5629398", "0.54877156", "0.53069246", "0.52667695", "0.52545625", "0.51867276", "0.5141248", "0.5109995", "0.5093013", "0.50528795", "0.5051258", "0.50483483", "0.5048305", "0.50454915", "0.5043633", "0.50357765", "0.50357765", "0.50...
0.8771143
0
Set up the genealogy of entity types.
def _genealogy(self, rules): tree = { t:{'level':0, 'base':None} for t in self.schema.keys() } for t in tree: log.debug("checking ancestors of %s ...", t) for r in rules: if re.match(r[0], t): b = r[1] if b == t: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initObjects(self):\n\n print \"DEBUG: Initializing Entities\"\n ObjectType.initializeObjectTypes()", "def entity_type(self, entity_type):\n self._entity_type = entity_type", "def init_elect_types(self):\n self.wta = WinnerTakeAll()\n self.proportional = Proportional()\n ...
[ "0.6412444", "0.5900751", "0.581962", "0.5757027", "0.5749391", "0.57444316", "0.57136536", "0.5633914", "0.55890703", "0.5508194", "0.54837847", "0.5448058", "0.54347545", "0.54028016", "0.53802484", "0.5371926", "0.53686976", "0.5334806", "0.5330833", "0.5330235", "0.532922...
0.0
-1
Generate Python source code matching the ICAT schema. Generate source code for a set of classes that match the entity info found at the server. The source code is returned as a string. The Python classes are created as a hierarchy. It is assumed that there is one abstract base type which is the root of the genealogy tr...
def pythonsrc(self, genealogyrules=None, baseclassname='Entity'): if genealogyrules is None: genealogyrules = [(r'','entityBaseBean')] tree = self._genealogy(genealogyrules) base = [t for t in tree if tree[t]['base'] is None][0] self.schema[base].classname = baseclassname ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pythonsrc(self, baseclass=None):\n\n classname = self.classname\n baseclassname = 'object'\n classcomment = getattr(self.info, 'classComment', None)\n beanname = self.beanname\n addbeanname = True\n constraint = self.getconstraint()\n attrs = self.getattrs()\n ...
[ "0.6546843", "0.6342097", "0.61589974", "0.61360514", "0.58900464", "0.55907094", "0.55879545", "0.5527749", "0.54475427", "0.54270315", "0.540438", "0.53865635", "0.535935", "0.52980083", "0.52552074", "0.5254086", "0.5237905", "0.5225976", "0.5212285", "0.5208125", "0.51882...
0.68348277
0
updates .coveralls.yml file to allow upload of coverage report
def update_coveralls_config( path_to_coverage, coveralls_token, token_key='repo_token', ): try: with open(path_to_coverage, 'r') as cover_fh: raw_file = cover_fh.read() except FileNotFoundError: raw_file = '' # check if repo_token is already in .coveralls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cover(ctx, html=False):\n header(cover.__doc__)\n extra = \"--cov-report html\" if html else \"\"\n with ctx.cd(ROOT):\n ctx.run(\n \"pytest --benchmark-skip --cov flask_restx --cov-report term --cov-report xml {0}\".format(\n extra\n ),\n pty=Tru...
[ "0.57402664", "0.55637956", "0.5521971", "0.5499088", "0.54615265", "0.5441391", "0.54214483", "0.5401124", "0.53201175", "0.51842374", "0.5157459", "0.51465404", "0.5143215", "0.5136255", "0.5116265", "0.5108954", "0.506716", "0.49769455", "0.49514818", "0.49292338", "0.4919...
0.7289181
0
turn multiline config entry into a list of commands
def parse_command_list(config_str): return [command for command in config_str.splitlines() if command]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_changes(cli):\n result = []\n in_config = False\n for line in cli.splitlines():\n if not in_config and line == 'Building configuration...':\n in_config = True\n elif in_config:\n result.append(line)\n\n return '\\n'.join(result)", "def get_commands_list(...
[ "0.64328206", "0.6407235", "0.6104706", "0.6073341", "0.5869535", "0.5853029", "0.57613", "0.5759418", "0.568729", "0.56760406", "0.5661332", "0.56305355", "0.5599522", "0.5569513", "0.55690366", "0.5557906", "0.55198437", "0.54839694", "0.5481613", "0.5474146", "0.5458116", ...
0.7687394
0
atexit handler for deactivating and removing local venv even if tools crash
def atexit_deactivate_venv( venv_name, cwd, logger=p_logging.DEFAULT_LOGGER ): # pragma: no cover logger.info('Cleaning up venv post-test') logger.info('--removing venv') try: rm_log = local['rm']('-rf', path.join(cwd, venv_name)) logger.debug(rm_log) except Exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_cleanup(self):\n pass", "def tear_down(self):\n self.destroy_env()\n self.dut.kill_all()", "def teardown(self):\n self.logger.info('Tearing down file server vm')\n self.local_env.execute('uninstall', task_retries=40,\n task_retry_interval...
[ "0.6747679", "0.6670127", "0.66516036", "0.6634058", "0.6194183", "0.6155125", "0.6096577", "0.6070269", "0.6064456", "0.60605145", "0.6057598", "0.60506946", "0.6045445", "0.6012506", "0.6011123", "0.59959084", "0.598898", "0.5965664", "0.59515667", "0.5941659", "0.59395814"...
0.7242372
0