code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def approximate_spd( panel_properties: Dict[str, Any], des_distance: float, des_intensity: float, des_spectrum: Dict[str, float], ) -> Tuple[Dict, Dict, float]: <NEW_LINE> <INDENT> desired_spd_dict = calculate_spd_dict(des_intensity, des_spectrum) <NEW_LINE> desired_spd_vector = accessors.vectorize_dict(desired_spd_dic...
Approximates spectral power distribution.
625941b85fcc89381b1e150f
def process_links(txt, prefix): <NEW_LINE> <INDENT> txt = re.sub(r'[^\[][0,2](attachment:.*)[^\]][0,2]', '[[' + "\\1" + ']]', txt) <NEW_LINE> txt = re.sub(r'\[\[(.*?)\]\]', lambda matchobj: '[[' + convert_link(matchobj, prefix) + ']]', txt) <NEW_LINE> if prefix: <NEW_LINE> <INDENT> wikiword_re = re.compile(r'(\s)([A-Z]...
convert links to moin syntax
625941b8498bea3a759b98fc
def step(self, step=None): <NEW_LINE> <INDENT> activearrays = self.pre_step(step) <NEW_LINE> h0 = red2comp( activearrays["hessian"], self.im.dbeads.nbeads, self.im.dbeads.natoms, self.im.coef, ) <NEW_LINE> h1 = np.add(self.im.h, h0) <NEW_LINE> d, w = clean_hessian( h1, self.im.dbeads.q, self.im.dbeads.natoms, self.im.d...
Does one simulation time step.
625941b867a9b606de4a7d08
@utils.arg('--limit', metavar='<NUMBER>', default=20, help='Page limit') <NEW_LINE> @utils.arg('--offset', metavar='<OFFSET>', help='Page offset') <NEW_LINE> @utils.arg('--order-by', metavar='<ORDER_BY>', help='Name of fields order by') <NEW_LINE> @utils.arg('--order', metavar='<ORDER>', choices=['desc', 'asc'], help='...
List all RegionQuota
625941b8a17c0f6771cbde9f
def do_fit( self, fit_function=None, x_data=None, y_data=None, channel_index=0, pixel_fit=False): <NEW_LINE> <INDENT> self.coord = None <NEW_LINE> if pixel_fit and np.count_nonzero(self.sweep_images) != 0: <NEW_LINE> <INDENT> frames = self.sweep_images / self.elapsed_sweeps <NEW_LINE> frames[:] = [cv2.flip(frame, 0) fo...
Execute the currently configured fit on the measurement data. Optionally on passed data
625941b8dc8b845886cb5380
def get_bin_seeds(X, bin_size, min_bin_freq=1): <NEW_LINE> <INDENT> bin_sizes = defaultdict(int) <NEW_LINE> for point in X: <NEW_LINE> <INDENT> binned_point = np.round(point / bin_size) <NEW_LINE> bin_sizes[tuple(binned_point)] += 1 <NEW_LINE> <DEDENT> bin_seeds = np.array([point for point, freq in six.iteritems(bin_si...
Finds seeds for mean_shift. Finds seeds by first binning data onto a grid whose lines are spaced bin_size apart, and then choosing those bins with at least min_bin_freq points. Parameters ---------- X : array-like, shape=[n_samples, n_features] Input points, the same points that will be used in mean_shift. bin_...
625941b87047854f462a1258
def __len__(self): <NEW_LINE> <INDENT> return self.n
Return the number of nodes in the trie.
625941b8adb09d7d5db6c5de
def alias(self): <NEW_LINE> <INDENT> return _spacegrant_swig.hdlc_framer_sptr_alias(self)
alias(hdlc_framer_sptr self) -> std::string
625941b899fddb7c1c9de1de
def test_login(self): <NEW_LINE> <INDENT> authenticator = Authenticator({'test': HiveUser('test', 'test')}) <NEW_LINE> Session.authenticator = authenticator <NEW_LINE> sessions = {} <NEW_LINE> users = {'test': HiveUser('test', 'test')} <NEW_LINE> cap = http.http(sessions, {'enabled': 'True', 'port': 0}, users, self.wor...
Tries to login using the username/password as test/test.
625941b899fddb7c1c9de1df
def set_stance(self, stance: Stance): <NEW_LINE> <INDENT> if isinstance(self.__toy, (R2D2, R2Q5)): <NEW_LINE> <INDENT> if stance == Stance.Bipod: <NEW_LINE> <INDENT> ToyUtil.perform_leg_action(self.__toy, R2LegActions.TWO_LEGS) <NEW_LINE> <DEDENT> elif stance == Stance.Tripod: <NEW_LINE> <INDENT> ToyUtil.perform_leg_ac...
Changes the stance between bipod and tripod. Set to bipod using ``set_stance(Stance.Bipod)`` and to tripod using ``set_stance(Stance.Tripod)``. Tripod is required for rolling.
625941b863b5f9789fde6f31
def recompute_grad(fn): <NEW_LINE> <INDENT> @functools.wraps(fn) <NEW_LINE> def wrapped(*args): <NEW_LINE> <INDENT> return _recompute_grad(fn, args) <NEW_LINE> <DEDENT> return wrapped
Decorator that recomputes the function on the backwards pass. Args: fn: a function that takes Tensors (all as positional arguments) and returns a tuple of Tensors. Returns: A wrapped fn that is identical to fn when called, but its activations will be discarded and recomputed on the backwards pass (i.e. on a...
625941b8097d151d1a222ca7
def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)): <NEW_LINE> <INDENT> nb_filter1, nb_filter2, nb_filter3 = filters <NEW_LINE> conv_name_base = 'res' + str(stage) + block + '_branch' <NEW_LINE> bn_name_base = 'bn' + str(stage) + block + '_branch' <NEW_LINE> x = Convolution2D(nb_filter1, 1...
conv_block is the block that has a conv layer at shortcut # Arguments input_tensor: input tensor kernel_size: defualt 3, the kernel size of middle conv layer at main path filters: list of integers, the nb_filters of 3 conv layer at main path stage: integer, current stage label, used for generating layer...
625941b8004d5f362079a182
def random_seeds(size, entropy=None): <NEW_LINE> <INDENT> return np.random.SeedSequence(entropy).generate_state(size)
Generates a sequence of most likely independent seeds.
625941b8e5267d203edcdaec
def _testLoadPinout(): <NEW_LINE> <INDENT> print(icGenerator.loadPinout("pinoutTest.ods"))
test for loadPinout function
625941b8925a0f43d2549cbf
def began_convergence_lossfun(y_true, y_pred, gamma): <NEW_LINE> <INDENT> x_hat = y_pred[..., 0] <NEW_LINE> x_hat_reconstructed = y_pred[..., 1] <NEW_LINE> x_real = y_true[..., 0] <NEW_LINE> x_real_reconstructed = y_pred[..., 2] <NEW_LINE> fake_ae_loss = K.mean(K.abs(x_hat - x_hat_reconstructed)) <NEW_LINE> real_ae_los...
y_pred[:,0]: (Gx(z)) y_pred[:,1]: D(Gx(z)) y_pred[:,2]: D(x) y_true: x
625941b8d18da76e2353231d
def add_handler(self, name: str): <NEW_LINE> <INDENT> if name in self.handlers: <NEW_LINE> <INDENT> return self.handlers[name] <NEW_LINE> <DEDENT> self.handlers[name] = handler = Handler(name) <NEW_LINE> self.add_function(name, lambda nme, inp: Handler._recursive_handle(handler, nme, inp)) <NEW_LINE> return handler
If a handler hasn't been added, a new handler is created. A function is also added in order to mimic a recursive call to handle. If a handler has previously been addend, that instance is returned. :param name: The name for the handler :return: A handler
625941b85166f23b2e1a4fa4
def nvidia_model_small(): <NEW_LINE> <INDENT> model = Sequential() <NEW_LINE> model.add(Conv2D(8, (5, 5), strides=(2, 2), activation="relu", input_shape=(67, 320, 1))) <NEW_LINE> model.add(Conv2D(12, (5, 5), strides=(2, 2), activation="relu")) <NEW_LINE> model.add(Conv2D(16, (5, 5), strides=(2, 2), activation="relu")) ...
Designed for single layer grayscale input.
625941b8ad47b63b2c509dd5
def setmem(vm_, memory, config=False, **kwargs): <NEW_LINE> <INDENT> conn = __get_conn(**kwargs) <NEW_LINE> dom = _get_domain(conn, vm_) <NEW_LINE> if VIRT_STATE_NAME_MAP.get(dom.info()[0], "unknown") != "shutdown": <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> flags = libvirt.VIR_DOMAIN_MEM_MAXIMUM <NEW_LINE> i...
Changes the amount of memory allocated to VM. The VM must be shutdown for this to work. :param vm_: name of the domain :param memory: memory amount to set in MB :param config: if True then libvirt will be asked to modify the config as well :param connection: libvirt connection URI, overriding defaults .. versiona...
625941b8009cb60464c63208
def pmf(self, k): <NEW_LINE> <INDENT> if (k > self.m) | (k != int(k)): <NEW_LINE> <INDENT> raise ValueError("k must be an integer between 0 and m, inclusive") <NEW_LINE> <DEDENT> if self.p == 1: <NEW_LINE> <INDENT> p_k = 1 if k == self.m else 0 <NEW_LINE> <DEDENT> elif self.p == 0: <NEW_LINE> <INDENT> p_k = 1 if k == 0...
Probability mass function. Uses exponents and logs to avoid overflow. Arguments: self, ConwayMaxwellBinomial object, k, int, must be an integer in the interval [0, m] Returns: P(k)
625941b8046cf37aa974cb96
@task <NEW_LINE> def seed_kafka(kafka_hosts="streamparse-box:9092", topic_name="pixels", num_pixels=100000): <NEW_LINE> <INDENT> kafka = KafkaClient(kafka_hosts) <NEW_LINE> producer = SimpleProducer(kafka) <NEW_LINE> puts("Seeding Kafka ({}) topic '{}' with {:,} fake pixels..." .format(kafka_hosts, topic_name, num_pixe...
Seed the local Kafka cluster's "pixels" topic with sample pixel data.
625941b876d4e153a657e97c
def p_c_p(t): <NEW_LINE> <INDENT> t[0] = ExpresionBinaria(t[2], t[3], OPERACION_RELACIONAL.IGUAL) <NEW_LINE> global gramatical <NEW_LINE> gramatical.append( " expresion.val := expresion.val == expresion.val")
c_p : IGUALQUE e c_p
625941b8b7558d58953c4d67
def compare_timestamps(ts1: str, ts2: str) -> bool: <NEW_LINE> <INDENT> ts1_head, ts1_pred = ts1.split("_") <NEW_LINE> ts2_head, ts2_pred = ts2.split("_") <NEW_LINE> return int(ts1_head) > int(ts2_head) or int(ts1_pred) > int(ts2_pred)
Compares the timestamp of two combined timestamp strings and determines if the first one is newer than the second one. Args: ts1: the first combined timestamp string ts2: the second combined timestamp string Returns: True if ``ts1`` is newer than ``ts2``
625941b87b180e01f3dc4651
def runBlocking(self,selector=selectors.DefaultSelector): <NEW_LINE> <INDENT> if self._is_started: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.initialize() <NEW_LINE> self.connect() <NEW_LINE> with self._selector_lock: <NEW_LINE> <INDENT> if self._is_started: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self....
Runs the client main loop in a blocking manner. ``selector`` may be changed to override the selector used for smart waiting. This method blocks until :py:meth:`stop()` is called.
625941b823849d37ff7b2edd
def multi_lasso_plot(X,CO_response,ethylene_response,supress=False): <NEW_LINE> <INDENT> from sklearn import linear_model <NEW_LINE> y=[] <NEW_LINE> for i in range(0,395): <NEW_LINE> <INDENT> y.append([CO_response[i],ethylene_response[i]]) <NEW_LINE> <DEDENT> model2 = linear_model.MultiTaskLasso(alpha=1200) <NEW_LINE> ...
Multi Task Lasso # X is the (m x n) feature vector. This can be an array or a pandas data frame. # CO_response is the m dimensional vector with the true CO values # ethylene_response is the m dimensional vector with the true ethylene values #If suppress is true, the plots are supressed.
625941b85166f23b2e1a4fa5
def __init__(self, explicit=False, is_run_shell=True): <NEW_LINE> <INDENT> self.platform_id = 2 <NEW_LINE> if sys.platform == 'win32': <NEW_LINE> <INDENT> self.platform_id = 0 <NEW_LINE> <DEDENT> if sys.platform == 'darwin': <NEW_LINE> <INDENT> self.platform_id = 1 <NEW_LINE> <DEDENT> info = publishinfo() <NEW_LINE> na...
编码默认为utf8 info: 由pushlishinfo获取的元组 explicit: 弹出页面是否使用显式调用 is_run_shell: bool 是否跑生成后的start
625941b80a50d4780f666cdb
def _cartesian_to_llh(x, y, z, model): <NEW_LINE> <INDENT> a, _, _, e2 = ELLIPSOID_MODELS[model] <NEW_LINE> p = math.sqrt(x*x+y*y) <NEW_LINE> lam = math.atan2(y, x) <NEW_LINE> phi = math.atan2(z, p*(1-e2)) <NEW_LINE> while True: <NEW_LINE> <INDENT> sp = math.sin(phi) <NEW_LINE> nu = a / math.sqrt(1 - e2*sp*sp) <NEW_LIN...
Approximate conversion from plane to spherical coordinates. Used as part of the Helmert transformation used outside the OSTN02 area. >>> _cartesian_to_llh(3841039.2016489909, -201300.3346975291, 5070178.453880735, 'OSGB36') (53.0, -3.0, 10.0)
625941b85fdd1c0f98dc007d
def get_Description(self): <NEW_LINE> <INDENT> return super(IServerObjectConfiguration, self).get_Description()
Method IServerObjectConfiguration.get_Description OUTPUT desc : BSTR*
625941b891af0d3eaac9b860
def say_hi(name, age): <NEW_LINE> <INDENT> print("Hello " + name + "! you are " + age + " years old.")
name = input("Enter Name: ")
625941b80a366e3fb873e663
def _select_last_modified_file(self): <NEW_LINE> <INDENT> role = self.model.DateModifiedRole <NEW_LINE> view = self.widgets["list"] <NEW_LINE> model = view.model() <NEW_LINE> highest_index = None <NEW_LINE> highest = 0 <NEW_LINE> for row in range(model.rowCount()): <NEW_LINE> <INDENT> index = model.index(row, 0, parent...
Utility function to select the file with latest date modified
625941b855399d3f055884ff
def test_set_new_password_for_own_user(self): <NEW_LINE> <INDENT> self.send_request('GET', 'users', username=self.testuser['username'], password=self.testuser['password']) <NEW_LINE> initial_pass = self.testuser['password'] <NEW_LINE> self.testuser['password'] = 'new_pass' <NEW_LINE> self.send_request('PUT', 'users', u...
Try to refresh the password of the current testuser.
625941b894891a1f4081b8f4
def __init__(self, **kwargs) : <NEW_LINE> <INDENT> self.alphabet = None <NEW_LINE> self.creator_text = release_description <NEW_LINE> self.logo_title = "" <NEW_LINE> self.logo_label = "" <NEW_LINE> self.stacks_per_line = 40 <NEW_LINE> self.unit_name = "bits" <NEW_LINE> self.show_yaxis = True <NEW_LINE> self.yaxis_label...
Create a new LogoOptions instance. >>> L = LogoOptions(logo_title = "Some Title String") >>> L.show_yaxis = False >>> repr(L)
625941b897e22403b379cde5
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'orgbranchs.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are you s...
Run administrative tasks.
625941b8656771135c3eb6bf
def create_thumbnail(fname, size=(100, 100), aspect_ratio=False): <NEW_LINE> <INDENT> im = Image.open(fname) <NEW_LINE> width, height = im.size <NEW_LINE> if width > height: <NEW_LINE> <INDENT> delta = width - height <NEW_LINE> left = int(delta / 2) <NEW_LINE> upper = 0 <NEW_LINE> right = height + left <NEW_LINE> lower...
@type fname: C{string} @param: Full path to image file @type size: C{tuple} @param: Width and height of the thumbnail @rtype: C{Image} @return: Returns PIL Image object
625941b8fb3f5b602dac34db
def test_query_sum(self): <NEW_LINE> <INDENT> start_date = datetime(2015, 1, 1) <NEW_LINE> end_date = datetime(2016, 1, 1) <NEW_LINE> result = data_query.query_sum(self.db, ["tot_1"], start_date, end_date, 1) <NEW_LINE> self.assertEqual(result["total"], 10) <NEW_LINE> result = data_query.query_sum(self.db, ["tot_1"], s...
Test basic query_sum functionality
625941b823e79379d52ee3b4
def extract_maf_wrapper(target, args): <NEW_LINE> <INDENT> accelerated_genomes = set(args.accelerated_genomes + [args.ref_genome]) <NEW_LINE> outgroup_genomes = set(args.target_genomes) - accelerated_genomes <NEW_LINE> bed_recs = [x.split() for x in open(args.conserved_bed)] <NEW_LINE> result_dir = target.getGlobalTemp...
Main pipeline wrapper. Calls out to hal2maf once for each region in args.conserved_bed
625941b8d58c6744b4257aad
def write(self, **kwargs): <NEW_LINE> <INDENT> return self.stub.write(**kwargs)
insert a level1 record into database :param kwargs: Parameter dictionary, key items support: level0_id: [str] data_type : [str] prc_params : [str] filename : [str] file_path : [str] prc_status : [int] prc_time : [str] pipeline_id : [str] refs: [dict] :returns: csst_dfs_...
625941b82c8b7c6e89b35610
def run_editor_on_exception(root_path=None, usercode_traceback=True, usercode_frame=True): <NEW_LINE> <INDENT> sys.excepthook = _get_debug_except_hook(root_path=root_path, usercode_traceback=usercode_traceback, usercode_frame=usercode_frame)
Run the editor when an unhandled exception (a fatal error) happens. Parameters ---------- root_path : str, optional Defaults to None (the directory of the main script). usercode_traceback : bool, optional Whether or not to show only the part of the traceback (error log) which corresponds to the user code. ...
625941b83539df3088e2e197
def test_one_task(): <NEW_LINE> <INDENT> f = Flow(name="test") <NEW_LINE> f.add_task(get_task("x1")) <NEW_LINE> steps = f.generate_local_task_ids(_debug_steps=True) <NEW_LINE> assert count_unique_ids(steps[1]) == 1 <NEW_LINE> assert steps[1] == steps[2] == steps[3] == steps[4] == steps[5]
x1 A single task
625941b84e4d5625662d4229
def allocate_structure(self,device=-1): <NEW_LINE> <INDENT> self.E = nn.Embedding( self.ref_set.lex_vocab.size(),self.embedding_size) <NEW_LINE> self.lstm = nn.LSTM(self.embedding_size, self.rnn_memory,num_layers=1,bidirectional=False) <NEW_LINE> self.W_struct_label = nn.Linear(self.rnn_memory...
This allocates the model parameters on the machine. Args: action_size (int): the number of action types lex_size (int): the size of the lexicon vocabulary struct_size (int): the size of the non terminal vocabulary rnn_memory (int): the size of the rnn hidden memory embedding_size(int): the e...
625941b83346ee7daa2b2bb5
def onConnectionPrompt(prompt, state, logger): <NEW_LINE> <INDENT> prompt = prompt.lower() <NEW_LINE> state.setdefault('triedPassword', 0) <NEW_LINE> state.setdefault('triedKeys', {}) <NEW_LINE> if 'enter passphrase for key' in prompt: <NEW_LINE> <INDENT> key = re.findall( r'key \'(.+)\':\s*$', prompt, flags = re.IGNOR...
:type prompt: str :type state: dict[str, object] :type logger: logging.Logger :rtype: str|None
625941b8090684286d50eb2c
@patchmethod(tf.Tensor, tf.Variable) <NEW_LINE> def padaxis(t, paddings, axis, mode='CONSTANT', name=None): <NEW_LINE> <INDENT> if isinstance(axis, int): <NEW_LINE> <INDENT> axis = (axis,) <NEW_LINE> if len(paddings) == 2: <NEW_LINE> <INDENT> paddings = [paddings] <NEW_LINE> <DEDENT> assert len(axis) == len(paddings) <...
t.pad((1,1), axis=0) # padleft, padright t.pad([(1,1), (1,1)], axis=[0,1]) # padleft, right, top, bottom :param t: :param paddings: :param axis: :param mode: :return:
625941b8dd821e528d63aff7
def test_role_edit_audit_errors(self): <NEW_LINE> <INDENT> admin_session = self.get_session('admin') <NEW_LINE> admin_session.edit('matholymprole', '1', {'room_types': ['Single room'], 'default_room_type': 'Shared room'}, error='Default room type not in permitted ' 'room types')
Test errors from role edit auditor.
625941b823849d37ff7b2ede
def move_const_torque(self, torque, **kwargs): <NEW_LINE> <INDENT> assert self._current_pos_enc is not None, ( "Home the actuator before attempting to move") <NEW_LINE> self.set_max_torque(torque, chain=True) <NEW_LINE> self.torque_mode(chain=True) <NEW_LINE> self.go(**kwargs)
Make the actuator maintain a constant torque output, units match read_torque return value.
625941b87d847024c06be10c
def guest_live_upload(self, guestaddr, file_to_upload, destination, timeout=10): <NEW_LINE> <INDENT> self.guest_execute_command(guestaddr, "mkdir -p " + os.path.dirname(destination), timeout) <NEW_LINE> return oz.ozutil.subprocess_check_output(["scp", "-i", self.sshprivkey, "-F", "/dev/null", "-o", "ServerAliveInterval...
Method to copy a file to the live guest.
625941b8c4546d3d9de7287c
def parse_ini( source: typing.Union[str, Path, typing.TextIO], intent_filter: typing.Optional[typing.Callable[[str], bool]] = None, sentence_transform: typing.Callable[[str], str] = None, file_name: typing.Optional[str] = None, ) -> IntentsType: <NEW_LINE> <INDENT> intent_filter = intent_filter or (lambda x: True) <NEW...
Parse multiple JSGF grammars from an ini file.
625941b8287bf620b61d38bb
def kraken_results_df_creator(kraken_hits, rds_or_cntgs): <NEW_LINE> <INDENT> dict_hits = {} <NEW_LINE> k = 1 <NEW_LINE> for i in range(0, len(kraken_hits)): <NEW_LINE> <INDENT> dict_hits['sp_krkn'+str(k)+'_'+rds_or_cntgs] = kraken_hits[i][5].lstrip() <NEW_LINE> dict_hits['sp_krkn'+str(k)+'_'+rds_or_cn...
Take the 2D array from a kraken search and return result as a dictionary.
625941b876e4537e8c3514c4
def likelihood(data, theta): <NEW_LINE> <INDENT> mu = theta['mu'] <NEW_LINE> tau = theta['tau'] <NEW_LINE> p = theta['p'] <NEW_LINE> lam = theta['lam'] <NEW_LINE> n_cts = len(mu) <NEW_LINE> n_bin = len(p) <NEW_LINE> n_ord = len(lam) <NEW_LINE> product = 1 <NEW_LINE> if isinstance(data, pd.DataFrame): <NEW_LINE> <INDENT...
Calculates likelihood :param data: the data :type data: pd.DataFrame or pd.Series :param parameters theta: parameters of the distributions :return: P(data|theta) :rtype: 0<=float<=1
625941b832920d7e50b28018
def __init__(self, flask_app, url, server_token): <NEW_LINE> <INDENT> self.server_token = server_token <NEW_LINE> self.error_reply = nothing_reply <NEW_LINE> self.text_match_registry = {} <NEW_LINE> self.text_re_match_registry = [] <NEW_LINE> self.msg_registry = {} <NEW_LINE> self.event_registry = {} <NEW_LINE> flask_a...
A wechat server. :param flask_app: :param url: register url to handle. :param server_token: wechat's server token. :return:
625941b8e8904600ed9f1d75
def __train_tree(self): <NEW_LINE> <INDENT> train_on = 15 <NEW_LINE> if len(self.history) > train_on: <NEW_LINE> <INDENT> f = -train_on <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f = 0 <NEW_LINE> <DEDENT> for cont in self.history[f:]: <NEW_LINE> <INDENT> if not cont.result: <NEW_LINE> <INDENT> continue <NEW_LINE> <D...
L.__train_tree() -> None -- update short & long memory and build new tree and test old and new
625941b838b623060ff0ac3b
def sendGetMessage(url, cookiename, callback): <NEW_LINE> <INDENT> request = {"action": "getCookie", "url": url, "cookieName": cookiename} <NEW_LINE> chrome.runtime.sendMessage(request, callback)
broadcast a cookie get request.
625941b8f9cc0f698b140452
def test_no_displacement(self): <NEW_LINE> <INDENT> self.logTestName() <NEW_LINE> mag_alpha = 0. <NEW_LINE> for phase_alpha in phase_alphas: <NEW_LINE> <INDENT> alpha = mag_alpha * np.exp(1j * phase_alpha) <NEW_LINE> self.circuit.reset(pure=self.kwargs['pure']) <NEW_LINE> self.circuit.displacement(alpha, 0) <NEW_LINE> ...
Tests displacement operation in some limiting cases where the result should be a vacuum state.
625941b856b00c62f0f144aa
def put(self,key,value,ex=60 * 60 * 24 * 5): <NEW_LINE> <INDENT> self.redis.set(key, value,ex=ex)
ex:默认过期时间为5天,如果一个task 5天都没有跑完,直接丢弃记录
625941b87cff6e4e811177d3
def normalise(self): <NEW_LINE> <INDENT> _, θ = self.polar() <NEW_LINE> return Vector.from_polar(1, θ)
return a normalised unit vector
625941b866673b3332b91ee4
def handle_getperms(bot, ievent): <NEW_LINE> <INDENT> try: name = ievent.args[0] <NEW_LINE> except IndexError: <NEW_LINE> <INDENT> ievent.missing('<name>') <NEW_LINE> return <NEW_LINE> <DEDENT> name = name.lower() <NEW_LINE> if not bot.users.exist(name): <NEW_LINE> <INDENT> ievent.reply("can't find user %s" % name) <NE...
arguments: <name> - get permissions of name.
625941b830bbd722463cbc0f
def draw_network(graph, filename = 'network.pdf', show = False, verbose = 2 ): <NEW_LINE> <INDENT> if verbose >=2: <NEW_LINE> <INDENT> print(".. Saving the network down as an image") <NEW_LINE> <DEDENT> if verbose >=3 : <NEW_LINE> <INDENT> print("... Coverting to dot") <NEW_LINE> <DEDENT> dot = to_pydot(graph) <NEW_LIN...
This is a simple wrapper to the networkx_draw. Args: graph: Supply a networkx graph object. NNs are all DiGraphs. filename: what file to save down as. Will add '.png' to the end. verbose: Do I even have to talk about this ? Notes: Takes any format that networkx plotter takes. This is not ready to be u...
625941b8460517430c393fdb
def invokeFactory(self, type_name, id, RESPONSE=None, *args, **kw): <NEW_LINE> <INDENT> constrains = IConstrainTypes(self, None) <NEW_LINE> if constrains: <NEW_LINE> <INDENT> allowed_ids = [ fti.getId() for fti in constrains.allowedContentTypes() ] <NEW_LINE> if type_name not in allowed_ids: <NEW_LINE> <INDENT> raise V...
Invokes the portal_types tool
625941b80383005118ecf431
def get_all_balances_paged(self, limit=None, page=None): <NEW_LINE> <INDENT> data = {} <NEW_LINE> if limit: <NEW_LINE> <INDENT> data['limit'] = limit <NEW_LINE> <DEDENT> if page: <NEW_LINE> <INDENT> data['page'] = page <NEW_LINE> <DEDENT> return self._get('account/balances', True, data=data)
Get all coin balances with paging if that's what you want https://kucoinapidocs.docs.apiary.io/#reference/0/assets-operation/get-all-balance :param limit: optional - Number of balances default 12, max 20 :type limit: int :param page: optional - Page to fetch :type page: int .. code:: python # get the default re...
625941b84a966d76dd550e59
def run(self, force=False): <NEW_LINE> <INDENT> if self.solution['results'] is not None and not force: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> master_results = np.zeros_like(np.arange(self._starts[0], self._stops[0], self._skip), dtype=np.float32) <NEW_LINE> counter = np.zeros_like(master_results, dtype=np.float...
Run all the required passes Parameters: ----------- force : bool, optional Will overwrite previous results if they exist
625941b89b70327d1c4e0c20
def fix_on_leg(self, fix, leg): <NEW_LINE> <INDENT> larger_than_minimum = not self.fix_before_leg(fix, leg) <NEW_LINE> smaller_than_maximum = not self.fix_after_leg(fix, leg) <NEW_LINE> return larger_than_minimum and smaller_than_maximum
Return whether fix takes place within certain leg, excluding the boundaries :param fix: :param leg: :return:
625941b8cc40096d615957a0
def test_topology_normalization(topology_with_dupl_links, normalized_topology_example): <NEW_LINE> <INDENT> top_with_data = task_25_1c.Topology(topology_with_dupl_links) <NEW_LINE> assert len(top_with_data.topology) == len(normalized_topology_example)
Проверка удаления дублей в топологии
625941b8377c676e91271ff7
def wait(self, expect=0): <NEW_LINE> <INDENT> if expect > 0: <NEW_LINE> <INDENT> raise AssertionError('expect <= 0') <NEW_LINE> <DEDENT> if expect == 0 and len(self.buffer) > 0: <NEW_LINE> <INDENT> return self.pop() <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> s = self.ch_in.readline() <NEW_LINE> self.logger.inf...
Blocking function. Use with care! `expect` should either be 0 or a negative number. If `expect == 0`, any positive indexed object is returned. Otherwise, it will queue any positive objects until the first negative object is received. If the received negative object does not match `expect`, then a ValueError is raised.
625941b838b623060ff0ac3c
def __init__(self, name=None, value=None): <NEW_LINE> <INDENT> self._name = None <NEW_LINE> self._value = None <NEW_LINE> self.discriminator = None <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> if value is not None: <NEW_LINE> <INDENT> self.value = value
ScreenRecordingFilterPageViewReferrerParam - a model defined in Swagger
625941b8099cdd3c635f0aa9
def add_nzb(self, filename, content=None, category=None, priority=PRIORITY.NORMAL): <NEW_LINE> <INDENT> if not self.api_connect(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> add_to_top = False <NEW_LINE> add_paused = False <NEW_LINE> dup_key = '' <NEW_LINE> dup_score = 0 <NEW_LINE> dup_mode = NZBGetDuplicateMo...
Simply add's an NZB file to NZBGet (via the API)
625941b857b8e32f524832ed
def leafSimilar(self, root1, root2): <NEW_LINE> <INDENT> def dfs(node, lst): <NEW_LINE> <INDENT> if not node.left and not node.right: <NEW_LINE> <INDENT> lst.append(node.val) <NEW_LINE> return <NEW_LINE> <DEDENT> if node.left: <NEW_LINE> <INDENT> dfs(node.left, lst) <NEW_LINE> <DEDENT> if node.right: <NEW_LINE> <INDENT...
:type root1: TreeNode :type root2: TreeNode :rtype: bool
625941b8d99f1b3c44c673e4
def check_for_password_before_cmdlist_func_call(*args, **kwargs): <NEW_LINE> <INDENT> util.log_info("... cmdlist_func = %s %s" % (archive_cmdlist_func, '')) <NEW_LINE> util.log_info("... kwargs=%s args=%s" % (kwargs, args)) <NEW_LINE> if 'password' in kwargs and kwargs['password'] is None: <NEW_LINE> <INDENT> kwargs.po...
If password is None, or not set, run command as usual. If password is set, but can't be accepted raise appropriate message.
625941b8fbf16365ca6f6009
@pytest.fixture(scope="module") <NEW_LINE> def inertialbase_objects_rt(dcm, mem): <NEW_LINE> <INDENT> dico = {} <NEW_LINE> coord = ["X", "Y", "Z"] <NEW_LINE> for each in coord: <NEW_LINE> <INDENT> dico["Acc" + each] = InertialSensorBase( dcm, mem, "Accelerometer" + each) <NEW_LINE> dico["Angle" + each] = InertialSensor...
Return a dictionary with several objects for each sensor value of the inertial base
625941b810dbd63aa1bd29fc
def create_deck(self, user_id, deck_name): <NEW_LINE> <INDENT> url = f'http://127.0.0.1:5000//Server/create_deck/{user_id}' <NEW_LINE> data = {deck_name: ''} <NEW_LINE> response = requests.post(url, json=data) <NEW_LINE> print(response.json())
Создание колоды
625941b8d7e4931a7ee9dd68
@deprecated( "2016-11-30", "Please switch to tf.summary.image. Note that " "tf.summary.image uses the node name instead of the tag. " "This means that TensorFlow will automatically de-duplicate summary " "names based on the scope they are created in. Also, the max_images " "argument was renamed to max_outputs.") <NEW_L...
Outputs a `Summary` protocol buffer with images. For an explanation of why this op was deprecated, and information on how to migrate, look ['here'](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/deprecated/__init__.py) The summary has up to `max_images` summary values containing images. The i...
625941b8090684286d50eb2d
def show_conv_to_rve(self): <NEW_LINE> <INDENT> self.convert_to_rve_widget = ConvertSegForRVEWidget() <NEW_LINE> self.convert_to_rve_widget.show()
show window to convert segmentations to RhizoVision Explorer compatible format
625941b850485f2cf553cbe6
def pthread_self(): <NEW_LINE> <INDENT> f = gdb.newest_frame() <NEW_LINE> while f.name() != 'start_thread': <NEW_LINE> <INDENT> f = f.older() <NEW_LINE> if f is None: <NEW_LINE> <INDENT> return get_fs_base() <NEW_LINE> <DEDENT> <DEDENT> try: <NEW_LINE> <INDENT> return f.read_var("arg") <NEW_LINE> <DEDENT> except ValueE...
Fetch pthread_self() from the glibc start_thread function.
625941b8ab23a570cc24ffcd
def GetTitleString(self): <NEW_LINE> <INDENT> fname = self.GetFileName() <NEW_LINE> title = os.path.split(fname)[-1] <NEW_LINE> if not len(title): <NEW_LINE> <INDENT> title = fname = self.GetTabLabel() <NEW_LINE> <DEDENT> if self.GetModify() and not title.startswith(u'*'): <NEW_LINE> <INDENT> title = u"*" + title <NEW_...
Get the title string to display in the MainWindows title bar @return: (unicode) string
625941b8fff4ab517eb2f286
def commit_counts(self, session): <NEW_LINE> <INDENT> limit = 1 <NEW_LINE> if self.cpt >= limit: <NEW_LINE> <INDENT> session.commit() <NEW_LINE> self.cpt = 0
Commits data to db if enough data has to be updated FIXME: By not commiting every time, we might have duplicates if the same guy tweets several times with the same flag
625941b8498bea3a759b98fe
def get_version(request): <NEW_LINE> <INDENT> if 'jsonrpc' in request: <NEW_LINE> <INDENT> return 2.0 <NEW_LINE> <DEDENT> elif 'id' in request: <NEW_LINE> <INDENT> return 1.0 <NEW_LINE> <DEDENT> return None
Computes the JSON-RPC version :param request: A request dictionary :return: The JSON-RPC version or None
625941b85e10d32532c5ed7c
def __iter__(self): <NEW_LINE> <INDENT> return iter(self._item)
调用迭代环境时返回迭代器
625941b86fece00bbac2d588
def get_default_params(type='BSPLINE'): <NEW_LINE> <INDENT> p = Parameters() <NEW_LINE> type = type.upper() <NEW_LINE> p.Metric = 'AdvancedMattesMutualInformation' <NEW_LINE> p.NumberOfHistogramBins = 32 <NEW_LINE> p.ImageSampler = 'RandomCoordinate' <NEW_LINE> p.NumberOfSpatialSamples = 2048 <NEW_LINE> p.NewSamplesEve...
get_default_params(type='BSPLINE') Get `Parameters` struct with parameters that users may want to tweak. The given `type` specifies the type of allowed transform, and can be 'RIGID', 'AFFINE', 'BSPLINE'. For detail on what parameters are available and how they should be used, we refer to the Elastix documentation. He...
625941b885dfad0860c3aca6
def matches(self, jira_connection: 'JiraConnection', find: str) -> bool: <NEW_LINE> <INDENT> if self.jira_connection_name == jira_connection.connection_name: <NEW_LINE> <INDENT> if find in self.issue_key: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> for value in list(self.values()): <NEW_LINE> <INDENT> if find i...
Tests all values in the ticket to see if they match the input string. Requires input of the JiraConnection you want to compare against to protect against duplicate project names across different JIRA instances.
625941b8b545ff76a8913c6c
def die(msg, *args): <NEW_LINE> <INDENT> error(msg, *args) <NEW_LINE> sys.exit(1)
Print as error message to stderr and exit the program.
625941b831939e2706e4ccbd
def delete(self, item_id, comment_id): <NEW_LINE> <INDENT> auth, retval = __check_auth__(self.auth_dict) <NEW_LINE> if auth: <NEW_LINE> <INDENT> return retval <NEW_LINE> <DEDENT> query = ItemComment.query.filter(ItemComment.id == comment_id) <NEW_LINE> query = query.filter(ItemComment.user_id == current_user.id).delete...
.. http:delete:: /api/1/items/<int:item_id>/comment/<int:comment_id> Deletes an item comment. **Example Request**: .. sourcecode:: http DELETE /api/1/items/1234/comment/7718 HTTP/1.1 Host: example.com Accept: application/json { } **Example Response**: .. sourcecode:: http HTTP/1.1 202 OK...
625941b826068e7796caeb25
def _after_init(self, _): <NEW_LINE> <INDENT> username = password = None <NEW_LINE> if creds is not None: <NEW_LINE> <INDENT> username, password = creds.username, creds.password <NEW_LINE> <DEDENT> if username is None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> if username is not None: <NEW_LINE> <INDENT> callback = ...
Get password
625941b8dc8b845886cb5381
def borrow_book(self, book, patron): <NEW_LINE> <INDENT> patron.add_borrowed_book(book.lower()) <NEW_LINE> self.db.update_patron(patron)
Borrows a book for a Patron. :param book: the title of the book :param patron: the Patron object
625941b88c0ade5d55d3e80c
def OnInit(self): <NEW_LINE> <INDENT> self.SetAppName('CEBL') <NEW_LINE> main = CEBLMain() <NEW_LINE> return True
Create a new CEBLMain frame.
625941b8d164cc6175782b9b
def test_nets(self): <NEW_LINE> <INDENT> good_nets = self.good.nets[:] <NEW_LINE> self.assertEqual(len(good_nets), 5) <NEW_LINE> for net in self.actual.nets: <NEW_LINE> <INDENT> for goodnet in good_nets: <NEW_LINE> <INDENT> if set(net.points) == set(goodnet.points): <NEW_LINE> <INDENT> good_nets.remove(goodnet) <NEW_LI...
Test that all the right nets are present with the right points.
625941b81d351010ab85596b
def get_stdev(nums): <NEW_LINE> <INDENT> pass
Helper function for calculating the standard deviation of a list of numbers. :param nums: list of numbers :return: standard deviation of list
625941b8d268445f265b4cc2
def schedule_teleport(self, position, map_id=None, *map_args): <NEW_LINE> <INDENT> if map_id is not None: <NEW_LINE> <INDENT> self.world.schedule_teleport(position, map_id, *map_args) <NEW_LINE> self.controller.stop() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.teleport_object(self.party_avatar, position)
After the current iteration of the WorldMap's context stack, the party will be teleported to the WorldMap represented by *map_id* at *position*. This method may also be used to teleport to another place in the same map, by passing None. If the map id of the current map is passed, the party will be removed and added to...
625941b8796e427e537b040f
def identify(self, authority, **kwds): <NEW_LINE> <INDENT> return authority.onDescriptor(descriptor=self, **kwds)
Let {authority} know I am a descriptor
625941b80c0af96317bb8036
def show_softclip(self): <NEW_LINE> <INDENT> bsoftclip = self.gamma.bsoftclip <NEW_LINE> if isinstance(bsoftclip, dict): <NEW_LINE> <INDENT> paramstr = ', '.join('{!s}={!r}'.format(key, val) for (key, val) in bsoftclip.items()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> paramstr = bsoftclip <NEW_LINE> <DEDENT> retur...
Return softclip start value(s) to show in menu
625941b829b78933be1e5506
def get_auto_login_url(self, url, name, token, login_type): <NEW_LINE> <INDENT> login_type = constants.ClassRoomAutoLoginType(login_type) <NEW_LINE> if login_type in ( constants.ClassRoomAutoLoginType.record, constants.ClassRoomAutoLoginType.audience, ): <NEW_LINE> <INDENT> return '{}&autoLogin=true&viewername={}&viewe...
url 为 room_link 中拿到的各个url, 教师端: https://class.csslcloud.net/index/presenter/?roomid=FC3548C1133061D09C33DC5901307461&userid=E9607DAFB705A798&username=XXX&password=XXX&autoLogin=true 互动者: https://class.csslcloud.net/index/talker/?roomid=FC3548C1133061D09C33DC5901307461&userid=E9607DAFB705A798&username=XXX&passwo...
625941b894891a1f4081b8f5
def getPercCpuLoad(self): <NEW_LINE> <INDENT> return int(self.getCpuLoad() * 100.0)
Metoda vrací vytížení procesoru v procentech 0 až 100 \param self Ukazatel na objekt eturn Procento mezi 0 až 100
625941b8de87d2750b85fbdb
def _test_expected_for_job(self, expected_results, job): <NEW_LINE> <INDENT> results = {} <NEW_LINE> with job.make_runner() as runner: <NEW_LINE> <INDENT> runner.run() <NEW_LINE> for line in runner.stream_output(): <NEW_LINE> <INDENT> key, value = job.parse_output_line(line) <NEW_LINE> results[key] = value <NEW_LINE> <...
Simple utility function to test results are as expected
625941b8cb5e8a47e48b78fd
def process_mptcp_pkt_from_server(ts_delta, acks, conn_acks, mptcp_connections, tcp, ip, saddr, daddr, sport, dport): <NEW_LINE> <INDENT> dss, dack, dss_is_8_bytes = get_dss_and_data_ack(tcp) <NEW_LINE> conn_id = acks[daddr, dport, saddr, sport][co.CONN_ID] <NEW_LINE> flow_id = acks[daddr, dport, saddr, sport][co.FLOW_...
Process a packet with ACK set from the server for the MPTCP DSS retransmissions
625941b823e79379d52ee3b5
def SetFullyConnected(self, *args): <NEW_LINE> <INDENT> return _itkOpeningByReconstructionImageFilterPython.itkOpeningByReconstructionImageFilterID3ID3SE3_SetFullyConnected(self, *args)
SetFullyConnected(self, bool _arg)
625941b863f4b57ef0000f70
def query_block_height(height, bestblock=False): <NEW_LINE> <INDENT> if height < 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not bestblock: <NEW_LINE> <INDENT> kwargs = {'method': 'getblockhash', 'params': [height]} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> kwargs = {'method': 'getbestblockhash'} <NEW_LINE...
Return a block by its height. :param bool bestblock: if True, will ignore the heigh param and return the most recent block.
625941b830bbd722463cbc10
def delDoor(self, ctrllerMac, doorId): <NEW_LINE> <INDENT> doorId = str(doorId).encode('utf8') <NEW_LINE> msg = CUD + b'P' + b'D' + b'{"id": ' + doorId + b'}' + END <NEW_LINE> try: <NEW_LINE> <INDENT> self.netMngr.sendToCtrller(msg, ctrllerMac) <NEW_LINE> <DEDENT> except CtrllerDisconnected: <NEW_LINE> <INDENT> self.lo...
Receives the controller MAC and the door ID. With them it creates the message to send it to controller (to delete). It gives the created message to the network manager thread.
625941b8796e427e537b0410
def url__cinema_regulate__open_ticket(self, apply_data: dict, remark_info: dict = None) -> bool: <NEW_LINE> <INDENT> uid = self.session.uid <NEW_LINE> flow_id = chv.OPEN_FLOW <NEW_LINE> apply_name = "开业申请" <NEW_LINE> remark_info = self.ckt.deal_remark_info(remark_info) <NEW_LINE> user, cinema_code = self.ckt.get_cinema...
开业申请
625941b8a8ecb033257d2f23
def get_estimation_schema(): <NEW_LINE> <INDENT> schema = TASKSCHEMA.clone() <NEW_LINE> schema['lines']['lines'].doctype = "estimation" <NEW_LINE> tmpl = 'autonomie:deform_templates/paymentdetails_item.pt' <NEW_LINE> schema.add_before( 'communication', TaskNotes(title=u"Notes", name="notes"), ) <NEW_LINE> schema.add_be...
Return the schema for estimation add/edit
625941b8097d151d1a222ca9
def purge_csv(self, name='log.csv'): <NEW_LINE> <INDENT> f = open(name,'w') <NEW_LINE> f.close()
Purge the data from the staging csv file Parameters ---------- name : `string` The name of the csv file that you want to log
625941b8b7558d58953c4d69
def __init__(self, hass, device_id, friendly_name, unit_of_measurement, state_template): <NEW_LINE> <INDENT> self.hass = hass <NEW_LINE> self.entity_id = generate_entity_id(ENTITY_ID_FORMAT, device_id, hass=hass) <NEW_LINE> self._name = friendly_name <NEW_LINE> self._unit_of_measurement = unit_of_measurement <NEW_LINE>...
Initialize the sensor.
625941b8f548e778e58cd3c9
def __utf_to_caps_func(self, line): <NEW_LINE> <INDENT> utf_text = line[17:-1] <NEW_LINE> if self.__caps_list[-1] == 'true' and self.__convert_caps: <NEW_LINE> <INDENT> utf_text = self.__utf_token_to_caps_func(utf_text) <NEW_LINE> <DEDENT> self.__write_obj.write('tx<ut<__________<%s\n' % utf_text)
Required: line -- line to parse returns nothing Logic Get the text, and use another method to convert
625941b83c8af77a43ae35ec
def test_successful_modify_percent_snapshot_space(self): <NEW_LINE> <INDENT> data = self.mock_args() <NEW_LINE> data['percent_snapshot_space'] = '90' <NEW_LINE> set_module_args(data) <NEW_LINE> with pytest.raises(AnsibleExitJson) as exc: <NEW_LINE> <INDENT> self.get_volume_mock_object('volume').apply() <NEW_LINE> <DEDE...
Test successful modify percent_snapshot_space
625941b8d6c5a10208143e95
def get_sec_group(name=None, region=None, secgroup_id=None, tenant_id=None): <NEW_LINE> <INDENT> __args__ = dict() <NEW_LINE> __args__['name'] = name <NEW_LINE> __args__['region'] = region <NEW_LINE> __args__['secgroupId'] = secgroup_id <NEW_LINE> __args__['tenantId'] = tenant_id <NEW_LINE> __ret__ = pulumi.runtime.inv...
Use this data source to get the ID of an available OpenStack security group.
625941b821bff66bcd6847a3