content
stringlengths
22
815k
id
int64
0
4.91M
def create_LED_indicator_rect(**kwargs) -> QPushButton: """ Useful kwargs: text: str, icon: QIcon, checked: bool, parent checked=False -> LED red checked=True -> LED green """ button = QPushButton(checkable=True, enabled=False, **kwargs) button.setStyleSheet(SS_LED_INDICATOR_RECT) ...
5,356,900
def get_current_version_name(): """Returns the version of the current instance. If this is version "v1" of module "module5" for app "my-app", this function will return "v1". """ return os.environ['CURRENT_VERSION_ID'].split('.')[0]
5,356,901
def getAlignments(infile): """ read a PSL file and return a list of PslRow objects """ psls = [] with open(infile, 'r') as f: for psl in readPsls(f): psls.append(psl) return psls
5,356,902
def cleanup(config): """ This function perform cleanups: - Stops and removes ESP containers - Removes ESP from disk - Removes stage status files (e.g. .cloned_esp) Docker images & cache are left intact. """ logging.info("Cleaning the provisioning environment") esp_path = pathlib.P...
5,356,903
def cd(editor, dir_path): """cdコマンドを上書き。エディタのディレクトリと同期させる. エディタの仕様として、コマンドラインと画面左のディレクトリは同期させたい cdコマンドを使った際は、画面左のディレクトリもそれに応じて動くように するためにcdコマンド自体を上書き """ editor.update_dir(dir_path)
5,356,904
def get_ring_kernel(zs,Rs): """Represents the potential influence due to a line charge density a distance *delta_z* away, at which the azimuthally symmetric charge distribution has a radius *R*.""" Logger.write('Computing ring kernels over %i x %i points...'%((len(zs),)*2)) #Form index enu...
5,356,905
async def test_async_with(client): """ Test async with context manager (with backward compatibility). """ mgr = client.connect(True) aexit = type(mgr).__aexit__ aenter = type(mgr).__aenter__(mgr) conn = await aenter try: assert conn.closed == False _ = await conn.whoami() ex...
5,356,906
def dsdh_h(P, h, region = 0): """ Derivative of specific entropy [kJ kg / kg K kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dsdh_h(P, h) elif region is 2: return region2.dsdh_h(P, h) elif reg...
5,356,907
def main(): """main() function """ global LOGGING global LOGFILE xprint("[+] fuzz_cli.py -- by Daniel Roberson @dmfroberson\n") args = parse_cli() # Make sure target exists and is executable progname = args.binary[0] if not os.path.isfile(progname) and not os.access(progname, os.X_...
5,356,908
def floor_datetime(dt, unit, n_units=1): """Floor a datetime to nearest n units. For example, if we want to floor to nearest three months, starting with 2016-05-06-yadda, it will go to 2016-04-01. Or, if starting with 2016-05-06-11:45:06 and rounding to nearest fifteen minutes, it will result in 201...
5,356,909
def get_dataset_descriptor(project_id, dataset_id): """Get the descriptor for the dataset with given identifier.""" try: dataset = api.datasets.get_dataset_descriptor( project_id=project_id, dataset_id=dataset_id ) if not dataset is None: return jsonif...
5,356,910
def pe41(): """ >>> pe41() 7652413 """ primes = Primes(1000000) for perm in permutations(range(7, 0, -1)): n = list_num(perm) if primes.is_prime(n): return n return -1
5,356,911
def transit_flag(body, time, nsigma=2.0): """Return a flag that indicates if times occured near transit of a celestial body. Parameters ---------- body : skyfield.starlib.Star Skyfield representation of a celestial body. time : np.ndarray[ntime,] Unix timestamps. nsigma : float ...
5,356,912
def _parse_port_ranges(pool_str): """Given a 'N-P,X-Y' description of port ranges, return a set of ints.""" ports = set() for range_str in pool_str.split(','): try: a, b = range_str.split('-', 1) start, end = int(a), int(b) except ValueError: log.error('Ig...
5,356,913
def get_flavors(): """ Get Nectar vm flavors in a dict with openstack_id as key """ fls = Flavor.query.all() results = [] for fl in fls: results.append(repack(fl.json(), {"name": "flavor_name"}, ["id"])) return array_to_dict(results)
5,356,914
def _HasTrafficChanges(args): """True iff any of the traffic flags are set.""" traffic_flags = ['to_revision', 'to_latest'] return _HasChanges(args, traffic_flags)
5,356,915
def send_attachment(recipient_id, url, type=None): """ Send an attachment by URL. If the URL has not been uploaded before, it will be uploaded and the attachment ID will be saved to the database. If the URL has been uploaded before, the ID is fetched from the database. Then, the attachment is sent by ID...
5,356,916
def ad5940_switch_test(): """ Capture ECG for 10s turning off all the Switches, no data should be received, the Turn On the 5940 & 8233 switch the capture ECG data you should receive the data as expected with the default frequency :return: """ capture_time = 10 freq_hz = 0 common.dcb_cfg...
5,356,917
def find_credentials(account): """ fumction that check if a credentials exists with that username and return true or false """ return Credentials.find_credentialls(account)
5,356,918
def enumerate_imports(tokens): """ Iterates over *tokens* and returns a list of all imported modules. .. note:: This ignores imports using the 'as' and 'from' keywords. """ imported_modules = [] import_line = False from_import = False for index, tok in enumerate(tokens): token_t...
5,356,919
def solved(maze): """Checks if the maze was solved. The maze is solved, if there is no 3 to be found. Returns: True if the maze has no 3. """ # TODO: Extend this function to properly check for 3s inside the maze. return True
5,356,920
def safe_htcondor_attribute(attribute: str) -> str: """Convert input attribute name into a valid HTCondor attribute name HTCondor ClassAd attribute names consist only of alphanumeric characters or underscores. It is not clearly documented, but the alphanumeric characters are probably restricted to ASC...
5,356,921
def store_booster(set_dict: Dict) -> None: """Fills boosters table from sets collection. """ s = Set.objects.get(id=set_dict['code']) booster = Booster.objects.get_or_create(set=s)[0] booster_slots = [] single_slots = [s for s in set_dict['booster'] if isinstance(s, str)] multi_slots = [s ...
5,356,922
def test_save_layer_single_no_named_plugin(tmpdir, layer_data_and_types): """Test saving a single layer without naming plugin.""" # make writer builtin plugins get called first from napari.plugins import plugin_manager plugin_manager.hooks.napari_write_image.bring_to_front(['builtins']) plugin_mana...
5,356,923
def assert_inheritance(obj, cls): """Asserts whether an object inherits from a particular class. Uses isinstance. Parameters ---------- obj : object The object to test. cls : Class Class to check obj is an instance of. """ check_is_class(cls) assert isinstance( ...
5,356,924
def main(): """Main function that reads command-line args and starts Tornado server""" args = parser.parse_args() app = Application(args) app.listen(args.local_port, '0.0.0.0') print(f"open http://127.0.0.1:{args.local_port} in your browser to view the application") if not args.websocket_server...
5,356,925
def _permutations(objs: Iterable[object]) -> Iterable[Iterable[object]]: """Return a list of permutations, all of which are deep copied""" def deep_copy_iterator(perm: Iterable[object]) -> Iterable[object]: for o in perm: if inspect.ismodule(o) or isinstance(o, str): yield o...
5,356,926
def store_data(df: pd.DataFrame, path: str): """Store DataFrame to pickle compressed with gzip. Args: df (pd.DataFrame): DataFrame to be stored. path (str): Path where to store created file. """ df.to_pickle(path="{}.pkl.gz".format(path), compression="gzip")
5,356,927
def focal_length_to_fov(focal_length, length): """Convert focal length to field-of-view (given length of screen)""" fov = 2 * np.arctan(length / (2 * focal_length)) return fov
5,356,928
def create_generic_connection(connection, verbose: bool = False): """ Generic Engine creation from connection object :param connection: JSON Schema connection model :param verbose: debugger or not :return: SQAlchemy Engine """ options = connection.connectionOptions if not options: ...
5,356,929
def main(): """Main part of script to execute. """ args = parse_command_line() # print('\n{0}\n\n'.format(args,)) # return # print('User VENV Location = {0}\nExists: {1}\n'.format(VENV_LOCATION, check_venv())) if 'language' in vars(args): if args.language == 'all': proce...
5,356,930
def make_csv(headers, data): """ Creates a CSV given a set of headers and a list of database query results :param headers: A list containg the first row of the CSV :param data: The list of query results from the Database :returns: A str containing a csv of the query results """ # Create a list where each entr...
5,356,931
def draw_color_rect(buf,ix,iy,size,wrect,color): """ draw a square centerd on x,y filled with color """ code = """ int nd = %d; int x, y, i, j; int ny = 1 + 2 * nd; int nx = ny; y = iy - nd; if (y < 0) { ny += y; y = 0; } else if ((y + ny) > dimy) ny -= y + ny - dimy; x = ix - nd; if (x < 0) { ...
5,356,932
def convert_fill_constant(g, op, block): """Operator converter for fill_constant.""" value = op.attr('value') shape = block.var(op.output('Out')[0]).shape dtype = block.var(op.output('Out')[0]).dtype dtype = str(dtype).strip().split('.')[1] value = np.full(shape, value, dtype) out = _expr.c...
5,356,933
def test_validate_python(mock_exit): """Test validate Python version method.""" with patch('sys.version_info', new_callable=PropertyMock(return_value=(2, 7, 8))): main.validate_python() assert mock_exit.called is True mock_exit.reset_mock() with patch('sys.version_info',...
5,356,934
def get_template_versions(obj, pretty_print, beep, template_id, headers): """Returns the versions of a specified template. """ spinner = init_spinner(beep=beep) start_spinner(spinner) try: if headers is not None: headers = json....
5,356,935
def _compute_focus_2d(image_2d, kernel_size): """Compute a pixel-wise focus metric for a 2-d image. Parameters ---------- image_2d : np.ndarray, np.float A 2-d image with shape (y, x). kernel_size : int The size of the square used to define the neighborhood of each pixel. An...
5,356,936
def test_ap_wps_er_set_sel_reg_oom(dev, apdev): """WPS ER SetSelectedRegistrar OOM""" try: _test_ap_wps_er_set_sel_reg_oom(dev, apdev) finally: dev[0].request("WPS_ER_STOP")
5,356,937
def extract_value_from_config( config: dict, keys: Tuple[str, ...], ): """ Traverse a config dictionary to get some hyper-parameter's value. Parameters ---------- config A config dictionary. keys The possible names of a hyper-parameter. Returns ------- ...
5,356,938
def boundaryStats(a): """ Returns the minimum and maximum values of a only on the boundaries of the array. """ amin = numpy.amin(a[0,:]) amin = min(amin, numpy.amin(a[1:,-1])) amin = min(amin, numpy.amin(a[-1,:-1])) amin = min(amin, numpy.amin(a[1:-1,0])) amax = numpy.amax(a[0,:]) amax = max(amax, num...
5,356,939
def offset_func(func, offset, *args): """ Offsets inputs by offset >>> double = lambda x: x * 2 >>> f = offset_func(double, (10,)) >>> f(1) 22 >>> f(300) 620 """ def _offset(*args): args2 = list(map(add, args, offset)) return func(*args2) with ignoring(Exceptio...
5,356,940
def add_summary_logger(experiment, original, value, *args, **kwargs): """ Note: auto_metric_logging controls summary metrics, and auto_metric_logging controls summary histograms Note: assumes "simple_value" is a metric """ try: LOGGER.debug("TENSORBOARD LOGGER CALLED") metric...
5,356,941
def get_redshift_schemas(cursor, user): """ Get all the Amazon Redshift schemas on which the user has create permissions """ get_schemas_sql = "SELECT s.schemaname " \ "FROM pg_user u " \ "CROSS JOIN " \ "(SELECT DISTINCT schemaname FROM ...
5,356,942
def window_features(idx, window_size=100, overlap=10): """ Generate indexes for a sliding window with overlap :param array idx: The indexes that need to be windowed. :param int window_size: The size of the window. :param int overlap: How much should each window overlap. :return arr...
5,356,943
def DetectVisualStudioPath(version_as_year): """Return path to the version_as_year of Visual Studio. """ year_to_version = { '2013': '12.0', '2015': '14.0', '2017': '15.0', '2019': '16.0', } if version_as_year not in year_to_version: raise Exception(('Visual Studio version %s (from versi...
5,356,944
def extract_pages(f, filter_namespaces=False): """ Extract pages from a MediaWiki database dump = open file-like object `f`. Return an iterable over (str, str, str) which generates (title, content, pageid) triplets. """ elems = (elem for _, elem in iterparse(f, events=("end",))) # We can't re...
5,356,945
def create_suburbans_answer(from_code, to_code, for_date, limit=3): """ Creates yandex suburbans answer for date by stations codes :param from_code: `from` yandex station code :type from_code: str :param to_code: `to` yandex station code :type to_code: str :param for_date: date for which da...
5,356,946
def update_user(usr): """ Update user and return new data :param usr: :return object: """ user = session.query(User).filter_by(id=usr['uid']).first() user.username = usr['username'] user.first_name = usr['first_name'] user.last_name = usr['last_name'] user.email = usr['email'] ...
5,356,947
def get_data(date_from=None, date_to=None, location=None): """Get covid data Retrieve covid data in pandas dataframe format with the time periods and countries provided. Parameters ---------- date_from : str, optional Start date of the data range with format 'YYYY-MM-DD'. By def...
5,356,948
def group_by_lambda(array: List[dict], func: GroupFunc) -> Dict[Any, List[dict]]: """ Convert list of objects to dict of list of object when key of dict is generated by func. Example:: grouped = group_by_lambda(detections, lambda x: x.get(DEVICE_ID)) :param array: list of objects to group :...
5,356,949
def update(isamAppliance, is_primary, interface, remote, port, health_check_interval, health_check_timeout, check_mode=False, force=False): """ Updating HA configuration """ # Call to check function to see if configuration already exist update_required = _check_enable(isamAppliance, is_pr...
5,356,950
def compare_images(image_file_name1, image_file_name2, no_print=True): """ Compare two images by calculating Manhattan and Zero norms """ # Source: http://stackoverflow.com/questions/189943/ # how-can-i-quantify-difference-between-two-images img1 = imread(image_file_name1).astype(float) img2 = imrea...
5,356,951
def prepare_update_mutation_classes(): """ Here it's preparing actual mutation classes for each model. :return: A tuple of all mutation classes """ _models = get_enabled_app_models() _classes = [] for m in _models: _attrs = prepare_update_mutation_class_attributes(model=m) # ...
5,356,952
def makePacket(ID, instr, reg=None, params=None): """ This makes a generic packet. TODO: look a struct ... does that add value using it? 0xFF, 0xFF, 0xFD, 0x00, ID, LEN_L, LEN_H, INST, PARAM 1, PARAM 2, ..., PARAM N, CRC_L, CRC_H] in: ID - servo id instr - instruction reg - register params - instructi...
5,356,953
def vision_matched_template_get_pose(template_match): """ Get the pose of a previously detected template match. Use list operations to get specific entries, otherwise returns value of first entry. Parameters: template_match (List[MatchedTemplate3D] or MatchedTemplate3D): The template match(s) ...
5,356,954
def create_rotor(model, ring_setting=0): """Factory function to create and return a rotor of the given model name.""" if model in ROTORS: data = ROTORS[model] return Rotor(model, data['wiring'], ring_setting, data['stepping']) raise RotorError("Unknown rotor type: %s" % model)
5,356,955
def prog_parts(fig, ax, z, peaks, title='', vmin=-2.5, vmax=-1.3, sigma=4, lmap= None, ax_label=True): """A plot to show how contours encapsulate the massive progenitors and how the absorption peaks are proxy to the center of mass of these protoclusters""" """ if z is not None : zs, ze = z, z+1...
5,356,956
def get_description(sequence, xrefs, taxid=None): """ Compute a description for the given sequence and optional taxon id. This function will use the rule scoring if possible, otherwise it will fall back to the previous scoring method. In addition, if the rule method cannot produce a name it also fal...
5,356,957
def compute_ess(samples): """Compute an estimate of the effective sample size (ESS). See the [Stan manual](https://mc-stan.org/docs/2_18/reference-manual/effective-sample-size-section.html) for a definition of the effective sample size in the context of MCMC. Args: samples: Tensor, vector (n,), float32 ...
5,356,958
def uptime(): """Returns uptime in milliseconds, starting at first call""" if not hasattr(uptime, "t0") is None: uptime.t0 = time.time() return int((time.time() - uptime.t0)*1000)
5,356,959
def load_plot(axis, plot, x_vals, y1=None, y2=None, y3=None, y4=None, title="", xlab="", ylab="", ltype=[1, 1, 1, 1], marker=['g-', 'r-', 'b-', 'k--']): """ Function to load the matplotlib plots. :param matplotlib.Axis axis: the matplotlib axis object. :param matplotlib.Figu...
5,356,960
def configure(output_path, install_dir=UNDEFINED, wrap_info=UNDEFINED, verbose_level=UNDEFINED, debug=UNDEFINED, freeze=UNDEFINED, update_shebang=UNDEFINED): """Change the STATE and update the file if necessary""" state = STATE.copy() if install_dir is not UNDEFINED: if i...
5,356,961
def _optimize_loop_axis(dim): """ Chooses kernel parameters including CUDA block size, grid size, and number of elements to compute per thread for the loop axis. The loop axis is the axis of the tensor for which a thread can compute multiple outputs. Uses a simple heuristic which tries to get at lea...
5,356,962
def no_zero(t): """ This function replaces all zeros in a tensor with ones. This allows us to take the logarithm and then sum over all values in the matrix. Args: t: tensor to be replaced returns: t: tensor with ones instead of zeros. """ t[t==0] = 1. return t
5,356,963
def php_implode(*args): """ >>> array = Array('lastname', 'email', 'phone') >>> php_implode(",", array) 'lastname,email,phone' >>> php_implode('hello', Array()) '' """ if len(args) == 1: assert isinstance(args, list) return "".join(args) assert len(args) == 2 as...
5,356,964
def RemoveInflectionalParticle(context): """ Remove Inflectional particle (lah|kah|tah|pun). Asian J. (2007) "Effective Techniques for Indonesian Text Retrieval". page 60 @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf """ result = re.sub(r'-*(lah|kah|tah|pun)$', '', context.cu...
5,356,965
def import_murals(infile): """ Imports murals from Montréal Open Data's Geo-JSON export. """ json_data = json.loads(infile.read()) # Imports each mural using the Geo-JSON export. murals_count, murals_errored_count = 0, 0 for feature in json_data.get('features'): try: import_id =...
5,356,966
def make_incompressible(velocity: Grid, domain: Domain, obstacles: tuple or list = (), solve_params: math.LinearSolve = math.LinearSolve(None, 1e-3), pressure_guess: CenteredGrid = None): """ Projects the given veloc...
5,356,967
def create_and_empty_dir(tdir, label, suffix=datetime.now().strftime("%Y%m%d%H%M%S"), sep='__', simulation=False): """ Tests if directory exists, if not creates it. If yes, tests if readable/writable. Returns True if new directory created, False if already existed and emptied (keeping directory, not con...
5,356,968
def no_source( time: datetime, glat: float, glon: float, Nbins: int, Talt: float, Thot: float ) -> xarray.Dataset: """testing only, may give non-physical results""" idate, utsec = glowdate(time) ip = gi.get_indices([time - timedelta(days=1), time], 81) cmd = [ str(get_exe()), idate...
5,356,969
def reduce_to_1D(ds, latitude_range, latitude_name='Latitude', time_mean=True, time_name='Time'): """ TODO """ if isinstance(latitude_range, (int, float)): latitude_range = [latitude_range, latitude_range] elif len(latitude_range) == 1: latitude_range = [latitude_ran...
5,356,970
def get_y_generator_method(x_axis, y_axis): """Return the y-value generator method for the given x-axis. Arguments: x_axis -- an instance of an XAxis class y_axis -- an instance of a YAxis class Returns: A reference to the y-value generator if it was found, and otherwise None. """ try: method_name = AXIS_...
5,356,971
def generate_filename(table_type, table_format): """Generate the table's filename given its type and file format.""" ext = TABLE_FORMATS[table_format] return f'EIA_MER_{table_type}.{ext}'
5,356,972
def rescale_coords(df,session_epochs,maze_size_cm): """ rescale xy coordinates of each epoch into cm note: automatically detects linear track by x to y ratio input: df: [ts,x,y] pandas data frame session_epochs: nelpy epoch class with epoch times mazesize: list with size of ...
5,356,973
def newsreader_debug(): """Given an query, return that news debug mode.""" query = request.args.get('query') if query is None: return 'No provided.', 400 result = SL.news_check(query, debug=True) if result is None: return 'not found : %s' % query, 400 return result, 200
5,356,974
def test_make_resource(pool): """ Test the resource object returned from _make_resource is the proper class instance. """ r, _ = pool._make_resource() assert pool.size == 1 assert isinstance(r, _ResourceTracker)
5,356,975
def test_modify_stats(m_app, m_get_filters): """ Test the modify_stats method in controller """ handle = RandomizerHandler(m_app) with mock.patch("controller.create_stat_modifier"): handle._modify_stats()
5,356,976
def get_vocabulary(query_tree): """Extracts the normalized search terms from the leaf nodes of a parsed query to construct the vocabulary for the text vectorization. Arguments --------- query_tree: pythonds.trees.BinaryTree The binary tree object representing a parsed search query. Each lea...
5,356,977
def pubkey_to_address(pubkey): """Convert a public key (in hex) to a Bitcoin address""" return bin_to_b58check(hash_160(changebase(pubkey, 16, 256)))
5,356,978
def test_inplace_add_model_parallel(): """ Feature: test InplaceAdd model parallel Description: model parallel Expectation: compile success """ context.set_auto_parallel_context(parallel_mode="semi_auto_parallel", device_num=8, global_rank=0) strategy = ((1, 4, 2), (1, 4, 2)) net = Inpla...
5,356,979
def transpose(A): """ Matrix transposition :rtype m: list :param m: a list of lists representing a matrix A :rtype: list :return: a list of lists representing the transpose of matrix A Example: -------- >>> A = [[0, -4, 4], [-3, -2, 0]] >>> print(transpose(A)) [[0.0, -3.0]...
5,356,980
def find_point_in_section_list(point, section_list): """Returns the start of the section the given point belongs to. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 3...
5,356,981
def mk_metrics_api(tm_env): """Factory to create metrics api. """ class _MetricsAPI(object): """Acess to the locally gathered metrics. """ def __init__(self): def _get(rsrc_id, timeframe, as_json=False): """Return the rrd metrics. """ ...
5,356,982
def create_base_args(parser: argparse.ArgumentParser, model_types=None): """Add base arguments for Transformers based models """ # Required parameters if model_types is not None and len(model_types) > 1: parser.add_argument("--model_type", default=None, type=str, choi...
5,356,983
def generate_module(file_allocator, name): """ Generate an in-memory module from a generated Python implementation. """ assert name in file_allocator.allocated_files f = file_allocator.allocated_files[name] f.seek(0) data = f.read() modname, _ = os.path.splitext(name) d = {} e...
5,356,984
def all_reduce_sum(t, dim): """Like reduce_sum, but broadcasts sum out to every entry in reduced dim.""" t_shape = t.get_shape() rank = t.get_shape().ndims return tf.tile( tf.expand_dims(tf.reduce_sum(t, dim), dim), [1] * dim + [t_shape[dim].value] + [1] * (rank - dim - 1))
5,356,985
def pprint(obj): """ Pretty Prints the object in json format using the following pprint options: pprint.PrettyPrinter(indent=2, width=120, sort_dicts=False) """ _pprint_object.pprint(obj)
5,356,986
def get_deltas_from_bboxes_and_landmarks(prior_boxes, bboxes_and_landmarks): """Calculating bounding box and landmark deltas for given ground truth boxes and landmarks. inputs: prior_boxes = (total_bboxes, [center_x, center_y, width, height]) bboxes_and_landmarks = (batch_size, total_bboxes, [y1...
5,356,987
def choose(population, sample): """ Returns ``population`` choose ``sample``, given by: n! / k!(n-k)!, where n == ``population`` and k == ``sample``. """ if sample > population: return 0 s = max(sample, population - sample) assert s <= population assert population > -1 i...
5,356,988
def _where_cross(data,threshold): """return a list of Is where the data first crosses above threshold.""" Is=np.where(data>threshold)[0] Is=np.concatenate(([0],Is)) Ds=Is[:-1]-Is[1:]+1 return Is[np.where(Ds)[0]+1]
5,356,989
def TVD_to_MD(well,TVD): """It returns the measure depth position for a well based on a true vertical depth Parameters ---------- well : str Selected well TVD : float Desire true vertical depth Returns ------- float MD : measure depth Attention --------- The input information comes from the file...
5,356,990
def get_table_b_2_b(): """表 B.2 居住人数 2 人における照明設備の使用時間率 (b) 休日在宅 Args: Returns: list: 表 B.2 居住人数 2 人における照明設備の使用時間率 (b) 休日在宅 """ table_b_2_b = [ (0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00), (0.00, 0.00, 0.0...
5,356,991
def eea(m, n): """ Compute numbers a, b such that a*m + b*n = gcd(m, n) using the Extended Euclidean algorithm. """ p, q, r, s = 1, 0, 0, 1 while n != 0: k = m // n m, n, p, q, r, s = n, m - k*n, q, p - k*q, s, r - k*s return (p, r)
5,356,992
def build_pot(): """Build the current 'gettext' language translation files and updates the *.po files for the supported languages. """ check_sphinx_build() command = ' '.join([SPHINX_BUILD, '-M', 'gettext', '"' + SPHINX_SOURCE_DIR + '"', '"' + SPHINX_LOCALE_DIR + '"', '-c', '.', '-D', 'language={0}'...
5,356,993
def string_quote(s): """ TODO(ssx): quick way to quote string """ return '"' + s + '"'
5,356,994
def nextjs_build(name, **kwargs): """Wrapper macro around nextjs cli Args: name: name **kwargs: **kwargs """ args = kwargs.pop("args", []) args = [ "build", # --outDir is parsed out by custom tool entry point & not forwarded to the underlying tool cli "--outD...
5,356,995
def arcball_constrain_to_axis(point, axis): """Return sphere point perpendicular to axis.""" v = np.array(point, dtype=np.float64, copy=True) a = np.array(axis, dtype=np.float64, copy=True) v -= a * np.dot(a, v) # on plane n = vector_norm(v) if n > _EPS: if v[2] < 0.0: v *= ...
5,356,996
def text( node: "RenderTreeNode", renderer_funcs: Mapping[str, RendererFunc], options: Mapping[str, Any], env: MutableMapping, ) -> str: """Process a text token. Text should always be a child of an inline token. An inline token should always be enclosed by a heading or a paragraph. """ ...
5,356,997
def patch_importlib_util_find_spec(name,package=None): """ function used to temporarily redirect search for loaders to hickle_loader directory in test directory for testing loading of new loaders """ return find_spec("hickle.tests." + name.replace('.','_',1),package)
5,356,998
def format_msg_controller(data): """Prints a formatted message from a controller :param data: The bytes from the controller message :type data: bytes """ return format_message(data, 13, "Controller")
5,356,999