content
stringlengths
22
815k
id
int64
0
4.91M
def ssim(img1, img2, cs_map=False): """Return the Structural Similarity Map corresponding to input images img1 and img2 (images are assumed to be uint8) This function attempts to mimic precisely the functionality of ssim.m a MATLAB provided by the author's of SSIM https://ece.uwaterloo....
78,300
def websocketUpdate(headers, project): """ Ping an update to the Application Manager for the project """ uploadjson = "{{\"project\": \"{}\", \"source\": \"{}\"}}".format(project, repository_source) url = "http://{}:{}/update_project_tasks".format(settings.app_manager_ip, settings.app_manager_port) rv = request...
78,301
def adpcm2lin(*args, **kwargs): # real signature unknown """ Decode an Intel/DVI ADPCM coded fragment to a linear fragment. """ pass
78,302
def state_processing_exit(app, cfg): """ Generate the QR Code and store it in the application. """ qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=1) if cfg.getboolean("QRCODE",...
78,303
def _hash(host, username, password, hasher_params): """Performs a hash operation on the given host with the given hasher parameters (hasherWsParams) and returns a hasherWsResult record with these fields: - blockFileDataHandler (base64Binary) - blockFileName (string) - bytesHashed (long) - elapse...
78,304
def generate(env): """Add Builders and construction variables for ifort to an Environment.""" # ifort supports Fortran 90 and Fortran 95 # Additionally, ifort recognizes more file extensions. SCons.Tool.SourceFileScanner.add_scanner('.i', fortran.FortranScan) SCons.Tool.SourceFileScanner.add_scanner...
78,305
def l2_distance(x, y): """Computes cosine similarity between all pairs of vectors in x and y.""" x_expanded, y_expanded = x[:, tf.newaxis], y[tf.newaxis, :] return tf.sqrt(tf.reduce_sum((x_expanded - y_expanded)**2, axis=-1))
78,306
def per_device_batch_size(batch_size, num_gpus): """For multi-gpu, batch-size must be a multiple of the number of GPUs. Note that this should eventually be handled by DistributionStrategies directly. Multi-GPU support is currently experimental, however, so doing the work here until that feature is in place. ...
78,307
def bio_delete(ctx, template_id, pin, force): """ Delete a fingerprint. Delete a fingerprint from the YubiKey by its ID, which can be seen by running the "list" subcommand. """ bio = _init_bio(ctx, pin) enrollments = bio.enumerate_enrollments() try: key: Optional[bytes] = bytes...
78,308
def clear_cache(cache_path=APICache.DEFAULT_CACHE_PATH): """Delete the HTTP cache used for the API.""" try: os.unlink(cache_path) print('Cleared cache in "%s"' % cache_path) except Exception as e: logging.error('Could not clear cache in "%s": %s. Try manually ' ...
78,309
def organisation_information_save(request,organisation_id): """ :param request: :param organisation_id: :return: """ # ADD IN PERMISSION CHECKING # Get the form data form = OrganisationForm(request.POST) if not form.is_valid(): return HttpResponseBadRequest(form.errors) ...
78,310
def _monkey_patch_python_domain_to_resolve_params(): """Adds support to the Python domain for resolving parameter references.""" PythonDomain = sphinx.domains.python.PythonDomain # pylint: disable=invalid-name orig_resolve_xref = PythonDomain.resolve_xref def resolve_xref( self: PythonDomain, env: sphi...
78,311
def containerhasprefix(obj, prefix): """ Returns whether obj's container starts with prefix. """ return obj.container.name.startswith(prefix)
78,312
def _variance(mean_variance, samples): """Perform final variance calculations. `mean_variance` and `samples` were pre-recorded with `options.record.reduction._variance`. This operation only calculates total running variance. This function is applied on per-recording basis (per layer to be exact)....
78,313
def export_dict(file_name, dict_): """Serializes a dictionary into a JSON file.""" with open(file_name, 'w') as f_json: json.dump(dict_, f_json, indent=4, sort_keys=True)
78,314
def scalajs_binary(name, srcs, deps, main_class = "auto", main_method = "main", main_method_with_args = True, module_kind = "no-module", scalacopts = [], scala = None, deps_used_whitelist = [], out = "index.js"): """Compiles scalajs sources""" classes = name + "_classes" scalajs_library( name = cla...
78,315
def get_connections_db(ccs_path): """Returns path to connections folder""" conns_path = get_targetDB(ccs_path) + '/' + CONNECTIONS return os.path.normpath(conns_path)
78,316
def trange(*args, **kwargs): """ A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange. """ return tqdm(_range(*args), **kwargs)
78,317
def load_event_schema(event_type, suffix=None): """Load an Avro schema for a Slack Events API event from the local app data. This function is memoized so that repeated calls are fast. Parameters ---------- event_type : `str` Name of an event type, such as ``"message"``. See htt...
78,318
def choose_part_ranges(content_length, minimum_part_size): """ Returns a list of (offset, length) for the parts of a large file. :param content_length: content length value :type content_length: int :param minimum_part_size: a minimum file part size :type minimum_part_size: int :rtype: list...
78,319
def setup_app(command, conf, vars): """Place any commands to setup hola here""" # Don't reload the app if it was loaded under the testing environment load_environment(conf.global_conf, conf.local_conf) # Create the tables if they don't already exist Base.metadata.create_all(bind=Session.bind)
78,320
def line_too_long(editor, item): """ Pylint line-too-long method """ line_no = item.line_no error_text = editor.lines[line_no] new_lines = line_split(error_text, 100) if not new_lines: LOGGER.info("Could not split: {0}".format(error_text)) result = (line_no, 0) else: asse...
78,321
def __process_input_of_start_premises(premisegroups, db_conclusion: Statement, supportive, db_issue: Issue, db_user: User) -> Dict[str, Any]: """ Inserts premises of groups as new arguments in dependence of the input parameters and returns a URL for forwarding. :param ...
78,322
def sampled_softmax(pre_logits, log_std, samples=10): """ Draw samples from gaussian distributed pre-logits and use these to estimate a mean and aleatoric uncertainty. """ # NOTE here as we do not risk dividing by zero should we really be # predicting log_std or is there another way to deal with...
78,323
def load_codebook(experiment_fpath: str, metadata: str) -> dict: """Function used to load the codebooks. It links the channel to the codebook pandas dataframe Args: experiment_fpath (str): Path to the experiment to process metadata (dict): Metadata related to the experiment to process ...
78,324
def main(): """ --------------------------------------- WanderBits: A text-based adventure game --------------------------------------- """ description = 'WanderBits: a text-based adventure game!' parser = argparse.ArgumentParser(description=description) parser.add_argument('--restore'...
78,325
def remove_actions_that_are_not_wildcard_arn_only(db_session, actions_list): """ Given a list of actions, remove the ones that CAN be restricted to ARNs, leaving only the ones that cannot. :param db_session: SQL Alchemy database session object :param actions_list: A list of actions :return: An upda...
78,326
def file_import(**kwargs): """ Fast import of exported log files containing messages from a bus. Optional arguments: - folder (str): Custom folder to import log files from. - limit (int): The maximum number of lines/messages to read each time. Default value is '5000'. - idle_sleep (int): ...
78,327
def cccv(inputs, out, title): """Plot CCCV result(s).""" from phenotrex.io.flat import load_cccv_accuracy_file from phenotrex.util.plotting import compleconta_plot conditions = [Path(str(x)).stem for x in inputs] cccv_results = [load_cccv_accuracy_file(x) for x in inputs] compleconta_plot(cccv_...
78,328
def test_stanford2(): """Test module stanford2.py by downloading stanford2.csv and testing shape of extracted data has 184 rows and 5 columns """ test_path = tempfile.mkdtemp() x_train, metadata = stanford2(test_path) try: assert x_train.shape == (184, 5) except: shutil.rmtree(test_path) r...
78,329
def main(useruid: str, old_passwd: str, new_passwd: str, email: str): """ 修改個資 """ user = User(useruid) session = get_empty_session() session.login( user.userid, old_passwd, session.courses.index(user.course) + 1) if session.active: session = get_session(useruid) i...
78,330
def test_deployment_defaults_for_type_git_quay(mock_time): """Should get defaults for deployment of type git-quay""" # Given: Deployment dictionary deployment = _create_test_deployment() # Mock Time call for creating version mock_time.return_value = 0.1006 # When: I apply defaults for deploym...
78,331
def isexe(fpath): """Test if a file is executable. Parameters ---------- fpath : path_like Path to the file. Returns ------ result : bool Whether the file is executable. """ return path.exists(fpath) and access(fpath, X_OK)
78,332
def check_user_permission(access_token, job_requires): """ Check if user has permission to run the job or not Args: access_token(str): the access token job_requires(dict): requirements so that job can run { "arborist_url": "http://arborist-service", ...
78,333
def FiskJohnsonDiscreteFuncExtrapolate(rho,F0,T): """Extrapolate samples of transform to sequence of target coordinates. Extrapolate sequence of (few) Fourier-Bessel transform samples to sequence of target coordinates following Eq. (9) of Ref. [1]. Args: rho (numpy array, ...
78,334
def media_entity(props): """ Helper to construct elements of the form <embed embedtype="custommedia" id="1"/> when converting from contentstate data """ return DOM.create_element('embed', { 'embedtype': 'wagtailmedia', 'id': props.get('id'), 'title': props.get('title'), ...
78,335
def ws_s_dt_wa_gauss(ws, wa, *params): """Models the function \\[ \\frac{a_2}{1 + e^{a_0 - a_1x}} - a_3x^2 + + a_4\\exp\\left(\\frac{-(y - a_5)^2}{2a_6}\\right) + a_7\\exp\\left(\\frac{-((360 - y) - a_8)^2}{2a_9}\\right) \\] """ wa = np.asarray(wa) return ( s_sha...
78,336
def get_bulk_selections(config: models.Config) -> models.Config: """Gets input in bulk mode if the user wants to only download specific consoles""" print("Press Enter to download all of Vimm's roms or select from the" + " following of what systems you would like to download") print('Enter \'d\' wh...
78,337
def get_version(relpath): """Read version info from a file without importing it""" for line in io.open(join(dirname(__file__), relpath), encoding="cp437"): if "__version__" in line: if '"' in line: return line.split('"')[1] elif "'" in line: return line.split("'")[1]
78,338
def write_all_date(tc, lib=None): """ :param tc: List,所有日期 :param lib: arctic.store.version_store.VersionStore :return: succ: List, written stocks; :return: fail: List, failed written stocks """ succ = [] fail = [] if not os.path.exists(other_dir): os.mkdir(other_dir) ...
78,339
def slice_array_d50(df,idNode): """ This function allows to slice the array resulting from the create_array function. The slicing is performed by a boolean mask in which the array is filtered according to the ID_Node specified by the user and then only the columns corresponding to time and mean diameter...
78,340
def to_upper(string): """The upper case version of a string""" return string.upper()
78,341
def is_printable_as_block_string(value: str) -> bool: """Check whether the given string is printable as a block string. For internal use only. """ if not isinstance(value, str): value = str(value) # resolve lazy string proxy object if not value: return True # emtpy string is prin...
78,342
def inbox(request, search_type='', search_word='', page=0, box=''): """Inbox""" if int(page) < 1: page = 1 list_count = settings.INBOX_LIST_COUNT current_page = int(page) - 1 start_at = current_page * list_count end_at = start_at + list_count if box == 'inbox': sq = (~Q(use...
78,343
def _after_arg(arg_name): """Return a finder for argument after arg_name.""" def generate(transform): """Generate three args, OTHER, arg_name and ARGUMENT.""" return "ONE {0} {1}".format(arg_name, transform("ARGUMENT")) return generate
78,344
def add_logger_to_scribe(logger, log_level=logging.INFO, fmt=DEFAULT_FORMAT, clogger_object=None): """Sets up a logger to log to scribe. By default, messages at the INFO level and higher will go to scribe. .. deprecated:: 0.1.6 .. warning:: This function is deprecated in favor of using :func...
78,345
def load_cifar(dataset="training", path="cifar"): """ The Cifar Loading Method. :param dataset: 'training' or 'testing', depending on the data to load :param path: path to the cifar files :return: X,y: data and labels """ if dataset == "training": X = numpy.ndarray([50000, 3072]) ...
78,346
def test_collect(obj): """ composite |- reader1 |- reader2 (no collect) |- reader3 """ reader1 = mock.Mock() reader2 = mock.Mock() reader3 = mock.Mock() del reader2.collect obj.add(reader1) obj.add(reader2) obj.add(reader3) assert [reader1.collect(),...
78,347
def get_data_files(split, dataset_config): """ Get the path to the dataset (images and labels). 1. If the user has explicitly specified the data_sources, we simply use those and don't do lookup in the datasets registered with VISSL from the dataset catalog. 2. If the user h...
78,348
def setup_api(): """ Initialize and return a Flask-RestX AP :return: """ api_config = CONFIG_UTIL.api_config authorizations = { 'apikey': { 'type': 'apiKey', 'in': 'header', 'name': 'X-Api-Key' } } global API API = Api( ve...
78,349
def create_s3_bucket(session, bname, region): """ IAM Permission Required: - s3:CreateBucket """ try: s3 = session.client('s3') req = { "Bucket": bname, "ACL": "private" } if region != "us-east-1": tmpObj = { "L...
78,350
def compute_predictions(example, n_best_size=10, max_answer_length=30): """ Converts an example into an NQEval object for evaluation. :param example: EvalExample :return: ScoreSummary """ predictions = [] for unique_id, result in example.results.items(): if unique_id not in example....
78,351
def validate_create_namespace(result, name): """ Validation function for integration testcases """ return name in get_system_namespace_list()
78,352
def set_log_level(verbose_count: int) -> None: """Sets the log level. Args: verbose_count: number of `-v` flags used """ if verbose_count > 2: log_level = logging.DEBUG elif verbose_count == 2: log_level = logging.INFO elif verbose_count == 1: log_level = logging...
78,353
def log5(request): """log5 is a version of log3 without conclusion. It is meant for the version that has artificial words as terms in the syllogism.""" if request.method == "GET": bValid = True (usernumber_str, bValid) = getValue(request, u"uid", bValid) (timelapse_str, bValid) = get...
78,354
def load_datasets(args): """load the dataset (ColonDataset) and split the dataset into train and validation set Args: args: arguments from the parser. Return: train_dataset: a dataset for training val_dataset: a dataset for validation """ dataset = ColonDataset( ...
78,355
def read_FMI_weather(ID, start_date, end_date, sourcefile, CO2=380.0): """ reads FMI OBSERVED daily weather data from file IN: ID - sve catchment ID. set ID=0 if all data wanted start_date - 'yyyy-mm-dd' end_date - 'yyyy-mm-dd' sourcefile - optional CO2 - atm. CO2 con...
78,356
def def_array(compiler, name: Var, shape: tuple, buffer: list): """ Array definition ================ 1. Evaluate every shape component 2. Evaluate buffer content 3. Set Array to memory """ ## Evaluates shape values and variables shape = tuple(compiler.eval_expr...
78,357
def _get_unstarted_workflows(): """Get a list of all workflows that should have a cycle started. This function is used for fixing failed cycle starts. Returns: list of workflows that are missing any started cycles. """ return db.session.query(Workflow).filter( Workflow.next_cycle_start_date < date...
78,358
def parse_list(elem): """Parse list of properties. >>> parse_list(ET.XML('<Property />')) [] >>> xml = '''<Property> ... <Property>Hello</Property> ... <Property>World</Property> ... </Property>''' >>> parse_list(ET.XML(xml)) ['Hello', 'World'] """...
78,359
def changelog_contents(changelog_releases: str='') -> str: """ Generate the changelog and return the contents as a string Parameters ---------- changelog_releases: str, optional Comma separated list of releases to include in the changelog. If not provided, will use all the releases...
78,360
def get_notes_by_version(reporoot, notesdir, branch=None): """Return an OrderedDict mapping versions to lists of notes files. The versions are presented in reverse chronological order. Notes files are associated with the earliest version for which they were available, regardless of whether they change...
78,361
def deltaF(int_list, f_0_win=5): """ Function for colculation ΔF/F0 for data series. f_0_win - window for F0 calculation (mean of first 2 values by defoult). """ f_0 = np.mean(int_list[:f_0_win]) return np.asarray([(i - f_0)/f_0 for i in int_list])
78,362
def calculate_rcplvs(lv): """ Convert cartesian lattice vectors to the fractional lattice vectors Args: lv (:py:attr:`array_like`, optional): Lattice vectors Returns: rcplvs (:py:attr:`array_like`, optional): Reciprcocal lattice vectors lengths (:py:attr:`array_like`, optional)...
78,363
async def start_slack_listener(app): """Start the Kafka consumer as a background task (``on_startup`` signal handler). """ app["kafka_consumer_task"] = app.loop.create_task(consume_kafka(app))
78,364
def vprint(threshold, desired, method, *msg): """ Light wrapper for printing that considers verbosity levels @ In, threshold, int, cutoff verbosity @ In, desired, int, requested message verbosity level @ In, method, str, name of method raising print @ In, msg, list(str), messages to print @ Ou...
78,365
def get_src_xyz_from_plane_disparity(meshgrid_src_homo, mpi_disparity_src, K_src_inv): """ :param meshgrid_src_homo: 3xHxW :param mpi_disparity_src: BxS :param K_src_inv: Bx3x3 :return: """ B, S = mpi_disparity_src.si...
78,366
def cancel_export_task(taskId=None): """ Cancels the specified export task. The task must be in the PENDING or RUNNING state. See also: AWS API Documentation :example: response = client.cancel_export_task( taskId='string' ) :type taskId: string :param taskId: ...
78,367
def reduce_loss_dict(loss_dict): """ Reduce the loss dict from all processes so that process with rank 0 has the averaged results. Returns a dict with the same fields as loss_dict, after reduction. """ world_size = get_world_size() if world_size < 2: return loss_dict with torch.no_gr...
78,368
def geoserver_cascading_delete(self, *args, **kwargs): """ Runs cascading_delete. """ lock_id = f'{self.request.id}' with AcquireLock(lock_id) as lock: if lock.acquire() is True: return cascading_delete(*args, **kwargs)
78,369
def create_vat(*, session: Session = Depends(get_session), schema: VatPostingGroupCreate): """«VAT Posting Group» («НДС Учетная Группа»)""" return service.servicetype_s.create(db=session, schema=schema)
78,370
def test_vnic_create_vlan(mocked_vnic_create, capfd): """ vnic creation with valid vlan """ vnic_name = "vnic0" vnic_link = "e1000g0" vnic_vlans = (1, "23", 23, 4094) vnic_temp = (True, False, False, True) for vlan, temp in zip(vnic_vlans, vnic_temp): set_module_args( ...
78,371
def check_dns_cname(domain, prefix, code): """ Validates a domain by checking the existance of the CNAME record on the domain as: {prefix}-{code}.{domain} pointing to a domain (usually yours) which the host is {prefix} (i.e.: {prefix}.yourdomain.com). Returns true if verification suceeded. """ ...
78,372
def editor(): """ editor group. """
78,373
def local_test_pressure_unity(α_spt, p_lt=None, p_li=None, p_e=None, **kwargs): """Local test pressure unity check. Reference: DNVGL-ST-F101 (2017-12) sec:5.4.2.1 eq:5.6 p:93 (local_test_press_unity) """ if p_e is None: p_e = external_pressure(h_l, ρ_seawater, g) if p_lt ...
78,374
def getProgramState(hc, nbuf, wait=SYNCHRONOUS): """Returns program state""" state = ctypes.c_int() acs.acsc_GetProgramState(hc, nbuf, byref(state), wait) return state.value
78,375
def read_specs(path): """ Get all IT declarations from the project looping through each of the spec files """ specs = [] for root, _, files in os.walk(path + '/spec/'): for file in files: if file.endswith(".rb"): file_path = os.path.join(root, file) ...
78,376
def print_report(report, nocolors): """Display report about number of passes and failures.""" # First of all, we need to setup colors to be displayed on terminal. Colors # are displayed by using terminal escape control codes. When color output # are not enabled on command line, we can simply use empty s...
78,377
def ip( source=None, source_hex=None, destination=None, destination_hex=None, version=None, ihl=None, tos=None, p=None, p_str=None, d=None, d_str=None, t=None, t_str=None, r=None, r_str=None, tl=None, id=None, flg=None, flg_str=None, frg=None, ttl=None, pro=None, sum=None, su...
78,378
def default_dict(_cls): """ Decorator that it create DefaultDict by attribute of class. Support attribute alias: @attrdict.default_dict class CustomDict: a=1 b=2 custom_dict = CustomDict() custom_dict.a # return: 1 custom_dict.b # return: ...
78,379
def trimmed_split(s, seps=(";", ",")): """Given a string s, split is by one of one of the seps.""" for sep in seps: if sep not in s: continue data = [item.strip() for item in s.strip().split(sep)] return data return [s]
78,380
def mp2rage_old(pd, r1, r2s=None, transmit=None, receive=None, gfactor=None, tr=6.25, ti1=0.8, ti2=2.2, tx=None, te=None, fa=(4, 5), n=160, eff=0.96, sigma=None, device=None, return_combined=True): """Simulate data generated by a (simplified) MP2RAGE sequence. The defaults are par...
78,381
def load_homonyms(synsets_file_name: str, senses_file_name: str, fasttext_model: FastText, udpipe_pipeline: Language) -> Dict[str, Tuple[np.ndarray, str]]: """ Create a special dictionary of RuWordNet homonyms and their distributional semantic representations. :param synsets_file_name: th...
78,382
def descendant_selected(node): """Returns true if this node or a descendant of it is selected. Use as e.g.: {% if descendant_selected node %} """ if node.selected: return True for child in node.children: if descendant_selected(child): return True return Fals...
78,383
def upload_emoji(emoji_uploader, emoji_name, emoji_file): """ Attempt to upload the given emoji. """ click.echo('Uploading emoji {}... '.format(emoji_name), nl=False) try: emoji_uploader.upload(emoji_name, emoji_file) click.echo(click.style('Done!', fg='green', bold=True)) except...
78,384
def create_mock_attention_data(number_of_nodes, edge_per_node, in_channels, periods): """ Creating a mock stacked feature matrix and edge index. """ graph = nx.watts_strogatz_graph(number_of_nodes, edge_per_node, 0.5) edge_index = torch.LongTensor(np.array([edge for edge in graph.edges()]).T) X ...
78,385
def pretty_labels_map(atom_labels): """ transforms all of these crazy tuples into the notation used in williams and beer I_min PID """ rename_map = {} for label in atom_labels: new_label = str(label) # eliminate commas and spaces new_label = new_label.replace(',', '') ...
78,386
def 取最小数(数值列表): """ 传入要对比的列表,如(1,2,3),返回里面最小的数字 :param 数值列表: (1,2,3) :return: 1 """ return min(数值列表)
78,387
def test_neural_network(): """Test NeuralNetwork""" nn = NeuralNetwork() nn.setup_network(input_data_size=2, output_data_size=2, hidden_layer_number_of_nodes=3, hidden_layer_bias=-1, output_layer_bias=-1) assert nn.hidden_layer.number_of_nodes == 3 assert nn.hidden_layer.weights...
78,388
def test_huang_inference(): """ Tests inference on the Huang graph. :return: None. """ bbn = BbnUtil.get_huang_graph() join_tree = InferenceController.apply(bbn) expected = { 'a': [0.5, 0.5], 'b': [0.45, 0.55], 'c': [0.45, 0.55], 'd': [0.68, 0.32], '...
78,389
def tile_iterator_1d(x,axis,n_tiles,block_size,n_block_overlap,guarantee='size'): """Tile iterator for one dimension of array x. Parameters ---------- x : numpy.ndarray Input array axis : int Axis which sould be tiled, all other axis not tiled n_tiles : int Targeted numb...
78,390
def _plot_categorical_feature_numerical_label( label_stats_data: pd.DataFrame, feature_stats_data: pd.DataFrame, feature_name: str, plot_style_params: _FeaturePlotStyles) -> List[axes.Axes]: """Plots the statistics of a categorical feature when label is numerical. Generates following plots: - distrib...
78,391
def get_all_property_groups(connection): """ Get the meta-information for all the property groups in the portal. :rtype: :class:`list` of :class:`PropertyGroup` instances :raises hubspot.connection.exc.HubspotException: End-point documentation: http://developers.hubspot.com/docs/methods/contac...
78,392
def test_next_move__current_infected(): """ 0,0 | 0,1 | 0,2 1,0 | 1,1 | 1,2 2,0 | 2,1,| 2,2 N W E S """ grid = Grid(infected=[(1,1)]) # moving west and turn right assert grid.next_move((1, 1), (1, 2)) == (0, 1) # moving east and turn right assert grid.next_m...
78,393
def check_spacing_for_function_call(line, line_number, error): """Checks for the correctness of various spacing around function calls. Args: line: The text of the line to check. line_number: The number of the line to check. error: The function to call with any errors found. """ # Sin...
78,394
def get_infected(data: EoN.Simulation_Investigation, end_time: int): """Returns list of infected nodes.""" return get_type_of_nodes(data, end_time, 'I')
78,395
def create_product_storage_record(record_info: dict): """ 创建一条库存变更记录 :param record_info:{ "shop_id": 1, "product_id": 1, "operator_type": 1, "user_id": 1, "type": 1, "change_storage": 1, "current_storage": 2, "order_num": 1xxxxx, } :ret...
78,396
def _includes_custom_type(content_type: str) -> bool: """ Evaluate whether a content type is a custom type or has a custom type as a sub-type. :return: Boolean result """ if content_type.startswith("Optional"): sub_type = _get_sub_types_of_compositional_types(content_type)[0] result ...
78,397
def gen_relationships(obj) -> Generator[Tuple[str, RelationshipProperty, Type], None, None]: """ Yields tuples of ``(attrname, RelationshipProperty, related_class)`` for all relationships of an ORM object. The object 'obj' can be EITHER an instance OR a class. ...
78,398
def test_correct_path_migrated(isolated_runner, old_project): """Check if path on dataset files has been correctly migrated.""" result = isolated_runner.invoke(cli, ["migrate"]) assert 0 == result.exit_code, format_result_exception(result) client = LocalClient(path=old_project.working_dir) assert c...
78,399