content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def parse_conf_node(env: BuildEnvironment, text: str, node: addnodes.desc_signature) -> str: """ Parse the content of a :rst:dir:`conf` directive. :param env: The Sphinx build environment. :param text: The content of the directive. :param node: The docutils node class. """ args = text.split('^') name = args[0...
0653104b79df7d732813c6801e7c81d9aaa21b25
43,700
def are_postgres_migrations_uptodate() -> bool: """ Check that all migrations that the running version of the code knows about have been applied. Returns `True` if so, `False` otherwise """ try: executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) plan = executor.migratio...
e3f06d27ef3fa63b9ec1ea91f08f98523b896108
43,701
def step_lr(lr_max, epoch, num_epochs): """Step Scheduler""" ratio = epoch/float(num_epochs) if ratio < 0.3: return lr_max elif ratio < 0.6: return lr_max*0.2 elif ratio <0.8: return lr_max*0.2*0.2 else: return lr_max*0.2*0.2*0.2
515bb508a207f6aa5175756b49f26d53de9d7f6f
43,702
def insertion_sort_counting(A): """ Instrumented Insertion Sort to return #swaps, #compares. """ N = len(A) num_swap = num_compare = 0 for i in range(N): for j in range(i, 0, -1): num_compare += 1 if A[j - 1] <= A[j]: break num_swap += ...
260f9a404f80ba93ce12cfcac9aade2135c61097
43,703
def dir_basename_from_pid(pid,j): """ Mapping article id from metadata to its location in the arxiv S3 tarbals. Returns dir/basename without extention and without full qualified path. It also ignores version because there is no version in the tarbals. I understand they have the updated version in the tarball...
38a955b2caecfa65f8aad44c8cf0fbc21d0b3709
43,704
def heat_capacity(T, E, S): """ This function calculates the heat capacity by taking in the temperature 'T', energy 'E', and entropy 'S' as NumPy arrays. The number 'Num' is also necessary to complete the heat capacity calculation. """ C = np.zeros_like(T) for i in range...
679f4ce34e50684665c0aa0e24fb4721fa81093a
43,705
def retrieve_penalties_from_event_data(period_events): """ Retrieves penalty information from game event data. """ penalties_dict = dict() for period in period_events: events = period_events[period] for event in events: if event['type'] != 'penalty': cont...
03bdc9a35b82db2e6e0a71529bb39a8425e816a1
43,706
def create_folder_old(cluster_indices, yhat): """ :param cluster_indices: function that returns numpy array of list of indices where the specified label = actual label (yhat) :param yhat: numpy array of class labels :return: list of list of indices by label """ folders = [cluster_indices(-1, yha...
1f6d841d3ac77cabc35991ec5df749f1f14c5702
43,707
def seconds_to_hours( move_data, label_time=constants.TIME_TO_PREV, new_label=None, inplace=True ): """ Convert values, in seconds, in label_distance column to hours. Parameters ---------- move_data : pymove.core.MoveDataFrameAbstract subclass. The input trajectory data label_time ...
f53e4744f81de69142896b9b360b2588fbe2bba3
43,708
def numba_hist(samples, bins, range): """ Wrapper to optimise numpy's histogram function with numba. """ return np.histogram(samples, bins, range)
329c202fd5e4e26d5a561787fce205dc2000ef71
43,709
import traceback def prepare_product_terms(session_context, product_dict, attributes=None, reprocessing_product=False, batch_processing=False): """ Processes the terms (cleans stop-words, stems, counts, persists DF's and TFIDF's) of all TEXT-type attributes of the given product. ...
28468a510264eeb13f76c1d04819cfeb2127c566
43,710
def ortools_wrapper_count_solutions(model,var_array): """ ortools_wrapper((model,var_array,print_solution=print_solution,num_sols=0) This is a simple wrapper for just counting the solutions of a model. Parameters: - model : the model - var_array: the array of arrays of the decision vari...
637ffd69ebe15497b59e01ae6c7f2c59bc5afcae
43,711
import os import torchvision def load_data_mnist_without_cfg(batch_size, resize=None, root=os.path.join( '~', '.pytorch', 'datasets', 'mnist'), use_normalize=True): """Download the MNIST dataset and then load into memory.""" root = os.path.expanduser(root) transformer = [] if resize: trans...
b632dd496ca7970bf18e84429e6a960e93c40a8c
43,712
def find_manhattan_distance(): """ Двигаемся из точки (0,0) в соответствие со списком инструкция: Nx - двигаться на North на x клеток Sx - двигаться на South на x клеток Ex - двигаться на East на x клеток Wx - двигаться на West на x клеток Lx - сменить направление взгляда на x градусов влево...
d938875ada591b4d6b62f7b601113bf1bd5752d2
43,713
import zipfile import posixpath import os import shutil def _extract_local_archive(working_dir, cleanup_functions, env_name, local_archive): """Helper internal function for extracting a zipfile and ensure that a cleanup is queued. Parameters ---------- working_dir : str cleanup_functions : List[(...
cb8bf09eda7a3f75e862a448462ee3470ef18cf5
43,714
def padded_chunks(l, n): """Yield successive n-sized chunks from l.""" tl = n out = [] for i in range(0, len(l), n): if i + n > len(l): tl = n - (len(l) - i) out.append(np.pad(np.array(l[i:]), ((0, tl), (0, 0)), 'constant')) else: out.append(np.array(l...
6a566e0e3319fcd6a9e59e4f25384c037c1f5e12
43,715
import argparse def _get_arguments(): """Build argument parser.""" parser = argparse.ArgumentParser(description='This starts a measure calculation.') parser.add_argument( '-s', '--state', help=""" State to extract data from. """, required=True, ty...
6fd8ce6c7b8fcab67be37669155289c0559198d4
43,716
import re def fix_extension(filename_end): """Processes ending section of filename to get extension Args: filename_end (str): starting section of filename Returns: str: file extension """ return_value = filename_end pattern_string = r".*\.(\w{3})$" pattern = re.compile( ...
5317c3c52920d669374ac72cc6cccc70a2740174
43,717
def rhombus_area(diagonal_1, diagonal_2): """Returns the area of a rhombus""" # You have to code here # REMEMBER: Tests first!!! return (diagonal_1 * diagonal_2) / 2
1b11e0e250d15198b4275c167ce9aa2302292d67
43,718
def aes_decrypt(ciphertext, password): """ This runs a command equivilent to: echo $ciphertext | openssl enc -aes-256-cbc -a -A -d -k $password to produce plaintext. """ p0 = Popen(["1", ciphertext], shell=False, stdout=PIPE, executable="echo") p1 = Popen(["1", "enc", "-aes-256-cbc", "...
506acab25e87f3a0293d27d4a6037c5fefb59b03
43,719
def unicode_dict(_dict): """ Make sure keys and values of dict is unicode. """ r = {} for k, v in iteritems(_dict): r[unicode_string(k)] = unicode_obj(v) return r
a9c43839af61c6868b844a6f6a2f817f4d412867
43,720
def first(column, ignore_nulls=False): """ Returns the first value in a group. The function by default returns the first values it sees. It will return the first non-null value it sees when ``ignore_nulls`` is set to true. If all values are null, then null is returned. """ return _with_expr(exp...
96ede0db2851a7f127b0d434b37cb9388f31221a
43,721
def group_configurations_detail_handler(request, course_key_string, group_configuration_id, group_id=None): """ JSON API endpoint for manipulating a group configuration via its internal ID. Used by the Backbone application. POST or PUT json: update group configuration based on provided informat...
39d20002df7f4a21fad2b91c192927a75ff10d20
43,722
def geodetic2geocentric(h, lat, lon, ellipsoid=None, **kwargs): """Convert from geodetic to geocentric coordinates. The geodetic coordinates refer to the reference ellipsoid specified by input ellipsoid. See module docstring for a defintion of the geocentric coordinate system. Parameters: ...
bace36df42bbcfde0bb83bc7caaee73aa0ea9bdc
43,723
def test_conditional_shared_limits(): """Test that conditional shared limits work.""" app = Flask(__name__) limiter = Limiter(app, key_func=get_remote_address) @app.route("/limited") @limiter.shared_limit("1 per day", "test_scope") def limited_route(): return "passed" @app.route("/...
755a98fa963c30e07853f25198643c9fad3c5b88
43,724
def _profile_is_configured(profile): """ Check if given profile is already configured. Args: profile (str): Profile to check. Returns: bool: Whether the profile was already configured or not. """ exit_code, _ = awscli(f"configure list --profile {profile}") return not exit_code
fe238800c13bee45b2da2fb8fa4b95b63009f04a
43,725
def is_equidistant(energy, tol=1e-08): """Returns True only when energy is equidistant.""" spacings = np.unique(np.diff(energy)) for spacing in spacings[1:]: if not np.isclose(spacing, spacings[0], atol=tol): return False return True
045466cc02e4a29724fe9ee6d0010a961eaf58c2
43,726
import numpy as np def acf(x,l): """ Auto correlation function of a given vector x with a maximum lag of length l. """ return np.array([1]+[np.corrcoef(x[:-i], x[i:])[0,1] \ for i in range(1, l)])
f168cf69b7055508a95c22b869b36e5c808f5953
43,727
def gDawson(n): """Return the G-value of a single Dawson game""" if n == 0: return 0 if n == 1: return 1 successors_g = [] for next_state in successors(n): if len(next_state) == 1: successors_g.append(gDawson(next_state[0])) else: successors_g....
9bea61f8593d40d007934d29c6f414fa645c2421
43,728
from typing import Optional def preprocess_data( exec_time_data: pd.DataFrame, neuro_bins: arrays.IntervalArray | pd.IntervalIndex, impair_bins: arrays.IntervalArray | pd.IntervalIndex, duration_bins: arrays.IntervalArray | pd.IntervalIndex, transition_fade_distance: Optional[int] = None, ) -> pd....
92e51430acb2295a135d95433a460b9334260114
43,729
import logging import sys import json import requests def calc_stats(geojson, request, geostore_id): """Given an input geojson and (optionally) some params (period, agg_by, etc), calculate the # of alerts in an AOI""" geom = shape(geojson['features'][0]['geometry']) geom_area_ha = tile_geometry.ca...
62a21521145baf7d8ada10a7a7e059e99a397dd3
43,730
def op_name(graph, tfobj_or_name): """ Get the name of a tf.Operation :param graph: tf.Graph, a TensorFlow Graph object :param tfobj_or_name: either a tf.Tensor, tf.Operation or a name to either """ graph = validated_graph(graph) return get_op(graph, tfobj_or_name).name
100e0c371cae4339c4740e00ad10f5f4b26d54f7
43,731
def check_conflict(tracks): """Check if there are 2 tracks in the same frame""" conflict_idx = [] for i in range(len(tracks)): for j in range(len(tracks)): temp_dets = np.concatenate([tracks[i].dump(), tracks[j].dump()], axis=0) if i!=j and not debug_frame(temp_dets): ...
3bae96fac6ff7b99fd58a8a66ba42804903e5e01
43,732
import os import json def save_pbobject_as_json(pb_object, save_path): """ Save protobuf (pb2) object to JSON file with our standard indent, key ordering, and other settings. Any calls to save protobuf objects to JSON in this repository should be through this function. Parameters ---------- ...
d27c95ccb2a95863f8ea853b02215ab16d7988d1
43,733
def parse_map_align_stdout(stdout): """Parse the stdout of map_align and extract the alignment of residues. Parameters ---------- stdout : str Standard output created with map_align Returns ------ dict A dictionary where aligned residue numbers in map_b are the keys and resi...
4cb699ffbb817e80402af22b08240323012919f8
43,734
def diff_dicts(new, origin): """Only compare the first layer, return a the dict that represent add, remove, modify changes from new to origin NOTE: If one of the two dicts comes from another, eg. from .copy(), # make sure new and origin are totally different from each other, that means, the result ...
45412104ff754096e66f64e0028dd1a9dcc5f715
43,735
def move_to_answer(request, post, **kwargs): """ Move this post to be an answer """ parent = post.root ptype = Post.ANSWER msg = "dragged post to answer" return move(request=request, parent=parent, source=post, ptype=ptype, msg...
ae63e914558b599a0184b52bc2b51d8ec69b1f62
43,736
import requests def read_feed(feed_url): """ Generates an events list based on a calendar URL :param feed_url: valid URL for an iCalendar feed :returns: list of icalendar Events """ response = requests.get(feed_url) cal = Calendar.from_ical(response.content) return get_events(cal)
3139c31246f2ac5f310e33b616ea8ba8860213e7
43,737
def nonmatsubara_exponents(coup_strength, cav_broad, cav_freq, beta): """ Get the exponentials for the correlation function for non-matsubara terms for the underdamped Brownian motion spectral density . (t>=0) Parameters ---------- coup_strength: float The coupling strength parameter. ...
84e441dfd7f8b8bf6e0aaed8b5811eb89acd881a
43,738
def get_branch_index_sub_divide(sub_divisions, edge_index, edge_degree, box_size=None, edge_x=None, edge_y=None, edge_z=None, phi=None, theta=None, edge_phi=None, edge_theta=None, branch_cutting_frequency=1000, mode='Euclidean', two_dimension=True): ""...
b20e67d6ed6cad2fa8220cb2390f7de8e90afeb5
43,739
def get_approved_anime_posts(conn, mal_id) -> dict: """ Get reddit posts for some anime, that were manually checked and approved. """ with conn: with conn.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: query = """select mar.post_id, mar.sub_name, mar.source_link, mar.vi...
4bb3aa0817870a9d549a76e65401faa3e91f3748
43,740
import re def get_default_look_in_description(schema_node: SchemaNode) -> str: """Filter. Get the default value of a JSON Schema property. If not set, look for it in the description.""" default_value = get_default(schema_node) if default_value: return default_value description = schema_node.k...
4c4d514de3f58e5d7ebef0f4311715065c272ff6
43,741
from datetime import datetime def deserialize_date(data_type, data, model_finder): """Deserializes data into a python date Expected input value in format YYYY-MM-DD as per https://tools.ietf.org/html/rfc3339#section-5.6 standard Raise ValueError if the input is well formatted but not a valid...
1eef3879449dfa5ac237959d79a03864f0e931bf
43,742
def tsunami_forecast_render(): """ Renders the tsunami forecast index. """ return render_template("tsunami_forecast.html")
2711660aebc4fd7a879bc0b70b669503c50e715a
43,743
import numpy import torch def get_tensor_n_elements(tensor): """Return the number of elements in a tensor.""" if isinstance(tensor, numpy.ndarray): return tensor.size if torch_available(): if isinstance(tensor, torch.Tensor): return torch.numel(tensor) raise ValueError("Uns...
efbedb6fc34bbff5e4b9122a439c5419049008ad
43,744
from typing import Callable from typing import Any from typing import Union def task( fn: Callable = None, **task_init_kwargs: Any ) -> Union[ "prefect.tasks.core.function.FunctionTask", Callable[[Callable], "prefect.tasks.core.function.FunctionTask"], ]: """ A decorator for creating Tasks from fu...
deaf4deae87c43b84a2ee1d24d8b73cebf781971
43,745
import math def ads(x, adsParameter): """ ADS function """ p = adsParameter exp1 = 1 + math.exp(-1 * (x - p.C + p.D / 2) / p.E) exp2 = 1 + math.exp(-1 * (x - p.C - p.D / 2) / p.F) dx = p.A + p.B / exp1 * (1 - 1 / exp2) return dx / p.DMAX
f09f35aea0bc43c3dcefb922a306c6745e472aaa
43,746
def label_diversity_norm(label): """ label差异性均值 :param label: :return: """ return label_diversity(label) / label_set_num(label)
5563cf0330af55ea701473ad5c87c1ee21046d35
43,747
def last_common_ancestor(taxonomies): """Compute last common ancestor""" lca = list() if len(taxonomies) > 1: zipped = zip(*taxonomies) for level in zipped: if len(set(level)) > 1: level = "*" else: level = level[0] lca.appe...
0f49b2faa2e480afd41b93d5442d2ee1b86d5b24
43,748
from typing import Optional def get_resource_share(id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetResourceShareResult: """ Resource Type definition for AWS::RAM::ResourceShare """ __args__ = dict() __args__['id'] = id if opts is Non...
c72ee6154de617b02ccf8260bd8b7169538c1b28
43,749
import struct import socket def ip_to_ascii(ip_address): """ Converts the quad IP format to an integer representation. """ return struct.unpack('!L', socket.inet_aton(ip_address))[0]
2cb3ccbe70eed2dd2e8ac21d10e180805dec95ea
43,750
from functools import reduce def nck(nval, kval): """from https://stackoverflow.com/questions/4941753/is-there-a-math-ncr-function-in-python""" # https://en.wikipedia.org/wiki/Binomial_coefficient""" # Computes the binomial coefficient n choose k""" kval = min(kval, nval-kval) numer = reduce(op.mu...
f3628850361a7609c3ba88acd168f646e5839652
43,751
def accumulate(results, gt, weights = None, exclude_keys = []) : """ Take results from evaluate_objects and ground truth and compile a simple data structure containing correct, total and nb_correlations """ # Get default weights if weights == None : weights = { a : { o : 1 for o in t.keys()...
813ac2d8d028a7d9d76e605bfdb143a8349b3c54
43,752
def _method_from_mod(block_dets, modname, methodname): """ E.g. from os import getcwd from os.path import join from os.path import join as joinpath <ImportFrom lineno="4" col_offset="0" type="int" module="os" level="0"> <names> <alias type="str" name="getcwd"/> """ imp...
d50c91099feee6ee40e8d7ae682112bd4ce6d0f6
43,753
def label(text='Origin', pos=(0, 0, 0), scale=(0.2, 0.2, 0.2), color=(1, 1, 1)): """Create a label actor. This actor will always face the camera Parameters ---------- text : str Text for the label. pos : (3,) array_like, optional Left down position of the label. s...
4ddad78c4a84b9668b1468c850ed9f1f241dab05
43,754
from typing import Any import jsonschema def validate_schema(schema_key: str, value: Any, draft_checker=jsonschema.draft7_format_checker) -> Any: """Validate a JSONSchema according a json model. .. versionadded:: 0.6.0 Raises: jsonschema.ValidationError: When the current value does not match wit...
361eef4099f5feef470e4f774de6bd3ed6ac5cf5
43,755
from typing import Any from typing import Sequence def complete_ports(_: Any, __: Any, incomplete: str) -> Sequence[str]: """Returns common ports for completion.""" return [k for k in ('80', '443', '8080') if k.startswith(incomplete)]
694306ae57bcfd21d6fa73a595768dde0ffba86a
43,756
import glob import os def import_modules(modules_path, skip_list=None): """ Dynamically imports python modules found in the provided directory and returns a list of the module objects found. Args: modules_path (str): filesystem path containing modules to import skip_list (list): modul...
de74ae9b6b786cbaed5d8eef88572d442432020a
43,757
def compute_local_coordinates(cx, cy, x, y, newton_tol=1e-12, interpolation_scheme='nufft', guess_ind=None, verbose=False, max_iterations=30): """ Find (s, r) given (x, y) using the coordinates: x = X(s) + r n_x(s) y = Y(s) + r n_y(s) Where X, Y is given by cx, cy Uses a NUFFT based...
7ef363d65f73122dd358a08885fe22e73a40d25c
43,758
from time import localtime def parse_search(interms): """We go to the trouble of parsing searches ourselves because ADS's syntax is quite verbose. Terms we support: (integer) -> year specification if this year is 2014, 16--99 are treated as 19NN, and 00--15 is treated as 20NN (for "2015 in ...
6734b9a204a024cc53bd7dce7b4a3a734c8f9e68
43,759
import traceback def gunicorn_sync_wrapper(wrapped, _instance, args, kwargs): """ Wraps the gunicorn sync worker handle request. Catches request handling errors and finally sending the trace. :param wrapped: wrapt's wrapped :param _instance: wrapt's instance :param args: wrapt's args :para...
da1b0047de8f439ead29c72693c2e9b8fb9f81ed
43,760
from typing import List from typing import Any from typing import Optional def make_table( rows: List[List[Any]], labels: Optional[List[Any]] = None, centered: bool = False ) -> str: """ :param rows: 2D list containing objects that have a single-line representation (via `str`). All rows must be of the...
3837a50395a215206dff1af1836545ea8620c26c
43,761
def _get_max_mem(): """Return the current cgroup's memory high water mark.""" try: with open("/sys/fs/cgroup/memory/memory.max_usage_in_bytes") as f: return float(f.read().strip()) except Exception: return 0
6031fdc75c6ca2fd8f74e52951316e708b0eb36e
43,762
import os def add_image(qc_html, image, title=None): """ Adds an image to the report. """ if title: qc_html.write('<center> {} </center>'.format(title)) relpath = os.path.relpath(image, os.path.dirname(qc_html.name)) qc_html.write('<a href="' + relpath + '" >') qc_html.write('<img...
01c4117c3ae9e18b6cfc49bcad11af97b80bc130
43,763
def gaussian_lowpass(sigma: tf.Tensor, filter_size: int): """Generates gaussian windows centered in zero, of std sigma. Args: sigma: tf.Tensor<float>[1, 1, C, 1] for C filters. filter_size: length of the filter. Returns: A tf.Tensor<float>[1, filter_size, C, 1]. """ sigma = tf.clip_by_value( ...
b27997c1af357d9b335f4b4b60d7f2ad18112470
43,764
from typing import List def predict_on_structure_par_en(structure: Structure, gp: GaussianProcess, n_cpus: int = None, write_to_structure: bool = True, selective_atoms: List[int] = None, ski...
e0c1a58ea5cd0fdf2fc0de73f94e2cbd186de41d
43,765
import unittest def suite(): """Gather all the tests from this package in a test suite.""" test_suite = unittest.TestSuite() test_suite.addTest(unittest.makeSuite(TestRevokeReport, "test")) return test_suite
1d868b629232e65bc24d0db9171e7284faab7cad
43,766
import re def get_sender(msg): """ Returns the best-guess sender of an email. Arguments: email -- the email whose sender is desired Returns: Sender of the email. """ sender = msg['From'] m = re.match(r'(.*)\s<.*>', sender) if m: return m.group(1) ...
3d88a6861df26d4ca7a5269346cbd14c09d248dc
43,767
def coord_arg_to_coord(carg): """ Parameters ---------- carg : str Argument from parser for coordinates Eligible formats are like: J081240.7+320809 122.223,-23.2322 07:45:00.47,34:17:31.1 Returns ------- icoord : str or tuple Allowed format for c...
16a6cb8090dc040b7b5f6a1a4ba873ea65e0dfdf
43,768
def clear_geolocation_override() -> dict: """Clears the overriden Geolocation Position and Error.""" return {"method": "Emulation.clearGeolocationOverride", "params": {}}
92c77ab41a443bda9bc0d132228f37b73581cfa7
43,769
def amount_in_location(obj, user): """ Returns how many instances of this product are at the current user's location """ return obj.get_amount_stocked(user)
4b722cb9e5721cbc2c7d87ff30046087853cd5c0
43,770
def getRayCircleIntersections(startPoint, direction, center, radius): """ Calculate distances, from start, where a ray intersects a circle. Returns a list of distances of length 0, 1 or 2. The smallest distance always appears 1st and can be negative to represent the case of the intersection being "b...
ae8c67aa80c65a94bffec0542523ca42ffd8adb9
43,771
def ip_attributes(system, request, row, row_counter, model): """ IP addresses are set depending on config """ # remove existing IP addresses for this system (not relevant for newly created systems) if model.csv_remove_ip: # remove many to many relation between system and ip without deleting existin...
72c43f970a7ffcf222c5dfd8f5a5b6d337d2c3fd
43,772
def is_tree_super_balanced(root): """Check if the tree is super balanced or not.""" d_max = depth_of_tree(root) d_min = depth_of_tree(root, False) if d_max - d_min > 1: return False else: return True
d3e9c9c7440d7b2c63bf02b43bfc15a51821c3f7
43,773
def load_user(user_id): """This function loads the user.""" user = session.query(User).filter_by(id=user_id).first() if not user: flash('invalid username or password') abort(400) return user
4ea98d86eb7abac727d4e0c0e32530753176f12c
43,774
def CombinatorialAuction( df, id_label="id", price_label="price", element_label="element", buyer_label="buyer", limit=-1, **kwargs, ): """ 組合せオークション問題 要素を重複売却せず、購入者ごとの候補数上限を超えないように売却金額を最大化 入力 df: 候補のDataFrameもしくはCSVファイル名 id_label: 候補番号の属性文字 price_l...
cb860df0093ad243a834322761815939b9220f80
43,775
def format_string(): """Returns the format string of the binary file""" return "IIccccI?cccc"
f833be1ff5ffcbc538ba0b785e9fe43c0513b688
43,776
def crear_actualizar_ciudadano_reniec(numero_documento, uuid=None): """ Obtiene datos de ciudadano desde RENIEC :param numero_documento: Número de documento a consultar en RENIEC :param uuid: UUID de ciudadano a actualizar :return: ciudadano """ verificar_conexion_internet() ciudadano ...
05d7bef4719537ba08424fca95f47b6b57fd60c3
43,777
def obj_box_zoom( im, classes=None, coords=None, zoom_range=(0.9, 1.1), row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0., order=1, is_rescale=False, is_center=False, is_random=False, thresh_wh=0.02, thresh_wh2=12. ): """Zoom i...
1669ee2b2aae25dd16141b040cfb28f358bee82d
43,778
def view_points_in_water(reconstructor, cam_id, pts3d, water, distorted=True): """ pts3d : (N,3) array of 3D points returns: (2,N) projection of 3D points """ assert isinstance(water, WaterInterface) pts3d = np.array(pts3d) assert pts3d.ndim == 2 assert pts3d.shape[1] == 3 # pt...
bee3d04674d3562d25766a30bc17a9c47eefbdc8
43,779
from .variable import Variable from typing import Hashable from typing import Mapping from typing import Union from typing import Tuple from typing import Optional def isel_variable_and_index( name: Hashable, variable: "Variable", index: Index, indexers: Mapping[Hashable, Union[int, slice, np.ndarray,...
ef98d01bfd4b034df31a0d4a872a45f0b5767b81
43,780
def respostas_iguais(r1,r2): """ respostas_iguais: resposta x resposta --> logico respostas_iguais(r1,r2) devolve o valor verdadeiro se as respostas r1 e r2 contiverem os mesmos tuplos, e falso caso contrario. """ return resposta_string(r1) == resposta_string(r2)
aafbef254acd7a3d7910caa113816ac37d23efae
43,781
def getCountryData(df): """ Implement a function to get counts of data based on show type """ country_df = df[["country","type","index"]] country_df = country_df.groupby(['country','type']).count().unstack() country_df.columns = ['Movie','TV Show'] country_df = country_df.reset_index().filln...
bde3247bc95c4914d3b665225aee9dd2a0bfe2b6
43,782
def GetBptEA(n): """ Get breakpoint address @param n: number of breakpoint, is in range 0..GetBptQty()-1 @return: addresss of the breakpoint or BADADDR """ bpt = idaapi.bpt_t() if idaapi.getn_bpt(n, bpt): return bpt.ea else: return BADADDR
baaf2f086ac0b9869236ad582a290ede568446e9
43,783
import warnings def flexible_pileup(features, data_select, data_snip, mapper=map): """ TAKEN from cooltool.snipping.pileup -> patched in a fashion that allows differently sized windows. Handles on-diagonal and off-diagonal cases. Parameters ---------- features : DataFrame Table of ...
925a917708111edea33bca38c32e8ce1df959229
43,784
def delete_customer(request, customer_id): """deleting customer""" # verify that the calling user has a valid token token = request.headers.get('Token') if token is None: return request_response(badRequestResponse, ErrorCodes.INVALID_CREDENTIALS, "Token is missing in the request headers") #...
15de13abf8d3b251d10c01ef13693e6d2c2f8a67
43,785
def list_conferences_groups(request_ctx, group_id, per_page=None, **request_kwargs): """ Retrieve the list of conferences for this context This API returns a JSON object containing the list of conferences, the key for the list of conferences is "conferences" Examples: curl 'https:...
03df9fa860dae497a8797813927f27d5062663b4
43,786
def all_success(mgmt_commands): """Determines if all child processes were successful. Args: mgmt_commands : A list of all Command objects Returns: True if all child processes succeeded """ for mgmt_command in mgmt_commands: if mgmt_command.retcode != 0: return False return True
1bc0d32491711e0d20106f1f294093b30e77bd55
43,787
import re def get_nameservice(hdfs_site): """ Multiple nameservices can be configured for example to support seamless distcp between two HA clusters. The nameservices are defined as a comma separated list in hdfs_site['dfs.nameservices']. The parameter hdfs['dfs.internal.nameservices'] was introduced in Had...
65a86316112a94b6f361daea88cd5658d8019668
43,788
def checkChanList(chanprof, profile, chanList): """ Return non-zero value if any element of chanlist is not in the channel list of profile """ for c in chanList: if c not in chanprof[profile-1]: return 1 return 0
face301b61634bcff8721fcafb1cbc09e2bd0e5f
43,789
from typing import List from pathlib import Path def someweta_de(data: List[List[str]], model=None) -> ( List[List[str]], List[str]): """ model (Default: None) Preloaded instance of the NLP model. See nlptasks.pos.get_model """ # (1) load model if not model: model = somewet...
43efb04e17f830114996acaeead91ba8f017047c
43,790
def contest_login(request, contest_id): """Generates a contest-local SID for a contest.""" sid = srvctl_sid(request) hdrs, resp = _runcgi(request, "new-master", SID=sid, action=3, contest_id=contest_id) if "Location" not in hdrs: if _xpath(resp, "//title").text.endswith("Permission denied"): ...
47dd7d68ef04aab671a9e85533cf8647cb6d53ea
43,791
def is_pyflakes_available(): """ Checks if pyflakes is availalbe. :returns: **True** if we can use pyflakes and **False** otherwise """ return _module_exists('pyflakes.api') and _module_exists('pyflakes.reporter')
886af673c6dca3691f42945d91ce95bb427ed04f
43,792
import json def load_polys(jsonfile): """load info of polygons(=puzzle state) from json file. Args: jsonfile (pathlib.Path): json file to be loaded """ try: with jsonfile.open('r') as fi: jsondata = json.load(fi) except (IsADirectoryError, FileNotFoundError, json.JSON...
7d33d4b1d1f97fd8152b4723f961b0be055dbb25
43,793
def make_tree_defs(mod_files_list): """get a list of 2-uple (module, list_of_files_which_import_this_module), it will return a dictionary to represent this as a tree """ tree_defs = {} for mod, files in mod_files_list: node = (tree_defs, ()) for prefix in mod.split('.'): ...
40b10ccb940af9c6c7bb48ba5b07b59036914dbd
43,794
def verify_identifiers(identifiers, n_items): """Ensure that identifiers has a compatible length and that its elements are unique""" if identifiers is None: return identifiers identifiers = np.array(identifiers, copy=False) # Check length for consistency if len(identifiers) != n_items:...
b84796e411ae9937855f4de23292d362823ea655
43,795
import json def image_get_class_cn_dict(cn_imagenet_class_path): """ 获得分类的中文对照词典 :param cn_imagenet_class_path: :return: """ fn = open(cn_imagenet_class_path, "r", encoding='UTF-8') str_json = fn.read() dic = json.loads(str_json) fn.close() return dic
190cb80d929bdef3fe33b082fa12149c1c290446
43,796
def reveal_type(value: _T) -> _T: """Inspect the inferred type of an expression. Calling this function will make pyanalyze print out the argument's inferred value in a human-readable format. At runtime it does nothing. This is automatically exposed as a global during type checking, so in code that...
fa51fe603fa1d60dbf48526e3e15cdba8303ff5e
43,797
def f5_update_policy_method_command(client: Client, policy_md5: str, method_id: str, method_name: str, act_as_method: str) -> CommandResults: """ Update allowed method from a certain policy.. Args: client (Client): f5 client. policy_md5 (str): MD5 hash of...
553c9b0efa8fa35c099caefc8a7699a327f37e04
43,798
def convertKerasType(dtype): """Convert a numpy type into a tensorflow type """ if dtype not in O.mapping.NP_TYPE_TO_TENSOR_TYPE: logger.warning("Unknown data type %s is treated as float", str(dtype)) dtype = np.dtype('float32') return O.mapping.NP_TYPE_TO_TENSOR_TYPE[dtype]
d2995303e22afc7d7a92e95dd4131a26ad289388
43,799