content
stringlengths
22
815k
id
int64
0
4.91M
def gen_members(schema: List[StructField]): """ MEMBERS -> MEMBER | MEMBER ',' MEMBERS """ if len(schema) == 1: for t in gen_member(schema[0]): yield t else: for t in gen_member(schema[0]): yield t yield "," for t in gen_members(s...
5,326,900
def ws_notifications_connect(message): """ Handles incoming connections on the websocket `/notifications`. All senders are accepted and added to the `notification` group. Parameters ---------- message: channels.message.Message The first message which is send by the sender. "...
5,326,901
def unpack_singleton(x): """Gets the first element if the iterable has only one value. Otherwise return the iterable. # Argument: x: A list or tuple. # Returns: The same iterable or the first element. """ if len(x) == 1: return x[0] return x
5,326,902
def main(argv: Optional[Union[str, List[str]]] = None) -> object: """ Apply R4 edits to FHIR JSON files :param argv: Argument list. Can be an unparsed string, a list of strings or nothing. If nothing, we use sys.argv :return: 0 if all RDF files that had valid FHIR in them were successful, 1 otherwise...
5,326,903
def distribution_filter_for(bijector): """Returns a function checking Distribution compatibility with this bijector. That is, `distribution_filter_for(bijector)(dist) == True` implies that `bijector` can act on `dist` (i.e., they are safe to compose with `TransformedDistribution`). TODO(bjp): Make this sens...
5,326,904
def create_markdown_table(table_info: dict, index_name: str='Id') -> str: """ Returns a string for a markdown table, formatted according to the dictionary passed as `table_info` Parameters: table_info: Mapping from index to values index_name: Name to use for the index column R...
5,326,905
def callvote(*args, **kwargs): # real signature unknown """ Calls a vote as if started by the server and not a player. """ pass
5,326,906
def _parse_sequence(sequence): """Get a string which should describe an event sequence. If it is successfully parsed as one, return a tuple containing the state (as an int), the event type (as an index of _types), and the detail - None if none, or a string if there is one. If the parsing is unsuccessful...
5,326,907
def update_note(original_timestamp, new_timestamp, new_note): """Updates note at supplied timestamp""" delete_note(original_timestamp) save_note(new_timestamp, new_note)
5,326,908
def test_authz_version_not_supported(client, valid_upload_file_patcher, data): """ Test create /objects response when the authz provided is not supported. Assume valid input, ensure correct response. """ fake_jwt = "1.2.3" resp = client.post( "/objects", json=data, headers={"Authorizatio...
5,326,909
def make_car_dict(key: str, data: List[str]) -> Dict: """Organize car data for 106 A/B of the debtor :param key: The section id :param data: Content extract from car data section :return: Organized data for automobile of debtor """ return { "key": key, "make": data[0], "...
5,326,910
def insert_code(src, dest, kind): """Insert code in source into destination file.""" source_text = open(src).read().strip() destination_text = open(dest).read() destination_lines = destination_text.split('\n') destination_tree = ast.parse(destination_text) if not destination_tree.body: ...
5,326,911
def _CalculatePerDirectoryCoverageSummary(per_file_coverage_summary): """Calculates per directory coverage summary. Args: per_file_coverage_summary: A dictionary from file path to coverage summary. Returns: A dictionary from directory path to coverage summary. """ logging.debug('Calculating per-dire...
5,326,912
def is_aix(): """ Simple function to return if host is AIX or not """ return salt.utils.platform.is_aix()
5,326,913
def save_species_info(db, folder, name_freq, name2tax, sci2tax=None, id2tax=None, name2id=None, minimum=0): """Writes taxonomy and species name info to file. Written by Phil Wilmarth, OHSU, 2009. """ # sort the species names and write to file print('...writing species analysis ...
5,326,914
def draw_support_spring( fig, support, orientation="up", color='orange', show_values=True, row=None, col=None, units="N/m"): """Draw an anchored spring shape on a plotly figure. Parameters ---------- fig : plotly figure plotly figu...
5,326,915
def main(): """ Main function of the application. """ my_calc = QApplication(sys.argv) # Calculator user interface (View) view = MyCalculatorUI() view.show() # The model model = evaluate_result # Controller MyCalcController(data=model, calc_ui=view) # Executing the main l...
5,326,916
def _collins_crt(r, R, P, p, K): """Wrapper of CRT for Collins's resultant algorithm. """ return gf_int(gf_crt([r, R], [P, p], K), P*p)
5,326,917
async def test_load_pipette( decoy: Decoy, model_utils: ModelUtils, hardware_api: HardwareAPI, subject: EquipmentHandler, ) -> None: """It should load pipette data, check attachment, and generate an ID.""" decoy.when(model_utils.generate_id()).then_return("unique-id") result = await subject...
5,326,918
def quantity_remover(my_thing): """ removes pint quantities to make json output happy Parameters ---------- my_thing Returns ------- """ if hasattr(my_thing, 'magnitude'): return 'QUANTITY', my_thing.magnitude, my_thing.units.format_babel() elif isinstance(my_thing, ...
5,326,919
def updatePositions(now): """ Each tracked bee has a time to live of 2 seconds. If the bee was not found for this amount of time, its entry is cleared from the dictionary. """ # get global variables global position_dict remove = [] # for every tracked bee for entry in position_dict:...
5,326,920
def sliced_wasserstein(PD1, PD2, M=50): """ Implementation of Sliced Wasserstein distance as described in Sliced Wasserstein Kernel for Persistence Diagrams by Mathieu Carriere, Marco Cuturi, Steve Oudot (https://arxiv.org/abs/1706.03358) Parameters ----------- PD1: np.ar...
5,326,921
def chunks(a_list, chunk_size): """ Args: a_list: A list. chunk_size: Size of each sub-list. Returns: A list of sub-lists. """ for i in xrange(0, len(a_list), chunk_size): yield a_list[i:i + chunk_size]
5,326,922
def test_single_fa(mocker, bowtie_args): """Tests single-end invocation of bowtie2 with fasta file.""" bowtie_args['read_paths'] = [ bowtie_args['read_paths'][0].with_suffix('.fa') ] bowtie_args['read2_paths'] = None mock = mocker.patch.object(shell, 'run_piped') bowtie2(**bowtie_args)...
5,326,923
def update_handler(request): """Responds to any HTTP request. Args: request (flask.Request): HTTP request object. Returns: The response text or any set of values that can be turned into a Response object using `make_response <https://flask.palletsprojects.com/en/1.1.x/api/#fl...
5,326,924
def test_is_datasource_for(): """Test the is_datasource_for method of SOTMap. Note that header data to be provided as an argument can be a MapMeta object.""" assert sot.is_datasource_for(sot.data, sot.meta)
5,326,925
def test_undistort_pts_on_curve(): """ """ fx = 458.654 fy = 457.296 cx = 367.215 cy = 248.375 k1 = -0.28340811 k2 = 0.07395907 k1k2 = np.array([[k1], [k2]]) pts_orig = [ [546, 20], [545, 40], [543, 83], [536, 159], [535, 170], [534, 180],...
5,326,926
def usercourse(request, course_code): """ The function is use for course content """ user = request.user extrainfo = ExtraInfo.objects.select_related().get(user=user) # get the type of user courseid = Courses.objects.select_related().get(code=course_code) classes = OnlineClasses.objects.sel...
5,326,927
def add_device(config_id, name, device_type_id, device_subtype_id, ip4address, ip6address, properties): """Add device to BAM.""" response = get_api()._api_client.service.addDevice(config_id, name, device_type_id, device_subtype_id, ip4address, ip6address, p...
5,326,928
def test_parts_with_charm_part_with_plugin(basic_project, charmcraft_yaml, monkeypatch): """Parts are declared with a charm part that uses a different plugin. When the "parts" section exists in chamcraft.yaml and a part named "charm" is defined with a plugin that's not "charm", handle it as a regular part ...
5,326,929
def cdf_approx(X): #, smoothness_factor=1): """ Generates a ppoly spline to approximate the cdf of a random variable, from a 1-D array of i.i.d. samples thereof. Args: X: a collection of i.i.d. samples from a random variable. args, kwargs: any options to forward to the cvxopt qp solver ...
5,326,930
def cleanse_param_name(name): """Converts Chainer parameter names to ONNX names. Note ONNX identifiers must be a valid C identifier. Args: name (str): A Chainer parameter name (e.g., /l/W). Returns A valid ONNX name (e.g., param_l_W). """ return 'param' + name.replace('/', '_')
5,326,931
def calc_checksum_for_ip_change(old_ip_packet, new_ip_packet, old_checksum, is_ipv6=False): """ ip地址改变之后重新获取校检码 :param old_ip_packet: :param new_ip_packet: :param old_checksum: :param is_ipv6:是否是ipv6 :return: """ final_checksum = old_checksum a = 0 b = 1 # tmpcsum = old_check...
5,326,932
def get_sender_password(): """Get sender password """ try: return Setting.objects.get(slug=KEY_SENDER_PASSWORD) except Setting.DoesNotExist: return None
5,326,933
def standardize_data(df): """Standardizes the data by cleaning string values and standardizing column names. df: Pandas dataframe to standardize. """ # Clean string values in the dataframe. df = df.applymap( lambda x: x.replace('"', '').strip() if isinstance(x, str) else x) # Stand...
5,326,934
def MatrixExp6(se3mat): """Computes the matrix exponential of an se3 representation of exponential coordinates :param se3mat: A matrix in se3 :return: The matrix exponential of se3mat Example Input: se3mat = np.array([[0, 0, 0, 0], [0, ...
5,326,935
def parse_log(content, arg_parser=json_arg_parser): """ Parse important information from log files. These log files are small so we are making the logic a little simpler by loading all the content into memory at once rather than using an iostream. Args: content (string): the string content of t...
5,326,936
def update_db_conf(): """Update the database configuration.""" # TODO: Move this these into a common module, so we don't have to bury it like this. from .servers import set_database_ip from .servers import set_web_server_ips execute(set_database_ip) execute(set_web_server_ips) # Update the ...
5,326,937
def _ohlc_dict(df_or_figure, open='', high='', low='', close='', volume='', validate='', **kwargs): """ Returns a dictionary with the actual column names that correspond to each of the OHLCV values. df_or_figure : DataFrame or Figure open : string Column name to be used for ...
5,326,938
def _s_to_b(value): """[string to binary single value]""" try: return bytes(value, 'utf-8') except: return value
5,326,939
def get_or_create( *, db_session, email: str, incident: Incident = None, **kwargs ) -> IndividualContact: """Gets or creates an individual.""" # we fetch the individual contact from the database individual_contact = get_by_email_and_project( db_session=db_session, email=email, project_id=inciden...
5,326,940
def stats(request): """Return stats as JSON according to different GET query parameters.""" offset = request.GET.get('offset', '0') limit = request.GET.get('limit', '10') order_by = request.GET.get('order_by', 'public_backlinks') return build_stats(offset, limit, order_by)
5,326,941
def news(): """ Return the latest version of the news json """ # TODO: add options to request like request.args.get('from', default='') latest_news = get_latest_news(local=CONFIG['PARAMS']['local'] == 'True') response = app.response_class(response=latest_news, status=200) return response
5,326,942
def zero_crossing(arr, rank=1): """Calculates the zero crossing rate""" if rank == 1: nzc = tf.cast(tf.count_nonzero(tf_diff_axis(tf.sign(arr))), tf.float32) else: nzc = tf.cast(tf.count_nonzero(tf_diff_axis(tf.sign(arr)), axis=rank - 1), tf.float32) arrlen = tf.cast(arr.shape[rank - 1]...
5,326,943
def get_results_by(parameter, value, table='publications', conn_params=PARAMS): """Returns records by given parameter from publications""" with PostgresConnectionManager(conn_params, returns=True) as postgres: if value == '': postgres.cursor.execute(f"SELECT * FROM {table}") else: ...
5,326,944
def normalize_command(command): """Convert `command` to the string representation. """ if isinstance(command, list): if len(command) == 1: # This is either a quoted compound shell command or a simple # one-item command. Pass it as is. command = command[0] ...
5,326,945
def make_struct(*args, **kwargs): """Create a Struct class according to the given format""" exec _structdef(*args, **kwargs) return Struct
5,326,946
async def test_unload_entry(hass): """Test successful unload of entry.""" device = await setup_axis_integration(hass) assert hass.data[axis.DOMAIN] assert await axis.async_unload_entry(hass, device.config_entry) assert not hass.data[axis.DOMAIN]
5,326,947
def savefig(fig, filename, lgd=None, tikz=False, mpl3d=False, crop=False, sizes=(5.25, 5)): """ Save a figure in various formats. @param fig: figure object @param filename: filename (without extension) where the file should be stor...
5,326,948
def link_iterable_by_fields(unlinked, other=None, fields=None, kind=None, internal=False, relink=False): """Generic function to link objects in ``unlinked`` to objects in ``other`` using fields ``fields``. The database to be linked must have uniqueness for each object for the given ...
5,326,949
def is_conn() -> bool: """是否连接核心网""" return param.parent.ia != utz.IA_INVALID and param.parent.is_conn
5,326,950
def GetConstants(): """Returns a list of all available constant values used by some Nexpose Criteria""" return _get_filtered_classes(NexposeCriteriaConstant)
5,326,951
def getEmpiresForUser(user_email): """Fetches empires for the given user. Even though the empires should be in the data store already, we force fetch them from the server. This is because it could be a new user and it hasn't synced yet, but also this provides a way for the user to force their empire to update ...
5,326,952
def netflix(es, ps, e0, l=0.0001): """Combine predictions with the optimal weights to minimize RMSE. Ref: Töscher, A., Jahrer, M., & Bell, R. M. (2009). The bigchaos solution to the netflix grand prize. Args: es (list of float): RMSEs of predictions ps (list of np.array): predictions ...
5,326,953
def metadata_deep_check(metadata): """ This will check each metadata element to confirm it correctly abides by: 1 - Metadata Naming Convention guidelines 2 - Metadata 'priority' key guidelines 3 - Metadata 'link' key guidelines Naming Convention: - No Spaces - No Uppercase - No Hyp...
5,326,954
def patch_ibex(current_dir, ibex_tmp_dir, f_log): """ Patch ibex sources. """ # TODO: Remove the need for ibex.patch with open(os.path.join(current_dir, 'ibex.patch')) as f_patch: subprocess.check_call( "patch -p1", stdin=f_patch, stdout=f_log, stderr...
5,326,955
def train(vae, optimizer, num_epochs, device, train_loader, test_loader): """ Train and evaluate VAE """ for epoch in range(1, num_epochs+1): # Training ----------------------------- vae.train() train_loss = 0 for batch_idx, (data, _) in enumerate(train_loader): data ...
5,326,956
def create_list(list_data, user_id, status=200): """Create a new todo list throught the API""" res = app.post_json('/v1/users/{user_id}/lists'.format(user_id=user_id), list_data, status=status, expect_errors=status != 200) return res
5,326,957
async def create_movie( *, session: aio_session.AsyncSession = fastapi.Depends( dependencies.get_session), movie_in: movie_model.MovieCreate, current_patron: patron_model.Patron = fastapi.Depends( # pylint: disable=unused-argument dependencies.get_current_active_patron), ) -> movie_mode...
5,326,958
def example3(): """ Figure 2 (left) in the paper. Constraints: Points lie on y = -x + 5 for the domain (-5.0, -3.0). Points lie on y = x + 5 for the domain (3.0, 5.0). Positive (Gaussian) constraint prior used. """ bnn = BNNHMCRegressor(uid='EX3', configfile="configs/EX3.json") bnn.load(**toy2()) bnn.add_...
5,326,959
def project_gdf(gdf, to_crs=None, to_latlong=False, verbose=False): """ https://github.com/gboeing/osmnx/blob/v0.9/osmnx/projection.py#L58 Project a GeoDataFrame to the UTM zone appropriate for its geometries' centroid. The simple calculation in this function works well for most latitudes, but ...
5,326,960
def get_full_schema() -> dict: """ Return the full schema for Jina core as a dict. """ from .. import __version__ from ..importer import IMPORTED from .driver import schema_all_drivers from .executor import schema_all_executors from .flow import schema_flow from .meta import schema_m...
5,326,961
def power_method(A, x0, n_iter=1): """Compute the first singular components by power method.""" for i in range(n_iter): x0 = A.T @ A @ x0 v = x0 / norm(x0) s = norm(A @ v) u = A @ v / s return u, s, v
5,326,962
def convert_coevalcube_to_sphere_surface_inpdict(inpdict): """ ----------------------------------------------------------------------------- Covert a cosmological coeval cube at a given resolution (in physical comoving distance) to HEALPIX coordinates of a specified nside covering the whole sky or...
5,326,963
def postmsg(message): """!Sends the message to the jlogfile logging stream at level INFO. This is identical to: @code jlogger.info(message). @endcode @param message the message to log.""" return jlogger.info(message)
5,326,964
def _linelabels(df, ax, x, y, label, colors=None, loc='end', label_width=100, **kwargs): """ Args: df: DataFrame[x, y, label, ...] ax: Current axes. x: Column for x-axis. y: Column for y-axis. label: Column for label text. colors: Lookup table { label: color }. loc: Position of label. ...
5,326,965
def test_managed_sub_account_withdraw_assets_without_asset(): """Tests the API endpoint to withdraw asset from managed sub account without asset""" params = { "fromEmail": "alice@test.com", "asset": "", "amount": 1, "transferDate": 1624023242, "recvWindow": 1000, } ...
5,326,966
def test_zjump_gt(): """Tests for zjump values.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'find', 'pass_zjump.swc', '-z', '19'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ...
5,326,967
def dec_lap_pyr(x, levs): """ constructs batch of 'levs' level laplacian pyramids from x Inputs: x -- BxCxHxW pytorch tensor levs -- integer number of pyramid levels to construct Outputs: pyr -- a list of pytorch tensors, each representing a pyramid level, ...
5,326,968
def modify_hsbk_calculation(): """ The way hsbk is calculated for canvas is close enough but not as accurate as the rest of Photons because it doesn't need to be as accurate and the changes are optimised for performance Unfortunately this means that comparisons in tests aren't so great, so let's modify...
5,326,969
def test_presplit(): """Test stub.""" assert True
5,326,970
def print_config(config, logger): """ Print configuration of the model """ for k, v in config.items(): logger.info("{}:\t{}".format(k.ljust(15), v))
5,326,971
def subinit2_readPPdb_checkkeys(PATHS, config, metadata): """ Reads the power plant database and determines the required input files (fundamentals and parameters): 1) Read the power plant database from disk 2) Read the database and check the required input files for: - fuels - efficiency curves ...
5,326,972
def cal(): """ 正方形的内切圆,半径为1,面积比为pi/4,n个点落入正方形,则落在圆的概率为pi/4 """ n = 10000000 # 随着n值的增大,精确性也会提高 r = 1.0 a, b = (0.0, 0.0) x_neg, x_pos = a - r, a + r y_neg, y_pos = b - r, b + r count = 0 for i in range(0, n): x = random.uniform(x_neg, x_pos) y = random.uniform(y_...
5,326,973
def mif2amps(sh_mif_file, working_dir, dsi_studio_odf="odf8"): """Convert a MRTrix SH mif file to a NiBabel amplitudes image. Parameters: =========== sh_mif_file : str path to the mif file with SH coefficients """ verts, _ = get_dsi_studio_ODF_geometry(dsi_studio_odf) num_dirs, _...
5,326,974
def write_nifti_header(hdrname, hdr, newfile=True): #************************************************* """ filename is the name of the nifti header file. hdr is a header dictionary. Contents of the native header will be used if it is a nifti header. Returns: 0 if no error, otherwise 1. """ ...
5,326,975
def get_array_of_float(num, data): """Read array of floats Parameters ---------- num : int Number of values to be read (length of array) data : str 4C binary data file Returns ------- str Truncated 4C binary data file list List of floats """ ...
5,326,976
def test_operations_in_a_time_round__assert_peer_number_normal( scenario: Scenario, engine: Engine, performance: Performance ) -> None: """ This tests operations_in_a_time_round(). It asserts if the peer number is correct after a time round of operations. """ # Arrange. single_run_instance:...
5,326,977
def AUcat(disk=None, first=1, last=1000, Aname=None, Aclass=None, Aseq=0, giveList=False): """ Catalog listing of AIPS UV data files on disk disk Strings use AIPS wild cards: * blank => any '?' => one of any character "*" => arbitrary string If giveList then r...
5,326,978
def process_threat_results(matching_threats, context): """ prepare response from threat results """ threats = [ThreatSerializer(threat).data for threat in matching_threats] response_data = { "id": context.id, "hits": threats, } status_code = status.HTTP_200_OK if context.pending...
5,326,979
def add_WMA(self, timeperiod=20, type="line", color="secondary", **kwargs): """Weighted Moving Average.""" if not self.has_close: raise Exception() utils.kwargs_check(kwargs, VALID_TA_KWARGS) if "kind" in kwargs: type = kwargs["kind"] name = "WMA({})".format(str(timeperiod)) s...
5,326,980
def main(): """ Main entry point """ t_6hrPlev = DataRequest.objects.filter( institution_id__name='MPI-M', table_id = '6hrPlev', cmor_name__in = ['wap4'] ).exclude( experiment_id__name='highresSST-present' ) t_6hrPlevPt = DataRequest.objects.filter( i...
5,326,981
def entropy_logits(logits): """ Computes the entropy of an unnormalized probability distribution. """ probs = F.softmax(logits, dim=-1) return entropy(probs)
5,326,982
def show_overview(gfile,dfile,xyd,xyref,xh,yh,ww,objname,save=False,container=None, params={'figsize':(10,10), '221':{'minmax':(5.,99.),'cmap':'viridis','s':30,'facecolor':'None','edgecolor':'red','fontsize':12,'title':'default'}, '222':{'minmax':(5.,99.),'cmap':'viridis','s':...
5,326,983
def convert_int_to_str(number: int, char: str = "'"): """Converts an ugly int into a beautiful and sweet str Parameters: nb: The number which is gonna be converted. char: The characters which are gonna be inserted between every 3 digits. Example: 2364735247 --> 2'364'735'247""" number ...
5,326,984
def exists(index, doc_type, id, **kwargs): """ Returns a boolean indicating whether or not given document exists in Elasticsearch. http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html """ res = request("exists", None, index, doc_type, id, **kwargs) jsonprint(res) retu...
5,326,985
def deserialize_cookie(string): """Deserialize cookie""" parts = string.split("#") length = len(parts) if length == 0 or length < 3: return None if not is_int(parts[2]): return None return create_internal_cookie( unquote(parts[0]), unquote(parts[1]), pa...
5,326,986
def multivolume_record(self, key, value): """Mark record with many volumes inside.""" val_a = clean_val("a", value, str) _migration = self["_migration"] if val_a == "MULTIVOLUMES1": parsed = False elif val_a == "MULTIVOLUMESX" or val_a == "MULTIVOLUMESx": parsed = True elif val_a...
5,326,987
def choose(n, k): """This is a binomial coeficient nCk used in binomial probablilty this funtion uses factorial() Usage: choose(n, k) args: n = total number k = total number of sub-groups """ try: return factorial(n)/(factorial(k) * factorial(n - k)) except(ValueError, ZeroD...
5,326,988
def BiRNN(x, seq_lens): """TODO: full docstring; seq_lens is np_array of actual input seq lens. Actually seq_lens is a tf.placeholder""" # data input shape: (batch_size, seq_lens, n_input) # Define lstm cells with tensorflow # Forward direction cell lstm_fw_cell = rnn.BasicLSTMCell(n_hidden, fo...
5,326,989
def get_os_group(name: _STR_OR_INT_OR_NONE = None) -> grp.struct_group: """Get an operating system group object. Args: name (:obj:`str` or :obj:`int`, optional): The "group name" or ``gid``. Defaults to the current users's group. Raises: OSError: If the given ``name`` does not ...
5,326,990
def _process_output(response, context): """Post-process TensorFlow Serving output before it is returned to the client. Args: response (obj): the TensorFlow serving response context (Context): an object containing request and configuration details Returns: (bytes, string): data to r...
5,326,991
def auto_declare_serializers(models_module, context): """ Automatically declares classes from serializers :param models_module: Passes the module to search model classes. :param context: Context module to export classes, should passes locals(). """ for model in models_module.__dict__.values(): ...
5,326,992
def execute_dscl(option="-plist", datasource=".", command="-read", parameters=""): """Execute dscl and return the values Args: option (str, optional): The option to use. Defaults to "-plist". datasource (str, optional): The node to query. Defaults to ".". command (str, optional): The ds...
5,326,993
def main(): """ We train a model and then use it to predict on the specified videos """ try: # This process periodically uploads the stdout and stderr files # to the S3 bucket. The website uses these to display stdout and stderr pid = os.getpid() upload_process = upload_stdo...
5,326,994
def extract_use_action_msgs(outfile, use_action, it_name, kwargs): """Extract messages for iuse_actor objects. """ for f in sorted(use_action_msgs): if type(use_action) is dict and f in use_action: if it_name: use_action[f] = writestr(use_action[f], **kwargs) # Recursivel...
5,326,995
def make_soup(text: str, mode: str="url", parser: str=PARSER) -> BeautifulSoup: """ Returns a soup. """ if mode == "url" or isinstance(mode, dict): params = mode if isinstance(mode, dict) else {} text = requests.get(text, params=params).text elif mode == "file": text = open(text) ...
5,326,996
def _merge_inner_function( class_def, infer_type, intermediate_repr, merge_inner_function ): """ Merge the inner function if found within the class, with the class IR :param class_def: Class AST :type class_def: ```ClassDef``` :param infer_type: Whether to try inferring the typ (from the defau...
5,326,997
def dump_single_value(path_and_file, value, append=False): """ Open a file in the binary mode, dump a single value and close file >>> dump_single_value("test_file_single.tmp", "test_value") :param path_and_file: path to file :param value: value to dump :param append: True to open file in "ab" ...
5,326,998
def fnmatch_fnmatch(): """判断文件是否匹配""" pattern = "*.PY" print("Pattern: ", pattern) print() files = os.listdir(".") for name in files: print("Filename: {:<25} {}".format(name, fnmatch.fnmatch(name, pattern))) """ Pattern: *.py Filename: a False Filename: dir ...
5,326,999