content
stringlengths
22
815k
id
int64
0
4.91M
def match_any_if_key_matches(audit_id, result_to_compare, args): """ We want to compare things if we found our interested key Even if the list does not have my interested name, it will pass Match dictionary elements dynamically. Match from a list of available dictionaries There is an argument: matc...
5,310,000
def get_municipio_near_geo(geo_points, max_meters=15e+3): """ Parameters ----------- geo_points: list List containing (latitude, longitude) coordinates. max_meters: int, float Max. number of meters from the geo_points to the municipio centroid used to filter municipios. ...
5,310,001
def replace_text_in_tables(page): """ Replace <p> tags with their contents because `html2text` has troubles with p tags inside tables. """ tables = page.find('body').find_all('table') has_colspan = False for table in tables: rows = table.find_all(["th", "tr"]) for row in rows...
5,310,002
def test_note_interpretation_acmg_rules_modified(workbook, es_testapp, new_interpretation): """ Tests the acmg_rules_with_modifier calculated property. Tests that - each rule in acmg_rules_invoked is added to calc prop with correct modifier (or none) - none of the deprecated acmg_guidelines get adde...
5,310,003
def test_config_does_not_load_blocked_plugin_from_args(testdir): """This tests that pytest's config setup handles "-p no:X".""" p = testdir.makepyfile("def test(capfd): pass") result = testdir.runpytest(str(p), "-pno:capture") result.stdout.fnmatch_lines(["E fixture 'capfd' not found"]) assert...
5,310,004
def get_mirror_table (left, right, miraxis='x'): """ Return a mirror table between two object on chosen axis :param str left: object to compare to slave :param str right: object to compare to master :param str miraxis: 'x'(default) chosen world axis on wich mirror is wanted :return: list: return...
5,310,005
def work_callback(ctx, param, value): """ Load correct work plugin and add it into the context """ plugin_name = plugin_callback(ctx, param, value) plugin_cls = get_work_plugins()[plugin_name] plugin = plugin_cls(config=ctx.obj["config"]) ctx.obj[param.name] = plugin return plugin
5,310,006
def wmh( flair, t1, t1seg, mmfromconvexhull = 12 ) : """ Outputs the WMH probability mask and a summary single measurement Arguments --------- flair : ANTsImage input 3-D FLAIR brain image (not skull-stripped). t1 : ANTsImage input 3-D T1 brain image (not skull-stripped). t1seg : ANTsImage ...
5,310,007
def translate_delta(mat, dx, dy): """ Return matrix with elements translated by dx and dy, filling the would-be empty spaces with 0. I feel this method may not be the most efficient. """ rows, cols = len(mat), len(mat[0]) # Filter out simple deltas if (dx == 0 and dy == 0): return m...
5,310,008
def test_sub_follows_path_to_final_position_value_part_two(): """Sub can follow a path and calculate its final position's value.""" sub = Submarine() commands = [ "forward 5", "down 5", "forward 8", "up 3", "down 8", "forward 2", ] for command in comma...
5,310,009
def w_blank(): """ >>> jeżeli 1: ... print('a') ... print() ... print('b') a <BLANKLINE> b """
5,310,010
def upscale_x( inputs, scale=4, scope='upscale_x' ): """mimic the tensorflow bilinear-upscaling for a fix ratio of x.""" with tf.variable_scope(scope): size = tf.shape(inputs) b = size[0] h = size[1] w = size[2] c = size[3] p_inputs = tf.concat((inputs, inputs[:, -1:, :, :]), ax...
5,310,011
def write_dataclass(dclass: object, path: str) -> None: """ Write a dataclass to the provided path as a json """ with open(path, "w+") as f: f.write( json.dumps(dclass, indent=4, ensure_ascii=True, default=pydantic_encoder) )
5,310,012
def audio_rttm_map(manifest): """ This function creates AUDIO_RTTM_MAP which is used by all diarization components to extract embeddings, cluster and unify time stamps input: manifest file that contains keys audio_filepath, rttm_filepath if exists, text, num_speakers if known and uem_filepath if exists...
5,310,013
def extract_slices(img): """ Extract slices from images shapes Parameters ----------- imgs: list of n_sessions arrays of shape\ (n_voxels, n_timeframes) Returns -------- slices: list of slices """ slices = [] t_i = 0 for i in range(len(img)): n_voxels, n...
5,310,014
def _generate_meta(): """ Generate Meta information for export """ d = {'root_url': request.url_root} return d
5,310,015
def u2(vector): """ This function calculates the utility for agent 2. :param vector: The reward vector. :return: The utility for agent 2. """ utility = vector[0] * vector[1] return utility
5,310,016
def assert_isinstance( instance: Any, cls: Type[TYPE], message: Optional[str] = None ) -> TypeGuard[TYPE]: """ A TypeGuard function that is equivalent to `assert instance, cls, message` that hides nasty MyPy or IDE warnings. :param instance: the instance that is checked against cls. :param cls: ...
5,310,017
def register_coders(cls, num, enc_func, dec_func): """ Register a new type for encoding and decoding. Take a class type, a number, an encoding and a decoding function.""" if num in _unpack_reg or cls in _pack_reg: raise Exception("Class or number already in use.") coders = (cls, num, enc_func...
5,310,018
def build_url(url): """Build the actual URL to use.""" f = furl(url) return f.url
5,310,019
def create_input_file(recipe=None, input_file=None, recipe_input=None, file_name='my_test_file.txt', media_type='text/plain', file_size=100, file_path=None, workspace=None, countries=None, is_deleted=False, data_type='', last_modified=None, source_started=None, source_ended=N...
5,310,020
def _add_parameters_section(string_buf: io.StringIO, node_type: hou.NodeType): """Add a parameters section to the buffer. :param string_buf: The output buffer. :param node_type: The source node type. :return: """ string_buf.write("@parameters\n") parameter_items = [] _process_parm_te...
5,310,021
def mask_and_mean_loss(input_tensor, binary_tensor, axis=None): """ Mask a loss by using a tensor filled with 0 or 1 and average correctly. :param input_tensor: A float tensor of shape [batch_size, ...] representing the loss/cross_entropy :param binary_tensor: A float tensor of shape [batch_size, ...] ...
5,310,022
def counting_sort_integers(values, max_val=None, min_val=None, inplace=False): """ Sorts an array of integers using counting_sort. Let n = len(values), k = max_val+1 """ if len(values) == 0: return values if inplace else [] #Runs in O(n) time if max_val is None or min_val is None if...
5,310,023
def xticks(*args, **kwargs): """ Set the tick spacing for the x. xticks(x1) sets the major/minor tick spacing to x1. xticks(x1, x2) sets the major/min spacing to x1/x2, resp. xticks([spacings]) gets passed to pyqtgraph.AxisItem.setTicks pass kwargs["applyBoth"] = False to prevent it from de...
5,310,024
def create_boore_asc2smc(control_file, input_file, data_column, num_headers, extension_string): """ This function creates the control file for the asc2smc converter tool """ ctl_file = open(control_file, 'w') ctl_file.write("!Control file for ASC2SMC...
5,310,025
def test_score_max(): """ Evaluates the functionality of the score_max function """ # Initialize the test arguments k = 2 row_i = [0, 3] row_j = [2, 1] rowcat = row_i + row_j arraya = np.array([[0, 1], [2, 1], [0, 3]]) precision = 10 arraycat = np.concatenate((arraya[0], arr...
5,310,026
def collision_type_interact(collision_type, map_detail='Low', data_directory="data/Collidium"): """ Queries database and returns maps based on data filtered by collision type Args: collision_type(str): Type of collision, characterized by entities involved. Values include Vehicle only and Bike/P...
5,310,027
def retrieve_thumbnails(records_dir: Path, output_dir: Path, max_workers: int): """Retrieve thumbnails for previously downloaded legacy SASDI records""" num_retrieved = 0 page_size = 10 with httpx.Client() as client: batch = [] for idx, path in enumerate(records_dir.iterdir()): ...
5,310,028
def xfun(p,B,pv0,f): """ Steady state solution for x without CRISPR """ return f/(B*p-p/pv0)
5,310,029
def convert_npi_max(node, **kwargs): """Map MXNet's min operator attributes to onnx's ReduceMin operator and return the created node. """ from onnx.helper import make_node name, input_nodes, attrs = get_inputs(node, kwargs) mx_axis = str(attrs.get("axis", 'None')) axes = convert_string_to_l...
5,310,030
def pattern_matching(pattern, genome): """Find all occurrences of a pattern in a string. Args: pattern (str): pattern string to search in the genome string. genome (str): search space for pattern. Returns: List, list of int, i.e. all starting positions in genome where pattern appea...
5,310,031
def test_fits_to_dataframe(): """Test that we can read a .FITS file and return a DataFrame.""" # First using real, well-formed data. test_fits = 'test_data/02400714_sws.fit' fname = pkg_resources.resource_filename('swsnet', test_fits) dataframe, header = fits_to_dataframe(fname) dataframe_dict ...
5,310,032
def findLblWithoutImg(pathI, pathII): """ :param pathI: a glob path. example: "D:/大块煤数据/大块煤第三次标注数据/images/*.jpg" :param pathII: a glob path. example: "D:/大块煤数据/大块煤第三次标注数据/labels/*.txt" :return: num of image which not has label """ num = 0 pathI = glob.glob(pathI) pathII = glob.glob(pathI...
5,310,033
def test_base_queue_value_type(): """Test value type.""" assert ConcreteBaseQueue().value_type == int
5,310,034
def lcf_float(val1, val2, tolerance): """Finds lowest common floating point factor between two floating point numbers""" i = 1.0 while True: test = float(val1) / i check = float(val2) / test floor_check = math.floor(check) compare = floor_check * test if val2 - compar...
5,310,035
def test_get_neighbors_with_some_neighbors_returns_correct_points(): """Verifies that the neighbor method functions for points with some neighbors.""" grid = Grid(((-1, -1), (-1, -1))) point = grid[0][0] expected_neighbors = (grid[0][1], grid[1][0]) actual_neighbors = point.get_neighbors() asser...
5,310,036
def locker_action(dm, action: str, locks: t.List[str]): """ disables or enables the lock mechanism on a certain scopes :param dm: Dimensigon object :param action: 'disable' if you want to disable :param locks: list of scopes to enable/disable :return: """ dm.create_flask_instance() with...
5,310,037
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" if await hass.config_entries.async_unload_platforms(entry, PLATFORMS): hass.data[DOMAIN].pop(entry.entry_id) return True return False
5,310,038
def create_flat_file_from_cluster(): """ Create a flat file from a cluster simulation """ # Get all we need from the command-line args = parse_arguments() # Figure out top-level directories args.top_level_indir = os.path.join(args.input_dir, "Sims", "indata") args.top_level_outdir = os....
5,310,039
def get_target_table(session, only_enabled=False, verbose=False): """ Get the complete target table or only the enabled entries """ # TODO why does it not expand the company???? dict_ = table2dict(Target, session, 'TargetID', ["Company", "CompanyName"]) return dict_
5,310,040
def register(): """Asks new users their email, first_name, last_name, password and provides them with an account number """ email = input("What is your email address? \n") first_name = input("What is your first name? \n") last_name = input("What is your last name? \n") password = getpass("Cr...
5,310,041
def check_num_row(data): """ @param df: dataframe @return: return 1 if checking condition is true """ return data.shape[0] > 10
5,310,042
def blog_post_feed_richtext_filters(request, format, **kwargs): """ Blog posts feeds - maps format to the correct feed view. """ try: return {"rss": PostsRSSRichtextFilters, "atom": PostsAtomRichtextFilters}[format](**kwargs)(request) except KeyError: raise Http404()
5,310,043
def _convert_text_to_logs_format(text: str) -> str: """Convert text into format that is suitable for logs. Arguments: text: text that should be formatted. Returns: Shape for logging in loguru. """ max_log_text_length = 50 start_text_index = 15 end_text_index = 5 return...
5,310,044
def force_langston_contact_agent_agent(r_tot, d, n, v, t, mu, kappa, damping): """Frictional contact force between agent and agent (Helbing, 2000).""" return mu * (r_tot - d) * n + kappa * (r_tot -d) * dot2d(v, t) * t + damping * dot2d(v, n) * n
5,310,045
def glossary(): """Generates glossary data""" data = [] for item in sorted(reference.ACRONYMS.items()): data.append({ "type": "Acronym", "code": item[1], "definition": item[0] }) for item in sorted(reference.ABBREVIATIONS.items()): data.appen...
5,310,046
def whereami(bot, event, *args): """get current conversation id""" yield from bot.coro_send_message( event.conv, _("You are at <b><pre>{}</pre></b>, conv_id = <i><pre>{}</pre></i>").format( bot.conversations.get_name(event.conv), event.conv.id_))
5,310,047
def dgControl(*args, **keywords): """ Dynamic library stub function """ pass
5,310,048
def generate_random_slug(length=40, prefix=None): """ This function is used, for example, to create Coupon code mechanically when a customer pays for the subscriptions of an organization which does not yet exist in the database. """ if prefix: length = length - len(prefix) # make sur...
5,310,049
def register_sample_data( data: Dict[str, Union[str, Callable[..., Iterable[LayerData]]]], hookimpl: HookImplementation, ): """Register sample data dict returned by `napari_provide_sample_data`. Each key in `data` is a `sample_name` (the string that will appear in the `Open Sample` menu), and the v...
5,310,050
def get_easy_variables(website_rules, url, settings): """Stuff that can be found without parsing the DOM -- its easy""" website_variables = {} website_variables["URL"] = { 'content': url.full_url, 'strength': 'high', 'type': 'attr' } website_variables["DOMAIN"] = { '...
5,310,051
def order_of_magnitude(x): """Determine the order of magnitude of the numeric input (`int`, `float`, :meth:`numpy.array` or :meth:`pandas.Series`). Examples -------- >>> order_of_magnitude(11) array(1.) >>> order_of_magnitude(234) array(2.) >>> order_of_magnitude(1) array(0.) >>...
5,310,052
def lines_of_words(S, W, text_words): """Convert index of first words to list of lines Take the "S" that's computed by a line breaking algorithm and converts it to a list of lines, where each line is a list of words. """ assert sorted(S.keys()) == list(range(1, 1+max(S.keys()))), [ sort...
5,310,053
def set_cmd_line_args(): """ get the command-line arguments needed to convert the Excel input file into Define-XML :return: return the argparse object with the command-line parameters """ parser = argparse.ArgumentParser() parser.add_argument("-i", "--input_file", help="path and file name of the...
5,310,054
def draw_task(id, start_time, end_time, color, task_name, title, line_width=40, block=True): """ Display timeline of given task as bar Parameters ------- id : int Id of the task to draw. Correspond to the y-axis position start_time start time of given task end_time e...
5,310,055
def digits_to_num(L, reverse=False): """Returns a number from a list of digits, given by the lowest power of 10 to the highest, or the other way around if `reverse` is True""" digits = reversed(L) if reverse else L n = 0 for i, d in enumerate(digits): n += d * (10 ** i) return n
5,310,056
def dynamics(q, u, p): """ Returns state derivative qdot. Takes current state q, motor input torque u, and disturbance torque p. See <http://renaissance.ucsd.edu/courses/mae143c/MIPdynamics.pdf> (rederived with incline). """ # Angle of pendulum in incline frame ang = q[2] - incline # M...
5,310,057
def install(c): """ Install the package """ c.sudo("apt-get -y update", watchers=[sudopass]) c.sudo("apt-get -y upgrade", watchers=[sudopass]) c.sudo("apt-get -y install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended latexmk", watchers=[sudopass]) c.run("pip install ...
5,310,058
def main(): """ This assumes that the offline model pipeline was already processed, meaning the feature extractors & model can be loaded from AWS S3 """ app = Flask(__name__) # build AWS S3 Client & point to the bucket s3 = build_s3() bucket_name = 'team-03-bucket' # point to the ...
5,310,059
def comp_time_angle(self, output): """Compute the time and space discretization of the Structural module Parameters ---------- self : Structural a Structural object output : Output an Output object (to update) """ output.struct.time = output.mag.time output.struct.Nt_to...
5,310,060
def set_root(root: str): """Set Deba root folder Root folder is the folder that contains deba.yaml file. If not set then the current working directory is assumed to be the root folder. :param str root: the root folder :rtype: None """ global _root _root = root
5,310,061
def set_user_expectations(settings): """ SUMMARY: prints a message so the user expects to wait while the YAML is deserialized INPUT: three-item settings dictionary OUTPUT: no return value, only prints to the screen conditionally """ if path.exists(str(config.axiom.binary_folder + "/invent...
5,310,062
def escape_and_join(args): """Creates a shell-escaped string from a list of arguments.""" escaped = [] for x in args: if x.startswith("$"): # This is a hack because a rule in //fpga/defs.bzl wants to pass # $XCELIUM_PATH as an argument, and have the shell expand it correctly....
5,310,063
def mean_shift_smart_init(X, kappa, num_seeds=100, max_iters=10, metric='cosine'): """ Runs mean shift with carefully selected seeds @param X: a [n x d] torch.FloatTensor of d-dim unit vectors @param dist_threshold: parameter for the von Mises-Fisher distribution @param num_seeds: number of...
5,310,064
def checkHighScore(stats, sb): """Check to see if high score has been broken""" if stats.score > stats.highScore: stats.highScore = stats.score sb.prepHighScore()
5,310,065
def mergesort(*tables, **kwargs): """ Combine multiple input tables into one sorted output table. E.g.:: >>> import petl as etl >>> table1 = [['foo', 'bar'], ... ['A', 9], ... ['C', 2], ... ['D', 10], ... ['A', 6], ...
5,310,066
def _normalizeGlifPointAttributesFormat2(element): """ - Follow same rules as Format 1, but allow an identifier attribute. """ attrs = _normalizeGlifPointAttributesFormat1(element) identifier = element.attrib.get("identifier") if identifier is not None: attrs["identifier"] = identifier ...
5,310,067
def fetch_account_balance(pubKey: str = REWARD_PUBLIC_KEY) -> float: """ Returns the balance of the given account available to be send """ try: acc = server.accounts().account_id(pubKey).call() except Exception as e: print(f"Specified account ({pubKey}) does not exists:", e) ...
5,310,068
def identify_formation_channels(seeds, file): """Identify the formation channel that produced each seed. We consider 5 main channels: classic, only stable, single core CEE, double core CEE and other. We define the channels as follows (the numbers are what is put in the ``channels`` output): Classic...
5,310,069
def _read_stimtime_FSL(stimtime_files, n_C, n_S, scan_onoff): """ Utility called by gen_design. It reads in one or more stimulus timing file comforming to FSL style, and return a list (size of [#run \\* #condition]) of dictionary including onsets, durations and weights of each event. Pa...
5,310,070
def test_exception_ping_redis(mocker): """Unsuccessful ping to Redis should return False.""" mock_redis = mocker.patch.object(utils, 'REDIS') mock_redis.ping.side_effect = redis.exceptions.ConnectionError() return_value = utils.ping_redis() mock_redis.ping.assert_called_once() assert return_val...
5,310,071
def parse_map(map_file): """ Parse a given map file (compilation output). """ sections = [ "Preamble", "Allocating common symbols", "Discarded input sections", "Memory Configuration", "Linker script and memory map", "OUTPUT", "Cross Reference Tabl...
5,310,072
def parse_sge_script(local_script_path): """ Parse the SGE script :returns: A dictionary of the options for constructing AiiDAJobFirework """ with open(local_script_path) as handle: lines = handle.readlines() options = { 'stdout_fname': '_scheduler-stdout.txt', 'stderr...
5,310,073
def add(domain, ip, www): """Add a rule to the hosts file""" rules = load_rules() add_rule(rules, ip, domain) if www: add_rule(rules, ip, "www." + domain) save_rules(rules)
5,310,074
def run_using_a_configuration_file( configuration_path: Union[Path, str], file_to_lint: str = __file__ ) -> Tuple[Mock, Mock, Run]: """Simulate a run with a configuration without really launching the checks.""" configuration_path = str(configuration_path) args = ["--rcfile", configuration_path, file_to_...
5,310,075
def get_gromacs_version(gmx: str = "gmx") -> int: """ Gets the GROMACS installed version and returns it as an int(3) for versions older than 5.1.5 and an int(5) for 20XX versions filling the gaps with '0' digits. Args: gmx (str): ('gmx') Path to the GROMACS binary. Returns: int: GR...
5,310,076
def set_seeds(seed=123): """ Set seeds for reproducibility. This will also help explore other solutions to the same configuration. """ np.random.seed(seed) torch.manual_seed(seed) random.seed(seed)
5,310,077
def generate_data(engine, dbsession, total=10): """Generate workflows and jobs. You must pass your own engine and session. """ # Create tables bm.Base.metadata.create_all(engine) for _ in range(total): {% for model in models %} models.{{ model.name }}.create() {% endfor ...
5,310,078
def StepToGeom_MakeConic2d_Convert(*args): """ :param SC: :type SC: Handle_StepGeom_Conic & :param CC: :type CC: Handle_Geom2d_Conic & :rtype: bool """ return _StepToGeom.StepToGeom_MakeConic2d_Convert(*args)
5,310,079
def AllNames(): """(read-only) Array of all Monitor Names""" return get_string_array(lib.Monitors_Get_AllNames)
5,310,080
def k2_mean(success_tag, ms_results): """ Returns the expectation of k2, the rate constant for the unimolecular step of a resting-set reaction. """ success_kcolls = np.ma.array(ms_results['kcoll'], mask=(ms_results['tags']!=success_tag)) success_t2s = np.ma.array(ms_results['times'], mask=(ms_results['tags']!=s...
5,310,081
def check_func_scan(func_scan_dct, scan): """Run some checks on the functional timeseries-related files for a given series/scan name or label.""" scan_resources = func_scan_dct[scan] try: scan_resources.keys() except AttributeError: err = "\n[!] The data configuration file you prov...
5,310,082
def ensure_opened(pdb_name, read_only): """Ensure a PDB is opened.""" if not existing_pdb: module.fail_json(msg="PDB %s doesn't exist." % pdb_name, changed=changed(), ddls=ora_db.ddls) if existing_pdb['state'] != 'opened' or existing_pdb['read_only'] != read_only: ora_db.execute_ddl( ...
5,310,083
def json_network(user, raw=True, callback=None): """ callback=NAME wrap the object definition in a function call NAME(...) ?raw a raw JSON object is returned, instead of an object named Delicious.posts """ url = 'http://del.icio.us/feeds/json/network/' +...
5,310,084
def data_struct_efficiency_check(): """ This method was used to test various data structure access methods to determine which one was the most efficient. The dictionary was determined to be the most efficient """ netflow_data=pd.read_csv(cfg.CONSOLIDATED_NETFLOW_DATA) netflow_data = netflow_da...
5,310,085
def perform_sigm_times_exp(tree, exp_x=None, exp_minus_x=None, sigm_x=None, sigm_minus_x=None, parent=None, child_idx=None, full_tree=None): """ Core processing of the `local_sigm_times_exp` optimization. This recursive function operates on a multiplica...
5,310,086
def gen_file_name(name=None, prefix='', output_dir='.', extension='log', append_time=True): """ Generate a file name. :param name: a base for the file name :param output_dir: the directory :param extension: give the file an extension :param append_time: append time to the file name (before the ...
5,310,087
def implode(space, w_arg1, w_arg2=None): """Join array elements with a string.""" if w_arg2 is None: if w_arg1.tp != space.tp_array: space.ec.warn("implode(): Argument must be an array") return space.w_Null else: w_arr = w_arg1 string = "" else...
5,310,088
def docs(ctx): """Generate Sphinx HTML documentation, including API docs.""" ctx.run(f"rm -f docs/{PACKAGE_NAME}.rst") ctx.run(f"rm -f docs/{PACKAGE_NAME}.*.rst") ctx.run(f"rm -f docs/modules.rst") ctx.run(f"{PIPENV_RUN} make -C docs clean") ctx.run(f"{PIPENV_RUN} make -C docs html") browser...
5,310,089
def fill_matrix(X: np.ndarray, mixture: GaussianMixture) -> np.ndarray: """Fills an incomplete matrix according to a mixture model Args: X: (n, d) array of incomplete data (incomplete entries =0) mixture: a mixture of gaussians Returns np.ndarray: a (n, d) array with completed data...
5,310,090
def get_pseudo(t_model, unlabeled_dataset): """ params: t_model: teacher model unlabeled_dataset: unlabeled dataset return: pseudo_label: ndarray[N, C], N=len(dataloader), C for num of class, dim C is output of softmax """ t_model.eval() device = next(t_model.parameters()...
5,310,091
def executable(name): """Return the full path to an executable""" suffix = "" folder = "bin" if sys.platform == "win32": suffix = ".exe" folder = os.path.join(folder, "Release") return os.path.join("..", folder, name + suffix)
5,310,092
def CountDictCall(keyfunc): """ Decorator for counting memoizer hits/misses while accessing dictionary values with a key-generating function. Like CountMethodCall above, it wraps the given method fn and uses a CountDict object to keep track of the caching statistics. The dict-key fun...
5,310,093
def GetEnumValue(name): """ Finds the value of a particular enum define. Ex kdp_req_t::KDP_VERSION => 0x3 params: name : str - name of enum in the format type::name returns: int - value of the particular enum. raises: TypeError - if the enum is not found ...
5,310,094
def test_evalF(): """ Returns a function that executes the formula passes as argument. The formula should use x,y,z as predefined arguments, or use args[..] array instead e.g.: map(evalF("x>2"),range(5)) : [False, False, False, True, True] It is optimized to be efficient (but still 50%...
5,310,095
def test_property_setter( assert_errors, parse_ast_tree, default_options, mode, ): """Ensures that property setter do not overlap.""" code = method_setter_template.format('func') tree = parse_ast_tree(mode(code)) visitor = BlockVariableVisitor(default_options, tree=tree) visitor.run...
5,310,096
def _group_map_list(_data, _f, *args, _keep=False, **kwargs): """List version of group_map""" return list( regcall( group_map, _data, _f, *args, **kwargs, _keep=_keep, ) )
5,310,097
def clean_zeros(a, b, M): """ Remove all components with zeros weights in a and b """ M2 = M[a > 0, :][:, b > 0].copy() # copy force c style matrix (froemd) a2 = a[a > 0] b2 = b[b > 0] return a2, b2, M2
5,310,098
def plot_from_xml(fn1=None, fnx=None, window=7): """Makes a dot-plot from xml and fasta sequence. :param fn1: Fasta file. :param fnx: XML file. :param window: Threshold, for example (5)' :return: None """ if fn1 is not None and fnx is not None: with open(fn1, 'r') as fh, open(fnx, '...
5,310,099