query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Store the value with the given key. Hash collisions should be handled with Linked List Chaining. Implement this.
def put(self, key, value): hi = self.hash_index(key) if self.storage[hi]: current = self.storage[hi] while current.next and current.key != key: current = current.next if current.key == key: current.value = value else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, key, value):\n ha = self.myhash(key)\n if key not in self.hashmap[ha][0]:\n self.hashmap[ha][0].append(key)\n self.hashmap[ha][1].append(value)\n else:\n self.hashmap[ha][1][self.hashmap[ha][0].index(key)] = value", "def put(self, key, value):\n...
[ "0.81106144", "0.80772465", "0.8076398", "0.80682015", "0.8036524", "0.8018422", "0.79838794", "0.7905589", "0.7890816", "0.7876302", "0.78534526", "0.781982", "0.77786344", "0.77710927", "0.77464396", "0.76788867", "0.7675746", "0.7673336", "0.7644221", "0.76339984", "0.7602...
0.8438726
0
Write a program that takes as input a BST and an interger k, and returns the k largest elements in the BST in decreasing order.
def find_k_largest_in_bst_recursively(tree, k): def find_k_largest_in_bst_helper(tree): if tree and len(k_largest_elements) < k: # Smart: Recursion iff we don't have K largest elements collected find_k_largest_in_bst_helper(tree.right) if len(k_largest_elements) < k: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findKthLargest(self, nums: List[int], k: int) -> int:\n return sorted(nums)[-k]", "def _get_k_largest(lst, k):\n sorted_lst = sorted([(val, index) for index, val in enumerate(lst)])\n return list(reversed(sorted_lst[-k:]))", "def kth_largest(arr: list, k: int):\n # Do not search if k is lar...
[ "0.7045558", "0.701398", "0.6677336", "0.6673362", "0.66666937", "0.65226465", "0.65028167", "0.646503", "0.6402724", "0.63980407", "0.6357561", "0.6304622", "0.617777", "0.61401814", "0.6116958", "0.6113665", "0.6077666", "0.60618454", "0.60614383", "0.60428995", "0.60170496...
0.8523908
0
Calculate upper percentile MCP cutoff for avoiding Andor saturation Andor begins saturating at ~5000 for 'signal' value. Set percentile cutoff of incident fluence (mcp) to the percentile where Andor reaches 4000, well before saturation. If that is greater than the 99.9th percentile, set percentile cutoff to 99.9 to eli...
def _calculate_percentile_cutoff(run_numbers): mcp_values = [] andor_values = [] for run_number in run_numbers: current_data_path = ''.join([DATA_PATH, 'run', str(run_number), 'allevts.h5']) f = h5py.File(current_data_path, 'r') current_phot = _get_photon_energy(f, run_number) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_spectrum(input_spectrum, desired_frequency_range):\n channels_ip = []\n for ip in input_spectrum.GetChannels():\n channel_ip = []\n channel_op = []\n for n, i in enumerate(ip):\n if n > desired_frequency_range[0] / input_spectrum.GetResolution() and n < desired_frequen...
[ "0.5653417", "0.5633713", "0.5491142", "0.54786575", "0.54064196", "0.53240645", "0.52246594", "0.52203375", "0.52071315", "0.51993823", "0.5179031", "0.51522595", "0.51460844", "0.51184833", "0.50988865", "0.5083905", "0.5054955", "0.5052072", "0.50464624", "0.50445575", "0....
0.59004277
0
Return a list of actions related to plugin
def get_plugin_actions(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActions():\n return getPlugins(IRenamingAction, plugins)", "def get_actions(self):\n return []", "def get_list_of_actions(self):\n return self.actions", "def actions(self):\n return self._action_list", "def actions(self):\n from moztrap.view.lists.actions import action...
[ "0.8130526", "0.76124007", "0.7425578", "0.73972076", "0.72777", "0.7205521", "0.7205521", "0.7205521", "0.7167486", "0.7161599", "0.7116936", "0.7075639", "0.70122087", "0.68798953", "0.67999965", "0.6772967", "0.6758088", "0.67547417", "0.6751595", "0.6751595", "0.67393315"...
0.8701119
1
Register plugin in Spyder's main window
def register_plugin(self): self.edit_goto.connect(self.main.editor.load) self.redirect_stdio.connect(self.main.redirect_internalshell_stdio) self.main.add_dockwidget(self) unittesting_act = create_action(self, _("Run unit tests"), icon=get_icon('p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_plugin(self):\n self.create_toggle_view_action()\n\n self.main.add_dockwidget(self)", "def test_addplugin(self):\n app = QApplication(sys.argv)\n data = (np.random.rand(30, 31, 32) * 100).astype(np.int)\n data[15:40, 13:20, 10:18] += 50\n se = seededitorqt.Q...
[ "0.69762045", "0.60747755", "0.58828604", "0.5874758", "0.58635104", "0.57819545", "0.5741525", "0.5716186", "0.5689403", "0.56821126", "0.5669613", "0.56537426", "0.55752265", "0.5545013", "0.55267227", "0.55135757", "0.5477841", "0.546501", "0.5450378", "0.54207486", "0.536...
0.65753347
1
Apply configuration file's plugin settings
def apply_plugin_settings(self, options): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_config_file(self):\n self.config_file = self.find_config_file()\n if self.config_file:\n self.apply_config_file(self.config_file)", "def apply_config(filename):\n with open(filename) as config_file:\n config = json.load(config_file)\n for setting, val...
[ "0.67779297", "0.6747643", "0.66346806", "0.6428851", "0.6423092", "0.6381086", "0.63534784", "0.6292545", "0.62646264", "0.6239537", "0.6237905", "0.6227397", "0.6210529", "0.6172642", "0.61720854", "0.6128758", "0.60786307", "0.6069815", "0.60622776", "0.6050749", "0.604386...
0.7636843
0
Used to allow a user to edit their own profile.
def edit_profile(request): user = request.user profile = Profile.objects.for_user(user) if request.method != 'POST': profile_form = ProfileForm(instance=profile) user_form = UserForm(instance=user) else: profile_form = ProfileForm(request.POST, instance=profile) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile(self, name, username, email):\n return self.app.post('/_editProfile', data = dict(\n name = name,\n username = username,\n email = email\n ), follow_redirects = True)", "def edit_user():\n if CURR_USER_KEY in session:\n user = g.user\n...
[ "0.7839375", "0.76361674", "0.75991297", "0.757305", "0.7543597", "0.74999654", "0.7481396", "0.74729866", "0.7393925", "0.73854417", "0.7290376", "0.7259955", "0.7223237", "0.72067004", "0.72060645", "0.7162687", "0.7130685", "0.7072604", "0.7040199", "0.70098627", "0.697346...
0.7651815
1
Return three Keras HDF5Matrix instances for the input, groundtruth density map and groundtruth segmentation mask in a compact TrainingSet
def get_matrices(training_set_path): if os.path.isfile(training_set_path): X = HDF5Matrix(training_set_path, 'input/input') y = HDF5Matrix(training_set_path, 'target/target') y_seg = HDF5Matrix(training_set_path, 'seg_map/seg_map') return X, y, y_seg else: raise Exception...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_to_h5():\n # this took about 10 minutes for set1\n for setname in ['set1', 'set2']:\n filename = os.path.join(ltrc_dirname, '{}.h5'.format(setname))\n f = h5py.File(filename, 'w')\n\n for name in ['train', 'valid', 'test']:\n g = f.create_group(name)\n ...
[ "0.60946685", "0.5913993", "0.58595705", "0.5826413", "0.58137065", "0.5807853", "0.5747172", "0.5703104", "0.5692386", "0.56754106", "0.56699955", "0.56411266", "0.56325924", "0.5626313", "0.56190795", "0.5594807", "0.5573859", "0.55735236", "0.5554242", "0.5549842", "0.5542...
0.63189304
0
Generate outputs from a noncompact TrainingSet to use with Keras' 'fit_generator' function. If 'n_crops' is nonzero, the Iterator crops n_crops 20x20 regions from each image before feeding them.
def flow(self, batch_size=32, output='both', crops=0): while True: for dataset in self.input_sets: X = self.training_set['input/'+dataset] y = self.training_set['target/'+dataset] y_seg = self.training_set['seg_map/'+dataset] for i in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_generator(batches, crop_length):\n while True:\n batch_x, batch_y = next(batches)\n batch_crops = np.zeros((batch_x.shape[0], crop_length, crop_length, 3))\n for i in range(batch_x.shape[0]):\n batch_crops[i] = random_crop(batch_x[i], (crop_length, crop_length))\n ...
[ "0.58771247", "0.57928264", "0.57725567", "0.5747757", "0.5570905", "0.5488688", "0.5483506", "0.5471397", "0.5459297", "0.5440349", "0.54253316", "0.54131067", "0.5412875", "0.54017425", "0.5401398", "0.5400203", "0.53945994", "0.5369897", "0.5358676", "0.53234917", "0.53224...
0.6750257
0
generate upstream cherrypick patch files
def generate_patch_files(sha_list: List[str], start_version: int) -> PatchList: upstream_dir = paths.TOOLCHAIN_LLVM_PATH fetch_upstream_once() result = PatchList() for sha in sha_list: if len(sha) < 40: sha = get_full_sha(upstream_dir, sha) file_path = paths.SCRIPTS_DIR / 'pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_genpatch(self, argv):\n #TODO:\n # - Would an optional [<files> ...] argument be useful or is\n # that overkill? E.g. 'p4 genpatch ./...' (I think that that\n # would be very useful.\n # - Could add '-f' option to only warn on 'out of sync'.\n # - Coul...
[ "0.6193804", "0.61185837", "0.60817057", "0.587971", "0.5735855", "0.57174575", "0.5645524", "0.55588645", "0.5523853", "0.5493776", "0.54873055", "0.5407881", "0.53941137", "0.5388479", "0.5378879", "0.53761584", "0.5310182", "0.52620775", "0.52522963", "0.52342397", "0.5227...
0.6612873
0
Print every package as "ignored".
def _print_ignored(packages): if not packages: print("## No Rez package was set to be ignored") print("No data found") return print("## Every package in this list was explicitly set to ignored by the user") for package, pattern in sorted(packages, key=_get_package_name): p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_missing(packages, verbose):\n if not packages:\n print(\"## No Rez packages were found.\")\n print(\"No data found\")\n\n return\n\n print(\"## Your command affects these Rez packages.\")\n\n template = \"{package.name}\"\n\n if verbose:\n template = \"{package.na...
[ "0.6896404", "0.65300035", "0.64506", "0.6380679", "0.6243997", "0.6215631", "0.6034081", "0.60240585", "0.58716226", "0.5729593", "0.57106125", "0.5704774", "0.56812304", "0.5655815", "0.565425", "0.5575963", "0.5534667", "0.550217", "0.5492941", "0.54724574", "0.547046", ...
0.83495414
0
Print all Rez packages that should be run on.
def _print_missing(packages, verbose): if not packages: print("## No Rez packages were found.") print("No data found") return print("## Your command affects these Rez packages.") template = "{package.name}" if verbose: template = "{package.name}: {path}" for line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_packages(self):\n for tag, pkg in PACKAGES.iteritems():\n print \"{tag} - {label}\".format(tag=tag, label=pkg['label'])", "def _print_ignored(packages):\n if not packages:\n print(\"## No Rez package was set to be ignored\")\n print(\"No data found\")\n\n return...
[ "0.6903446", "0.6681349", "0.64860743", "0.6483986", "0.64436895", "0.63718176", "0.6362368", "0.62700814", "0.62351704", "0.6204767", "0.6189284", "0.61830366", "0.61695254", "0.6160334", "0.6057463", "0.6053403", "0.6039349", "0.5968796", "0.5965892", "0.5961952", "0.595328...
0.7438773
0
Print the Rez packages that were skipped automatically by this tool. Skipped packages differ from "invalid" packages in that they are "valid Rez packages but just don't need the command run on". Ignored packages are Rez packages that the user explicitly said to not process. Skipped packages are packages that the user m...
def _print_skips(skips, verbose): if not skips: print("## No packages were skipped") print("Every found Rez package can be processed by the command.") return print("## Packages were skipped from running a command. Here's the full list:") template = "{issue.package.name}: {issue.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_ignored(packages):\n if not packages:\n print(\"## No Rez package was set to be ignored\")\n print(\"No data found\")\n\n return\n\n print(\"## Every package in this list was explicitly set to ignored by the user\")\n\n for package, pattern in sorted(packages, key=_get_pack...
[ "0.7548334", "0.75025696", "0.6658978", "0.64952445", "0.59089476", "0.58754075", "0.5860346", "0.5699727", "0.5639692", "0.5637996", "0.5636697", "0.5571671", "0.5533277", "0.55121475", "0.54966754", "0.5486724", "0.5446966", "0.54336095", "0.53756714", "0.53676933", "0.5310...
0.80562556
0
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
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
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
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
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 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
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
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
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
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
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
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
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
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
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
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""" 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""" 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"""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""" 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""" 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
Return the list of logged messages. If the bitvector function includes `log_msg` calls in its ``eval``, this method return the list of messages logged in the last evaluation with the format field objects applied. Otherwise, an exception is raised. See also `log_msg`.
def get_formatted_logged_msgs(cls): if cls._logger is None: raise ValueError("eval must be called before get_formatted_logged_msgs") list_msgs = [] for format_string, format_field_objects in cls._logger: list_msgs.append(format_string.format(*format_field_objects)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchLogs(self):\n return [record.msg for record in self.handler.buffer]", "def logged_messages(self):\n return self._logged_messages", "def get_log_messages(self, instance):\n return LogMessageSerializer(instance.log_messages, many=True).data", "def getLogs():\n # in flux, it...
[ "0.6443969", "0.6088012", "0.59338963", "0.5926019", "0.5836273", "0.58012664", "0.5783213", "0.5783213", "0.5766307", "0.5717272", "0.57159305", "0.5616483", "0.55946606", "0.5492802", "0.5484665", "0.5484665", "0.5435299", "0.54241", "0.53707105", "0.5340541", "0.5327934", ...
0.7781618
0
Return the class name and the current number of rounds.
def get_name(cls): return f"{super().get_name()}_{cls.num_rounds}R"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_rounds(self):\n return print(f\"Total Rounds played: {sum([self.wins, self.draws, self.losses])}\")", "def vrepr(cls):\n return f\"{super().vrepr()}.set_num_rounds_and_return({cls.num_rounds})\"", "def count_one_round(self):\n\t\tself.round_count+=1\n\t\treturn self.round_count", "de...
[ "0.6289936", "0.6277111", "0.61140394", "0.59419346", "0.585802", "0.5823698", "0.58067185", "0.57185745", "0.5677853", "0.5667394", "0.56487215", "0.559757", "0.5528206", "0.54875326", "0.5471102", "0.5463627", "0.5463372", "0.5451482", "0.5443987", "0.54125917", "0.54034907...
0.72071
0
Return the `SSA` object of the roundbased bitvector function. This method calls `BvFunction.to_ssa` with the same argument list, and stores the round outputs in the `SSA` object if `add_round_outputs` calls were added in ``eval``.
def to_ssa(cls, input_names, id_prefix, decompose_sec_ops=False, **ssa_options): my_ssa = super().to_ssa(input_names, id_prefix, decompose_sec_ops=decompose_sec_ops, **ssa_options) if cls._rounds_outputs is not None: my_ssa._rounds_outputs = cls._rounds_outputs[:] return my_ssa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bvfunction(self):\n _input_widths = [v.width for v in self.input_vars]\n _output_widths = [v.width for v in self.output_vars]\n\n class MyBvFunction(BvFunction):\n input_widths = _input_widths\n output_widths = _output_widths\n _ssa = self\n\n ...
[ "0.5443392", "0.4841223", "0.48364985", "0.48349917", "0.4701788", "0.4483575", "0.44465578", "0.44207594", "0.4366836", "0.43557042", "0.4316889", "0.43090743", "0.42799342", "0.4275801", "0.42707747", "0.4246866", "0.42396498", "0.41845697", "0.41824216", "0.4165671", "0.41...
0.5147074
1
Set `RoundBasedFunction.num_rounds` and update `input_widths` and ``output_widths`` if necessary.
def set_num_rounds(cls, new_num_rounds): raise NotImplementedError("subclasses need to override this method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_num_rounds_and_return(cls, new_num_rounds):\n cls.set_num_rounds(new_num_rounds)\n return cls", "def roundParameters(self, roundNum):\n ruleName = random.choice(self.state.ruleNames)\n return SupportedRules[ruleName].makeRoundParameters(self, roundNum)", "def _refresh_width(...
[ "0.5804964", "0.5515761", "0.5343894", "0.5200584", "0.5151792", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.49409455", "0.4925701", "0.4892504", "0.48858312", "0.48690236", "0....
0.66365224
0
Call `set_num_rounds` and return ``cls``.
def set_num_rounds_and_return(cls, new_num_rounds): cls.set_num_rounds(new_num_rounds) return cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_num_rounds(cls, new_num_rounds):\n raise NotImplementedError(\"subclasses need to override this method\")", "def vrepr(cls):\n return f\"{super().vrepr()}.set_num_rounds_and_return({cls.num_rounds})\"", "def newRound():\r\n pass", "def rounds(self):\n if self.round_number > 0:...
[ "0.7139906", "0.58930886", "0.5714936", "0.53902805", "0.5324967", "0.52531534", "0.5185726", "0.50927013", "0.4869179", "0.48575476", "0.485736", "0.48567307", "0.4828904", "0.48038808", "0.47967023", "0.4774418", "0.47364053", "0.47306034", "0.47172225", "0.47037777", "0.46...
0.728035
0
Return the list of round outputs obtained in the last evaluation. See also `add_round_outputs`.
def get_rounds_outputs(cls): if cls._rounds_outputs is None: raise ValueError("eval must be called before get_rounds_outputs") return cls._rounds_outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_round_separators(self):\n if getattr(self, \"_rounds_outputs\", None) is None:\n return None\n if len(self._rounds_outputs) == 0:\n return None\n return self._rounds_outputs[:-1]", "def outputs(self):\n return self._outputs if self._outputs else [self.uto...
[ "0.6637656", "0.6438899", "0.62058717", "0.61304086", "0.61035067", "0.6090151", "0.6051942", "0.600966", "0.59717953", "0.59507537", "0.59507537", "0.59088373", "0.59074545", "0.5906354", "0.5867009", "0.57934654", "0.57923913", "0.5694699", "0.5679354", "0.5678499", "0.5628...
0.77957076
0
Check whether the last assignments are SSAReturn of the output variables.
def _are_last_assignments_valid(assignments, output_vars, ignore_exception=True): assert isinstance(assignments, collections.OrderedDict) if len(assignments) == 0: return False last_assignments = [] for assign_outvar in reversed(assignments): last_assignments.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_return(\n ret_type: None | IntType | ReferenceType, returned: Sequence[BitString]\n) -> None:\n if len(returned) > 1:\n raise ValueError(\"code block returns multiple values\")\n\n if ret_type is None:\n if len(returned) != 0:\n raise ValueError(\n 'funct...
[ "0.5993794", "0.5920944", "0.5595559", "0.5568826", "0.55436", "0.54635245", "0.5395138", "0.5378417", "0.53685534", "0.5290771", "0.52233475", "0.5216341", "0.5209409", "0.5198429", "0.5192773", "0.51814836", "0.5171536", "0.51640624", "0.51598394", "0.5133761", "0.51216966"...
0.751274
0
Return an executable string representation. This method returns a string so that ``eval(self.vrepr())`` returns a new `SSA` object with the same content. >>> from cascada.bitvector.core import Variable >>> from cascada.bitvector.operation import BvXor, BvIdentity >>> from cascada.bitvector.ssa import BvFunction >>> z =...
def vrepr(self): return "{}(input_vars={}, output_vars={}, assignments={}{})".format( type(self).__name__, f"[{', '.join([v.vrepr() for v in self.input_vars])}]", f"[{', '.join([v.vrepr() for v in self.output_vars])}]", f"[{', '.join([f'({v.vrepr()}, {e.vrepr()})'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_(self):\n s = 'An equation '\n have_A = not self.A().is_zero()\n if have_A:\n s += repr(self.A()) + ' x '\n if self.b()>=0:\n if have_A:\n s += '+'\n else:\n s += '-'\n if have_A:\n s += ' '\n s +=...
[ "0.61188376", "0.61188376", "0.60854304", "0.6069777", "0.6012829", "0.5928467", "0.5817199", "0.58145636", "0.5814443", "0.5811863", "0.57879734", "0.5767751", "0.57263815", "0.5706116", "0.5697784", "0.5687782", "0.5685565", "0.56687975", "0.5661975", "0.56314254", "0.56243...
0.6500199
0
Return two strings (header and body) of a C function evalauting the SSA. This method returns two strings (the function header and the function body) of a function in the C programming language that computes the SSA. The C function is of ``void`` type and its list of arguments consists of the input variables, the extern...
def get_C_code(self, C_function_name): from cascada.bitvector.printing import BvCCodePrinter width2type = BvCCodePrinter._width2C_type # in C, * binds to the declarator, not the type specifier input_vars_c = ', '.join(["{} {}".format(width2type(v.width), v.name) for v in self.input_var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_func_body(func_name, arg_dict, return_type):\n body = \"\"\n arg_list = \"\"\n\n # the following are pointers to scalar outputs\n # Note: pBufferSize was renamed pBufferSizeInBytes in v6.5\n scalar_ptr_outputs = ['nnzTotalDevHostPtr',\n 'pBufferSize',\n ...
[ "0.6069087", "0.5914765", "0.57788587", "0.562777", "0.56116414", "0.56074697", "0.56074697", "0.5592773", "0.5562327", "0.55166125", "0.5506797", "0.5430662", "0.53873694", "0.5343953", "0.5333583", "0.5295312", "0.5277339", "0.527095", "0.5228903", "0.522377", "0.51906025",...
0.67547506
0
Return a `BvFunction` that evaluates ``self``. The returned `BvFunction` stores ``self`` in the ``_ssa`` attribute. Moreover, the method `BvFunction.to_ssa` of the returned `BvFunction` raises an exception unless it is called with the same arguments that were used to create ``_ssa`` (in this case ``_ssa`` is returned)....
def to_bvfunction(self): _input_widths = [v.width for v in self.input_vars] _output_widths = [v.width for v in self.output_vars] class MyBvFunction(BvFunction): input_widths = _input_widths output_widths = _output_widths _ssa = self @classmethod ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_function(self):\n return SSAFunction(self.get_graph())", "def get_ssa(self, name='main'):\n\n ssa = NetworkEnsemble()\n ssa.add_function(name, self.get_function())\n return ssa", "def Avv_func(f):\n\n def Avv(x, v):\n def F(s):\n return f(x + v * s)\n\n ...
[ "0.6440057", "0.57623315", "0.54604423", "0.52078617", "0.50013286", "0.47485492", "0.46421528", "0.46381408", "0.46227366", "0.46155635", "0.46057883", "0.4594721", "0.4532908", "0.45137742", "0.45113122", "0.45107594", "0.45080462", "0.45050156", "0.44994885", "0.4497978", ...
0.75143814
0
Split into multiple `SSA` objects given the list of variable separators.
def split(self, var_separators): assert len(var_separators) >= 1 _listify = lambda s: list(s) if isinstance(s, collections.abc.Sequence) else [s] input_vars_set = set(self.input_vars) external_vars_set = set(self.external_vars) # remove input and external vars from var_separat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_split(text, seps):\n if not seps: # split by whitespaces\n return text.split()\n else: # split by separators in `seps`\n\n ##### Topics on Stack Overflow\n # http://stackoverflow.com/questions/1059559/python-strings-split-with-multiple-separators\n\n ## Method 1: use `re...
[ "0.58263", "0.5815856", "0.57184464", "0.5663677", "0.5640506", "0.5351031", "0.53371066", "0.530127", "0.52853507", "0.526529", "0.5252852", "0.52451015", "0.52377874", "0.5202907", "0.52014166", "0.5190723", "0.5180124", "0.5155712", "0.51366144", "0.51366144", "0.51365817"...
0.623241
0
Return the round separators if the SSA was obtained from a `RoundBasedFunction`. If the `SSA` object was obtained from `RoundBasedFunction.to_ssa` of a `RoundBasedFunction` including `add_round_outputs` calls in its ``eval``, this method returns a list with the round outputs delimiting the rounds. Otherwise, ``None`` i...
def get_round_separators(self): if getattr(self, "_rounds_outputs", None) is None: return None if len(self._rounds_outputs) == 0: return None return self._rounds_outputs[:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rounds(self) -> List[Round]:\n return self._rounds", "def get_rounds_outputs(cls):\n if cls._rounds_outputs is None:\n raise ValueError(\"eval must be called before get_rounds_outputs\")\n return cls._rounds_outputs", "def roundParameters(self, roundNum):\n ruleName =...
[ "0.5567383", "0.5464221", "0.5120953", "0.511039", "0.5052884", "0.48159716", "0.46500137", "0.46258867", "0.45040205", "0.44882062", "0.4462644", "0.4399613", "0.43700054", "0.43601322", "0.43520933", "0.42661065", "0.42626894", "0.4245764", "0.42430812", "0.42364082", "0.42...
0.6987893
0
Compile a C function given its C code as two strings (function header and body).
def _compile_C_code(header, body, return_unloaded=False, verbose=False): import importlib import tempfile import uuid import cffi module_name = "module_" + uuid.uuid4().hex if "__uint128" in header: raise ValueError("_compile_C_code does not support bit-vector widths " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compile(self, filename, source):\n \n if source and source[-1] != '\\n':\n source = source + '\\n'\n code = __builtin__.compile(source, filename.cStr(), 'exec')\n\n # try to cache the compiled code\n pycFilename = Filename(filename)\n pycFilename.setExtensi...
[ "0.7229262", "0.6958879", "0.68127483", "0.663641", "0.6623606", "0.6555563", "0.6529795", "0.63210225", "0.6301976", "0.6199189", "0.61737925", "0.61382604", "0.60743004", "0.60626096", "0.6054126", "0.60315853", "0.60043836", "0.59953725", "0.59876066", "0.59520745", "0.592...
0.71571857
1
returns progress as a number between 0 and 100
def progress(self): return self.progressValue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(self) -> int:\n return int(round(100 * self.somme() / self.finances))", "def percentage_progress(self):\n\n if self.total_progress != 0:\n return float(self.progress) / self.total_progress\n return self.progress", "def percentage_progress(self):\n\n if self.t...
[ "0.79426646", "0.7889467", "0.7889467", "0.7813299", "0.7813299", "0.7813299", "0.7813299", "0.7616806", "0.755221", "0.74852914", "0.74636984", "0.73992074", "0.7360572", "0.73133385", "0.7295597", "0.726702", "0.7258826", "0.71958226", "0.71958226", "0.71958226", "0.7195822...
0.79399526
1
Parse a file from Dunbrack's PICSE server. This will iterate all lines in the file and extract the list of proteins that match the resolution criteria.
def parse_file(self, path, max_resolution, threshold, proteins={}): """ create regex pattern here so it is not done repeatedly while parsing file groups: 0 - Protein ID 1 - Chain ID 2 - Length of protein chain 3 - Exptl. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_protenn_matches(file: str):\n with open(file, \"rt\") as fh:\n for line in fh:\n sequence_id, pfam_acc, start, end = line.rstrip().split(\"\\t\")\n if re.fullmatch(r\"PF\\d+\", pfam_acc):\n yield sequence_id, pfam_acc, int(start), int(end)", "def read(read_...
[ "0.5723123", "0.5713342", "0.56971914", "0.5693488", "0.5667087", "0.56034213", "0.5589402", "0.5556643", "0.55423754", "0.55163777", "0.54881227", "0.5454614", "0.5442599", "0.5424246", "0.542282", "0.5417614", "0.5411043", "0.5402362", "0.539387", "0.53841794", "0.5367232",...
0.5888745
0
Create an instance by evaluating all constraints in the problem. The ``problem`` is a DnaChisel DnaOptimizationProblem.
def from_problem(problem, autopass_constraints=True): def evaluate(constraint): if ( autopass_constraints and constraint.enforced_by_nucleotide_restrictions ): return SpecEvaluation( constraint, prob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase_I_problem_from(cls, problem: LinearConstraintsProblem) -> LinearProblem:\n n = problem.n\n m = len(problem.constraints)\n\n e_x = np.zeros(shape=n)\n e_z = np.ones(shape=m)\n e = np.concatenate((e_x, e_z))\n\n x0 = np.zeros(n)\n # we dont need to look at s...
[ "0.6295126", "0.60471386", "0.5886922", "0.5765422", "0.5730006", "0.5707503", "0.565367", "0.5576092", "0.5528963", "0.54968774", "0.5491965", "0.54807454", "0.5393297", "0.53774476", "0.53702635", "0.5276206", "0.52658254", "0.5262188", "0.5253071", "0.5241584", "0.52301854...
0.6974452
0
Return color 60f979 if evaluation.passes else f96c60.
def success_failure_color(self, evaluation): return "#60f979" if evaluation.passes else "#f96c60"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"", "def color(self):\n return 0x2f3136", "def color_negative_red_positive_green(val):\n if val < 0:\n color = 'red'\n elif val > 0:\n color = '...
[ "0.7141954", "0.6812762", "0.6681384", "0.66602385", "0.66393065", "0.65938675", "0.65505564", "0.64515567", "0.64472324", "0.6438781", "0.6421074", "0.6412371", "0.6412371", "0.6412371", "0.6412371", "0.64005363", "0.6387426", "0.63748986", "0.6365186", "0.6347126", "0.63348...
0.722408
0
Return a global SUCCESS or FAILURE message for all evaluations.
def text_summary_message(self): failed = [e for e in self.evaluations if not e.passes] if failed == []: return "SUCCESS - all constraints evaluations pass" else: return "FAILURE: %d constraints evaluations failed" % len(failed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success_failure_color(self, evaluation):\n return \"#60f979\" if evaluation.passes else \"#f96c60\"", "def get_error_message(self):\n msg = 'Test case: ' + self.benchmark + '.yaml + ' + self.producer + '.yaml failed. '\n info = ''\n if not self.directory:\n info = 'No r...
[ "0.602707", "0.6026309", "0.575857", "0.57070476", "0.56101066", "0.55959904", "0.5554432", "0.5525771", "0.55251604", "0.54986006", "0.54985416", "0.5497898", "0.54954153", "0.5488641", "0.54584396", "0.5451354", "0.5448297", "0.54367286", "0.54192775", "0.5412327", "0.53970...
0.73922765
0
Synchronously sends a button one time.
def send_one(self, button): self.client.send_one(self.name, button)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_thread():\n state = True\n while True:\n newstate = False if GPIO.input(18) else True\n if state != newstate:\n state = newstate \n print('Button', state)\n socketio.emit('button', {'state': state}, namespace='/test')\n time.sleep(.1)", "...
[ "0.62327343", "0.6195085", "0.6072948", "0.60537666", "0.59465384", "0.59400034", "0.5935611", "0.5875449", "0.578244", "0.57768023", "0.57764006", "0.5765144", "0.5585602", "0.55646986", "0.55332255", "0.5523995", "0.5501173", "0.5440503", "0.5439348", "0.5438772", "0.541685...
0.72782546
0
initializes id and title
def __init__(self, id = 'abbrev', title = "Abbreviation Bibliography ID Cooker"): self.id = id self.title = title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, id=\"\", title=\"\", arguments=\"\"):\n\t\tself.id= id\n\t\tself.title= title\n\t\tself.arguments= arguments", "def __init__(self, id_, name):\n self._id = id_\n\n self._name = name\n self._name = self._name.title()", "def __init__(self, title):\n self._title = ti...
[ "0.78083724", "0.73984087", "0.7277978", "0.7061586", "0.686914", "0.6863247", "0.6813077", "0.6807725", "0.67897606", "0.666484", "0.666484", "0.666484", "0.666484", "0.66423106", "0.6562245", "0.6524675", "0.6524675", "0.6489632", "0.64539367", "0.64539367", "0.642176", "...
0.7662275
1
cooks a bibref id for one reference entry dict
def _cookIdCore(self, ref, **kwargs): # AUTHORS namepart='nobody' if self._refHasAuthorNames(ref): lastnames = [] for each in ref['authors']: if each.get('lastname', None): lastnames.append(each['lastname']) if len(lastnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_cff_reference(bib_entry: pybtex.database.Entry) -> dict:\n\n def _cff_transform(cff_field, bib_value):\n if cff_field == \"type\":\n if bib_value == \"inproceedings\":\n return \"article\"\n elif bib_value == \"incollection\":\n return \"article\...
[ "0.6515439", "0.59412706", "0.5690313", "0.5684403", "0.56685394", "0.56310415", "0.5598006", "0.5590219", "0.55857784", "0.5583656", "0.55488837", "0.55436593", "0.54998034", "0.54959476", "0.54939634", "0.5449776", "0.5437612", "0.5418777", "0.5413845", "0.5396753", "0.5389...
0.61811495
1
Test for when clone lun is not passed a block count.
def test_clone_lun_zero_block_count(self): lun = netapp_api.NaElement.create_node_with_children( 'lun-info', **{'alignment': 'indeterminate', 'block-size': '512', 'comment': '', 'creation-timestamp': '1354536362', 'is-space-all...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corrected_clump_tester(clump):\n tester = True\n for block in clump:\n if len(block) >= 3: # Fixed block!\n tester = False\n break\n return tester", "def org_clump_tester(clump):\n tester = True\n for block in clump:\n if len(clump) >= 3: # clump should be...
[ "0.5885451", "0.5682751", "0.56746435", "0.5612983", "0.5546021", "0.5530416", "0.55098057", "0.5433039", "0.54293126", "0.5397168", "0.536836", "0.5333882", "0.53137195", "0.530228", "0.52823144", "0.5272673", "0.52483624", "0.5217936", "0.5197577", "0.51798713", "0.5166777"...
0.7056724
0
Checks if symbol is a valid device
def _check_validdevice(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdeviceids: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_deviceline(self):\n # Check if device name is valid\n if self._check_name(self.symbol):\n self.device_name = self.symbol\n self.symbol = self.scanner.get_symbol()\n # Check if '=' is used\n if self._is_equal(self.symbol):\n # Get n...
[ "0.75342447", "0.6746497", "0.65169084", "0.64804757", "0.63896406", "0.63296634", "0.6282044", "0.6268811", "0.62086785", "0.6193023", "0.61705214", "0.6164332", "0.615052", "0.6144333", "0.61336094", "0.6121036", "0.6086974", "0.6019076", "0.6016493", "0.59963256", "0.59561...
0.8153207
0
Checks if symbol is a valid parameter
def _check_validparam(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validparamids: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_name(self, symbol):\n if symbol.type == self.scanner.NAME:\n return True\n else:\n return False", "def _is_valid_input(self, parameter_name):\n raise NotImplementedError()", "def _check_paramindevice(self):\n if self._check_validparam(self.symbol):\n...
[ "0.6862855", "0.6799891", "0.6653889", "0.65039194", "0.64729655", "0.64628637", "0.6461699", "0.64211375", "0.6384333", "0.6335811", "0.63166904", "0.6274853", "0.62189996", "0.62188965", "0.61966276", "0.6187289", "0.6160707", "0.6061646", "0.6057763", "0.60409635", "0.6040...
0.82193774
0
Check correctness of the symbol START
def _check_fixed_start(self): self.symbol = self.scanner.get_symbol() if self.symbol.type == self.scanner.KEYWORD and \ self.symbol.id == self.scanner.START_ID: pass elif self._is_eof(self.symbol): # In case file ends prematurely pass e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_start(start, lines):\r\n if start.isalpha(): # start word must be alphabetic\r\n if len(start) > 1: # start word must be larger than 1 character\r\n if start in lines: # start word must be in the list of words\r\n return \"0\"\r\n else:\r\n ...
[ "0.71219003", "0.6362785", "0.63464314", "0.63366246", "0.6255174", "0.6188901", "0.6157201", "0.6143468", "0.60610247", "0.6050532", "0.5992676", "0.59828264", "0.59446603", "0.59429526", "0.5934591", "0.59285474", "0.5921997", "0.5911821", "0.5889964", "0.5861589", "0.58428...
0.77844435
0
Check if symbol is a valid DType input
def _check_validdtypeinput(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdtypeinputs: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_validdtypeoutput(self, symbol):\n if symbol.type == self.scanner.KEYWORD and \\\n symbol.id in self.validdtypeoutputs:\n return True\n else:\n return False", "def is_symbol(obj):\n return isinstance(obj, Symbol)", "def isValidDataTypeName(name: u...
[ "0.7286696", "0.66887015", "0.6577127", "0.6570027", "0.64245325", "0.6364817", "0.6271129", "0.6229207", "0.6214596", "0.61741644", "0.6168954", "0.6150034", "0.6127641", "0.607109", "0.60133564", "0.59820586", "0.5958963", "0.5928896", "0.59214616", "0.5874561", "0.5868875"...
0.7812703
0
Check if symbol is a valid DType output
def _check_validdtypeoutput(self, symbol): if symbol.type == self.scanner.KEYWORD and \ symbol.id in self.validdtypeoutputs: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_validdtypeinput(self, symbol):\n if symbol.type == self.scanner.KEYWORD and \\\n symbol.id in self.validdtypeinputs:\n return True\n else:\n return False", "def is_symbol(obj):\n return isinstance(obj, Symbol)", "def _want_sym(sym):\n if s...
[ "0.7144111", "0.62963384", "0.612206", "0.60689634", "0.6064693", "0.5982979", "0.5965407", "0.5920263", "0.5882332", "0.58719504", "0.58253753", "0.5759133", "0.57490194", "0.5722805", "0.57056916", "0.5703249", "0.5655178", "0.56458294", "0.5625231", "0.56242913", "0.562355...
0.7976685
0
Checks for a semicolon
def _is_semicolon(self, symbol): if symbol.type == self.scanner.SEMICOLON: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_semicolon_else_skip(self, symbol):\n if symbol.type == self.scanner.SEMICOLON:\n pass\n else:\n self._display_syntax_error(\"semicolon\")\n # Skip to semicolon at end of line\n self._semicolon_skipper()", "def _check_semicolon(line_index, input...
[ "0.77693564", "0.7576656", "0.73017335", "0.7250093", "0.67261046", "0.63885087", "0.63797534", "0.635322", "0.6284039", "0.615116", "0.6051766", "0.6046793", "0.60242265", "0.58955777", "0.5878949", "0.585406", "0.58402747", "0.57678705", "0.5749202", "0.5675741", "0.5645079...
0.7972013
0
Check for a semicolon, otherwise skip to end of line
def _check_semicolon_else_skip(self, symbol): if symbol.type == self.scanner.SEMICOLON: pass else: self._display_syntax_error("semicolon") # Skip to semicolon at end of line self._semicolon_skipper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _semicolon_skipper(self):\n while (\n not self._is_semicolon(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n self.symbol = self.scanner.get_symbol()\n if self._is_eof(self.symbol):\n # In case file ends premat...
[ "0.78582406", "0.76281416", "0.73624676", "0.7034011", "0.6740908", "0.65985113", "0.6566954", "0.649407", "0.62372047", "0.60137314", "0.60137314", "0.60137314", "0.5960441", "0.5945319", "0.58354354", "0.5831994", "0.58205914", "0.5817536", "0.5817003", "0.5816331", "0.5751...
0.7773585
1
Checks for a comma
def _is_comma(self, symbol): if symbol.type == self.scanner.COMMA: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_comma(text):\n err = \"style-guide.serial-comma\"\n msg = \"Use serial comma after penultimate item.\"\n regex = \"\\,\\s[a-zA-Z0-9]*\\sand\\s\"\n\n return existence_check(text, [regex], err, msg, require_padding=False)", "def contains_comma(self, *args):\n return _ida_hexrays.cexpr_...
[ "0.78176993", "0.7652777", "0.75575286", "0.739962", "0.6958344", "0.68487954", "0.67709404", "0.6737014", "0.654276", "0.6426066", "0.6025317", "0.60239697", "0.590207", "0.5873435", "0.5853992", "0.58382696", "0.5835906", "0.579905", "0.579905", "0.5768135", "0.5726377", ...
0.78183836
0
Checks if symbol is =
def _is_equal(self, symbol): if symbol.type == self.scanner.EQUALS: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equality(s):\n return s == \"=\"", "def have_equal_symbol(l):\r\n if \"=\" in str(l):\r\n return 1\r\n else:\r\n return 0", "def __eq__(self, other):\n if isinstance(other, Symbol):\n return self.arg == other.arg\n else:\n return False", "def ...
[ "0.7069563", "0.7053939", "0.6365846", "0.6041129", "0.6032814", "0.6008303", "0.5979109", "0.5968912", "0.59604686", "0.5947024", "0.5919421", "0.5879708", "0.5776344", "0.56683415", "0.5635651", "0.5520605", "0.5435992", "0.5415546", "0.54125285", "0.5401831", "0.5359267", ...
0.7887802
0
Checks if symbol is a number
def _is_number(self, symbol): if symbol.type == self.scanner.NUMBER: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeral(self, symbol: str) -> bool:\n return symbol in self.numerals", "def is_number(symbol):\n return isa(symbol, complex) or is_rational(symbol)", "def is_int(symbol):\n return isa(symbol, int)", "def _is_num(w):\n symbols = list(w)\n for s in symbols:\n ...
[ "0.7981778", "0.796459", "0.7456952", "0.71271473", "0.7109606", "0.7074188", "0.7070969", "0.70643014", "0.7049879", "0.70249534", "0.7018031", "0.701756", "0.701756", "0.701756", "0.7005208", "0.69720167", "0.6957312", "0.69454503", "0.69375134", "0.6913471", "0.6888762", ...
0.87825435
0
Checks if symbol is END
def _is_end(self, symbol): if symbol.id == self.scanner.END_ID: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_eof(self, symbol):\n if symbol.type == self.scanner.EOF:\n return True\n else:\n return False", "def is_eof(eof):\n return eof == Symbol('#!eof')", "def _is_at_end(self):\n return self._peek().token_type == scanner.TokenType.EOF", "def end_marker(data...
[ "0.7342705", "0.7149009", "0.70896596", "0.70774", "0.67542297", "0.6487307", "0.63351965", "0.6282967", "0.6278268", "0.6223454", "0.6220154", "0.6128539", "0.6115099", "0.6088857", "0.60728556", "0.60151976", "0.5978687", "0.5965214", "0.5928278", "0.5921364", "0.5912482", ...
0.8258185
0
Checks if symbol is period
def _is_period(self, symbol): if symbol.type == self.scanner.PERIOD: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dot(f):\n return f.startswith('.')", "def contains_only_digit_period(cell):\n # Check if empty\n if check_empty(cell):\n return True\n return not bool(re.match(\"^[\\d\\.]+$\", str(cell)))", "def test_assert_does_not_contain_period(self):\n\n with self.assertRaisesRegexp(Except...
[ "0.67990226", "0.66136557", "0.6595603", "0.6524375", "0.65057904", "0.62380713", "0.6233876", "0.61981905", "0.6056237", "0.6032704", "0.5983063", "0.59301597", "0.5924762", "0.57949024", "0.57834405", "0.5684264", "0.5677624", "0.56559867", "0.5553411", "0.55044025", "0.549...
0.84950036
0
Checks if symbol is arrow
def _is_arrow(self, symbol): if symbol.type == self.scanner.ARROW: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_arrow(arrow):\r\n if arrow == '->':\r\n return u'\\u2192'\r\n if arrow == '<->':\r\n return u'\\u2194'\r\n\r\n # this won't be reached unless we add more arrow types, but keep it to avoid explosions when\r\n # that happens.\r\n return arrow", "d...
[ "0.6579438", "0.62176615", "0.6158133", "0.61140186", "0.56991667", "0.56856215", "0.5675952", "0.56478024", "0.56177944", "0.56067", "0.5604297", "0.55857825", "0.5528179", "0.549328", "0.549197", "0.5484557", "0.54716647", "0.5453517", "0.54349774", "0.54213643", "0.5419489...
0.8980897
0
Checks if symbol is EOF
def _is_eof(self, symbol): if symbol.type == self.scanner.EOF: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_eof(eof):\n return eof == Symbol('#!eof')", "def _is_end(self, symbol):\n if symbol.id == self.scanner.END_ID:\n return True\n else:\n return False", "def isEOF(self):\n return _libsbml.XMLToken_isEOF(self)", "def is_eof(self) -> bool:\n ...", "de...
[ "0.81757635", "0.75523627", "0.72510964", "0.7247274", "0.72082675", "0.6746605", "0.6746605", "0.6746605", "0.6746605", "0.6720954", "0.6688368", "0.6590599", "0.6573672", "0.6370021", "0.62316614", "0.62316614", "0.62316614", "0.6191076", "0.61427915", "0.6137312", "0.61229...
0.89874196
0
Checks the entire devices list until END DEVICE is reached
def _check_devicelist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_deviceline() until END DEVICE while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_deviceline() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_devices(self):\n _LOGGER.debug(\"Scan_devices invoked.\")\n if self._update_info() == False:\n # self.hass.data[DOMAIN]['devices'] = None\n self.hass.data[DOMAIN]['scanning'] = False\n _LOGGER.warning(\"Can't update device list\")\n return []\n ...
[ "0.6879687", "0.660112", "0.65719104", "0.6563505", "0.6508826", "0.6344587", "0.62265825", "0.6206864", "0.6176136", "0.61714685", "0.61622983", "0.61597127", "0.61597127", "0.6158857", "0.61501837", "0.6118743", "0.6103006", "0.6098765", "0.60909706", "0.6088176", "0.606403...
0.7390407
0
Checks the entire connections list until END CONNECTIONS is reached
def _check_connectionlist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_connectionline() until END CONNECTIONS while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_connection_status(self):\n while True:\n if not self.connected:\n self.log.error(\"Lost connection to spa, attempting reconnect.\")\n await self.connect()\n await asyncio.sleep(10)\n continue\n if (self.lastupd...
[ "0.6651885", "0.66485655", "0.658435", "0.65760034", "0.65238696", "0.65040714", "0.645094", "0.63097805", "0.63036615", "0.628794", "0.6277836", "0.6257548", "0.6239977", "0.62278676", "0.6214399", "0.61141676", "0.61134064", "0.6110468", "0.6097771", "0.60918623", "0.606363...
0.7198108
0
Checks validity of each line in the connections list
def _check_connectionline(self): self.connection_first_device, \ self.connection_first_port \ = self._check_validconnectionoutput() if self._is_arrow(self.symbol): # Get next symbol self.symbol = self.scanner.get_symbol() self.connection_second...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_connectionlist(self):\n self.symbol = self.scanner.get_symbol()\n # Repeatedly call _check_connectionline() until END CONNECTIONS\n while (\n not self._is_end(\n self.symbol)) and (\n not self._is_eof(\n self.symbol)):\n ...
[ "0.68231344", "0.6541388", "0.62784106", "0.6260675", "0.60896343", "0.60538226", "0.60501355", "0.597213", "0.59351665", "0.5903994", "0.58946735", "0.58336484", "0.5699847", "0.5687605", "0.567442", "0.5646546", "0.56359893", "0.56153196", "0.56123793", "0.5572138", "0.5549...
0.6729478
1
Create own make_connection to handle the fact that first device may sometimes not have a port specified.
def _connection_maker( self, first_device, first_port, second_device, second_port): if first_port is None: return self.network.make_connection( first_device.id, None, second_device.id, second_port.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_connection( hostname, port = 4663 ):\n \tconnection = socket.socket();", "def connect(self, device_ip, device_port=DEFAULT_PORT):\n return", "def init_tcp_conn(target: str, port: int) -> socket.socket:\n conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n conn.settimeout(5)...
[ "0.6627861", "0.6501172", "0.63174254", "0.6263077", "0.6138852", "0.6062171", "0.6033618", "0.6004392", "0.59724677", "0.59683317", "0.5954122", "0.5947945", "0.59181684", "0.59173775", "0.58790517", "0.58762664", "0.58634245", "0.58634245", "0.5857357", "0.5852349", "0.5844...
0.79061735
0
Use network's check_network() to test all connections.
def _check_whole_network(self): if not self.network.check_network(): # check_network has failed, issue error self._display_semantic_error("network")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_network(network_with_devices):\n network = network_with_devices\n devices = network.devices\n names = devices.names\n\n [SW1_ID, SW2_ID, OR1_ID, I1, I2] = names.lookup([\"Sw1\", \"Sw2\", \"Or1\", \"I1\",\n \"I2\"])\n\n # Inputs are u...
[ "0.77178425", "0.6734853", "0.67199486", "0.66826373", "0.6626964", "0.6584825", "0.65507597", "0.649634", "0.6491266", "0.6462607", "0.6385012", "0.6379867", "0.6345907", "0.6305116", "0.6298622", "0.6279326", "0.6273643", "0.62547606", "0.62362325", "0.6226283", "0.62199765...
0.7808896
0
Checks the entire monitors list until END MONITORS is reached
def _check_monitorlist(self): self.symbol = self.scanner.get_symbol() # Repeatedly call _check_monitorline() until END MONITORS while ( not self._is_end( self.symbol)) and ( not self._is_eof( self.symbol)): self._check_monitorli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reDetectMonitors(self):\n if self.os_type == 'Windows8':\n try:\n self.notifyPut('Running a quick monitor detect')\n self.checkMetrics()\n pythoncom.CoInitialize() # Initialize COM lib on thread\n ...
[ "0.64343464", "0.64005023", "0.636382", "0.6222358", "0.61567485", "0.61138576", "0.6028731", "0.590527", "0.5892099", "0.58482844", "0.58335686", "0.57457507", "0.5730217", "0.56420094", "0.56305265", "0.5628375", "0.55960834", "0.5589741", "0.5579765", "0.5569071", "0.55687...
0.68545663
0
Function that gets run once every watchdog_period_seconds.
def watchdog(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AutonomousPeriodic(self):\n Scheduler.GetInstance().Run()", "def reset_timer(self, *_) -> \"ALL\":\n self.last = time.time()\n delta = time.time() - self.last\n if delta > 180:\n print(\n \"!!! Warning: Watchdog failure detected, spawning a fallback \"\n ...
[ "0.64125323", "0.63243026", "0.62250376", "0.61276174", "0.60985696", "0.6009293", "0.59422404", "0.58473533", "0.57617235", "0.5760029", "0.563189", "0.56076306", "0.55893135", "0.5549261", "0.5547748", "0.5533392", "0.5522406", "0.551928", "0.54789424", "0.54440325", "0.542...
0.69782615
0
Computes the L2 error of the adapted solution compared to the solution on the finest grid. The tree_adapted must have been projected to the finest grid first.
def global_error_to_finest_grid(tree_adapted, tree_finest): error = 0 for index in tree_finest.tree_leaves: error += (tree_finest.nvalue[index] - tree_adapted.nvalue[index])**2 error = math.sqrt(error) if tree_finest.dimension == 1: dx = mesh.space_step(tree_finest, tree_fine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potentialSolver2(self, max_it, tol):\n\n dx2 = 1.0/(self.dh[0]*self.dh[0]); # dx^2\n dy2 = 1.0/(self.dh[1]*self.dh[1]); # dy^2\n dz2 = 1.0/(self.dh[2]*self.dh[2]); # dz^2\n \n L2 = 0.0 # norm\n \n converged = False\n \n \n # solve potential\n ...
[ "0.5702751", "0.56921744", "0.564493", "0.5359636", "0.5309151", "0.5170774", "0.51317436", "0.51264113", "0.50781935", "0.50201297", "0.49748135", "0.49748135", "0.4940611", "0.48971447", "0.48584917", "0.48562384", "0.48285002", "0.48250198", "0.48124108", "0.48025668", "0....
0.6766839
0
Retrieves an updated list of tickers for companies included in the S&P 500. Saves to a pickle file.
def retrieve_sp500(): source = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' resp = requests.get(source) soup = bs.BeautifulSoup(resp.text, 'lxml') table = soup.find('table', {'class': 'wikitable sortable'}) tickers = [] for row in table.findAll('tr')[1:]: ticker = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_company_data(self):\n self.set_stock_sym_append_str('')\n self.set_stock_retrieval_type('all') #'all', watcher\n self.load_stock_symbol_fr_file()", "def Save(self, filename = 'tickers.dat'):\n if not self.changed:\n if not self.silent:\n print('n...
[ "0.6478883", "0.64458394", "0.6418934", "0.63052785", "0.6192895", "0.61889976", "0.6067577", "0.5903302", "0.58534765", "0.5844709", "0.5843255", "0.5743359", "0.56932896", "0.55991876", "0.55669063", "0.5554215", "0.5516616", "0.5503813", "0.5497355", "0.5488232", "0.544957...
0.74970037
0
Given the RNN outputs (presoftmax) at each time step and a target labeling, compute the negative of the CTC loss for one example, where the loss itself can be defined as the negative of the probability p(target | logits) as defined in equations 3 & 8
def compute_ctc_loss(self, logits, target): num_time_steps = logits.shape[0] num_labels = logits.shape[1] - 1 num_labels_with_blank = num_labels + 1 # sanity check to ensure targets are all right assert (target < num_labels).all() ###################### ### YOUR CODE HERE ### ##############...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CELOSS(output,label,delay = 0):\n if delay > 0:\n label.data[delay:,:] = label.data[0:-delay,:]\n label.data[0:delay, :] = -1\n _,predict = torch.max(output,1)\n correct = (predict.data == label.view(-1).data).sum()\n\n #correct = np.sum(predict_data == yt.reshape(-1))\n \n mask...
[ "0.7144969", "0.6606015", "0.6490216", "0.64216244", "0.6363278", "0.63588995", "0.63528866", "0.63436717", "0.63401145", "0.633253", "0.63303226", "0.631504", "0.6300099", "0.6297033", "0.6292471", "0.6279375", "0.62720025", "0.6260915", "0.62449986", "0.6224692", "0.6217328...
0.7510228
0
Given the normalized RNN outputs (postsoftmax) at each time step and a target labeling, compute the forward variables alpha_t(s) as defined in equation 5 in the paper
def compute_forward_variables(self, normalized_logits, target): target_length = target.shape[0] num_time_steps = normalized_logits.shape[0] ###################### ### YOUR CODE HERE ### ###################### blank_label = normalized_logits.shape[1] - 1 l = add_blanks(target, blank_label) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_alpha(self, feats):\n \n init_alphas = torch.Tensor(1, self.tagset_size).fill_(-10000.)\n init_alphas[0][self.tag_to_ix[START_TAG]] = 0.\n\n forward_var = autograd.Variable(init_alphas)\n\n for feat in feats:\n alphas_t = [] # The forward variables at t...
[ "0.6556268", "0.6452523", "0.6378413", "0.62199193", "0.6107131", "0.6078645", "0.60783464", "0.6060503", "0.6053484", "0.6044611", "0.6033897", "0.60004437", "0.5989006", "0.59869456", "0.5968317", "0.5951192", "0.5950084", "0.5944599", "0.5943287", "0.5917645", "0.5909624",...
0.73559594
0