code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def compute_mod_diff( old_mods: List[Mapping[str, str]], new_mods: List[Mapping[str, str]], *, loglevel=None ) -> DiffObject: <NEW_LINE> <INDENT> LOGGER.info("Computing mod diff") <NEW_LINE> old_addons = {mod["addonID"]: mod for mod in old_mods} <NEW_LINE> new_addons = {mod["addonID"]: mod for mod in new_mods} <NEW_LIN...
Computes the difference between old and new modlists Arguments: old_mods -- the old mods ("mods" property of pack-manifest.json) new_mods -- the new mods ("mods" property of pack-manifest.json) loglevel -- if a logging level, logs the diff Returns a DiffObject on the addonID of the mods
625941f466673b3332b926ae
def data_fn(tree_item): <NEW_LINE> <INDENT> return safe_tio_call(obj_fn, tree_item, log_exceptions=log_exceptions)
Call the obj_fn(tree_item.obj). Returns empty string in case of an error
625941f416aa5153ce362a96
def plotToStringIO(self): <NEW_LINE> <INDENT> zData = self.part_rgb[0, :, :] <NEW_LINE> rows, columns = zData.shape <NEW_LINE> xArray = np.arange(columns) <NEW_LINE> yArray = np.arange(rows) <NEW_LINE> xData, yData = np.meshgrid(xArray, yArray) <NEW_LINE> return graph.surfacePlot(xData, yData, zData, "rgb")
Plots the graph to a StringIO object and returns it. Return values: graphString: a StringIO object representing the graph.
625941f423e79379d52eeb78
def NormjoinPathForceCMakeSource(base_path, rel_path): <NEW_LINE> <INDENT> if os.path.isabs(rel_path): <NEW_LINE> <INDENT> return rel_path <NEW_LINE> <DEDENT> if any([rel_path.startswith(var) for var in FULL_PATH_VARS]): <NEW_LINE> <INDENT> return rel_path <NEW_LINE> <DEDENT> return os.path.join('${CMAKE_CURRENT_LIST_D...
Resolves rel_path against base_path and returns the result. If rel_path is an absolute path it is returned unchanged. Otherwise it is resolved against base_path and normalized. If the result is a relative path, it is forced to be relative to the CMakeLists.txt.
625941f423849d37ff7b36a7
def tmodel_ids_with_protocol(self, protocol=None, groups=None, **kwargs): <NEW_LINE> <INDENT> protocol = protocol or self.protocol <NEW_LINE> groups = self.check_parameters_for_validity(groups, "group", self.groups(protocol, add_world=False)) <NEW_LINE> return self.__model_id_list__(groups, 'for_tnorm', protocol)
Returns a list of T-Norm model ids for the specific query by the user. Parameters ---------- protocol : str or ``None`` The protocol to consider groups : str or [str] or ``None`` The groups to which the models belong ``('dev', 'eval')``. Returns ------- [str] A list containing all the T-Norm model ids belong...
625941f450485f2cf553d3b9
def get_image_id(ec2, image_name): <NEW_LINE> <INDENT> image = list(ec2.images.filter(Owners=['self'], Filters=[{'Name': 'name', 'Values': [image_name]}])) <NEW_LINE> if len(image) > 0: <NEW_LINE> <INDENT> return image[0].id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("requested AMI not found")
Given an AMI name, return the id of this AMI
625941f4f548e778e58cdb9d
def maybe_enqueue_notifications(user_profile_id, message_id, private_message, mentioned, stream_push_notify, stream_name, always_push_notify, idle, already_notified): <NEW_LINE> <INDENT> notified = dict() <NEW_LINE> if (idle or always_push_notify) and (private_message or mentioned or stream_push_notify): <NEW_LINE> <IN...
This function has a complete unit test suite in `test_enqueue_notifications` that should be expanded as we add more features here.
625941f41f037a2d8b946819
def __repr__(self): <NEW_LINE> <INDENT> return "Yang-Baxter graph of %s, with top vertex %s" % (self._partition, self._root)
EXAMPLES:: sage: Y = YangBaxterGraph(partition=[3,2]) sage: Y.__repr__() 'Yang-Baxter graph of [3, 2], with top vertex (1, 0, 2, 1, 0)'
625941f494891a1f4081c0c9
def __init__(self): <NEW_LINE> <INDENT> self._active = True <NEW_LINE> self._label = "" <NEW_LINE> self._name = ""
Represent a document through the object parameter. _active: Boolean that indicates if the document is active _label: file label _name: original filename
625941f4ac7a0e7691ed46dc
def test_package_resource(registry): <NEW_LINE> <INDENT> registry.scan_resource('metpy.plots', 'nexrad_tables') <NEW_LINE> assert 'cc_table' in registry
Test registry scanning package resource.
625941f44f88993c3716c67d
def compute_aps(self): <NEW_LINE> <INDENT> counts = defaultdict(lambda: 0) <NEW_LINE> gt_map = defaultdict(dict) <NEW_LINE> for sample_id, boxes in enumerate(self.gt_boxes): <NEW_LINE> <INDENT> boxes_by_class = defaultdict(list) <NEW_LINE> for box in boxes: <NEW_LINE> <INDENT> counts[box.label] += 1 <NEW_LINE> boxes_by...
Compute the average precision per class
625941f456ac1b37e62647df
def convert(self, s, numRows): <NEW_LINE> <INDENT> res = [[] for i in range(numRows)] <NEW_LINE> lens = len(s) <NEW_LINE> rows = min(numRows, len(s)) <NEW_LINE> down = False <NEW_LINE> curRow = 0 <NEW_LINE> for i in range(lens): <NEW_LINE> <INDENT> res[curRow]+=s[i] <NEW_LINE> if curRow == 0 or curRow == numRows - 1: <...
:type s: str :type numRows: int :rtype: str
625941f4d164cc617578336c
def set_layer_options(self, p_layer_options=None): <NEW_LINE> <INDENT> self._layer_options = {} <NEW_LINE> if p_layer_options is None: <NEW_LINE> <INDENT> for layer in self.project.mapLayers().values(): <NEW_LINE> <INDENT> self.add_layer(layer) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> for lname, options i...
Set the configuration options for the the project layers :param p_layer_options: dict of options for each layers if p_layer options is None, add all layers otherwise add layer for all layer names specified in p_layer_options
625941f45510c4643540f9f1
def import_db(): <NEW_LINE> <INDENT> data = [] <NEW_LINE> target = [] <NEW_LINE> with open('../dataset/db.csv', 'r') as csvfile: <NEW_LINE> <INDENT> reader = csv.DictReader(csvfile, delimiter=";") <NEW_LINE> for row in reader: <NEW_LINE> <INDENT> data.append(np.array([eval(row["x"]), eval(row["y"]), eval(row["z"])]).T)...
:return: the training examples (data) and list of event labels (target) from db.csv :rtype: np.array, shape = (len(data), len(target))
625941f426238365f5f0f493
@only_int_arguments <NEW_LINE> def add(x, y): <NEW_LINE> <INDENT> return x + y
Adds two numbers
625941f4b545ff76a8914432
def __init__(self, year, att="Cumul%20precip", index=0): <NEW_LINE> <INDENT> self.year = year <NEW_LINE> self.att = att <NEW_LINE> self.index = index <NEW_LINE> self.countrys = "('BRAZIL','ARGENTINA','CHINA','CANADA','UKRAINE','UNITED STATES','RUSSIA')" <NEW_LINE> self.engine = create_engine('mysql+pymysql://root:12345...
初始化变量
625941f4be8e80087fb21254
def set_AWSAccessKeyId(self, value): <NEW_LINE> <INDENT> super(PutBucketTaggingInputSet, self)._set_input('AWSAccessKeyId', value)
Set the value of the AWSAccessKeyId input for this Choreo. ((required, string) The Access Key ID provided by Amazon Web Services.)
625941f44e4d5625662d49eb
def get_agr_abbreviation_synonyms(self): <NEW_LINE> <INDENT> if self.title is not None: <NEW_LINE> <INDENT> self.agr_abbreviation_synonyms.append(self.miniref) <NEW_LINE> <DEDENT> return
Get abbreviations for the resource.
625941f4187af65679ca573d
def _check_exists(self, filter_str, url, target_key, get_id=True): <NEW_LINE> <INDENT> params = { 'query': filter_str } <NEW_LINE> response = self._generic_api_get(url, params) <NEW_LINE> if not response: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not get_id: <NEW_LINE> <INDENT> return True <NEW_LINE> <DED...
Generic method to run a search in the PagerDuty REST API and return the id of the first occurence from the results. Args: filter_str (str): The query filter to search for in the API url (str): The url to send the requests to in the API target_key (str): The key to extract in the returned results get_id...
625941f4236d856c2ad44e01
def inverse_normal_cdf(p: float, mu: float = 0, sigma: float = 1, tolerance: float = 0.00001) -> float: <NEW_LINE> <INDENT> if mu != 0 or sigma != 1: <NEW_LINE> <INDENT> return mu + sigma * inverse_normal_cdf(p, tolerance=tolerance) <NEW_LINE> <DEDENT> low_z = -10.0 <NEW_LINE> hi_z = 10.0 <NEW_LINE> while hi_z - low_...
Find approximate inverse using binary search
625941f401c39578d7e75458
@bp.route('/') <NEW_LINE> def home(): <NEW_LINE> <INDENT> stations = session.query(Station).all() <NEW_LINE> return render_template('home.html', stations=stations)
Home.
625941f4be7bc26dc91cdc11
def install(app, conf): <NEW_LINE> <INDENT> app.wsgi_app = keystone.middleware.auth_token.AuthProtocol(app.wsgi_app, conf=conf, ) <NEW_LINE> app.before_request(check) <NEW_LINE> return app
Install ACL check on application.
625941f457b8e32f52483abc
def get_website_text(url): <NEW_LINE> <INDENT> logging.debug("Making a request to {} in order to get the URL's text".format(url)) <NEW_LINE> headers = dict() <NEW_LINE> if CONFIG['user_agent'] is not None and CONFIG['user_agent'] != "": <NEW_LINE> <INDENT> headers['User-Agent'] = CONFIG['user_agent'] <NEW_LINE> <DEDENT...
Make a request to get the content of the given URL.
625941f43d592f4c4ed1d679
def test_a11y(self): <NEW_LINE> <INDENT> self.auth() <NEW_LINE> self.stub_catalog_api(programs=[self.program]) <NEW_LINE> self.cache_programs() <NEW_LINE> self.details_page.visit() <NEW_LINE> self.details_page.a11y_audit.check_for_accessibility_errors()
Test the page's a11y compliance.
625941f4cb5e8a47e48b80bc
def save_hsh(self, adr): <NEW_LINE> <INDENT> fichier.str2file(self.hash, adr)
Sauvegarde le hash
625941f4f8510a7c17cf9d1f
def test_022_playback_capture_file_slowdown(self): <NEW_LINE> <INDENT> assert playback_start(PlaybackTests.play_file_name, PlaybackTests.play_file_hash, 50) == 0 <NEW_LINE> begtime = time.time() <NEW_LINE> assert playback_wait() == 0 <NEW_LINE> endtime = time.time() <NEW_LINE> slowtime = (endtime - begtime) <NEW_LINE> ...
playback the capture file and wait for it to finish
625941f4091ae35668667571
@cliutils.arg( '--all-projects', dest='all_projects', action='store_true', default=False, help=_('Display server groups from all projects (Admin only).')) <NEW_LINE> def do_server_group_list(cs, args): <NEW_LINE> <INDENT> server_groups = cs.server_groups.list(args.all_projects) <NEW_LINE> _print_server_group_details(cs...
Print a list of all server groups.
625941f4adb09d7d5db6cda9
def __init__(self, *, machine): <NEW_LINE> <INDENT> super().__init__(machine=machine, fade_in=True) <NEW_LINE> self._push_schedule = False <NEW_LINE> self._img = self.sorcerer.get_resource('sprite_sheet') <NEW_LINE> _ball_region = self._img.get_region(32, 32, 64, 64) <NEW_LINE> _ball_region.anchor_x = _ball_region.widt...
Constructor Kwargs: machine(StateMachine): parent state machine
625941f4e1aae11d1e74a2db
def getWeightedEntropy(attributes_array): <NEW_LINE> <INDENT> for col_index in range(3,10): <NEW_LINE> <INDENT> temp_array = [ [(row[ci]) for ci in range(col_index, col_index+1)] for row in attributes_array ] <NEW_LINE> unique_array, unique_counts = numpy.unique(temp_array, return_counts=True) <NEW_LINE> weighted_entro...
This function computes the weighted entropy for attributes 4 to 10. :param attributes_array: the input 2D array :return: None
625941f4de87d2750b8603b7
def Distance(self, *args): <NEW_LINE> <INDENT> return _ogr.Geometry_Distance(self, *args)
Distance(Geometry self, Geometry other) -> double double OGR_G_Distance(OGRGeometryH hFirst, OGRGeometryH hOther) Compute distance between two geometries. Returns the shortest distance between the two geometries. The distance is expressed into the same unit as the coordinates of the geometries. This function is the ...
625941f430bbd722463cc3e7
def call_dispatcher(self, *args, **kwargs): <NEW_LINE> <INDENT> sickrage.LOGGER.debug("API :: all args: '" + str(args) + "'") <NEW_LINE> sickrage.LOGGER.debug("API :: all kwargs: '" + str(kwargs) + "'") <NEW_LINE> try: <NEW_LINE> <INDENT> cmds = kwargs.pop('cmd', args[0] if len(args) else "").split('|') or [] <NEW_LINE...
calls the appropriate CMD class looks for a cmd in args and kwargs or calls the TVDBShorthandWrapper when the first args element is a number or returns an error that there is no such cmd
625941f401c39578d7e75459
def test_normal_tab(self): <NEW_LINE> <INDENT> self.repl.s = "" <NEW_LINE> self.repl.config = Mock() <NEW_LINE> self.repl.config.tab_length = 4 <NEW_LINE> self.repl.complete = Mock() <NEW_LINE> self.repl.print_line = Mock() <NEW_LINE> self.repl.tab() <NEW_LINE> self.assertEqual(self.repl.s, " ")
make sure pressing the tab key will still in some cases add a tab
625941f4796e427e537b0be9
def var(self): <NEW_LINE> <INDENT> return (self.max_included - self.min_included) ** 2 / 12
Calculate variance value of the random variable. :return: variance value of the random variable.
625941f497e22403b379d5b9
def prior_r(h_params2): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> param = {'mu_x': _gauss_pos(*h_params2['mu_x']), 'sigma_x2': gammavariate(*h_params2['sigma_x2']), 'beta_y': gammavariate(*h_params2['beta_y']), 'beta_o': gammavariate(*h_params2['beta_o']),} <NEW_LINE> if param['beta_y'] < para...
Parameters ---------- h_params a hashmap with the hyperparameters Returns ------- A realization of the parameter
625941f47d847024c06be8df
def add_messages(email='study.ai_172@mail.ru', password='NextPassword172', n_messages=30, base_name='mail_inbox'): <NEW_LINE> <INDENT> client = MongoClient('localhost', 27017) <NEW_LINE> if base_name not in client.list_database_names(): <NEW_LINE> <INDENT> print(f'Создана база {base_name}!') <NEW_LINE> <DEDENT> db = cl...
функция обновляет базу входящих сообщений почтовика mail.ru. По умолчанию установлена база "mail_inbox", базу можно выбрать, если выбранной базы не существует, она будет создана. :param email: str, default: 'study.ai_172@mail.ru' :param password: str, default: 'NextPassword172' :param n_messages: int, default: 30 :par...
625941f426238365f5f0f494
def _check_task_compatibility(self, task): <NEW_LINE> <INDENT> if hasattr(task, "_case"): <NEW_LINE> <INDENT> if self._case != task._case: <NEW_LINE> <INDENT> raise ValueError( "Strategy <-> task mismatch: The chosen strategy is " "incompatible with the given task" ) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDEN...
Check compatibility of task with strategy
625941f45166f23b2e1a5777
def get_service_level_change_work_order_grid_first_row_work_order_name(self): <NEW_LINE> <INDENT> return self.get_text_from_element(self.service_level_grid_first_row_work_order_name_locator)
Implementing get service level change work order grid first row work order name functionality :return: column_value
625941f4d18da76e23532afc
def add_component(self, component, id=None, path=None, before=False, append=False): <NEW_LINE> <INDENT> if not id and not path: <NEW_LINE> <INDENT> if before: <NEW_LINE> <INDENT> self.components.append(component) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.components.insert(0, component) <NEW_LINE> <DEDENT> <DED...
Add component to existing layout can insert component before or after component :param component: :param id: component id :param path: component path, example: container.row.column6[1].panel :param append: append component to selected component from id or path :return:
625941f43317a56b8693a266
def options(self): <NEW_LINE> <INDENT> options = {} <NEW_LINE> for option in self.options: <NEW_LINE> <INDENT> options[option.name] = option.text() <NEW_LINE> <DEDENT> return options
Returns a list of all available options
625941f47d43ff24873a32c3
def fetch_token(self) -> None: <NEW_LINE> <INDENT> log.info("fetching a new reddit access token") <NEW_LINE> try: <NEW_LINE> <INDENT> response = self.http_client.post( url=self.ACCESS_TOKEN_URL, auth=(self.client_id, self.client_secret), data={ "grant_type": "https://oauth.reddit.com/grants/installed_client", "device_i...
Fetch a new token from the api
625941f4097d151d1a223474
def _process(table, name): <NEW_LINE> <INDENT> _02_first._process(table) <NEW_LINE> table.name = name <NEW_LINE> table.var = _03_thinkstats._var(table.lengths, table.mu) <NEW_LINE> table.trim = _03_thinkstats._trimmed_mean(table.lengths) <NEW_LINE> table.hist = _04_Pmf._make_hist_from_list(table.lengths, name=name) <NE...
Runs various analyses on this table.
625941f40383005118ecfbfe
def cn(self, name): <NEW_LINE> <INDENT> if name.startswith('wxBITMAP_TYPE_') or name.startswith("wxDefault") or name.startswith('wxSYS_COLOUR_'): <NEW_LINE> <INDENT> return name <NEW_LINE> <DEDENT> if "_" in name: <NEW_LINE> <INDENT> start = name.split("_",1)[0] <NEW_LINE> if start in {'wxART', 'wxBORDER', 'wxBRUSHSTYL...
Return the name properly formatted; see: self._perl_constant_list
625941f4627d3e7fe0d69470
def compare(self, val1, val2): <NEW_LINE> <INDENT> if (val1 in self.missing_values) or (val2 in self.missing_values): <NEW_LINE> <INDENT> return self.missing_weight <NEW_LINE> <DEDENT> if (self.do_caching == True): <NEW_LINE> <INDENT> cache_weight = self.__get_from_cache__(val1, val2) <NEW_LINE> if (cache_weight != Non...
Compare two field values using the Smith-Waterman distance approximate string comparator.
625941f491f36d47f21acb17
def p_annotations(p): <NEW_LINE> <INDENT> if len(p) == 1: <NEW_LINE> <INDENT> p[0] = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = p[2]
annotations : BACKSLASH id_list BACKSLASH |
625941f4d486a94d0b98e764
def get_connected_devices(self): <NEW_LINE> <INDENT> return self.command('get_connected_devices', multiline=True)
This command will return a list of the devices currently connected to the computer. The connected device will have the return parameter ACTIVE at the end of the line.
625941f46fb2d068a760f6c5
def checkResult(self): <NEW_LINE> <INDENT> self.info = self.return_json.json() <NEW_LINE> common_1.show_return_msg(self.return_json) <NEW_LINE> if self.result == '0': <NEW_LINE> <INDENT> self.assertEqual(self.info['code'], self.code) <NEW_LINE> self.assertEqual(self.info['msg'], self.msg) <NEW_LINE> self.assertIsNotNon...
:return:
625941f48e05c05ec3eea998
def processCommand(self, command, *args): <NEW_LINE> <INDENT> if self.blocked is not None: <NEW_LINE> <INDENT> self.blocked.append((command, args)) <NEW_LINE> return <NEW_LINE> <DEDENT> command = command.upper() <NEW_LINE> authCmd = command in self.AUTH_CMDS <NEW_LINE> if not self.mbox and not authCmd: <NEW_LINE> <INDE...
Dispatch a command from the client for handling. @type command: L{bytes} @param command: A POP3 command. @type args: L{tuple} of L{bytes} @param args: Arguments to the command. @raise POP3Error: When the command is invalid or the command requires prior authentication which hasn't been performed.
625941f44e696a04525c9a6c
def _get_sequence_length(self, input_, mask): <NEW_LINE> <INDENT> if mask is not None: <NEW_LINE> <INDENT> int_mask = tf.keras.backend.cast(mask, tf.int8) <NEW_LINE> sequence_length = self.mask_to_sequence_length(int_mask) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> input_energy_shape = tf.shape(input_) <NEW_LINE> ra...
Currently underline CRF fucntion (provided by tensorflow_addons.text.crf) do not support bi-direction masking (left padding / right padding), it support right padding by tell it the sequence length. this function is compute the sequence length from input and mask.
625941f47047854f462a1a20
def reverse(n): <NEW_LINE> <INDENT> return int(str(n)[::-1])
Reverse a number
625941f44c3428357757c941
def test_4_invalid_smf_fmri(self): <NEW_LINE> <INDENT> some_fake_file = os.path.join(self.test_root, "tmp", "some_fake_file") <NEW_LINE> self.make_misc_files(["tmp/some_fake_file"]) <NEW_LINE> tmp_dir = os.path.join(self.test_root, "tmp") <NEW_LINE> for invalid_fmri in ["svc:", "svc://notexist", some_fake_file]: <NEW_L...
We return an error given an invalid pkg/depot smf fmri.
625941f4f9cc0f698b140c14
def portals_id_portal_members_post_with_http_info(self, id, **kwargs): <NEW_LINE> <INDENT> all_params = ['id', 'data'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> ...
Creates a new instance in portalMembers of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.portal...
625941f491f36d47f21acb18
def _get_url(self): <NEW_LINE> <INDENT> length = api.SrvGetURL(self._handle, None, 0) <NEW_LINE> library.check_last_status_raise_on_error() <NEW_LINE> buf = create_string_buffer(length + 1) <NEW_LINE> api.SrvGetURL(self._handle, buf, length) <NEW_LINE> library.check_last_status_raise_on_error() <NEW_LINE> return buf.va...
URL of the specified network instrument or instrument server.
625941f48c3a8732951589e1
def on_select(self): <NEW_LINE> <INDENT> self.select_file(_default_extension = ".xml", _file_types=[('.xml files', '.xml'), ('all files', '.*')])
Brings up a selector dialog, prompting the user to select a file, the relative path if the file is then saved to the filename property. Also, the base path is set.
625941f4baa26c4b54cb1737
def wic_slot_available(self, wic_slot_id): <NEW_LINE> <INDENT> if self._wics[wic_slot_id] == None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
Checks if a WIC slot is available :returns: True is the WIC slot is available, False otherwise.
625941f476d4e153a657f150
def correct_syntax(s, num) : <NEW_LINE> <INDENT> if num == 0: return True <NEW_LINE> elif num == 1 and s.isdigit() and len(s) == 15: return True <NEW_LINE> elif num == 2 and s.isdigit() and len(s) == 15: return True <NEW_LINE> elif num == 3 and s.isdigit(): return True <NEW_LINE> elif num == 4 or num == 5 or num == 6 o...
檢查修改的資料有沒有格式上的錯誤 :param s: 要檢查的字串 :param num: list中第幾個
625941f46fece00bbac2dd64
def parse_rss(url): <NEW_LINE> <INDENT> rss=ElementTree(file=urlopen(url)) <NEW_LINE> root=rss.getroot() <NEW_LINE> rsslist=[] <NEW_LINE> for item in [ x for x in root.getiterator() if "item" in x.tag]: <NEW_LINE> <INDENT> rssdict={} <NEW_LINE> for elem in item.getiterator(): <NEW_LINE> <INDENT> for k in ['link', 'titl...
RSS 2.0をパースして、辞書のリストを返す
625941f48a43f66fc4b5467c
def build_city_candidates(self): <NEW_LINE> <INDENT> candidates = [] <NEW_LINE> for s in [x for x in self.settlements if x.team == self.team and x.contents == Settlement.TOWN]: <NEW_LINE> <INDENT> candidates.append(s) <NEW_LINE> <DEDENT> return candidates
Return the list of all settlements that are valid candidates for being upgraded to city
625941f4fff4ab517eb2fa5f
def read_rs_points(self) -> List[RsPointModel]: <NEW_LINE> <INDENT> p = Table('askue_rs_point', alias='p') <NEW_LINE> q = (Q.from_(p) .select(p.id, p.object_name, p.fes, p.res, p.ps, p.vl, p.tp, p.sch, p.rv, p.str_ra, p.rxx, p.ktt, p.locality, p.number_point, p.driver, p.country)) <NEW_LINE> sql_query = q.get_sql() <NE...
Выполняет чтение всех точек учета распределительных сетей :return: массив точек учета
625941f421bff66bcd684f6b
def atomic_write_string_to_file(filename, contents, overwrite): <NEW_LINE> <INDENT> temp_pathname = (tf.compat.as_bytes(filename) + tf.compat.as_bytes(".tmp") + tf.compat.as_bytes(uuid.uuid4().hex)) <NEW_LINE> with tf.gfile.GFile(temp_pathname, mode="w") as f: <NEW_LINE> <INDENT> f.write(contents) <NEW_LINE> <DEDENT> t...
Writes to `filename` atomically. This means that when `filename` appears in the filesystem, it will contain all of `contents`. With write_string_to_file, it is possible for the file to appear in the filesystem with `contents` only partially written. Accomplished by writing to a temp file and then renaming it. Args: ...
625941f431939e2706e4d47f
def render_template(jinja_env, jinja_ctx, src_file, dest_file): <NEW_LINE> <INDENT> template = jinja_env.get_template(src_file) <NEW_LINE> try: <NEW_LINE> <INDENT> with open(dest_file, 'w') as f: <NEW_LINE> <INDENT> f.write(template.render(jinja_ctx)) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> raise
Render a jinja template :param jinja_env: a jinja2.Environment object :param jinja_ctx: the dictionary providing rendering context :param src_file: the source template :param dest_file: the destination path
625941f430bbd722463cc3e8
def getBB(self): <NEW_LINE> <INDENT> return self.bb
**SUMMARY** Get the bounding box **RETURNS** A tuple - (x, y, w, h) **EXAMPLE** >>> track = Tracking(img, bb) >>> print track.getBB()
625941f4e8904600ed9f2556
def showTargetColumn(self, **kwargs: object) -> bool: <NEW_LINE> <INDENT> project: Project = getattr(kwargs['proc'], 'project') <NEW_LINE> return project.showTargets
Returns True iff the target column should be included. Default implementation returns True iff there are multiple targets defined for this project.
625941f4498bea3a759ba0cc
def lengthOfLastWord(self, s): <NEW_LINE> <INDENT> if len(s.split()) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return len(s.split()[-1])
:type s: str :rtype: int
625941f40c0af96317bb8805
def process_ab_partitions_txt(framework_target_files_temp_dir, vendor_target_files_temp_dir, output_target_files_temp_dir): <NEW_LINE> <INDENT> framework_ab_partitions_txt = os.path.join(framework_target_files_temp_dir, 'META', 'ab_partitions.txt') <NEW_LINE> vendor_ab_partitions_txt = os.path.join(vendor_target_files_...
Perform special processing for META/ab_partitions.txt. This function merges the contents of the META/ab_partitions.txt files from the framework directory and the vendor directory, placing the merged result in the output directory. The precondition in that the files are already extracted. The post condition is that the...
625941f48a349b6b435e8791
def stateString(self): <NEW_LINE> <INDENT> raise NotImplementedError('subclasses must override stateString()!')
Print the current state as a string
625941f47d43ff24873a32c4
def get_template_object_name(self, obj): <NEW_LINE> <INDENT> if hasattr(obj, '_meta'): <NEW_LINE> <INDENT> return re.sub('[^a-zA-Z0-9]+', '_', obj._meta.verbose_name.lower()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.template_object_name
Get the name to use for the object.
625941f4596a89723608a0d6
def to_fixture(json_dict: dict) -> Fixture: <NEW_LINE> <INDENT> if json_dict is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> fixture_url = json_dict['_links']['self']['href'] <NEW_LINE> fixture_id = fixture_url[fixture_url.rfind('/') + 1:] <NEW_LINE> competition_url = json_dict['_links']['competition']['hr...
Converts json dictionary to Fixture object :param json_dict: :return:
625941f4851cf427c661ab28
def do_cont(self, args): <NEW_LINE> <INDENT> return self.send('cont ' + args)
send continue command to first user process
625941f4a8ecb033257d36e9
def __init__(self): <NEW_LINE> <INDENT> self.host_address = (gethostname(), 8585) <NEW_LINE> self.tcp_backlog = 5 <NEW_LINE> self.host_sock = socket() <NEW_LINE> self.username = None
The class that contains client related functionality.
625941f4442bda511e8bea2d
def _image2data(img: np.ndarray) -> np.array: <NEW_LINE> <INDENT> return img.reshape((img.shape[0] * img.shape[1], img.shape[2]))
Transform image into data suitable for clusteringself. Image is read as a 3D tensor, but clusteing requires 2D tensor with each row corresponding to a single point. Args: img: image to tranform. Returns: Image as a 2D tensor.
625941f4b830903b967e9f22
def generate_confirmation_token(self, expiration=3600): <NEW_LINE> <INDENT> s = Serializer(current_app.config['SECRET_KEY'], expires_in=expiration) <NEW_LINE> return s.dumps({'confirm': self.id})
生成一个验证用token 持续时间为1天
625941f466656f66f7cbc7cc
def sanity_numericalDerivative(self): <NEW_LINE> <INDENT> from .numericalDerivatives import diffCFD <NEW_LINE> import numpy as np <NEW_LINE> x = np.linspace(-10,10,1000) <NEW_LINE> y = [np.poly1d((0.03, -0.31, 0.4, 0.35, 1.4))] <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> y.append(y[-1].deriv()) <NEW_LINE> <DEDENT...
mtools: Checking accuracy of numerical derivatives.
625941f4009cb60464c639cb
@jax.vmap <NEW_LINE> def sigmoid_cross_entropy_loss(logits, targets): <NEW_LINE> <INDENT> log_p = jax.nn.log_sigmoid(logits) <NEW_LINE> log_not_p = jax.nn.log_sigmoid(-logits) <NEW_LINE> return -jnp.sum(targets * log_p + (1. - targets) * log_not_p, axis=-1)
Sigmoid cross entropy (A.K.A. binary cross entropy). This implementation is numerically stable and this loss function can be used in case of binary classification or multi-class classification. Args: logits: float array; Output of model in shape `[ ..., num_classes]`. targets: int array; Labels with shape `[......
625941f4f7d966606f6aa62a
def getFeed(self): <NEW_LINE> <INDENT> entries_xml = [] <NEW_LINE> for entry in self.middleware.entries: <NEW_LINE> <INDENT> request = entry['request'] <NEW_LINE> response = entry.get('response') <NEW_LINE> begin = time.localtime(request['begin']) <NEW_LINE> entry_id = self._generateEntryTagURI(entry) <NEW_LINE> entry_...
Get XML representing information in the middleware
625941f4925a0f43d254a49c
def crawl_proxy360(self, page_count=5): <NEW_LINE> <INDENT> start_url = "http://www.swei360.com/?page={}" <NEW_LINE> urls = [start_url.format(pageNum) for pageNum in range(1, page_count + 1)] <NEW_LINE> for url in urls: <NEW_LINE> <INDENT> html = requests.get(url, headers=headers) <NEW_LINE> if html.status_code == 200:...
获取360代理 :return: 代理
625941f499fddb7c1c9de9ac
def check_whatsapp_contact( self, channel: str, phone_number: str ) -> Optional[str]: <NEW_LINE> <INDENT> result = self.check_whatsapp_contacts(channel, [phone_number]) <NEW_LINE> try: <NEW_LINE> <INDENT> checked = result[phone_number] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> checked = None <NEW_LINE> <...
Check a single phone number.
625941f410dbd63aa1bd31c1
def parse(string): <NEW_LINE> <INDENT> return edn(string).edn()
Parse a single edn element. Returns an abstract representation of a single edn element.
625941f4507cdc57c6307309
def validate_properties(self, entity_type=None, display_name=None, mail_nickname=None, on_behalf_of_userid=None): <NEW_LINE> <INDENT> payload = { "entityType": entity_type, "displayName": display_name, "mailNickname": mail_nickname, "onBehalfOfUserId": on_behalf_of_userid } <NEW_LINE> qry = ServiceOperationQuery(self, ...
Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies. Clients can use this API to determine whether a display name or mail nickname is valid before trying to create a Microsoft 365 group. To validate the properties of an existing group, use the group: validateProperties func...
625941f4dc8b845886cb5b56
def clean_password2(self): <NEW_LINE> <INDENT> if 'password' not in self.cleaned_data or self.cleaned_data['password2'] == self.cleaned_data['password']: <NEW_LINE> <INDENT> return self.cleaned_data['password2'] <NEW_LINE> <DEDENT> raise forms.ValidationError(_("Password does not match."))
Password2 cleaner (password confirmation) Check that password equals password2
625941f463b5f9789fde7705
def getNonInstallableProfiles(self): <NEW_LINE> <INDENT> return [ 'collective.behaviors:uninstall', ]
Hide uninstall profile from site-creation and quickinstaller
625941f401c39578d7e7545a
def ModelingData(X, y, n_folds): <NEW_LINE> <INDENT> return (X, y, n_folds)
Function to stitch Features(X), Response Variable(y) and n_folds for modeling X and y must ba arrays
625941f4f8510a7c17cf9d20
def trackMidiText(name, ln): <NEW_LINE> <INDENT> if not ln: <NEW_LINE> <INDENT> error("Use: %s Text" % name) <NEW_LINE> <DEDENT> ln = ' '.join(ln) <NEW_LINE> gbl.tnames[name].midiPending.append(("MIDITEXT", gbl.tickOffset, ln)) <NEW_LINE> if gbl.debug: <NEW_LINE> <INDENT> print("Set %s MIDIText '%s'." % (name, ln))
Insert midi text event.
625941f43d592f4c4ed1d67b
def run_parallel(*pipes): <NEW_LINE> <INDENT> def parallel_runner(): <NEW_LINE> <INDENT> return parallel(*pipes) <NEW_LINE> <DEDENT> return parallel_runner
A wrapper to make the parallel function play nice with pipes it currently does not support passing args to pipes open function
625941f430c21e258bdfaac4
@app.task <NEW_LINE> def create_container(container_id): <NEW_LINE> <INDENT> command = [BASH, SCRIPT_ROOT_DIR_PATH + 'condeploy.sh', '-H', str(container_id)] <NEW_LINE> try: <NEW_LINE> <INDENT> process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) <NEW_LINE> if process.returncode != 0: <NEW_...
Dockerホスト上にContainerを作成します。
625941f4adb09d7d5db6cdab
def error(self, message): <NEW_LINE> <INDENT> pass
Called by the STOMP connection when an ERROR frame is received. :param message: the message received from server
625941f4be383301e01b5a98
def fit(self, X: pd.DataFrame, y: np.ndarray, batch_size: int = 32, epochs: int = 20) -> None: <NEW_LINE> <INDENT> dataset = self._preprocessor.preprocess_fit(X, y, batch_size=batch_size) <NEW_LINE> dataset_spec = self._preprocessor.get_dataset_spec(dataset) <NEW_LINE> if self._model is None: <NEW_LINE> <INDENT> self._...
Fit on training data. Notes: The input of the model is determined by the features metadata. If a model has already been found (by hyperparameter tuning for example), the fitting is done on this model, else on the model with the default hyperparameters. Args: X: Input features. y: Ground truth labe...
625941f407f4c71912b11aa4
def _as_float_array(x, check_finite=False): <NEW_LINE> <INDENT> x = np.ascontiguousarray(x) <NEW_LINE> dtyp = _get_dtype(x.dtype) <NEW_LINE> x = x.astype(dtyp, copy=False) <NEW_LINE> if check_finite and not np.isfinite(x).all(): <NEW_LINE> <INDENT> raise ValueError("Array must not contain infs or nans.") <NEW_LINE> <DE...
Convert the input into a C contiguous float array. NB: Upcasts half- and single-precision floats to double precision.
625941f4f7d966606f6aa62b
def test_logout_required_logged_in(self): <NEW_LINE> <INDENT> email = 'test@example.com' <NEW_LINE> name = 'John Doe' <NEW_LINE> user = User(email, name) <NEW_LINE> db.session.add(user) <NEW_LINE> db.session.commit() <NEW_LINE> login_user(user) <NEW_LINE> redirect_function = logout_required(self.view_function) <NEW_LIN...
Test the `logout_required` decorator with a logged-in user. Expected result: The redirect response to the home page is returned.
625941f4fbf16365ca6f67f1
def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(**kwargs) <NEW_LINE> if self.survey_schedule_object: <NEW_LINE> <INDENT> context.update( survey_schedule=self.survey_schedule_object.field_value, survey_schedule_object=self.survey_schedule_object, survey_schedules=self.survey_...
Add survey and survey_schedule objects to the context.
625941f42eb69b55b151ced8
def multiple_testing_correction(pvalues, correction_type="FDR"): <NEW_LINE> <INDENT> from numpy import array, empty <NEW_LINE> pvalues = array(pvalues) <NEW_LINE> sample_size = pvalues.shape[0] <NEW_LINE> qvalues = empty(sample_size) <NEW_LINE> if correction_type == "Bonferroni": <NEW_LINE> <INDENT> qvalues = sample_si...
Consistent with R - print correct_pvalues_for_multiple_testing([0.0, 0.01, 0.029, 0.03, 0.031, 0.05, 0.069, 0.07, 0.071, 0.09, 0.1])
625941f47c178a314d6efa8a
def add_header_info(self, header, mode, **kwargs): <NEW_LINE> <INDENT> header = super().add_header_info(header, mode) <NEW_LINE> info = self.load_info() <NEW_LINE> return header
read data from header and add it as REDUCE keyword back to the header
625941f43cc13d1c6d3c7996
def host_names(self): <NEW_LINE> <INDENT> return ', '.join([host.name for host in self.hosts.all()])
Returns a formatted list of the hosts of a job.
625941f4de87d2750b8603b9
def capa(x,y,lamda,s,p,A,n,k,MU): <NEW_LINE> <INDENT> out = np.dot((A(x,lamda,s,p)-MU*np.eye(int(comb(n,k)))), y) <NEW_LINE> return out
Returns the value y'(x) of the first order system y' = (A(x,lambda)-(mu)*Identity)*y Input x is the value where y'(x) is evaluated, y is the vector y(x), lamda is the point in the complex plane where the Evans function is evaluated, s,p are structures explained in the STABLAB documentation, A is a function handl...
625941f445492302aab5e8e9
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> if 'id' in kwargs: <NEW_LINE> <INDENT> del kwargs['id'] <NEW_LINE> <DEDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.created = datetime.datetime.utcnow() <NEW_LINE> self.email_confirmed = False <NEW_LINE> self.failed_logins = 0
Instantiate with optional keyword data to set
625941f42ae34c7f2600d74f
def remove(self, **kw): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> db.session.delete(self) <NEW_LINE> db.session.commit() <NEW_LINE> return True <NEW_LINE> <DEDENT> except DatabaseError as e: <NEW_LINE> <INDENT> db.session.rollback() <NEW_LINE> application.logger.error("Remove error: {}".format(e)) <NEW_LINE> return ...
Deletes object
625941f401c39578d7e7545b
def p_file_comment_1(self, p): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if six.PY2: <NEW_LINE> <INDENT> value = p[2].decode(encoding='utf-8') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> value = p[2] <NEW_LINE> <DEDENT> self.builder.set_file_comment(self.document, value) <NEW_LINE> <DEDENT> except OrderError: <NEW...
file_comment : FILE_COMMENT TEXT
625941f4046cf37aa974d360
def test_approved_verification_expiry_date(self): <NEW_LINE> <INDENT> user = UserFactory.create() <NEW_LINE> self.create_and_submit(user) <NEW_LINE> approved_verification = self.create_and_submit(user) <NEW_LINE> approved_verification.status = 'approved' <NEW_LINE> approved_verification.save() <NEW_LINE> expected_date ...
Tests that the command correctly updates expiry_date Criteria : Verification for which status is approved and expiry_date is null
625941f4796e427e537b0beb
@when('we stop container {container_name}') <NEW_LINE> def step_stop_container(context, container_name): <NEW_LINE> <INDENT> context.cli.sendline('stop {0}'.format(container_name))
Send "stop" command.
625941f4596a89723608a0d7
def test_MMParser_Dataset(): <NEW_LINE> <INDENT> f = 'HeLa_Control_A750_1_MMStack_Pos0_locMetadata.json' <NEW_LINE> inputFile = testDataRoot / Path('parsers_test_files') / Path(f) <NEW_LINE> datasetType = 'LocMetadata' <NEW_LINE> mmParser = leb.MMParser() <NEW_LINE> mmParser.parseFilename(inputFile, datasetType) <NEW_L...
MMParser returns the correct Dataset.
625941f4d7e4931a7ee9e53f
def process_section_automatic_or_recognition(self): <NEW_LINE> <INDENT> section_is_recognition = False <NEW_LINE> section_is_automatic_credit = False <NEW_LINE> self.report_text = progress_upto(self.report_text, match_everything_upto['automatic_or_recognition']) <NEW_LINE> section_is_automatic_credit = regex_handler.ch...
handles the sections "automatic credit" and "recognition for prior learning". both sections specify units in the same format, and therefor is possible to parse in the same manner. since the "automatic credit" section comes first on curtin's progress reports, this section is handled first if it exists. once it's process...
625941f45e10d32532c5f544