code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def stats(self): <NEW_LINE> <INDENT> s = dict.fromkeys(update_stats_keys, 0) <NEW_LINE> s.update(self._source.stats()) <NEW_LINE> s["contains_updates"] = bool(sum(s.get(k, 0) for k in update_stats_keys)) <NEW_LINE> return s
Return the query statistics.
625941c1d6c5a10208143fce
def start_module(): <NEW_LINE> <INDENT> table = data_manager.get_table_from_file('accounting/items.csv') <NEW_LINE> is_not_main_menu = True <NEW_LINE> while is_not_main_menu: <NEW_LINE> <INDENT> data_manager.write_table_to_file('accounting/items.csv', table) <NEW_LINE> accounting_manager_menu = [ "(1) Show table", "(2)...
Starts this module and displays its menu. User can access default special features from here. User can go back to main menu from here. Returns: None
625941c1009cb60464c63338
def set_oxidationstates(self, values): <NEW_LINE> <INDENT> self.oxidationstates = values
Function to set the oxidation states values. Parameters ---------- values : array-like 2-D numpy array containing oxidation states values for all the elements. Returns -------
625941c1eab8aa0e5d26dadd
@celery_app.task(max_retries=3) <NEW_LINE> def create_habit_instances(habit_pk): <NEW_LINE> <INDENT> habit = Habit.objects.get(pk=habit_pk) <NEW_LINE> start_date = habit.start_date <NEW_LINE> end_date = start_date + timedelta(days=6) <NEW_LINE> if habit.end_date and end_date > habit.end_date: <NEW_LINE> <INDENT> end_da...
Each time a habit is created this task is called to create instances.
625941c1f7d966606f6a9f87
def tlgu_cleanup(self, rm_punctuation=True, rm_periods=False): <NEW_LINE> <INDENT> from cltk.corpus.utils.formatter import tlg_plaintext_cleanup <NEW_LINE> return self.__class__( text=tlg_plaintext_cleanup( self.data, rm_punctuation=rm_punctuation, rm_periods=rm_periods ), options=self.options )
Fix TLG betacode texts using TLGU. Necessary to cleanup TLG texts before processing, but can also used to perform rudimentary cleaning operations on other Greek texts. Args: rm_punctuation (:obj:`bool`, optional) True to remove punctuation marks (exception periods) rm_periods (:obj:`bool`, optional) True to r...
625941c1099cdd3c635f0be1
def __factory_reset(self): <NEW_LINE> <INDENT> driver = self.driver <NEW_LINE> driver.find_element_by_link_text('Tools').click() <NEW_LINE> time.sleep(1) <NEW_LINE> for element in driver.find_elements_by_css_selector("input[type=\"submit\"]"): <NEW_LINE> <INDENT> if element.get_attribute('value') == 'Factory Reset': <N...
恢复出厂设置
625941c18da39b475bd64ef6
def strobe_state(comet, state): <NEW_LINE> <INDENT> comet.strobing = state
bool
625941c1004d5f362079a2ba
def test_nd_eq(): <NEW_LINE> <INDENT> arr1 = Array((3,2,1), 1, 2, 3, 4, 5, 6) <NEW_LINE> arr2 = Array((3,2,1), 1, 2, 3, 4, 5, 6) <NEW_LINE> assert (arr1 == arr2) == True <NEW_LINE> arr2 = Array((3,2,1), 1, 2, 3, 4, 5, 7) <NEW_LINE> assert (arr1 == arr2) == False <NEW_LINE> arr2 = Array((2,1), 2, 3) <NEW_LINE> assert (a...
Verifying that comparing two arrays (by ==) returns what it is supposed to - which should be a boolean.
625941c1dd821e528d63b130
def draw_pic_3d(option, x, y, x_test, y_pred): <NEW_LINE> <INDENT> plot_feature_1 = int(option["feature_1"]) <NEW_LINE> plot_feature_2 = int(option["feature_2"]) <NEW_LINE> x_test_1 = x_test[x_test.columns[plot_feature_1]] <NEW_LINE> x_test_2 = x_test[x_test.columns[plot_feature_2]] <NEW_LINE> x_1 = x[x.columns[plot_fe...
plot 3d graph :param option: :param x: :param y: :param x_test: :param y_pred: :return:
625941c123e79379d52ee4eb
def test_config_sections(self): <NEW_LINE> <INDENT> import configparser <NEW_LINE> configuration = configparser.ConfigParser() <NEW_LINE> configuration.read(config.get_default_config()) <NEW_LINE> expected_sections = ["hyperplan"] <NEW_LINE> self.assertEqual(set(expected_sections), set(configuration.sections()))
Assert that the correct sections exist in the config file
625941c11f037a2d8b946184
def _initialize_time(self): <NEW_LINE> <INDENT> self.taveints = np.ceil(self.taveint/self.dt)
Set up timestep stuff
625941c1fbf16365ca6f6145
def testCase005(self): <NEW_LINE> <INDENT> arg = 'd:\\:d:\\' <NEW_LINE> if RTE is RTE_WIN32: <NEW_LINE> <INDENT> resX = 'd:\\:d:' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resX = 'd:\\:d:\\' <NEW_LINE> <DEDENT> res = normpathx(arg, tpf='local') <NEW_LINE> self.assertEqual(res, resX)
.. code-block:: python :linenos: path = 'd:\:d\'
625941c1cc0a2c11143dce15
def average(numbers): <NEW_LINE> <INDENT> sum_numbers = 0 <NEW_LINE> for num in numbers: <NEW_LINE> <INDENT> sum_numbers = sum_numbers + num <NEW_LINE> avg = float(sum_numbers/len(numbers)) <NEW_LINE> <DEDENT> return avg
Return the average (mean) of the list of numbers given. For example:: >>> average([2, 4]) 3.0 This should handle cases where the result isn't an integer:: >>> average([2, 12, 3]) 5.666666666666667 There is no defined answer if the list given is empty; it's fine if this raises an error when given an...
625941c126068e7796caec61
def plot(): <NEW_LINE> <INDENT> temp = float_data[:, 1] <NEW_LINE> plt.plot(range(len(temp)), temp) <NEW_LINE> plt.figure() <NEW_LINE> plt.plot(range(1440), temp[:1440]) <NEW_LINE> plt.show() <NEW_LINE> return
temperature ove the full temporal range of the dataset
625941c107f4c71912b11406
def __init__(self): <NEW_LINE> <INDENT> self.StrategyName = None <NEW_LINE> self.ScanCycle = None <NEW_LINE> self.ScanAt = None <NEW_LINE> self.CategoryIds = None <NEW_LINE> self.IsGlobal = None <NEW_LINE> self.MachineType = None <NEW_LINE> self.RegionCode = None <NEW_LINE> self.Quuids = None
:param StrategyName: 策略名称 :type StrategyName: str :param ScanCycle: 检测周期, 表示每隔多少天进行检测.示例: 2, 表示每2天进行检测一次. :type ScanCycle: int :param ScanAt: 定期检测时间,该时间下发扫描. 示例:“22:00”, 表示在22:00下发检测 :type ScanAt: str :param CategoryIds: 该策略下选择的基线id数组. 示例: [1,3,5,7] :type CategoryIds: list of int non-negative :param IsGlobal: 扫描范围是否全部服...
625941c18c3a87329515833d
def isEq(a, b): <NEW_LINE> <INDENT> return schemeBool(a is b)
(eq? a b)
625941c1236d856c2ad4475d
def addCondition(self, *fns, **kwargs): <NEW_LINE> <INDENT> for fn in fns: <NEW_LINE> <INDENT> self.parseAction.append( conditionAsParseAction( fn, message=kwargs.get("message"), fatal=kwargs.get("fatal", False) ) ) <NEW_LINE> <DEDENT> self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False) <NEW_L...
Add a boolean predicate function to expression's list of parse actions. See :class:`setParseAction` for function call signatures. Unlike ``setParseAction``, functions passed to ``addCondition`` need to return boolean success/fail of the condition. Optional keyword arguments: - message = define a custom message to be u...
625941c1b7558d58953c4e9e
def testFunctionRoomClosedItem(self): <NEW_LINE> <INDENT> pass
Test FunctionRoomClosedItem
625941c1167d2b6e31218b1b
def rm_multiples(ls, x): <NEW_LINE> <INDENT> for i in range(2, len(ls)): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ls[i * x] = 0 <NEW_LINE> <DEDENT> except (ValueError, IndexError): <NEW_LINE> <INDENT> break
removes multiple of primes
625941c1e76e3b2f99f3a795
def save(self): <NEW_LINE> <INDENT> self.model.save()
Save ``self.model`` based on ``self.model.file_path``.
625941c1090684286d50ec69
def fit(self, X, y): <NEW_LINE> <INDENT> if self.auto_optimize_k: <NEW_LINE> <INDENT> self._optimize_n_neighbors(X, y) <NEW_LINE> <DEDENT> self.y = y <NEW_LINE> self.knn.fit(X) <NEW_LINE> return self
Fit the model using X as training data and y as target values. If auto_optimize_k is True, searches n_neighbor_candidates for best k on validation set of size 0.1 * X.shape[0]. Parameters ---------- X: {array-like, sparse matrix} Training data, shape [n_samples, n_features]. y: {array-like, sparse matrix} Targ...
625941c1bf627c535bc13154
def dispatch(parser, argv=None, add_help_command=True, completion=True, pre_call=None, output_file=sys.stdout, errors_file=sys.stderr, raw_output=False, namespace=None, skip_unknown_args=False): <NEW_LINE> <INDENT> if completion: <NEW_LINE> <INDENT> autocomplete(parser) <NEW_LINE> <DEDENT> if argv is None: <NEW_LINE> <...
Parses given list of arguments using given parser, calls the relevant function and prints the result. The target function should expect one positional argument: the :class:`argparse.Namespace` object. However, if the function is decorated with :func:`~argh.decorators.plain_signature`, the positional and named argument...
625941c14f88993c3716bfef
def r1k_experiment(fn, ident=None): <NEW_LINE> <INDENT> cx = R1kExp(board=fn[-3:]) <NEW_LINE> cx.ident = ident <NEW_LINE> m = ExpMem(0, 0xff, attr=2) <NEW_LINE> cx.m.map(m, 0) <NEW_LINE> adr = 0x10 <NEW_LINE> params = [] <NEW_LINE> b = open(fn, "rb").read().rstrip(b'\x00') <NEW_LINE> for i in b.split(b'\x0a'): <NEW_LIN...
Disassemble an experiment file
625941c18da39b475bd64ef7
def eulerianCycle(graph): <NEW_LINE> <INDENT> stack = [] <NEW_LINE> circuit = [] <NEW_LINE> in_edges = [] <NEW_LINE> out_edges = [] <NEW_LINE> values = graph.values() <NEW_LINE> count = sum(len(value) for value in values) <NEW_LINE> listed_keys = list(graph.keys()) <NEW_LINE> for x in graph.keys(): <NEW_LINE> <INDENT> ...
Finds the cycle through a graph where each in and out edge or 'bridge' is used only once. :param graph: Directed adjacency list of Eulerian graph as dictionary. :return: List in order representing Eulerian path
625941c1a219f33f346288f2
def get_post_data(request): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> return request.POST <NEW_LINE> <DEDENT> return None
get request.POST, if POST is empty return None
625941c10a50d4780f666e16
def read_execl(self): <NEW_LINE> <INDENT> data = xl.open_workbook(self.path) <NEW_LINE> names = data.sheet_names() <NEW_LINE> label = [] <NEW_LINE> content = [] <NEW_LINE> title = [] <NEW_LINE> label_count = [0] <NEW_LINE> count = 0 <NEW_LINE> for name in names[1:]: <NEW_LINE> <INDENT> table = data.sheet_by_name(name) ...
#从excel文件读入文本 :return:label,content
625941c16aa9bd52df036d28
def jacobi(A, b, initial_guess, true_solution, tol): <NEW_LINE> <INDENT> print("Initializing Jacobi Solver", end='\r') <NEW_LINE> n, m = A.shape <NEW_LINE> b = b.flatten() <NEW_LINE> u = initial_guess.flatten() <NEW_LINE> u_true = true_solution.flatten() <NEW_LINE> u_new = u.copy() <NEW_LINE> res = np.linalg.norm(u - t...
Solves the algebraic system A*x=b using a jacobi iterative solver. Parameters ---------- A : array Matrix A corresponding to the system A*x = b. b : array Column vector b corresponding to the system A*x = b. initial_guess : array, optional Initial solution. true_solution : array, optional Used for resi...
625941c17c178a314d6ef3e1
def getHost(self): <NEW_LINE> <INDENT> return self.__HOST
Return server host name. :return: host name :rtype: str
625941c1a8370b7717052826
def install_profile(profile): <NEW_LINE> <INDENT> if not profile.get('PayloadType') == 'Configuration': <NEW_LINE> <INDENT> display.display_error('Unsupported profile PayloadType: %s' % profile.get('PayloadType')) <NEW_LINE> return False <NEW_LINE> <DEDENT> mcx_data = profile_to_mcx(profile) <NEW_LINE> if not mcx_data:...
Extracts managed preferences from a configuration profile and installs them as local MCX. Returns a boolean indicating success (or not)
625941c1b57a9660fec33808
def convertToBinaryTree(postfix): <NEW_LINE> <INDENT> tokens = list(postfix) <NEW_LINE> print("tokens: ", tokens, "\n") <NEW_LINE> operators = "+-*/" <NEW_LINE> stack = Stack() <NEW_LINE> return recursiveHelper(tokens, stack)
The goal is to go from postfix to binary tree
625941c18c3a87329515833e
def print_access_token(self): <NEW_LINE> <INDENT> request_token = self._get_request_token() <NEW_LINE> access_token = self._get_access_token(request_token) <NEW_LINE> print(access_token)
Zaimのアクセストークンを取得・表示する OAuth1.0aの認証方法については、以下の記事を参考に実装 https://qiita.com/kosystem/items/7728e57c70fa2fbfe47c
625941c182261d6c526ab422
def score(self, features): <NEW_LINE> <INDENT> super(DensePerceptron, self).score(features) <NEW_LINE> return self.model.T.dot(features).reshape((-1,))
Calculate score for each label :param features: extracted feature values, of size num_features :return: array with score for each label
625941c1d10714528d5ffc67
def save_form(self, params): <NEW_LINE> <INDENT> raise Exception("Not implemented by {} widget".format(self.widget_name))
Save the results of the form
625941c166656f66f7cbc130
def __init__(self, plugin_name): <NEW_LINE> <INDENT> self.plugin_name = plugin_name <NEW_LINE> if plugin_name == "RouteFollowing": <NEW_LINE> <INDENT> self.node_name = "/guidance/route_following_plugin" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rospy.logerr("ERROR: Unknown node for Strategic Plugin: " + str(self.pl...
Constructor for StrategicPluginResults
625941c123849d37ff7b3016
def generator_loss_fn(y_generated, data_label=0): <NEW_LINE> <INDENT> loss = F.binary_cross_entropy_with_logits(y_generated, torch.full(y_generated.size(), data_label).to(y_generated.device)) <NEW_LINE> return loss
Computes the loss of the generator given generated data using a binary cross-entropy metric. This is the loss used to update the Generator parameters. :param y_generated: Discriminator class-scores of instances of data generated by the generator, shape (N,). :param data_label: 0 or 1, label of instances coming from the...
625941c14527f215b584c3df
def log(self, message, category="misc", data=None): <NEW_LINE> <INDENT> self._dirty = True <NEW_LINE> entry = {"message": message, "timestamp": time.time(), "category": category} <NEW_LINE> if data is not None: <NEW_LINE> <INDENT> entry["data"] = data <NEW_LINE> <DEDENT> json.appendline(entry, self.filename) <NEW_LINE>...
Logs a message, the timestamp, its category, and the and any data to the log file.
625941c15510c4643540f36f
def maxDepth(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> level = 0 <NEW_LINE> curNode = 1 <NEW_LINE> nextNode = 0 <NEW_LINE> queue = [] <NEW_LINE> queue.append(root) <NEW_LINE> while queue: <NEW_LINE> <INDENT> root = queue.pop(0) <NEW_LINE> curNode -= 1 <NEW_LINE> if r...
:type root: TreeNode :rtype: int
625941c1f9cc0f698b140583
def get_messages(path, model): <NEW_LINE> <INDENT> cmd = f'{gs.WGRIB2} {path} -s -n' <NEW_LINE> res = open_subprocess_pipe(cmd) <NEW_LINE> res = (res.split('\n'))[:-1] <NEW_LINE> names = [] <NEW_LINE> messages = [] <NEW_LINE> for key, meta in vs.metvars.items(): <NEW_LINE> <INDENT> for i in res: <NEW_LINE> <INDENT> if ...
Find the message numbers for the grib files that we want. (ens mean, variable percentiles) Args: path (int): File path for the grib we want messages for model (str): Name of the meteorological model grib Returns: tuple: Correlated lists of names and grib message numbers
625941c130dc7b76659018ee
def test_p_d(): <NEW_LINE> <INDENT> assert Helpers.p_d_elo(0) == 0.5 <NEW_LINE> for _ in range(10): <NEW_LINE> <INDENT> D = random.randint(-10, 10) <NEW_LINE> p_d = 1.0 / (1.0 + 10.0 ** (-D / 400.0)) <NEW_LINE> assert p_d == Helpers.p_d_elo(D)
GIVEN prediction helper CHECK if p(d) is correct with the D
625941c124f1403a92600aee
def load(self): <NEW_LINE> <INDENT> if not super(IFCSTRUCTURALLOADSINGLEDISPLACEMENT,self).load(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
register inverses
625941c17b180e01f3dc4788
def stage_find(self, cr, uid, cases, team_id, domain=None, order='sequence', context=None): <NEW_LINE> <INDENT> if isinstance(cases, (int, long)): <NEW_LINE> <INDENT> cases = self.browse(cr, uid, cases, context=context) <NEW_LINE> <DEDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> team_id...
Override of the base.stage method Parameter of the stage search taken from the lead: - type: stage type must be the same or 'both' - team_id: if set, stages must belong to this team or be a default stage; if not set, stages must be default stages
625941c1c432627299f04bca
def get_web_dir(cls, file_object=None, alias=None): <NEW_LINE> <INDENT> if file_object: <NEW_LINE> <INDENT> alias = file_object.get_value('base_dir_alias') <NEW_LINE> <DEDENT> if not alias: <NEW_LINE> <INDENT> alias = "default" <NEW_LINE> <DEDENT> from pyasm.security import Site <NEW_LINE> site = Site.get() <NEW_LINE> ...
get base web directory
625941c18a43f66fc4b53fed
def tva_ttc_parts(self): <NEW_LINE> <INDENT> ret_dict = {} <NEW_LINE> ht_parts = self.tva_ht_parts() <NEW_LINE> tva_parts = self.get_tvas() <NEW_LINE> for tva_value, amount in ht_parts.iteritems(): <NEW_LINE> <INDENT> ret_dict[tva_value] = amount + tva_parts.get(tva_value, 0) <NEW_LINE> <DEDENT> return ret_dict
Return a dict with TTC amounts stored by corresponding tva
625941c15e10d32532c5eead
def __gt__(self, other): <NEW_LINE> <INDENT> if self.deg() > other.deg(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if self.deg() < other.deg(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> poly1 = self.poly.copy() <NEW_LINE> poly2 = self.poly.copy() <NEW_LINE> poly1.reverse() <NEW_LINE> poly2.reverse...
Return self > other
625941c13346ee7daa2b2cf1
def __init__( self, input_tensor, padding, stride, filter_size, name, initializer): <NEW_LINE> <INDENT> if padding == 'SAME': <NEW_LINE> <INDENT> self.padding_input = self.get_padding_input( input_tensor=input_tensor, filter_size=filter_size) <NEW_LINE> <DEDENT> elif padding == "VALID": <NEW_LINE> <INDENT> self.padding...
padding can be 'SAME' or 'VALID'
625941c130bbd722463cbd4a
def denotation_set(self, name, cond=None): <NEW_LINE> <INDENT> return set(self.denotation(name, cond))
Get the denotation set of a query.
625941c155399d3f05588639
def upload_object(self, local_file_path: str, object_id: str) -> None: <NEW_LINE> <INDENT> if not os.path.isfile(local_file_path): <NEW_LINE> <INDENT> raise McProgrammingError(f"Local file '{local_file_path}' does not exist.") <NEW_LINE> <DEDENT> if not object_id: <NEW_LINE> <INDENT> raise McProgrammingError("Object ID...
Upload a local file to a GCS object. Will overwrite existing objects with a warning. :param local_file_path: Local file that should be stored. :param object_id: Object ID under which the object should be stored.
625941c19b70327d1c4e0d5a
def copy_all(self, ctxt): <NEW_LINE> <INDENT> for key, value in ctxt.iteritems: <NEW_LINE> <INDENT> self.set_attribute(key, value)
copies all values into the current context from given context :param ctxt:
625941c1462c4b4f79d1d656
def SetupNetworkVar(cls, name, networkvarname): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> p = getattr(cls, name) <NEW_LINE> if type(p) == property: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> getter = lambda self: getattr(self, networkva...
Creates a property with the given name Calls the setter of the network class which actually contains the data.
625941c166673b3332b92017
def scalar_mul(v, alpha): <NEW_LINE> <INDENT> u=v.copy() <NEW_LINE> for d in u.f.keys(): <NEW_LINE> <INDENT> u.f[d]=alpha*u.f[d] <NEW_LINE> <DEDENT> return u
Returns the scalar-vector product alpha times v
625941c150485f2cf553cd1f
def _set_enabled(self, v, load=False): <NEW_LINE> <INDENT> if hasattr(v, "_utype"): <NEW_LINE> <INDENT> v = v._utype(v) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> t = YANGDynClass( v, base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="enabled", parent=self, path_helper=self._path_helper, extmethods=se...
Setter method for enabled, mapped from YANG variable /interfaces/interface/subinterfaces/subinterface/ipv4/unnumbered/state/enabled (boolean) If this variable is read-only (config: false) in the source YANG file, then _set_enabled is considered as a private method. Backends looking to populate this vari...
625941c17b25080760e393e0
def _track_remote_changes(self, remote_info, remote_variable, old_value, new_value, fromdb, local_info): <NEW_LINE> <INDENT> local_column = self._get_local_column(local_info.cls_info.cls, remote_variable.column) <NEW_LINE> if local_column is not None: <NEW_LINE> <INDENT> local_info.variables[local_column].set(new_value...
Deliver changes in remote to local. This hook ensures that the local object will keep track of changes done in the remote object, either manually or at flushing time.
625941c17cff6e4e8111790c
def deleteAtIndex(self, index: int) -> None: <NEW_LINE> <INDENT> if index < 0 or index >= self.n: return <NEW_LINE> pre = self.dummy <NEW_LINE> while index: <NEW_LINE> <INDENT> pre = pre.next <NEW_LINE> index -= 1 <NEW_LINE> <DEDENT> if pre.next == self.tail: <NEW_LINE> <INDENT> self.tail = pre <NEW_LINE> <DEDENT> pre....
Delete the index-th node in the linked list, if the index is valid.
625941c1d6c5a10208143fcf
def _handle_aes(self, data): <NEW_LINE> <INDENT> if 'cmd' not in data: <NEW_LINE> <INDENT> log.error('Received malformed command %s', data) <NEW_LINE> return {} <NEW_LINE> <DEDENT> cmd = data['cmd'] <NEW_LINE> log.trace('AES payload received with command %s', data['cmd']) <NEW_LINE> if cmd.startswith('__'): <NEW_LINE> ...
Process a command sent via an AES key :param str load: Encrypted payload :return: The result of passing the load to a function in AESFuncs corresponding to the command specified in the load's 'cmd' key.
625941c129b78933be1e5636
def ensure_site_absent(nb, nb_endpoint, data): <NEW_LINE> <INDENT> nb_site = nb_endpoint.get(slug=data["slug"]) <NEW_LINE> result = dict() <NEW_LINE> if nb_site: <NEW_LINE> <INDENT> dummy, diff = delete_netbox_object(nb_site, module.check_mode) <NEW_LINE> changed = True <NEW_LINE> msg = "Site %s deleted" % (data["name"...
:returns dict(msg, changed)
625941c11f5feb6acb0c4ada
def move_by(self, step_x, step_y): <NEW_LINE> <INDENT> if not isinstance(step_x, int): <NEW_LINE> <INDENT> raise TypeError("step_x must be int, not {}" .format(type(step_x).__name__)) <NEW_LINE> <DEDENT> if not isinstance(step_y, int): <NEW_LINE> <INDENT> raise TypeError("step_y must be int, not {}" .format(type(step_y...
Change sprite position by _step_x_ and _step_y_.
625941c150812a4eaa59c2aa
def __pos__(self): <NEW_LINE> <INDENT> return 0j
x unchanged. :rtype: complex
625941c10a366e3fb873e79f
def at_use(self, caller, targets=[], quiet=False): <NEW_LINE> <INDENT> pass
Triggered by the 'use' command used on this object.
625941c1d4950a0f3b08c2d7
def backprop(self, train_X, train_Y, Z, A, l, D=None): <NEW_LINE> <INDENT> dZ = [np.zeros((len(w[0]), self.m)) for w in self.W] <NEW_LINE> dW = [np.zeros((num_out, num_in)) for num_in, num_out in self.layers] <NEW_LINE> db = [np.zeros((num_out, 1)) for _, num_out in self.layers] <NEW_LINE> def dA_sigmoid(A_l): <NEW_LIN...
Auxillary method for back propagation. Args: train_X: training features. IMPORTANT: X must be formatted as a column vector such that each column is one example and one row is one feature. train_Y: training labels. IMPORTANT: Y must be formatted as a column vector such that each column is one e...
625941c12eb69b55b151c833
def rmsAndDisplay(self, data, displayObject): <NEW_LINE> <INDENT> rms = self.RMS(data) <NEW_LINE> displayObject.setValue('Voltage=%s' % (apply_si_prefix(rms, 'V'))) <NEW_LINE> return rms
data : an array of numbers displayObject : an object containing a setValue method Fits against a sine function, and writes to the object
625941c107d97122c417880d
def pure_kingman(taxon_set, pop_size=1, rng=None): <NEW_LINE> <INDENT> if rng is None: <NEW_LINE> <INDENT> rng = GLOBAL_RNG <NEW_LINE> <DEDENT> nodes = [dataobject.Node(taxon=t) for t in taxon_set] <NEW_LINE> seed_node = coalescent.coalesce(nodes=nodes, pop_size=pop_size, period=None, rng=rng, use_expected_tmrca=True)[...
Generates a tree under the unconstrained Kingman's coalescent process.
625941c192d797404e304110
def login(self): <NEW_LINE> <INDENT> njInfo = {"status": False, "content": "", "errLog": ""} <NEW_LINE> sshChannel = sshv2(self.ip, self.username, self.password, self.timeout, self.port) <NEW_LINE> if sshChannel['status']: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> njInfo['status'] = True <NEW_LINE> self.channel = ss...
Because the device of this model is different from the other huawei devices in commit parameters, it is rewritten.
625941c16fb2d068a760f022
def create_movie_tiles_content(movies): <NEW_LINE> <INDENT> content = '' <NEW_LINE> for movie in movies: <NEW_LINE> <INDENT> youtube_id_match = re.search( r'(?<=v=)[^&#]+', movie.trailer_youtube_url) <NEW_LINE> youtube_id_match = youtube_id_match or re.search( r'(?<=be/)[^&#]+', movie.trailer_youtube_url) <NEW_LINE> tr...
Return HTML string of movie tiles. Keyword arguments: movies -- list of Movie instances
625941c17d847024c06be240
def transform(vol, loc_shift, interp_method='linear', indexing='ij',phase_encoding='RL'): <NEW_LINE> <INDENT> if isinstance(loc_shift.shape, (tf.compat.v1.Dimension, tf.TensorShape)): <NEW_LINE> <INDENT> volshape = loc_shift.shape[:-1].as_list() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> volshape = loc_shift.shape[:...
transform (interpolation N-D volumes (features) given shifts at each location in tensorflow Essentially interpolates volume vol at locations determined by loc_shift. This is a spatial transform in the sense that at location [x] we now have the data from, [x + shift] so we've moved data. Parameters: vol: volume wi...
625941c121a7993f00bc7c73
def pull(self): <NEW_LINE> <INDENT> pass
No pulling functionality is incorporated
625941c15fdd1c0f98dc01b9
def update(self, instance, validated_data): <NEW_LINE> <INDENT> instance.email = validated_data.get('email') <NEW_LINE> instance.save() <NEW_LINE> verify_url = instance.generate_email_verify_url() <NEW_LINE> send_verify_email.delay(instance.email, verify_url=verify_url) <NEW_LINE> return instance
重写此方法 目的不是为了修改而是借此时机发激活邮箱
625941c13eb6a72ae02ec45e
def local_main(): <NEW_LINE> <INDENT> run_selenium = args.run_selenium <NEW_LINE> use_stanford_corenlp = args.use_corenlp <NEW_LINE> pathsaver = PathSaver() <NEW_LINE> if not use_stanford_corenlp: <NEW_LINE> <INDENT> nlp = nltk <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> from utils import get_stanford_parser <NEW_LIN...
Main Function! make output file at /output/
625941c18a349b6b435e80fa
def write(self, level, *lines): <NEW_LINE> <INDENT> if self.disabled or level in self.exclude or ( self.levels != ALL and level not in self.levels ): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> prefix = self.prefix <NEW_LINE> if self.with_time or (self.filename and self.with_time is None): <NEW_LINE> <INDENT> prefix...
Filter by level before writing lines to the log file
625941c1a05bb46b383ec7aa
def set_invested(self,strategy_name,symbol,status): <NEW_LINE> <INDENT> self.strategies[strategy_name].invested[symbol]=status
:param strategy_name: :param symbol: :param status: :return:
625941c1d18da76e2353245a
def minByKey(keys, vals, dim=-1): <NEW_LINE> <INDENT> return _rbk_dim(keys, vals, dim, backend.get().af_min_by_key)
Calculate the min of elements along a specified dimension according to a key. Parameters ---------- keys : af.Array One dimensional arrayfire array with reduction keys. vals : af.Array Multi dimensional arrayfire array that will be reduced. dim: optional: int. default: -1 Dimension along which the min...
625941c1796e427e537b054b
def _sub_folders_from_path(path): <NEW_LINE> <INDENT> folders = [] <NEW_LINE> while path is not None: <NEW_LINE> <INDENT> sp = os.path.split(path) <NEW_LINE> if sp[0] != '/': <NEW_LINE> <INDENT> folders.append(sp[1]) <NEW_LINE> path = sp[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> folders.append(sp[0] + sp[1]) <NE...
divide a path in its sub folder :param path: :return:
625941c11d351010ab855aa3
def fill_fitDF(self, data, fitparams=None): <NEW_LINE> <INDENT> if fitparams is None: <NEW_LINE> <INDENT> fitparams = self.model.fitparams <NEW_LINE> <DEDENT> for k in data.keys(): <NEW_LINE> <INDENT> if '_' in k: <NEW_LINE> <INDENT> data[k.split('_')[-1]] = data[k] <NEW_LINE> <DEDENT> <DEDENT> fitDF = self.fitDF.copy(...
fill fitDF with fit statistics ::Arguments:: data (Series): fitinfo Series containing model statistics and optimized parameters (see Model.assess_fit() method) fitparams (dict): model.fitparams dict w/ meta info for last fit
625941c1f8510a7c17cf9682
def addArray(self, channel: Union[int, str], waveform: np.ndarray, SR: int, **kwargs) -> None: <NEW_LINE> <INDENT> N = len(waveform) <NEW_LINE> self._data[channel] = {} <NEW_LINE> self._data[channel]['array'] = {} <NEW_LINE> for name, array in kwargs.items(): <NEW_LINE> <INDENT> if len(array) != N: <NEW_LINE> <INDENT> ...
Add an array of voltage value to the element on the specified channel. Overwrites whatever was there before. Markers can be specified via the kwargs, i.e. the kwargs must specify arrays of markers. The names can be 'm1', 'm2', 'm3', etc. Args: channel: The channel number waveform: The array of waveform values ...
625941c1ab23a570cc250108
def mergeTwoLists(self, l1, l2): <NEW_LINE> <INDENT> if not l1: <NEW_LINE> <INDENT> return l2 <NEW_LINE> <DEDENT> if not l2: <NEW_LINE> <INDENT> return l1 <NEW_LINE> <DEDENT> head = ListNode(-1) <NEW_LINE> cur = head <NEW_LINE> while l1 and l2: <NEW_LINE> <INDENT> if l1.val <= l2.val: <NEW_LINE> <INDENT> cur.next = l1 ...
:type l1: ListNode :type l2: ListNode :rtype: ListNode
625941c1a219f33f346288f3
def after_training_epoch( self, strategy: Template, *args, **kwargs ) -> CallbackResult: <NEW_LINE> <INDENT> pass
Called after `train_epoch` by the `BaseTemplate`.
625941c1cad5886f8bd26f61
def __init__(self, pure_channels_set: dict[str, tf.Tensor], noise_cfg: NoiseCfg = None, exp_name: str = None, qubits_num: int = 3, lr: float = 0.03, lmbd1: float = 50, lmbd2: tp.Optional[float] = None, iterations: int = 250, sample_size: int = 1000): <NEW_LINE> <INDENT> self.qubits_num = qubits_num <NEW_LINE> self.lr =...
A class which holds all the information about current experiment. Args: pure_channels_set: A set of pure channels for this experiment. noise_cfg: A list of tuples, which have a bit complicated form. tuple[0] (str) - name of the gate; tuple[1] (int) - id of the gate; tuple[2] (func) - function to us...
625941c13c8af77a43ae3725
def calibration_buckets(zipped_corr_conf): <NEW_LINE> <INDENT> thresholds = np.linspace(0, 1, 21) <NEW_LINE> corrects = zipped_corr_conf[:, 0] <NEW_LINE> confidences = zipped_corr_conf[:, 1] <NEW_LINE> buckets = [(thresholds[i], thresholds[i + 1]) for i in range(len(thresholds) - 1)] <NEW_LINE> bucket_accs = [] <NEW_LI...
return calibration buckets :param zipped_corr_conf: (arr) :return: (list) bucket boundaries (list) averaged accuracy of examples within each bucket (list) averaged confidence of examples within each bucket (list) number of examples in each bucket
625941c1fff4ab517eb2f3c1
def get_session(session: str = None) -> str: <NEW_LINE> <INDENT> return session if session else sys.argv[1]
Gets session name from command line, with injectable option
625941c116aa5153ce3623ff
@api.route('/api/users', methods=['POST']) <NEW_LINE> @create_user_validate <NEW_LINE> def create_user(): <NEW_LINE> <INDENT> user = Users(first_name=request.json['first_name'], last_name=request.json['last_name'], email=request.json['email'], role_id=request.json['role_id']) <NEW_LINE> user.hash_password(request.json[...
Create a new user. Add a new user and returns the user for the user to view
625941c1507cdc57c6306c5d
def post_format(self, criterion): <NEW_LINE> <INDENT> if self.context.__name__ == 'statistic_entry': <NEW_LINE> <INDENT> criterion.entry = self.context <NEW_LINE> <DEDENT> return criterion
We hard-set the model_type
625941c156ac1b37e626415a
def render(self, context): <NEW_LINE> <INDENT> items = News.objects.all() <NEW_LINE> if self.random: <NEW_LINE> <INDENT> random.shuffle(items) <NEW_LINE> <DEDENT> if self.quantity: <NEW_LINE> <INDENT> items = items[:self.quantity] <NEW_LINE> <DEDENT> return render_to_string("lfc/portlets/news_portlet.html", { "title" :...
Renders the portlet as HTML.
625941c1fb3f5b602dac3618
def get_template(self, template_id, version=None): <NEW_LINE> <INDENT> if (version): <NEW_LINE> <INDENT> return self._api_request( self.TEMPLATES_VERSION_ENDPOINT % (template_id, version), self.HTTP_GET) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._api_request(self.TEMPLATES_SPECIFIC_ENDPOINT % template_i...
API call to get a specific template
625941c1287bf620b61d39ec
def set_norm_count(self,norm_count): <NEW_LINE> <INDENT> self.__norm_count = norm_count
Function used to set the normalisation time norm_time can be a float or an array
625941c1c4546d3d9de729b9
def OnClearTool(self, event): <NEW_LINE> <INDENT> id = self.selected <NEW_LINE> if id > 0: <NEW_LINE> <INDENT> self.FindWindowById(id + 1000).SetValue('') <NEW_LINE> self.toolslines[id]['tool_desc'] = '' <NEW_LINE> self.toolslines[id]['tool'] = '' <NEW_LINE> self.SetStatusText( _("%s. cleaning tool removed, will be ign...
Remove tool button pressed
625941c1596a897236089a4a
@app.route('/register', methods = ['GET', 'POST']) <NEW_LINE> def register(): <NEW_LINE> <INDENT> if current_user.is_authenticated: <NEW_LINE> <INDENT> return redirect('/search') <NEW_LINE> <DEDENT> form = RegisterForm() <NEW_LINE> if request.method == 'GET': <NEW_LINE> <INDENT> return render_template('register.html', ...
Registration
625941c138b623060ff0ad75
def get_schema(self): <NEW_LINE> <INDENT> return self.get_graph(self._schema_node_label)
Get the schema graph object.
625941c1bd1bec0571d905b6
def firstBadVersion(self, n): <NEW_LINE> <INDENT> l, r = 1, n <NEW_LINE> while l < r: <NEW_LINE> <INDENT> mid=l+((r-l)>>1) <NEW_LINE> if isBadVersion(mid): <NEW_LINE> <INDENT> r=mid <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> l=mid+1 <NEW_LINE> <DEDENT> <DEDENT> return l
:type n: int :rtype: int
625941c1099cdd3c635f0be3
@pg_drop.command() <NEW_LINE> @click.argument('poll_interval', type=click.IntRange(1000, 30000)) <NEW_LINE> @click.pass_context <NEW_LINE> def interval(ctx, poll_interval): <NEW_LINE> <INDENT> port_info = {} <NEW_LINE> port_info['POLL_INTERVAL'] = poll_interval <NEW_LINE> ctx.obj.mod_entry("FLEX_COUNTER_TABLE", PG_DROP...
Set pg_drop packets counter query interval interval is between 1s and 30s.
625941c1ac7a0e7691ed4057
def _is_selected(self) -> bool: <NEW_LINE> <INDENT> return self.__content_canvas_item.selected
Used for testing.
625941c150485f2cf553cd20
def do_edit_device_type(self, line): <NEW_LINE> <INDENT> device_type_name = line <NEW_LINE> if not device_type_name: <NEW_LINE> <INDENT> self.get_device_type_descriptions() <NEW_LINE> print('\nEnter a device type name you want to edit. Press <Enter> to exit: ', end='') <NEW_LINE> device_type_name = input().lower() <NEW...
Edit an existed device type in maps.yaml Press <Enter> if no change needed If addressing and endian do not match existed options, they will remain as existed setting values Edit a specific device type: edit_device_type <name> <name>: name of a device type in maps.yaml L...
625941c1be8e80087fb20bcd
def __controlSchemaComboChanged(self): <NEW_LINE> <INDENT> if self.__controlSchemaCombo.itemText(0) == "": <NEW_LINE> <INDENT> self.__controlSchemaCombo.removeItem(0) <NEW_LINE> <DEDENT> if self.controlSchemaDb() is not None: <NEW_LINE> <INDENT> self.__setTableCombo(self.controlUriDb(), self.controlSchemaDb(), self.__c...
When the selection in schema combo has changed
625941c1a05bb46b383ec7ab
def main(): <NEW_LINE> <INDENT> raw_data = ptb_reader.ptb_raw_data(ptb_data_path) <NEW_LINE> train_data, valid_data, test_data, _ = raw_data <NEW_LINE> config = SmallConfig() <NEW_LINE> eval_config = SmallConfig() <NEW_LINE> eval_config.batch_size = 1 <NEW_LINE> eval_config.num_steps = 1 <NEW_LINE> with tf.Graph().as_d...
项目运行的API :return:
625941c199fddb7c1c9de319
def get_rev_comp(seq): <NEW_LINE> <INDENT> return str(seq).translate(DNA_CONVERT_TABLE)[::-1]
Reverse complement for DNA. Included ambiguous nucleotides and retains case.
625941c1bde94217f3682d7a
def __init__(self, kind="2par"): <NEW_LINE> <INDENT> if kind not in ("2par", "3par"): <NEW_LINE> <INDENT> raise ValueError("Unknown kind '{invalid}'; valid: '2par', '3par'".format(invalid=kind)) <NEW_LINE> <DEDENT> self.label = kind <NEW_LINE> super().__init__() <NEW_LINE> makef = symutil.make_function <NEW_LINE> I4 = ...
Constructor. Parameters: kind: str "2par" to build the 2-parameter model where ϕ = ϕ(u,v), using only the invariants I4 and I5. "3par" to build the 3-parameter model where ϕ = ϕ(u,v,w), using all three invariants I4, I5 and I6.
625941c11f037a2d8b946186
def activateVirtualSubPop(self, subPop: 'vspID') -> "void": <NEW_LINE> <INDENT> return _simuPOP_std.Population_activateVirtualSubPop(self, subPop)
Obsolete or undocumented function.
625941c126068e7796caec63
def cancelar_todas_ordens(self, ordens_abertas): <NEW_LINE> <INDENT> for ordem in ordens_abertas: <NEW_LINE> <INDENT> self.cancelar_ordem(ordem['id'])
Cancelar todas as ordens abertas por ativo
625941c163b5f9789fde706c
def __init__(self): <NEW_LINE> <INDENT> self.dictionary_file = open(os.path.join( os.path.dirname(__file__), 'data/ml_rootwords.txt')) <NEW_LINE> self.dictionary = self.dictionary_file.readlines() <NEW_LINE> self.dictionary_file.close() <NEW_LINE> try: <NEW_LINE> <INDENT> self.dictionary = marisa_trie.Trie([x.strip().d...
Initialize necessary resources.
625941c1d486a94d0b98e0cc
def instantiate(self, var_mapping, init_facts, fluent_facts, objects_by_type): <NEW_LINE> <INDENT> arg_list = [var_mapping[par.name] for par in self.parameters[:self.num_external_parameters]] <NEW_LINE> name = "(%s %s)" % (self.name, " ".join(arg_list)) <NEW_LINE> precondition = [] <NEW_LINE> try: <NEW_LINE> <INDENT> s...
Return a PropositionalAction which corresponds to the instantiation of this action with the arguments in var_mapping. Only fluent parts of the conditions (those in fluent_facts) are included. init_facts are evaluated whilte instantiating. Precondition and effect conditions must be normalized for this to work. Returns N...
625941c11d351010ab855aa4
def rightSideView(self, root): <NEW_LINE> <INDENT> res = [] <NEW_LINE> def helper(root,k): <NEW_LINE> <INDENT> if not root: return <NEW_LINE> if k==0 or k==len(res): res.append([]) <NEW_LINE> res[k].append(root.val) <NEW_LINE> helper(root.left,k+1) <NEW_LINE> helper(root.right,k+1) <NEW_LINE> <DEDENT> helper(root,0) <N...
:type root: TreeNode :rtype: List[int]
625941c1d486a94d0b98e0cd
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 2 <NEW_LINE> (self.topic_id,) = _struct_H.unpack(str[start:end]) <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> start = end <NEW_LINE> ...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941c1d53ae8145f87a1fb