code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_total(self): <NEW_LINE> <INDENT> mission_evaluation.score_team(self.eval) <NEW_LINE> self.assertAlmostEqual(0.2851666666666667, self.eval.score.score_ratio)
Test the total scoring.
625941da92d797404e304454
def _get_version_output(self): <NEW_LINE> <INDENT> if not self.executable: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> command = [self.executable, '--version'] <NEW_LINE> out, _, _ = self._check(self.conn, command) <NEW_LINE> try: <NEW_LINE> <INDENT> return out.decode('utf-8').split()[2] <NEW_LINE> <DEDENT> excep...
Ignoring errors, call `ceph --version` and return only the version portion of the output. For example, output like:: ceph version 9.0.1-1234kjd (asdflkj2k3jh234jhg) Would return:: 9.0.1-1234kjd
625941dad53ae8145f87a535
def cargar_datos(self, apertura=None): <NEW_LINE> <INDENT> self.estado = E_CARGA <NEW_LINE> self.controller.estado = E_INGRESO_DATOS <NEW_LINE> hora = None <NEW_LINE> autoridades = None <NEW_LINE> if apertura is not None: <NEW_LINE> <INDENT> hora = apertura.hora <NEW_LINE> autoridades = [(autoridad.a_dict()) for autori...
Callback de salida del estado inicial, que indica que se obtuvo un tag de apertura. Ahora se pasa al estado de carga de datos, solicita el ingreso de datos del Presidente de Mesa.
625941da187af65679ca53e8
def distance(self,other): <NEW_LINE> <INDENT> pos1 = self.pos <NEW_LINE> pos2 = other.pos <NEW_LINE> p12 = CartezPos(pos2 - pos1) <NEW_LINE> dist = p12.norme() <NEW_LINE> return dist
Calulates the distance between two position pos1 and pos2 must be 2D or 3D arrays
625941da8a349b6b435e843c
def dispatch(self, todo): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> (func, args, kwargs) = todo <NEW_LINE> func(*args, **kwargs) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> (func, args) = todo <NEW_LINE> func(*args) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> (f...
dispatch functions from provided queue.
625941da5fdd1c0f98dc04fd
def reverseWords(s): <NEW_LINE> <INDENT> return " ".join(s.split()[::-1])
s = s.split(' ') ans = '' for i in range(len(s)-1,-1,-1): if s[i]: ans = ans + s[i] + ' ' return ans.rstrip()
625941da66656f66f7cbc475
def check_match(to_match, regex_list): <NEW_LINE> <INDENT> for reg_ex in regex_list: <NEW_LINE> <INDENT> if re.match(reg_ex, to_match): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Helper function that returns true if `to_match` matches with any of the regex patterns in `regex_list` (prefix match), false otherwise :param to_match: text to be matched against the pattern list :param regex_list: regex pattern list :return: True if we have a match, False otherwise
625941da66656f66f7cbc476
def test_190806(prodtest): <NEW_LINE> <INDENT> params = { "wfo": "DMX", "begints": "2012-06-20T12:00Z", "endts": "2012-06-30T12:00Z", "hailsize": 1.0, } <NEW_LINE> res = client.get("/cow.json", params=params) <NEW_LINE> cow = res.json() <NEW_LINE> assert cow["stats"]["warned_reports"] == (56 if prodtest else 0) <NEW_LI...
Test that we can limit verification to tags.
625941da16aa5153ce362741
def on_adapter_selection_change(self, adapter): <NEW_LINE> <INDENT> name = adapter.selection[0].text.lower() + '.png' <NEW_LINE> name = name.replace(' and ', '_') <NEW_LINE> image_source = join(NEW_TEMPLATE_IMAGE_PATH, name) <NEW_LINE> _dir = dirname(designer.__file__) <NEW_LINE> _dir = split(_dir)[0] <NEW_LINE> image_...
Event handler for 'on_selection_change' event of adapter.
625941da76e4537e8c35193e
def __init__(self, owner, item=None, label=None): <NEW_LINE> <INDENT> self._owner = owner <NEW_LINE> self._itemEdited = item <NEW_LINE> if label is None: <NEW_LINE> <INDENT> self._startValue = item.GetText() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._startValue = label <NEW_LINE> <DEDENT> self._finished = Fals...
Default class constructor. For internal use: do not call it in your code! :param `owner`: the control parent (an instance of :class:`CustomTreeCtrl`); :param `item`: an instance of :class:`GenericTreeItem`. :raise: `Exception` when the item has an associated image but the parent :class:`CustomTreeCtrl` does not have...
625941daadb09d7d5db6ca57
def find_evens(thing_to_evaluate): <NEW_LINE> <INDENT> return not thing_to_evaluate % 2
returns True if even
625941da2c8b7c6e89b35a89
def __init__(self, label_dict: dict, bidirectional: bool = True): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.label_dict = label_dict <NEW_LINE> self.direction = 2 if bidirectional else 1 <NEW_LINE> self.lstm = nn.LSTM(input_size=self.vector_size, hidden_size=self.d_model, num_layers=self.layers, batch_first...
Entity Recognition을 위한 LSTM 모델 클래스입니다. :param label_dict: 라벨 딕셔너리 :param bidirectional: Bidirectional 여부
625941daa8370b7717052b68
def gf_gcdex(f, g, p, K): <NEW_LINE> <INDENT> if not (f or g): <NEW_LINE> <INDENT> return [K.one], [], [] <NEW_LINE> <DEDENT> p0, r0 = gf_monic(f, p, K) <NEW_LINE> p1, r1 = gf_monic(g, p, K) <NEW_LINE> if not f: <NEW_LINE> <INDENT> return [], [K.invert(p1, p)], r1 <NEW_LINE> <DEDENT> if not g: <NEW_LINE> <INDENT> retur...
Extended Euclidean Algorithm in ``GF(p)[x]``. Given polynomials ``f`` and ``g`` in ``GF(p)[x]``, computes polynomials ``s``, ``t`` and ``h``, such that ``h = gcd(f, g)`` and ``s*f + t*g = h``. The typical application of EEA is solving polynomial diophantine equations. Consider polynomials ``f = (x + 7) (x + 1)``, ``g...
625941da30dc7b7665901c2d
def fetchapidata(): <NEW_LINE> <INDENT> url = 'http://api.tradeskillmaster.com/v1/item/US/khazgoroth?format=csv&apiKey=odfIR8Qtfy1q7R2Ee27a9rNO_WN_M97w' <NEW_LINE> with urllib.request.urlopen(url) as testfile, open(CONSTFILENAME, 'w') as file: <NEW_LINE> <INDENT> file.write(testfile.read().decode())
method docstring
625941dad164cc6175783018
def __init__( self, currency=None, available=None, locked=None, borrowed=None, interest=None, local_vars_configuration=None ): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configurat...
MarginAccountCurrency - a model defined in OpenAPI
625941dacc0a2c11143dd15a
def analyze_crossover(self, historical_data, hot_thresh=None, cold_thresh=None, period_count=(15, 21), all_data=False): <NEW_LINE> <INDENT> dataframe = self.convert_to_dataframe(historical_data) <NEW_LINE> sma_one_values = abstract.SMA(dataframe, period_count[0]) <NEW_LINE> sma_two_values = abstract.SMA(dataframe, peri...
Performs a SMA crossover analysis on the historical data Args: historical_data (list): A matrix of historical OHCLV data. hot_thresh (float, optional): Defaults to None. The threshold at which this might be good to purchase. cold_thresh (float, optional): Defaults to None. The threshold at which th...
625941da656771135c3ebb3b
def _create_user(self, username, email, password, **extra_fields): <NEW_LINE> <INDENT> email = self.normalize_email(email) <NEW_LINE> if username: <NEW_LINE> <INDENT> extra_fields['username'] = self.model.normalize_username(username) <NEW_LINE> <DEDENT> user = self.model(email=email, **extra_fields) <NEW_LINE> user.set...
Create and save a user with the given username, email, and password.
625941dabf627c535bc13499
def diff(old_html, new_html, cutoff=0.0, plaintext=False, pretty=False): <NEW_LINE> <INDENT> if plaintext: <NEW_LINE> <INDENT> old_dom = parse_text(old_html) <NEW_LINE> new_dom = parse_text(new_html) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> old_dom = parse_minidom(old_html) <NEW_LINE> new_dom = parse_minidom(new_h...
Show the differences between the old and new html document, as html. Return the document html with extra tags added to show changes. Add <ins> tags around newly added sections, and <del> tags to show sections that have been deleted.
625941dad8ef3951e3243807
def remove_duplicated_name(df): <NEW_LINE> <INDENT> names = pd.DataFrame(df.drop_duplicates(subset=['Codigo'])) <NEW_LINE> names.drop( labels=[ 'Hora', 'Super-Heroi', 'Nº Volta', 'Tempo Volta', 'Velocidade média da volta', ], axis=1, inplace=True, ) <NEW_LINE> return names
Args: df: DataFrame com as informações do CSV mais as colunas Codigo e Nome Returns: Dataframe com as colunas Codigo e Nome sem duplicidade
625941da21bff66bcd684c19
def create_expressions(xblock_id, connection, updated_expressions): <NEW_LINE> <INDENT> cursor = connection.cursor() <NEW_LINE> query = "INSERT INTO edxapp.expression (xblock_id, name, type, formula, decimal_places) VALUES (%s, %s, %s, %s, %s)" <NEW_LINE> for expression_name, expression in updated_expressions.iteritems...
Create expressions for a question template
625941da50485f2cf553d065
def ang2pix(nside, lon, lat, coord='GAL'): <NEW_LINE> <INDENT> theta = np.radians(90. - lat) <NEW_LINE> phi = np.radians(lon) <NEW_LINE> return hp.ang2pix(nside, theta, phi)
Input (lon, lat) in degrees instead of (theta, phi) in radians
625941da63d6d428bbe447b9
def verify_file_matches_repo_root(result, *file): <NEW_LINE> <INDENT> mother_file = REPO_ROOT_PATH.join(*file).strpath <NEW_LINE> generated_file = result.project.join(*file).strpath <NEW_LINE> assert compare_files(mother_file, generated_file), "Mother project '{}' not matching template.\n {} != {}".format( paths...
Assert that a generated file matches the one with the identical name in the project repository root.
625941da3cc13d1c6d3c7643
def add_column(self, name, format_spec=None): <NEW_LINE> <INDENT> if name in self.__writer.fieldnames: <NEW_LINE> <INDENT> raise ValueError(f"column name already exists: {name}") <NEW_LINE> <DEDENT> if format_spec is None: <NEW_LINE> <INDENT> format_spec = '' <NEW_LINE> <DEDENT> self.__writer.fieldnames.append(name) <N...
Add table column, optional format spec for values.
625941da097d151d1a223122
def load(self): <NEW_LINE> <INDENT> self._lockfile = portalocker.Lock(self._lockfile, timeout=10) <NEW_LINE> try: <NEW_LINE> <INDENT> with lzma.open(self.pickle_file, 'rb') as infile: <NEW_LINE> <INDENT> self.logs = pickle.load(infile) <NEW_LINE> <DEDENT> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> pass
load logs from file
625941da96565a6dacc8f994
def HSI2RGB(hsi_img): <NEW_LINE> <INDENT> row = np.shape(hsi_img)[0] <NEW_LINE> col = np.shape(hsi_img)[1] <NEW_LINE> rgb_img = hsi_img.copy() <NEW_LINE> H, S, I = cv2.split(hsi_img) <NEW_LINE> [H, S, I] = [i / 255.0 for i in ([H, S, I])] <NEW_LINE> R, G, B = H, S, I <NEW_LINE> for i in range(row): <NEW_LINE> <INDENT> ...
这是将HSI图像转化为RGB图像的函数 :param hsi_img: HSI彩色图像 :return: RGB图像
625941dae8904600ed9f21fa
def remove_many(self, activities, *args, **kwargs): <NEW_LINE> <INDENT> if activities and not isinstance(activities[0], Activity): <NEW_LINE> <INDENT> raise ValueError('Expecting Activity not %s' % activities) <NEW_LINE> <DEDENT> self.trim() <NEW_LINE> current_activities = self[:self.max_length] <NEW_LINE> new = [] <NE...
Removes many activities from the feed :param activities: the list of activities to remove
625941da0a50d4780f66715e
@app.route('/neo4j_stock_phone_query/',methods=['GET','POST']) <NEW_LINE> def neo4j_stock_phone_query(): <NEW_LINE> <INDENT> if request.method=='GET': <NEW_LINE> <INDENT> return render_template('gps_label_sta.html') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> import json <NEW_LINE> date = request.form.get('neo4j_quer...
用户发货号码关联关系查询 :return:
625941dad58c6744b4257f28
def __init__(self) -> None: <NEW_LINE> <INDENT> msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( ", ".join(['RuleConditionSingleProperty', 'RuleConditionOrLvl2', 'RuleConditionAndLvl2'])) <NEW_LINE> raise Exception(msg)
Initialize a RuleCondition object.
625941da4d74a7450ccd448e
def _GetEventByNameFromEvents(events): <NEW_LINE> <INDENT> assert 'types' in events, 'The dictionary |events| must contain the key "types".' <NEW_LINE> event_list = [t for t in events['types'] if t.get('name') == 'Event'] <NEW_LINE> assert len(event_list) == 1, 'Exactly one type must be called "Event".' <NEW_LINE>...
Parses the dictionary |events| to find the definitions of members of the type Event. Returns a dictionary mapping the name of a member to that member's definition.
625941da2eb69b55b151cb7c
def _replace(self, token_list, doc, percent=0.3): <NEW_LINE> <INDENT> keywords = self._extract_keywords(self.dct, self.tfidf_model[doc]) <NEW_LINE> num = int(len(token_list) * percent) <NEW_LINE> new_tokens = token_list.copy() <NEW_LINE> indexes = np.random.choice(len(token_list), num) <NEW_LINE> for index in indexes: ...
replace token by another token which is similar in wordvector Args: token_list (list): reference token list doc (list): A reference represented by a word bag model Returns: (str): new reference str
625941da30dc7b7665901c2e
def ck_input_variable_float_zero_to_1( self, input_variables_dict, key, bad_input_variables_values_list ): <NEW_LINE> <INDENT> if ( input_variables_dict[key] is not None and isinstance(input_variables_dict[key], float) is not True or input_variables_dict[key] < 0 or input_variables_dict[key] > 1 or str(input_variables_...
Checks if the input variable is a float from 0 to 1 ( 0 =< value <= 1). If not, the provided list is appended with the bad with the dict_key Parameters ---------- input_variables_dict: dict The user input variable dictionary key: str Dictionary key for the user provided input variable list bad_input_variables_...
625941dadd821e528d63b471
def rmsprop(x, dx, config={}): <NEW_LINE> <INDENT> config.setdefault('learning_rate', 1e-2) <NEW_LINE> config.setdefault('decay_rate', 0.99) <NEW_LINE> config.setdefault('epsilon', 1e-8) <NEW_LINE> cache = config.get('cache', np.zeros_like(x)) <NEW_LINE> cache = config['decay_rate'] * cache + (1 - config['decay_rate'])...
Uses the RMSProp update rule, which uses a moving average of squared gradient values to set adaptive per-parameter learning rates. config format: - learning_rate: Scalar learning rate. - decay_rate: Scalar between 0 and 1 giving the decay rate for the squared gradient cache. - epsilon: Small scalar used for smoothin...
625941da8da39b475bd65240
def put(self, request, token=None): <NEW_LINE> <INDENT> if token: <NEW_LINE> <INDENT> identifier = handle_token(token) <NEW_LINE> if not identifier: <NEW_LINE> <INDENT> return RESPONSE_498_INVALID_TOKEN <NEW_LINE> <DEDENT> user = CustomUser.get_by_id(identifier['user_id']) <NEW_LINE> if not user: <NEW_LINE> <INDENT> re...
Handles PUT request.
625941da3539df3088e2e615
def matches(pattern, term): <NEW_LINE> <INDENT> value, meta = pattern.replace(' ','').split(';') <NEW_LINE> meta = meta.split(',') <NEW_LINE> if isinstance(term, AAnnotation): <NEW_LINE> <INDENT> return term._matches(value, meta) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return term._matches(value)
Collapse terms with as-patterns.
625941daa05bb46b383ecaea
def sub_folder_size(sub_folder): <NEW_LINE> <INDENT> total_size = 0 <NEW_LINE> for dir_path, dir_names, file_names in os.walk(sub_folder): <NEW_LINE> <INDENT> for filename in file_names: <NEW_LINE> <INDENT> full_path = os.path.join(dir_path, filename) <NEW_LINE> if os.path.exists(full_path): <NEW_LINE> <INDENT> file_si...
:param sub_folder: path to a sub folder :return: size of all the files
625941da91f36d47f21ac7bf
def testTrivial(self): <NEW_LINE> <INDENT> self.assertEqual(0.0, eValueToBitScore(eValue=1.0, dbSize=1, dbSequenceCount=1, queryLength=1, lengthAdjustment=0))
For an e-value of 1.0 on a database of size 1 with total query length 1, we should get a bit score of 0.0
625941dacdde0d52a9e532ff
def p_file_chk_sum(self, f_term, predicate): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for _s, _p, checksum in self.graph.triples((f_term, predicate, None)): <NEW_LINE> <INDENT> for _, _, value in self.graph.triples((checksum, self.spdx_namespace['checksumValue'], None)): <NEW_LINE> <INDENT> self.builder.set_file_ch...
Sets file checksum. Assumes SHA1 algorithm without checking.
625941da76d4e153a657edfc
def batch_iterator(self, train_mode=True): <NEW_LINE> <INDENT> raise NotImplemented("You must implement batch iterator" + " in DataLoader class.")
This function returns an iterator over all the batches of data :returns iterator
625941da5f7d997b87174d64
def genericGET(self, URL): <NEW_LINE> <INDENT> URL = "%s%s%s" % (self.transport, self.controllername, URL) <NEW_LINE> try: <NEW_LINE> <INDENT> r = requests.get(URL, auth=(self.username, self.password), headers=self.HEADER, verify=False) <NEW_LINE> <DEDENT> except requests.ConnectionError as e: <NEW_LINE> <INDENT> retur...
Issue a GET and return the results
625941dacc40096d61595c1a
def clean_up(nodes): <NEW_LINE> <INDENT> node_s = [(n.stones[-1], n.cost, nodes.index(n)) for n in nodes] <NEW_LINE> node_s.sort() <NEW_LINE> remove_list = list() <NEW_LINE> prev_ls = None <NEW_LINE> for ns in node_s: <NEW_LINE> <INDENT> node_x = nodes[ns[2]] <NEW_LINE> if ns[0] == prev_ls: <NEW_LINE> <INDENT> remove_l...
Input: List of Node class object Return: List of Node class object
625941da796e427e537b0892
def __init__(self): <NEW_LINE> <INDENT> Player.Player.__init__(self) <NEW_LINE> self.past_moves = [] <NEW_LINE> self.opp_moves = [] <NEW_LINE> self.win_record = [] <NEW_LINE> self.player_number = -1 <NEW_LINE> self.opp_number = -1 <NEW_LINE> self.name = "Game Master"
Initializes the player's class fields All lists are set to an empty value and the player/opp numbers should be negative
625941da24f1403a92600e2e
def _getInstanceId(self): <NEW_LINE> <INDENT> self.instanceIdCounter += 1 <NEW_LINE> return 'instanceId_%s' % str(self.instanceIdCounter)
Return a unique (for this jobslave run) file id for use in an ovf.
625941da287bf620b61d3d2c
def test_duplicates(self): <NEW_LINE> <INDENT> mainpage = self.get_mainpage() <NEW_LINE> links = [page for page in self.site.pagelinks(mainpage, total=20) if page.exists()] <NEW_LINE> dupl_links = links + links[::-1] <NEW_LINE> pages = list(self.site.preloadpages(dupl_links, groupsize=40)) <NEW_LINE> self.assertEqual(p...
Test outcome is following same order of input.
625941da507cdc57c6306faa
def test_molssi_train_imported(): <NEW_LINE> <INDENT> assert "molssi_train" in sys.modules
Sample test, will always pass so long as import statement worked
625941da099cdd3c635f0f24
@socketio.on('login') <NEW_LINE> def login(msg): <NEW_LINE> <INDENT> if DEBUG: <NEW_LINE> <INDENT> print('收到登录请求', msg) <NEW_LINE> <DEDENT> if gamemain.login(msg): <NEW_LINE> <INDENT> emit('login_reply', {'data': 'success'}) <NEW_LINE> if DEBUG: <NEW_LINE> <INDENT> print('登录成功') <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_...
处理登录 :param msg:
625941da0a50d4780f66715f
def query_file(keyfield): <NEW_LINE> <INDENT> r = requests.get('{}/api/query/projectId_25/F1_{}/divider_/binaryData?guid={}'.format(siteurl, keyfield, guid)) <NEW_LINE> if r.status_code == 200: <NEW_LINE> <INDENT> contents = r.json() <NEW_LINE> if contents[0]['files']['totalCount'] == 0: <NEW_LINE> <INDENT> print('No f...
Using the keyfield, find a file and return its listing of documents
625941da15fb5d323cde0ddd
def print_square(size): <NEW_LINE> <INDENT> if type(size) is not int: <NEW_LINE> <INDENT> raise TypeError("size must be an integer") <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise ValueError("size must be >= 0") <NEW_LINE> <DEDENT> if size > 0: <NEW_LINE> <INDENT> print(("#" * size + "\n") * size, end="")
prints a square with "#"'s that has a length of size
625941da9c8ee82313fbba40
def __call__(self, name=None, profile=None, user=None, value=None, ): <NEW_LINE> <INDENT> optional_kwargs = {} <NEW_LINE> if name is not None: <NEW_LINE> <INDENT> optional_kwargs['name'] = name <NEW_LINE> <DEDENT> if profile is not None: <NEW_LINE> <INDENT> optional_kwargs['profile'] = profile <NEW_LINE> <DEDENT> if us...
Set the profile information for a user. :param name: Optional. Name of a single key to set. Usable only if profile is not passed. e.g. first_name :param profile: Optional. Collection of key:value pairs presented as a URL-encoded JSON hash. e.g. { first_name: "John", ... } :param user: Optional. ID of user to change. T...
625941da63f4b57ef00013dd
def userRenamed(self, oldname, newname): <NEW_LINE> <INDENT> pass
a user changed the nick
625941daf7d966606f6aa2d2
def _refresh(self): <NEW_LINE> <INDENT> self.control.setUpdatesEnabled(False) <NEW_LINE> while self.layout.count() > 0: <NEW_LINE> <INDENT> self.layout.takeAt(0) <NEW_LINE> <DEDENT> for page in self.pages: <NEW_LINE> <INDENT> self.layout.addWidget(page.control) <NEW_LINE> <DEDENT> self.layout.addStretch(1) <NEW_LINE> s...
Refresh the layout and contents of the notebook.
625941dabe383301e01b574c
def generate_classes_header(self): <NEW_LINE> <INDENT> name_upper = self.name.upper() <NEW_LINE> header = separator <NEW_LINE> header += " * %s\n" % self.name <NEW_LINE> header += " */\n" <NEW_LINE> header += "\n" <NEW_LINE> header += "#define %s_CLASSNAME \\\n" % name_upper <NEW_LINE> header += " \"%s\"\n" % self.n...
Generate C header code and return it as string Declares: <class_name>_Data - used as one of hypervObject->data members <class_name>_TypeInfo - used as wsman XmlSerializerInfo <class_name> - "inherits" hypervObject struct
625941dae5267d203edcdf64
def _setup(): <NEW_LINE> <INDENT> global parser, args, config, r, response, patch, monitor, debug, ft_host, ft_port, ft_input, ft_output <NEW_LINE> parser = argparse.ArgumentParser() <NEW_LINE> parser.add_argument("-i", "--inifile", default=os.path.join(path, name + '.ini'), help="name of the configuration file") <NEW_...
Initialize the module This adds a set of global variables
625941da15fb5d323cde0dde
def deploy_dragon(self, place_name, dragon_type_name): <NEW_LINE> <INDENT> constructor = self.dragon_types[dragon_type_name] <NEW_LINE> if self.food < constructor.food_cost: <NEW_LINE> <INDENT> print('Not enough food remains to place ' + dragon_type_name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dragon = construct...
Place a dragon if enough food is available. This method is called by the current strategy to deploy dragons.
625941dae76e3b2f99f3aad2
def dump(self): <NEW_LINE> <INDENT> style, shape = '', '' <NEW_LINE> stops = set() <NEW_LINE> endpoints = self.__origin, self.__destin <NEW_LINE> routeTitle = self.__timeTable.split('.')[0] <NEW_LINE> visual_graph = open(self.__outfile, 'w') <NEW_LINE> visual_graph.write("graph {} {}\n".format(routeTitle, '{')) <NEW_LI...
Exports most recent found shortest path between requested cities to a gv file.
625941dade87d2750b86005f
@app_controller.route('/subjects/<subject_key>/revise') <NEW_LINE> @Utils.auth_required <NEW_LINE> def subject_revise(user, subject_key): <NEW_LINE> <INDENT> subject = Utils.urlsafe_to_key(subject_key).get() <NEW_LINE> session_data = user.getSession() <NEW_LINE> if session_data['views'] < 5: <NEW_LINE> <INDENT> return ...
Send revision concepts
625941da5f7d997b87174d65
def resolve_conflicts(self) -> bool: <NEW_LINE> <INDENT> neighbours = self.nodes <NEW_LINE> new_chain = None <NEW_LINE> max_length = len(self.chain) <NEW_LINE> for node in neighbours: <NEW_LINE> <INDENT> response = requests.get(f'http://{node}/chain') <NEW_LINE> if response.status_code == 200: <NEW_LINE> <INDENT> lengt...
共识算法解决冲突 使用网络中最长的链. :return: True 如果链被取代, 否则为False
625941da460517430c39444a
def pmLookupInDom(self, pmdesc, name): <NEW_LINE> <INDENT> status = LIBPCP.pmUseContext(self.ctx) <NEW_LINE> if status < 0: <NEW_LINE> <INDENT> raise pmErr(status) <NEW_LINE> <DEDENT> status = LIBPCP.pmLookupInDom(get_indom(pmdesc), name) <NEW_LINE> if status < 0: <NEW_LINE> <INDENT> raise pmErr(status) <NEW_LINE> <DED...
PMAPI - Lookup the instance id with the given NAME in the indom c_uint instid = pmLookupInDom(pmDesc pmdesc, "Instance")
625941da45492302aab5e591
def testGetIDFromDeflatedSAMLLogoutRequest(self): <NEW_LINE> <INDENT> deflated_logout_request = self.file_contents(join(self.data_path, 'logout_requests', 'logout_request_deflated.xml.base64')) <NEW_LINE> logout_request = OneLogin_Saml2_Utils.decode_base64_and_inflate(deflated_logout_request) <NEW_LINE> id1 = OneLogin_...
Tests the get_id method of the OneLogin_Saml2_LogoutRequest
625941da377c676e91272472
def run(command): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) <NEW_LINE> <DEDENT> except OSError as e: <NEW_LINE> <INDENT> raise Failure("could not run %s: %s" % (command, e)) <NEW_LINE> <DEDENT> output = pipe.communicate()[0].decode(lo...
Run a command [cmd, arg1, arg2, ...]. Returns the output (stdout + stderr). Raises CommandFailed in cases of error.
625941da435de62698dfdf18
def draw_annos(image, annos): <NEW_LINE> <INDENT> for a in annos: <NEW_LINE> <INDENT> blur = a['blur'] <NEW_LINE> expr = a['expression'] <NEW_LINE> occ = a['occlusion'] <NEW_LINE> pose = a['pose'] <NEW_LINE> illum = a['illumination'] <NEW_LINE> inval = a['invalid'] <NEW_LINE> x, y, w, h = a['x'], a['y'], a['w'], a['h']...
Test code to validate loaded annoataion values
625941dad7e4931a7ee9e1e9
def _setGeneric(c, nx): <NEW_LINE> <INDENT> key, val = c.argv[1:] <NEW_LINE> if nx and (key in c.dict_): <NEW_LINE> <INDENT> server.addReply(c, shared.one) <NEW_LINE> return <NEW_LINE> <DEDENT> c.dict_[key] = val <NEW_LINE> if nx: <NEW_LINE> <INDENT> server.addReply(c, shared.one) <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
For set and setnx.
625941daaad79263cf390d0f
def chained_parameter_variation(self, *args, **kwargs): <NEW_LINE> <INDENT> return chained_parameter_variation(self, *args, **kwargs)
See :func:`chained_parameter_variation`.
625941da99cbb53fe6792eb1
def _get_race_coding(self): <NEW_LINE> <INDENT> df = pd.read_html('http://hl7.org/fhir/ValueSet/v2-0005')[2] <NEW_LINE> df.columns = df.iloc[0,:] <NEW_LINE> df = df.iloc[1:,0:3] <NEW_LINE> self.race_description = random.choice(df.Description.tolist()) <NEW_LINE> self.race_code = df[df.Description==self.race_description...
Uses FHIR valueset v2 to obtain and randomly choose a race.
625941da566aa707497f4830
def _build_param_dict(self): <NEW_LINE> <INDENT> pass
Populate the parameter dictionary with parameters. For each parameter key, add match stirng, match lambda function, and value formatting function for set commands.
625941da498bea3a759b9d79
def concat(variables, dim='concat_dim', positions=None, shortcut=False): <NEW_LINE> <INDENT> variables = list(variables) <NEW_LINE> if all(isinstance(v, Coordinate) for v in variables): <NEW_LINE> <INDENT> return Coordinate.concat(variables, dim, positions, shortcut) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return...
Concatenate variables along a new or existing dimension. Parameters ---------- variables : iterable of Array Arrays to stack together. Each variable is expected to have matching dimensions and shape except for along the stacked dimension. dim : str or DataArray, optional Name of the dimension to stack ...
625941da925a0f43d254a144
def language_pairs(self): <NEW_LINE> <INDENT> return ( ('eng', 'fra'), ('eng', 'deu'), ('eng', 'spa'), ('eng', 'ita'), ('fra', 'eng'), ('fra', 'deu'), ('deu', 'eng'), ('deu', 'spa'), ('deu', 'fra'), ('spa', 'eng'), ('spa', 'deu'), )
Returns a tuple of all supported language pairs for this worker.
625941da8c3a873295158688
def test_query_get_provide_None(self): <NEW_LINE> <INDENT> actual = self.queries.get() <NEW_LINE> expected = self.project.examples["queries"]["results"][0] <NEW_LINE> self.assertEqual(actual, expected)
can a user pass nothing into queries.get()
625941da4a966d76dd5512dc
def test_build_channel_class(): <NEW_LINE> <INDENT> channel_class = build_channel_class(channel_number=2, mcaroi_numbers=(1, 2, 3)) <NEW_LINE> assert hasattr(channel_class, "channel_number") <NEW_LINE> assert getattr(channel_class, "channel_number") == 2 <NEW_LINE> assert hasattr(channel_class, "sca") <NEW_LINE> assert...
Try to verify all Component attributes are present.
625941da3cc13d1c6d3c7644
def nankappa(alpha, axis=None, w=None, d=0): <NEW_LINE> <INDENT> return _kappa(alpha, True, axis=axis, w=w, d=d)
Computes an approximation to the ML estimate of the concentration parameter kappa of the von Mises distribution. Parameters ---------- alpha : np.ndarray The array of angles axis : int (default=None) The axis along which to take the mean w : np.ndarray (default=None) An array of weights, if a weighted mean ...
625941daa8ecb033257d3397
def write(self, obj): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif isinstance(obj, Node): <NEW_LINE> <INDENT> self.write_node(obj) <NEW_LINE> <DEDENT> elif isinstance(obj, Relationship): <NEW_LINE> <INDENT> self.write_relationship(obj) <NEW_LINE> <DEDENT> elif isinstance(obj, Pa...
Write any entity, value or collection. :arg obj:
625941da24f1403a92600e2f
def __init__(self, server, port=None): <NEW_LINE> <INDENT> dest_port = settings['dns_port'] <NEW_LINE> if (port): <NEW_LINE> <INDENT> dest_port = port <NEW_LINE> <DEDENT> (family, type_, proto, canonname, sockaddr) = socket.getaddrinfo(server, dest_port, proto=socket.SOL_TCP)[0] <NEW_LINE> sock = socket.sock...
Initialise settings for conversation.
625941db236d856c2ad44aa8
def filter_is_up(self, gw): <NEW_LINE> <INDENT> ago = now().timestamp - (60 * 10) <NEW_LINE> return gw.updated > ago
filter out gateways that have not received update for more then 10 minutes
625941db0fa83653e4657285
def main(args=None): <NEW_LINE> <INDENT> unused_parsed_args = _PARSER.parse_args(args=args) <NEW_LINE> delete_directory_tree(OPPIA_TOOLS_DIR) <NEW_LINE> delete_directory_tree('node_modules/') <NEW_LINE> delete_directory_tree('third_party/') <NEW_LINE> delete_directory_tree('build/') <NEW_LINE> delete_directory_tree('ba...
Runs the script to clean temporary and installed files.
625941db2c8b7c6e89b35a8a
def __receive(self): <NEW_LINE> <INDENT> msg = packing.receive_msg(self.client_socket) <NEW_LINE> if msg['code'] in GOSSIP_MESSAGE_TYPES.keys(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> message_object = GOSSIP_MESSAGE_TYPES[msg['code']](msg['message']) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> ...
Receives a new message, unpacks it and forwards it to the assigned controller. :returns: The received message object
625941db3d592f4c4ed1d333
@pytest.mark.P2 <NEW_LINE> @pytest.mark.parametrize('gas_type', [0, 1]) <NEW_LINE> def test_IV_041(client_new_node, gas_type): <NEW_LINE> <INDENT> client = client_new_node <NEW_LINE> economic = client.economic <NEW_LINE> node = client.node <NEW_LINE> if gas_type == 0: <NEW_LINE> <INDENT> node.ppos.need_quota_gas = Fals...
混合金额质押,锁仓+自由质押金额不足
625941db4f88993c3716c330
def start_process(cmd): <NEW_LINE> <INDENT> print("Starting BrowserStackLocal process ", end='', flush=True) <NEW_LINE> process = Popen(cmd, stdout=PIPE) <NEW_LINE> poll_obj = select.poll() <NEW_LINE> poll_obj.register(process.stdout, select.POLLIN) <NEW_LINE> connected = False <NEW_LINE> start_time = time.time() <NEW_...
Start BrowserStackLocal foreground process. Monitor its output to find a specific text that indicates that the process has successfully established connection to BrowserStack server and ready to serve. Credits to https://stackoverflow.com/questions/10756383 :param list[str] cmd: :rtype: subprocess.Popen | None
625941dbcdde0d52a9e53300
def ncoset_reps(self): <NEW_LINE> <INDENT> return len(self._source.reps())
Return the number of coset representatives defining the domain of the modular symbols in this space. OUTPUT: The number of coset representatives stored in the manin relations. (Just the size of `P^1(\ZZ/N\ZZ)`) EXAMPLES:: sage: D = Symk(2) sage: M = PollackStevensModularSymbols(Gamma0(2), coefficients=D) ...
625941dbd18da76e235327a3
def update_complex_name(metadata, filename): <NEW_LINE> <INDENT> unsupported_types = ['_phase', '_magnitude', '_magnitude1', '_magnitude2', '_phasediff', '_phase1', '_phase2'] <NEW_LINE> if any(ut in filename for ut in unsupported_types): <NEW_LINE> <INDENT> return filename <NEW_LINE> <DEDENT> if 'M' in metadata.get('I...
Insert `_part-<mag|phase>` entity into filename if data are from a sequence with magnitude/phase part. Parameters ---------- metadata : dict Scan metadata dictionary from BIDS sidecar file. filename : str Incoming filename Returns ------- filename : str Updated filename with part entity added in appropria...
625941db596a897236089d89
def _generate_builder_configs(): <NEW_LINE> <INDENT> configs = [] <NEW_LINE> for module in sorted(set(_MODULES)): <NEW_LINE> <INDENT> configs.append(nlp.BuilderConfig(name=module, version=nlp.Version("1.0.0"), description=_DESCRIPTION,)) <NEW_LINE> <DEDENT> return configs
Generate configs with different subsets of mathematics dataset.
625941db711fe17d82542630
def archive_location(self, id_, uri): <NEW_LINE> <INDENT> if isinstance(id_, Dataset): <NEW_LINE> <INDENT> warnings.warn("Passing dataset is deprecated after 1.2.2, pass dataset.id", DeprecationWarning) <NEW_LINE> id_ = id_.id <NEW_LINE> <DEDENT> with self._db.connect() as connection: <NEW_LINE> <INDENT> was_archived =...
Archive a location of the dataset if it exists. :param typing.Union[UUID, str] id_: dataset id :param str uri: fully qualified uri :return bool: location was able to be archived
625941db009cb60464c6367b
def configureCygwinBrokenPipe(self): <NEW_LINE> <INDENT> if config.setCompilers.Configure.isCygwin(self.log): <NEW_LINE> <INDENT> import platform <NEW_LINE> import re <NEW_LINE> r=re.compile("([0-9]+).([0-9]+).([0-9]+)") <NEW_LINE> m=r.match(platform.release()) <NEW_LINE> major=int(m.group(1)) <NEW_LINE> minor=int(m.gr...
Cygwin version <= 1.7.18 had issues with pipes and long commands invoked from gnu-make http://cygwin.com/ml/cygwin/2013-05/msg00340.html
625941db57b8e32f52483768
def send(self, message): <NEW_LINE> <INDENT> if isinstance(message, Message): <NEW_LINE> <INDENT> if len(message.tokens) == 0: <NEW_LINE> <INDENT> LOG.warning("Message without device tokens is ignored") <NEW_LINE> return Result(message) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if len(message) == 0: <NEW_L...
Send the message. The method will block until the whole message is sent. The method returns :class:`Result` object, which you can examine for possible errors and retry attempts. .. note:: If the client fails to connect to APNs, probably because your network is down, then this method will raise the related ...
625941db26068e7796caefad
@shared.cli.command() <NEW_LINE> @click.argument("name", required=False) <NEW_LINE> @click.option("--list_docs", "-l", is_flag=True, required=False) <NEW_LINE> @click.pass_context <NEW_LINE> def path(ctx, name, list_docs): <NEW_LINE> <INDENT> docs = shared.get_document_selection(ctx, name, list_docs) <NEW_LINE> if not ...
Show local disk path for document.
625941db4428ac0f6e5baabf
def _create_id_object(cls, object_id, _schema_id=None): <NEW_LINE> <INDENT> if _schema_id is not None: <NEW_LINE> <INDENT> if not isinstance(_schema_id, SchemaClassId): <NEW_LINE> <INDENT> raise TypeError("class SchemaClassId expected") <NEW_LINE> <DEDENT> params = {QmfData.KEY_SCHEMA_ID: _schema_id} <NEW_LINE> <DEDENT...
Create a ID Query for an object (schema optional).
625941db1f5feb6acb0c4e17
def findTarget(self, root, k): <NEW_LINE> <INDENT> li = [] <NEW_LINE> def traverse(root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> traverse(root.left) <NEW_LINE> li.append(root.val) <NEW_LINE> traverse(root.right) <NEW_LINE> <DEDENT> traverse(root) <NEW_LINE> i, j = 0, len(li) - 1...
:type root: TreeNode :type k: int :rtype: bool
625941db44b2445a33932360
def getDatabase(self, name=None): <NEW_LINE> <INDENT> return self.getAuthority(name=name)
Deprecated. Use getAuthority instead
625941db30dc7b7665901c2f
def __init__(self, **args) : <NEW_LINE> <INDENT> HTML_document.__init__(self) <NEW_LINE> for key in list(self.__possibleargs.keys()) : <NEW_LINE> <INDENT> if key in args : <NEW_LINE> <INDENT> value = args[key] <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> value = self.__possibleargs[key] <NEW_LINE> <DEDENT> setattr(se...
Initialise local datas.
625941db0a366e3fb873eae7
def groups(self): <NEW_LINE> <INDENT> out = set([self.group]) if self.group is not None else set() <NEW_LINE> return out
Return groups associated with this node
625941dbe76e3b2f99f3aad3
@cache_redis.memoize(timeout=TIMEOUT_12HR*2*7) <NEW_LINE> def get_sector_data(sector): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> stocks = [s for s in SectorCollection(sector, output_format = 'json').fetch() if 'primaryExchange' in s and ''.join(sorted(s['primaryExchange'].upper())).strip() in [''.join(sorted(e['name...
Get sector data from iexfinance API
625941dbbaa26c4b54cb13e8
def deactivate(self, service): <NEW_LINE> <INDENT> self.log.info("Removing service %s from environment %s" % (service.name, self.name)) <NEW_LINE> if service in self.services: <NEW_LINE> <INDENT> self.services.remove(service) <NEW_LINE> <DEDENT> self.clear_cache()
This removes the service from this environment.
625941dba17c0f6771cbe31b
def __occupy(self, x, y, player): <NEW_LINE> <INDENT> queue = [(x, y)] <NEW_LINE> area = [] <NEW_LINE> closed = True <NEW_LINE> while closed and len(queue) > 0: <NEW_LINE> <INDENT> (x, y) = queue.pop(0) <NEW_LINE> if (x, y) in area: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> area.append((x, y)) <NEW_LINE> if not ...
Checks if a new area will get occupied by the given player.
625941dbcc0a2c11143dd15c
def test_pruned_samplespace2(): <NEW_LINE> <INDENT> outcomes = ['0', '1', '2', '3'] <NEW_LINE> pmf = [1/2, 0, 1/2, 0] <NEW_LINE> ss2_ = ['0', '1', '2'] <NEW_LINE> d = dit.ScalarDistribution(outcomes, pmf) <NEW_LINE> d2 = dit.algorithms.pruned_samplespace(d, sample_space=ss2_) <NEW_LINE> d2.make_dense() <NEW_LINE> ss2 =...
Prune a sample space while specifying a desired sample space.
625941db4f6381625f114d07
def main(filename, start, count, output="./img_snapshots", slice_type="side"): <NEW_LINE> <INDENT> filename = pathlib.Path(filename) <NEW_LINE> stem = filename.stem.split("_")[0] <NEW_LINE> tasks = 'Temperature(y=+1)' <NEW_LINE> dpi = 150 <NEW_LINE> savename_func = lambda write: '{}_{:06}.png'.format(stem, write) <NEW_...
Save plot of specified tasks for given range of analysis writes.
625941db9b70327d1c4e10a1
def nitems_read(self, *args, **kwargs): <NEW_LINE> <INDENT> return _blocks_swig4.pdu_filter_sptr_nitems_read(self, *args, **kwargs)
nitems_read(pdu_filter_sptr self, unsigned int which_input) -> uint64_t
625941dbbaa26c4b54cb13e9
def OnSaveSettings(self, event=None): <NEW_LINE> <INDENT> self._log.debug('Saving Settings.') <NEW_LINE> ccOpt = self.menuBar.FindMenuItem(self._idCcOption) <NEW_LINE> sentNotifyOpt = self.menuBar.FindMenuItem(self._idSentNotify) <NEW_LINE> cfgSettings = {} <NEW_LINE> cfgSettings['dest_email'] = self._destEmail ...
Needs Implemented
625941dbd99f1b3c44c67856
def ddgen(self, c, minimize, maximize): <NEW_LINE> <INDENT> self.minimize = minimize <NEW_LINE> self.maximize = maximize <NEW_LINE> n = 2 <NEW_LINE> self.CC = c <NEW_LINE> if self.debug_dd: <NEW_LINE> <INDENT> print("dd(%s, %r)..." % (self.pretty(c), n)) <NEW_LINE> <DEDENT> outcome = self._dd(c, n) <NEW_LINE> if self.d...
Return a 1-minimal failing subset of C
625941db9b70327d1c4e10a2
def activate_thread(self, semaphore, pool, url): <NEW_LINE> <INDENT> with semaphore: <NEW_LINE> <INDENT> name = threading.current_thread().getName() <NEW_LINE> pool.activate(name) <NEW_LINE> self.check_url(url) <NEW_LINE> pool.deactivate(name)
Activate thread to check a URL. Args: semaphore: threading semaphore. pool: instance of ActivePool() url: a single URL.
625941db21bff66bcd684c1b
def get_session_dict(session, session_id): <NEW_LINE> <INDENT> session_obj = session.query(models.Session).get(session_id) <NEW_LINE> if session_obj is None: <NEW_LINE> <INDENT> raise exceptions.InvalidSessionReference("No session with id: %s" % str(session_id)) <NEW_LINE> <DEDENT> return derive_session_dict(session_ob...
Get the session dict based on the ID :param session_id: ID of the session :type session_id: `int` :return: Session dict :rtype: `dict`
625941db796e427e537b0893
def forward(self, x): <NEW_LINE> <INDENT> return self.w_2(self.dropout(F.relu(self.w_1(x))))
@param x - shape (batch_size, sent_len, dim_model). The first dimension has size batch_size and the last has size dim_model. return shape: (batch_size, sent_len, dim_model)
625941db60cbc95b062c680f
def get_provision_metadata(self): <NEW_LINE> <INDENT> self.clone_git_repository(self.git_repo) <NEW_LINE> self.setup_topology_by_osp_config(self.osp_config) <NEW_LINE> self.openstack_topology_credentials = self.get_openstack_credentials(self.osp_data) <NEW_LINE> if self.metadata_file: <NEW_LINE> <INDENT> self.setup_top...
Method for getting provision topology Credentials values are stored in openstack_topology_credentials parameter :returns tuple -- first elements is dictionary of provision topology and second dictionary of topology credentials
625941db26068e7796caefae