content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def lfnToEOS( path ): """Converts LFN to EOS. If path is not an LFN in the first place, return path. ??? shouldn't we raise an exception?""" if isLFN(path): pfn = 'root://eoscms.cern.ch//eos/cms/' + path return pfn.replace('//store','/store') else: return path
b41b0f42a707f1868776412d1c2f7a6a2fde3a47
3,628,150
def get_link_href(result_object, link_relation): """ Given a result_object (returned by a previous API call), return the link href for a link relation. 'result_object' a JSON object returned by a previous API call. May not be None. 'link_relation' the link relation for which href is required. ...
400cd38d1b29ea71bf974d8aa16c1b3adf104428
3,628,151
from typing import Callable from typing import Any from typing import Sequence def scanr( fun: Callable[[Any, Any], Any], acc: Any, trav: Sequence[Any] ) -> Sequence[Any]: """Implementation of scanr in Python3. This is an implementation of the right-handed scan function from functional programming. ...
4ef7c43aa4b4b9490efe955ef810a1eab38a6064
3,628,152
def argtopk_aggregate(a_plus_idx, k, axis, keepdims): """ Final aggregation function of argtopk Invoke argtopk one final time, sort the results internally, drop the data and return the index only. """ assert keepdims is True a, idx = argtopk(a_plus_idx, k, axis, keepdims) axis = axis[0] ...
bb9c113112dcbd64bd833a390721a042a0cbbc56
3,628,154
def eht(): """Make an empty bst size of 10.""" return HashTable(10)
7197f5c5846a8b369e5c1284b40b990035fb447b
3,628,155
import re def rx_filter(objs: list, attr: str, prompt: str) -> list: """ Filter a list of dicts based on user-entered regex match to one of their values. """ while True: search_term = input(prompt+" ") # Prefer exact match first -- otherwise can never select an item that's a substri...
f0c6dd5609020054da7895e577483c911d9aaea3
3,628,156
import logging import glob def _get_morphotactics_rules(morphotactics_dir: str) -> _RewriteRuleSet: """Parses morphotactics model into valid rewrite rules. Args: morphotactics_dir: path to the directory that contains the text files that define rules of morphotactics FST. All files that have the ".txt...
56da73c4a6623dcf9e2f3d8cc136f9aab3409c84
3,628,157
def _get_usb_hub_map(device_info_list): """Creates a map of usb hub addresses to device_infos by port. Args: device_info_list (list): list of known usb_connections dicts. Returns: dict: map of usb hub addresses to device_infos by port """ map_usb_hub_ports = {} for device_info in device_info_li...
eaadc4713a41fdf38cea4fce35806d1d8772df27
3,628,158
def gaussian_smoothing(eem_df, sigma, truncate): """Performs gaussian smooothing on the excitation-emission matrix from the input sigma and truncation sigma. Args: eem_df (pandas.DataFrame): An excitation-emission matrix. sig (int): Sigma of the gaussian distribution weight for the data smo...
e3e81ba47b2dd2c7a6015f092b151c65f1236bb9
3,628,159
import re def parse_pgsql_logs(data): """ Parse the pgsql benchmark data from ripsaw and return the data in list format Args: data (str): log data from pgsql bench run Returns: list_data (list): data digestable by scripts with below format e.g.: [ ...
5bd5cd43432b17be6bd52004b151b32a0f574980
3,628,161
from django.utils.encoding import force_text from django.core.mail import EmailMultiAlternatives from mailer.models import Message, PRIORITY_MAPPING def send_html_mail(subject, message, message_html, from_email, recipient_list, priority="medium", fail_silently=False, auth_user=None, auth_password=N...
c77b7cd475fb42891310c2de5cdf0ceb599f637b
3,628,162
def jd2gdate(myjd): """Julian date to Gregorian calendar date and time of day. The input and output are for the proleptic Gregorian calendar. Parameters ---------- myjd: julian date (float). Returns ------- y, m, d, f : int, int, int, float Four element tuple containing...
f43a299fd8627804893eb5b6266d6a016c191d72
3,628,164
def donation_journal_history_for_a_voter(voter_we_vote_id): """ :param voter_we_vote_id: :return: """ donation_manager = DonationManager() donation_journal_results = donation_manager.retrieve_donation_journal_list(voter_we_vote_id) refund_days = get_environment_variable("STRIPE_REFUND_DAYS"...
41b6a63d2893a7104fd15686e31090ee058438cd
3,628,165
import math def sigmoid_1(x): """ sigmoid at x """ return math.log(x / (1 - x))
a7ec76035e4f3b33613e7176e00dff7e243a695a
3,628,167
from typing import Tuple from typing import List def initialize_device_settings(use_cuda: bool, local_rank: int=-1, multi_gpu: bool=True) -> Tuple[List[str], int]: """ Returns a list of available devices. :param use_cuda: Whether to make use o...
c84f1dcc13ea90b2539b5027324382466372a77d
3,628,168
def get_action_td_zero(exploration_mode, current_state, Q, epsilon, temperature, exploration_degree, actions, nextStates): """ choose action based on temporal difference learning @param exploration_mode: @param current_state: @param Q: @param epsilon: @param temperatur...
ad5045f21f5048853371f4b12e9a08a6af50036d
3,628,169
def get_policy_targets(context, presentation): """ Returns our target node templates and groups if we have them. """ node_templates = [] groups = [] our_targets = presentation.targets if our_targets: all_node_templates = \ context.presentation.get('service_template', 't...
f483b9749c25b7d56c0e0a02a6787d936782e470
3,628,170
def check_for_messages(folder, message_data, pst_name, folder_name): """ The check_for_messages function reads folder messages if present and passes them to the report function :param folder: pypff.Folder object :param message_data: list to pass and extend with message info :param pst_name: A st...
0022536bbd6b0d0f723c6e6daf9a96e83afcd18d
3,628,171
import socket def __get_host_ip(): """ 获取本地IP地址 :return: """ try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('8.8.8.8', 80)) ip = s.getsockname()[0] finally: s.close() return ip
a73d4c02618a0729501dafe12702287195123f2c
3,628,172
def uv_renew(u, s, v, X, gamma1, gamma2): """ This function will return the updated u, v and the corresponding lambdas. Only for internal use for the SSVD function. """ n,d = X.shape u = u.reshape((n,1)) v = v.reshape((d,1)) SSTO = np.sum(X**2) ## first, update v #...
cb3eef48dc3cac9fd8bae8f2d010d7883eed2a56
3,628,173
def merge_df(df1, df2): """ Genera un dataframe seleccionant les columnes que ens interessen dels dos dataframes, eliminant valors NA, i actualitza les notes de '538 Grade' simplificant-les. Keyword arguments: df1 -- dataframe que conté les dades de les entrevistes. df2 -- dataframe que conté l...
955569ebbbbcf141eedd64ca3ee9b9b89f7922be
3,628,174
def OpInfo_CONV( conv_ps: conv.Conv2DParams, s_id: str, vin_id: str, vout_id: str ) -> OpInfo: """ OpInfo for a CONV operation """ rd_a = ( "{{ {SID}[oh,ow] -> {VID}[id,ih,iw] " ": 0 <= oh < {OH} " "and 0 <= ow < {OW} " "and 0 <= id < {ID} " "and oh <= i...
6f4292a79b9905a9a9c1ce79607ab854b3e97d81
3,628,175
def mean_period(data): """Return mean-period of signal.""" peaks = len(find_peaks(data, height=0)[0]) return len(data) / peaks if peaks > 0 else len(data)
627be25f610f81e45c2387f2c0e778e0b5ce8c20
3,628,176
def rvsi_vi(imgData, wave, mask=0, bands=[-1,-1,-1]): """ Function that calculates the Red-edge Vegetation Stress Index. This functions uses bands 714, 733, and 752 nm. The closest bands to these values will be used. Citation: Merton, R. and Huntington, J. 1999. Early simulation results of the ARIES-1 ...
ddf08ac67979b5bff879faaac139bb25fdc660cb
3,628,177
def usb_pitop_peripherals(): """Returns a list with the status of USB pi-top peripherals. Returns: list: list of dictionaries with the status of USB peripherals """ return [ {"name": "pi-top Touchscreen", "connected": touchscreen_is_connected()}, {"name": "pi-top Keyboard", "con...
5fa9100fdfa03bbfaebe3a053a036bc50b52dd59
3,628,178
import torch def isPD(B): """Check whether a matrix is positive definite. Args: B ([torch.Tensor]): [Input matrix.] Returns: [bool]: [Returns True if matrix is positive definite, otherwise False.] """ try: _ = torch.cholesky(B) return True except RuntimeError:...
c51dc4f6f48ac7417f49ef41b81f3b04816b9279
3,628,179
def convert_TriMap_to_SelectedLEDs( best_led_config ): """ Returns a lookup dict of the selected LEDs. """ d = {} for tri_num in best_led_config: for led_num in best_led_config[tri_num]: d[led_num] = True return d
521a1be0d11cb8198944e437d20d4ac0349c8856
3,628,180
def get_by_id(id_estudiante, id_asignatura, edicion): """ Obtiene la tupla de la relación Estudiantes con el identificador :param id_estudiante: El identificador del estudiante :type id_estudiante: str :param id_asignatura: El identificadir de la asignatura :type id...
04fa8447359917896210c1252b92ce82dc40f511
3,628,183
def keyword(tokens, expected): """Case-insensitive keyword match.""" try: token = next(iter(tokens)) except StopIteration: return if token and token.name == "symbol" and token.value.lower() == expected: return TokenMatch(None, token.value, (token,))
2ae106158e4a17258283abdd3ddcf77c670957c4
3,628,184
def milestone_container(request): """milestone container""" template = loader.get_template('project_management/milestone_container.html') context = {} return HttpResponse(template.render(context, request))
5461448dccdc5a5a3a7d56cc324dbaff5b3dbcc2
3,628,185
def _run_symbolic_method(op_name, symbolic_fn, args): """ This trampoline function gets invoked for every symbolic method call from C++. """ try: return symbolic_fn(*args) except TypeError as e: # Handle the specific case where we didn't successfully dispatch # to symboli...
c95f8d18e4b3a0ed7a06ccc6bdf178a820537d08
3,628,186
import csv def load_input_source(input_source): """Load data from an arbitrary input source. Currently supported: JSON, JSON-String, CSV, CSV-String. Returns an empty list if no data is available.""" input_data = [] try: input_data = load_json_from_file(input_source) except ValueError as e: ...
82ea97978a39a93a8d42e024cef9890cf2535dbe
3,628,187
def total_intensity(field): """Calculates total intensity of the field. Computes intesity and sums over pixels.""" i = field2intensity(field) return i.sum(tuple(range(i.ndim))[-2:])
89a26b8d53c7520aff99ef54800cab5fcb0937bb
3,628,188
import array def g_function_bernier(Fo, rba): """ Bernier (2001) approximation of Ingersol et al. (1954) G-function of the cylindrical heat source problem. Fo = Fourier number rba = ratio of the radius where the temperature is calculated over the external radius of the borehole. Re...
58226463d498b5af839d7ffd3c1042e4a0a4b5ee
3,628,189
def clear_item_updates(api_key: str, item_id: str, *args, **kwargs): """Clear an item's updates. Parameters api_key : `str` The monday.com v2 API user key. item_id : `str` The item's unique identifier. args : `tuple` ...
fc487f8fb27d179df5823601179fbcbb858dd69c
3,628,190
import torch def compute_aucs(pred, targ): """ Computes Area Under the Curve (AUC) from prediction scores. Args: targ: Pytorch tensor on GPU, shape = [n_samples, n_classes] true binary labels. pred: Pytorch tensor on GPU, shape = [n_samples, n_classes] can either be pro...
2b2b00eb55421ee1005534998f0519c96ed70696
3,628,191
def minhash(features): # type: (List[int]) -> List[int] """ Calculate a 64 dimensional minhash integer vector. :param List[int] features: List of integer features :return: Minhash vector :rtype: List[int] """ return [ min([(((a * f + b) & MAXI64) % MPRIME) & MAXH for f in featur...
c0bb534f4433fd517a7910647260f947c136111a
3,628,192
def get_gauss_beams(fwhm=7, nside=512, lmax=None): """the fwhm of 143GHz is 7.27, test fwhm: 7, 6, 5, 4 """ if lmax is None: lmax = 3*nside + 50 bl = hp.gauss_beam(fwhm*np.pi/10800., lmax=lmax) return bl
85a4edd2389afa49c166488089ad70433a4683bd
3,628,193
def create_long_model(model_specified, attention_window, max_pos): """Starting from the `roberta-base` (or similar) checkpoint, the following function converts it into an instance of `RobertaLong`. It makes the following changes: 1)extend the position embeddings from `512` positions to `max_pos`. In Lo...
ff7dc0f6f008ff03f834389f9dc02ccbdabceece
3,628,194
def api_redirect(): """Redirects the user to the API documentation page.""" return flask.redirect(flask.url_for("api_ns.api"))
471dcc20b64da5299572783af7345bf2b3effd29
3,628,195
from rasa.nlu import utils as nlu_utils import aiohttp async def download_file_from_url(url: Text) -> Text: """Download a story file from a url and persists it into a temp file. Returns the file path of the temp file that contains the downloaded content.""" if not nlu_utils.is_url(url): rais...
373ca5e8a0726baeeb868a98b827110ca46e541b
3,628,196
import binascii def _decode_pem_private(lines, passphrase): """Decode a PEM format private key""" pem_name, headers, data, end = _decode_pem(lines, b'PRIVATE KEY') if pem_name == b'OPENSSH': return _decode_openssh_private(data, passphrase), end if headers.get(b'Proc-Type') == b'4,ENCRYPTED'...
64db7a54a1c35b35d435f64b45353c94029ab6c6
3,628,197
def kBtu_h2kW(x): """kBtu/h -> kW""" return Btu_h2kW(kBtu_h2Btu_h(x))
e528827fc9527dfbfa421741aea7c719979c7eb9
3,628,198
def plot_hist_centers(output, *args, **kwargs): """Plot 1-dimensinal output using pyplot.plot executes pyplot.plot(x, y, *args, **kwargs) with first two arguments overridden all other arguments are passed as is. Options: scale=float or 'width' - multiply bin by a scale or divide by bin width ...
be0d7e2cf5f3b5229d3c781c3f675291c9a9d4ba
3,628,199
import math def schedule_exp(initial_value): """ Exponential decay learning rate schedule. :param initial_value: (float or str) :return: (function) """ def func(progress): """ Progress will decrease from 1 (beginning) to 0 :param progress: (float) :return: (fl...
5d13bbd63c2a3e78ce921cb5e6fb6a38f4f729bb
3,628,200
def home(request): """ main view that handles rendering home page """ all_images = UserPost.objects.all() all_users = User.objects.exclude(id=request.user.id) if request.method == 'POST': form = UserPostForm(request.POST, request.FILES) if form.is_valid(): post = form...
cf8fb596b1ba40dcb37d2bfc49cdcc4ad3f757f4
3,628,201
def get_table_id(table): """ Returns id column of the cdm table :param table: cdm table name :return: id column name for the table """ return table + '_id'
33fd8f445f15fb7e7c22535a31249abf6f0c819b
3,628,202
from typing import Sequence from typing import Hashable def all_items_present(sequence: Sequence[Hashable], values: Sequence[Hashable]) -> bool: """ Check whether all provided `values` are present at any index in the provided `sequence`. Arguments: sequence: An iterable of Hashable values to ...
f43a881159ccf147d3bc22cfeb261620fff67d7a
3,628,203
import shutil def lnpost_hr4796aH2spf(var_values = None, var_names = None, path_obs = None, path_model = None, calcSED = False, hash_address = True, calcImage = False, calcSPF = True, Fe_composition = False, pit = False, pit_input = None): """Returns the log-posterior probability (post = prior * likelihood, thus ...
8f554959b042392afbcf5bcfc08bbc63eb1da867
3,628,204
def reorder(rules): """ Set in ascending order a list of rules, based on their score. """ return(sorted(rules, key = lambda x : x.score))
cf4ff3b8d8aacd5e868ee468b37071fed2c1d67e
3,628,205
def expand_np_candidates(np, stemming): """ Create all case-combination of the noun-phrase (nyc to NYC, israel to Israel etc.) Args: np (str): a noun-phrase stemming (bool): True if to add case-combinations of noun-phrases's stem Returns: list(str): All case-combination of the ...
3afe020bdec4d159a3ba5e186cb1a74492935c94
3,628,206
def gantt_chart(username, root_wf_id, wf_id): """ Get information required to generate a Gantt chart. """ dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id) gantt_chart = dashboard.plots_gantt_chart() d = [] for i in range(len(gantt_chart)): d.append( { ...
2640ffe378c08fed01f6fe6f23939eece9c89b4a
3,628,207
def read_sharepoint_excel(file_path, host, site, library, credentials, token_filepath=None, **kwargs): """ Returns a panda DataFrame with the contents of a Sharepoint list :param str file_path: a file path to an excel file in sharepoint within a site's library (i.e. /General/file.xlsx) :...
66e745913e3c3161e733e35d2b79f4235d4b4df5
3,628,208
def XDoG(img, sigma=0.5, k=1.6, tau=0.98, epsilon=0.1, phi=10): """ Improve thresholding with a tanh """ # Get a DoG aux = DoG(img, sigma=sigma, k=k, tau=tau)/255 # Thresholding for i in range(aux.shape[0]): for j in range(aux.shape[1]): if aux[i, j] >= epsilon: aux[i, j] = 1 # white! else: aux[...
2679505db9c8272f0e6abcf1cf793c096a8d0f8e
3,628,209
def calc_gcc_weights(ks_calib, num_virtual_channels, correction=True): """Calculate coil compression weights. Input ks_calib -- raw k-space data of dimensions (num_kx, num_readout, num_channels) num_virtual_channels -- number of virtual channels to compress to correction -- apply rotation cor...
d3754859c4e36d03d0e32431d91c0307df692592
3,628,210
def _ontology_info_url(curie): """Get the to make a GET to to get information about an ontology term.""" # If the curie is empty, just return an empty string. This happens when there is no # valid ontology value. if not curie: return "" else: return f"{OLS_API_ROOT}/ontologies/{_ont...
95a56a97e100387306bccb50d523fc7e41c4f8b2
3,628,211
def _is_LoginForm_in_this_page(driver): """ 用于判断一个页面是否有账号密码框 """ try: get_username_input(driver) get_password_input(driver) except Errors.LoginFormIsNotFound: return False else: return True
e5ffb5cf512ff35821ebb0f723528102957c3ba2
3,628,212
def get_native_instance() -> native.new_word_finder.NewWordFinder: """ 返回原生NLPIR接口,使用更多函数 :return: The singleton instance """ return __instance__
7b9604fcab328149ad185b3883f8a287e5a45873
3,628,213
def reconstruct(analysis): """Main reconstruct method""" reconstruction = Reconstruction(analysis) reconstruction.reconstruct() return reconstruction.data
253ac1bd62bb683823e39d9fda4493466f9b4226
3,628,214
import six def validate_str(value=None, min_length=None, max_length=None, required=True, name=None): """ validate string """ name_str = __name(name) # no input / no required if not value and not required: return True if not value and required: raise TypeError(('{name_str} expected str, string must be inpu...
15ccf4e4b4cd4143c513ee7fc26cf3b5fdbb8a5c
3,628,215
from typing import Dict def ore_required_for(target: Reactant, reactions: Dict[str, Reaction]) -> int: """Return the units of ORE needed to produce the target.""" ore = 0 excess: Dict[str, int] = defaultdict(int) needed = [target] while needed: cur = needed.pop() if cur.ID == "OR...
8670a9903c8777f88db4566833096a04174ca76f
3,628,216
from typing import Union from typing import List def list_available_dbms(connection: "Connection", to_dictionary: bool = False, limit: int = None, **filters) -> Union[List["Dbms"], List[dict]]: """List all available database management systems (DBMSs) objects or dicts. Optionally filte...
ca45a956890186d721a40cc623c00ea33d148fea
3,628,217
import io def csv_encode(data: np.ndarray) -> bytes: """Encodes a NumPy array in CSV. :param: data: NumPy array to encode """ with io.BytesIO() as buffer: np.savetxt(buffer, data, delimiter=",") return buffer.getvalue()
334ee81d47cb3b8a5c459856c82839e4e7b3da79
3,628,219
def _calculate_global_step(current_step: int) -> int: """Calculate the current global step given the current iteration step.""" global_step = 0 for step in range(current_step): global_step += n_optimize_fn(step) return global_step
f78cb5553cfd1134f75bd65805e0e490882b5ca2
3,628,220
def _format_optvalue(value, script=False): """Internal function.""" if script: # if caller passes a Tcl script to tk.call, all the values need to # be grouped into words (arguments to a command in Tcl dialect) value = _stringify(value) elif isinstance(value, (list, tuple)): v...
6f8123050e3249e2e038684d4324aff5181b6dc4
3,628,221
def scheme_to_str(exp): """Convert a Python object back into a Scheme-readable string.""" if isinstance(exp, ltypes.List): return "(" + " ".join(map(scheme_to_str, exp)) + ")" return str(exp)
1fe7f4e557c2ba2b5a0c3876c3b8e6787c45bfa2
3,628,222
from datetime import datetime def utcTimeFromUTCTimestamp(utcTimestamp: int): """ Args: utcTimestamp: number of seconds since 1970-01-01 00:00:00 UTC Returns: a (non-timezone aware) datetime object representing the same time as utcTimestamp, in UTC time """ return datetime.datetime.utcf...
57c9e7351bb87a3e5ac6770076539c7164e3c6dc
3,628,223
import re def extract_floats(string): """Extract all real numbers from the string into a list (used to parse the CMI gateway's cgi output).""" return [float(t) for t in re.findall(r'[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?', string)]
0dc26261d45bd0974e925df5ed660a6e31adf30c
3,628,224
import random def ProbToSequence_Nitem2_Order1(Prob): """ Return a random sequence of observations generated based on Prob, a sequence of first-order transition probability. In other words, the sequence follows a first-order Markov chain. Prob is a np array. """ length = Prob.shape[1] ...
7e73cbf6249d21fb5980614079bb16acead4fdfd
3,628,225
def binary(n, digits): """Returns a tuple of (digits) integers representing the integer (n) in binary. For example, binary(3,3) returns (0, 1, 1)""" t = [] for i in range(digits): n, r = divmod(n, 2) t.append(r) return tuple(reversed(t))
bc52a985b86954b1d23bb80a14c56b3e3dfb7c59
3,628,226
def build_results(interactions: pd.DataFrame, mean_analysis: pd.DataFrame, percent_analysis: pd.DataFrame, clusters_means: dict, complex_compositions: pd.DataFrame, counts: pd.DataFrame, genes: pd.DataFrame, ...
5d8d5dea8adf0e4fa6798ddf295555895241f653
3,628,227
from typing import Tuple def load_mnist(data_node_name, label_node_name, *args, normalize=True, folder='', **kwargs) -> Tuple[Dataset, Dataset]: """ Returns the training and testing Dataset objects for MNIST. @param data_node_name The graph node name for the data inputs. @param label_node_name The...
4d84d7c17528bc391cafa97f3da7caf3ad6181d6
3,628,228
def test_api_group_in_role_template(admin_mc, admin_pc, user_mc, remove_resource): """Test that a role moved into a cluster namespace is translated as intended and respects apiGroups """ # If the admin can't see any nodes this test will fail if len(admin_mc.client...
d2bb334bd7fa27f19347a03e58f95341d0db3156
3,628,229
def voc_ap(rec, prec): """ Compute VOC AP given precision and recall. Taken from https://github.com/marvis/pytorch-yolo2/blob/master/scripts/voc_eval.py Different from scikit's average_precision_score (https://github.com/scikit-learn/scikit-learn/issues/4577) """ # first append sentinel values a...
428bbdb9883d2b38a7bcdafa1a678305989c3904
3,628,230
import sympy def GetShapeFunctionDefinitionLine3D3N(x,xg): """ This computes the shape functions on 3D line Keyword arguments: x -- Definition of line xg -- Gauss point """ N = sympy.zeros(3) N[1] = -(((x[1,2]-x[2,2])*(x[2,0]+x[2,1]-xg[0]-xg[1])-(x[1,0]+x[1,1]-x[2,0]-x[2,1])*(x[2,2]-xg[2]...
aaa2f5b7afac4afc60d2b79ef3f22fba3553aabb
3,628,231
def get_next_version(release_type): """Increment a version for a particular release type.""" if not isinstance(release_type, ReleaseType): raise TypeError() version = Version(get_current_version()) if release_type is ReleaseType.major: return str(version.next_major()) if release_t...
f8a3be4195ed971a5bfadb86163ff6bdcfab1ab8
3,628,232
from crits.core.user import CRITsUser def get_user_subscriptions(user=None): """ Get user subscriptions. :param user: The user to query for. :type user: str or CRITsUser :returns: str """ if user is None: return None if not hasattr(user, 'username'): user = str(user)...
b6b3eb0bc03646939394ce8c495ea543c5d566d9
3,628,233
def calc_zvals(opt: Optimizer, std_errors=None, information='expected'): """Calculates z-scores. Keyword arguments: opt -- Optimizer containing proper parameters' values. std_errors -- Standard errors in case they were already calculated. ...
c344791c7632ae75270a22320b604e0bdad81f50
3,628,235
from rx.core.operators.observeon import _observe_on import typing from typing import Callable def observe_on(scheduler: typing.Scheduler) -> Callable[[Observable], Observable]: """Wraps the source sequence in order to run its observer callbacks on the specified scheduler. Args: scheduler: Schedul...
d803cfb77cca5550d6b9a46b4d40816125a123f0
3,628,236
def generate_grande_signature_regex(signataire_titre): """ Create a regex for a grande signature using the appropriate titres (main signatory, or secretary) signataire_titre : the list of usable titres (president, conseiller national, secretaire...) for the signature Return : (grande_signature_regex, ti...
52a0221fdbd3fc33f41162c59acad71b315511ca
3,628,237
def list_product_images(): """Retrieve a paginated list of product images with optional filters.""" shelf_image_id = request.args.get('shelfImageId') print(shelf_image_id) upc = request.args.get('upc') review_status = request.args.get('reviewStatus') skip = int(request.args.get('skip', 0)) l...
29d2b0ad73a374e28d69618217258eaf617f0636
3,628,238
from typing import Dict from typing import Any import yaml def variables() -> Dict[str, Any]: """Contents of ruinway.variables.yml.""" return yaml.safe_load((CURRENT_DIR / "runway.variables.yml").read_bytes())
c17834814f5a91103760bc2f6a5a1beb0e3ab63f
3,628,239
def csi_fsmn( frame, l_filter, r_filter, frame_sequence, frame_counter, l_order, r_order, l_stride, r_stride, unavailable_frames, out_dtype, q_params, layer_name="", ): """Quantized fsmn operator. Parameters ---------- Input : tvm.te.Tensor 2-...
1b2d99eaf38e007a52fc4788c2e8c03238b59c0b
3,628,240
def get_line_context(line: str) -> tuple[str, None] | tuple[str, str]: """Get context of ending position in line (for completion) Parameters ---------- line : str file line Returns ------- tuple[str, None] Possible string values: `var_key`, `pro_line`, `var_only`, `...
5f2bd8fafd71c69ae78dbe4cfeb790537a72753d
3,628,241
def list_accounts_for_identity(identity_key, id_type): """ Returns a list of all accounts for an identity. :param identity: The identity key name. For example x509 DN, or a username. :param id_type: The type of the authentication (x509, gss, userpass, ssh, saml). returns: A list of all accounts fo...
d6dd84ec6a2ea4b5604501c84f537b75f5a6718e
3,628,242
from typing import Any from typing import Tuple def to_tuple( value: Any, length: int = 1, ) -> Tuple[TypeNumber, ...]: """ to_tuple(1, length=1) -> (1,) to_tuple(1, length=3) -> (1, 1, 1) If value is an iterable, n is ignored and tuple(value) is returned to_tuple((1,), le...
6fa9b38fe040b1e16f016a12b288436a50a35ee2
3,628,244
def makenodelogin(): """make a node login """ if request.method == 'POST': ipaddr=request.form['ip'] iqn=request.form['iqn'] cmdres="iscsiadm -m node "+ iqn + "-p " +ipaddr + "-o update -n node.startup -v automatic" res=cmdline(cmdres) return Response(response=res,sta...
1a05d92ed6e699969254d0753e3ea213ad998af2
3,628,246
def _sorted_photon_data_tables(h5file): """Return a sorted list of keys "photon_dataN", sorted by N. If there is only one "photon_data" (with no N) it returns the list ['photon_data']. """ prefix = 'photon_data' ph_datas = [n for n in h5file.root._f_iter_nodes() if n._v_name.sta...
a8df6edb5cfa9b328d7648e0c9ab9f883812ee5a
3,628,247
from typing import Any def apatch(mocker: MockerFixture): """Return a function that let you patch an async function.""" def patch(target: str, return_value: Any): return mocker.patch(target, side_effect=mocker.AsyncMock(return_value=return_value)) yield patch
159a5087754a9b4befaae61b68244c76277e3cf3
3,628,248
def test(): """ 定义一个reader来获取测试数据集及其标签 Args: Return: read_data: 用于获取测试数据集及其标签的reader """ global TEST_SET return read_data(TEST_SET)
195eaeb2f1a54cf3419a807c5a180498034449f9
3,628,249
def structure_sample_ks_convergence_diagnostics(fit, max_nonzero=None, indicator_var='k', batch=True, **kwargs): """Calculate chi squared convergence diagnostics.""" if batch and hasattr(fit, 'warmup_posterior'): ...
96933c359c31bf0f4db5da1c5415034ca5192f2c
3,628,250
def prepare_wld(bbox, mwidth, mheight): """Create georeferencing world file""" pixel_x_size = (bbox.maxx - bbox.minx) / mwidth pixel_y_size = (bbox.maxy - bbox.miny) / mheight left_pixel_center_x = bbox.minx + pixel_x_size * 0.5 top_pixel_center_y = bbox.maxy - pixel_y_size * 0.5 return ''.join(...
668c348d74780a79a39ebc53f3f119ea37855e8e
3,628,251
def graphql_refresh_token_mutation(client, variables): """ Refreshes an auth token :param client: :param variables: contains a token key that is the token to update :return: """ return client.execute(''' mutation refreshTokenMutation($token: String!) { refreshToken(token: $to...
c217217b289a188de8709dbe875853329d2c3fbc
3,628,252
def sintef_d50(u0, d0, rho_p, mu_p, sigma, rho): """ Compute d_50 from the SINTEF equations Returns ------- d50 : float Volume median diameter of the fluid phase of interest (m) Notes ----- This function is called by the `sintef()` function after several intermedia...
c6cad2e32ddaf0b254ad118a80ed29e0ac49e88a
3,628,253
def check_duplicate_stats(stats1, stats2, threshold=0.01): """ Check two lists of paired statistics for duplicates. Returns a list of the pairs that agree within to <1%. INPUTS: STATS1 : List of first statistical metric, e.g. Standard Deviations STATS2 : List of second statistical metric, e.g....
eb75d9d02a92cdb337dcbc100b282773543ac894
3,628,255
def get_width(panel: Panel) -> int: """Return the width of the panel""" if isinstance(panel, RowPanel): return GRID_WIDTH if panel.gridPos is None: return 0 # unknown width return panel.gridPos.w
2e2542a51d517062fdd82f9c80932167d8da855b
3,628,256
def tensor_abs(inputs): """Apply abs function.""" return P.Abs()(inputs)
5635018e4186601ff2579a7aaf9329b73d3ba601
3,628,257
import re def _parse_uci_regression_dataset(name_str): """Parse name and seed for uci regression data. E.g. yacht_2 is the yacht dataset with seed 2. """ pattern_string = "(?P<name>[a-z]+)_(?P<seed>[0-9]+)" pattern = re.compile(pattern_string) matched = pattern.match(name_str) if matched: name = ma...
dd2158e1a5ceeba25a088b07ff8064e8016ae551
3,628,258
import requests import json def http_request(method, path, other_params=None): """ HTTP request helper function Args: method: HTTP Method path: part of the url other_params: Anything else that needs to be in the request Returns: request result """ params = {'app_partn...
281ddd467d0d8854495d7235ae06e381ef0790bf
3,628,259
def preprocess(text, remove_punct=False, remove_num=True): """ preprocess text into clean text for tokenization """ # 1. normalize text = normalize_unicode(text) # 2. remove new line text = remove_newline(text) # 3. to lower text = text.lower() # 4. de-contract text = decontr...
8debaa593904219620e43ffe5f4805219f57fd3b
3,628,260