code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def visit_list(url_list, driver, profile, ads_profile): <NEW_LINE> <INDENT> current_time = "" <NEW_LINE> current_time = str(time.strftime("%m%d%y%H%M%S", time.localtime())) <NEW_LINE> directory = 'session' + str(current_time) <NEW_LINE> if not os.path.exists(directory): <NEW_LINE> <INDENT> os.makedirs(directory) <NEW_L...
Visit URL list and dump stuff
625941f0f7d966606f6aa5a4
def captcha(digits): <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> for i, d in enumerate(digits): <NEW_LINE> <INDENT> if i == len(digits) - 1: <NEW_LINE> <INDENT> if digits[0] == d: <NEW_LINE> <INDENT> sum += int(d) <NEW_LINE> <DEDENT> <DEDENT> elif digits[i + 1] == d: <NEW_LINE> <INDENT> sum += int(d) <NEW_LINE> <DEDENT> <DE...
calc sum of string if next value matches current value
625941f0627d3e7fe0d693ea
def write_demo_data(folder_path): <NEW_LINE> <INDENT> if not os.path.exists(folder_path): <NEW_LINE> <INDENT> os.makedirs(folder_path) <NEW_LINE> <DEDENT> shutil.copy()
Create a sample files. This is a function for testing purposes. :param folder_path: :returns:
625941f04428ac0f6e5bad90
def __dump_class_ref_counts(gc, referrer_depth, cutoff, rcutoff, ignore): <NEW_LINE> <INDENT> plog("NOTICE", "GC: Gathering garbage collection stats...") <NEW_LINE> uncollectable = gc.collect() <NEW_LINE> class_counts = {} <NEW_LINE> referrers = {} <NEW_LINE> plog("NOTICE", "GC: Uncollectable objects: "+str(uncollectab...
loil
625941f0c432627299f051e3
def send_target_commands(self, target, conn): <NEW_LINE> <INDENT> conn.send(str.encode(" ")) <NEW_LINE> cwd_bytes = self.read_command_output(conn) <NEW_LINE> cwd = str(cwd_bytes, "utf-8") <NEW_LINE> print(cwd, end="") <NEW_LINE> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cmd = input() <NEW_LINE> if len(st...
Connect with remote target client :param conn: :param target:
625941f057b8e32f52483a38
def update_dataset(self, dataset, fields, retry=DEFAULT_RETRY): <NEW_LINE> <INDENT> partial = dataset._build_resource(fields) <NEW_LINE> if dataset.etag is not None: <NEW_LINE> <INDENT> headers = {'If-Match': dataset.etag} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> headers = None <NEW_LINE> <DEDENT> api_response = s...
Change some fields of a dataset. Use ``fields`` to specify which fields to update. At least one field must be provided. If a field is listed in ``fields`` and is ``None`` in ``dataset``, it will be deleted. If ``dataset.etag`` is not ``None``, the update will only succeed if the dataset on the server has the same ETa...
625941f03539df3088e2e8e4
def layer_normalization(self,x,layer_index,type): <NEW_LINE> <INDENT> filter=x.get_shape()[-1] <NEW_LINE> with tf.variable_scope("layer_normalization"+type+str(layer_index)): <NEW_LINE> <INDENT> mean=tf.reduce_mean(x,axis=-1,keep_dims=True) <NEW_LINE> variance=tf.reduce_mean(tf.square(x-mean),axis=-1,keep_dims=True) <N...
x should be:[batch_size,sequence_length,d_model] :return:
625941f08da39b475bd65514
def drop(self, dbname=None, username=None): <NEW_LINE> <INDENT> self.node.execute( "drop publication {}".format(self.name), dbname=dbname, username=username)
Drop publication
625941f02ae34c7f2600d6c9
def sort(self, reverse, *properties): <NEW_LINE> <INDENT> class After: <NEW_LINE> <INDENT> def __lt__(self, other): return False <NEW_LINE> def __gt__(self, other): return True <NEW_LINE> def __str__(self): return '' <NEW_LINE> <DEDENT> class Before: <NEW_LINE> <INDENT> def __lt__(self, other): return True <NEW_LINE> d...
Return an iterator over the objects in self in alphabetical order of properties in turn.
625941f0287bf620b61d3ff9
def get_queryset(self): <NEW_LINE> <INDENT> return Question.objects.order_by('-pub_data')[:5]
Return the last five published questions.
625941f0460517430c39470e
def closeLimitOrders(self, asset, currency): <NEW_LINE> <INDENT> self.market.Order.Order_cancelAll().result()
:param asset: :param currency:
625941f045492302aab5e862
def in_sorted(target, sorted_list): <NEW_LINE> <INDENT> for ind in range(len(sorted_list)): <NEW_LINE> <INDENT> if target == sorted_list[ind]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif target > ind: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT...
Check if target is in the given sorted list
625941f030c21e258bdfaa3d
def test_some(self, mocker): <NEW_LINE> <INDENT> mock_valid = mocker.patch( "houdini_toolbox.ui.menus.parmmenu._valid_to_convert_to_absolute_reference", side_effect=(False, True), ) <NEW_LINE> mock_parm1 = mocker.MagicMock(spec=hou.Parm) <NEW_LINE> mock_parm2 = mocker.MagicMock(spec=hou.Parm) <NEW_LINE> scriptargs = {"...
Test converting when at least one parm is suitable to convert.
625941f0462c4b4f79d1dc68
def carrega_dados(arquivo): <NEW_LINE> <INDENT> dados = open(arquivo, 'r') <NEW_LINE> X=[] <NEW_LINE> Y=[] <NEW_LINE> Z=[] <NEW_LINE> tempos = [] <NEW_LINE> for i,linha in enumerate(dados): <NEW_LINE> <INDENT> listadados = linha.split('|') <NEW_LINE> X.append(int(listadados[3])) <NEW_LINE> Y.append(int(listadados[4])) ...
Abre um arquivo de dados e retorna 3 vetores: x,y,z, com tantos valores quanto houver no arquivo.
625941f0f548e778e58cdb19
def chdir(self, newdir): <NEW_LINE> <INDENT> if isinstance(newdir, RemotePath): <NEW_LINE> <INDENT> raise TypeError("newdir cannot be %r" % (newdir,)) <NEW_LINE> <DEDENT> logger.debug("Chdir to %s", newdir) <NEW_LINE> os.chdir(str(newdir)) <NEW_LINE> return self.__class__()
Changes the current working directory to the given one :param newdir: The destination director (a string or a ``LocalPath``)
625941f0d164cc61757832e8
@conduct_logging.handle_connection_error <NEW_LINE> @conduct_logging.handle_http_error <NEW_LINE> def run(args): <NEW_LINE> <INDENT> path = 'bundles/{}?scale={}'.format(args.bundle, args.scale) <NEW_LINE> url = conduct_url.url(path, args) <NEW_LINE> response = requests.put(url) <NEW_LINE> conduct_logging.raise_for_stat...
`conduct run` command
625941f0d8ef3951e3243ad7
def add_long_option(self, name, value): <NEW_LINE> <INDENT> if not self.definition.has_option(name): <NEW_LINE> <INDENT> raise Exception('The "--%s" option does not exist.' % name) <NEW_LINE> <DEDENT> option = self.definition.get_option(name) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> if option.is_value_required(...
Adds a long option value @param name: The long option key @type name: str @param value: The value for the option @type value: mixed
625941f09b70327d1c4e1371
@metricify(LOGLOSS_SIG_W, "For internal use only", DIRECTION_ASCENDING, match_func=match_disabled) <NEW_LINE> def logloss_sig_w(act, pred, weight=None): <NEW_LINE> <INDENT> return _logloss_sig(act, pred, weight)
apply sigmoid to args before calculating log loss. used for model approximation of probabilities
625941f082261d6c526aba41
def test_status_predict(): <NEW_LINE> <INDENT> people = People(data) <NEW_LINE> status = people.status_prediction() <NEW_LINE> assert status == 1 or status == 0
Check the predict method
625941f0566aa707497f4afa
def pos_block_selector_n(self, seed, n, i): <NEW_LINE> <INDENT> l = self.pos_block_selector(seed, n) <NEW_LINE> return l[i]
return the POS staker list position for given seed at index, i :param seed: :param n: :param i: :return:
625941f0ad47b63b2c50a519
def prepare_input_for_subloader(self, filepath, unit): <NEW_LINE> <INDENT> sentLst = [] <NEW_LINE> if self.c9sents == None: <NEW_LINE> <INDENT> if self.options.lang=="fin": <NEW_LINE> <INDENT> c9reader = conllud_fin(filepath) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> c9reader = conll09(filepath, self.options.use_pr...
if unit is oracle , make a list from token_oracles, otherwise use token_words :param filepath: path to training file :param unit: subword unit :return:
625941f0d486a94d0b98e6e0
def ACItf(audio, Fs, j, s): <NEW_LINE> <INDENT> s = s/np.amax(s) <NEW_LINE> specrows = s.shape[0] <NEW_LINE> speccols = s.shape[1] <NEW_LINE> dk = np.absolute(np.diff(s, axis=1)) <NEW_LINE> duracion = len(audio)/Fs <NEW_LINE> m = math.ceil(duracion/j) <NEW_LINE> n = math.floor(speccols/m) <NEW_LINE> ACI = np.zeros((spe...
Calcula el indice de complejidad acústica original (ACI) [1] que fue renombrado en [2] :param audio: señal monoaural temporal (numpy array) :param Fs: frecuencia de muestreo en Hz (int) :param j: tamaño de cada cluster en segundos (int) :param s: espectrograma de la señal (numpy array) :return: valor del ACItf (float)
625941f07b25080760e399ee
def __init__(self, sim:np.ndarray, obs:np.ndarray): <NEW_LINE> <INDENT> self.simulation = sim <NEW_LINE> self.observation = obs
Args: sim (np.ndarray) : Simulation of some model obs (np.ndarray) : Observation or expected ground truth
625941f02eb69b55b151ce51
def _preprocess_list_of_dicts(self, data_in): <NEW_LINE> <INDENT> data = deepcopy(data_in) <NEW_LINE> self.logger.info('(Preprocess) Serializing...') <NEW_LINE> for item in tqdm(data, desc='Serialization', leave=False): <NEW_LINE> <INDENT> item = serialize_dict_1d(item) <NEW_LINE> item['uuid_in_df'] = self._get_uuid_fr...
Preprocess list of dicts. Args: data_in (list): list of dicts containing data Returns: (dict): dict of lists = listed dict
625941f0a4f1c619b28b05c4
def on_focus_changed(): <NEW_LINE> <INDENT> vi_state = app.vi_state <NEW_LINE> if app.current_buffer.read_only(): <NEW_LINE> <INDENT> vi_state.input_mode = InputMode.NAVIGATION <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> vi_state.input_mode = InputMode.INSERT
When the focus changes to a read/write buffer, make sure to go to insert mode. This happens when the ViState was set to NAVIGATION in the copy buffer.
625941f0091ae356686674ee
def draw_jointplot( figname, x, y, data=None, kind="reg", color=None, xlim=None, ylim=None, format="pdf" ): <NEW_LINE> <INDENT> import seaborn as sns <NEW_LINE> sns.set_context("talk") <NEW_LINE> plt.clf() <NEW_LINE> register = { "MeanCoverage": "Sample Mean Coverage", "HD.FDP": "Depth of full spanning reads", "HD.PDP"...
Wraps around sns.jointplot
625941f096565a6dacc8fc62
def text_generator(example_generator): <NEW_LINE> <INDENT> for e in example_generator: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> article_text = e.features.feature['article'].bytes_list.value[ 0] <NEW_LINE> abstract_text = e.features.feature['abstract'].bytes_list.value[ 0] <NEW_LINE> <DEDENT> except ValueError: <NEW...
Generates article and abstract text from tf.Example. Args: example_generator: a generator of tf.Examples from file. See data.example_generator
625941f0b57a9660fec33e25
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, RangesResponse): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941f015baa723493c4513
def create_validate_code(size=(150, 40), chars=init_chars, img_type="GIF", mode="RGB", bg_color=(255, 255, 255), fg_color=(0, 0, 255), font_size=18, font_type=fontType, length=4, draw_lines=True, n_line=(1, 2), draw_points=True, point_chance = 2): <NEW_LINE> <INDENT> width, height = size <NEW_LINE> img = Image.new(mode...
@todo: 生成验证码图片 @param size: 图片的大小,格式(宽,高),默认为(120, 30) @param chars: 允许的字符集合,格式字符串 @param img_type: 图片保存的格式,默认为GIF,可选的为GIF,JPEG,TIFF,PNG @param mode: 图片模式,默认为RGB @param bg_color: 背景颜色,默认为白色 @param fg_color: 前景色,验证码字符颜色,默认为蓝色#0000FF @param font_size: 验证码字体大小 @param font_type: 验证码字体,默认为 ae_AlArabiya.ttf @param length: 验证...
625941f0e76e3b2f99f3ad9b
def mse_loss(output, y): <NEW_LINE> <INDENT> return output - y
:param output: the output of the net. :param y: the label of input. :return: \partial L/ \partial output
625941f085dfad0860c3b3f6
def score(self, fin, log=None): <NEW_LINE> <INDENT> iv = StockIntrinsicValue.intrinsic_value(fin) <NEW_LINE> latest_price = fin.get_latest_price() <NEW_LINE> if iv is None or latest_price is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> score = (iv - latest_price)/latest_price <NEW...
Compute the score for a stock :param fin: the morningstar financial object of the stock :type fin: financial.Financial :param log: the log information :type log: pyvalue.log_info.LogInfo :return: the score
625941f0d4950a0f3b08c8e0
def release_lock(self, request): <NEW_LINE> <INDENT> self.send_release_lock(request) <NEW_LINE> return self.recv_release_lock()
Parameters: - request
625941f07b25080760e399ef
def format_date(self, date): <NEW_LINE> <INDENT> if 'hour' in self.args['interval']: <NEW_LINE> <INDENT> date_str = date.strftime("%Y-%m-%dT%H:%M:%S") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> date_str = date.strftime("%Y-%m-%d") <NEW_LINE> <DEDENT> return date_str
Return formatted date string based on interval.
625941f066673b3332b9262a
def post(self, request: Request, format=None) -> 'Response': <NEW_LINE> <INDENT> serializer = NewsSerializer(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> serializer.save(author=request.user) <NEW_LINE> return Response(serializer.data, status=status.HTTP_201_CREATED) <NEW_LINE> <DEDENT> re...
Handle POST HTTP Request :param request: Request object :param format: Whether use or not format suffixes :return: Response with JSON News data if News was successfully created, otherwise Response with 400 status code
625941f04a966d76dd5515af
def For_iter(self, node, parent, expr): <NEW_LINE> <INDENT> target = node.target.id <NEW_LINE> if isinstance(expr, Range): <NEW_LINE> <INDENT> start = expr.start <NEW_LINE> stop = expr.stop <NEW_LINE> node.step = expr.step <NEW_LINE> name = target <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> start = types.zero <NEW_LI...
For(expr target, expr iter, stmt* body, stmt* orelse)
625941f0bd1bec0571d90bc8
def precompute_processing_quantities(self): <NEW_LINE> <INDENT> self.initialize_phase_screen()
Implements the FieldProcessor method called after recieveing the properties of the aperture field.
625941f07b180e01f3dc4d8a
def get_attention_bias(sequence_length, maxlen=None): <NEW_LINE> <INDENT> mask = tf.sequence_mask(sequence_length, maxlen=maxlen) <NEW_LINE> nonpadding = tf.to_float(mask) <NEW_LINE> invert_sequence_mask = tf.to_float(tf.logical_not(mask)) <NEW_LINE> attention_bias = common_attention.attention_bias_ignore_padding( inve...
Create attention bias so attention is not applied at padding position.
625941f0435de62698dfe1e6
def validation_POW(block_hex): <NEW_LINE> <INDENT> block = block_header.BlockHeader(io.BytesIO(bytes.fromhex(block_hex))) <NEW_LINE> exposant, coefficient = tools_bits.bits2target(block.bits.value) <NEW_LINE> hash_header = hash_block_header(block_hex) <NEW_LINE> print(tools_bits.cible_atteinte(coefficient, exposant, ha...
validationPOW(block_hex)
625941f07c178a314d6efa03
def Insert(self, request, global_params=None): <NEW_LINE> <INDENT> config = self.GetMethodConfig('Insert') <NEW_LINE> return self._RunMethod( config, request, global_params=global_params)
Inserts and starts a new update. Args: request: (ReplicapoolupdaterRollingUpdatesInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message.
625941f03617ad0b5ed68490
def fetch(self): <NEW_LINE> <INDENT> if self.idx is None: <NEW_LINE> <INDENT> raise ValueError("Device data cannot be fetched if idx is missing") <NEW_LINE> <DEDENT> self.data = self.server.get_device("idx", self.idx) <NEW_LINE> if self.data is None: <NEW_LINE> <INDENT> raise ValueError("Failed to fetch device data for...
Fetches device data
625941f06e29344779a62baa
def acf(forces, funlen, dstart=10): <NEW_LINE> <INDENT> if funlen > forces.shape[0]: <NEW_LINE> <INDENT> raise Exception("Not enough data") <NEW_LINE> <DEDENT> ntraj = int(np.floor((forces.shape[0]-funlen)/dstart)) <NEW_LINE> meanfz = np.mean(forces) <NEW_LINE> f1 = np.zeros((funlen)) * meanfz.unit**2 <NEW_LINE> origin...
Calculate the autocorrelation of a function Params ------ forces : np.ndarray, shape=(n,) The force timeseries acting on a molecules timestep : float Simulation timestep in fs funlen : int The desired length of the correlation function Returns ------- corr : np.array, shape=(funlen,) The autocorrelati...
625941f08a349b6b435e870c
def word_mover_distance(x, y): <NEW_LINE> <INDENT> p = np.ones(x.shape[0]) / x.shape[0] <NEW_LINE> q = np.ones(y.shape[0]) / y.shape[0] <NEW_LINE> D = np.sqrt(np.square(x[:, None] - y[None, :]).mean(axis=2)) <NEW_LINE> return wasserstein_distance(p, q, D)
WMD(Word Mover's Distance) x.shape=[m,d], y.shape=[n,d]
625941f0a79ad161976cc6df
def _result(self, command_response, log=None): <NEW_LINE> <INDENT> if command_response["success"] == "yes": <NEW_LINE> <INDENT> return CommandResult(True, None, log) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return CommandResult(False, command_response["errmsg"], log)
Create a CommandResult for a request response. :param command_response: command request response :type command_response: dict :param log: list of log messages (optional) :type log: list :return: a CommandResult containing any given log messages :rtype: :py:class:`vici.session.CommandResult`
625941f06aa9bd52df037341
def describe(self) -> str: <NEW_LINE> <INDENT> return f"Pause for {self.number} {self.unit} {self.reason}."
Describe the Action in present tense.
625941f096565a6dacc8fc63
def candidate_pruning(F_k, c_k, k): <NEW_LINE> <INDENT> c_k_pruned = [] <NEW_LINE> for cand in c_k: <NEW_LINE> <INDENT> flag = True <NEW_LINE> cand_subsets = [list(x) for x in itertools.combinations(cand, k-1)] <NEW_LINE> for cand_subset in cand_subsets: <NEW_LINE> <INDENT> if cand_subset not in F_k[k-1]: <NEW_LINE> <I...
Prune the generated candidates
625941f0dc8b845886cb5ad0
def add_type_to_database(type_name: str, elf_name: str, byte_size: int, db_handle: sqlite_utils.Database) -> Union[dict, None]: <NEW_LINE> <INDENT> new_type_record = {} <NEW_LINE> elf_key = list(db_handle['elfs'].rows_where('name=?', [os.path.realpath(elf_name)])) <NEW_LINE> if len(elf_key) < 1: <NEW_LINE> <INDENT> log...
Adds a new type with the name of type_name size of byte_size and mapped to the elf with name of elf_name. It is assumed that the type does NOT exist in the database. :param type_name: The nam of the new type. :param elf_name: The name of the elf file in the database. :param byte_size: The size of the new type. Must be ...
625941f024f1403a926010fb
def _get_mol_vector(self, step, mol_id, param=("x", "y", "z")): <NEW_LINE> <INDENT> begin = step * self.natoms <NEW_LINE> end = (step + 1) * self.natoms <NEW_LINE> mol_vector_structured = self.trajectory[begin:end][self.mol_config[mol_id]][param] <NEW_LINE> new_shape = mol_vector_structured.shape + (-1,) <NE...
Returns numpy array corresponding to atomic vectors of parameter "param" for the given time step and molecule id Args: step (int): time step mol_id (int): molecule id param (list): the atomic parameter for which the weighted average is to be computed Returns: 2D numpy array(natoms_in_molecule ...
625941f0b5575c28eb68e59f
def jhymes(word): <NEW_LINE> <INDENT> return get_rhymes(word, mode="json")
Get rhymes with forced JSON mode.
625941f0bd1bec0571d90bc9
def simplifyPath(self, path): <NEW_LINE> <INDENT> path=[x for x in path.split('/') if (x!='' and x!='.')] <NEW_LINE> stack=[] <NEW_LINE> for i in path: <NEW_LINE> <INDENT> if i=='..': <NEW_LINE> <INDENT> if stack: <NEW_LINE> <INDENT> stack.pop() <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> stack.append(i) <NE...
:type path: str :rtype: str
625941f0711fe17d825428f8
def get_package_permissions(spec): <NEW_LINE> <INDENT> for name in (spec.name, 'all'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> readable = spack.config.get('packages:%s:permissions:read' % name, '') <NEW_LINE> if readable: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> except AttributeError: <NEW_LINE> <IND...
Return the permissions configured for the spec. Package-specific settings take precedence over settings for ``all``
625941f0bde94217f3683385
def _swim(self, startpos, pos): <NEW_LINE> <INDENT> newitem = self._pq[pos] <NEW_LINE> while pos > startpos: <NEW_LINE> <INDENT> parentpos = (pos - 1) >> 1 <NEW_LINE> parentitem = self._pq[parentpos] <NEW_LINE> if self._keys[newitem] < self._keys[parentitem]: <NEW_LINE> <INDENT> self._pq[pos] = parentitem <NEW_LINE> se...
based on _siftdown in heapq from cpython
625941f0460517430c39470f
def no_real_wabs_credentials(): <NEW_LINE> <INDENT> if parse_boolean_envvar(os.getenv( 'WALE_WABS_INTEGRATION_TESTS')) is not True: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> for e_var in ('WABS_ACCOUNT_NAME', 'WABS_ACCESS_KEY'): <NEW_LINE> <INDENT> if os.getenv(e_var) is None: <NEW_LINE> <INDENT> return True ...
Helps skip integration tests without live credentials. Phrased in the negative to make it read better with 'skipif'.
625941f04c3428357757c8be
def ingredient_compare2(x, y): <NEW_LINE> <INDENT> c1 = x.minRadius <NEW_LINE> c2 = y.minRadius <NEW_LINE> if c1 < c2: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> elif c1==c2: <NEW_LINE> <INDENT> r1 = x.completion <NEW_LINE> r2 = y.completion <NEW_LINE> if r1 > r2: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> ...
sort ingredients using decreasing radii and decresing completion for radii matches: priority = 0
625941f066673b3332b9262b
def _init_state(self): <NEW_LINE> <INDENT> self._state['run'] = False <NEW_LINE> self._state['stop'] = False <NEW_LINE> self._state['pause'] = False <NEW_LINE> self._state['init'] = True <NEW_LINE> self._state['resch'] = False <NEW_LINE> self._state['cmdval'] = CMDINIT <NEW_LINE> self._setstateval() <NEW_LINE> rpiL...
Set Init state for the scheduled self._run() job.
625941f031939e2706e4d3fb
def set_substitution_filenames(self,filename='filename_substitutions.yaml'): <NEW_LINE> <INDENT> self.substitution_filenames = None <NEW_LINE> if self.ready: <NEW_LINE> <INDENT> self.util.set_yaml_attr(attr_obj=self, attr_name='substitution_filenames', filename=filename) <NEW_LINE> if not self.substitution_filenames: <...
Set the filename text substitution dictionary.
625941f0656771135c3ebe10
def p_vars_2nd(p): <NEW_LINE> <INDENT> p[0] = "" <NEW_LINE> for x in range(1, len(p)): <NEW_LINE> <INDENT> p[0] += p[x] + " " <NEW_LINE> <DEDENT> p[0]
vars_2nd : ID COMMA vars_2nd | ID DOUBLEDOT tipo SEMICOLON vars_3rd
625941f0fb3f5b602dac3c33
def __init__(self, valid_methods=None, description=None): <NEW_LINE> <INDENT> HTTPException.__init__(self, description) <NEW_LINE> self.valid_methods = valid_methods
Takes an optional set of valid http methods
625941f05fc7496912cc3f17
def get_urns_from_files(mappe, file_type='txt'): <NEW_LINE> <INDENT> import os <NEW_LINE> froot, _, files = next(os.walk(mappe)) <NEW_LINE> urns = dict() <NEW_LINE> for f in files: <NEW_LINE> <INDENT> fn = (os.path.join(froot, f)) <NEW_LINE> if f.endswith('.docx'): <NEW_LINE> <INDENT> urns[f] = get_urns_from_docx(fn) <...
Find URNs in files in a folder - specify folder
625941f091f36d47f21aca93
def __init__(self, agent, supervisor=NullSupervisor, interval=1): <NEW_LINE> <INDENT> self.last_input_time = -1 <NEW_LINE> self.last_output_time = -1 <NEW_LINE> self.last_spent = -1 <NEW_LINE> self.last_dt = -1 <NEW_LINE> super(RealTimeSyncScheduler, self).__init__( agent, supervisor=NullSupervisor, ) <NEW_LINE> self.s...
Create a new `RealTimeSyncScheduler` Instance. Args: interval (int): minimu interval in seconds between input and output of the modules. Returns: RealTimeSyncScheduler: A new `RealTimeSyncScheduler` instance.
625941f0004d5f362079a8c9
def get_transaction(self, transaction_id): <NEW_LINE> <INDENT> if not self.dpay.is_connected(): <NEW_LINE> <INDENT> raise OfflineHasNoRPCException("No RPC available in offline mode!") <NEW_LINE> <DEDENT> self.dpay.rpc.set_next_node_on_empty_reply(False) <NEW_LINE> if self.dpay.rpc.get_use_appbase(): <NEW_LINE> <INDENT>...
Returns a transaction from the blockchain :param str transaction_id: transaction_id
625941f09f2886367277ae22
def wrapped_handler(interface, handler, cleanup=None): <NEW_LINE> <INDENT> if handler: <NEW_LINE> <INDENT> if isinstance(handler, NativeHandler): <NEW_LINE> <INDENT> return handler.native <NEW_LINE> <DEDENT> def _handler(widget, *args, **kwargs): <NEW_LINE> <INDENT> if asyncio.iscoroutinefunction(handler): <NEW_LINE> <...
Wrap a handler provided by the user so it can be invoked. If the handler is a NativeHandler, return the handler object contained in the NativeHandler. If the handler is a bound method, or function, invoke it as it, and return the result. If the handler is a generator, invoke it asynchronously, with the yie...
625941f05fdd1c0f98dc07cf
def get_locations(self, latitude: float, longitude: float) -> List[Location]: <NEW_LINE> <INDENT> body = { 'location': { 'lat': latitude, 'lng': longitude }, 'fromDate': datetime.now(tz=pytz.timezone('US/Pacific')).strftime('%Y-%m-%d'), 'vaccineData': self.vaccine_data, 'locationQuery': { 'includePools': LOCATION_POOLS...
Gets available locations near the given coordinates
625941f02c8b7c6e89b35d56
def save(self): <NEW_LINE> <INDENT> self.save_to_storage() <NEW_LINE> self.save_to_scope() <NEW_LINE> list_current_documents()
Save the note.
625941f0442bda511e8be9aa
def aff_bn_relu_backward(dout, cache): <NEW_LINE> <INDENT> fc_cache, bn_cache, relu_cache = cache <NEW_LINE> da = relu_backward(dout, relu_cache) <NEW_LINE> dbn, dgamma, dbeta = batchnorm_backward_alt(da, bn_cache) <NEW_LINE> dx, dw, db = affine_backward(dbn, fc_cache) <NEW_LINE> return dx, dw, db, dgamma, dbeta
Helper function for Batch Normalization backward pass
625941f01f5feb6acb0c50e3
def test_hasCrossing(self): <NEW_LINE> <INDENT> return self.test_String("%", self.catf_sign)
returns true if the self.catf_sign has %
625941f085dfad0860c3b3f7
def decrypt(self, master_key: str) -> EncryptionKeysDB_V1: <NEW_LINE> <INDENT> assert isinstance(master_key, str) <NEW_LINE> assert isinstance(self.kdf_salt, str) <NEW_LINE> assert isinstance(self.nonce, str) <NEW_LINE> kdf_salt = binascii.a2b_base64(self.kdf_salt.encode("utf-8")) <NEW_LINE> symmetric_key = self.derive...
Raises `nacl.exceptions.CryptoError` on failure to authenticate cyphertext
625941f0ab23a570cc250722
def realIndex(self): <NEW_LINE> <INDENT> if self._stale: <NEW_LINE> <INDENT> self._initFrameList() <NEW_LINE> <DEDENT> return(self._framelist[self._index-1])
The 'real' frame in the trajectory for this index
625941f04527f215b584c9ec
def parse_payload(self, payload): <NEW_LINE> <INDENT> parsed_data = self._parse_payload_hex(payload["payload_hex"], payload["fport"]) <NEW_LINE> return parsed_data
This is common parsing method, implemented by all parsers.
625941f021a7993f00bc8295
def range_sum(B, i, j): <NEW_LINE> <INDENT> return B[j + 1] - B[i]
Return sum of elements in range i to j of A array. We assume that 0 <= i <= j < n, where n = len(A). We also assum that first element is 0, last is len(A) - 1
625941f01f5feb6acb0c50e4
def get_car_loc(self, n): <NEW_LINE> <INDENT> return self._car_locs[n][len(self._car_locs[n]) - 1]
Returns the current location of the n'th car. :param n: the index of the car :rtype: int
625941f021bff66bcd684ee7
def main(argv=sys.argv, consumer=None): <NEW_LINE> <INDENT> Tailer.cli(argv, consumer=consumer) <NEW_LINE> return 0
Args: argv (list): List of arguments consumer: an optional consumer Returns: int: A return code Does stuff.
625941f0a8370b7717052e38
def install(self, install_options, global_options=(), *args, **kwargs): <NEW_LINE> <INDENT> to_install = [r for r in self.requirements.values() if not r.satisfied_by] <NEW_LINE> if to_install: <NEW_LINE> <INDENT> logger.notify('Installing collected packages: %s' % ', '.join([req.name for req in to_install])) <NEW_LINE>...
Install everything in this set (after having downloaded and unpacked the packages)
625941f060cbc95b062c6ade
def convert_type(ty, default=None): <NEW_LINE> <INDENT> guessed_type = False <NEW_LINE> if ty is None and default is not None: <NEW_LINE> <INDENT> if isinstance(default, tuple): <NEW_LINE> <INDENT> ty = tuple(map(type, default)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ty = type(default) <NEW_LINE> <DEDENT> guesse...
Converts a callable or python type into the most appropriate param type.
625941f04f88993c3716c5fb
def values_and(x1: str, x2: str) -> str: <NEW_LINE> <INDENT> assert(len(x1) == len(x2)) <NEW_LINE> values1 = convert_value_to_bool(x1) <NEW_LINE> values2 = convert_value_to_bool(x2) <NEW_LINE> return convert_value_to_str([x and y for x, y in zip(values1, values2)])
Побитовое <И> 2-ух строк
625941f073bcbd0ca4b2c610
def _covers(self, geom) -> bool: <NEW_LINE> <INDENT> return self.eval(geom)
* Tests whether this PreparedPolygon <tt>covers</tt> a given geometry. * * @param geom the test geometry * @return true if the test geometry is covered
625941f0d268445f265b5409
def __init__(self, type=None, git=None): <NEW_LINE> <INDENT> self._type = type <NEW_LINE> self._git = git
V1SourceRevision - a model defined in Swagger
625941f0e76e3b2f99f3ad9c
def start_xibo_session(self): <NEW_LINE> <INDENT> self.site_cert_assurer.assure_site_cert() <NEW_LINE> return self.oauth2_session_starter.start_session()
Return a new web session with the Xibo API server.
625941f0925a0f43d254a417
def get_hierarchy_query_inspector(self): <NEW_LINE> <INDENT> return
Gets the inspector for the query to examine the terms used in the search. :return: the hierarchy query inspector :rtype: ``osid.hierarchy.HierarchyQueryInspector`` *compliance: mandatory -- This method must be implemented.*
625941f0eab8aa0e5d26e0f5
def __init__(self, sample_length, resolution, divider, n_regions=None, min_percentage_of_samples_per_region=None): <NEW_LINE> <INDENT> self.resolution = int(resolution) <NEW_LINE> if n_regions is None: <NEW_LINE> <INDENT> if self.resolution == 0: <NEW_LINE> <INDENT> self.divider = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE>...
:param sample_length: number of samples :param resolution: overall resolution :param divider: uniform divider rate at each resolution :param n_regions is a list containing number of regions at each resolution. Regions are then selected randomly. If given, it will overwrite the divider. :param min_percentage_of_samples_...
625941f007d97122c4178e34
def get_state(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Returns the state of the grid. Typically the matrix is stored like an array in numpy.
625941f0596a89723608a053
def export_playlist(db: DBMuziek, name: str): <NEW_LINE> <INDENT> playlist_query = db.get_playlist(name) <NEW_LINE> if not playlist_query: <NEW_LINE> <INDENT> print(f"The playlist {name} doesn't exist yet, create it and add songs to it.") <NEW_LINE> return None <NEW_LINE> <DEDENT> playlist_songs = db.get_playlist_songs...
Exports a playlist to be imported by this app. :param db: The database used. :param name: Name of the playlist to export. :PRE: The database object needs to be connected. :POST: If the playlist exists, it'll be exported, the information about the songs and groups will be included as well.
625941f05e10d32532c5f4bf
def total(line): <NEW_LINE> <INDENT> result = [0] * 256 <NEW_LINE> for char in line: <NEW_LINE> <INDENT> result[ord(char)] += 1 <NEW_LINE> <DEDENT> return result
Sum
625941f07d847024c06be85b
def get_os_dev_by_switch_interface(pop_url, pop_id, uuid): <NEW_LINE> <INDENT> odl_info = _get_odl_info(pop_url, pop_id) <NEW_LINE> topology_json = get_topology(odl_info[0], odl_info[1], odl_info[2]) <NEW_LINE> for topology in topology_json['network-topology']['topology']: <NEW_LINE> <INDENT> if 'link' in topology: <NE...
Retrieve the ID of the OS device connected to the given Switch Interface. None if there is no OS device connected :param pop_url: Url of Neo4j PoP DB :param pop_id: PoP ID :param uuid: Switch Interface OpenFlow ID :return string: OS Device ID
625941f05e10d32532c5f4c0
def set_epoch(self, epoch): <NEW_LINE> <INDENT> self.epoch = epoch
Sets the epoch for this sampler. When :attr:`shuffle=True`, this ensures all replicas use a different random ordering for each epoch. Otherwise, the next iteration of this sampler will yield the same ordering. Arguments: epoch (int): Epoch number.
625941f00383005118ecfb7b
def loaddata(self): <NEW_LINE> <INDENT> data = [] <NEW_LINE> keys = self.cart.keys() <NEW_LINE> for productid in keys: <NEW_LINE> <INDENT> dao = ProductDao() <NEW_LINE> product = dao.findbyid(productid) <NEW_LINE> row = {} <NEW_LINE> row['productid'] = product['productid'] <NEW_LINE> row['cname'] = product['cname'] <NE...
根据购物车中保存的商品id查询出商品的其他属性
625941f0d4950a0f3b08c8e1
def __init__(self, parent=None): <NEW_LINE> <INDENT> super(SaveQMLDockWidget, self).__init__(parent) <NEW_LINE> self.setupUi(self)
Constructor.
625941f01f037a2d8b946797
def test_scale_data_down_screen_up(self): <NEW_LINE> <INDENT> ax = AxisManager() <NEW_LINE> ax.data_min_DC = 1 <NEW_LINE> ax.data_max_DC = 0 <NEW_LINE> ax.screen_min_SC = 0 <NEW_LINE> ax.screen_max_SC = 100 <NEW_LINE> ax.update() <NEW_LINE> Ps = ax.to_screen(0.25) <NEW_LINE> self.assertEqual(Ps,75)
Test Coordinate calculation when the data and screen scales go in opposite directions Data scale: min = high, max = low Screen scale: min = low, max = high
625941f0627d3e7fe0d693ec
def nextMove(self, move): <NEW_LINE> <INDENT> self.moveAllItemsInDir(move) <NEW_LINE> self.checkIfGameOver() <NEW_LINE> state = self.gameState <NEW_LINE> isFull = all([state.getItem(x,y)!=None for x in range(self.gameState.size) for y in range(self.gameState.size)]) <NEW_LINE> if not isFull: self.addNumToRandomPoint(2)
Advance game to next move.
625941f0b7558d58953c54a2
def __iter__(self): <NEW_LINE> <INDENT> for i in range(0,len(self)): <NEW_LINE> <INDENT> yield self[i]
Supports iteration (via `iter(self)`)
625941f0c432627299f051e5
def _reprTextLine(self, **keywords): <NEW_LINE> <INDENT> return self._recurseRepr(self, addBreaks=False, addIndent=False)
Return a text representation without line breaks. This methods can be overridden by subclasses to provide alternative text representations.
625941f0498bea3a759ba048
def is_visible(self): <NEW_LINE> <INDENT> return False
This is never a menu command
625941f0e1aae11d1e74a258
def test_device_keyword_args(self): <NEW_LINE> <INDENT> test_kwargs = {'database': 'dummy_database', 'other_var': 'other_val'} <NEW_LINE> test_device = pyfusion.devices.base.Device('TestDevice', **test_kwargs) <NEW_LINE> self.assertEqual(test_device.database, test_kwargs['database']) <NEW_LINE> self.assertEqual(test_de...
Check that Device correctly processes config/kwarg options.
625941f0f8510a7c17cf9c9c
def setFileName(filename:str): <NEW_LINE> <INDENT> pass
Informs the code writer that the translation of a new VM file has started.
625941f030c21e258bdfaa3f
def fetch(self, rname, start, end): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> entry = self.index[rname] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise FetchError("Requested rname {0} does not exist! " "Please check your FASTA file.".format(rname)) <NEW_LINE> <DEDENT> start = start - 1 <NEW_LINE> offs...
Fetch the sequence ``[start:end]`` from ``rname`` using 1-based coordinates 1. Count newlines before start 2. Count newlines to end 3. Difference of 1 and 2 is number of newlines in [start:end] 4. Seek to start position, taking newlines into account 5. Read to end position, return sequence without newlines
625941f03617ad0b5ed68491
def isClassAdvisor(ob): <NEW_LINE> <INDENT> from warnings import warn <NEW_LINE> warn(isClassAdvisor.__doc__, DeprecationWarning, 2) <NEW_LINE> return decorators.metaclass_is_decorator(ob)
protocols.advice.isClassAdvisor is deprecated, please use
625941f082261d6c526aba43
def serve(request, path, document_root=None, show_indexes=False): <NEW_LINE> <INDENT> path = posixpath.normpath(urllib.unquote(path)) <NEW_LINE> path = path.lstrip('/') <NEW_LINE> newpath = '' <NEW_LINE> for part in path.split('/'): <NEW_LINE> <INDENT> if not part: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> drive...
Serve static files below a given point in the directory structure. To use, put a URL pattern such as:: (r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root' : '/path/to/my/files/'}) in your URLconf. You must provide the ``document_root`` param. You may also set ``show_indexes`` to ``True`` if you'd l...
625941f07047854f462a199e
def programs_dance(moves, programs): <NEW_LINE> <INDENT> for move in moves: <NEW_LINE> <INDENT> if move[0] == "s": <NEW_LINE> <INDENT> x = int(move[1:]) <NEW_LINE> programs = programs[-x:] + programs[:-x] <NEW_LINE> <DEDENT> if move[0] == "x": <NEW_LINE> <INDENT> A, B = move[1:].split("/") <NEW_LINE> A, B = int(A), int...
Make the programs dance according to the moves sequence. Return the list of programs after the dance.
625941f0293b9510aa2c382b
def apply_convolution_for_event(source_output: np.ndarray, density_intervals: np.ndarray, event_proba: float): <NEW_LINE> <INDENT> return convolve_probability(source_output, density_intervals, scale=event_proba)
Calculate a convolved output. Args: source_output: Previously computed model output on which the calculation is based density_intervals: Overall probability distribution of event occurring at a particular time given that it occurs event_proba: Total probability of the event occurring Returns: A numpy ...
625941f04f88993c3716c5fc
def detach(self): <NEW_LINE> <INDENT> return _DataModel.ArclinkUser_detach(self)
detach(ArclinkUser self) -> bool
625941f0d7e4931a7ee9e4bb
def do_reorder(self, order): <NEW_LINE> <INDENT> self.response = HttpResponseRedirect(reverse('basket:summary')) <NEW_LINE> basket = self.request.basket <NEW_LINE> for line in order.lines.all(): <NEW_LINE> <INDENT> if not line.product: <NEW_LINE> <INDENT> messages.warning(self.request, _("'%s' unavailable for re-order"...
'Re-order' a previous order. This puts the contents of the previous order into your basket
625941f0167d2b6e31219130