id
stringlengths
20
20
title
stringclasses
1 value
text
stringlengths
8
768k
ff89d0c48baf9c59603b
def channels(self, channels): self._channels = channels
ff89e341328b5d9385f6
def to_dog_years(): # write your solution below this line. human_years = get_age() dog_years = human_years * 7 say_hello() + print("\nYour dog age is {}!\n".format(dog_years))
ff8a03ee6349bcbee2b7
def saveFig(filename): if pathDias is None: raise RuntimeError("you must set utils.pathDias first") plt.savefig( os.path.join(pathDias, "{}.pdf".format(filename)), bbox_inches="tight" )
ff8a0888675d4cde6b4e
def add_labels(self, labels): if not labels: raise ValueError("label is not specified") self._update(self.RegisteredModelMessage(labels=labels))
ff8a18dfce88ff72ac12
def setRootVal(self, obj): self.key = obj
ff8a2b23969d7070f2d6
def getDepth(self): return self._rect.getDepth()
ff8a4156de7b938f3a84
def ubercam(*args, **kwargs): pass
ff8a52ecfe61669e59f8
def _make_dict(my_tup, lang): labels = ['comment_text', 'course_code', 'learner_classification', 'offering_city', 'offering_fiscal_year', 'offering_quarter', 'overall_satisfaction', 'stars', 'magnitude', 'nanos'] results = {key: val for key, val in zip(labels, my_tup)} return results
ff8a5d252ecca4078cee
def plugin_start(): global _cache global _overlay _cache = Cache() _overlay = OverlayManager() if not TTL_FIELD.get(): TTL_FIELD.set(str(TTL_VALUE_DEFAULT)) config.set(TTL_CONFIG_KEY, str(TTL_VALUE_DEFAULT)) if not ED_DATE_FIELD.get(): ED_DATE_FIELD.set(ED_DA...
ff8a6a94745dbdabeaa3
def delete(self, endpoint, **kwargs): return requests.delete(kwargs.pop('address'), **kwargs)
ff8a735879e1f8af86f2
def plot_precision_recall_curve(precisions, recalls): """ # For Task 1 plotting interpolated = np.zeros(11) j = 0 indices = np.arange(0.0, 1.1, 0.1) print(indices) for i in indices: while int(i*10) > int(recalls[j] * 10): j = j + 1 interpolated[int(i*10)] = max(precisions[j:]) ...
ff8a740016cf675c4108
def _check_cell_validity(self, i, j): if i >= len(self._output): return True if j >= len(self._output[i]): return True if self._output[i][j] is None: return True return False
ff8a7eb725086ff6e31a
def read(self, fname): image = tf.io.read_file(fname) image = tf.io.decode_image(image) image = tf.cast(image, dtype=tf.float32) image = image/255 # assumes image is uint8 return image
ff8a88da7b833955577a
def get_symbol(self, symbol, stats): raise NotImplementedError()
ff8aa0dfb9e7c9113479
def genEnemies(wave, Images): Monsters = [] if wave == 1: for i in range(20): Monsters.append([monsters.Monster(1, wave, False, Images),30*i]) elif wave == 2: for i in range(35): Monsters.append([monsters.Monster(1, wave, False, Images),15*i]) elif wave == 3: ...
ff8ab465e74b41dc0948
def create_cog(nc_href: str, cog_href: str, ds_name: str = "elevation") -> None: cogify(f'NETCDF:"{nc_href}":{ds_name}', cog_href, ["-co", "compress=LZW"])
ff8ad6a28abe5b194136
def in_notes(self): notes = [] bass_notes = [] # notes for melody in self.melodies: for measure in melody.measures: for note in measure.notes: notes.append(note) # bass for melody in self.melodies: for measure in...
ff8afe9536287ec144a6
def search_x_dim(nbs, minx, maxx): y = z = 0 steps = 2 step_size = (maxx - minx // steps) # find a coord that gives the best num_in_range while step_size >= 1: best_num = 0 for low_x in range(minx, maxx + 1, step_size): x = low_x + (step_size // 2) pos = (x, ...
ff8b036e92cc31809132
def get_unique_name(name: str) -> str: nonlocal link_id if name is None: name = f"{DEF_LINK_NAME_PREFIX} {link_id}" while name in self.links_all or slugify(name) in self._slugs_all: link_id += 1 name = f"{DEF_LINK_NAME_PREFIX} {link_id}...
ff8b09f2f92fc726ac3d
def parse_matrix(lines): M = {} top, *body = [l.split() for l in lines] for line in body: r, *vals = line for i, c in enumerate(top): M[r, c] = float(vals[i]) return M
ff8b10b67f5d60784eef
def perform_nb(X_train, y_train, X_test, y_test): gnb_clf = GaussianNB() gnb_clf.fit(X_train, y_train) y_pred = gnb_clf.predict(X_test) util.calculate_binary_metrics(y_test, y_pred, metric_of_interest=None, print_mess=True)
ff8b83a8839fca9fb4da
def get_cli_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser() listing_group = parser.add_mutually_exclusive_group() listing_group.add_argument( "-P", "--list-profiles", dest="list_profiles", default=False, action="store_true", help="List...
ff8bc189398042fcdf78
def collect_words(self, word_file="gre_word_file.txt"): with open(word_file) as wordlist: wordlist = wordlist.read().splitlines() return wordlist
ff8bc5e60dc6bf35d0af
def __get_postponed_exec_date(self, scheduling_info, min_date): # Convert age requirement to timedelta (or None) if scheduling_info.age_requirement is None: age_td = None else: age_td = datetime.timedelta(seconds=scheduling_info.age_requirement) # Perform BFS on...
ff8bd5e6c5c2653cdf01
def get_title(absfilename, contents): lcontents = contents.lower() c = 1 b = soup.BeautifulSoup(contents, "lxml") while c < 6: tag = b.find('h' + str(c)) if tag != None: return tag.text.replace('&#182;', '') c += 1 i = absfilename.rfind('/') j = absfilename.rf...
ff8bed2d345d0b61782e
def dump_all(self): dyn = self.parent if (self.dump_amps and self.dump_dyn_gen and self.dump_prop and self.dump_prop_grad and self.dump_fwd_evo and (self.dump_onwd_evo) or (self.dump_o...
ff8bf4a7b6c1b8581ab2
def slotOnItemClicked(self,selection): index = selection.data(Qt.UserRole+1).toInt()[0] if index == 1: """ Hack: create a blank project to open to simulate a new blank project similar to Kate's behavior. Hopefully in the future there will be a ...
ff8bfc30a29e3c65ef73
def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) # Settings self.chat_models = self["general"]["chat_models"] self.model = self["general"]["model"] self.max_tokens = self["general"]["max_tokens"] self.temperature = self["general"]["temperatur...
ff8c1963ae226d0ea83b
def addServer(self, server): self.accessory.addServer(server.server)
ff8c55a65a4d5d75e2eb
def load(fp, *args, **kwargs): return json.load(fp, *args, **kwargs)
ff8c77365e2fe120796f
def load_json(photon_package: str) -> Any: folder = ( os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + "/registry" ) file_name = os.path.join(folder, photon_package + ".json") if os.path.isfile(file_name): # Reading json ...
ff8c7cfcf8c1f4653c1d
def on_test_timeout_fail(self): self.fail_msg = 'Test timed out' self.io_loop.stop()
ff8c88c83c9a56181010
def on_init(self): self.write_log("策略初始化") self.rsi_buy = 50 + self.rsi_entry self.rsi_sell = 50 - self.rsi_entry self.load_bars(10)
ff8ca940dc6a5a15b2cd
def s1_up_01(modules, script_params): modules['attna_c'][8][0][0][0] = script_params[0] modules['attna_re'][8][0][0][0] = script_params[4] modules['attna_b'][8][0][0][0] = script_params[0] modules['attna_s'][8][0][0][0] = script_params[0] modules['mgns'][8][0][41][0] = script_params[5] ...
ff8cb6dc2a70afbd11ae
def climate_bar(df, title, out_path): # Number of companies per year #yeared_df = df.groupby("Climate Prediction") #yeared_df = yeared_df.agg({"Sentence": "nunique"}) # yeared_df = yeared_df.reset_index() # Plot sns.set(style="whitegrid") plt.title(title) ax = sns.countplot(data=df, x="C...
ff8cb848a104e65bf640
def test_collision(): small_table = HashTable(2) small_table.set("a", "hello") small_table.set("c", "world") assert ("a", "hello") in small_table._table[1] assert ("c", "world") in small_table._table[1] assert small_table._table[0] == []
ff8cdadbb7bdeb818dd6
def get_queryset(self): return PublicBody.objects.get_for_search_index()
ff8cdc5ba602ff81b1a3
def update_camera(self, frame): img = QImage(frame, self.args.camera_size[0], self.args.camera_size[1], QImage.Format_RGB888) self.setPixmap(QPixmap.fromImage(img))
ff8d016623900af950a4
def schedule_concatenate(outs): def vectorize(sch, tensor, vectorize_limit): """Internal vectorization function for concatenate.""" inner_axis = s[tensor].op.axis[len(s[tensor].op.axis) - 1] # Check that the tensor shape is static. Otherwise skip vectorization. if isinstance(tensor....
ff8d1f9442bfd3c5cc16
def get_history(args={}): url_suffix = 'analysis/' params = args response = http_request('GET', url_suffix=url_suffix, params=params) return response
ff8d486f0e0109490ef3
def optimSetup(self): if hasattr(self, 'optMinimize'): raise Exception('optimization node is already defined!') # Load data: puNum = self.processorNum controller = self.controller graph = self.graph optimizer = self.optimizer ...
ff8d4b88797d84d4b3de
def spawn_webranches(self, deadends): x, y = self.index cwidth = 2 * self.half_width + 1 cheight = 2 * self.half_height + 1 nairlocks = filter(lambda airlock: airlock.coords[1]==y-1,self.airlocks) # north airlocks sairlocks = filter(lambda airlock: airlock.coords[1]=...
ff8d7a938b35817075c8
def test_known_bootstub(p): known_bootstubs = { # covers the two cases listed in Panda.connect McuType.F4: [ # case A - no bcdDevice or panda type, has to assume F4 "bootstub_f4_first_dos_production.panda.bin", # case B - just bcdDevice "bootstub_f4_only_bcd.panda.bin", ], Mcu...
ff8d8745457c51875bc5
def text_fields(df: pd.DataFrame) -> list: return df.select_dtypes("object")
ff8d9ca102e04560ee10
def is_group_error(self): return bool(self.code & ERROR_GROUP.code)
ff8dcba2c7d34910c9ab
def init_meta(self): self.meta = {}
ff8e03e5f864a166089f
def device_version(self): return self.shell_arguments('getprop ro.build.version.release')[0].strip()
ff8e145817d8c6697d64
def cluster_visulization(self): dn = dendrogram(self.z) plt.axhline(y=2) plt.show() # self.cluster1 = self.z[len(self.z) - 1] # self.cluster2 = self.z[len(self.z) - 2] # # plt.scatter(self.cluster1, self.cluster2) # self.clusterdict ={} # for i in ...
ff8e3a2e259b4baeeac2
def addGroup(name): try: UserGroup.curs.execute("insert into Groups values (?)", (name,)) UserGroup.conn.commit() except Exception as e: if "UNIQUE constraint" in str(e): return "There is a group called '{}' already!".format(name) else: ...
ff8e46c7c8c81f42610f
def from_translation_vector(cls, t_xyz): return cls.from_quat_pose_array(np.append(np.array([1., 0., 0., 0.]), np.array(t_xyz)))
ff8e5b2d500a21d49838
def crud_amenities(amenity_id=None): data = { 'id': amenity_id, # id for amenity 'class': 'Amenity', # Name class 'f_id': None, # foreign key value 'exists': ['name'], # attr that must exist } # All methods req_methods = { 'GET': get, 'DELETE': delete,...
ff8e64f2f27cfcfc4e09
def fit_predict_and_loss(self): raise NotImplementedError()
ff8e6ed9e20986e067f6
def depends_dot(args, patches, depends): # Seems that fdp gives the best clustering if patches are often # independent res = """ digraph ConflictMap { node [shape=box] layout=neato overlap=scale """ if args.randomize: res += "start=random\n" for p in patches: label = dot_escape_str...
ff8e7d3e9b54eb8379b3
def nakresli_text(text, x, y, pozice_x): napis = pyglet.text.Label( text, font_size=VELIKOST_FONTU, x=x, y=y, anchor_x=pozice_x ) napis.draw()
ff8ec0ef84faf49364e5
def write_to_file(self, f): f.write(" ".join(self.paths) + "\n") f.write(" ".join(self.snps) + "\n")
ff8ee960f134a2dd9eca
def force_unicode(string): if sys.version_info[0] == 2: if isinstance(string, unicode): return string.encode('utf-8') return string
ff8eee378a22742a1991
def reset(self): self.integrated_error = 0.0 self.last_error = 0.0 self.last_var_desired = 0.0
ff8ef77615030d0e6e79
def setUp(self): self.methods = [Spectral(), GSVD(), SVD()] self.bimethods = [GSVD(), SVD()]
ff8ef7852ba9ddf090b0
def search_word(word): try: adverb = "" definition = "" #Sets the base_url based on which Dictionary is currently selected if dictionary_selected == "Dictionary.com": base_url = DICTIONARY_URL elif dictionary_selected == "Merriam-Webster": ba...
ff8f01c60095eed104b3
def set_as_not_done(id: str): return _update_todo_status(id, isDone=False)
ff8f0660979f2404bf52
def permed_lsdds( k_all_c: torch.Tensor, x_perms: List[torch.Tensor], y_perms: List[torch.Tensor], H: torch.Tensor, H_lam_inv: Optional[torch.Tensor] = None, lam_rd_max: float = 0.2, return_unpermed: bool = False, ) -> Union[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor...
ff8f09599fcbc62832b6
def test_can_run_ANOVA_trajectories(self): self.assertTrue(can_run_ANOVA_trajectories(self.anova_dict_true)) self.assertFalse(can_run_ANOVA_trajectories(self.anova_dict_false))
ff8f1f00b653eae76789
def _remove_striped_peaks_line(self): if self._no_peak_van_line is not None: self.ui.graphicsView_main.remove_line(self._no_peak_van_line) self._no_peak_van_line = None return
ff8f5f01f1e83598d0af
def eval(self): while self.iteration < 100: for q_key in self.qs: game = AI_Game(agent,q_key) result,visited_states = game.play() #returns a tuple to be unpacked self.update_average(q_key,result) for state in visited_states: ...
ff8f6df374ef5963ea91
def motor_angle_detection_from_top(self, im_in, im_vis): ssd_results, im_vis = self.detect_object_in_image(im_in, im_vis) try: m = MotorOrientation() # if True hole is observed in im_in angle_orientation = m.main_proc(im_in, ssd_results) im_vis = m.get_im...
ff8f77f69174b05bc718
def disconnect(self) -> None: if self.cdata is not None: if hasattr(ffi, "release"): ffi.release(self.cdata) # causes sr_disconnect to be called self.cdata = None
ff8f7ad78c70ea4dd538
def _validate_config(self): try: config_validation.validate_bisect_config(self.bisect_config) except config_validation.ValidationFail as error: self.surface_result('BAD_CONFIG') self.api.m.halt(error.message) raise self.api.m.step.StepFailure(error.message)
ff8f7deb8f341460e677
def printTable( headers, data, colwidths=None ): if colwidths == None: colwidths = [12]*len(headers) else: colwidths = [ width+2 if width > 8 else 8 for width in colwidths ] for header, width in zip(headers, colwidths): print('{:{align}{width}}'.format(header, align='^', width=width), end='') print...
ff8f8c9b27894d7fe76a
def get_tracker_time(self): unsynced_time = self.unsynced_clock.get_time() synced_time = self.sync_manager.convert_from_local_to_remote( unsynced_time) return synced_time
ff8fcd758b5f2b96fa49
def graph_data_obj_to_nx(data): G = nx.Graph() # edges edge_index = data.edge_index.cpu().numpy() edge_attr = data.edge_attr.cpu().numpy() n_edges = edge_index.shape[1] for j in range(0, n_edges, 2): begin_idx = int(edge_index[0, j]) end_idx = int(edge_index[1, j]) w1, w...
ff8ffc2e2e3158a676cb
def read_stock_data(stock_name, stock_file_name): with open(stock_file_name) as f: stock_prices = json.load(f) # store daily volume and close numbers in MONTHLY_V_C for stock_dict in stock_prices: # parse date p_date = datetime.datetime.strptime(stock_dict["Date"], '%Y-%m-%d') ...
ff9035fd0d3d7bad1751
def construct_serial_obj(port: str) -> serial.Serial: s = serial.Serial(port) set_serial_settings(s) return s
ff904fd77cc4f4b670c5
def format(obj): # pylint: disable=W0622 return json.dumps(obj)
ff9098a6c31224bea023
def verification_certificate_pem(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "verification_certificate_pem")
ff90a08f8e10a0c9e604
def testTwoStepCommand(self): results = [] def handle_command(iq, session): def handle_step2(form, session): results.append(form['values']['bar']) def handle_step1(form, session): results.append(form['values']['foo']) ...
ff90be6f4bf4466fb017
def kdf(self): kdf = PBKDF2HMAC( algorithm=self.algorithm, length=self.length, salt=self.salt, iterations=self.iterations, backend=self.backend ) return kdf
ff90dc2ad16064ac6ba4
def test_assign_to_app_no_content(app): scroll_container = toga.ScrollContainer() # Scroll container is initially unassigned assert scroll_container.app is None # Assign the scroll container to the app scroll_container.app = app # Scroll container is on the app assert scroll_container.app...
ff90e3a3b28b6a581b68
def animate_scenes(self, states, sim, space=[]): with show.animation(len(states), self.scenario, self.video_path, writer='imagemagick', viz=self.viz) as context: ax = context['ax'] ax.set_xlabel('x [m]') ax.set_ylabel('y [m]') yield ax for s in space...
ff90fd9af82624f085f8
def beta_create_Analysis_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): request_serializers = { ('analysis.Analysis', 'RequireAnalysis'): AnalysisRequest.SerializeToString, } response_deserializers = { ('analysis.Analysis', 'RequireAnalysis'): AnalysisReply.FromS...
ff9105f7fb713e7463e4
def results_from_query(request): # Transformation to APIRequest is done by API.create_response (inherited) return ResultsFromResponse(response=request())
ff9106fb51f2cd7fb299
def post(self, route, **kwargs): return self.make_request('post', route, **kwargs)
ff9108d964c1540e5ff3
def _int(x): if is_na(x): return NA else: return int(x)
ff9124315cd89371c3ce
def remove_weight_norm(self): def _remove_weight_norm(layer): try: nn.utils.remove_weight_norm(layer) except ValueError: pass self.apply(_remove_weight_norm)
ff91456b7b78c2a7747a
async def emojilo(self, ctx): settings = self.bot.settings[ctx.guild] if settings.bot_commands_channels and ctx.channel.id not in settings.bot_commands_channels: await ctx.send(f"Please use <#{settings.bot_commands_channels[0]}>") return manager = self.managers[ctx.guild....
ff9146ba70af962c88b2
def _plot_line(self, key): # If the data is None (due to input error), remove current line if (len(self._plot_data[key].xdata) == 0 or len(self._plot_data[key].ydata) == 0): return self._plot_data[key].line = self._axes.plot( self._plot_data[key].xdata, ...
ff91514be81c695fbd3d
def upgrade_ha_one_controller(self): if not self.env.d_env.has_snapshot('ceph_ha_one_controller_compact'): raise SkipTest() self.env.revert_snapshot('ceph_ha_one_controller_compact') cluster_id = self.fuel_web.get_last_created_cluster() _ip = self.fuel_web.get_nailgun_node_...
ff915c701be8be620d7e
def gen_dot_train_file(data_root, rel_path, out_root, f_name='detrac.train'): if not (os.path.isdir(data_root) and os.path.isdir(out_root)): print('[Err]: invalid root') return out_f_path = out_root + '/' + f_name cnt = 0 with open(out_f_path, 'w') as f: root = data_root + rel_p...
ff916a94b64af3e69367
def teardown(): for store in store.stores.values(): try: store.drop_database() except (AttributeError, NotImplementedError): pass store.stores = {} store.shutdown()
ff916d49d4e5974c2af2
def serialize_to_xml(self) -> etree.Element: osm = etree.Element("osm") osm.set("version", "0.6") osm.set("upload", "true") osm.set("generator", "opendrive2lanelet") for node in self.nodes: osm.append(node.serialize_to_xml()) for way in self._ways: ...
ff919cd76a7d3bb22f98
def predict(self, X_test): return self.nn.predict(X_test)
ff91ad0b5f1b5b018f80
def _do_backup(self): self.log.info("Do the backup copying operation") backup = backup_operation.BackupCopy( options=self.options, config=self.conf, backup_source_root=self._temp_mount_point() ) backup.run()
ff91adee9949d3cb97b1
def pipeline_runner(): # file_parser() # take raw data file and extract columns of interest. remove contaminants. entry_parser() # remove duplicates, faulty lines and format the whole thing normally. lfq_parser() # replace 0s in lfq reading with random small numbers for t testing purposes # open Rstudio and do ...
ff91b1f79bc14ae0ba2c
def delete(self, product): self.products.remove(product)
ff91da6ca5376ff446c3
def test_in_order_solo(): from bst import BST b = BST([20]) in_ord = b.in_order() in_ord_list = [] for ii in in_ord: in_ord_list.append(ii) assert in_ord_list == [20]
ff91e2ed06b3a64eb461
def parse2mrc(self) -> List[DataStruct]: data = list() for i, child in enumerate(self.root.iter(self.ARTICLE_KEYWORD)): medline = child.find(self.MEDLINE_XPATH).text sentence_idx = 0 for category, xpath in zip( [self.TITLE_KEYWORD, self.ABSTRACT_KEYWO...
ff91f2a9b9317d939551
def _config_file(): config_fname = 'run_backup.rc' candidates = [] try: import xdg.BaseDirectory for directory in xdg.BaseDirectory.xdg_config_dirs: candidate = os.path.join(directory, config_fname) candidates.append(candidate) if os.path.exists(candidate)...
ff920bd625f52c4eb2aa
def logp(self, net): res = 0. for name, param in net.named_parameters(): mu, std = self._get_params_by_name(name) if (mu is None) and (std is None): continue var = std.to(param.device) ** 2 res -= torch.sum(((param - mu) ** 2) / (2 * var)) ...
ff9214b466ab5cfe2251
def test_particle_obj(): # Set up the base parameters describing a particle object T = 273.15 + 15. P = 150e5 Sa = 35. Ta = 273.15 + 4. composition = ['methane', 'ethane', 'propane', 'oxygen'] yk = np.array([0.85, 0.07, 0.08, 0.0]) de = 0.005 lambda_1 = 0.85 K = 1. Kt = 1. ...
ff92289660940f4b7bcb
def print_commands(olist=commands): print('commands:', ', '.join(olist))
ff9243434a660b8d4ce4
def activate_twitter(hash_tags = [], ignore_users = [], ignore_terms = [], accept_langs = [], persist = False, connection_string = None): auth = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET) ...