content
stringlengths
35
416k
sha1
stringlengths
40
40
id
int64
0
710k
def _make_var_list(var): """ Allows for a one line check for if a variable is a list. """ var_was_str = False if isinstance(var, str): var_was_str = True var = [var] return var, var_was_str
da59651688e7faa61a810901fc01d00708260fb7
642,428
def get_decipher_values(values, text_key): """ Converts a Decipher values collection into a Quantipy values collection. Parameters ---------- values : list The values object from a block of Decipher metadata Returns ------- values : list The Quantipy values object ...
9d25e9574880ea8f0f079df857f09313067bca0e
642,429
def create_pointer(name, direction='j'): """Creates a mark to a particular place on the tape.""" return '`h/_{name}:\rn{direction}m{name}'.format(name=name, direction=direction)
e1556692e930b4f8c06ea8a224a52670b18735dc
642,430
from datetime import datetime def date_from_epoch(epoch_secs): """Returns datetime.""" return datetime.utcfromtimestamp(epoch_secs)
4b8fa55abed7e459933ec3dc3dbd468853f88b78
642,431
def linear_search(lst, value): """ Searches for a specified value in a list. It performs linear search in an iterative way. @param lst: a list containing numbers @param value: value to search @return: True if value is found. Otherwise, False. """ for element in lst: if element ...
16106aed79dd0b1aed689ad0fb995743d0654514
642,432
def harmonic_mean_reward_fn(env, top1, top5, vloss, total_macs): """This reward is based on the idea of weighted harmonic mean Balance compute and accuracy provided a beta value that weighs the two components. See: https://en.wikipedia.org/wiki/F1_score """ beta = 1 # beta = 0.75 # How much to...
d230b60ec81a6bd4d1dd7576062f70b7a7229f94
642,433
import os def winbundle(entry='main.py'): """ ::usage:: Run from terminal in root folder You could also zip all the files. python3 > from bird import windowbundle > windowbunle() #--> creates a vbs file The vbs file along with the root folder should not be placed in "application"...
4d276641059809d4f6bcd0767c49ab63b8ce4a69
642,434
import math def calculate_kl(p, q): """Calculate D_KL(P || Q) (the KL-divergence) in bits. D_KL(P || Q) is the `information gained when one revises one's beliefs from the prior probability distribution Q to the posterior probability distribution P`. (Wikipedia, Kullback–Leibler divergence) ...
06a474403090147bf1f85f23e6a30c818cab54f6
642,435
def obtain_dest_by_user(config, userID, session): """ Obtain the destination's node id by the user's id """ # Perform the HTTP request to the server url = config['serveruri'] + "/users/" + str(userID) + "/events/next" r = session.get(url) # Retrieve the events and takes the first user_events =...
4e9647a7d84b8eb464267b1957d6e7508aa20855
642,436
def compute_macd_custom( df, column_source, column_target_ema, column_target_macd, column_target_macd_signal, column_target_macd_histogram, time_period_fast, time_period_slow, time_period_macd): """ Compute Moving Average Convergence Divergence (MACD). When fast ema crosses above sl...
4f0078c7e6e3db1f9c1a6e1a45027eae7ba9917a
642,437
import re def get_title(str): """ 获取标题 : 章节 + 标题 :param : str 输入应是 一行数据 如:( 6.1 间隔与支持向量 121 ) :return: str title """ part = str.strip("@").split() # delete @ # 页码和标题没有分隔符 if part[-1][-1].isdigit() and not part[-1][0].isdigit(): return re.sub(r"[0-9]{1,3}$", '', str).replace('...
051fcd44aff21bdfe5024d31fc8305f61cae75f8
642,438
def calculate_costs(minutes, hourly_rate): """ Returns the costs for a task based on time and hourly rate. Usage:: {{ item.time|calculate_costs:HOURLY_RATE }} """ return round(float(minutes) / 60 * hourly_rate, 2)
ce7f68db983a912a9fae72c9c2184d5c38a389fc
642,439
import re import os def _get_filename_index_value(file_path): """ stamp a filename with an added indexed incremented to what it had before """ file_idx_re = re.compile(r'^(?P<name>.+?)_(?P<idx>\d+)$') name, ext = os.path.splitext(file_path) m = file_idx_re.match(name) if m: return int...
63721233592ef55ee1e17a6452686c7c17553f63
642,440
import logging import os def get_loggers(logdir, keys=['base', 'train', 'valid', 'test'], format='%(asctime)s %(name)-4s %(levelname)-4s %(message)s'): """get Logging loggers for a set of `keys`""" logging.basicConfig(level=logging.INFO, format=format, ...
b23c0ec3fc934643c7b0cf6925643b357c5728f7
642,441
import random import string def client_token_generator(challenge_pk): """ Returns a 32 characters long client token to ensure idempotency with create_service boto3 requests. Parameters: None Returns: str: string of size 32 composed of digits and letters """ remaining_chars = 32 - len(str...
49571784dc37772c59fafe634beeeaa15200dd37
642,442
def apply_units(v, units): """Apply unit to a dimensionless value. Return dimensional values unchanged. Args: v (numeric, unit): The value to which units will be applied. units (unit): Unit to apply to the value. Returns: unit: A value with a Pint unit applied to it. Example: ...
df4056424c35062f346e8b7d98af6a15a9c0d46d
642,443
def mean_squared_error(a, initial=None): """Mean squared error (MSE). By default, assume the input array `a` is the residuals/deviations/error, so MSE is calculated from zero. Another reference point for calculating the error can be specified with `initial`. """ if initial is None: init...
204c14237b330644152b62b4432ac5867217159b
642,444
def ListVersionTags(client, messages, package, version): """Lists tags associated with the given version.""" list_tags_req = messages.ArtifactregistryProjectsLocationsRepositoriesPackagesTagsListRequest( parent=package, filter="version=\"{}\"".format(version)) list_tags_res = client.projects_locations_repos...
0e3befae26f053424e945a1602ebc8efe8e9cc20
642,445
import numpy def replace_a_with_b(array_a, array_b, a_nodata, b_nodata): """Set array_a to array_b where array_a==nodata an array_b != nodata.""" result = numpy.copy(array_a) valid_mask = ( (numpy.isclose(array_a, a_nodata) | numpy.isnan(array_a)) & ~numpy.isclose(array_b, b_nodat...
b5e8786c9fe995cd4aaa695823025705bc3d3e89
642,446
def dataframe_service(**args): """Indicates that the function operations on a data frame. The function will receive a single input in the form of a data frame, and should return a data frame object. The schema of the data frame is specified with this decorator. @publish(...) @dataframe_service(a =...
d8336ed8acc8bb1afd8fbf24aed385d771bd532d
642,447
import math import bisect def get_tile_coords_range(min_lat, min_long, max_lat, max_long, interval): """ Get the coordinates of the upper left corners of the list tiles containing the region. Args: min_lat: (float) The minimum latitude (farthest south). min_long: (float) The mini...
d938cc68eaa1821811c2bfab68a83c93c9a70901
642,448
def get_file_target(content, output, dependencies=None): """ Get a target that creates a file Parameters ---------- content : str file content output : str copy destination during build dependencies : list of str, optional outputs of target's dependencies, by default...
1aa8e67aa813874b16f8b9cb7fe46ebc96c9211a
642,449
import random def generate_card_pin(): """ Function to generate the credit card pin of the profile. Returns: The return value. String value containing credit card pin. """ return str(random.randint(1123,9850))
314f159f81d6ec81987756792c99b33062175524
642,450
import random def gen_fullrand(card): """ Just a random array """ out = [] for _ in range(card): out.append(random.randint(0, 100_000)) return out
7c0dfd3860ddef04689b5b4fdb099adb8d199166
642,451
def indent(text, prefix): """ Adds `prefix` to the beginning of non-empty lines in `text`. """ # Based on Python 3's textwrap.indent def prefixed_lines(): for line in text.splitlines(True): yield (prefix + line if line.strip() else line) return u"".join(prefixed_lines())
08d596f0641ab8b5077d70311c9f7b945d707877
642,452
from pathlib import Path import yaml def bad_temp_environment_yml(tmp_path_factory): """ Returns an invalid temporary environment.yml file """ env_file: Path = tmp_path_factory.mktemp("temp").joinpath("environment.yml") # name must be a string fake_env_info = { "name": 300, "...
7fb47181bc919f376026a797e1287a6c3d25949f
642,453
def app_logo_url(): """A URL for the test app logo.""" return "https://raw.githubusercontent.com/aiidalab/aiidalab-hello-world/master/img/logo.png"
0c3ea09635174fa569c55bf4d44dffd2b6aeb38f
642,454
def _flatten_yocto_conf(conf): """ Flatten conf entries. While using YAML *entries syntax, we will get list of conf entries inside of other list. To overcome this, we need to move inner list 'up' """ # Problem is conf entries that it is list itself # But we can convert inner lists to tuples, wh...
0651fb7678d8309fc7992e25c40f27b5fb99e93a
642,455
def load_corrupted_test_info(dataset): """Loads information for CIFAR-10-C.""" if dataset == 'cifar10': corruption_types = [ 'gaussian_noise', 'shot_noise', 'impulse_noise', 'defocus_blur', 'frosted_glass_blur', 'motion_blur', 'zoom_blur', 'snow', ...
3208f2edd2516fe136d7504f3d9a8143b6e0f5b8
642,456
def fix_flv(content): """This is aimed to make the extracted video files playable. For some reason youtube sends the files without the initial 13 bytes of FLV header. This should remediate this and allow for replaying saved videos by normal media players.""" # to prevent adding the header to file that ...
d7dd1abb814eda77ee96efcd953ffe8a959779cf
642,457
import math def _find_long_short(quadrants, l_int=(-float('inf'), +float('inf')), s_int=(-float('inf'), +float('inf'))): """The _find_long_short() function returns the average length of the long and short sides of the rectangles whose vertices are given in @p quadrants....
1b187ff8090571173cfd8c855c7fc03718c40ba0
642,458
from typing import Union from datetime import datetime from typing import Tuple def parse_date_range(date_range: str) -> Union[datetime, Tuple[datetime, datetime]]: """Parse either a date string or date tuple from a string. Args: date_range (str): This can either be a string with a single date or a t...
3474ca8493ed3b5e15d54042615fc6d3ec514558
642,459
def centroid_to_row(centroid_resource): """Returns a csv row to store main centroid info in csv files. """ return [centroid_resource['object']['centroid_name']]
3de093ec0f08d848086bb39e6cd2adcebb17a68a
642,460
import itertools def flatten(iterable): """Concatenate several iterables.""" return itertools.chain.from_iterable(iterable)
868ef9e0bd02d7c0c67d096c74c8eb69d87b2bfa
642,461
def _has_annotation(var: str) -> bool: """Check if a variable has an annotation. 'self' and 'cls' can't have annotations. :param var: str String containing variable name, annotations, and default value :return: bool Returns whether or not the variable has an annotation """ if va...
da4b980e37f764937a96b720df15f9758b0ed0c9
642,462
from typing import List from typing import Tuple def _split_chunk_bounds( start: int, stop: int, multiple: int, ) -> List[Tuple[int, int]]: # pylint: disable=g-doc-args # pylint: disable=g-doc-return-or-yield """Calculate the size of divided chunks along a dimension. Example usage: >>> _split_chunk_...
ebbc2ff86ca29f3eb72040944bdcc61cbab318ca
642,463
def map_bound(value, in_low, in_high, out_low, out_high): """map with high and low bound handling.""" result = None if value <= in_low: result = out_low else: if value >= in_high: result = out_high else: # http://stackoverflow.com/a/5650012/574981 ...
17c3d2a00cc0050daac27d70aa62a5cbab989022
642,464
def search_fid_mock(self, criterion_type, criteria_list): """ Mock of TemporalDataMgr.search_functional_identifiers method Same parameters and types as the original function """ return [{"tsuid": "00001", "funcId": "FuncId_0001"}, {"tsuid": "00002", "funcId": "FuncId_0002"}, ...
22a681dddac4dec45155ae2c3f5b73ee94ab7fbb
642,466
def get_outputs(task): """Get all outputs from a given luigi task and his dependencies.""" outputs = [] local_require = task while 1: try: outputs.append(local_require.output().path) local_require = local_require.requires() except AttributeError: break...
0293437d343a7e7d3ac81112f41b79a91b471c2d
642,467
import inspect def build(klass, **kwargs): """Build instance of klass using matching kwargs""" known_param_names = list(inspect.signature(klass).parameters.keys()) known_params = {n: kwargs[n] for n in known_param_names if n in kwargs} return klass(**known_params)
ae07ee5d784d7fd8d3ab5389a8771f614be8034d
642,468
def more_vowels(astring): """Solution to exercise C-4.18. Use recursion to write a Python function for determining if a string s has more vowels than consonants. """ string = astring.lower() vowels = 'aeiou' n = len(string) vowel_count = 0 def recurse(idx): nonlocal vowel_c...
7af30946a0314d04580eeae39d4c5a302b7c6d3e
642,470
from typing import Tuple def rgb_to_cmyk(r: int, g: int, b: int) -> Tuple[float, float, float, float]: """Convert RGB (Red Green Blue) to CMYK (Cyan Magenta Yellow Black). :param r: Red (0 to 255 inclusive). :param g: Green (0 to 255 inclusive). :param b: Blue (0 to 255 inclusive). :return: CMYK ...
c4a02d3fb66405940e4d50f578830ac5b8e809a9
642,471
def dimension_x_u(A, B): """x, uの次元を求める.""" nx = A.shape[1] nu = B.shape[1] return nx, nu
20d59bbd498187f435110dbe71d1ed1a12013c94
642,472
def isHappy(n): """ :type n: int :rtype: bool """ total=n result=[] result=set(result) while(1): total=sum(pow(int(i),2) for i in str(total)) if total == 100 or total == 1: return True elif total in result and 1 not in result: return False else: result.add(total)
cc7404e5768d98ba61a2a4537c8e482869b80711
642,473
def get_text(msg): """Function: get_text Description: Walks the tree of a email and returns the text of the email. Arguments: (input) msg -> Email message instance. (output) All texts in email joined together in a single string. """ msg_list = [] for part in msg.walk(): ...
9143ac9e6f3c6c31ce02b2fa39c96724a9999c23
642,475
import os def is_sdk_path_source(sdk_dir): """Validate if Firebase sdk dir is Firebase cpp source dir.""" # Not the most reliable way to detect if the sdk path is source or prebuilt # but should work for our purpose. return os.path.exists(os.path.join(sdk_dir, 'build_tools'))
7dee9ec5a949fed96776fddeda0578b0079e203f
642,476
def __r7(soup): """ Gets the most read news from the R7 page :param soup: the BeautifulSoup object :return: a list with the most read news from the R7 Page """ news = [] ps = soup.find_all('p', class_='trends-thermometer-description') i = 0 for p in ps: if i == 6: # Six tr...
83fecfc6e2a34c01b790ad037e62fe2827721883
642,477
import os def _itsa_file(anyfile): """ Helper function to confirm a file exists and is not empty. :param str anyfile: path to a file """ return(os.path.isfile(anyfile) and os.stat(anyfile).st_size > 0)
ff900025eb8adb8ab76bee68c014212a603bc401
642,478
def find_all(L, x): """Find indexes of all occurrences of *x* in list *L*, and return a list of them.""" out = [] prev = -1 while 1: try: prev = L.index(x,prev+1) out.append(prev) except: return out
9b2a061418cdee0767e37764edb6b60a791f52e9
642,479
import os def href_path(src: str, dest: str) -> str: """Returns the path to use for a reference from file src to file dest. This is a relative path to dest from the directory containing src. For example, for src `/foo/bar/baz.md` and dest `/foo/meh/blah.png`, returns `../meh/blah.png`. src and ...
a56b42d9ae99f042deae247d7bc8d00edc423259
642,480
def any_check(geom_test, gdf, how): """Improve speed for an 'any()' test on a list comprehension. Replace a statement like... .. code:: if any([geom_test.touches(g) for g in gdf.geometry]): ... with the following: .. code:: if any_check(geom_test, gdf, how='touches'): Inst...
42a1cdfc447c37fe028483e1ed74138e99c4904e
642,481
def drop_duplicates_sorted(df, subset=None, sep='', inplace=True): """ Drop duplicate rows based on unique combination of values from given columns. Combinations will be sorted on row axis before dropping duplicates. Params ------ df : pandas DataFrame subset : list of str Subs...
ee723e97b71985cc510c70bbf1ec0fdfac684484
642,482
import argparse def get_args(): """ Parse command arguments """ parser = argparse.ArgumentParser() parser.add_argument('ip_address', type=str, help="IP address of MazeRunner management server.") parser.add_argument('api_key', type=str, help="The API key.") parser.add_argument('api_secret...
e59afeacbfa753f0b3fef3dc5c9cc7cebd98e7b5
642,483
import configparser from typing import Optional import html def getconfigvar_escaped(config: configparser.ConfigParser, section: str, key: str) -> Optional[str]: """ Returns a CGI-escaped version of the value read from an INI file using :class:`ConfigParse...
066eef7c17ed96b59d40dd08b02a39928dc86fdc
642,484
import re def obfuscate_email(email: str | None) -> str: """Mask email""" return re.sub(r"(.).*@.*(.\..*)", r"\1****@****\2", str(email))
e8f2c365fca4825fbd4bff024ddd28951c6417e8
642,485
def parse_session_list(session_str: str) -> list: """ Moderate = Old World, Colony01 = New World :param session_str: :return: """ session_list = [session.strip() for session in session_str.split(';')] return session_list
6cd966a142b47d5c37945f7c278327c0b196eadc
642,486
import os def setdir(path): """Returns the path if present.""" if os.path.isdir(path): return path raise RuntimeError('Directory not found: "%s"' % path)
07bbf100f5b63bacb78de5d077ef8cc232f96498
642,488
def is_valid_energy(ext): """ Checks if energy format is compatible with GROMACS """ formats = ['edr'] return ext in formats
c46bae63df3daa8c11dd8efd981f3149866214de
642,489
def trim_the_firsts_e(L, e): """Return the list L without the first sequence of element(s) e. Eg. trim_the_firsts_e([0, 0, 1, 0, 1, 0]) -> [1, 0, 1, 0] :param L: the list to trim :param e: the element to remove :type L: list(int) :type e: int :return: the list L without the first(s) e(s) ...
b52b9a1bb2a94553735af335daa66898137f1424
642,490
def combine_dict_in_list(d1_, d2_): """ Merges two dictionaries, non-destructively, combining values on duplicate keys in a list >>> d1 = {'a': 'test', 'b': 'btest', 'd': 'dreg'} >>> d2 = {'a': ['cool', 'test'], 'b': 'main', 'c': 'clear'} >>> combine_dict_in_list(d1,d2) {'c': ['clear'], 'a': ['...
22163b4ed411d2f3a7fe0919604e357c288eb364
642,491
def part2(allergens): """Part 2 wants the list of unsafe ingredients, sorted by their allergen alphabetically, joined together into one string by commas. """ return ",".join( ingredient for (allergen, ingredient) in sorted(allergens.items()) )
4d1d1b32b673fabc47fc03fef6d32343f0a49532
642,492
def chromosoneCheck(sperm): """ chromosome_check == PEP8 (forced mixedCase by Codewars) Spelling mistake courtesy of Codewars as well """ return "Congratulations! You're going to have a {}.".format( 'son' if 'Y' in sperm else 'daughter' )
60c747a8410808e0aff768a8e5d3234126071c52
642,493
from typing import List from functools import reduce def mult_list(list_: List[int], modulus: int = 0) -> int: """ Utility function to multiply a list of numbers in a modular group :param list_: list of elements :param modulus: modulus to be applied, use 0 for no modulus :return: product of the e...
0d460e1d96e72d68cc1bdfaf2a69ba97890a0845
642,494
import argparse def get_parsed_arguments(): """ Returns arguments from argparser. """ parser = argparse.ArgumentParser(description='Filter the olympics database using the commands below:') parser.add_argument('--athlete', '-a', nargs=1, metavar='noc', help='list the names of all the athletes from...
58cfc8bbf8aa23330e8b7f4e06c0bbc5beeaa3c5
642,495
def get_skip_in(name, block): """ check backbone, defining skip_in for each block """ if name == 'unet_encoder': return [0,0,0,0,0,0,0,0,0,0] elif name == 'resnet50': return [block*2,block*6,0,block*12,block*2,0,block*24,block*4,block*2,0]
4030a2d5318fb05630039bfd682cd0d297034471
642,497
from typing import Dict def get_j2k_parameters(codestream: bytes) -> Dict[str, object]: """Return a dict containing JPEG 2000 component parameters. .. versionadded:: 2.1 Parameters ---------- codestream : bytes The JPEG 2000 (ISO/IEC 15444-1) codestream to be parsed. Returns ---...
0e3f78a8de7904e2273ba9643ebccf1252c9cf3d
642,499
def _is_trivial_description(col_name, col_description): # type: (str, str) -> bool """ Heuristics to determine if the column has a trivial description (which we do not document). """ return col_description == col_name or \ col_description == "Property " + col_name or \ col_...
77fba30df7984326d000ed2415fd06f0b45252e9
642,500
def get_source(dpath): """ Retrieve which source generated the data in the specified path """ if dpath.name == "TI_radar": source = "TI_sensor" elif dpath.name == "special_cases": source = "TI_sensor_special" elif dpath.name == "BBM": source = "BBM" elif dpath.suffix ...
51548832079d1f52d3e1aff0891485d74649a57f
642,501
def _original_var_name(var_name): """ Return the original variable name. """ if var_name.endswith('.quantized.dequantized'): return var_name[:-len('.quantized.dequantized')] if var_name.endswith('.quantized'): return var_name[:-len('.quantized')] if var_name.endswith('.dequantize...
a9745300ac1cb857dc2f3c782809819e042ba718
642,502
from pathlib import Path def get_input_paths(global_conf, local_conf): """Returns a 2-tuple: - Markdown Path or None - Input-file Paths or empty list """ del global_conf # Unused relative_markdown_path = None # Markdown is optional input_files = [] # Input file could be empty if "m...
a3b770074a0fab48eb782d4cfcb88bc41897445a
642,503
def lj_potential(rdist, eps, sig): """ Calculate Lennard-Jones Potential """ return (4.0 * eps) * ((sig / rdist)**12 - (sig / rdist)**6)
7af881c53cd4782eee27a868910ae38888ca7fe3
642,504
def filterIfEmpty(l): """ If l is one line (comment), filter.""" if len(l) == 1: return [] else: return l
06f3204d8a7e0e61b2352398af8b8d6f545bbffc
642,505
import shutil def copy_fixture(src, dest): """Wrap shutil.copy to backport use with Path objects.""" return shutil.copy(str(src.absolute()), str(dest.absolute()))
09ee7570f664587b980f89d10b763f131388d15a
642,506
import torch def compute_kld(mu: torch.Tensor, logvar: torch.Tensor) -> torch.Tensor: """ Compute the expected/averaged kl-divergence from a batch of mu's and logvar's for a fully-factorized Gaussian distribution. Assume dim0 is the batch dimension, and all the rest are data dimension. .. note::...
b5f9fedaf27818bf33af05dfeaeaf01e4a638aa5
642,507
def check_complete(board): """Checks the board. If all matches have been found, returns True.""" for card in board: if not card["cleared"]: return False return True
36ed0748019ea321c69b6e75e59c79557199cb88
642,508
def get_all_funcs(source=None, cspyce_dict=None): """Return a dictionary of all cspyce functions, keyed by their names. Inputs: source the dictionary to search, which defaults to globals(). cspyce_dict is used internally for recursion; it should not be referenced in int...
fcd691b33a7b99ded36e6499d4eb96a76fb880d0
642,510
def elide_text(text: str, max_length: int) -> str: """Shorten a string to a max length and end it with an ellipsis.""" return text if len(text) < max_length else f"{text[:max_length]}..."
0fc2072c53eb70e7e2ed3fb1d132a9a608c4a400
642,511
def determine_best_stat(vo, vi, da): """Card stats are either balanced (VoViDa are around the same), or one stat will be noticeably higher. This function returns which one.""" VISUAL, DANCE, VOCAL, BALANCED = 1, 2, 3, 4 # for balanced cards, the ratio hi:lo will be close to 1 THRES = 1.2 ...
5d96179480beb3b514ec48406dffeb70912cfd32
642,512
import json def get_workout_data_from_file(fNamePath): """ Parses passed files and loads that json data to a Dictionary. Returns the Dictionary storing the json data. """ data = '' with open(fNamePath) as data_file: data = json.load(data_file) return data
69d22f7553ab57d8013bd4351deb4edabc642a8d
642,513
import requests import json def RuhHali(ACCESS_TOKEN, ACCESS_TOKEN_SECRET, TEXT): """ ACCESS_TOKEN= Erişim anahtarını ifade eder turkce.ai üzerinden alınız. ACCESS_TOKEN_SECRET= Erişim gizli anahtarını ifade eder turkce.ai üzerinden alınız. TEXT= Analiz yapılacak metni giriniz. kelime ...
4e4cb65bca16e4020dcdb1bff871582b2795d746
642,514
def mock_spam_check(mocker): """Mock the check_comment_for_spam task""" return mocker.patch("channels.task_helpers.check_post_for_spam")
562c20db585fca4584e49e65a29da06975b82b8d
642,515
import json def load_json_schema(schema_file_name): """Load json schema from JSON file.""" with open(schema_file_name) as schema_file: return json.loads(schema_file.read())
40286cb00a2f3ff79cfc3629092ba3748221a528
642,516
def chen_celikovsky(XYZ, t, a=36, b=3, d=20): """ The Chen-Celikovsky Attractor. x0 = (0.1,0.1,0.1) """ x, y, z = XYZ x_dt = a * (y - x) y_dt = -x * z + d * y z_dt = x * y - b * z return x_dt, y_dt, z_dt
cb9b8427776e73610548a83ca9e5e2f2a4a6d3e2
642,517
import torch def batchify(fn, chunk_size): """Constructs a version of 'fn' that applies to smaller batches. All `fn`'s inputs have to be K-dimensional and have identical first K-1 sizes. `fn` must return one tensor. """ if chunk_size is None: return fn def ret(*inputs): origin...
9d47cc01c666460a6b2309404c8df6e2e44a77f0
642,518
def add_to_dict(param_dict): """ Aggregates extra variables to dictionary Parameters ---------- param_dict: python dictionary dictionary with input parameters and values Returns ---------- param_dict: python dictionary dictionary with old and new values added """ ...
38f7a701f3cd580b1b824a63640a9fce0612bee7
642,519
def capitalize_first(string): """Returns string with its first character capitalized (if any)""" return string[:1].capitalize() + string[1:]
0d248ba79ee5bf2dd5031fe8a1229a601cd2c09b
642,520
def dut_interface_status(duthost, interface_name): """ NAT CLI helper gets DUT's interface status :param duthost: DUT host object :param interface_name: string interface to configure :return : string formatted CLI output with interface current operstatus """ return duthost.show_interface(com...
c6b047eb24c8f3646dc80d1e484219d0a5f5109a
642,521
def evaluate_old_grounding(grounding): """Return status of old grounding.""" if not grounding['db_refs']: return 'ungrounded' elif not grounding['correct']: return 'incorrect' else: return 'correct'
c19349d70e2c7e9f53cca827c7d2443228183619
642,522
import torch def means_covs_observation(observations): """ For a guide on np.einsum (vs using for loops, a lot faster) (which is really similar to torch.einsum, which is used below to keep gpu speed-ups) check: - (short) http://ajcr.net/Basic-guide-to-einsum/ - or (eleborate, but VERY ...
e42f8c4f53f79e3cf328dca9a66a4b3e1aae36f1
642,523
def set_xpath(blockette, identifier): """ Returns an X-Path String to a blockette with the correct identifier. """ try: identifier = int(identifier) except Exception: msg = 'X-Path identifier needs to be an integer.' raise TypeError(msg) abbr_path = '/xseed/abbreviation_d...
9277013094c8a425739116f0718332bd6d0d21a1
642,524
def rotate(string, n): """Rotate characters in a string. Expects string and n (int) for number of characters to move. """ return string[n:] + string[:n]
97913787c51d9cb07274bf51285559d714ac00db
642,525
def invert_dict(source): """ Invert a dict Behavior if multiple values are the same is undefined """ out = {} for k, v in source.items(): out[v] = k return out
84badb192fbb1390cb8396b36c74fe737bd73176
642,526
def out_of_place_col_insert(df, series, loc, column_name=None): """Returns a new dataframe with given column inserted at given location. Parameters ---------- df : pandas.DataFrame The dataframe into which to insert the column. series : pandas.Series The pandas series to be inserted...
a3068c32760e02a012cddc300a0873c0a66f1adf
642,527
import logging def append_to_file(file_path: str, file_text: str) -> bool: """ Purpose: Append text to a file Args/Requests: file_path: file path file_text: Text of file Return: Status: True if appended, False if failed """ try: with open(file_path, "...
c6af52cd945367dc23da5d2bd1df17b1b52f05ed
642,528
def asciistate(): """returns the initial value for the "state" argument to ascii()""" return [0, 0]
ebb2fcc0d64b84d2314ba80d06a7b094f54b12c2
642,529
import re def explode(bus_str): """ Explode a bus into its separate lines. This function takes a bus expression like "ADDR[0:3]" and returns "ADDR0,ADDR1,ADDR2,ADDR3". It also works if the order is reversed, e.g. "ADDR[3:0]" returns "ADDR3,ADDR2,ADDR1,ADDR0". If the input string is not a vali...
3ccc46795a3d2b95087987c1503ffac53d4ec734
642,530
def __getRanks(dataColumn, descending=False): """ ([List], Boolean) -> [List] Determines the indexes(ranks) of data stored in the given list after getting sorted. Has an option to make it a descending ranking. """ items = [item for item in dataColumn] itemsSorted = sorted(items, reverse=...
dc44e57ccff9d07ba5729d83bfdd7720591691d5
642,531
def unique(mylist): """Finds unique elements of list""" return list(set(mylist))
67d889a98c50181c40546fa687e2ade8075fb315
642,532
def percent(val, val_max): """ Percentage calc :param val: value :param val_max: max value :return: ratio in percentage """ return float(val * 100) / val_max
2dbde830da389e98da7de3dd7138a3ee5b59e469
642,533
from typing import Collection def mean(iterable: Collection[float]) -> float: """ Returns the average value of an iterable """ return sum(iterable) / len(iterable)
d7780c052a4e7109694203a0967c94a81a4d2c29
642,534