content
stringlengths
22
815k
id
int64
0
4.91M
def find_from(board, word, y, x, seen): """Can we find a word on board, starting at x, y?""" # This is called recursively to find smaller and smaller words # until all tries are exhausted or until success. # Base case: this isn't the letter we're looking for. if board[y][x] != word[0]: pr...
5,291,200
def hello(): """ Basic hello world route to check if server is running. """ return "Welcome to Codenames."
5,291,201
def vm_clone_handler(si, logger, linked, vm_name, datacenter_name, cluster_name, resource_pool_name, folder_name, datastore_name, custom_mac, ipv6, maxwait, post_script, power_on, print_ips, print_macs, template, template_vm, template_snapshot, mac_ip_pool, mac_ip_pool_results, adv_parameters): """ Will handle ...
5,291,202
def get_hashsum_dictionary(): """Return a dictionary of hashes of file contents in the current directory and all its subdirectories.""" return { f: generate_hashsum(f) for f in [ os.path.join(root, name)[2:] for root, dirs, files in os.walk(".") for name i...
5,291,203
def partition_labels(S: str) -> List[int]: """ consumed: 68ms 64ms :param S: :return: >>> partition_labels('ababcbacadefegdehijhklij') [9, 7, 8] >>> partition_labels('eccbbbbdec') [10] """ first_index: int = 0 res = [] while first_index < len(S): last_index: int =...
5,291,204
def test_moat(): """Test main moat function.""" # values from https://www.maa.org/sites/default/files/pdf/upload_library/22/Chauvenet/Gethner.pdf m = gp.moat_component(3) assert m.shape == (2, 380) m = gp.moat_component(3.2) assert m.shape == (2, 31221) m = gp.moat_component(4) assert m.shape == (2, ...
5,291,205
def orderings2() -> List[List[int]]: """Enumerates the storage orderings an input with rank 2.""" return [[0, 1], [1, 0]]
5,291,206
def hello_pubsub(event, context): """Triggered from a message on a Cloud Pub/Sub topic. Args: event (dict): Event payload. context (google.cloud.functions.Context): Metadata for the event. """ pubsub_message = base64.b64decode(event['data']).decode('utf-8') project_id = "coredata...
5,291,207
def building_2d_to_3d(citygml_writer, zone_shp_path, district_shp_path, tin_occface_list, height_col, nfloor_col): """ This script extrudes buildings from the shapefile and creates intermediate floors. :param citygml_writer: the cityGML object to which the buildings are gonna be created. ...
5,291,208
def get_sloc_lines(path): """Determine the lines in file `path` that are source code. i.e. Not space or comments. This requires a parser for this file type, which exists for most source code files in the Pygment module. Returns: If a Pygment lexer can be found for file `path` ...
5,291,209
def calculate_and_save_exact_density_of_energy_for_2_D_fermi_hubbard(tunneling_energy, coulomb_interaction_energy, x_dimension=None, ...
5,291,210
def alpha_canonicalize(equation): """Alpha convert an equation in an order-independent canonical way. Examples -------- >>> oe.parser.alpha_canonicalize("dcba") 'abcd' >>> oe.parser.alpha_canonicalize("Ĥěļļö") 'abccd' """ rename = OrderedDict() for name in equation: if ...
5,291,211
def hello(name='world'): """ Method to print a greeting, defaulting to 'Hello, world!' """ print('Hello, {}!'.format(name))
5,291,212
def get_raster_records(host=config.PYCSW_URL, params=config.PYCSW_GET_RECORD_PARAMS): """ This function will return all records of raster's data :param host: pycsw server's entrypoiny url :param params: request parameters for GetRecords API request with json result :return: Dict -> list of records -...
5,291,213
def read_file(filepath): """Reads text file and returns each line as a list element. Parameters: filepath (str): path to file Returns list: list of strings """ data = [] with open(filepath, 'r', encoding='utf-8') as file_obj: for line in file_obj.readlines(): ...
5,291,214
def get_template( template_name, template_path=GRAPH_TEMPLATE_PATH, logger=ps_helper.DEFAULT_LOGGER ): """Fetch R code/metadata for building plots Args: template_name (str): basename for template to graph to template_path (str, optional): basepath to templates (abspath >...
5,291,215
def _get_table_index(data_group, table_id): """Get attr table.""" table = _get_table(data_group, table_id) return dict( zip( list(map(lambda d: d['entity_id'], table)), table, ) )
5,291,216
def xml_api() -> XMLClient: """ Sets up a client to communicate with UK Carbon Intensity API using XML structure as the response format. """ return XMLClient()
5,291,217
def clear(num: int, start: int, end: int) -> int: """ Sets zeros on bits of num from start to end non inclusive """ if start == end: raise ValueError('Start value same as end') # Builds group of 1s the size of the start - end mask: int = (1 << (end - start)) - 1 return num & ~(mask << start)
5,291,218
def secure_shell(github_token, *args): """ execute git commands in a sub process """ print( " ".join([re.sub(r"%s" % github_token, "<GITHUB_TOKEN>", arg) for arg in args]) ) subprocess.run(args, check=True)
5,291,219
def test__is_radical_radical(): """ test strid.is_radical_radical """ rid1 = '[H][H]_m1.[O]_m3>>[H]_m2.[OH]_m2' rid2 = 'OO_m1.[H]_m2>>O[O]_m2.[H][H]_m1' rid3 = '[CH3]_m2.[H]_m2>>[CH2]_m1.[H][H]_m1' assert strid.is_radical_radical(rid1) is True assert strid.is_radical_radical(rid2) is False ...
5,291,220
def delete_coa(): """ Delete a certificate of analysis from storage. """ # Remove certificate from storage. # Remove the certificate data. return NotImplementedError
5,291,221
def get_incident_by_query(query): """ Get a query and return all incidents details matching the given query. Args: query: Query for the incidents that should be returned. Returns: dict. The details of all incidents matching the query. """ # In order to avoid performance issues, l...
5,291,222
def bethe_bloch(KE, Z=3., A=6., rho=1., relativistic=True, I=None): """Returns the differential energy loss per depth for protons of speed v (not relativistic) in a medium with density rho as a function of the kinetic energy KE = m * v**2 / 2 in MeV units https://en.wikipedia.org/wiki/Bethe_formul...
5,291,223
def loadhires(fn: Path, downsample: int = None) -> xarray.DataArray: """ loads and modifies GOES data """ if netCDF4 is None: raise ImportError("netCDF4 needed for hires data. pip install netcdf4") with netCDF4.Dataset(fn, "r") as f: t = datetime.utcfromtimestamp(f["time"][()].it...
5,291,224
def get_issuer_or_subject(data, country, state_prov, locality, org, org_unit, common): """Appends issuer or subject, if they exist, to data.""" if country: get_name(country, 0x06, data) if state_prov: get_name(state_prov, 0x08, data) if locality: get_name(locality, 0x07, data) ...
5,291,225
def get_connector_cluster_by_conf(channel_name, project_id=None, bk_biz_id=None, cluster_type=None): """ :param channel_name: channel_name :param project_id: 项目id :param bk_biz_id: 业务id :param cluster_type: 集群类型 :return: 优先根据project_id,bk_biz_id选择集群 """ project_route_config = model_mana...
5,291,226
def convert_to_unsigned64(value): """Convert an integer to 64-bit unsigned.""" if value > 0xffffffffffffffff: raise TahuInterfaceError(f"Cannot convert large integer {value} to 64-bit") if value > 0: return value if value < -0x8000000000000000: raise TahuInterfaceError(f"Cannot...
5,291,227
def f(x): """A transformation that has both a fully-predictable part and an inherently-random part.""" a, b = torch.split(x, 16, -1) return torch.cat((a+1, b-1 + torch.randn_like(b)/3), -1)
5,291,228
def msd(r): """ Mean square displacement Parameters ---------- r: numpy array. dimensions: (t, 3) Array containing the coordinates along t """ shifts = np.arange(len(r)) msds = np.zeros(shifts.size) for i, shift in enumerate(shifts): diffs = r[:-shift if shift els...
5,291,229
def align_shiplabels(text): """Return the announcement with the ship labels aligned.""" # See comment in is_unscheduled() for a description of the regex, def monospace(matched): return '`{}`'.format(matched.group(0)) return re.sub('^\d\d:(?!\d\d\s)', monospace, text, flags=re.MULTILINE)
5,291,230
async def test_lti_11_authenticate_handler_invokes_login_user_method(make_mock_request_handler): """ Does the LTI11AuthenticateHandler call the login_user function? """ local_handler = make_mock_request_handler(LTI11AuthenticateHandler) with patch.object(LTI11AuthenticateHandler, 'redirect', return_...
5,291,231
def _get_data_type( version: str, name: str, property_definition: dict, entity_class_name: str ) -> kuber_maker.DataType: """...""" setter_type_hint = None reference = property_definition.get("$ref") reference_type = (reference or "").rsplit(".", 1)[-1] api_type = property_definition.get("type")...
5,291,232
def create_api_client(base_path, access_token): """ Function for creating api clinet, to interact with docusign. input :: - base_path : base path uri - access_token : auth token received from docusign output :: api_client object """ api_client = ApiClient() api_client.host = base_pa...
5,291,233
def stopsNearby(coordX, coordY, maxRadius=None, maxNumber=None, timeout=5): """ Finds stops close to given coordinates. Args: coordX (float): Longitude. coordY (float): Latitude. maxRadius (int): The radius in meters to search within. maxNumber (int): The number of results to re...
5,291,234
def _healpix_bot_left(p, nside, steps=10, reverse=False): """Returns the boundary on the bottom left side of a healpix pixel in healpix x and y coordinates. Parameters ---------- p : int Healpix pixel index. nside : int Healpix Nside. steps : int, optional Number of ...
5,291,235
def imag(x): """Returns the imaginary part of a complex tensor. :param x: The complex tensor :type x: torch.Tensor :returns: The imaginary part of `x`; will have one less dimension than `x`. :rtype: torch.Tensor """ return x[1, ...]
5,291,236
def flatten( input_name, schema=None, output_name=None, output_format="all", main_sheet_name="main", root_list_path="main", root_is_list=False, sheet_prefix="", filter_field=None, filter_value=None, preserve_fields=None, rollup=False, root_id=None, use_titles=Fals...
5,291,237
def crossing_from_taper(taper=lambda: taper(width2=2.5, length=3.0)) -> Component: """Returns Crossing based on a taper. The default is a dummy taper Args: taper: taper function. """ taper = gf.get_component(taper) c = Component() for i, a in enumerate([0, 90, 180, 270]): _tape...
5,291,238
def test_get_version(): """Version as expected.""" actual = pypyrslack.version.get_version() expected = (f'pypyrslack {pypyrslack.version.__version__} ' f'python {platform.python_version()}') assert actual == expected, "version not returning correctly"
5,291,239
def entry(): """Run when navigating to this page""" if stager.utils.AUTO_ADVANCE: stager.utils.navigator.auto_advance_thread( stager.utils.BUILDER.get_object(START_BUTTON_ID) ) # Update UI elements # Show either an image or default to an emoji if stager.utils.CONFIG.wel...
5,291,240
async def send_group_forward_msg(group_id: int, msg): """ 发送合并转发 (群) """ try: await nonebot.get_bot().call_api('send_group_forward_msg', **{ 'group_id': group_id, 'messages': msg }) except exception.NetworkError as ne: logger.warning(f'向{group_id}发送 合并...
5,291,241
def tag_DU_row_col_header(root, lCells, maxRowSpan): """ Tag the XML nodes corresponding to those cells Modify the XML DOM """ for cell in lCells: lText = MultiPageXml.getChildByName(cell,'TextLine') # HEADER WISE: D CH O if int(cell.get('row')) < maxRowSpan: ...
5,291,242
def unflatten_array(X, N, param_shapes): """Takes flattened array and returns in natural shape for network parameters.""" return [torch.reshape(X[N[i]:N[i + 1]], s) \ for i, s in enumerate(param_shapes)]
5,291,243
def quantize_values(values, centers=None): """On a particular 1d latice, quantize points to nearest Args: values (ndarray[Float]): Array of values to quantize to the centers centers (ndarray[Float]): Center values to quantize to. If None it will attempt to get the centers from the v...
5,291,244
def bs_se(bs_pdf): """ Calculates the bootstrap standard error estimate of a statistic """ N = len(bs_pdf) return np.std(bs_pdf) * np.sqrt(N / (N - 1))
5,291,245
def _create_subnetwork_report_proto(materialized_subnetwork_report): """Creates a Subnetwork proto.""" def _update_proto_map_from_dict(proto, field_name, dictionary): """Updates map field of proto with key-values in dictionary. Args: proto: the proto to be updated in place. field_name: name of...
5,291,246
def parse_timestamp(timestamp, time_format=None): """ parse_timestamp(timestamp, time_format=None) -> struct_time Does NOT raise ValueError. Return None on formatting error. """ if time_format is None: time_format = '%a, %d %b %Y %H:%M:%S %Z' try: return time.strptime(timestamp, time_format) exce...
5,291,247
def decrypt(value): """decoding""" print(value) src = signing.loads(value) print(src) return src
5,291,248
def calculate_activation_statistics(act): """Calculation of the statistics used by the FID. Params: -- images : Numpy array of dimension (n_images, hi, wi, 3). The values must lie between 0 and 255. -- sess : current session -- batch_size : the images numpy array is...
5,291,249
def user_view_list_data(): """ Fixture for testing VideoDetail view permissions with a collection view_list """ video = VideoFactory() collection = video.collection moira_list = factories.MoiraListFactory() collection.view_lists.set([moira_list]) return SimpleNamespace(video=video, moira...
5,291,250
def _fast_spearman(corr_method, x, y, destination): """internal method for calculating spearman correlation, allowing subsititution of methods for calculationg correlation (corr_method), allowing to choose methods that are fast (fast_corr) or tolerant of nan's (nan_fast_corr) to be used """ logger.debug...
5,291,251
def amountValidation(amount, minWithdrawAccount, maxWithdrawAccount, atmCash, accountBalance, minBill): """Validate the amount of money. Args: amount (int): Amount of money. minWithdrawAccount (int): Minimum amount of money allowed to withdraw. maxWithdrawAccount (in...
5,291,252
def _propagate_pairs(pairs, go_dict): """Propagates pairs of annotations - generator. For each pair in an array of annotation pairs, the GO annotations will be replaced by a set of their (recursive) child terms (including itself). Other types of annotations are left untouched, but converted to a 1-mem...
5,291,253
def setup_bigid_for_all_tables(metadata): """ This is more for Base.create_all() usage than for migrations, but still important for that flow. Alembic migrations have a different flow """ tables = metadata.sorted_tables for table in tables: nextbigid_sql = generate_nextbigid_sql_for_tabl...
5,291,254
def catchItem(f, theSpider=None): """Decorador, ejecuta la función parse y procesa el resultado como una lista de items, ejecutando la función 'saveitem' que corresponda.""" def new_f(*args, **kwargs): #print("thepath "+os.getcwd()) #print("the spider") #print(str(theSpider)) ...
5,291,255
def _MatchGlobToken_Fast(line, start_pos): """Returns (id, end_pos).""" tok_type, end_pos = fastlex.MatchGlobToken(line, start_pos) return IdInstance(tok_type), end_pos
5,291,256
def destroy_ball(balle,bodyballe,espace): """detruit une balle de l'espace""" espace.remove(balle,bodyballe)
5,291,257
def copy_source_sse_md5(params, **kwargs): """ S3 server-side encryption requires the encryption key to be sent to the server base64 encoded, as well as a base64-encoded MD5 hash of the encryption key. This handler does both if the MD5 has not been set by the caller specifically if the parameter is ...
5,291,258
def roundoff(a, digit=2): """ roundoff the number with specified digits. :param a: float :param digit: :return: :Examples: >>> roundoff(3.44e10, digit=2) 3.4e10 >>> roundoff(3.49e-10, digit=2) 3.5e-10 """ if a > 1: return round(a, -int(math.log10(a)) + digit -...
5,291,259
def describe_elasticsearch_domains(DomainNames=None): """ Returns domain configuration information about the specified Elasticsearch domains, including the domain ID, domain endpoint, and domain ARN. See also: AWS API Documentation :example: response = client.describe_elasticsearch_domains( ...
5,291,260
def trial(car, initial, change, verbose=False): """Perform the simulation of one trial Parameters ---------- car : int The door the car is behind (1, 2 or 3) initial : int The player's initial door selection (1, 2 or 3) change : bool If true, the player will change their...
5,291,261
def imgMI(inImg, refImg, inMask=None, refMask=None, numBins=128, samplingFraction=1.0): """ Compute mattes mutual information between input and reference images """ # In SimpleITK the metric can't be accessed directly. # Therefore we create a do-nothing registration method which uses an ...
5,291,262
def force_exit(cmd, ctx): """Command function to force immediate exit. """ print("Exiting...") sys.exit()
5,291,263
def natsort(alist): """ Sort the given iterable in the way that humans expect. From: https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python """ convert = lambda text: int(text) if text.isdigit() else text alphanum_key = lambda key: [convert(c) for c in re.spli...
5,291,264
def charge_range_(lo, hi, step=None): """Generate a sequence of successive charge states, automatically deducing the polarity of the charge range to infer the step. Parameters ---------- lo : int The smallest magnitude charge (positive or negative) hi : int The largest magnitude...
5,291,265
def get_field(data, ml=0, member=None): """ Arguments: data: N-D array of data ml: Prefer this model level, if there are several levels Returns: np.array: 3D array: Time X, Y """ if(len(data.shape) == 4): # Extract the right model level, if multip...
5,291,266
def predict_with_lgbm_meter(test_df, row_ids, model_filepath): """" Takes a given directory which contains four models (one for each meter type) and then predicts the rows with the respective model :param test_df: DataFrame containing the test data :param row_ids: A vector with the matching row ids ...
5,291,267
def validate_unreal_paths(properties): """ This function checks each of the entered unreal paths to see if they are correct. :param object properties: The property group that contains variables that maintain the addon's correct state. :return bool: True if the objects passed the validation. """...
5,291,268
def com_google_fonts_check_073(ttFont): """MaxAdvanceWidth is consistent with values in the Hmtx and Hhea tables?""" hhea_advance_width_max = ttFont['hhea'].advanceWidthMax hmtx_advance_width_max = None for g in ttFont['hmtx'].metrics.values(): if hmtx_advance_width_max is None: hmtx_advance_width_max...
5,291,269
def parse_args(): """Parse the command line arguments and perform some validation on the arguments Returns ------- args : argparse.Namespace The namespace containing the arguments """ parser = ArgumentParser( description='''Run GIST calculations through command-line.''') ...
5,291,270
def parse_labels_yolo(label_file, labels, img_width, img_height): """ Definition: Parses label files to extract label and bounding box coordinates. Converts (x1, y1, x1, y2) KITTI format to (x, y, width, height) normalized YOLO format. Parameters: label_file - file with KITTI label(s) inside labels - list ...
5,291,271
def reverseString(s): """ Do not return anything, modify s in-place instead. """ for i in range(len(s)//2): s[i], s[len(s) - 1 - i] = s[len(s) - 1 - i], s[i]
5,291,272
def set_log_level(log_level: Optional[int] = None): """Set log level of Rasa and Tensorflow either to the provided log level or to the log level specified in the environment variable 'LOG_LEVEL'. If none is set a default log level will be used.""" import logging if not log_level: log_level ...
5,291,273
def build_dict(min_word_freq=50, train_filename="", test_filename=""): """ Build a word dictionary from the corpus, Keys of the dictionary are words, and values are zero-based IDs of these words. """ with open(train_filename) as trainf: with open(test_filename) as testf: word_fr...
5,291,274
def create_images_test_data(sqla): """The function that creates test data in the correct order """ create_multiple_images(sqla, 15) create_images_events(sqla, 0.75) create_images_people(sqla, 0.75) create_images_courses(sqla, 0.75) create_images_groups(sqla, 0.75) create_images_locations(sql...
5,291,275
def test_investpy_news(): """ This function checks that investpy news retrieval functionality works as expected. """ params = [ { 'time_zone': None, 'time_filter': 'time_only', 'countries': ['spain', 'france'], 'importances': ['high', 'low'], ...
5,291,276
def deltaG_fwd(model, sys_params) -> Tuple[Tuple[float, List], np.array]: """same signature as DeltaG_from_results, but returns the full tuple""" results = run_model_simulations(model, sys_params) return _deltaG_from_results(model=model, results=results, sys_params=sys_params)
5,291,277
def work(botname, type, channel, result, item, *args, **kwargs): """ worker function used in defer. """ watcher.work(botname, type, channel, result, item, *args, **kwargs)
5,291,278
def parse_iso8601tz(date_string): """return a datetime object for a string in ISO 8601 format. This function parses strings in exactly this format: '2012-12-26T13:31:47.823-08:00' Sadly, datetime.strptime's %z format is unavailable on many platforms, so we can't use a single strptime() call. "...
5,291,279
def sp_compute_adj_att(node_features, adj_matrix_sp): """Self-attention for edges as in GAT with sparse adjacency.""" out_dim = node_features.shape[-1] # Self-attention mechanism a_row = tf.get_variable( initializer=WEIGHT_INIT, dtype=tf.float32, name='selfatt-row', shape=(out_dim, 1)) ...
5,291,280
def mat_mul2(A, B, alpha=1): """ https://www.benjaminjohnston.com.au/matmul """ return alpha * np.matmul(A, B) # return LA.blas.sgemm(alpha, A, B)
5,291,281
def observation_encoder(o): """ """ with tf.variable_scope('observation_encoder_module'): std1 = tf.nn.space_to_depth(o, 4) cs1 = conv_stack(std1, 3, 16, 5, 16, 3, 64) std2 = tf.nn.space_to_depth(cs1, 2) cs2 = conv_stack(std2, 3, 32, 5, 32, 3, 64) e = tf.nn.relu(cs2) ...
5,291,282
def getSuperUserTimezone(): """ For the calculation of correct datetimes for payment gateways on when exactly to charge recurring payments Assumption: the superuser has set the correct local timezone which matches with the payment gateway's timezone setting """ su = User.objects.get(is_superuser=1) ...
5,291,283
def empirical(datafile,vavg,crew,rigging,tstroke,trecovery,doplot=1): """ Reads in empirical acceleration data to be compared with acceleration plot """ lin = rigging.lin lscull = rigging.lscull lout = lscull - lin tempo = crew.tempo mc = crew.mc mb = rigging.mb Nrowers = r...
5,291,284
def dup_zz_factor(f, K): """ Factor (non square-free) polynomials in `Z[x]`. Given a univariate polynomial `f` in `Z[x]` computes its complete factorization `f_1, ..., f_n` into irreducibles over integers:: f = content(f) f_1**k_1 ... f_n**k_n The factorization is computed by redu...
5,291,285
def register_space(name, ctor): """Registers a model dynamically.""" _spaces[name] = ctor
5,291,286
def non_net_metering(tfr_dfs): """ Transform the EIA 861 Non-Net Metering table. Args: tfr_dfs (dict): A dictionary of transformed EIA 861 DataFrames, keyed by table name. It will be mutated by this function. Returns: dict: A dictionary of transformed EIA 861 dataframes, ke...
5,291,287
def create_user(**params): """Create and return a new user.""" return get_user_model().objects.create_user(**params)
5,291,288
def create_inventory_vm(config, machines): """Create ansible inventory for setting up Kubernetes and KubeEdge, so ssh to all VMs is needed Args: config (dict): Parsed configuration machines (list(Machine object)): List of machine objects representing physical machines """ logging.info("...
5,291,289
def cancel_fitting_fields(plotgui, nsets): """ Clear the set fitting results. This routine will "clear" the fitting data sets. This is done by reverting the plotgui.nsets value to what it was before the fitting was started. Hence all the fitting data sets are still present but are not plotted...
5,291,290
def answer_counts(answers): """Rank the most popular answers to a question, given a per-student mapping of answers to questions from final_answers_from_df() TODO: Make this into an expectation maximization problem instead to find source reliability, and then also return source (student) reliabilit...
5,291,291
def create_configuration() -> Config: """Create and populate the configuration.""" return Config(dict(os.environ))
5,291,292
def napari_get_reader(path): """Show OME XML if an ome.xml file is dropped on the viewer.""" if isinstance(path, str) and path.endswith("ome.xml"): return view_ome_xml
5,291,293
def Hx(sk, messages): """A helper function Hx""" assert len(messages) == len(sk) - 1 total = sk[0] for xi, mi in zip(sk[1:], messages): total = total + (xi * mi) return total
5,291,294
def main(): """ run codes! """ tagger = Mecab() if 'kr' in sys.argv else None pairs = read_files(READ_PATH, tagger=tagger) if '-min_w' in sys.argv and '-max_w' in sys.argv: pairs = filter_pairs(pairs, MIN_WORD, MAX_WORD) if '-r' in sys.argv: pairs = [[t, s] for s, t in ...
5,291,295
def main(): """Tea-Leaf Classification""" st.title('Tea-Leaf Classification') st.write('*Classify tea leaves based on region and category*') # select leaf category categories = ['Fresh', 'Withered'] choice = st.sidebar.selectbox('Select Category', categories) if choice == 'Fresh': ...
5,291,296
def rpc_context_span_extractor(context): """ Extract and create Span object from context object. Expects context object to have span attribute. :param context: :return: opentracing.span.Span object """ log.debug("In rpc_context_span_extractor...") try: # If context object...
5,291,297
def _unsur(s: str) -> str: """Merge surrogates.""" return s.encode("utf-16", "surrogatepass").decode("utf-16", "surrogatepass")
5,291,298
def chatload(): """ Load all chat messages on a conversation channel """ rq = RequestData(request) channel = rq["channel"] if not channel: # We must have a valid channel return jsonify(ok=False) user_id = current_user_id() game = None if channel.startswith("game:"): ...
5,291,299