content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def _column_sel_dispatch(columns_to_select, df): # noqa: F811 """ Base function for column selection. Applies only to slices. The start slice value must be a string or None; same goes for the stop slice value. The step slice value should be an integer or None. A slice, if passed correctly i...
177fd2f84884e068b08b509037788c998c026502
3,657,800
def create_or_update(*, db_session, monitor_in: MonitorCreate) -> Monitor: """Creates or updates a monitor.""" monitor = get_by_weblink(db_session=db_session, weblink=monitor_in.weblink) if monitor: monitor = update(db_session=db_session, monitor=monitor, monitor_in=monitor_in) else: mon...
08057b527fc6bf9fc36b66133b78a88b63e05d34
3,657,801
import itertools def get_record_map(index_array, true_false_ratio): """Get record map. :param index_array: the indexes of the images :type index_array: numpy array :param true_false_ratio: the number of occurrences of true cases over the number of occurrences of false cases :type true_false_r...
1a610b8842ac3259322cd0ef613bee3d305d3014
3,657,802
def sdfGetMolBlock(mol): """ sdfGetMolBlock() returns the MOL block of the molecule """ return mol["molblock"]
399874a696f30f492ee878ef661094119bd5f96f
3,657,803
import inspect def get_methods(klass): """Get all methods, include regular, static, class method. """ methods = list() attributes = get_attributes(klass) for key, value in inspect.getmembers(MyClass): if (not (key.startswith("__") and key.endswith("__"))) and \ (key not in ...
1b4ada9c3fed32e09fa25434e2c547e5d8f81ca8
3,657,804
import math def get_sample_column(table_file_name, sample_name, sex='U'): """ Get a VCF column as a Pandas Series for one sample. :param table_file_name: Name of genotyped features table file output by the genotyper after applying the genotyping model and annotating the genotype for no-call varia...
21a0461c9779d71b77fc5a510dcbb3660764d05a
3,657,805
import os import traceback def find_plugin_models(): """ Find custom models """ # List of plugin objects plugins_dir = find_plugins_dir() # Go through files in plug-in directory if not os.path.isdir(plugins_dir): msg = "SasView couldn't locate Model plugin folder %r." % plugins_dir...
47bc32c5eca743ed200c0d9baa6c43e6446601a7
3,657,806
def write_to_variable(tensor, fail_if_exists=True): """Saves a tensor for later retrieval on CPU.""" if not isinstance(tensor, tf.Tensor): raise ValueError('Expected tf.Tensor but got {}'.format(type(tensor))) # Only relevant for debugging. debug_name = 'tpu_util__' + tensor.name.split(':')[0] reuse = F...
8c353fecb29730401e0aad8c7fc01107f9793753
3,657,807
def is_close(A, B, tol=np.sqrt(_eps)): """ Check if two matrices are close in the sense of trace distance. """ if tracedist(A, B) < tol: return True else: A[np.abs(A) < tol] = 0.0 B[np.abs(B) < tol] = 0.0 A /= np.exp(1j*np.angle(A[0,0])) B /= np.exp(1j*np.angl...
07c81f94d8a131bd097b1739040e761e37ebe998
3,657,808
def hist3d_numba_seq_weight(tracks, weights, bins, ranges, use_memmap=False, tmp=None): """Numba-compiled weighted 3d histogram From https://iscinumpy.dev/post/histogram-speeds-in-python/ Parameters ---------- tracks : (x, y, z) List of input arrays of identical length, to be histogrammed ...
aaa60642772310f82eb5d4c69d5f5815220f8058
3,657,809
def convertTimeQuiet(s): """ Converts a time String in the form hh:mm:ss[.nnnnnnnnn] to a long nanoseconds offset from Epoch. :param s: (java.lang.String) - The String to convert. :return: (long) QueryConstants.NULL_LONG if the String cannot be parsed, otherwise long nanoseconds offset from Epoch. ...
e80f847da06d035f12257e80b290beec06ad801f
3,657,810
from typing import Optional def pop_first_non_none_value( *args, msg: Optional[str] = "default error msg", ): """ Args: args: a list of python values Returns: return the first non-none value """ for arg in args: if arg is not None: return arg raise V...
917a6b0546d4bda09f5abe53c1fb0085f3f225ae
3,657,811
def all_equal(iterable): """ Returns True if all the elements are equal. Reference: Add "equal" builtin function https://mail.python.org/pipermail/python-ideas/2016-October/042734.html """ groups = groupby(iterable) return next(groups, True) and not next(groups, False)
819f94bb02e70999d00c45b8c11d9eaf80f43fac
3,657,812
import re def is_str(required=False, default=None, min_len=None, max_len=None, pattern=None): """ Returns a function that when invoked with a given input asserts that the input is a valid string and that it meets the specified criteria. All text are automatically striped off of both trailing and lea...
22002a220b8e0f4db53ba0ffd6bb6c2c0c8a599d
3,657,813
from typing import OrderedDict import os def load_property_file(filename): """ Loads a file containing x=a,b,c... properties separated by newlines, and returns an OrderedDict where the key is x and the value is [a,b,c...] :param filename: :return: """ props = OrderedDict() if not os.pa...
f3cedf1d475ffe04fbefc6ddeb6d8b41101b6f91
3,657,814
def fit_curve(df, country, status, start_date, end_date=None): """ Summary line. Extended description of function. Parameters: arg1 (int): Description of arg1 Returns: int: Description of return value """ # Select the data slc_date = slice(start_date, end_date) y_data = ...
d76e6e3f7c585dc93d70d09e43861f29a3b777ea
3,657,815
def load_data_from(file_path): """ Loads the ttl, given by file_path and returns (file_path, data, triple_count) Data stores triples. """ graph = Graph() graph.parse(file_path, format="ttl") data = {} triple_count = 0 for subject, predicate, object in graph: triple_count += ...
8f856d1600e5d387fe95b2ff06a889c72f40a69c
3,657,816
def get_predictability(X, y, dtype='continuous'): """Returns scores for various models when given a dataframe and target set Arguments: X (dataframe) y (series) dtype (str): categorical or continuous Note: X and y must be equal in column length Returns...
8af7b53eef2da6c84f54081fe41641aa4aa2e66d
3,657,817
import uuid def generate_guid(shard=0, base_uuid=None): """ Generates an "optimized" UUID that accomodates the btree indexing algorithms used in database index b-trees. Check the internet for details but the tl;dr is big endian is everything. Leveraging the following as the reference implementati...
0e9b6395045c9c2f51e5f9aa19951f5ff569b914
3,657,818
def load(name): """Loads dataset as numpy array.""" x, y = get_uci_data(name) if len(y.shape) == 1: y = y[:, None] train_test_split = 0.8 random_permutation = np.random.permutation(x.shape[0]) n_train = int(x.shape[0] * train_test_split) train_ind = random_permutation[:n_train] test_ind = random_per...
3e084ff82d092b2bfdc0fa947a1b9bd1548c336d
3,657,819
def read_file(filename): """ Read :py:class:`msbuildpy.corflags.CorFlags` from a .NET assembly file path. **None** is returned if the PE file is invalid. :param filename: A file path to a .NET assembly/executable. :return: :py:class:`msbuildpy.corflags.CorFlags` or **None** """ ...
f5992bd119f90418748f9c67e64eda6fe1338839
3,657,820
def cleanup_all(threshold_date=None): """Clean up the main soft deletable resources. This function contains an order of calls to clean up the soft-deletable resources. :param threshold_date: soft deletions older than this date will be removed :returns: total number of entries removed from the datab...
cabfb77af2c650bc05df4f86c2a719dc1a90adb7
3,657,821
import tempfile def parse_config(config_strings): """Parse config from strings. Args: config_strings (string): strings of model config. Returns: Config: model config """ temp_file = tempfile.NamedTemporaryFile() config_path = f'{temp_file.name}.py' with open(config_path, ...
88e37c8e13517534486d5914e28f5a941e439c38
3,657,822
def validate_profile_info(df, fix=False): """ Validates the form of an information profile dataframe. An information profile dataframe must look something like this: pos info info_err 0 0.01 0.005 1 0.03 0.006 2 0.006 0.008 A 'pos' column reports the...
fa4143da7cadaeb322315da3a0aaa49fc869a1eb
3,657,823
import math def degrees(cell): """Convert from radians to degress""" return math.degrees(GetNum(cell))
3e5b08ffb2d5ec82c0792a266eb13b6fb8110971
3,657,824
def create_address(request): """ List all code snippets, or create a new snippet. """ if request.method == 'POST': data = JSONParser().parse(request) serializer = AddressSerializer(data=data) if serializer.is_valid(): serializer.save() return JsonResponse(...
d9dd0ff221ddecb826cc961e5d4cb1acf867c510
3,657,825
def createPhysicalAddressDataframe(userDf): """ This method create PhoneNumber dataframe for CDM :param userDf: person dataframe :type userDf: object """ addressColumns = [ "id as personId","city","country","officeLocation","postalCode","state","streetAddress" ] return userDf.selec...
4d185175ff6719476ed843680c17d0f267fa15ff
3,657,826
def test_reproject_continuous(n=100, m=20, r=10): """Test pre._reprojection.reproject_continuous().""" # Construct dummy operators. k = 1 + r + r*(r+1)//2 D = np.diag(1 - np.logspace(-1, -2, n)) W = la.qr(np.random.normal(size=(n,n)))[0] A = W.T @ D @ W Ht = np.random.random((n,n,n)) H =...
cc418dc7b5fce06c20a907cd020641823b42355b
3,657,827
def index(): """ Custom View """ module_name = deployment_settings.modules[module].name_nice return dict(module_name=module_name)
6cde065d07d0aeec371da20c47e46b82c8e3035d
3,657,828
def _lm_map_func(hparams, sos_id, eos_id, prot_size): """Return a closure for the BDLM with the SOS/EOS ids""" def lm_map_func(id, seq_len, seq, phyche): prot_eye = tf.eye(prot_size) # split characters seq = tf.string_split([seq], delimiter="").values # map to integers se...
f9fde8af2970f309476c845281538375564841cc
3,657,829
def isSpecificInterfaceType(t, name): """ True if `t` is an interface type with the given name, or a forward declaration or typedef aliasing it. `name` must not be the name of a typedef but the actual name of the interface. """ t = unaliasType(t) return t.kind in ('interface', 'forward') an...
5358d6ac946567323d00a56149cb3309d7ef4cb8
3,657,830
from typing import Optional from pathlib import Path import os def is_stem(path: Optional[str]) -> bool: """Check if the given path is a stem.""" if path is None: return False path = path.lower() parent = str(Path(path).parent) if parent == ".": root, ext = os.path.splitext(path...
c14053cb93997eaea118f9187d96869b82c97539
3,657,831
from datetime import datetime def now(): """Returns the current time in ISO8501 format. """ return datetime.datetime.now().isoformat()
6fcd34faf9d2ca8d1d64a1e8b453a2a7eff44752
3,657,832
import math def get_CF_matrix_from_parent_vector(parent, D, alpha, beta): """Documentation to be added.""" cell_ids = list(D.keys()) mut_ids = list(D[cell_ids[0]].keys()) children = {} children[ROOT] = [] for mut_id in mut_ids: children[mut_id] = [] for child_id, parent_id in par...
17a937f130dea7849d0f6aaf0a4b62d7e97bd746
3,657,833
import os def get_resource_path(filename: str = "") -> str: """ get the resource path in the resource in the test dir. /path/to/resource/filename """ current = os.path.abspath(__file__) current_path = os.path.dirname(current) resource_dir = os.path.join(current_path, 'resource') return...
4e140c7619336a508f3eb833b95513bc7e84bd4e
3,657,834
from typing import Generator def esr_1_2(out_filename, source_folder, dest_folder=getcwd(), one_hot=True, normalized=True, out_type="float", balanced_classes=False, n_batch=None, batch_size=None, validation_size=30, validation_as_copy=False, test_size=160, save_stats=False): """Create a esr data...
8e7857baf4d0ac5c07614db4089d0bd4cf5a2897
3,657,835
def chec_to_2d_array(input_img, img_map=chec_transformation_map()): """ Convert images comming form "CHEC" cameras in order to get regular 2D "rectangular" images directly usable with most image processing tools. Parameters ---------- input_img : numpy.array The image to convert Re...
c235e3f9751a05ffd02d82eb07f79da84a9a742a
3,657,836
def noop_chew_func(_data, _arg): """ No-op chew function. """ return 0
82ef82b350c2a01e5ba22f288c003032bf6e63e0
3,657,837
def find_middle_snake_less_memory(old_sequence, N, new_sequence, M): """ A variant of the 'find middle snake' function that uses O(min(len(a), len(b))) memory instead of O(len(a) + len(b)) memory. This does not improve the worst-case memory requirement, but it takes the best case memory requirement ...
d320090f975525a620a7fafc479e9eec8b9a4ffa
3,657,838
def music_pos(style_name, st, at): """ Returns the track position to Ren'Py. """ global time_position if music.get_pos(channel="music_room") is not None: time_position = music.get_pos(channel="music_room") readableTime = convert_time(time_position) d = Text(readableTime, style=sty...
bb7287d812927b3bea15f8a0a077588c9f13ddb8
3,657,839
from datetime import datetime def get_time(data=None): """Receive a dictionary or a string and return a datatime instance. data = {"year": 2006, "month": 11, "day": 21, "hour": 16, "minute": 30 , "second": 00} or data = "21/11/06 16:30:00"...
b8bf33db4225d44961991b58a6cdef7876cfef95
3,657,840
from datetime import datetime def set_clock(child, timestamp=None): """Set the device's clock. :param pexpect.spawn child: The connection in a child application object. :param datetime timestamp: A datetime tuple (year, month, day, hour, minute, second). :returns: The updated connection in a child ap...
b6299ab780ffc9e9d27b0715decf095b3d6a6272
3,657,841
def feature_structure(string, case, intr=False): """Convert person-number string to a single feature structure. Examples: >>> feature_structure('1s', 'Nom', True) ['Nom', '+1', '-2', '-3', '+sg', '-pl', '+intr'] >>> feature_structure('2p', 'Abs', True) ['Abs', '-1', '+2', '-3', '-sg', '+pl', '...
32967a45156f8a476cabc91d63d9a92dcb72dc6a
3,657,842
def repo_description(gurl, owner, repo): """ Returns: (status_code, status_text, data) data = {"created_at": date, "description": str, "stargazers_count": int, "subscribers_count": int} """ res = "/repos/{}/{}".format(owner, repo) response = gurl.request(funcs.get_hub_url(res)) c...
ab9bf82b474cddd55ad1da426fdca4d9874320c6
3,657,843
def check_omf_version(file_version): """Validate file version compatibility against the current OMF version This logic may become more complex with future releases. """ if file_version is None: return True return file_version == OMF_VERSION
e834b8bafb1d9d94b12f7846d29fcbdf4c080c08
3,657,844
from typing import List from typing import Tuple def create_ks_scheduled_constant_graph_ops( graph: tf_compat.Graph, global_step: tf_compat.Variable, var_names: List[str], begin_step: int, end_step: int, ks_group: str, ) -> Tuple[tf_compat.Tensor, List[PruningOpVars]]: """ Creates cons...
ba4ae29793d3ff5de6ad4b84966d04dff0235fae
3,657,845
import os import ntpath def findImages(dataPath): """ Finds all the images needed for training on the path `dataPath`. Returns `([centerPaths], [leftPath], [rightPath], [measurement])` """ directories = [x[0] for x in os.walk(dataPath)] dataDirectories = list(filter(lambda directory: os.path.i...
3910b1571266e5d0a8f79551abdd3631fd256d19
3,657,846
def insert(user_job_id: ObjectId, classifier: str, fastq_path: str, read_type: str or None = None) -> ObjectId: """ Insert a new ClassificationJob into the collection. :param user_job_id: Which UserJob is associated with this ClassificationJob :param classifier: The classifier to use :param fastq_pa...
6d95d6b2eb4d55f8ec4ae1c63e3c457f66f6b2a1
3,657,847
from typing import List from typing import Union def as_columns( things: List[Union[SheetColumn, list, tuple, set, str]] ) -> List[SheetColumn]: """A list of each thing as a SheetColumn""" result = [] for thing in things: if isinstance(thing, SheetColumn): sheet_column = thing ...
43f9a0a3bf655dd1f4b818e15a666d96d9279f1c
3,657,848
def generator_path(x_base, y_base): """[summary] use spline 2d get path """ sp2d = Spline2D(x_base, y_base) res = [] for i in np.arange(0, sp2d.s[-1], 0.1): x, y = sp2d.calc_position(i) yaw = sp2d.calc_yaw(i) curvature = sp2d.calc_curvature(i) res.append(...
eda2e72ecef8b0f12069c4e7154503e859c6c28c
3,657,849
def index(request): """Render site index page.""" return {}
38c0a1e47cdbe2eed374b6231761698efa1bc166
3,657,850
def bellman_ford_with_term_status(graph, is_multiplicative=False): """ An implementation of the multiplication-based Bellman-Ford algorithm. :param: graph - The graph on which to operate. Should be a square matrix, where edges that don't exist have value None :param: graph_labels - ...
c73839578ea662b404dcdbca7443978674f151a3
3,657,851
def decoder(z, rnn, batch_size, state=None, n_dec=64, reuse=None): """Summary Parameters ---------- z : TYPE Description rnn : TYPE Description batch_size : TYPE Description state : None, optional Description n_dec : int, optional Description ...
f0464424e6e770031003c59d0f46c85d8aca23ec
3,657,852
def parse_file(filename): """Parses the file containing the db schema Key Arguments: filename - the file to parse""" f = open(filename, 'r') lines = f.readlines() f.close() db = {} for line in lines: s_line = line.split('\t') if s_line[0] == 'TABLE_CATALOG': ...
0b02829505a1b07c8a1ed9cc8a34c651cf4be41c
3,657,853
def est_L(sample_list, est_method, bandwidth = 0.5): """Estimate L from a list of samples. Parameter ------------------------------------------ sample_list: list a list of samples for arm i at time t est_method: str can be one of the choice of 'kde', 'naive' 'kde': kernel de...
f01d29c1d8863d27d7c7af8c001d108a240d48bf
3,657,854
def create_test_area(test_tiles): """Create geometry from test images Parameters ---------- test_tiles : list directory with test images Returns ------- GeoPandas DataFrame all test images merged into a GeoDataFrame """ multipolygon = ogr.Geometry(ogr.wkbMultiPolyg...
8f8cd7834ce5c9923d1ba2f5677155badd1176aa
3,657,855
import os import requests def check_token(token) -> bool: """Check ReCaptcha token Args: token Returns: bool """ if os.getenv("CI"): return True url = "https://www.google.com/recaptcha/api/siteverify" secret_key = os.getenv("RECAPTCHA_SECRET_KEY") payload =...
5c78e55333e4e5484ae30acaea58a988247152dd
3,657,856
def covSEard(x, z, ell, sf2 ): """GP squared exponential kernel. This function is based on the 2018 GP-MPC library by Helge-André Langåker Args: x (np.array or casadi.MX/SX): First vector. z (np.array or casadi.MX/SX): Second vector. ...
a911df160227b5cac356101befe0df29eb8c47aa
3,657,857
import binascii def make_devid(identity): """ Generate device ID from device identity data trying to follow the same logic as devauth does. Returns a string containing device ID. """ d = SHA256.new() # convert to binary as needed bid = identity if type(identity) is bytes else identity.enco...
979c9d379c001e79ebdec2bcf7a7f256c195bbee
3,657,858
from typing import List def get_recomm_products(user_id: str) -> List[Text]: """ Gets the top 10 products the user is most likely to purchase. :returns: List of product ids. """ instances_packet = { "instances": [user_id] } prediction = aiplatform_recomm_endpoint.predict(instances=instances_packet...
76086a2fea1d6b5a55c4a431510a333c2919e893
3,657,859
def relu(Z): """ :param Z: -- the linear output in this layer :return: A -- the activation output in this layer activation_cache -- a dictionary contains Z and A """ [m, n] = Z.shape A = np.zeros((m,n)) for i in range(m): for j in range(n): if Z[i][j] < 0: ...
b97073c806273edd4f9ccdf94743903ee4709674
3,657,860
def month(x: pd.Series) -> pd.Series: """ Month of each value in series :param x: time series :return: month of observations **Usage** Returns the month as a numeric value for each observation in the series: :math:`Y_t = month(t)` Month of the time or date is the integer month numbe...
5049681c77c9416bf2dd28c1a71265e44274c115
3,657,861
def _library_from_nglims(gi, sample_info, config): """Retrieve upload library from nglims specified user libraries. """ names = [config.get(x, "").strip() for x in ["lab_association", "researcher"] if config.get(x)] check_names = set([x.lower() for x in names]) for libname, role in conf...
3c22807d23723267b39d026990b787febaf7cb1d
3,657,862
import argparse def get_commandline_parser(): """it parses commandline arguments.""" parser = argparse.ArgumentParser(description='Toolpath generator.') parser.add_argument('--stl-filepath', help='filpath of stl file.') parser.add_argument('--diameter', help='Diameter of toolbit.') parser.add_argu...
d8727b7a9f40f63e0c322074ae88585e7dd5f0eb
3,657,863
def con_isogonal(cos0,assign=False,**kwargs): """ keep tangent crossing angle X += [lt1,lt2, ut1,ut2, cos] (ue1-ue3) = lt1 * ut1, ut1**2 = 1 (ue2-ue4) = lt2 * ut2, ut2**2 = 1 ut1 * ut2 = cos if assign: cos == cos0 """ w = kwargs.get('isogonal') mesh = kwargs.get('mesh')...
d2626e48a128b9b1dcecaa1ad3d297b5515540f9
3,657,864
import os def download_is_complete(date): """ Has the process of downloading prescribing data for this date finished successfully? """ return os.path.exists(local_storage_prefix_for_date(date) + SENTINEL_SUFFIX)
2914ed7c35b2b46f71e0cb995fbbe3f4689211a5
3,657,865
def tf_apply_with_probability(p, fn, x): """Apply function `fn` to input `x` randomly `p` percent of the time.""" return tf.cond( tf.less(tf.random_uniform([], minval=0, maxval=1, dtype=tf.float32), p), lambda: fn(x), lambda: x)
2d2a5a5c0c67c41007ed839423bc474e9dbf283d
3,657,866
import functools def adjoin(x,seq,test=lambda x,y: x is y): """Tests whether item is the same as an existing element of list. If the item is not an existing element, adjoin adds it to list (as if by cons) and returns the resulting list; otherwise, nothing is added and the original list is returned....
d32b459d688f5ccca36b56e8772aca2bf66603c5
3,657,867
from typing import Optional from datetime import datetime from typing import Any def get_service_logs( project_id: str = PROJECT_ID_PARAM, service_id: str = SERVICE_ID_PARAM, lines: Optional[int] = Query(None, description="Only show the last n lines."), since: Optional[datetime] = Query( None,...
1b20bc7ec55ba8f772490ea54848d1f331caa17e
3,657,868
def uniquify_contacts(contacts): """ Return a sequence of contacts with all duplicates removed. If any duplicate names are found without matching numbers, an exception is raised. """ ctd = {} for ct in contacts: stored_ct = ctd.setdefault(ct.name, ct) if stored_ct.dmrid != ct.dm...
f4bf001abcccad1307633e6de6ed6228516ba0b2
3,657,869
def optimize_bank_transaction_list(bank_transactions): """Append related objects using select_related and prefetch_related""" return bank_transactions.select_related('block')
c7c7242336f9cddf399efc9d813b7650b0f6ce5e
3,657,870
from datetime import datetime def rss(): """ RSS2 Support. support xml for RSSItem with 12 diaries. Args: none Return: diaries_object: list site_settings: title, link, description """ articles = Diary.objects.order_by('-publish_time')[:12] items = [] for a...
f17e063bb0c15da4ab776e421408eb6a58fc7a50
3,657,871
def _interpolate_solution_at(target_time, solver_state, validate_args=False): """Computes the solution at `target_time` using 4th order interpolation. Args: target_time: Floating `Tensor` specifying the time at which to obtain the solution. Must be within the interval of the last time step of the `...
813b54730cb21443b9e051bfef553f226cfaf5ab
3,657,872
def test_drawcities(): """Draw Cities""" mp = MapPlot( title="Fill and Draw Cities", subtitle="This is my subtitle", continentalcolor="blue", sector="iowa", nocaption=True, ) mp.drawcities() return mp.fig
c83efdfb856010c93811d92f3ac1ffe39056bab6
3,657,873
def from_hi(psi_0, mpa_type, system_index, hi, tau=0.01, state_compression_kwargs=None, op_compression_kwargs=None, second_order_trotter=False, t0=0, psi_0_compression_kwargs=None, track_trace=False): """ Factory function for imaginary time TMP-objects (ITMPS, ITMPO, ITPMPS) :par...
cdee96cae5a9798fd3757000e5e49538f9f1c191
3,657,874
from typing import Type def config_backed(config_path: str): """Second order decorator that sets up a backing config for a GuildState type. """ def deco(gs_type: Type[GuildStateTV]) -> Type[GuildStateTV]: gs_type._cfg_path = config_path return gs_type return deco
6d2e64fed12918fd27ff10a2e97fc2b69d5751c2
3,657,875
def determine_if_is_hmmdb(infp): """Return True if the given file is an HMM database (generated using hmmpress from the HMMer3 software package), and return False otherwise. """ #if open(infp, 'r').read().startswith('HMMER3/f'): if open(infp, 'r').readline().startswith('HMMER3/f'): return Tr...
33b962e24c76e9e25f2cc76d4e7f78565adf8a3e
3,657,876
from typing import Sequence def assignment_path(base_var: str, path: Sequence[daglish.PathElement]) -> str: """Generates the LHS of an assignment, given a traversal path. Example: ["foo", 3, "bar"] -> "foo[3].bar". Args: base_var: Base variable name. path: Attribute path on `base_var` to assign to. ...
92af61cf96008bc45a62df8ce369d7d7e9b1879f
3,657,877
def template_footer(in_template): """Extracts footer from the notebook template. Args: in_template (str): Input notebook template file path. Returns: list: List of lines. """ footer = [] template_lines = [] footer_start_index = 0 with open(in_template) as f...
cb872076b82b2012b2e27fcb1be9b8704cd60d27
3,657,878
def conf_auc(test_predictions, ground_truth, bootstrap=1000, seed=None, confint=0.95): """Takes as input test predictions, ground truth, number of bootstraps, seed, and confidence interval""" #inspired by https://stackoverflow.com/questions/19124239/scikit-learn-roc-curve-with-confidence-intervals by ogrisel ...
a1825187e896f479f4fb9b4aeb7c494fdd4b55e5
3,657,879
from binheap import BinHeap def empty_heap(): """Instantiate a heap for testing.""" min_heap = BinHeap() return min_heap
5941d09590be084465458d2ff3bd5db51ee41b4a
3,657,880
def get_requires_python(dist): # type: (pkg_resources.Distribution) -> Optional[str] """ Return the "Requires-Python" metadata for a distribution, or None if not present. """ pkg_info_dict = get_metadata(dist) requires_python = pkg_info_dict.get('Requires-Python') if requires_python is ...
9d8b475703bd3f12ca5845c33d324a3ba346c5fb
3,657,881
def standard_primary_main_prefixes(primary = None): """Return list of standard prefixes that may go with particular primary name. **Note** You may wish to use `StandardPrimaryMainPrefixes()` instead. **Description** The function returns, a list of main prefixes that may go together with ...
294ad0fbf34a82c7d45a44ef3ba739c220298958
3,657,882
def post_step1(records): """Apply whatever extensions we have for GISTEMP step 1, that run after the main step 1. None at present.""" return records
98287f6930db6aa025715356084b3bef8c851774
3,657,883
def gen_report_complex_no_files() -> dp.Report: """Generate a complex layout report with simple elements""" select = dp.Select(blocks=[md_block, md_block], type=dp.SelectType.TABS) group = dp.Group(md_block, md_block, columns=2) toggle = dp.Toggle(md_block, md_block) return dp.Report( dp.Pa...
874aa4c601e4ba4a01dfcdd0067f2638f04bd597
3,657,884
import requests from bs4 import BeautifulSoup import re def suggested_associations(wiki_title, language='de'): """Given a Wikipedia page title, return a list of suggested associations for this entry.""" # The main heuristic to determine relevant associations for a given Wikipedia entry is to first gather all...
4b20a309b863feea64004e1b872c97a4ff1d37af
3,657,885
def manage_categories(): """ Manage expense categories """ alert_message = "" user = User.query.filter_by(id=session["user_id"]).scalar() if request.method == "GET": with app.app_context(): categories = ( Category.query.options(joinedload("category_type")) ...
4180e52585e1c1cdb55c9b33a7220bcb7cebc087
3,657,886
def shear_3d(sxy=0., sxz=0., syx=0., syz=0., szx=0., szy=0.): """ Returns transformation matrix for 3d shearing. Args: sxy: xy shearing factor sxz: xz shearing factor syx: yx shearing factor syz: yz shearing factor szx: zx shearing factor szy: zy shearing fact...
f160ec1d2e51164f56136f7e7f1613b9cd74f430
3,657,887
def Position(context): """Function: <number> position()""" return context.position
e5ddf5aa8d5321ce9e7dc14b635cb942fbbbcbf1
3,657,888
import math def spatial_shift_crop_list(size, images, spatial_shift_pos, boxes=None): """ Perform left, center, or right crop of the given list of images. Args: size (int): size to crop. image (list): ilist of images to perform short side scale. Dimension is `height` x `width` ...
c80d8ab83f072c94887d48c3d1cfe5bb18285dbb
3,657,889
import argparse def get_input_args(): """ Used to parse the command line arguments in order to predict the flower name and the class probability. Options: Return top KK most likely classes: python predict.py input checkpoint --top_k 3 Use a mapping of categories to real names: python predict.py in...
145e6d2601b37b10f4c8dbac649ab8abec2951a5
3,657,890
def testsuite_results(log_filename, msg_testsuite_section_start, msg_testsuite_end_message): """Read the NEST Travis CI build log file, find the 'make-installcheck' section which runs the NEST test suite. Extract the total number of tests and the number of tests failed. Return True if ...
682d5bcc7676388cb23707079581036efcc2f3da
3,657,891
def line_state_to_out(line: StaticStates, out_data: bool): """ Calculate the data and enable values given a initial state Args: line: StaticState that represent the line out_data: If line value is 2 it will be returned as the next value of data Returns: Data and Enable values fo...
e79b48bef3fba31bef6aa758686d2f79580954a4
3,657,892
def GetProxyConfig(http_proxy_uri=None, https_proxy_uri=None, cafile=None, disable_certificate_validation=None): """Returns an initialized ProxyConfig for use in testing. Args: http_proxy_uri: A str containing the full URI for the http proxy host. If this is not specified, the ProxyCon...
f984a17dd452d91d7f5dde24784d44626561ca4f
3,657,893
from typing import List import os def get_possible_paths(path: str) -> List[str]: """ Finds possible paths to resources, considering PACKAGE and USER directories first, then system-wide directories :param path: :return: """ # <sphinx_resources-get_possible_paths> dist_name = env.distribu...
974071844bae1746aa9dbe4a59bca213903c1ba0
3,657,894
def inchi_key_to_chembl(inchi_keys): """Return list of chembl ids that positionally map to inchi keys.""" molecule = new_client.molecule chembl_mols = [] ndone = 0 # counter for printing progress to console for inchi_key in inchi_keys: if pd.isnull(inchi_key): chembl_mols.appe...
d60dc5f9391c9ae085b41f2bea37ef1851b3a943
3,657,895
def StandaloneStyle(cfg): """ Construct a OWS style object that stands alone, independent of a complete OWS configuration environment. :param cfg: A valid OWS Style definition configuration dictionary. Refer to the documentation for the valid syntax: https://datacube-ows.readthedocs.io/en...
4b517acd8b48616175d8d78745b1beb51f9ba00d
3,657,896
def insert_or_test_version_number(): """Should the format name and version number be inserted in text representations (not in tests!)""" return INSERT_AND_CHECK_VERSION_NUMBER
2add9bf3041d8bab36ee4e5cf8c5d708c7e0ff79
3,657,897
import sys import os def IsInteractive(output=False, error=False, heuristic=False): """Determines if the current terminal session is interactive. sys.stdin must be a terminal input stream. Args: output: If True then sys.stdout must also be a terminal output stream. error: If True then sys.stderr must ...
8037e2d38dca9fc745b7b0b79cfb83226e59d42d
3,657,898
def get_ipaserver_host(): """Return the fqdn of the node hosting the IPA_SERVER. """ for node in svars['nodes']: if 'ipaserver' in node['groups']: return fqdn(node['name'])
46d74ec3b1ebadaa7699073423de9e27cec8c137
3,657,899