content
stringlengths
22
815k
id
int64
0
4.91M
def shuffle_list(elements: List[Any]) -> List[Any]: """ Shuffle the input list in random order :param elements: List to be reshuffled :return: reshuffled list """ random.shuffle(elements) return elements
5,299,300
def get_time_range(xml_path): """ Get the first and last timepoint present. Arguments: xml_path (str): path to the xml file with the metadata """ root = ET.parse(xml_path).getroot() seqdesc = root.find('SequenceDescription') tpoints = seqdesc.find('Timepoints') first = int(tpoints.f...
5,299,301
def url_decode(string: str) -> str: """Decodes a url escaped string""" return __ulp.unquote(string)
5,299,302
def pool_output(shape, Kernel, Padding=(0, 0, 0), Stride=(1, 1, 1)): """ Z : depth Y : height X : width P : padding K : kernel """ Z, Y, X = shape Z_out = math.floor(((Z + 2 * Padding[0] - (Kernel[0] - 1) - 1) / Stride[0]) + 1) Y_out = math.floor(((Y + 2 * Padding[1] - (Kernel[1...
5,299,303
def get_channel_dir(channel): """ Returns the directory containing the channel data file(s) which is: - <self.base_dir>/input/data/<channel> Returns: (str) The input data directory for the specified channel. """ return os.path.join(INPUT_DATA_PATH, channel)
5,299,304
def run_riemannian_revolute_experiment( graph: RobotGraph, solver: RiemannianSolver, n_per_dim: int, D_goal, Y_goal, ee_goals: dict, Y_init: dict, T_goal=None, use_limits: bool = False, verbosity=2, do_bound_smoothing: bool = False, pose_goals: bool = False, ) -> pd.DataF...
5,299,305
def generate_translations(existing_codelist_filename, output_filename, lang): """Generate an Excel translations file from an existing XML file""" parser = etree.XMLParser(remove_blank_text=True) codelist_xml_file = open(existing_codelist_filename) codelist_xml = etree.parse(codelist_xml_file, parser...
5,299,306
def reserve_vxlan(db_session, network_profile): """ Reserve a VXLAN ID within the range of the network profile. :param db_session: database session :param network_profile: network profile object """ seg_min, seg_max = get_segment_range(network_profile) segment_type = c_const.NETWORK_TYPE_OV...
5,299,307
def _make_pink_noise(T,rms_normalization=False): """ Makes a segment of pink noise length T and returns a numpy array with the values Parameters ---------- T : int length of the pink noise to generate rms_normalization : float normalization factor for the pink noise, ie the rms ...
5,299,308
def merge_sort(array): """ ### Merge sort Implementation of one of the most powerful sorting algorithms algorithms.\n Return a sorted array, """ def merge(L, R): res = [] left_ind = right_ind = 0 while left_ind < len(L) and right_ind < len(R): ...
5,299,309
def add_paginate_all(method: str = 'page'): """Decorator that adds auto-pagination support, invoked by passing ``page='all'`` to the wrapped API function. """ def decorator(func): @wraps(func) def wrapper(*args, **params): if params.get('page') == 'all': retu...
5,299,310
def meets_version(version, meets): """Check if a version string meets a minimum version. This is a simplified way to compare version strings. For a more robust tool, please check out the ``packaging`` library: https://github.com/pypa/packaging Parameters ---------- version : str Ver...
5,299,311
def get_model(cfg): """Gets the model class specified in the config.""" err_str = "Model type '{}' not supported" assert cfg.MODEL.TYPE in _models.keys(), err_str.format(cfg.MODEL.TYPE) return _models[cfg.MODEL.TYPE]
5,299,312
def shift_message(text: str, key: str, mode: str) -> str: """Perform the letter shifting for the polyalphabetic substitution cipher (e.g. Vigénere). Args: text (str): The string that is being shifted. key (str): The key used to shift the string. mode (str): The mode (either "encrypt" or...
5,299,313
def get_train_infos(host_api, login, password, gare, depart): """Retrieve the data provided by the SNCF API. :param host_api: Host of the SNCF API, protocol (HTTP or HTTPS) more an IP or a domain name. :type host_api: str :param login: Login for the SNCF API. :type login: str :param password:...
5,299,314
def week(event): """ show last week's logged objects. """ if not event._parsed.rest: event.reply("week <key>") return event._parsed.start = to_day(day()) - 7 * 24 * 60 * 60 event._parsed.end = time.time() nr = 1 for obj in storage.selected(event): event.display(obj, event...
5,299,315
def test_generate_timestamp(): """Test generate the timestamp for verification.""" assert isinstance(signature.generate_timestamp(), str)
5,299,316
def test_superuser_service_account_login( docker_backend: ClusterBackend, artifact_path: Path, request: SubRequest, log_dir: Path, rsa_keypair: Tuple[str, str], jwt_token: Callable[[str, str, int], str] ) -> None: """ Tests for successful superuser service account login which asserts ...
5,299,317
def mat_err_compare(nuc_keys, threshold=1e-3): """This returns a generator that compares the origen decayed material to the pyne material decay. The comparison stores: * the material key, matkey * the parent nuclide, nuc * the decay time, t * the maximum relative error over all nuclides, relerr...
5,299,318
def haproxy_username() -> str: """Retrieve the name of the user to use for authentication to the secure haproxy service.""" return _haproxy_username(scale_factor=1)[0]
5,299,319
def test_fit_wrong_type(som_estimator): """Test the raise of type error when fit method is invoked.""" with pytest.raises(TypeError): clone(GSOMO).set_params(som_estimator=som_estimator).fit(X, y)
5,299,320
def hue_lite(rgb: np.ndarray, alpha: np.ndarray, beta: np.ndarray) -> np.ndarray: """色相の変更の適当バージョン。""" assert alpha.shape == (3,) assert beta.shape == (3,) assert (alpha > 0).all() ma = 3 / (1 / (alpha + 1e-7)).sum() mb = np.mean(beta.astype(np.float32)) return to_uint8(rgb.astype(np.float32...
5,299,321
def test_rr2phi(): """Test that we can handle this RR2.""" utcnow = utc(2021, 9, 20, 5, 10) prod = parser(get_test_file("SHEF/RR2PHI.txt"), utcnow=utcnow) assert len(prod.data) == 560
5,299,322
def get_wow_config(pricer_path: Path) -> Dict[str, Any]: """Gets the pricer config file.""" try: with open(pricer_path, "r") as f: path_config = json.load(f) except FileNotFoundError: logger.error("Pricer config does not exist") path_config = {"base": ""} return path_...
5,299,323
def materialize_computation_from_cache( factory_func, cache, arg_spec, **factory_kwargs): """Materialize a tf_computation generated by factory_func. If this function has already been called with a given combination of factory_func, arg_spec, and factory_kwargs, the resulting function proto & type spec wi...
5,299,324
def extract_audio(file_path, format: str="wav"): """ Extract audio from video. Args: file_path: File path for the video clip. Returns: mv_audio_file: Audio file path extracted. """ print(f"Extracting audio from {file_path}") mv = mp.VideoFileClip(f...
5,299,325
def flash_message(message, category="message"): """flash message""" return flash(message, category)
5,299,326
def test_ddp_sampler_error(): """ Make sure DDP + AMP work :return: """ if not torch.cuda.is_available(): warnings.warn('test_amp_gpu_ddp cannot run. Rerun on a GPU node to run this test') return if not torch.cuda.device_count() > 1: warnings.warn('test_amp_gpu_ddp cannot...
5,299,327
def RectangleCommandAddLowerRight(builder, lowerRight): """This method is deprecated. Please switch to AddLowerRight.""" return AddLowerRight(builder, lowerRight)
5,299,328
def train_model(concepts, verify_videos, model_name, collection_ids, min_examples, epochs, download_data=True, verified_only=False, include_tracking=True): """ Trains the model, uploads it...
5,299,329
def transform_row_into_list(row): """This function transform a row into a named tuple""" result = row.strip('\n').split(',') return result
5,299,330
def main(): """Main function called when script run""" parser = ArgumentParser( description=DESC, epilog="""https://github.com/codethechange/mobility_pipeline""", ) parser.add_argument("country_id", action="store", help="Uniquely identifies country data in DATA_PA...
5,299,331
def split_col_row(ref): """Split the letter and number components of a cell reference. Examples: >>> split_col_row('A1') ('A', 1) >>> split_col_row('B100') ('B', 100) >>> split_col_row('CC12') ('CC', 12) """ head = ref.rstrip("0123456789") tail = ref[...
5,299,332
def home(request): """render contact form if a form is submitted check if it is valid and save it """ ci = RequestContext(request) tmpl = {} if request.method == 'POST': form = MessageForm(request.POST) if form.is_valid(): message = Message( name=...
5,299,333
def test_get_method_returns_value_in_hash_table(empty_hash_table): """Test set method adds value to hash table.""" empty_hash_table.set('cat', 2) assert empty_hash_table.get('cat') == 2
5,299,334
def returnModelFit(data, theta, **kwargs): """ Function to be fed into the MCMC. Input: 'data' : spectrum obj of data 'params' : parameters to synthesize a model with 'makeModel' Output: 'chi' : chi-squared fit between data and synthesized model """ params = kwargs.get('params') lsf = kwargs.get('ls...
5,299,335
def update_subjects(subjects: List[Dict[str, str]]) -> None: """ 更新subject """ url_path = "/api/v1/web/subjects" return _call_iam_api(http_put, url_path, data=subjects)
5,299,336
def test_rdm1234(c_or_python): """Test computation of 1-, 2-, 3- and 4-RDM""" fqe.settings.use_accelerated_code = c_or_python norb = 2 nelec = 2 loader = FqeDataSetLoader(nelec, norb) test = loader.get_fqe_data_set() od1, od2, od3, od4 = test.rdm1234() rd1 = loader.get_rdm(1) rd2 = ...
5,299,337
def get_mapping(from_file=None, resource_ids=None, pyrog_client=None): """ Get all available resources from a pyrog mapping. The mapping may either come from a static file or from a pyrog graphql API. Args: source_name: name of the project (eg: Mimic) from_file: path to the static f...
5,299,338
def channel_response_callback(container, channels): """ A callback to give back a canned response for regex matches in channels """ payload = container.payload logger.debug('channel response callback text: {}'.format(payload['text'])) logger.debug('channel response payload: {}'.format( j...
5,299,339
def featurize_training_examples( training_examples: List[Message], attributes: List[Text], entity_tag_specs: Optional[List["EntityTagSpec"]] = None, featurizers: Optional[List[Text]] = None, bilou_tagging: bool = False, ) -> Tuple[List[Dict[Text, List["Features"]]], Dict[Text, Dict[Text, List[...
5,299,340
def CreateNewSmtpUser(connection, user, password): """Creates a new SMTP user via the administration server. Args: connection: An open socket to the administration server. user: The user's username. password: The user's password. """ payload = ['adduser %s %s' % (user, password), 'qui...
5,299,341
def configure_agent(filename): """ Configure Agent Core with configuration file specified by filename. :param filename: name of the configuration file needed to configure the Agent Core :type filename: str :return: Agent Core configured :rtype: AgentCore """ try: config = config...
5,299,342
def load_fishcatch(): """Missing values were imputed with -1!""" module_path = dirname(__file__) data, target = load_data(module_path, 'fishcatch.csv', is_classification=False) return data, target
5,299,343
def ClassifyRspecifier(rspecifier): """Interprets type / filename / options for the given rspecifier. Args: rspecifier: A string indicating the rspecifier. Returns: (RspecifierType, filename, RspecifierOptions) for the given filename. Note: We also allow the meaningless prefix...
5,299,344
def cross_validation(x_tra, y_tra): """ The method performs 5-fold cross-validation on training data and returns the error rates. Parameters ---------- x_tra: features of training data y_tra: labels of training data """ errors = [] maes = [] pcc = [] X = x_tra Y = y_tra...
5,299,345
def lduG(G): """ G a Cell object containing AtA + rhoI matrices. The A matrices are the PSF matrices, I is the identity matrix and rho is the ADMM timestep. """ nr, nc = G.getCellsShape() mshape = G.getMatrixShape() assert (nr == nc), "G Cell must be square!" nmat = nr # C...
5,299,346
def generate_test_input(name, test_class): """Generate the test input for @J2clTestInput. This will triggers processing the test class. Args: name: target name. test_class: the test class to be processed. Returns: J2clTestInput java src file which will be used to generate adapt...
5,299,347
def drive_needs_mounting(mapper_device): """ Check if an encrypted drive can be mounted directly. :param mapper_device: The pathname of the device mapper device (a string). :returns: ``True`` if the drive should be mounted, ``False`` otherwise. """ if any(fs.device_file == mapper_device for fs ...
5,299,348
def setxy(x: float, y: float): """ Set the turtle's current position to point (x,y). Will not leave traces. :param x: x coordinate value of the destination point. :param y: y coordinate value of the destination point. """ _check_turtle() _turtle.setxy(x, y)
5,299,349
def cred(): """administrate user credentials."""
5,299,350
def check_if_string_in_file( file_name: str, string_to_search: str, search_flag: int = 0 ) -> bool: """Check if any line in the file contains given string""" with open(file_name, "r") as read_obj: file_data = read_obj.read() if re.search(string_to_search, file_data, flags=search_flag): ...
5,299,351
def single_performance_metric(actual, predicted): """Weighted F1_score Arguments: actual: numpy array --> Array containing actual labels. predicted: numpy array --> Array containing predicted labels. Returns: f1_score: float --> Weighted F1_score. """ return f1_score(actua...
5,299,352
def conformalset(X, y, model, alpha=0.1, gamma=None, tol=1e-3, nqp=10, algo=None, stat=False): """ Compute full conformal prediction set with root-finding solver. Parameters ---------- X : {array-like}, shape (n_samples, n_features) Training data. y : ndarray, shape = (n_sa...
5,299,353
def indentlevel(line): """Return the indent level of a line""" m = re_indent.match(line) if not m: return 0 return len(m.group(0))
5,299,354
def approximate_moment( distribution, k_loc, order=None, rule="fejer", **kwargs ): """ Approximation method for estimation of raw statistical moments. Uses quadrature integration to estimate the values. Args: distribution (Distribution): Dist...
5,299,355
def get_projects_from_sln_file(path: str) -> List[str]: """ Gets the projects defined in a sln file. :param path: The path of a Visual Studio sln file. """ with open(path, "r", encoding="utf-8") as file: return list(get_projects_from_sln_file_contents(file.read()))
5,299,356
def get_bar_yz_transform(v, ihat, eid, n1, n2, nid1, nid2, i, Li): """helper method for _get_bar_yz_arrays""" vhat = v / norm(v) # j try: z = np.cross(ihat, vhat) # k except ValueError: msg = 'Invalid vector length\n' msg += 'n1 =%s\n' % str(n1) msg += 'n2 =%s\n' % str(...
5,299,357
def solve(): """Connect to the server and return the solving maneuver.""" display.delete(1.0, END) # clear output window try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error: show_text('Failed to create socket') return # host = 'f9f0b2jt6zmzyo6b.myf...
5,299,358
def pca_solve(newflux, newivar, maxiter=0, niter=10, nkeep=3, nreturn=None, verbose=False): """Replacement for idlspec2d pca_solve.pro. Parameters ---------- newflux : array-like The input spectral flux, assumed to have a common wavelength and redshift system. newivar ...
5,299,359
def __set_system_proxy__(sysinfo): """ :return: """ proxy_string = """http_proxy="http://127.0.0.1:8118" https_proxy="http://127.0.0.1:8118" ftp_proxy="http://127.0.0.1:8118" HTTP_PROXY="http://127.0.0.1:8118" HTTPS_PROXY="http://127.0.0.1:8118" FTP_PROXY="http://127.0.0.1:8118" _JAVA_OPTIONS="-Dhttp.p...
5,299,360
def list_models(): """ list model zoo """ zoo_config = os.path.join(model_zoo_path) zoo_config = yaml.load(open(zoo_config, 'r'), Loader=yaml.FullLoader) custom_zoo_config = yaml.load(open(custom_zoo, 'r'), Loader=yaml.FullLoader) if cus...
5,299,361
def extract_post_info(browser): """Get the information from the current post""" post = browser.find_element_by_class_name('_622au') print('BEFORE IMG') imgs = post.find_elements_by_tag_name('img') img = '' if len(imgs) >= 2: img = imgs[1].get_attribute('src') likes = 0 if len(post.find_elements...
5,299,362
def fact(): """Returns the Node.js version if installed""" version = "None" binary = "/usr/local/bin/node" if os.path.exists(binary): try: cmd = [binary, "--version"] proc = subprocess.check_output(cmd) version = proc[1:].strip() except: pa...
5,299,363
def _link(filename, existing_filename): """symlink(source, link_name) Creates a symbolic link pointing to source named link_name""" CreateHardLinkW(filename, existing_filename, 0)
5,299,364
def TL2Q(T=None, L=None): """ Compute Q from angle and wavelength. Q = 4 pi sin(T) / L Returns Q in inverse Angstroms. """ return 4 * pi * sin(radians(T)) / L
5,299,365
def StationGroup_Meta(): """StationGroup_Meta() -> MetaObject""" return _DataModel.StationGroup_Meta()
5,299,366
def query_identifiers( object_type, object_ids, db_from, db_to, max_separation=3 ): """Return id for given metabolite from the corresponding database. :param object_type: The type of the object, e.g. Metabolite, Gene or Reaction. :param object_ids: list of identifiers :param db_from: databa...
5,299,367
def FiterHeteSnp(args): """ Filter heterozygous snp variant for training, if there are too many candidates for full alignment training, we would select more in low quality variants, which is more challenging for pileup model to predict and using more information will benefit calling those variants. ...
5,299,368
def _PF(dataset): """ Mandible Postured Forward """ dataset.FunctionalCondition = _get_sct_code_sequence('787611004', 'Photographic image extraoral with mandible postured forward (record artifact)')
5,299,369
def MROMerge(input_seqs): """Merge a sequence of MROs into a single resulting MRO. Args: input_seqs: A sequence of MRO sequences. Returns: A single resulting MRO. Raises: MROError: If we discovered an illegal inheritance. """ seqs = [Dedup(s) for s in input_seqs] try: return visitors.Me...
5,299,370
def handCard(handPos, game): """ Return the value of indexed card in player's hand :param handPos: :param game: :return: """ return game.players[game.whoseTurn].handCards[handPos]
5,299,371
def set_button_states( component_tree_view: QTreeView, delete_action: QAction, new_rotation_action: QAction, new_translation_action: QAction, create_link_action: QAction, zoom_action: QAction, edit_component_action: QAction, ): """ Changes the button states based on user interaction ...
5,299,372
def create_config_file(config): """Create config file with given contents.""" with open(conf_file_name, 'w') as conf_file: conf_file.write(config) return conf_file_name
5,299,373
def delete_table_info(data_source_id: int, schema: str, table: str): """Delete the table info from the metadata of the given data source and table""" data_source_metadata: DataSourceMetadata = ( DataSourceMetadata.query.filter( DataSourceMetadata.data_source_id == data_source_id, ...
5,299,374
def deregister_all_services(): """De-register all existing services""" _registered_services.clear()
5,299,375
def countHostBits(binaryString): """ This will calculate the number of host bits in the mask """ # count the number of 0s in the subnet string return binaryString.count('0')
5,299,376
def core_pipeline(fasta_dir: Path, outdir: Path, n_cpu: int, n_cpu_pickbest: int, min_seq_id: float, coverage_length: float, medoid_repseqs: bool, pairwise: bool): """ Generates a core genome and reports """ main_log = logging.getLogger('main_log') main_log.debug(f"minimum sequence identit...
5,299,377
def load_aws_environment_file(credential_file=None, profile='default'): """Set local environment variables. Can be run alone if credential_file already created. :type credential_file: file :param credential_file: A non-suffixed file containing access key, secret access key, and profiles. ...
5,299,378
def diskthick(): """ A test procedure to demonstrate the KinMS code, and check if it works on your system. This procedure demonstrates how to create a simulation of an exponential disk of molecular gas with a thickness that varies with radius. Any default parameters can be changed by specifying them at ...
5,299,379
def predict_structure( fasta_path: str, fasta_name: str, output_dir_base: str, data_pipeline: pipeline.DataPipeline, model_runners: Dict[str, model.RunModel], amber_relaxer: relax.AmberRelaxation, benchmark: bool, random_seed: int): """Predicts structure using AlphaFold for...
5,299,380
def _serve_logs(skip_serve_logs: bool = False) -> Optional[Process]: """Starts serve_logs sub-process""" if skip_serve_logs is False: sub_proc = Process(target=serve_logs) sub_proc.start() return sub_proc return None
5,299,381
def sincos_func(x_data, a, b): """ Computes the function a * sin(b * x) + b * cos(a * x) Args: x_data : A Numpy array of input data a : Real-valued argument of the function b : Real-valued argument of the function Returns: A Numpy array of values of the function a * sin(b * ...
5,299,382
async def test_form_duplicated_id(hass: HomeAssistant) -> None: """Test setting up duplicated entry.""" entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONFIG ) ...
5,299,383
def build_model_modified_field_list(queryset): """ Setup the field list for a 'modified' api query, add any Foreign Key field names """ fields = list() fields.append('id') fields.append('modified') if not queryset: return fields try: for field in queryset.model._meta.local_fie...
5,299,384
def convert(md_text): """ Convert markdown string to html format :param md_text: str, the markdown file :return: str, the html content """ # separate by line md_text = md_text.split('\n') # save the html content for return html_text = '' # begin looping from the first line ind...
5,299,385
def interpolate_model(cat_file: str, names: Union[str, list]) -> Dict[str, np.ndarray]: """Interpolates 2D model field into dense Cloudnet grid. Args: cat_file: Categorize file name. names: Model variable to be interpolated, e.g. 'temperature' or ['temperature', 'pressure']. Returns: ...
5,299,386
def should_retry_request(req): """ Whether should retry this request. :param request: Request as a dictionary. :returns: True if should retry it; False if no more retry. """ if req['state'] == RequestState.SUBMITTING: return True if req['state'] == RequestState.NO_SOURCES or req['st...
5,299,387
def test_gauss1D(): """ Tests for Gabor low-pass - Make sure that it has a fast decay in time - Make sure that it is symmetric, up to 1e-7 absolute precision """ N = 2**13 J = 7 sigma0 = 0.1 tol = 1e-7 for j in range(1, J + 1): sigma_low = sigma0 / math.pow(2, j) ...
5,299,388
def getSiteStore(store): """ Given C{store} find the site store. """ siteStore = store while siteStore.parent: siteStore = siteStore.parent return siteStore
5,299,389
def main(): """Clear the data directory of all downloaded data """ folder = str(Path().resolve().parent) + "/data/" for filename in os.listdir(folder): file_path = os.path.join(folder, filename) try: if os.path.isfile(file_path) or os.path.islink(file_path): ...
5,299,390
def fit_aerofoil(xy, chi, zte, order): """Fit Bernstein polynomial coefficients for both aerofoils surfaces.""" n = order - 1 dx = 0.02 # When converting from real coordinates to shape space, we end up with # singularities and numerical instability at leading and trailing edges. # So in these ca...
5,299,391
def _validate_lgblock(val): """ Validate that the lgblock setting is valid. """ if (val != 0) and not (16 <= val <= 24): raise error( "%d is not a valid lgblock, must be either 0 or between 16 and 24" % val )
5,299,392
def process_stocks(list_of_stocks: List[str], period: str = "3mo") -> pd.DataFrame: """Get adjusted closing price for each stock in the list Parameters ---------- list_of_stocks: List[str] List of tickers to get historical data for period: str Period to get data from yfinance R...
5,299,393
def get_file_handle(file_path, compression): """ Returns a file handle to the given path. :param file_path: path to the file to open :param compression: indicates whether or not the input file is compressed :return: a file handle to file_path """ if compression: return gzip.open(fil...
5,299,394
def solve(firewall): """Return severity if the trip through the firewall. :firewall: list of depth and range of the scanner (separated by a colon) for each layer (separated by newline) :returns: severity of a trip >>> solve('''0: 3 ... 1: 2 ... 4: 4 ... 6: 4''') 24 "...
5,299,395
def cputime(t=0, subprocesses=False): """ Return the time in CPU seconds since Sage started, or with optional argument ``t``, return the time since ``t``. This is how much time Sage has spent using the CPU. If ``subprocesses=False`` this does not count time spent in subprocesses spawned by Sage ...
5,299,396
def change_string_in_file(filename: str, old_string: str, new_string: str): """Replaces old_string with new_string from filename and saves the result to that file""" with open(filename) as f: content = f.read() if old_string not in content: return with open(filename, 'w') as f: ...
5,299,397
def toggle(request, segment_id): """Toggle the status of the selected segment. :param request: The http request :type request: django.http.HttpRequest :param segment_id: The primary key of the segment :type segment_id: int :returns: A redirect to the original page :rtype: django.http.HttpRe...
5,299,398
def _maketrans_c(arg1, arg2, delete=False): """Make a complement tr table for the 'c' flag. If the 'd' flag is passed, then delete=True. Ranges are expanded in arg1 and arg2 but arg2 is not otherwise normalized""" t = str.maketrans(arg1, arg1) d = dict() for i in range(257): if i not in t...
5,299,399