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
Add common arguments to the given commandline `parser`.
def _add_arguments(parser): parser.add_argument( "command", help='The plugin to run. e.g. "shell".', choices=sorted(registry.get_command_keys()), ) parser.add_argument( "-x", "--maximum-repositories", default=sys.maxsize, type=int, help='If a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add_common_args(parser: argparse.ArgumentParser):\n parser.add_argument(\"--model\", help=\"name of the model to use. Use query --get-models to get a list of valid names.\")\n parser.add_argument(\"--grid-type\", help=\"type of the grid to use.\")\n parser.add_argument(\"--level-type\", help=\"type ...
[ "0.7846328", "0.7687689", "0.75765723", "0.7496589", "0.7450118", "0.73800874", "0.737162", "0.7317518", "0.7310741", "0.7300933", "0.7238756", "0.723621", "0.7189027", "0.7180999", "0.7125901", "0.7097852", "0.70644516", "0.7057616", "0.7057616", "0.7044358", "0.70165956", ...
0.707367
16
Check which help message the user actually wants to print out to the shell. The concept behind this function is a bit weird. Imagine you have 3 calls to ``rez_batch_process`` python m rez_batch_process help python m rez_batch_process run help python m rez_batch_process run shell help The first should print the choices ...
def _process_help(text): text = copy.copy(text) found_index = -1 found_text = "" if "--help" in text: found_index = text.index("--help") found_text = "--help" elif "-h" in text: found_index = text.index("--h") found_text = "-h" if not found_text: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_help_text(self):\n self.shell.completer = None\n description, example = self.shell.generate_help_text('')\n self.assertEqual(description, '')\n self.assertEqual(example, '')\n\n self.shell.completer = TestCompleter()\n description, example = self.shell.ge...
[ "0.65590817", "0.6279931", "0.6265416", "0.6258547", "0.6257743", "0.6243471", "0.61520076", "0.61436427", "0.61064446", "0.60910314", "0.60761446", "0.60735446", "0.6021295", "0.60164595", "0.60079336", "0.59912646", "0.5986868", "0.5982642", "0.59823585", "0.59813535", "0.5...
0.734195
0
Add commands such as "report" and "run" which can detect / run.
def parse_arguments(text): text, needs_subparser_help = _process_help(text) parser = argparse.ArgumentParser( description="Find Rez packages to change using a command." ) parser.add_argument( "-v", "--verbose", action="store_true", help="Print debug messages when...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands():", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def run(self):\n for command in CUSTOM_COMMANDS:\n self.run_custom_command(command)", "def run(self, commands: list[str]):\n ...", "def process_command...
[ "0.7083837", "0.68859935", "0.68859935", "0.68859935", "0.68859935", "0.6656659", "0.65091854", "0.65003496", "0.64056325", "0.6376763", "0.63437176", "0.6323311", "0.62681067", "0.62480503", "0.62328964", "0.62324965", "0.62001026", "0.6195781", "0.61601037", "0.61443716", "...
0.0
-1
Run the main execution of the current script.
def main(text): _register_plugins() arguments, command_arguments = parse_arguments(text) if arguments.verbose: _LOGGER.setLevel(logging.DEBUG) arguments.execute(arguments, command_arguments)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_script(self) -> None:\n main()", "def run_script(self):\n pass", "def run_main():\n main(sys.argv)", "def run():\n main()", "def run():\n\n call_args = sys.argv[1:]\n main(call_args)", "def main():\n run_program()", "def run():\n main(sys.argv[1:])", "def run():...
[ "0.7270303", "0.7117256", "0.69666445", "0.6947555", "0.6931077", "0.6905349", "0.6898379", "0.6898379", "0.6898379", "0.6898379", "0.6898379", "0.6898379", "0.6898379", "0.6898379", "0.6848156", "0.6815355", "0.6814735", "0.68072516", "0.67196566", "0.67164123", "0.6676314",...
0.0
-1
Does any sequence in sequences have a reflection? A reflection is a fourcharacter sequence that is the same backward as forward and consists of two different characters.
def has_reflection(sequences): for sequence in sequences: for i in range(len(sequence) - 3): subseq = sequence[i:i + 4] if (len(Counter(subseq)) == 2) and (subseq == subseq[-1::-1]): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issequence(obj) -> bool:\n return hasattr(type(obj), '__iter__') and hasattr(type(obj), '__len__')", "def is_reflective(self):\n return self._reflective", "def is_sequence(arg):\n return (not hasattr(arg, \"strip\") and\n hasattr(arg, \"__getitem__\") or\n hasattr(arg, \"__it...
[ "0.592695", "0.5832554", "0.5718492", "0.5712738", "0.5561228", "0.55578184", "0.5450076", "0.52724874", "0.5185765", "0.5170214", "0.5164834", "0.51240486", "0.5089455", "0.49864534", "0.498638", "0.4963209", "0.48805374", "0.4781474", "0.47128096", "0.46820468", "0.46809286...
0.7524243
0
Return whether address is compatible with protocol.
def is_compatible(address, protocol=1): bracketed = [word.strip('[]') for word in re.findall('\[[^\]]*\]', address)] not_bracketed = re.split('\[[^\]]*?\]', address) if protocol == 1: if has_reflection(bracketed): return False return has_reflection(not_bracketed)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_support_address(self, addr: int) -> bool:\n return (self.fpb_rev == 2) or (addr < 0x20000000)", "def isProtocolDefined(self) -> bool:\n ...", "def is_ip(address):\n try:\n socket.inet_pton(socket.AF_INET, address)\n except socket.error:\n try:\n socket.inet_...
[ "0.6820964", "0.6668771", "0.66564524", "0.66512966", "0.66328156", "0.64613605", "0.64490527", "0.64391613", "0.64211375", "0.6321145", "0.62663627", "0.6232519", "0.62187594", "0.62100095", "0.6193499", "0.617714", "0.6138549", "0.6138365", "0.6137218", "0.6131304", "0.6118...
0.7616966
0
Return all threecharacter patterns of the form 'aba'.
def extract_protocol_patterns(sequences): patterns = [] for sequence in sequences: length = len(sequence) start, mid, end = (range(length - 2), range(1, length - 1), range(2, length)) for i, j, k in zip(start, mid, end): i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_with_3a(words):\n return [word for word in words if re.match(r'\\w*a{3}\\w*', word)]", "def alpha_chars_pairs (text):\n alpha_text = list (alpha_chars (text))\n return itertools.combinations (alpha_text)", "def letterCombinations(self, digits: str) -> [str]:\n return Combinations(digi...
[ "0.69442785", "0.6035293", "0.5737873", "0.5690029", "0.56879747", "0.5684394", "0.56670874", "0.55950636", "0.55902666", "0.5590083", "0.55318946", "0.551917", "0.55180794", "0.5508772", "0.5430977", "0.54273945", "0.5388487", "0.53611076", "0.5341514", "0.5332907", "0.53190...
0.0
-1
Load a list of addresses from a file.
def load_addresses(): with open('addresses.txt') as f: return [address.strip() for address in f.readlines()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_in_address_file(file):\n address_list = list()\n lines = 0\n valid_ips = 0\n with file as f:\n for n in file:\n lines += 1\n if validate_ip(n.strip()):\n address_list.append(n.strip())\n valid_ips += 1\n if valid_ips < lines:\n ...
[ "0.68453926", "0.66718036", "0.6595332", "0.65375346", "0.65279084", "0.6232124", "0.6221131", "0.6218062", "0.62075657", "0.6184122", "0.61824334", "0.61824334", "0.61778766", "0.61719495", "0.6160394", "0.6155133", "0.61548156", "0.61479515", "0.609529", "0.6087289", "0.608...
0.82936203
0
Method fetches the GPS coordinates for a particular address using the TomTom API
def geo(address): API_PRIVATE = os.environ.get("TOM_TOM_PRIVATE") encoded = urllib.parse.quote(address) query ='https://api.tomtom.com/search/2/geocode/' + str(encoded) + \ '.json?limit=1&countrySet=US&lat=42&lon=-72&topLeft=42.886%2C%20-73.508&btmRight=41.237%2C-69.928&key=' \ + API_P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coords(self, address):\n while True:\n try:\n location = self.geolocator.geocode(address) \n break\n except:\n time.sleep(20)\n\n try:\n latitude = location.latitude\n longitude = location....
[ "0.7102267", "0.7014812", "0.6976603", "0.6896242", "0.68889475", "0.68035966", "0.66808176", "0.66728675", "0.6567192", "0.6561787", "0.6561166", "0.65074974", "0.64575374", "0.6441019", "0.6414824", "0.63909835", "0.6352897", "0.634464", "0.6343922", "0.6325966", "0.6294006...
0.78567797
0
Method returns the address from the GPS coordinates
def reverseGeo(latit, longit): API_PRIVATE = os.environ.get("TOM_TOM_PRIVATE") query = 'https://api.tomtom.com/search/2/reverseGeocode/'+str(latit)+'%2C%20' +str(longit)+\ '.json?returnSpeedLimit=false&heading=0&radius=50&number=0&returnRoadUse=false&key=' + API_PRIVATE response = requests.get(q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address(self):\n return self.address.line[0]+\", \"+self.address.city+\", \"+self.address.state+\", \"+self.address.country", "def get_location(coordinates):\n location_info = gmaps.reverse_geocode(latlng=coordinates)\n location_list = list()\n for location in location_info:\n if \...
[ "0.7354939", "0.71786314", "0.7155313", "0.7139218", "0.70997936", "0.7014094", "0.6998274", "0.6893705", "0.6858712", "0.6855003", "0.6730858", "0.6721745", "0.6721372", "0.67202485", "0.67179745", "0.6692427", "0.665286", "0.6591389", "0.65418506", "0.65276116", "0.6511635"...
0.0
-1
Method fetches stores within a certain distance from a location
def search(latit, longit, dist, num_results): API_PRIVATE = os.environ.get("TOM_TOM_PRIVATE") apiParameters = { 'key': API_PRIVATE, 'typeahead': True, 'limit': num_results, 'ofs': 0, 'countrySet': 'US', 'lat': latit, 'lon': longit, 'radius': dist, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_store(request):\n r = {'result':'-1'}\n \n import httplib, urllib\n\n h = httplib.HTTPConnection(\"api.remix.bestbuy.com\")\n lat = request.POST['lat']\n lon = request.POST['lon']\n distance = request.POST['distance']\n\n h.request('GET', '/v1/stores(area(%s,%s,%s))?format=json&api...
[ "0.6663172", "0.6532991", "0.6180643", "0.6100919", "0.60445905", "0.5973044", "0.5964637", "0.59558463", "0.59354746", "0.5922521", "0.5916111", "0.5910967", "0.58715504", "0.58228385", "0.5778087", "0.5774706", "0.57603323", "0.5740384", "0.5720486", "0.57089466", "0.568057...
0.51591885
88
Search through a course query set for the given query text.
def search_courses(courses, query): return courses.annotate( course_id=Concat('subject', Value(' '), 'course_number', Value(' '), 'section', output_field=CharField()), ).annotate(rank=Case( When( course_id__istartswith=query, then=1 ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query_string):", "def search_courses(self,terms):\n\n return self.course_search.search_for(terms)", "def find_matching_course_indexes(self, query):\r\n return self.course_index.find(query)", "def search(self, query_string):\n terms = query_string.lower().split()\n resul...
[ "0.6957833", "0.6722406", "0.65923154", "0.6582587", "0.65008897", "0.64552164", "0.6410639", "0.6144836", "0.61288846", "0.60934883", "0.6073968", "0.60084444", "0.5999161", "0.5854337", "0.5810443", "0.5810396", "0.5810294", "0.5807406", "0.5799478", "0.5748375", "0.5746335...
0.68331397
1
Filter a course query set based on known filtering parameters.
def filter_courses(courses, params): if 'notFull' in params and params['notFull'] == 'true': courses = courses.filter( Q(enrollment__lt=F('max_enrollment')) | Q(max_enrollment=0) ) if 'distributions' in params: ds = int(params['distributions']) valid = [] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_by_org(self):\n # Create a second course to be filtered out of queries.\n alternate_course = self.create_course(\n org=md5(self.course.org.encode('utf-8')).hexdigest()\n )\n\n assert alternate_course.org != self.course.org\n\n # No filtering.\n u...
[ "0.6403235", "0.6289507", "0.6289507", "0.61878574", "0.6167096", "0.6147818", "0.6120054", "0.6090686", "0.6059228", "0.6019451", "0.5984955", "0.595956", "0.5954526", "0.5939324", "0.5930389", "0.5916537", "0.5906486", "0.58574575", "0.5847235", "0.58464557", "0.5833112", ...
0.69457674
0
Get path to freshclam
def get_freshclam_path(module): try: freshclam_binary = module.get_bin_path('freshclam') if freshclam_binary.endswith('freshclam'): return freshclam_binary except AttributeError: module.fail_json(msg='Error: Could not find path to freshclam binary. Make sure freshclam is inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatpath(cam):\n return os.path.join(BASEPATH, cam + \"_flats\")", "def darkpath(cam):\n return os.path.join(BASEPATH, cam + \"_dark\")", "def get_ocio_path():\n bl_path = os.getcwd()\n version = f'{bpy.app.version[0]}' + '.' + f'{bpy.app.version[1]}'\n cs_folder = os.path.join(bl_path, ver...
[ "0.6257656", "0.6125458", "0.59306973", "0.58662236", "0.5794049", "0.5657319", "0.5657319", "0.5646315", "0.5645382", "0.5630027", "0.5627743", "0.5627743", "0.56236285", "0.5618213", "0.5597625", "0.55891645", "0.5585807", "0.5585807", "0.55688757", "0.55400866", "0.55293",...
0.796606
0
Run freshclam to update ClamAV signatures
def update_freshclam(module, freshclam_binary): rc_code, out, err = module.run_command("%s" % (freshclam_binary)) return rc_code, out, err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n module = AnsibleModule(\n argument_spec=dict(\n update=dict(type='bool', default=True),\n ),\n supports_check_mode=True\n )\n\n update = module.params['update']\n changed = False\n\n # Get path of freshclam\n freshclam = get_freshclam_path(module)\n\n...
[ "0.6522567", "0.5180732", "0.4842134", "0.4842134", "0.4842134", "0.480723", "0.4806568", "0.46753028", "0.46636984", "0.46499807", "0.4631858", "0.45774838", "0.45397392", "0.4516316", "0.45130098", "0.45083612", "0.4504563", "0.44913578", "0.44790775", "0.44666895", "0.4463...
0.5935258
1
Start main program to run freschlam
def main(): module = AnsibleModule( argument_spec=dict( update=dict(type='bool', default=True), ), supports_check_mode=True ) update = module.params['update'] changed = False # Get path of freshclam freshclam = get_freshclam_path(module) # Update ClamAV...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n run_program()", "def run():\n main()", "def main():\n\n fam = FAM()\n\n # show main menu\n fam.show_main_menu()", "def main():\n\n # Fix crackling audio\n util.set_environment('PULSE_LATENCY_MSEC', '60')\n\n # Replace launcher with game exe in proton arguments\n util....
[ "0.75468475", "0.7292671", "0.72066283", "0.71692777", "0.715747", "0.7133834", "0.71303934", "0.70165783", "0.700235", "0.69810116", "0.6920356", "0.6920356", "0.6920356", "0.6920356", "0.6920356", "0.6920356", "0.6920356", "0.6920356", "0.688327", "0.6793555", "0.67762464",...
0.0
-1
Loads the raw state variables.
def _load_state(self, name): # load the list of suction points placement_points = np.loadtxt(os.path.join(name, "placement_points.txt"), ndmin=2) # we just want the current timestep place point placement_points = np.round(placement_points) if self._stateless: placeme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state(self):\n return self.state.read()", "def _load_state(self, state):\n self._array, self._turn, self._score = state", "def load_variables(cls):\n cls._variablesDict = fileops.get_json_dict(cls.get_variables_filepath())", "def load_state(self, dictionary):\n self.log_f...
[ "0.72482204", "0.70144105", "0.6982983", "0.6770665", "0.66737944", "0.65953964", "0.6540361", "0.65036875", "0.64495504", "0.64159304", "0.64075583", "0.64075583", "0.64035577", "0.63863003", "0.63863003", "0.6256578", "0.6249241", "0.6204521", "0.61872864", "0.6140673", "0....
0.59941995
37
Splits a heightmap into a source and target. For placement, we just need the source heightmap.
def _split_heightmap(self, height): half = height.shape[1] // 2 self._half = half height_s = height[:, half:].copy() return height_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regenerate_heightmap(self):\n\n for x in range(16):\n for z in range(16):\n column = x * 16 + z\n for y in range(255, -1, -1):\n if self.get_block((x, y, z)):\n break\n\n self.heightmap[column] = y", "def...
[ "0.5663573", "0.56367624", "0.5591895", "0.55197525", "0.5284474", "0.52686596", "0.5200579", "0.51957935", "0.5177453", "0.51321024", "0.5119517", "0.50274366", "0.49972472", "0.4958767", "0.49391246", "0.49228847", "0.49190336", "0.486945", "0.4841022", "0.48311082", "0.481...
0.66152096
0
Randomly samples negative pixel indices.
def _sample_negative(self, positives): max_val = self._H * self._W num_pos = len(positives) num_neg = int(num_pos * self._sample_ratio) positives = np.round(positives).astype("int") positives = positives[:, :2] positives = np.ravel_multi_index((positives[:, 0], positives[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample_free_negative(self, kit_mask):\n max_val = self._H * self._W\n num_neg = int(100 * self._sample_ratio)\n negative_indices = []\n while len(negative_indices) < num_neg:\n negative_indices.append(np.random.randint(0, max_val))\n negative_indices = np.vstack(n...
[ "0.7825663", "0.7001766", "0.69911414", "0.6830196", "0.6780321", "0.67745644", "0.6610074", "0.65719396", "0.6553887", "0.6516553", "0.65040195", "0.6457263", "0.6457089", "0.64084995", "0.6372672", "0.63520557", "0.63315266", "0.63315266", "0.6311688", "0.6283116", "0.62791...
0.7932355
0
Randomly samples negative pixel indices.
def _sample_free_negative(self, kit_mask): max_val = self._H * self._W num_neg = int(100 * self._sample_ratio) negative_indices = [] while len(negative_indices) < num_neg: negative_indices.append(np.random.randint(0, max_val)) negative_indices = np.vstack(np.unravel_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample_negative(self, positives):\n max_val = self._H * self._W\n num_pos = len(positives)\n num_neg = int(num_pos * self._sample_ratio)\n positives = np.round(positives).astype(\"int\")\n positives = positives[:, :2]\n positives = np.ravel_multi_index((positives[:, 0...
[ "0.79328346", "0.70020574", "0.6991375", "0.6832262", "0.67802733", "0.6776218", "0.6609127", "0.65733886", "0.6555638", "0.6516547", "0.6505941", "0.6458264", "0.6458162", "0.6410023", "0.6369915", "0.63526434", "0.6331508", "0.6331508", "0.6309954", "0.62844604", "0.6281519...
0.7826438
1
Returns a dataloader over the `Placement` dataset.
def get_placement_loader( foldername, dtype="train", batch_size=1, sample_ratio=1.0, shuffle=True, stateless=True, augment=False, background_subtract=None, num_channels=2, radius=2, num_workers=4, use_cuda=True, ): def _collate_fn(batch): """A custom collate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataloader(self):\n shuffle = True if self.mode == \"train\" else False\n return DataLoader(self.get_dataset(), batch_size=self.batch_size, shuffle = shuffle, \n collate_fn=create_mini_batch)", "def dataloader(self):\n return DataLoader", "def get_datalo...
[ "0.6528042", "0.6296754", "0.6117473", "0.5985506", "0.5861961", "0.58134794", "0.576722", "0.5752375", "0.5730256", "0.5723458", "0.5705245", "0.5683443", "0.5645826", "0.55966157", "0.55555403", "0.5552447", "0.5544895", "0.5537698", "0.5531602", "0.552853", "0.5525307", ...
0.6269584
2
A custom collate function. This is to support variable length suction labels.
def _collate_fn(batch): # imgs = [b[0] for b in batch] # labels = [b[1] for b in batch] # imgs = torch.stack(imgs, dim=0) # return [imgs, labels] imgs = [b[0] for b in batch] labels = [b[1] for b in batch] imgs = torch.cat(imgs, dim=0) labels = [l for subl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_collate_fn(data):\n features, labels = zip(*data)\n return pack_sequence(features, enforce_sorted=False), torch.tensor(labels)", "def build_label_transform():\n\n return NALabelEncoder()", "def collate_fn(self, *args):\n return TupleMiniBatch(default_collate(*args))", "def collate_...
[ "0.6760868", "0.6298105", "0.62588686", "0.61754584", "0.594664", "0.59251636", "0.58412385", "0.58352673", "0.58113956", "0.57396", "0.57317317", "0.5664951", "0.5635371", "0.56197876", "0.56163347", "0.5601387", "0.55891913", "0.5588004", "0.5577124", "0.5577124", "0.557365...
0.53312933
27
Add noise to clean wav
def __call__(self, wav): beg_i = 0 end_i = wav.shape[0] sel_noise = self.load_noise(self.sample_noise()) if len(sel_noise) < len(wav): # pad noise P = len(wav) - len(sel_noise) sel_noise = np.pad(sel_noise, (0, P)) # mode='reflect').view(-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self, freq: int, /) -> None:", "def add_noise(self, data):", "def remove_silence_audio() -> None:\n # Read the wav file and get rate and list of data\n rate, data = scipy.io.wavfile.read('Test.wav')\n\n # Create list for data of amended wav file\n data2 = []\n\n # Loop through data of ...
[ "0.7423652", "0.7405924", "0.7366395", "0.69180745", "0.6750727", "0.6699078", "0.66540253", "0.658802", "0.6577528", "0.657021", "0.6549641", "0.6537854", "0.651717", "0.64348406", "0.64318675", "0.6426577", "0.64224035", "0.6406505", "0.6336889", "0.62958145", "0.62921906",...
0.7112348
3
Variable files can have a special get_variables method that returns variables as a mapping.
def get_variables(enclosure_name=None): variables = enclosure_defaults # Get enclosure configuration if enclosure_name is not None: print "enclosure name: %s" % enclosure_name enclosure_configuration = get_enclosure_configuration(enclosure_name) if enclosure_configuration is not Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_variables(file_path, allow_multiple_files=False):\n method_name = \"load_variables\"\n\n if allow_multiple_files:\n paths = file_path.split(CommandLineArgUtil.MODEL_FILES_SEPARATOR)\n else:\n paths = [file_path]\n\n variable_map = {}\n\n for path in paths:\n try:\n ...
[ "0.72306913", "0.7151136", "0.71135825", "0.6780433", "0.6583045", "0.65767616", "0.6560745", "0.6550188", "0.6489009", "0.64451224", "0.64358747", "0.64146364", "0.6391979", "0.63432294", "0.6327937", "0.6281795", "0.6279863", "0.6260892", "0.62577844", "0.62312794", "0.6178...
0.0
-1
Returns Enclosure Manager configuration information from specified enclosure name.
def get_enclosure_configuration(enclosure_name): for name in enclosure_configurations: if enclosure_name == name: return enclosure_configurations[name] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variables(enclosure_name=None):\n variables = enclosure_defaults\n\n # Get enclosure configuration\n if enclosure_name is not None:\n print \"enclosure name: %s\" % enclosure_name\n enclosure_configuration = get_enclosure_configuration(enclosure_name)\n if enclosure_configurat...
[ "0.5719812", "0.56810486", "0.5645006", "0.5638644", "0.563859", "0.5427897", "0.539716", "0.5308325", "0.53053176", "0.52962", "0.526522", "0.5247232", "0.5241141", "0.52331144", "0.52289283", "0.518747", "0.5168693", "0.51547784", "0.51333475", "0.51181686", "0.5108758", ...
0.7809599
0
Get the floating IPv6 address of the active EM by logging into the CI and extracting the lldp data.
def get_enclosure_manager_ip(variables): if 'FUSION_IP' in variables: try: # Connect to the CI Manager. ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(variables['FUSION_IP'], username=va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_main_ipv6():\n try:\n # No data is actually transmitted (UDP)\n s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)\n s.connect( ('2001:4860:4860::8888', 53) )\n real_ip = s.getsockname()[0]\n s.close()\n return real_ip\n except socket.error as e:\n logging.error(\"Cannot retrieve ...
[ "0.6562759", "0.62232167", "0.6131419", "0.60632503", "0.5982587", "0.59368205", "0.58039576", "0.5771897", "0.5748743", "0.5733749", "0.56903505", "0.5683504", "0.56151277", "0.5612566", "0.5604526", "0.5600458", "0.5588906", "0.5587297", "0.5569751", "0.55641264", "0.555214...
0.5635114
12
Takes in a document, returns the individual words (no punctuation) in it
def tokenize(doc): # Calls NLTK function to tokenize the document. Broken into individual words, cleans out punctuation tokens = nltk.word_tokenize(doc) return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(doc):\n splitter = re.compile('\\\\W*')\n # Split the words by non-alpha characters\n words = [s.lower() for s in splitter.split(doc) \n if len(s)>2 and len(s)<20]\n # Return the unique set of words only\n return dict([(w,1) for w in words])", "def tokens(doc):\n return (...
[ "0.7785867", "0.7555599", "0.7534922", "0.75300217", "0.75241643", "0.74158704", "0.7410245", "0.7398779", "0.73895", "0.7206151", "0.71567714", "0.7117067", "0.7102596", "0.7061617", "0.70349526", "0.69996923", "0.6893931", "0.6889518", "0.6820737", "0.67384434", "0.67279804...
0.6920817
16
Takes in tokens, marks them by POS, finds NEs, returns consolidated list of NEs
def chunk(tokens): # Uses NLTK function to pair each token with its Part Of Speech entity_list = [] pos = nltk.pos_tag(tokens) named_entities_chunk = nltk.ne_chunk(pos, binary=True) # Finds named entities in tokens, stores in list of strings for i in range(0, len(named_entities_chunk)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nerspos(tokens, ners):\n pos_list = list()\n for ner in ners:\n pos = get_nerpos(tokens, ner)\n pos_list.append(pos)\n\n return pos_list", "def get_nerpos(tokens, ner):\n\n loc = list()\n for i, token in enumerate(tokens):\n if token == ner:\n loc.append(i)\...
[ "0.6511681", "0.62655246", "0.62197286", "0.61083245", "0.6082513", "0.6082513", "0.5933781", "0.5828468", "0.5822531", "0.57664376", "0.5731313", "0.5682466", "0.56602114", "0.5646151", "0.5586088", "0.55553305", "0.5539988", "0.5534359", "0.55341905", "0.55209655", "0.54587...
0.62955546
1
Takes in a document, returns the named entities in that document
def add_entities(doc): # Calls function to tokenize the document, stores as list of strings tokens = tokenize(doc) # Calls function to find named entities in the tokens, stores as list of strings chunks = chunk(tokens) return chunks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def named_entities(self) -> List[str]:", "def get_entities(doc, clusters):\n ent_clusts = []\n for clust in clusters:\n ent_clust = []\n for (s, e) in clust:\n ent_clust.append(doc[s : e + 1])\n ent_clusts.append(ent_clust)\n return ent_clusts", "def named_entity_list_s...
[ "0.67873853", "0.647988", "0.6388253", "0.6316278", "0.62480557", "0.6205224", "0.6171935", "0.6130217", "0.60650283", "0.60634047", "0.6033262", "0.59924245", "0.5955614", "0.59127384", "0.5888513", "0.58798087", "0.587367", "0.58041203", "0.57902235", "0.57902235", "0.56847...
0.7496968
0
The function 'match' when given a list of words, finds all indices pairs such that the concatenation of the two words is a palindrome.
def match(list_string): assert type(list_string)==list for i in list_string: assert type(i)==str assert i.isalpha() #Loops through all the possible substrings of the list of words to find the word pairs that are palindromes. my_match = [] for i in range(0,len(list_string)): f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromePairs(self, words: List[str]) -> List[List[int]]:\n d = {w : i for i, w in enumerate(words)}\n \n res = []\n for idx, word in enumerate(words):\n for i in range(len(word)+1):\n str1 = word[:i]\n str2 = word[i:]\n # fi...
[ "0.75175416", "0.7488159", "0.6926305", "0.6626271", "0.6542914", "0.63874125", "0.63204014", "0.630162", "0.62365013", "0.622492", "0.611714", "0.6113025", "0.609781", "0.6046568", "0.604634", "0.6016963", "0.6004262", "0.60025907", "0.6000019", "0.59904724", "0.59786916", ...
0.8192264
0
Given a string comprising of opening parentheses, closing parentheses and asterix() where could represent an opening parentheses, closing parentheses or an empty string, the function 'isBalanced()' takes in the string and determines if the string is balanced or not. It returns True if it is Balanced and False otherwise...
def isBalanced(string): assert type(string)==str if any(a not in '(*)' for a in string): raise AssertionError string = list(string) #Converts the inputted list to a string. #Loops through the list, checks for opening and closing parentheses and removes them from the list. k = 0 while T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_balanced_parens(string):\n\n parens = 0\n\n for char in string:\n if char == \"(\":\n parens += 1\n elif char == \")\":\n parens -= 1\n\n if parens < 0:\n return False\n\n return parens == 0", "def balanced_parenths(string):\n balanced = 0...
[ "0.76423204", "0.7475379", "0.7464924", "0.7454584", "0.73763055", "0.7281661", "0.72627336", "0.72251475", "0.7140217", "0.70825875", "0.70499676", "0.6990417", "0.68499714", "0.68152845", "0.680589", "0.65978754", "0.6583618", "0.6527759", "0.6501284", "0.64587474", "0.6430...
0.80695677
0
Initialize your data structure here.
def __init__(self): self.capacity = 10000 self.table = [[] for _ in range(self.capacity)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
value will always be nonnegative.
def put(self, key: int, value: int) -> None: chain, idx = self._search(key) if idx is None: chain.append((key, value)) else: chain[idx] = (key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def must_be_positive_or_zero(cls, value):\n if value < 0:\n raise ValueError('must be positive or zero')\n return value", "def __init__(self, value):\n self.value = max(min(value,1.0),-1.0)", "def __init__(self, value):\n self.value = max(min(value,1.0),-1.0)", "def non...
[ "0.7559364", "0.71699816", "0.71699816", "0.71449524", "0.7086703", "0.6996072", "0.6973722", "0.68763524", "0.68398154", "0.6833531", "0.68270814", "0.67961454", "0.6792929", "0.6737048", "0.6731404", "0.6717127", "0.67094165", "0.6641308", "0.6621965", "0.6614856", "0.66099...
0.0
-1
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: chain, idx = self._search(key) if idx is not None: return chain[idx][1] return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.8002989", "0.7909007", "0.76288855", "0.7565029", "0.7557547", "0.7529507", "0.7525005", "0.74928814", "0.7372854", "0.7294311", "0.72926253", "0.72211987", "0.7216913", "0.718049", "0.7165574", "0.698056", "0.69297296", "0.67844254", "0.67563844", "0.6735803", "0.6611858"...
0.7176771
14
Removes the mapping of the specified value key if this map contains a mapping for the key
def remove(self, key: int) -> None: chain, idx = self._search(key) if idx is not None: chain.pop(idx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, key: int) -> None:\n if key in self.map:\n del self.map[key]", "def delete(self, key):\n self.map.pop(key, None)", "def discard(m: MutableMapping[KT, VT], key: KT) -> None:\n try:\n del m[key]\n except KeyError:\n pass", "def remove(self, key: int...
[ "0.7551893", "0.7535787", "0.7414338", "0.7270902", "0.7270058", "0.7254383", "0.7232726", "0.7205212", "0.7163669", "0.7153222", "0.7056408", "0.7025951", "0.6984242", "0.6890065", "0.6869844", "0.6869084", "0.6857213", "0.68486613", "0.6800672", "0.6768782", "0.66714096", ...
0.0
-1
Reads the complete excel sheet and returns it as a 2D Numpy Array. The alleged Y variable (according to the description) is stored in the last column.
def read_all(return_type = 'np', scaling = 'None', remove_GrLivArea_outliers = True, normal_sales_only = True, feature_subset = 'all'): data = pd.read_csv(basepath + '/Ames_Housing/train.csv') # Postprocessing if remove_GrLivArea_outliers: # See remark in the t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(filename):\n \n # Iterate over all X-values. Y-values are stored in colummns of particular worksheet\n for x in range(0,13):\n\n wb = xlrd.open_workbook(filename)\n ws = wb.sheet_by_index(0)\n\n # This position of metadata doesn't change its relative position from sheet-...
[ "0.7388231", "0.6981574", "0.6880698", "0.68683195", "0.63061714", "0.61602956", "0.6135726", "0.6122789", "0.61113584", "0.5860383", "0.58505625", "0.5845013", "0.57882416", "0.5783295", "0.57558686", "0.57505053", "0.57138175", "0.5706197", "0.56720996", "0.564628", "0.5630...
0.0
-1
add. Add a new flavor
def add(self, flavor): # check if the flavor already exist. # Note: If it does, no LookupError will be raised try: self.get(flavor.flavor_id) except LookupError: pass else: raise ValueError("A flavor with the id '%s' already exists" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_add_flavor(self):\n for flavor_id, flavor in OPENSTACK_FLAVOR.items():\n self.cmd._add_flavor(flavor, flavor_id)\n ralph_flavor = CloudFlavor.objects.get(flavor_id=flavor_id)\n self.assertEqual(ralph_flavor.name, flavor['name'])\n self.assertEqual(r...
[ "0.66554", "0.6539999", "0.64634496", "0.6276409", "0.6224643", "0.6144736", "0.60846186", "0.6082218", "0.59546834", "0.5807027", "0.5702086", "0.56974804", "0.56030923", "0.55301595", "0.55301595", "0.5521269", "0.5513947", "0.5496889", "0.5475897", "0.5458206", "0.5424259"...
0.7390688
0
delete. Delete a flavor.
def delete(self, flavor_id): args = { 'flavor_id': flavor_id } self.session.execute(CQL_DELETE, args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_flavor(self, flavor='del_flvr'):\n try:\n self.novaclient.flavors.delete(\n self.get_flavor_id(flavor))\n except Exception as e:\n print \"Flavor %s failed to delete: %s\" % (flavor, repr(e))", "def delete_flavor(cls, flavor_uuid):\n cls.dbdriv...
[ "0.8474688", "0.790102", "0.7408305", "0.6912675", "0.6432324", "0.63639987", "0.6341171", "0.6192315", "0.61700565", "0.61316884", "0.6116827", "0.61035794", "0.60948354", "0.60634995", "0.5931294", "0.5915984", "0.5905497", "0.58586687", "0.5837155", "0.58345485", "0.583454...
0.769154
2
Make sure you can't delete all the data without forcing it.
def test_validation(self): with self.assertRaises(DeletionError): Band.delete().run_sync() Band.delete(force=True).run_sync()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_data(self):\n pass", "def clean_data():\n redis_db.flushdb()", "def test_data_object_del_all(self):\n pass", "def delete_all(self):\n raise NotImplementedError()", "def force_delete(self):\n self.manager.force_delete(self)", "def force_delete(self):\n se...
[ "0.67689216", "0.6756043", "0.6739888", "0.66517854", "0.6601176", "0.6601176", "0.65898114", "0.65553623", "0.65471154", "0.65161544", "0.65074754", "0.6488821", "0.6467579", "0.64235723", "0.64228135", "0.6413586", "0.640541", "0.6403171", "0.6403171", "0.6403171", "0.64031...
0.63244575
27
Remove unnecessary duplicates from the list of URLs
def remove_duplicate_urls(seq, id_fun=None): if id_fun is None: def id_fun(x): return x seen = {} result = [] for item in seq: marker = id_fun(item) if marker in seen: continue seen[marker] = 1 result.append(item) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_duplicate_urls(urls: list) -> set:\n clean_urls = set()\n for url in urls:\n cleaned_url = url.split(\"&sa=U\")[0]\n clean_urls.add(cleaned_url)\n return clean_urls", "def unique(list_of_links):\n return list(set(list_of_links))", "def removeDuplicateUrl(inputfile, outputf...
[ "0.8338792", "0.7502167", "0.74011534", "0.72646266", "0.6965555", "0.68384427", "0.6683819", "0.66033196", "0.6563067", "0.6533289", "0.64317024", "0.6398783", "0.6371524", "0.6368943", "0.63611966", "0.6360357", "0.63403106", "0.63384825", "0.629922", "0.6251626", "0.624470...
0.7100154
4
Differentiate between classes and ids in the way jQuery does (id, .class)
def class_or_id(selector): if selector[0] == '.': soup_selector = 'class' elif selector[0] == '#': soup_selector = 'id' else: soup_selector = '' return [soup_selector, selector[1:]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_class(self, cls):", "def CSSClasses(self):", "def choose_class(self, *args, **kwargs):", "def has_css_class(self, selector, klass):\n from selenium.webdriver.common.by import By\n\n return (\n self.selenium.find_element(\n By.CSS_SELECTOR,\n ...
[ "0.5969814", "0.5116526", "0.5043086", "0.49965757", "0.49743137", "0.48656708", "0.48378223", "0.4804341", "0.48037136", "0.47905084", "0.47905084", "0.47669527", "0.47648126", "0.46888798", "0.46766043", "0.46766043", "0.46712658", "0.46682423", "0.46682423", "0.46661127", ...
0.66846955
0
This function prints and plots the confusion matrix.
def plot_confusion_matrix(cm, classes, title='Confusion matrix', cmap=plt.cm.Blues): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\"...
[ "0.80913913", "0.8078153", "0.7999024", "0.7947685", "0.7922891", "0.7846677", "0.7834236", "0.77823174", "0.77771777", "0.7758015", "0.77074605", "0.7704409", "0.76958793", "0.768", "0.76602453", "0.7643174", "0.76248074", "0.76126397", "0.76126075", "0.75999814", "0.7589856...
0.0
-1
List records in model
def list(self, tareaID): r = cls.select(cls.q.tareaID == tareaID) return dict(records=r, name=name, tareaID=int(tareaID),namepl=namepl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n return self.objects.all()", "def list(self, request):\n return self._get_filtered_results(request, columns=[])", "def list(self,**kwargs):\n # import pdb;pdb.set_trace()\n g.title = \"{} Record List\".format(g.title)\n \n self.select_recs(**kw...
[ "0.7003149", "0.679678", "0.67469424", "0.67068654", "0.6675257", "0.6652397", "0.65244657", "0.64975744", "0.63210124", "0.62835675", "0.6280251", "0.627428", "0.62576044", "0.6183673", "0.6182447", "0.61749685", "0.6151051", "0.61437804", "0.6106423", "0.6104436", "0.606692...
0.0
-1
Create new records in model
def new(self, tareaID,**kw): form.fields[0].attrs['value'] = tareaID return dict(name=name, namepl=namepl, form=form, values=kw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createRecord(self):\n self.dto.getRecord().append(self.controller.createNewObj())\n print(\"Record added.\")", "def create(self,**extra_fields):\r\n print(extra_fields)\r\n data = self.model(**extra_fields)\r\n data.save(using=self._db)", "def create(self, **kwargs):\n ...
[ "0.7579949", "0.7489215", "0.7366622", "0.72979283", "0.7149944", "0.7137307", "0.7120601", "0.70935357", "0.70247215", "0.69756055", "0.6969858", "0.6969858", "0.6969858", "0.6902731", "0.6900171", "0.6900171", "0.6895643", "0.67392313", "0.67076695", "0.6706795", "0.6692632...
0.0
-1
Save or create record to model
def create(self, **kw): t = TareaFuente.get(kw['tareaID']) orden = kw['orden'] del kw['orden'] del kw['tareaID'] if kw['los_archivos_entrada'].filename: kw['archivos_entrada'] = kw['los_archivos_entrada'].file.read() del kw['los_archivos_entrada'] if k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n if self.id:\n self.update()\n else:\n self.create()", "def save(self, record):\n self.collection.insert(record)\n self.record = record\n\n return self", "def save(self):\n if self.id is None:\n self._insert()\n ...
[ "0.7921299", "0.7158828", "0.71253914", "0.71156526", "0.7053872", "0.70400375", "0.7018748", "0.69996095", "0.69881845", "0.69813716", "0.6950644", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236...
0.0
-1
Edit record in model
def edit(self, id, **kw): r = validate_get(id) r.archivos_guardar = ",".join(r.archivos_a_guardar) return dict(name=name, namepl=namepl, record=r, form=form)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_record(self, record):\r\n self.record.editObject(record, id=record['id'])", "def edit(self):\n\n pass", "def edit_person(self, pk):", "def edit(self, **kwargs):\n ...", "def editRecord(self):\n selectedData = self.controller.chooseRecord(\"Enter the record number: \") -...
[ "0.8572037", "0.7858695", "0.7754658", "0.77518696", "0.75999594", "0.75239253", "0.74553186", "0.73650414", "0.72753733", "0.699284", "0.674907", "0.67028105", "0.67017984", "0.6701272", "0.66436124", "0.65793896", "0.65286726", "0.6519846", "0.6507518", "0.6462808", "0.6461...
0.61108214
54
Save or create record to model
def update(self, id, **kw): orden = kw['orden'] del kw['orden'] del kw['tareaID'] if kw['los_archivos_entrada'].filename: kw['archivos_entrada'] = kw['los_archivos_entrada'].file.read() del kw['los_archivos_entrada'] if kw['los_archivos_a_comparar'].filename: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n if self.id:\n self.update()\n else:\n self.create()", "def save(self, record):\n self.collection.insert(record)\n self.record = record\n\n return self", "def save(self):\n if self.id is None:\n self._insert()\n ...
[ "0.7921299", "0.7158828", "0.71253914", "0.71156526", "0.7053872", "0.70400375", "0.7018748", "0.69996095", "0.69881845", "0.69813716", "0.6950644", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236", "0.6943236...
0.0
-1
Show record in model
def show(self,id, **kw): r = validate_get(id) return dict(name=name, namepl=namepl, record=r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n\n pass", "def record_detail(request, slug, pk):\n # Try except to make sure the user is a member of this project\n try:\n ProjectMember.objects.get(user=request.user, project=Project.objects.get(slug=slug))\n except ObjectDoesNotExist:\n # User is not a member\n ...
[ "0.6654208", "0.6623582", "0.65511125", "0.65330863", "0.65330863", "0.65330863", "0.6506896", "0.6484355", "0.6447105", "0.6341355", "0.626047", "0.62341845", "0.62341845", "0.60806584", "0.6062569", "0.59904456", "0.59904456", "0.59904456", "0.59904456", "0.59904456", "0.59...
0.6396216
9
Destroy record in model
def delete(self, id): r = validate_get(id) tareaID = r.tarea.id r.destroySelf() flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list/%d' % tareaID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_model(self, request, instance):\n pass", "def do_destroy(self, arg):\n obj = self.verify(arg, 2)\n if obj:\n del storage.all()[obj]\n storage.save()", "def model_delete(self, db):\n db.session.delete(self)\n db.session.commit()", "def perfor...
[ "0.7964051", "0.7633398", "0.75807494", "0.7457794", "0.74167144", "0.7346914", "0.7339421", "0.7318597", "0.7249231", "0.7237386", "0.7195176", "0.71799356", "0.7121314", "0.7091678", "0.7052985", "0.70508444", "0.7045779", "0.704239", "0.7032921", "0.70145726", "0.70066327"...
0.0
-1
this function reads the input_file and returs a dictionary in the fallowing format {
def read_input_file(input_file_path): with open(input_file_path, "r") as f: inputData = f.read() lines = inputData.split("\n") elementsDict = {"C": [], "M": [], "T": [], "A": []} for line in lines: lineSplit = line.split("\u200b") elemType = lineSplit[0] if elemType in ["C", "M", "T"]: elemData = lineSpl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_to_dictionary():\n\n return;", "def read(self):\n dictionary = {}\n with open(self.path) as file:\n key_header = \"\"\n for line in file:\n entry = line.strip().split()\n if len(entry) == 0:\n continue\n ...
[ "0.76554203", "0.7585119", "0.7328827", "0.724599", "0.7155301", "0.7071451", "0.6796202", "0.67042035", "0.66150266", "0.6580991", "0.6578905", "0.65427274", "0.6528005", "0.648927", "0.6482334", "0.647334", "0.64695305", "0.64502513", "0.643875", "0.6421674", "0.6398321", ...
0.67370635
7
Convert a boolean to a color value. Used in a binding.
def _bool_to_color(value) -> int: if value is True: return RED return BLACK
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bool_converter(self, bool_var):\n if bool_var == True:\n result = 1\n elif bool_var == False:\n result = 0\n return result", "def boolean(self, state, label=None):\n self.savepos()\n label = self._colorize(label, fg = \"base0\")\n\n msg = (self....
[ "0.6550001", "0.6254398", "0.6227761", "0.61124694", "0.60178113", "0.6006656", "0.5986612", "0.59549403", "0.58936", "0.5892532", "0.5844509", "0.58332866", "0.5804236", "0.5769234", "0.5754589", "0.57381105", "0.5738081", "0.5699414", "0.56867105", "0.5628775", "0.5615144",...
0.83635396
0
Simple integration test for example.
def test_example_runs(self): run_example( verbose=False, testapp=self.testapp, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Demo(self):\n self._run(self._example_scenarios, \"Demo\")", "def test_example(self):\n self.assertEqual(self.example.get_example(), True)", "def test():\n pass", "def test_basic_execution(self):", "def test(self):\n pass", "def unitary_test():", "def setUp(self...
[ "0.75707936", "0.75659436", "0.7493056", "0.7339084", "0.72260743", "0.72219384", "0.7164712", "0.71493244", "0.71493244", "0.71489894", "0.7075676", "0.7047602", "0.7043749", "0.70285046", "0.6992753", "0.6974311", "0.69304705", "0.6910975", "0.6910975", "0.6910975", "0.6910...
0.77079654
0
head, tail = os.path.split(path) return tail or os.path.basename(head)
def path_leaf(path): return re.sub('[^A-Za-z0-9]+', '_', path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pathLeaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)", "def path_leaf(path):\n\thead, tail = ntpath.split(path)\n\treturn tail or ntpath.basename(head)", "def path_leaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)", "def b...
[ "0.8084616", "0.8074502", "0.8041229", "0.78678495", "0.78282255", "0.78110695", "0.7523113", "0.72164637", "0.7181861", "0.7169209", "0.7126973", "0.70769894", "0.68622905", "0.68341327", "0.6810272", "0.67949396", "0.67901784", "0.678849", "0.6783288", "0.67816633", "0.6759...
0.0
-1
Resize image proportionally and return smaller image
def smaller(self): w1, h1 = float(self.imwidth), float(self.imheight) w2, h2 = float(self.__huge_size), float(self.__huge_size) aspect_ratio1 = w1 / h1 aspect_ratio2 = w2 / h2 # it equals to 1.0 if aspect_ratio1 == aspect_ratio2: image = Image.new('RGB', (int(w2), in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(img):\n size = (500, 500)\n img.thumbnail(size)\n return img", "def resize_img(self,scale=1):\n reduced = self.image.reduce((scale,scale))\n reduced.save(\"../edited/{}\".format(self.image.filename))\n\n reduced = Image.open(\"../edited/{}\".format(self.image.filename))\n...
[ "0.7569842", "0.7247945", "0.7185252", "0.7185252", "0.716092", "0.7158779", "0.7128538", "0.70436215", "0.7032408", "0.69969285", "0.69632465", "0.6959521", "0.69531983", "0.69303435", "0.6924912", "0.69141155", "0.69057286", "0.69034487", "0.68982446", "0.68926364", "0.6873...
0.636957
85
Dummy function to redraw figures in the children classes
def redraw_figures(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redraw(event):\n if np.size(plt.get_figlabels()):\n #Need to check if figure is closed or not and only then do the following\n #operations. Else, the following operations will create a new figure\n ax.clear()\n drawRectangle(ax)\n fig.canvas.draw()\n else:\n pas...
[ "0.69585615", "0.68990314", "0.6801519", "0.67597973", "0.6633574", "0.64148325", "0.6317707", "0.6250047", "0.6198424", "0.61798114", "0.61377364", "0.6077331", "0.60669315", "0.60655534", "0.60549927", "0.6053331", "0.60529304", "0.6050833", "0.604263", "0.6037915", "0.6037...
0.78338176
0
Put CanvasImage widget on the parent widget
def grid(self, **kw): self.__imframe.grid(**kw) # place CanvasImage widget on the grid self.__imframe.grid(sticky='nswe') # make frame container sticky self.__imframe.rowconfigure(0, weight=1) # make canvas expandable self.__imframe.columnconfigure(0, weight=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, parent):\n self.widget = QImageView(parent)", "def draw(self, canvas):\n canvas.delete(\"all\")\n width = canvas.winfo_reqwidth()\n height = canvas.winfo_reqheight()\n\n image = ImageTk.PhotoImage(self.image())\n canvas.create_image(width/2, height/2, im...
[ "0.73584396", "0.6960625", "0.66261744", "0.6505108", "0.64840746", "0.6342383", "0.6337893", "0.6254485", "0.6195801", "0.6191953", "0.61800814", "0.61585593", "0.61277044", "0.6115059", "0.60857826", "0.6078125", "0.60671324", "0.60180926", "0.5978611", "0.59671956", "0.596...
0.5976574
19
Scroll canvas horizontally and redraw the image
def __scroll_x(self, *args, **kwargs): self.canvas.xview(*args) # scroll horizontally self.__show_image() # redraw the image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __scroll_x(self, *args, **kwargs):\n self.canvas_image.xview(*args) # scroll horizontally\n self.__show_image() # redraw the image", "def continuous_scroll(self, context):\n\n self.drawing.redraw_canvas(self.dy)\n \n return True", "def refresh(self):\n\n # Delete...
[ "0.78580177", "0.6695677", "0.6625122", "0.66034824", "0.64015204", "0.6336621", "0.62105596", "0.6134658", "0.6117314", "0.6087952", "0.60482293", "0.5974955", "0.59536266", "0.59532565", "0.5856979", "0.58364534", "0.58310264", "0.58037436", "0.5784162", "0.5746283", "0.573...
0.7781856
1
Scroll canvas vertically and redraw the image
def __scroll_y(self, *args, **kwargs): self.canvas.yview(*args) # scroll vertically self.__show_image() # redraw the image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __scroll_y(self, *args, **kwargs):\n self.canvas_image.yview(*args) # scroll vertically\n self.__show_image() # redraw the image", "def refresh(self):\n\n # Delete old image (if needed) \n if self.canvas_image_id:\n self.canvas.delete(self.canvas_image_id)\n if...
[ "0.7920473", "0.70299685", "0.6990068", "0.6820892", "0.6765869", "0.6654134", "0.64846414", "0.6347093", "0.6318105", "0.6262267", "0.62320995", "0.61670595", "0.61647034", "0.6136531", "0.6127709", "0.61248255", "0.6105798", "0.60805285", "0.6061856", "0.6059932", "0.605003...
0.78760535
1
Show image on the Canvas. Implements correct image zoom almost like in Google Maps
def __show_image(self): box_image = self.canvas.coords(self.container) # get image area box_canvas = (self.canvas.canvasx(0), # get visible area of the canvas self.canvas.canvasy(0), self.canvas.canvasx(self.canvas.winfo_width()), self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_image(self):\n if self.image_name is not None:\n img = mpimg.imread(self.image_name)\n extent = (0.5, self.xmax+0.5, -0.5, self.ymax-0.5)\n self.ax.imshow(img, extent=extent, origin='lower',\n alpha=self.image_alpha)", "def showImage(se...
[ "0.67507696", "0.6737647", "0.6699389", "0.6665635", "0.65819067", "0.63922745", "0.6391614", "0.6366368", "0.6336832", "0.6326238", "0.6259202", "0.6224977", "0.6215237", "0.6212369", "0.6197968", "0.6176257", "0.6166282", "0.6113475", "0.6082709", "0.60773355", "0.60769224"...
0.6475404
5
wrapper function for mousebutton release
def __mouse_release(self, event, right_click=False): global choose_rectangle if right_click: return if choose_rectangle: self.__finish_rectangle(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_release(self, x, y, button):\n pass", "def mouse_release_event(self, x: int, y: int, button: int):\n pass", "def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass", "def release():\n gui.mouseUp()", "def ev_mousebuttonup(self, event: MouseButtonUp) -> None:"...
[ "0.8550267", "0.85080427", "0.8371652", "0.7959913", "0.76580673", "0.7642061", "0.7623801", "0.7619377", "0.7613162", "0.7599928", "0.7481668", "0.74567205", "0.74488276", "0.740924", "0.7371951", "0.73562956", "0.7320346", "0.725374", "0.7246893", "0.71940935", "0.7148537",...
0.71970165
19
begin drawing a rectangle when mousebutton is pressed
def __begin_rectangle(self, event): self.start_point_rect = Point2D(self.canvas.canvasx(event.x), self.canvas.canvasy(event.y)) global choose_rectangle if choose_rectangle: self.rectangles.append(self.canvas.create_rectangle(self.start_point_rect.x, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _press(self, event):\n # make the drawn box/line visible get the click-coordinates,\n # button, ...\n if self._interactive and self._selection_artist.get_visible():\n self._set_active_handle(event)\n else:\n self._active_handle = None\n\n if ((self._acti...
[ "0.72806805", "0.69949013", "0.6965726", "0.6957685", "0.69377804", "0.68940526", "0.6857397", "0.68302447", "0.68219036", "0.68137723", "0.6807555", "0.6778434", "0.67169297", "0.6711751", "0.667597", "0.66613656", "0.6624775", "0.6610253", "0.65589386", "0.65369856", "0.651...
0.71212363
1
expand the begun rectangle
def __expand_rectangle(self, event): global choose_rectangle curX = self.canvas.canvasx(event.x) curY = self.canvas.canvasy(event.y) w, h = self.canvas.winfo_width(), self.canvas.winfo_height() if event.x > 0.9 * w: self.canvas.xview_scroll(1, 'units') elif ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.rect = (self.x, self.y, self.width, self.height)", "def update(self):\n self.rect.x += self.change_x\n self.rect.y += self.change_y", "def update(self):\n self.rect.x += self.change_x\n self.rect.y += self.change_y", "def update(self):\r\n se...
[ "0.65636665", "0.632413", "0.632413", "0.6275868", "0.626541", "0.6198104", "0.61374", "0.61107606", "0.6077449", "0.6026812", "0.60264236", "0.60256207", "0.60034686", "0.599594", "0.59890485", "0.5981123", "0.59531474", "0.5931869", "0.59192246", "0.5909494", "0.5909494", ...
0.70743585
0
add some points to a polygon stored as line until finish polygon is called
def __draw_polygon(self, event, klick): global creating_polygon curX = self.canvas.canvasx(event.x) curY = self.canvas.canvasy(event.y) if not klick and len(self.polygon_points) >= 2: c_r_x, c_r_y = self.get_canvas_relative_coords((self.polygon_points[-2], self.polygon_points...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _finish_polygon(self):\n global undo_stack, choose_polygon\n if len(self.polygon_points) < 6:\n messagebox.showinfo(title='Info', message='Too few points for a polygon')\n return 'too_few_points'\n relative_poly_points = []\n for p in range(0, len(self.polygon_...
[ "0.6654041", "0.65504473", "0.63987935", "0.63902766", "0.63872755", "0.6376831", "0.631317", "0.6277058", "0.62526375", "0.6227516", "0.6221252", "0.61530316", "0.6152681", "0.6141955", "0.6117791", "0.6106976", "0.60684395", "0.60385185", "0.6023373", "0.6020817", "0.600721...
0.6825931
0
remove the basicstructure and redraw a actual polygon
def _finish_polygon(self): global undo_stack, choose_polygon if len(self.polygon_points) < 6: messagebox.showinfo(title='Info', message='Too few points for a polygon') return 'too_few_points' relative_poly_points = [] for p in range(0, len(self.polygon_points), 2)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_drawing_poly(self):\n\n self.drawing_poly = QPolygonF()\n self.drawing_points_coords = []\n\n for p in self.drawing_points:\n p.setVisible(False)\n\n for line in self.connecting_line_list:\n line.setVisible(False)\n if self.connecting_line:\n ...
[ "0.73358727", "0.7100318", "0.68646985", "0.65996605", "0.6440847", "0.64096266", "0.6398554", "0.63252187", "0.63171345", "0.6316067", "0.62766445", "0.6156967", "0.6132086", "0.6114123", "0.6112921", "0.6112921", "0.6089977", "0.6041766", "0.6036091", "0.59728026", "0.59728...
0.66933465
3
Checks if the point (x,y) is outside the image area
def outside(self, x, y): bbox = self.canvas.coords(self.container) # get image area if bbox[0] < x < bbox[2] and bbox[1] < y < bbox[3]: return False # point (x,y) is inside the image area else: return True # point (x,y) is outside the image area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outside(self, x, y):\n bbox = self.canvas_image.coords(self.container) # get image area\n if bbox[0] < x < bbox[2] and bbox[1] < y < bbox[3]:\n return False # point (x,y) is inside the image area\n else:\n return True # point (x,y) is outside the image area", "de...
[ "0.8744506", "0.73789674", "0.7371134", "0.7322722", "0.7271759", "0.71677816", "0.712399", "0.70662796", "0.7022934", "0.7015038", "0.69635075", "0.69552475", "0.69520825", "0.6922031", "0.68969744", "0.6880167", "0.68586254", "0.6837809", "0.6799358", "0.67987967", "0.67827...
0.8740559
1
Zoom with mouse wheel
def __wheel(self, event): x = self.canvas.canvasx(event.x) # get coordinates of the event on the canvas y = self.canvas.canvasy(event.y) if self.outside(x, y): return # zoom only inside image area scale = 1.0 # Respond to Linux (event.num) or Windows (event.delta) wheel event ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_mouse_wheel(self, event):\n delta = event.delta[1]\n if delta > 0: # Zoom in\n factor = 0.9\n elif delta < 0: # Zoom out\n factor = 1 / 0.9\n for _ in range(int(abs(delta))):\n self.zoom(factor, event.pos)", "def set_zooming_wheel(self):\n ...
[ "0.85726655", "0.80449104", "0.8004456", "0.7585186", "0.73545897", "0.73259586", "0.7284348", "0.72594196", "0.72263455", "0.72035336", "0.72010034", "0.718997", "0.70950526", "0.70493853", "0.702092", "0.6952343", "0.6904609", "0.6904609", "0.6886205", "0.6867479", "0.68537...
0.7176848
12
Scrolling with the keyboard. Independent from the language of the keyboard, CapsLock, +, etc.
def __keystroke(self, event): if event.state - self.__previous_state == 4: # means that the Control key is pressed pass # do nothing if Control key is pressed else: if event.char in [' ', 'f']: return self.parent_class.finish_polygons_key() self.__pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_key(self, event):\n if event.key() == QtCore.Qt.Key_Up:\n self.model.channel_Scroll_Up('page')\n elif event.key() == QtCore.Qt.Key_PageUp:\n self.model.channel_Scroll_Up('page')\n elif event.key() == QtCore.Qt.Key_Down:\n self.model.channel_Scroll_Down('...
[ "0.6527951", "0.6464333", "0.61489356", "0.6063385", "0.60461384", "0.60447955", "0.5948647", "0.5922068", "0.5914517", "0.5873922", "0.58543026", "0.5772906", "0.5769714", "0.57527506", "0.5698987", "0.5686578", "0.5645206", "0.56375104", "0.5636933", "0.5630431", "0.5626772...
0.5592072
23
Crop rectangle from the image and return it
def crop(self, bbox): if self.__huge: # image is huge and not totally in RAM band = bbox[3] - bbox[1] # width of the tile band self.__tile[1][3] = band # set the tile height self.__tile[2] = self.__offset + self.imwidth * bbox[1] * 3 # set offset of the band s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop(self, image):\n\t\treturn image.copy()[self.ymin:self.ymax,self.xmin:self.xmax]", "def crop_bounding_box(im, x, y, w, h):\n return im[y:y+h, x:x+w]", "def doCrop(image, x, y, w, h):\n\tcrop_height = int((config.FACE_HEIGHT / float(config.FACE_WIDTH)) * w)\n\tmidy = y + h/2\n\ty1 = max(0, midy-c...
[ "0.794316", "0.7912728", "0.79095435", "0.7763151", "0.77613497", "0.7685504", "0.7674794", "0.7651554", "0.76351476", "0.76155263", "0.76091325", "0.7597892", "0.7550879", "0.74946725", "0.74688417", "0.7440861", "0.7434267", "0.7434267", "0.74154586", "0.74154586", "0.73024...
0.6934507
42
Start a docker container and read out its Python version.
def ping_docker(): with Docker('unittest-36', image='python:3.6') as tun: return tun.call(python_version)[:2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _get_python_version(user_image, python_binary) -> packaging.version.Version:\n\n proc = await asyncio.create_subprocess_exec(\n \"docker\",\n \"run\",\n \"--rm\",\n user_image,\n python_binary,\n \"--version\",\n stdout=subprocess.PIPE,\n stderr=...
[ "0.6702616", "0.6522058", "0.6303183", "0.6298336", "0.62177324", "0.6161299", "0.6140888", "0.59771216", "0.59576744", "0.5911534", "0.58886117", "0.5851652", "0.57637846", "0.5735787", "0.56933355", "0.5655075", "0.56307906", "0.5624655", "0.56032175", "0.55927694", "0.5572...
0.6773678
0
Infinite recursion, requiring depth limit to stop.
def recursive(): with Local() as tun: tun.call(recursive)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_depth_limit(self):\n with self.assertRaisesRegexp(\n RemoteException,\n r'.*DepthLimitExceeded: Depth limit of 2 ' +\n 'exceeded at localhost -> localhost -> localhost'):\n recursive()", "def getrecursionlimit(): # real signature unknown; re...
[ "0.67078143", "0.66165847", "0.6310526", "0.6277235", "0.6264654", "0.62610734", "0.62260467", "0.6224823", "0.6135212", "0.607142", "0.606345", "0.60588396", "0.6054196", "0.60538924", "0.6049625", "0.5928221", "0.5916244", "0.5903939", "0.59015894", "0.5863307", "0.5840322"...
0.6727311
0
We can start a subtunnel from within a tunnel.
def test_python_version(self): with Local() as tun: res = tun.call(ping_docker) self.assertEqual( res, [3, 6] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n\n assert SSH_HOST is not None, 'SSH_HOST not set. Please configure.'\n\n\n def connect():\n port = find_open_port(SSH_HOST)\n if init_tunnel(SSH_HOST, port):\n print 'Tunnel initialized, pid:', PID\n return {'ssh tunnel entry': 'ssh://{}:{}'.format(SSH_HOST, p...
[ "0.6110306", "0.5998699", "0.5859723", "0.57514507", "0.5716737", "0.56965566", "0.5687885", "0.5560813", "0.554982", "0.5481662", "0.5474748", "0.54664797", "0.5458131", "0.53530735", "0.5345879", "0.52689457", "0.5253138", "0.5233275", "0.52150315", "0.51958454", "0.5192471...
0.0
-1
Recursive tunneling is limited by a depth limit.
def test_depth_limit(self): with self.assertRaisesRegexp( RemoteException, r'.*DepthLimitExceeded: Depth limit of 2 ' + 'exceeded at localhost -> localhost -> localhost'): recursive()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _loop_depth(self, start, connections):\n # This is just a slightly modified breadth-first search\n visited = {start: 1}\n frontier = [start]\n\n limit = []\n while len(frontier):\n node = frontier.pop(0)\n prev_depth = visited[node]\n if prev_...
[ "0.65145206", "0.6437202", "0.6319541", "0.6313615", "0.6255119", "0.620241", "0.61591923", "0.6117179", "0.6089963", "0.6020909", "0.5939277", "0.5929417", "0.5891039", "0.5885006", "0.56439644", "0.5581242", "0.55780214", "0.55770856", "0.55101794", "0.5502034", "0.55014837...
0.66625166
0
r""" Set, reset or unset attributes of a component for provided arguments.
def set_attr(self, **kwargs): # set specified values for key in kwargs: if key in self.variables: data = self.get_attr(key) if kwargs[key] is None: data.set_attr(is_set=False) try: data.set_attr(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAttr(*args, alteredValue: bool=True, caching: bool=True, capacityHint: int=0,\n channelBox: bool=True, clamp: bool=True, keyable: bool=True, lock: bool=True, size:\n int=0, type: AnyStr=\"\", q=True, query=True, e=True, edit=True,\n **kwargs)->Union[None, Any]:\n pass", ...
[ "0.6659873", "0.64540994", "0.6348945", "0.6348945", "0.6348945", "0.6249304", "0.62207323", "0.61808115", "0.61789376", "0.6144969", "0.6138145", "0.6136499", "0.60521305", "0.59711444", "0.5904123", "0.5897654", "0.5889573", "0.58771515", "0.58758324", "0.5870571", "0.58626...
0.5462349
72
r""" Get the value of a component's attribute.
def get_attr(self, key): if key in self.__dict__: return self.__dict__[key] else: msg = ('Component ' + self.label + ' has no attribute \"' + key + '\".') logger.error(msg) raise KeyError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribute_value(self) -> str:\n return pulumi.get(self, \"attribute_value\")", "def __getattr__(self, attribute):\n ret_val = getattr(self._value, attribute)\n return ret_val", "def getattribute(self, name):\n return self.attributes[name]", "def attribute_value(self):\n ...
[ "0.74563134", "0.74354494", "0.7370588", "0.7359628", "0.7254076", "0.7183806", "0.71574754", "0.71574754", "0.71574754", "0.7138758", "0.7128541", "0.7099436", "0.7083212", "0.70608014", "0.7046827", "0.7021247", "0.70061314", "0.6994601", "0.6945041", "0.6943167", "0.693189...
0.70868886
12
r""" Perform component initialization in network preprocessing.
def preprocess(self, nw, num_eq=0): self.num_nw_fluids = len(nw.fluids) self.nw_fluids = nw.fluids self.always_all_equations = nw.always_all_equations self.num_nw_vars = self.num_nw_fluids + 3 self.it = 0 self.num_eq = 0 self.vars = {} self.num_vars = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initComponent(self):\n\n self.optimizer = self._initOptimizer()\n self.scheduler = self._initScheduler()", "def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss()\n...
[ "0.73592216", "0.7217473", "0.71708953", "0.6822168", "0.66681695", "0.6580221", "0.6578977", "0.65429455", "0.6536772", "0.65033126", "0.6453514", "0.64466166", "0.6424697", "0.64238423", "0.64200073", "0.63732165", "0.6348051", "0.631997", "0.63136613", "0.63092107", "0.630...
0.0
-1
r""" Generic method to access characteristic function parameters.
def get_char_expr(self, param, type='rel', inconn=0, outconn=0): if type == 'rel': if param == 'm': return ( self.inl[inconn].m.val_SI / self.inl[inconn].m.design) elif param == 'm_out': return ( self.outl[outconn].m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):", "def get_params(self):", "def parameters(self):\n #print \"in instrument.parameter()\"\n return self._params", "def __parameters__(self) -> tuple[TypeVar, ...]:\n return super().__getattribute__(\"_parameters\")", "def getParameter(self, name):", "def read_parameters(...
[ "0.638319", "0.63467544", "0.6131503", "0.60618967", "0.6018425", "0.58923507", "0.58653975", "0.58419234", "0.57856905", "0.57763296", "0.5766703", "0.57305014", "0.5712051", "0.57080185", "0.56804574", "0.56773883", "0.56731844", "0.56685215", "0.5663867", "0.56484133", "0....
0.0
-1
r""" Generic method to access characteristic function parameters.
def get_char_expr_doc(self, param, type='rel', inconn=0, outconn=0): if type == 'rel': if param == 'm': return ( r'\frac{\dot{m}_\mathrm{in,' + str(inconn + 1) + r'}}' r'{\dot{m}_\mathrm{in,' + str(inconn + 1) + r',design}}'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):", "def get_params(self):", "def parameters(self):\n #print \"in instrument.parameter()\"\n return self._params", "def __parameters__(self) -> tuple[TypeVar, ...]:\n return super().__getattribute__(\"_parameters\")", "def getParameter(self, name):", "def read_parameters(...
[ "0.63821954", "0.63460344", "0.61296266", "0.60612744", "0.6019171", "0.5890072", "0.5864016", "0.58409107", "0.578442", "0.57746404", "0.57655984", "0.5728951", "0.5711015", "0.5706423", "0.5681548", "0.56765294", "0.5671412", "0.5667351", "0.56624484", "0.56476915", "0.5602...
0.0
-1
Solve equations and calculate partial derivatives of a component.
def solve(self, increment_filter): sum_eq = 0 for constraint in self.constraints.values(): num_eq = constraint['num_eq'] self.residual[sum_eq:sum_eq + num_eq] = constraint['func']() if not constraint['constant_deriv']: constraint['deriv'](increment_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def efSolver2(self):\n dx = self.dh[0] # dx\n dy = self.dh[1] # dy\n dz = self.dh[2] # dz\n \n \"\"\"\n for i in np.arange(0, self.ni):\n for j in np.arange(0, self.nj):\n for k in np.arange(0, self.nk):\n \"\"\"\n\n ##x-component#\n...
[ "0.63676906", "0.6318809", "0.61739284", "0.61720145", "0.60927474", "0.6058577", "0.6052706", "0.5976665", "0.59508836", "0.59151536", "0.590374", "0.59031516", "0.59006107", "0.58917207", "0.58890295", "0.58890295", "0.5881435", "0.5831069", "0.575402", "0.575402", "0.57426...
0.60249364
7
r""" Base method for calculation of the value of the bus function.
def bus_func(self, bus): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bus_func(self, bus):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n val = i[0] * (o[2] - i[2])\n\n return val", "def bus_func(self, bus):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n val = i[0] * (o[2] - i[2])\n\n return val", ...
[ "0.74466026", "0.74466026", "0.73250955", "0.69117403", "0.6853125", "0.6853125", "0.6853125", "0.6842702", "0.67769855", "0.6680553", "0.6620213", "0.6615885", "0.6506827", "0.6495545", "0.6471144", "0.64525867", "0.64162827", "0.634052", "0.6305146", "0.62129354", "0.616710...
0.6996662
3
r""" Base method for LaTeX equation generation of the bus function.
def bus_func_doc(self, bus): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _latex_(self):\n from sage.misc.latex import latex\n if self.parent()._chart.manifold().options.textbook_output:\n return latex(ExpressionNice(self._express))\n else:\n return latex(self._express)", "def _latex_(self):\n from sage.misc.latex import latex\n ...
[ "0.6859866", "0.67537344", "0.66368383", "0.6585811", "0.6494769", "0.642173", "0.64036083", "0.6402349", "0.63059413", "0.6264931", "0.6260173", "0.6228161", "0.6106762", "0.60969347", "0.60949934", "0.60809594", "0.6070735", "0.6070468", "0.6061759", "0.5919542", "0.5900691...
0.0
-1
r""" Base method for partial derivatives of the bus function.
def bus_deriv(self, bus): return np.zeros((1, self.num_i + self.num_o, self.num_nw_vars))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bus_deriv(self, bus):\n deriv = np.zeros((1, 2, self.num_nw_vars))\n f = self.calc_bus_value\n deriv[0, 0, 0] = self.numeric_deriv(f, 'm', 0, bus=bus)\n deriv[0, 0, 2] = self.numeric_deriv(f, 'h', 0, bus=bus)\n deriv[0, 1, 2] = self.numeric_deriv(f, 'h', 1, bus=bus)\n ...
[ "0.69889283", "0.6980462", "0.6693093", "0.660097", "0.6312161", "0.62941307", "0.61552036", "0.6154978", "0.6104887", "0.6049277", "0.6044257", "0.6028678", "0.5986956", "0.5884622", "0.5859759", "0.5845866", "0.58308524", "0.5733738", "0.5729273", "0.56549215", "0.56411767"...
0.66927165
3
r""" Return the busses' characteristic line input expression.
def calc_bus_expr(self, bus): b = bus.comps.loc[self] if np.isnan(b['P_ref']) or b['P_ref'] == 0: return 1 else: comp_val = self.bus_func(b) if b['base'] == 'component': return abs(comp_val / b['P_ref']) else: bus_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_critic_input(self, data):\n return data[1]", "def expression(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"expression\")", "def expression(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"expression\")", "def expression(self) -> pulumi.Input[str]:\n return...
[ "0.55414534", "0.5332202", "0.5332202", "0.5332202", "0.5330955", "0.5330955", "0.5318536", "0.52062017", "0.5186955", "0.51606643", "0.51374507", "0.51354766", "0.50988615", "0.50677305", "0.5063594", "0.5058454", "0.504102", "0.5008465", "0.49748966", "0.49703637", "0.49274...
0.0
-1
r""" Return the busses' efficiency.
def calc_bus_efficiency(self, bus): return bus.comps.loc[self, 'char'].evaluate(self.calc_bus_expr(bus))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(self) -> float:", "def efficiency_cal(self):\n Temp = 0\n for i in self.supplyseries:\n for j in self.demandseries:\n if(self.shortestpathij(i, j) == None):\n continue\n Temp += 1/self.shortestpathij(i, j)\n \n ...
[ "0.7053986", "0.68898183", "0.63519907", "0.63385314", "0.6318781", "0.63130236", "0.627369", "0.62707245", "0.6202245", "0.6139958", "0.6115106", "0.6112748", "0.60495883", "0.60211414", "0.5992771", "0.5992771", "0.5950813", "0.5923411", "0.5913143", "0.58888257", "0.587729...
0.7440501
0
r""" Return the busses' value of the component's energy transfer.
def calc_bus_value(self, bus): b = bus.comps.loc[self] comp_val = self.bus_func(b) expr = self.calc_bus_expr(bus) if b['base'] == 'component': return comp_val * b['char'].evaluate(expr) else: return comp_val / b['char'].evaluate(expr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy(self):\r\n return self._energy", "def energy(self):\n return self.mc.energy(self.chain)", "def energy(self):\n return self._energy", "def get_energy(self):\n return self.momentum*self.momentum/(2*self.mass)", "def E(self):\n return self.generic_getter(get_energ...
[ "0.7103761", "0.6741589", "0.6661972", "0.6645079", "0.65683067", "0.65582204", "0.6549883", "0.6479461", "0.6479461", "0.6452638", "0.6380666", "0.6349827", "0.6336084", "0.6301303", "0.62337786", "0.62261325", "0.62261325", "0.6221748", "0.6215831", "0.62015873", "0.6199199...
0.68374914
1
r""" Return a starting value for pressure and enthalpy at outlet.
def initialise_source(self, c, key): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_pressure(self) -> float: # type: ignore\n ...", "def READ_PRESSURE_SENSOR():\n return 15.246", "def pressure(self):\r\n self._read_temperature()\r\n\r\n # Algorithm from the BME280 driver\r\n # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c\r\...
[ "0.5868105", "0.57068515", "0.56197834", "0.5604052", "0.55942744", "0.55892384", "0.5534466", "0.5500813", "0.54857486", "0.5482551", "0.5470157", "0.5466288", "0.5466257", "0.5457118", "0.54416794", "0.54115534", "0.54091275", "0.5405981", "0.54051214", "0.53974545", "0.539...
0.0
-1
r""" Return a starting value for pressure and enthalpy at inlet.
def initialise_target(self, c, key): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LAT(self):\n # The maximum update amount for these element\n LateralFraction_DELTA = self.dt * (self.LateralFraction_LIMITS[1] -\n self.LateralFraction_LIMITS[0]) / (\n 2.0)\n\n # Add either positive or...
[ "0.61206806", "0.60037404", "0.58854634", "0.5766789", "0.5737171", "0.57287496", "0.5697701", "0.563686", "0.56257325", "0.56166184", "0.56111634", "0.5605827", "0.5603236", "0.55928534", "0.5592787", "0.55920285", "0.5564147", "0.55313486", "0.5528398", "0.5516435", "0.5506...
0.0
-1
r""" Propagate the fluids towards connection's target in recursion.
def propagate_fluid_to_target(self, inconn, start, entry_point=False): if not entry_point and inconn == start: return conn_idx = self.inl.index(inconn) outconn = self.outl[conn_idx] for fluid, x in inconn.fluid.val.items(): if (not outconn.fluid.val_set[fluid] a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def propagate_fluid_to_target(self, inconn, start, entry_point=False):\n return", "def _propagate_step(self):\n\n # optical depth to next interaction\n self.tau = -np.log(self.RNG.rand(self.N_active))\n # optical depth to sphere edge\n self.tau_edge = np.sqrt(self.tau_sphere**2...
[ "0.64130163", "0.55329174", "0.5395205", "0.53396946", "0.5322844", "0.5240561", "0.5212087", "0.5199893", "0.51931745", "0.5155537", "0.51272595", "0.5123761", "0.51091444", "0.51039255", "0.5070662", "0.5069562", "0.505843", "0.50526226", "0.50483257", "0.5047778", "0.50458...
0.58511007
1
r""" Propagate the fluids towards connection's source in recursion.
def propagate_fluid_to_source(self, outconn, start, entry_point=False): if not entry_point and outconn == start: return conn_idx = self.outl.index(outconn) inconn = self.inl[conn_idx] for fluid, x in outconn.fluid.val.items(): if (inconn.fluid.val_set[fluid] is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def propagate_fluid_to_source(self, outconn, start, entry_point=False):\n return", "def propagate_fluid_to_target(self, inconn, start, entry_point=False):\n return", "def propagate_fluid_to_target(self, inconn, start, entry_point=False):\n if not entry_point and inconn == start:\n ...
[ "0.64293945", "0.63272977", "0.59649205", "0.55494595", "0.53208864", "0.5319327", "0.5266767", "0.5224403", "0.5209671", "0.51940536", "0.5158065", "0.51512367", "0.5102777", "0.5099959", "0.5066894", "0.5066894", "0.5066894", "0.5059303", "0.50117844", "0.49763256", "0.4952...
0.58708227
3
r""" Set or unset design values of component parameters.
def set_parameters(self, mode, data): if mode == 'design' or self.local_design: self.new_design = True for key, dc in self.variables.items(): if isinstance(dc, dc_cp): if ((mode == 'offdesign' and not self.local_design) or (mode == 'design...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self):\n for item in self.components.values():\n try:\n item.reset_parameters()\n except:\n pass", "def updateParameters(self, parameters):\r\n #return\r\n parameters[2].enabled = 0\r\n parameters[3].enabled = 0\...
[ "0.702711", "0.6602672", "0.6602672", "0.616704", "0.61542153", "0.6152141", "0.6152141", "0.61476177", "0.61234164", "0.6120168", "0.60706997", "0.5983295", "0.5956423", "0.594708", "0.5910639", "0.5910118", "0.5900919", "0.5882526", "0.5859908", "0.58378756", "0.57734054", ...
0.63311106
3
r"""Check parameter value limits.
def check_parameter_bounds(self): for p in self.variables.keys(): data = self.get_attr(p) if isinstance(data, dc_cp): if data.val > data.max_val + err: msg = ( 'Invalid value for ' + p + ': ' + p + ' = ' + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chkLimits(name, value, Min, Max, unit = 'V', Hex = False):\n\n #global Log\n if not Min < value < Max:\n if Hex:\n line = \"%s:0x%X OUT OF LIMITS (0x%X, 0x%X). Test Failed !\" %(name, value, Min, Max)\n else:\n line = \"%s:%F %s OUT OF LIMITS (%F, %f). Test Failed !\"...
[ "0.72562593", "0.7207735", "0.6949408", "0.6937725", "0.68831706", "0.6846565", "0.68388087", "0.6836606", "0.6768127", "0.6702471", "0.66531205", "0.6622947", "0.6586079", "0.65730226", "0.65702236", "0.65590054", "0.6541621", "0.6513924", "0.64859587", "0.64766264", "0.6450...
0.7210946
1
r"""Entropy balance calculation method.
def entropy_balance(self): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n\n \"\"\"Gets the first neighbours, which are the first 2*r+1 cells.\"\"\"\n current_neighbours = []\n amount = [0] * self.k ** (2 * self.r + 1)\n for i in range(2 * self.r + 1):\n current_neighbours.append(self.config[self.t, i % self.width])\n\n \"\"\"Calculates the rule...
[ "0.6509844", "0.6371908", "0.6213984", "0.6136312", "0.6065171", "0.6035214", "0.5988753", "0.59741235", "0.593793", "0.59257174", "0.5884737", "0.5825986", "0.58200336", "0.5820027", "0.5815513", "0.5708887", "0.5693141", "0.56926143", "0.5690234", "0.56868804", "0.56770515"...
0.7791232
1
r""" Exergy balance calculation method.
def exergy_balance(self, T0): self.E_P = np.nan self.E_F = np.nan self.E_bus = { "chemical": np.nan, "physical": np.nan, "massless": np.nan } self.E_D = np.nan self.epsilon = np.nan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __balance__(self) -> float:\n\n with dataset.connect(database.get_db()) as db:\n # Find last bank transaction.\n statement = statement = f\"\"\"\n SELECT opening_balance, transaction_amount\n FROM bank\n WHERE author_id = {self.user.id}\...
[ "0.6611536", "0.6485161", "0.6480992", "0.62875473", "0.6287387", "0.62516195", "0.6235926", "0.62153035", "0.62097895", "0.6207586", "0.6202252", "0.6169626", "0.6166075", "0.6151702", "0.61431146", "0.6121842", "0.6106136", "0.60940135", "0.60891706", "0.60594755", "0.60576...
0.66281956
0
r""" Calculate the vector of residual values for fluid balance equations. Returns
def fluid_func(self): residual = [] for i in range(self.num_i): for fluid, x in self.inl[0].fluid.val.items(): residual += [x - self.outl[0].fluid.val[fluid]] return residual
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual(self, y,r):\n u,v,tt = self.split(y)\n fiu,fiv,fitt = self.problem.internal_forces(u,v,tt)\n R = np.concatenate((fiu,fiv,fitt))\n R = self.residualApplyBCs(R,y,r)\n return R", "def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory"...
[ "0.74340457", "0.7347378", "0.7319442", "0.7217461", "0.69636905", "0.6963552", "0.6871364", "0.68401945", "0.681984", "0.6801746", "0.672087", "0.6656552", "0.6597367", "0.65881217", "0.65841734", "0.65810835", "0.65665925", "0.65098804", "0.64105034", "0.64079887", "0.63958...
0.7524545
0
r""" Get fluid balance equations in LaTeX format.
def fluid_func_doc(self, label): indices = list(range(1, self.num_i + 1)) if len(indices) > 1: indices = ', '.join(str(idx) for idx in indices) else: indices = str(indices[0]) latex = ( r'0=x_{fl\mathrm{,in,}i}-x_{fl\mathrm{,out,}i}\;' r'\f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _latex_(self):\n p = self._weight_rat.numer()\n q = self._weight_rat.denom()\n old = s = \"\\\\begin{verbatim}\\\\end{verbatim}\"\n new = \"\"\n # s=\"\\\\text{Space of Vector-Valued harmonic weak Maass forms on }\"\n # s+=latex(self.multiplier().group)+\" \\\\text{ of...
[ "0.6390339", "0.61643064", "0.59686494", "0.59008926", "0.5800427", "0.56833917", "0.56500894", "0.5631739", "0.56279516", "0.5623258", "0.56122214", "0.55725545", "0.5540091", "0.54662", "0.5461821", "0.5420831", "0.5405885", "0.53829193", "0.5366576", "0.5364439", "0.535399...
0.49265587
90
r""" Calculate partial derivatives for all fluid balance equations. Returns
def fluid_deriv(self): deriv = np.zeros((self.fluid_constraints['num_eq'], 2 * self.num_i + self.num_vars, self.num_nw_vars)) for i in range(self.num_i): for j in range(self.num_nw_fluids): deriv[i * self.num_nw_fluids + j, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfdm, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n pass", "def get_partial_derivatives(self) -> L...
[ "0.7008659", "0.68837386", "0.67990386", "0.6779742", "0.651725", "0.6399954", "0.6385995", "0.626156", "0.623674", "0.61964655", "0.61451423", "0.61306727", "0.6099219", "0.60581386", "0.6001761", "0.59012693", "0.58673", "0.5847264", "0.58267736", "0.57926023", "0.57854134"...
0.6893844
1
r""" Calculate the residual value for mass flow balance equation. Returns
def mass_flow_func(self): residual = [] for i in range(self.num_i): residual += [self.inl[i].m.val_SI - self.outl[i].m.val_SI] return residual
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residual_edp(self, params):\n data = self.F**2\n model = np.absolute(self._model())**2\n sigma = self.sigma\n return (data[self.mask]-model[self.mask]) / sigma[self.mask] \n \n # The following three lines do not reproduce Sun's results, which proves\n # that the fits were done through...
[ "0.7142771", "0.711344", "0.6858216", "0.6804414", "0.67678005", "0.6669607", "0.6621667", "0.65743244", "0.6516514", "0.64806926", "0.6451823", "0.64506173", "0.6443773", "0.64277303", "0.6395385", "0.637513", "0.6296391", "0.6291521", "0.6279404", "0.6278526", "0.62685186",...
0.6447826
13
r""" Get mass flow equations in LaTeX format.
def mass_flow_func_doc(self, label): indices = list(range(1, self.num_i + 1)) if len(indices) > 1: indices = ', '.join(str(idx) for idx in indices) else: indices = str(indices[0]) latex = ( r'0=\dot{m}_{\mathrm{in,}i}-\dot{m}_{\mathrm{out,}i}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_latex(self,str):\n\n # Characters that need to be escaped for latex:\n escape_re = re.compile(r'(%|_|\\$)',re.MULTILINE)\n # Magic command names as headers:\n cmd_name_re = re.compile(r'^(@.*?):',re.MULTILINE)\n # Magic commands \n cmd_re = re.compile(r'(?P<cmd>...
[ "0.61550564", "0.6111842", "0.60673213", "0.6023438", "0.60037583", "0.60020965", "0.59330696", "0.59254414", "0.5925027", "0.5925027", "0.57846826", "0.5777811", "0.57759964", "0.57490516", "0.57295036", "0.5720124", "0.56587726", "0.56531966", "0.56382304", "0.56171054", "0...
0.57269776
15
r""" Calculate partial derivatives for all mass flow balance equations. Returns
def mass_flow_deriv(self): deriv = np.zeros(( self.num_i, self.num_i + self.num_o + self.num_vars, self.num_nw_vars)) for i in range(self.num_i): deriv[i, i, 0] = 1 for j in range(self.num_o): deriv[j, j + i + 1, 0] = -1 return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfdm, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]", "def get_partial_derivatives(self) -> List[Callable]:\n pass", "def get_partial_derivatives(self) -> L...
[ "0.6914979", "0.6852726", "0.675896", "0.66721344", "0.65446", "0.62188804", "0.62091684", "0.61756337", "0.6168354", "0.6111313", "0.6039505", "0.600849", "0.59814304", "0.5865967", "0.5858942", "0.5858539", "0.57900053", "0.5748033", "0.57478374", "0.5718946", "0.57161343",...
0.6493
5
r""" Equation for pressure equality. Returns
def pressure_equality_func(self): residual = [] for i in range(self.num_i): residual += [self.inl[i].p.val_SI - self.outl[i].p.val_SI] return residual
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pressure_equality_deriv(self):\n deriv = np.zeros((\n self.num_i,\n self.num_i + self.num_o + self.num_vars,\n self.num_nw_vars))\n for i in range(self.num_i):\n deriv[i, i, 1] = 1\n for j in range(self.num_o):\n deriv[j, j + i + 1, 1]...
[ "0.66087", "0.60439175", "0.6018254", "0.59146416", "0.5873855", "0.5870745", "0.5859539", "0.58267796", "0.58157915", "0.5770944", "0.5750991", "0.56742233", "0.56737494", "0.5672614", "0.5670559", "0.56237346", "0.56087416", "0.5586878", "0.5584568", "0.558083", "0.5577955"...
0.6142468
1
r""" Equation for pressure equality.
def pressure_equality_func_doc(self, label): indices = list(range(1, self.num_i + 1)) if len(indices) > 1: indices = ', '.join(str(idx) for idx in indices) else: indices = str(indices[0]) latex = ( r'0=p_{\mathrm{in,}i}-p_{\mathrm{out,}i}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pressure_equality_deriv(self):\n deriv = np.zeros((\n self.num_i,\n self.num_i + self.num_o + self.num_vars,\n self.num_nw_vars))\n for i in range(self.num_i):\n deriv[i, i, 1] = 1\n for j in range(self.num_o):\n deriv[j, j + i + 1, 1]...
[ "0.6440797", "0.60335", "0.5909713", "0.5904858", "0.5901278", "0.58500665", "0.5842524", "0.58402574", "0.58209616", "0.5795475", "0.57685304", "0.576647", "0.5764", "0.57508457", "0.57366455", "0.57271135", "0.5660572", "0.56595135", "0.5640095", "0.56368417", "0.5621451", ...
0.60294664
2