code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@pytest.fixture(scope='function', name='cause') <NEW_LINE> def cause_mock(mocker): <NEW_LINE> <INDENT> cause = mocker.patch.object(Cause, 'push') <NEW_LINE> return cause
Mock cause for unit testing.
625941f0462c4b4f79d1dc6f
def test_getErr(self): <NEW_LINE> <INDENT> self.assertEqual(self.toas[-1].getErr(), 0.381)
Test getErr()
625941f0097d151d1a2233f6
def vrotv(v, axis, theta): <NEW_LINE> <INDENT> v = stypes.toDoubleVector(v) <NEW_LINE> axis = stypes.toDoubleVector(axis) <NEW_LINE> theta = ctypes.c_double(theta) <NEW_LINE> r = stypes.emptyDoubleVector(3) <NEW_LINE> libspice.vrotv_c(v, axis, theta, r) <NEW_LINE> return stypes.vectorToList(r)
Rotate a vector about a specified axis vector by a specified angle and return the rotated vector. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vrotv_c.html :param v: Vector to be rotated. :type v: 3-Element Array of Floats. :param axis: Axis of the rotation. :type axis: 3-Element Array of Floats. :param ...
625941f0379a373c97cfb0e7
def __getitem__(self, key): <NEW_LINE> <INDENT> return getattr(self.link, key)
Allow dict access to Link attributes
625941f073bcbd0ca4b2c615
def expand_logic_levels(logic_levels, count): <NEW_LINE> <INDENT> if count >= 3: <NEW_LINE> <INDENT> step = (logic_levels[1] - logic_levels[0]) / (count - 1) <NEW_LINE> return [logic_levels[0]] + [logic_levels[0] + i * step for i in xrange(1, count-1)] + [logic_levels[1]] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> r...
Generate evenly spaced logic levels logic_levels ((float, float)) A 2-tuple (low, high) representing the min and max logic level to expand on count (int) The number of logic levels in the result. If the value is less than 3, the result is the same as the sequence passed as logic_levels. Returns a list of...
625941f071ff763f4b549c36
def save_filename(**kw): <NEW_LINE> <INDENT> fn = kw['path'] + "/" + kw['prefix'] + "/" + kw['prefix'] + "_" + str(kw['ul']) + "_" + str(kw['lr']) <NEW_LINE> if kw['suffix'] != "": <NEW_LINE> <INDENT> fn += "_" + kw['suffix'] <NEW_LINE> <DEDENT> if not kw['isnp']: <NEW_LINE> <INDENT> fn += "_" + "sp" <NEW_LINE> ...
Return the path to write a save file to, based on the input parameters.
625941f0a4f1c619b28b05cb
def get_table_header(self, table_name): <NEW_LINE> <INDENT> table_info = self.curs.execute('PRAGMA table_info({0})'.format(table_name)) <NEW_LINE> db_columns = {} <NEW_LINE> for index, name, data_type, notnull, dflt_value, pk in table_info: <NEW_LINE> <INDENT> db_columns[name.encode(DEFAULT_ENCODING)] = index <NEW_LINE...
get the column names (e.g. title, year, authors) and their index from the books table of the db and return them as a dictionary. @param table_name: name of a database table, e.g. 'books' @type table_name: C{str} @return: a dictionary, which contains the names of the table columns as keys and their index as values @rt...
625941f0baa26c4b54cb16b9
def check(self, check_id, stopwatch=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> m = imaplib.IMAP4_SSL(self.imap_server) <NEW_LINE> m.login(self.login, self.password) <NEW_LINE> data=[b''] <NEW_LINE> while data == [b'']: <NEW_LINE> <INDENT> if stopwatch != None: <NEW_LINE> <INDENT> if stopwatch.gettime() > self....
docstring for check
625941f0004d5f362079a8cf
def calculate_degree_centrality(self): <NEW_LINE> <INDENT> values = nx.degree_centrality(self.graph) <NEW_LINE> nx.set_node_attributes(self.graph, 'degree', values)
Calculates degree centrality for every node of graph. For undirected graphs only.
625941f007d97122c4178e39
def _main(): <NEW_LINE> <INDENT> parsers = get_arg_parser() <NEW_LINE> args = parsers['main'].parse_args() <NEW_LINE> if is_dbus_required(args) and dbus is None: <NEW_LINE> <INDENT> LOGGER.error('To use any of the daemon functionality, "dbus-python" ' 'is required.') <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT> usr = use...
Entrypoint for dups.
625941f06fece00bbac2dce6
def wait_for_service_status(self, location, status, abort_on_status=None, retry_interval=2, retry_timeout=30): <NEW_LINE> <INDENT> current_status = '' <NEW_LINE> start_time = int(time.time()) <NEW_LINE> stop_time = start_time + retry_timeout <NEW_LINE> while current_status.lower() != status.lower(): <NEW_LINE> <INDENT>...
Waits for a service to reach a given status.
625941f026068e7796caf288
def main(q_tlm): <NEW_LINE> <INDENT> pygame.init() <NEW_LINE> tlm = telemetry.Telemetry("MOSK - Mobile Operational System Kamikaze") <NEW_LINE> Gloss.screen_resolution = 1024,768 <NEW_LINE> Gloss.enable_multisampling = True <NEW_LINE> pygame.mouse.set_visible(True) <NEW_LINE> tlm.init(q_tlm) <NEW_LINE> tlm.run()
Запускает отрисовку телеметрии и пробрасывает в нее очередь сообщений.
625941f085dfad0860c3b3fd
def _merge_servicemethods(self): <NEW_LINE> <INDENT> if self.service: <NEW_LINE> <INDENT> for store in self.get_option('stores'): <NEW_LINE> <INDENT> if not store.service: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> for name, method in list(store.service.methods.items()): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDEN...
Merges the declared service methods from multiple stores into a single store. The store reference on each method will still point to the original store.
625941f05510c4643540f976
def __init__(self, scraper, web, whatif_id): <NEW_LINE> <INDENT> self.web = web <NEW_LINE> self.scraper = scraper <NEW_LINE> self.whatif_id = whatif_id <NEW_LINE> logger.info("Getting what if {id}".format(id=self.whatif_id)) <NEW_LINE> url = "http://what-if.xkcd.com/{id}/".format(id=self.whatif_id) <NEW_LINE> response ...
Worker Profile Run for each item that needs parsing Each thread has a web instance that is used for parsing
625941f0fbf16365ca6f6770
def write_readinto(self: "MicroBitSPI", write_buffer: Union[str, bytes, bytearray], read_buffer: Union[str, bytes, bytearray], ) -> None: <NEW_LINE> <INDENT> pass
Write the content of ``write_buffer`` to the bus and read any response into the ``read_buffer``. For each byte written, one byte is also read. Thus, the ``read_buffer`` should be at least as big as the ``write_buffer``. The buffers can be the same object. Call ``init()`` before using the SPI.
625941f076d4e153a657f0d2
def to_http_info(self, config): <NEW_LINE> <INDENT> if self.drawing_data is None: <NEW_LINE> <INDENT> raise ValueError("Missing the required parameter `drawing_data` when calling `put_drawing_svg`") <NEW_LINE> <DEDENT> collection_formats = {} <NEW_LINE> path = '/cad/svg' <NEW_LINE> path_params = {} <NEW_LINE> query_par...
Prepares initial info for HTTP request :param config: CAD API configuration :type: asposecadcloud.Configuration :return: http_request configured http request :rtype: Configuration.models.requests.HttpRequest
625941f0a8ecb033257d366b
def test_getTranslation(self): <NEW_LINE> <INDENT> for seqs in [ {'seq1': 'GATTTT', 'seq2': 'GATC??'}, {'seq1': 'GAT---', 'seq2': '?GATCT'}]: <NEW_LINE> <INDENT> alignment = self.Class(data=seqs, MolType=DNA) <NEW_LINE> self.assertEqual(len(alignment.getTranslation()), 2) <NEW_LINE> alignment = self.Class(data=seqs) <N...
SequenceCollection.getTranslation translates each seq
625941f0d268445f265b540f
def cancel_move(self,cr,uid,ids, *args): <NEW_LINE> <INDENT> ids = isinstance(ids, (int, long)) and [ids] or ids <NEW_LINE> am_obj = self.pool.get('account.move') <NEW_LINE> for ret in self.browse(cr, uid, ids): <NEW_LINE> <INDENT> if ret.state == 'done': <NEW_LINE> <INDENT> for ret_line in ret.line_ids: <NEW_LINE> <IN...
Delete move lines related with withholding vat and cancel
625941f0b545ff76a89143b6
def get_fields(): <NEW_LINE> <INDENT> get_fields_as_list = [] <NEW_LINE> list_of_widgets = widgets_entry["name"].get(), widgets_entry["last_name"].get(), widgets_entry["phone"].get(), widgets_entry["adress"].get(), widgets_entry["city"].get() <NEW_LINE> get_fields_as_list = Individu.insert_individu(list_of_widgets) <NE...
get fields from the Tkinter entry and save informations about a given "individu" Parameters ---------- None
625941f0046cf37aa974d2e2
def combinationSum2(self, candidates, target): <NEW_LINE> <INDENT> def helper(candi,target,path): <NEW_LINE> <INDENT> if target<0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif target==0: <NEW_LINE> <INDENT> if path not in self.ans: <NEW_LINE> <INDENT> self.ans.append(path) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW...
:type candidates: List[int] :type target: int :rtype: List[List[int]]
625941f060cbc95b062c6ae4
def p_union_patterns_1(p): <NEW_LINE> <INDENT> p[0] = []
union_patterns : empty
625941f05fc7496912cc3f1e
def make_patch(tissue_mask): <NEW_LINE> <INDENT> slide = openslide.OpenSlide(cf.demo_slide_path) <NEW_LINE> p_size = hp.patch_size <NEW_LINE> width, height = np.array(slide.level_dimensions[0])//304 <NEW_LINE> total = width * height <NEW_LINE> all_cnt, patch_cnt = 0,0 <NEW_LINE> step = int(p_size/(2**MASK_LV)) <NEW_LIN...
extract patches in the whole slide using tissue mask return patch list and patch location Args: tissue_mask (numpy array): tissue mask list
625941f0796e427e537b0b6b
def move_player(self, mark, old_position, new_position): <NEW_LINE> <INDENT> condition_to_move = not self._check_position(old_position) or not self._check_position(new_position) <NEW_LINE> try: <NEW_LINE> <INDENT> condition_position = self._table[old_position] != mark or self._table[new_position] != self._free_position...
Moves player from old_position to new_position. Returns true if move is successful, else false.
625941f0cdde0d52a9e535d8
def windowfunction(length, type="hamming", debug=False): <NEW_LINE> <INDENT> if type == "hamming": <NEW_LINE> <INDENT> return hamming(length, debug=debug) <NEW_LINE> <DEDENT> elif type == "hann": <NEW_LINE> <INDENT> return hann(length, debug=debug) <NEW_LINE> <DEDENT> elif type == "blackmanharris": <NEW_LINE> <INDENT> ...
Returns a window function of the specified length and type. Once calculated, windows are cached for speed. Parameters ---------- length : int The length of the window function :param length: type : {'hamming', 'hann', 'blackmanharris'}, optional Window type. Choices are 'hamming' (default), 'hann', and...
625941f03d592f4c4ed1d5fe
def test_readExcel(self): <NEW_LINE> <INDENT> driver = self.driver <NEW_LINE> self.import_vlrnumber() <NEW_LINE> path_filenum_history = nu(self, num=0, path=r"C:\Users\renqiwei\Downloads") - 1 <NEW_LINE> print(path_filenum_history, 1) <NEW_LINE> time.sleep(2) <NEW_LINE> driver.find_element_by_xpath("/html/body/div/div[...
断言是否增加了文件,人工审核数据
625941f076d4e153a657f0d3
@javaproperties.command() <NEW_LINE> @click.option( "-A/-U", "--ascii/--unicode", "ensure_ascii", default=True, help="Whether to escape non-ASCII characters or output raw", ) <NEW_LINE> @encoding_option <NEW_LINE> @click.option( "-o", "--outfile", type=outfile_type, default="-", help="Write output to this file" ) <NEW_...
Format/"canonicalize" a Java .properties file
625941f00a366e3fb873edc0
@register_model <NEW_LINE> def efficientnet_b2a(pretrained=False, **kwargs): <NEW_LINE> <INDENT> kwargs['bn_eps'] = BN_EPS_TF_DEFAULT <NEW_LINE> model = _gen_efficientnet( 'efficientnet_b2a', channel_multiplier=1.1, depth_multiplier=1.2, pretrained=pretrained, **kwargs) <NEW_LINE> return model
EfficientNet-B2 @ 288x288 w/ 1.0 test crop
625941f04e4d5625662d4970
def printCar(self): <NEW_LINE> <INDENT> print('The make is : %s and model is : %s' % (self.make, self.model)) <NEW_LINE> print('More details: %s %s %s'% (self.year, self.make, self.model))
This method prints out the card details
625941f0b830903b967e9ea5
def calculateDataBatchSize(self, data): <NEW_LINE> <INDENT> return 1
:param data: One sample which yield by generateData :type data: list :return: The batch size that the data contribute. :rtype: int
625941f05e10d32532c5f4c5
def get_content(file_name, pkg_name='onedrived', is_text=True): <NEW_LINE> <INDENT> content = pkgutil.get_data(pkg_name, 'data/' + file_name) <NEW_LINE> if is_text: <NEW_LINE> <INDENT> content = content.decode('utf-8') <NEW_LINE> <DEDENT> return content
Read a resource file in data/. :param str file_name: :param str pkg_name: :param True | False is_text: True to indicate the text is UTF-8 encoded. :return str | bytes: Content of the file.
625941f08c3a873295158962
def get_recession_end(): <NEW_LINE> <INDENT> data = pd.ExcelFile("gdplev.xls") <NEW_LINE> gdp = data.parse(skiprows=5) <NEW_LINE> gdp = (gdp.drop(gdp.columns[[0,1,2,3,7]], 1) .drop([0,1]) .reset_index(drop=True)) <NEW_LINE> gdp.columns = ["Quarters", "GDP in Billions of Current Dollars", "GDP in Billions of Chained 200...
Returns the year and quarter of the recession end time as a string value in a format such as 2005q3
625941f055399d3f05588c59
def post(self, request): <NEW_LINE> <INDENT> key = str(uuid.uuid1()) <NEW_LINE> pathname = os.path.join(OBJECT_STORE_DIR, key) <NEW_LINE> pickle.dump(self.CONTENT, open(pathname, 'wb')) <NEW_LINE> remove_oldest_files(OBJECT_STORE_DIR, MAX_FILES) <NEW_LINE> return Response(status.HTTP_201_CREATED, self.CONTENT, {'Locati...
Create a new stored object, with a unique key.
625941f0cb5e8a47e48b8041
def _revision_key(self, ud, d, name): <NEW_LINE> <INDENT> slash_re = re.compile(r"/+") <NEW_LINE> return "git:" + ud.host + slash_re.sub(".", ud.path) + ud.unresolvedrev[name]
Return a unique key for the url
625941f00a50d4780f667438
def open_browser(self): <NEW_LINE> <INDENT> url = "http://www.google.com" <NEW_LINE> webbrowser.open(url,new=2)
opens a browser in a new tab on your computer
625941f01f037a2d8b94679d
def to_dask_array(array_proxy, name=None, **kwds): <NEW_LINE> <INDENT> return da.from_array(array_proxy, chunks="auto", name=name, fancy=False, **kwds)
Wrap BaseArrayProxy object into dask.array object. The chunk size is adapted by dask (chunks="auto"). Use `dask.config.get("array.chunk-size")` and `dask.config.set({"array.chunk-size": "10 MiB"})` to control the maximum chunk size.
625941f016aa5153ce362a1a
def _set_total_prefixes(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=RestrictedClassType( base_type=long, restriction_dict={"range": ["0..4294967295"]}, int_size=32, ), is_leaf=True, yang_nam...
Setter method for total_prefixes, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/global/state/total_prefixes (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_total_prefixes is considered as a private method. Backends looking to populate this...
625941f0097d151d1a2233f7
def train(self, states, gradients): <NEW_LINE> <INDENT> self.sess.run(self.optimizer, feed_dict={self.inputs: states, self.action_gradients: gradients})
Train the model on the given states and the given gradients provided by the critic.
625941f0d486a94d0b98e6e7
def reconfig_bus(self): <NEW_LINE> <INDENT> pinmode = self.get_pin_mode() <NEW_LINE> try: <NEW_LINE> <INDENT> if pinmode == "INPUT": <NEW_LINE> <INDENT> self.gpg.set_grove_type(self.portID, self.gpg.GROVE_TYPE.CUSTOM) <NEW_LINE> self.gpg.set_grove_mode(self.portID, self.gpg.GROVE_INPUT_ANALOG) <NEW_LINE> <DEDENT> if pi...
Sets the bus properly. Sometimes this needs to be done even after instantiation when two processes are trying to connect to the GoPiGo and one re-initialises the ports.
625941f07b180e01f3dc4d91
def delete(self, txid, store, entity, path): <NEW_LINE> <INDENT> raise NotImplementedError()
Method definition for opendaylight-jsonrpc-data RPC `delete`.
625941f08a349b6b435e8713
def _get_unique_key(self): <NEW_LINE> <INDENT> return [k for k, v in self.dataset.mapping.iteritems() if v.get('key', False)]
Return a list of unique keys for the dataset
625941f03539df3088e2e8ec
def p_list_sum(t): <NEW_LINE> <INDENT> t[0] = Operation('list_sum', [t[3]])
val : SUM OF val %prec OF
625941f0507cdc57c630728a
def _is_ecb(self): <NEW_LINE> <INDENT> size = 2 <NEW_LINE> prev_block = None <NEW_LINE> flag = True <NEW_LINE> while size <= 1024: <NEW_LINE> <INDENT> msg = b"A" * size * 40 <NEW_LINE> ctext = self._encrypt(msg) <NEW_LINE> cblocks = [ctext[i:i+size] for i in range(0, len(ctext), size)] <NEW_LINE> for block in cblocks[:...
Confirm oracle uses ECB mode for AES encryption while finding the blocksize. for each block size if the first block is the same as the rest, then we know it is ecb and thats the block size. :return: (if oracle uses ecb, block size)
625941f0d7e4931a7ee9e4c0
def p_element_javascript(p): <NEW_LINE> <INDENT> p[0] = ("javascript-element",p[1])
element : JAVASCRIPT
625941f02ae34c7f2600d6d1
def get_project_id(private_token, ssl_verify): <NEW_LINE> <INDENT> remote_url = get_remote_url('origin', verbose=False) <NEW_LINE> gitlab_url, owner, project_name = get_repository_info(remote_url) <NEW_LINE> querystring = {'search': project_name, 'membership': 'true'} <NEW_LINE> url = f'{gitlab_url}/api/v4/projects?{ur...
Get project id from the gitlab host passed
625941f015fb5d323cde10b9
@tools.deprecated( reason='use sopel.tools.get_logger instead', version='7.0', warning_in='8.0', removed_in='9.0', ) <NEW_LINE> def get_logger(name=None): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> return logging.getLogger('sopel') <NEW_LINE> <DEDENT> parts = name.strip().split('.') <NEW_LINE> if len(parts) >...
Return a logger for a module, if the name is given. .. deprecated:: 7.0 Sopel's own code should use :func:`logging.getLogger(__name__) <logging.getLogger>` instead, and external plugins should use :func:`sopel.tools.get_logger`. This will emit a deprecation warning in Sopel 8.0, and it will be re...
625941f02eb69b55b151ce59
def volume_delete(self, context, instance, volume_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> aws_volume_id = self._get_provider_volume_id(context, volume_id) <NEW_LINE> if not aws_volume_id: <NEW_LINE> <INDENT> aws_volumes = self._get_provider_volume(context, volume_id) <NEW_LINE> if not aws_volumes: <NEW_LINE> ...
Delete specified volume.
625941f056b00c62f0f14bfe
@get('/static/fonts/<filename>') <NEW_LINE> def fonts(filename): <NEW_LINE> <INDENT> return static_file(filename, root=Path(absolute_path + '/fonts'))
Статические файлы Fonts
625941f0566aa707497f4b02
def __init__(self, width, height): <NEW_LINE> <INDENT> self.integer_validator("width", width) <NEW_LINE> self._wh = width <NEW_LINE> self.integer_validator("height", height) <NEW_LINE> self._ht = height
inisialisation of a rectangle class
625941f0e8904600ed9f24d8
def versions(app_id, token=None): <NEW_LINE> <INDENT> api_method = 'apps/{0}/app_versions'.format(app_id) <NEW_LINE> resp = hockey_get(api_method, token=token) <NEW_LINE> return loads(resp.content)
List all versions of an app. http://support.hockeyapp.net/kb/api/api-versions#list-versions :param app_id: The public_identifier attribute of the app. :param token: The user's hockeyapp API token as a string. :return: The response from the app_versions endpoint.
625941f0090684286d50f290
def pipeline_summary(data): <NEW_LINE> <INDENT> work_bam = (data.get("work_bam") if data["config"]["algorithm"].get("merge_bamprep", True) else data.get("callable_bam")) <NEW_LINE> if data["sam_ref"] is not None and work_bam: <NEW_LINE> <INDENT> logger.info("Generating summary files: %s" % str(data["name"])) <NEW_LINE>...
Provide summary information on processing sample.
625941f0b57a9660fec33e2d
def size(self): <NEW_LINE> <INDENT> return _swigibpy.OrderComboLegList_size(self)
size(OrderComboLegList self) -> std::vector< shared_ptr< OrderComboLeg > >::size_type
625941f0aad79263cf390feb
def test_embedded_update_after_save(self): <NEW_LINE> <INDENT> class Page(EmbeddedDocument): <NEW_LINE> <INDENT> log_message = StringField(verbose_name="Log message", required=True) <NEW_LINE> <DEDENT> class Site(Document): <NEW_LINE> <INDENT> page = EmbeddedDocumentField(Page) <NEW_LINE> <DEDENT> Site.drop_collection(...
Test update of `EmbeddedDocumentField` attached to a newly saved document.
625941f0f9cc0f698b140b97
def parse_arg(arg): <NEW_LINE> <INDENT> if type(arg) == str: <NEW_LINE> <INDENT> arg = arg.strip() <NEW_LINE> if ',' in arg: <NEW_LINE> <INDENT> arg = arg.split(',') <NEW_LINE> arg = [x.strip() for x in arg] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> arg = [arg] <NEW_LINE> <DEDENT> <DEDENT> return arg
解析参数成列表 参数 arg: list, tuple, string或csv list ('a,b,c')其中之一 返回 list
625941f091af0d3eaac9bfbf
def test(self,idx): <NEW_LINE> <INDENT> user = '4131145503' <NEW_LINE> idx = int(idx) <NEW_LINE> if idx==1: <NEW_LINE> <INDENT> gConfig.set(CFG_DOWN_SYNCBEGIN,(time.time()-180*24*3600)*1000) <NEW_LINE> self.post(user) <NEW_LINE> <DEDENT> elif idx==2: <NEW_LINE> <INDENT> logInfo("break point mode") <NEW_LINE> self.post(...
1,可选user,不要太多页(1840488466,4691977921,4131145503) 2,idx=1,设置begin,从begin点爬,人为中断 3,idx=2,断点开始继续,还是人为中断 4,idx=3,强制使用增量模式,从头开始爬到上次开始点 :return:
625941f023849d37ff7b362c
def prep_level(self): <NEW_LINE> <INDENT> self.level_image = self.font.render(str(self.stats.level), True, self.text_color, self.ai_settings.bg_color) <NEW_LINE> self.level_rect = self.level_image.get_rect() <NEW_LINE> self.level_rect.right = self.screen_rect.right <NEW_LINE> self.level_rect.top = self.score_rect.botto...
显示等级
625941f04a966d76dd5515b7
def before_render(self): <NEW_LINE> <INDENT> super(DrugsView, self).before_render() <NEW_LINE> self.request.set("disable_border", 1)
Before template render hook
625941f0cc40096d61595eef
def __exit__(self, exc_type, exc_value, traceback): <NEW_LINE> <INDENT> if exc_type is not None: <NEW_LINE> <INDENT> self.invalidate() <NEW_LINE> <DEDENT> self.finish() <NEW_LINE> return False
Leaves a block of revision management.
625941f096565a6dacc8fc6a
def non_max_suppression(prediction, conf_thres=0.1, iou_thres=0.6, merge=False, classes=None, agnostic=False): <NEW_LINE> <INDENT> nc = prediction[0].shape[1] - 5 <NEW_LINE> xc = prediction[..., 4] > conf_thres <NEW_LINE> min_wh, max_wh = 2, 4096 <NEW_LINE> max_det = 300 <NEW_LINE> time_limit = 10.0 <NEW_LINE> redundan...
Performs Non-Maximum Suppression (NMS) on inference results Returns: detections with shape: nx6 (x1, y1, x2, y2, conf, cls)
625941f05fcc89381b1e1c65
def _AddTagValue(self, value): <NEW_LINE> <INDENT> self.valid_tag_values.append(value)
Adds a valid value for tag field. Args: value: Valid value for tag field.
625941f092d797404e30472e
def all_subsets(lst): <NEW_LINE> <INDENT> lst_out=[[]] <NEW_LINE> for item in lst: <NEW_LINE> <INDENT> prev_lst = [] <NEW_LINE> for each in lst_out: <NEW_LINE> <INDENT> tmp_lst=list(each) <NEW_LINE> tmp_lst.append(item) <NEW_LINE> prev_lst.append(list(tmp_lst)) <NEW_LINE> <DEDENT> lst_out.extend(prev_lst) <NEW_LINE> <D...
" all subsets of a set @param lst: input set @return lst_out: potent set of lst
625941f0d58c6744b42581ff
def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> return real_super(*args, **kwargs)
Allow 'old-style' super()-calls.
625941f015fb5d323cde10ba
def get_data(self): <NEW_LINE> <INDENT> li_list = self.driver.find_elements_by_xpath('/html/body/div[4]/div[1]/div[5]/div[2]/ul/li')[:-2] <NEW_LINE> print(len(li_list)) <NEW_LINE> data_list =[] <NEW_LINE> for li in li_list: <NEW_LINE> <INDENT> item = {} <NEW_LINE> if li.get_attribute("class") == 'apartments-pkg apartme...
通过driver对象,解析内容,获取需要的内容
625941f08da39b475bd6551d
def get_relative_well_position(self, row, column): <NEW_LINE> <INDENT> if isinstance(row, string_types): <NEW_LINE> <INDENT> row = ord(row.lower()) - 96 <NEW_LINE> <DEDENT> if row > self.num_rows or column > self.num_columns or row < 1 or column < 1: <NEW_LINE> <INDENT> raise ValueError('Invalid row or column') <NEW_LI...
Expects column and row to be 1 indexed, like on a plate!
625941f044b2445a33932633
def select(self, folder: Folder) -> int: <NEW_LINE> <INDENT> self._debug("select", str(folder)) <NEW_LINE> response = self.imap.select(folder.getName()) <NEW_LINE> self._debugResponse("select", response) <NEW_LINE> status, data = response <NEW_LINE> if status == 'OK': <NEW_LINE> <INDENT> return int(data[0]) <NEW_LINE> ...
Return number of existing messages.
625941f096565a6dacc8fc6b
def transmit(self, msg: Any, delay: float) -> None: <NEW_LINE> <INDENT> request = self._res.request() <NEW_LINE> yield self._env.timeout(delay) & request <NEW_LINE> self._print("Transmitting msg: " + str(msg.obj)) <NEW_LINE> self._node.event_store.put(msg) <NEW_LINE> yield self._env.timeout(self.__waiter) <NEW_LINE> se...
Actual transmitting function :param msg: message that needs to be trasfered :param delay: time that needs to be waited before the message arrives to the destination
625941f0498bea3a759ba04f
def test_add_sorting(self): <NEW_LINE> <INDENT> dirs = ['a', 'a/a', 'a/a/a', 'a/a/a/a', 'a-a', 'a/a-a', 'a/a/a-a', 'a/a/a/a-a', ] <NEW_LINE> null_sha = b'' <NEW_LINE> state = dirstate.DirState.initialize('dirstate') <NEW_LINE> self.addCleanup(state.unlock) <NEW_LINE> fake_stat = os.stat('dirstate') <NEW_LINE> for d in ...
Add entries in lexicographical order, we get path sorted order. This tests it to a depth of 4, to make sure we don't just get it right at a single depth. 'a/a' should come before 'a-a', even though it doesn't lexicographically.
625941f06aa9bd52df037349
def main(asmfile, outputdir=None): <NEW_LINE> <INDENT> lines = [line.strip() for line in open(asmfile)] <NEW_LINE> symbolics = symboltable(lines) <NEW_LINE> line_loc = 0 <NEW_LINE> parsed = [] <NEW_LINE> for line in symbolics.lines: <NEW_LINE> <INDENT> line_loc += 1 <NEW_LINE> try: <NEW_LINE> <INDENT> parsed.append(par...
Creates a symbolictable isntance and parseline instances. Holds asm in memory while reading and hack while writing. All parseline objects along with symbolic table are retained and returned for ease of error handling. To avoid (possibly) large memory footprint function can be written inside loop to fac...
625941f0be383301e01b5a1c
def link_room(self, room) : <NEW_LINE> <INDENT> neighbours = [] <NEW_LINE> for pos_vec in Room.neighbour_pos_vectors : <NEW_LINE> <INDENT> neighbour_coords = room.coords + pos_vec <NEW_LINE> if(are_valid_coords(neighbour_coords, self.dims)) : <NEW_LINE> <INDENT> neighbours.append(self.grid[neighbour_coords.x][neighbour...
Finds the neighbours to the given room and links them
625941f094891a1f4081c04e
def itkSparseFieldLayerSFLSNI3_cast(*args): <NEW_LINE> <INDENT> return _itkSparseFieldLevelSetImageFilterPython.itkSparseFieldLayerSFLSNI3_cast(*args)
itkSparseFieldLayerSFLSNI3_cast(itkLightObject obj) -> itkSparseFieldLayerSFLSNI3
625941f04f6381625f114fdc
def query(self, search_request): <NEW_LINE> <INDENT> result = ClientResult(self.context, SearchResult()) <NEW_LINE> qry = ServiceOperationQuery(self, "query", search_request.to_json(), None, "query", result) <NEW_LINE> self.context.add_query(qry) <NEW_LINE> def _construct_request(request): <NEW_LINE> <INDENT> request.m...
The operation is used to retrieve search results by using the HTTP protocol with the GET method. :type search_request: office365.sharepoint.search.searchRequest.SearchRequest
625941f00383005118ecfb82
def Pailie(realr, modelout, count=90): <NEW_LINE> <INDENT> relal_num = np.array(realr) <NEW_LINE> modelout_num = np.array(modelout) <NEW_LINE> fu = np.random.choice(list(range(len(realr))), count, replace=True) <NEW_LINE> show_real, show_model = relal_num[fu], modelout_num[fu] <NEW_LINE> sunnum = show_real - show_model...
:param real: 预测数据集真实的数据 :param modelout: 预测数据集的模型的输出值 :param count: 进行数据对比的条数 :return: 按照差值从小到大排列的数据
625941f07d43ff24873a3246
def complete_memory_2(file: List) -> dict: <NEW_LINE> <INDENT> mem = {} <NEW_LINE> for line in file: <NEW_LINE> <INDENT> if "mask" in line: <NEW_LINE> <INDENT> mask = line.split(" = ")[1] <NEW_LINE> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> mem_helper, value = line.split(" = ") <NEW_LINE> mem_helper = mem_...
Get the complete memory of the program.
625941f0d99f1b3c44c67b25
def _readheader(self, infile): <NEW_LINE> <INDENT> self.header = self.check_header()
Read and decode the header of an image: :param infile: Opened python file (can be stringIO or bzipped file)
625941f03317a56b8693a1eb
def get_data(self): <NEW_LINE> <INDENT> return self.filtered_data.values(*self.get_groupby()).annotate( **self.get_annotations() )
Get the aggregated queryset
625941f0be7bc26dc91cdb97
def removeDuplicateLetters(self, s): <NEW_LINE> <INDENT> mapping = {c: ord(c) - ord('a') for c in ascii_lowercase} <NEW_LINE> counter = [0] * 26 <NEW_LINE> used = [False] * 26 <NEW_LINE> for char in s: <NEW_LINE> <INDENT> idx = mapping[char] <NEW_LINE> counter[idx] += 1 <NEW_LINE> <DEDENT> stack = [] <NEW_LINE> for cha...
:type s: str :rtype: str
625941f00c0af96317bb8789
def mergeKLists_merge_no_recursion(self, lists): <NEW_LINE> <INDENT> def mergeTwoLists(l1, l2): <NEW_LINE> <INDENT> if l1 == None: <NEW_LINE> <INDENT> return l2 <NEW_LINE> <DEDENT> if l2 == None: <NEW_LINE> <INDENT> return l1 <NEW_LINE> <DEDENT> if l1.val <= l2.val: <NEW_LINE> <INDENT> l1.next = mergeTwoLists(l1.next, ...
算法:归并排序(分治思想)-由底向上的, 自己写的,通俗易懂。两两合并直至剩下最后一个 复杂度分析: 时间:Onlogk,k是链表数量,合并两个链表要On,故总Onlogk 空间:Onlogk(不一定对),对k个链表,循环调用logk次,combine新建k次,combine长度On,总Onlogk
625941f067a9b606de4a8458
def UpdateMetadata(metadata, args): <NEW_LINE> <INDENT> manifest = yaml.load(metadata.value) <NEW_LINE> if args.IsSpecified('container_image'): <NEW_LINE> <INDENT> manifest['spec']['containers'][0]['image'] = args.container_image <NEW_LINE> <DEDENT> if args.IsSpecified('container_command'): <NEW_LINE> <INDENT> manifest...
Update konlet metadata entry using user-supplied data.
625941f0cc0a2c11143dd433
def run_hook(logger, script, path, env, timeout): <NEW_LINE> <INDENT> ret = SUCCESS_EXITVAL <NEW_LINE> logger.debug("Running hook '{}' in directory {}". format(script, path)) <NEW_LINE> cmd = Command([script], logger=logger, work_dir=path, env_vars=env, timeout=timeout, doprint=True) <NEW_LINE> cmd.execute() <NEW_LINE>...
Change a working directory to specified path, run a command and change the working directory back to its original value. Return 0 on success, 1 on failure.
625941f073bcbd0ca4b2c617
def test_init(self): <NEW_LINE> <INDENT> dataset = parse.parse_set() <NEW_LINE> tree = CartTree(random.sample(dataset, len(dataset) // 5)) <NEW_LINE> return tree
Also returns the tree created.
625941f097e22403b379d53e
def collect_sample_dirs(start_dir, blacklist=set()): <NEW_LINE> <INDENT> for parent, subdirs, files in os.walk(start_dir): <NEW_LINE> <INDENT> if any(f for f in files if f[-8:] == '_test.py'): <NEW_LINE> <INDENT> del subdirs[:] <NEW_LINE> yield parent <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> subdirs[:] = [s for s ...
Recursively collects a list of dirs that contain tests. This works by listing the contents of directories and finding directories that have `*_test.py` files.
625941f099cbb53fe6793186
def check_upgrade_steps(connection, plone_path=None): <NEW_LINE> <INDENT> app, plone_site = get_plone_site(connection, plone_path) <NEW_LINE> not_upgraded = 0 <NEW_LINE> if plone_site: <NEW_LINE> <INDENT> setSite(plone_site) <NEW_LINE> ps = plone_site.portal_setup <NEW_LINE> for profile_id in ps.listProfilesWithUpgrade...
Check if all upgrade steps are ran.
625941f04c3428357757c8c6
def getTemplateKeyPoints(self): <NEW_LINE> <INDENT> return self.tkp
**SUMMARY** Returns all the keypoints which are found on the template Image. **RETURNS** A list of points. **EXAMPLE** >>> track = SURFTrack(image, pts, detector, descriptor, temp, skp, sd, tkp, td) >>> tkp = track.getTemplateKeyPoints()
625941f05fdd1c0f98dc07d7
def setup_training_data(self, train_data_config: Optional[DictConfig] = None): <NEW_LINE> <INDENT> if train_data_config is None: <NEW_LINE> <INDENT> train_data_config = self._cfg.train_ds <NEW_LINE> <DEDENT> if not hasattr(self._cfg, "class_labels") or self._cfg.class_labels is None: <NEW_LINE> <INDENT> OmegaConf.set_s...
Setup training data
625941f0004d5f362079a8d1
def test_compare_union(): <NEW_LINE> <INDENT> it = [[1, 2]] <NEW_LINE> others = [[3, 4]] <NEW_LINE> actual = [] <NEW_LINE> for i, o in zip(it, others): <NEW_LINE> <INDENT> result = ut.compare_set(i, o, how='union') <NEW_LINE> actual.append(result) <NEW_LINE> <DEDENT> expected = [{1, 2, 3, 4}] <NEW_LINE> nt.assert_equal...
Check set union.
625941f00a50d4780f667439
def transition_node_prob_with_one_node(G): <NEW_LINE> <INDENT> alias_nodes = {} <NEW_LINE> for node in G.nodes(): <NEW_LINE> <INDENT> probs = [G[node][nbr]['weight'] for nbr in G.neighbors(node)] <NEW_LINE> sum_probs = sum(probs) <NEW_LINE> normed_probs = [float(prob) / sum_probs for prob in probs] <NEW_LINE> alias_nod...
当只考虑当前节点的时候,也就是只知道一个节点的时候,决定下一个节点往何处。 :return: 这里考虑的是整个图,形成一个字典。alias_nodes[node] 在当前节点node时,下一步情况的概率情况,也就是 alias 两个数组。
625941f0fff4ab517eb2f9e2
def decode_index_value(self, index, value): <NEW_LINE> <INDENT> if index.endswith("_int"): <NEW_LINE> <INDENT> return int(value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return bytes_to_str(value)
Decodes a secondary index value into the correct Python type. :param index: the name of the index :type index: str :param value: the value of the index entry :type value: str :rtype str or int
625941f05fc7496912cc3f1f
def test_flake8(self): <NEW_LINE> <INDENT> result = subprocess.run(['flake8', self.module.__file__]) <NEW_LINE> self.assertEqual(result.returncode, 0)
Checking for PEP8/flake8 compliance
625941f099cbb53fe6793187
def _validate_type_uuid(self, field, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> UUID(value) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> self._error(field, errors.ERROR_BAD_TYPE.format('uuid'))
Validates that the value is an UUID.
625941f0ab23a570cc25072a
def GetDeformationField(self): <NEW_LINE> <INDENT> return _itkPDEDeformableRegistrationFilterPython.itkPDEDeformableRegistrationFilterIF2IF2IVF22_GetDeformationField(self)
GetDeformationField(self) -> itkImageVF22
625941f0dd821e528d63b746
def chnfsclient(self, share_path, client_spec): <NEW_LINE> <INDENT> ssh_cmd = ['mcsop', 'chnfsclient', '-path', '"%s"' % share_path, '-client', client_spec] <NEW_LINE> self.run_ssh_assert_no_output(ssh_cmd)
:param share_path: :param client_spec: :return:
625941f023e79379d52eeafe
def raise_notification_log_entry(self, notif, contact, host_ref): <NEW_LINE> <INDENT> if self.__class__.log_notifications: <NEW_LINE> <INDENT> log_level = 'info' <NEW_LINE> command = notif.command_call <NEW_LINE> if notif.type in [u'DOWNTIMESTART', u'DOWNTIMEEND', u'DOWNTIMECANCELLED', u'CUSTOM', u'ACKNOWLEDGEMENT', u'...
Raise SERVICE NOTIFICATION entry (critical level) Format is : "SERVICE NOTIFICATION: *contact.get_name()*;*host_name*;*self.get_name()* ;*state*;*command.get_name()*;*output*" Example : "SERVICE NOTIFICATION: superadmin;server;Load;UP;notify-by-rss;no output" :param notif: notification object created by se...
625941f0be8e80087fb211da
def ajouterChangementCarteANotifier(self, carteQuittee, carteEntree, nomEvenement, carteEvenement): <NEW_LINE> <INDENT> changement = self._changementsCarteANotifier.setdefault((carteQuittee,carteEntree), dict()) <NEW_LINE> changement[nomEvenement] = carteEvenement
Demande au gestionnaire d'informer <nomEvenement> sur <carteEvenement> de tout changement de carte du joueur en <carteQuittee> vers <carteEntree>.
625941f09b70327d1c4e137a
def load_demonstrations(self, num_demos): <NEW_LINE> <INDENT> if num_demos > 40: <NEW_LINE> <INDENT> raise ValueError('Specified number of demos must be at most 40.') <NEW_LINE> <DEDENT> self.num_demos = num_demos <NEW_LINE> with open('experts/my_' + self.robot_name + '_demos.pkl', 'rb') as f: <NEW_LINE> <INDENT> self....
Loads the specified number of expert demonstrations, and returns a video of the expert demonstration trajectories. The maximum number of demonstrations that can be loaded is 40.
625941f0b5575c28eb68e5a8
def query_anchor_text(self, url, cols, scope = A_PTP): <NEW_LINE> <INDENT> self.report('Grabbing anchor text.') <NEW_LINE> return self.call_anchor_text(url, cols, scope)
run a query for anchor text
625941f076d4e153a657f0d4
def update_membrane_potential(self) -> None: <NEW_LINE> <INDENT> self.i_net = (self.net * (self.spec.e_rev_e - self.v_m) + self.spec.gc_l * (self.spec.e_rev_l - self.v_m) + self.gc_i * (self.spec.e_rev_i - self.v_m)) <NEW_LINE> self.v_m += (self.spec.integ * self.spec.vm_dt * ( self.i_net - self.adapt)).clamp(-100, 100...
Updates the membrane potential. This assumes we already have updated the net input and unit inhibition.
625941f0b545ff76a89143b8
def arrayPairSum(self, nums): <NEW_LINE> <INDENT> nums = sorted(nums) <NEW_LINE> temp = 0 <NEW_LINE> for e in range(int(len(nums)/2)): <NEW_LINE> <INDENT> temp += nums[2 * e] <NEW_LINE> <DEDENT> return temp
:type nums: List[int] :rtype: int
625941f04f88993c3716c603
def predict_df(self, df): <NEW_LINE> <INDENT> super(Component, self).predict_df() <NEW_LINE> if self.active: <NEW_LINE> <INDENT> idx = df.index <NEW_LINE> X = df.loc[:, self.attributes] <NEW_LINE> return_clf = np.array(self.predict_func(X.values)) <NEW_LINE> return_df = pd.DataFrame(columns=self.returns, index=idx) <NE...
Method to predict samples from a dataframe. Parameters ---------- df : pandas.DataFrame Dataframe containing all the features. Returns ------- return_df : pandas.DataFrame Dataframe of the scores.
625941f0925a0f43d254a41f
def __str__(self): <NEW_LINE> <INDENT> pass
Pretty print the table and state. :return: String
625941f0d6c5a102081445f2
def document_class(self): <NEW_LINE> <INDENT> return self.spec.document_type.model_class()
Document class for this spec. :return: The document class.
625941f0283ffb24f3c55e9d
def bonus_promotion(self): <NEW_LINE> <INDENT> self.weight += self.event.promotion_boost * self.start_time_factor
Add bonus for promoted events
625941f060cbc95b062c6ae6