code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_mShop_items(self,page): <NEW_LINE> <INDENT> url = 'https://zhongshunjierou.m.tmall.com/shop/shop_auction_search.do?sort=s&p={}&shop_id={}'.format(page, self.mShopId) <NEW_LINE> headers = { 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'zh-CN,zh;q=0.9', 'cookie': self.cookie , 'referer': 'https://zh...
获取M端网页的商品列表 :param page: 商品列表页数 :return: 输出商品json格式
625941f526238365f5f0f4af
def _varscan_work(align_bams, ref_file, config, target_regions, out_file): <NEW_LINE> <INDENT> max_read_depth = "1000" <NEW_LINE> version = programs.jar_versioner("varscan", "VarScan")(config) <NEW_LINE> if version < "v2.3.5": <NEW_LINE> <INDENT> raise IOError("Please install version 2.3.5 or better of VarScan with sup...
Perform SNP and indel genotyping with VarScan.
625941f5cc40096d61595f86
def get_stock_basicinfo(self, market, stock_type=SecurityType.STOCK): <NEW_LINE> <INDENT> param_table = {'market': market, 'stock_type': stock_type} <NEW_LINE> for x in param_table: <NEW_LINE> <INDENT> param = param_table[x] <NEW_LINE> if param is None or is_str(param) is False: <NEW_LINE> <INDENT> error_str = ERROR_ST...
获取指定市场中特定类型的股票基本信息 :param market: 市场类型,futuquant.common.constsnt.Market :param stock_type: 股票类型, futuquant.common.constsnt.SecurityType :return: (ret_code, content) ret_code 等于RET_OK时, content为Pandas.DataFrame数据, 否则为错误原因字符串, 数据列格式如下 ================= =========== =========================================...
625941f53617ad0b5ed6852f
def post_process_dataType(self, before, after): <NEW_LINE> <INDENT> self.revalidateData()
if the dataType is changed we need to ensure that all items in data fall in this new data type
625941f54f88993c3716c699
def extend(self, name: str, values: List[str]) -> None: <NEW_LINE> <INDENT> if name in self._variables: <NEW_LINE> <INDENT> self._variables[name].extend(values) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.set(name, values)
Extend the specified variable with the specified list of strings.
625941f59f2886367277aec1
def classify_regions(dataset, masks, method='ERF', threshold=0.08, remove_overlap=True, regularization='scale', output='summary', studies=None, features=None, class_weight='auto', classifier=None, cross_val='4-Fold', param_grid=None, scoring='accuracy'): <NEW_LINE> <INDENT> (X, y) = get_studies_by_regions(dataset, mask...
Perform classification on specified regions Given a set of masks, this function retrieves studies associated with each mask at the specified threshold, optionally removes overlap and filters by studies and features. Then it trains an algorithm to classify studies based on features and tests performance. Args: ...
625941f585dfad0860c3b496
@app_views.route('/cities/<city_id>', methods=['GET']) <NEW_LINE> def single_city(city_id): <NEW_LINE> <INDENT> my_city = storage.get("City", city_id) <NEW_LINE> if my_city is None: <NEW_LINE> <INDENT> abort(404) <NEW_LINE> <DEDENT> return jsonify(my_city.to_dict())
function returns a single city given its id
625941f5a219f33f34628f99
def create_samplingfeature(row, SF_set): <NEW_LINE> <INDENT> SF = dict() <NEW_LINE> SF['SamplingFeatureUUID'] = str(uuid.uuid1()) <NEW_LINE> SF['SamplingFeatureGeotypeCV'] = 'Point' <NEW_LINE> point_shp = Point(row['lon'], row['lat']) <NEW_LINE> SF['FeatureGeometryWKT'] = point_shp.wkt <NEW_LINE> if SF_set == 'site': <...
Function to create Sampling Features :row: Row of dataframe :SF_set: Type of Sampling Features
625941f563d6d428bbe44b2a
def raise_to_clause(element): <NEW_LINE> <INDENT> if is_clause_type(element): <NEW_LINE> <INDENT> return element <NEW_LINE> <DEDENT> if is_phrase_type(element): <NEW_LINE> <INDENT> if is_noun_type(element): return Clause(subject=element) <NEW_LINE> if is_verb_type(element): return Clause(predicate=element) <NEW_LINE> <...
Convert element into a clause. If it is a clause, return it as is.
625941f5fbf16365ca6f680b
def __str__(self): <NEW_LINE> <INDENT> return "[OpenStack Exception:reason=%s]" % self._reason
Return a string representing the exception
625941f556b00c62f0f14c97
def is_online(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.get_data_sources() <NEW_LINE> <DEDENT> except urllib2.URLError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Returns True if Helioviewer is online and available
625941f5167d2b6e312191cd
def set_proc_title(name=None): <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> name = os.path.basename(sys.argv[0]) <NEW_LINE> <DEDENT> libc = cdll.LoadLibrary('libc.so.6') <NEW_LINE> buff = create_string_buffer(len(name)+1) <NEW_LINE> buff.value = name.encode("UTF-8") <NEW_LINE> ret = libc.prctl(15, byref(buff), ...
Set the process title
625941f5cb5e8a47e48b80d8
def diags_stackrac_test(**kwargs): <NEW_LINE> <INDENT> return e.diags.stackrac_test(**kwargs)
:menu: (enable=True, name=STACKRAC, section=Diags, num=10, args={'menu': True})
625941f5d53ae8145f87a89c
def format(self, wrap=70): <NEW_LINE> <INDENT> header = ">{0}".format(self.id) <NEW_LINE> if self.description: <NEW_LINE> <INDENT> header += " " + self.description <NEW_LINE> <DEDENT> header += "\n" <NEW_LINE> wseq = [] <NEW_LINE> for i in range(0, len(self.seq), wrap): <NEW_LINE> <INDENT> wseq.append(self.seq[i:i + wr...
Return a formatted Fasta record. Example: >>> import Fasta >>> record = SeqRecord(seq='MRELEAKAT', id='NP_055309.2', description='TNRC6A') >>> print(record.format()) >NP_055309.2 TNRC6A MRELEAKAT
625941f5435de62698dfe286
@property <NEW_LINE> def baseAppData(): <NEW_LINE> <INDENT> pass
说明: 这个属性包含一个类字典的对象,这个对象会在所有的BaseApps之间自动同步。 当字典的一个值被修改,这个修改会广播到所有的BaseApps。 例子: KBEngine.baseAppData[ "hello" ] = "there" 其余BaseApps可以访问下面的: print KBEngine.baseAppData[ "hello" ] 键和值可以是任意类型,但这些类型必须在所有目标组件上能够被封装和被拆封。 当一个值被改变或被删除,一个回调函数会在所有组件被调用。 参看:KBEngine.onBaseAppData和KBEngine.onDelBaseAppData。 注意:只有顶层的值才会被...
625941f58c0ade5d55d3effa
def similarities(self, list_of_words): <NEW_LINE> <INDENT> query_dict = {} <NEW_LINE> for w in list_of_words: <NEW_LINE> <INDENT> query_dict[w] = query_dict.get(w, 0.0) + 1.0 <NEW_LINE> <DEDENT> length = float(len(list_of_words)) <NEW_LINE> for k in query_dict: <NEW_LINE> <INDENT> query_dict[k] = query_dict[k] / length...
Returns a dict of all the [docname, similarity_score] pairs relative to a list of words.
625941f5ac7a0e7691ed46f8
def form_map(request): <NEW_LINE> <INDENT> return render(request,'FishResult/form_map.html')
フォーム用map表示
625941f599fddb7c1c9de9c6
def merge(self, intervals): <NEW_LINE> <INDENT> n = len(intervals) <NEW_LINE> starts, ends = [], [] <NEW_LINE> for i in intervals: <NEW_LINE> <INDENT> starts.append(i.start) <NEW_LINE> ends.append(i.end) <NEW_LINE> <DEDENT> starts.sort() <NEW_LINE> ends.sort() <NEW_LINE> j = 0 <NEW_LINE> res = [] <NEW_LINE> for i in ra...
:type intervals: List[Interval] :rtype: List[Interval]
625941f5b545ff76a891444e
def __eq__(self, other: 'NluEnrichmentRelations') -> bool: <NEW_LINE> <INDENT> if not isinstance(other, self.__class__): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Return `true` when self and other are equal, false otherwise.
625941f58c3a8732951589fc
def get_inventory(self, context): <NEW_LINE> <INDENT> with LoggingSessionContext(context) as logger, ErrorHandlingContext(logger): <NEW_LINE> <INDENT> with CloudShellSessionContext(context) as cloudshell_session: <NEW_LINE> <INDENT> self._log(logger, 'get_inventory_context_json', context) <NEW_LINE> cloud_provider_reso...
Discovers the resource structure and attributes. :param AutoLoadCommandContext context: the context the command runs on :return Attribute and sub-resource information for the Shell resource you can return an AutoLoadDetails object :rtype: AutoLoadDetails
625941f582261d6c526abae2
def reverse_contiguous_sequence(chars, line_start, line_end, highest_level, lowest_odd_level): <NEW_LINE> <INDENT> for level in range(highest_level, lowest_odd_level-1, -1): <NEW_LINE> <INDENT> _start = _end = None <NEW_LINE> for run_idx in range(line_start, line_end+1): <NEW_LINE> <INDENT> run_ch = chars[run_idx] <NEW...
L2. From the highest level found in the text to the lowest odd level on each line, including intermediate levels not actually present in the text, reverse any contiguous sequence of characters that are at that level or higher.
625941f57047854f462a1a3b
@utils.arg('consistencygroup', metavar='<consistencygroup>', help='Name or ID of a consistency group.') <NEW_LINE> @utils.service_type('volumev2') <NEW_LINE> def do_consisgroup_show(cs, args): <NEW_LINE> <INDENT> info = dict() <NEW_LINE> consistencygroup = _find_consistencygroup(cs, args.consistencygroup) <NEW_LINE> in...
Shows details of a consistency group.
625941f5187af65679ca575a
def show_cluster(self, generation, cluster, visstate=None): <NEW_LINE> <INDENT> tag = "G%sc%s" % (generation, cluster) <NEW_LINE> if self.molids.get(tag) is None: <NEW_LINE> <INDENT> self.load_cluster(generation, cluster) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if visstate is None: <NEW_LINE> <INDENT> visstate = ...
Shows or hides a cluster. If not loaded, loads it
625941f5c432627299f05284
def parse_test_html_get_json(): <NEW_LINE> <INDENT> with open(r'C:\Users\topeasecpb\Desktop\test.html', 'r', encoding='utf8') as fp: <NEW_LINE> <INDENT> data_stream = fp.read() <NEW_LINE> <DEDENT> soup = BeautifulSoup(data_stream, 'html.parser') <NEW_LINE> data_select = soup.select('pre.data') <NEW_LINE> data_str = dat...
从获取的测试html中获取json字符串 :return:
625941f555399d3f05588cf2
def delete_queue(self, request): <NEW_LINE> <INDENT> query_strings = {} <NEW_LINE> headers = {} <NEW_LINE> if request.get_request_id() is not None: <NEW_LINE> <INDENT> headers["X-GS2-REQUEST-ID"] = request.get_request_id() <NEW_LINE> <DEDENT> from gs2_job_queue_client.control.DeleteQueueRequest import DeleteQueueReques...
ジョブキューを削除します<br> <br> :param request: リクエストパラメータ :type request: gs2_job_queue_client.control.DeleteQueueRequest.DeleteQueueRequest
625941f5287bf620b61d4099
def test_from_sys_path_device_not_found(self): <NEW_LINE> <INDENT> sys_path = "there_will_not_be_such_a_device" <NEW_LINE> with pytest.raises(DeviceNotFoundAtPathError) as exc_info: <NEW_LINE> <INDENT> Devices.from_sys_path(_CONTEXT, sys_path) <NEW_LINE> <DEDENT> error = exc_info.value <NEW_LINE> assert error.sys_path ...
Verify that a non-existant sys_path causes an exception.
625941f5bde94217f3683424
def write(self, s: str) -> None: <NEW_LINE> <INDENT> if not isinstance(s, str): <NEW_LINE> <INDENT> raise TypeError('write() argument must be str, not {}'.format(type(s))) <NEW_LINE> <DEDENT> self.buffer.byte_buf += s.encode(encoding=self.encoding, errors=self.errors) <NEW_LINE> if self.echo: <NEW_LINE> <INDENT> self.i...
Add str to internal bytes buffer and if echo is True, echo contents to inner stream
625941f5656771135c3ebeb0
def generate_print_info(timestamp, endpoint_name, err_no, success_no): <NEW_LINE> <INDENT> return [timestamp, endpoint_name, '%.2f' % calculate_percent(success_no, err_no) ]
makes a list from the description information of an endpoint, which will be printed later
625941f5d7e4931a7ee9e559
def checkLineLine(segA, segB, lineA, lineB): <NEW_LINE> <INDENT> orientA = checkPointLine(segA,lineA,lineB) <NEW_LINE> orientB = checkPointLine(segB,lineA,lineB) <NEW_LINE> if orientA == orientB == "on": <NEW_LINE> <INDENT> return "colinear" <NEW_LINE> <DEDENT> elif orientA == 'left': <NEW_LINE> <INDENT> if orientB == ...
Checks whether segment is "left", "right", "cross" or "colinear" relative to line. In case line is norizontal, its "left" is below the line by convention.
625941f5167d2b6e312191ce
def block(self, blocker, blockcard=None): <NEW_LINE> <INDENT> if not isinstance(blocker, Player): <NEW_LINE> <INDENT> raise TypeError() <NEW_LINE> <DEDENT> if (self.is_blockable and self.can_advance_state(StateAction.BLOCK) and not self.only_target_can_block or blocker == self.target): <NEW_LINE> <INDENT> if ((blockcar...
Blocks action. Returns None if can't be blocked.
625941f51b99ca400220b0ee
def get_ad(size): <NEW_LINE> <INDENT> products = Product.objects.filter(ad__size__size__exact=size, ad__accepted=True).distinct() <NEW_LINE> if not products: <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> product = products[Impression.objects.count() % len(products)] <NEW_LINE> return random.choice(product.ad_se...
Get the ad from the database. Go through each Product and get the first Ad of that Product. If the Product has more than one Ad, get the next one, next time we get to that Ad. Return a 404 if nothing is found
625941f57d43ff24873a32df
def wascores(x, w, expand=False): <NEW_LINE> <INDENT> wa = np.zeros((w.shape[1], x.shape[1])) <NEW_LINE> for i in range(wa.shape[0]): <NEW_LINE> <INDENT> wa[i, :] = np.average(x, axis=0, weights=w[:,i]) <NEW_LINE> <DEDENT> if expand: <NEW_LINE> <INDENT> x_w = w.sum(axis=1) <NEW_LINE> ewa_w = w.sum(axis=0) <NEW_LINE> x_...
Inspired by vegan function wascores https://rdrr.io/rforge/vegan/man/wascores.html to compute species scores. x: 2D numpy array of the scores w: abundance data expand: logical, if True species has a weigthed variance
625941f58e05c05ec3eea9b4
@asyncio.coroutine <NEW_LINE> def print_every_second_coroutine(type): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> for i in range(10): <NEW_LINE> <INDENT> print(i, "s (corotine {})".format(type)) <NEW_LINE> yield from asyncio.sleep(1) <NEW_LINE> <DEDENT> loop = asyncio.get_event_loop() <NEW_LINE> loop.stop()
Print seconds
625941f5dd821e528d63b7dd
def get_next_steps( self, status: Dict[StepName, JobStatusString], step2age=None ) -> Tuple[bool, Optional[EvalStateString], List[StepName]]: <NEW_LINE> <INDENT> CS = ChallengesConstants <NEW_LINE> assert isinstance(status, dict) <NEW_LINE> assert STATE_START in status <NEW_LINE> assert status[STATE_START] == CS.STATUS...
status is a dictionary from step name to status. It contains at the beginning START: success Returns: bool (complete) optional status: ['error', 'failed', 'success'] a list of steps to activate next
625941f5a8ecb033257d3704
def __long__(*args, **kwargs): <NEW_LINE> <INDENT> pass
x.__long__() <==> long(x)
625941f5fb3f5b602dac3cd4
def get_webhook_id(self, ha_url, favs=None) -> str or None: <NEW_LINE> <INDENT> favs = favs if favs else self.device.favorites() <NEW_LINE> if 'http' not in favs: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> for fav_id in favs['http']: <NEW_LINE> <INDENT> if favs['http'][fav_id]['value'] == ha_url: <NEW_LINE> <I...
Return the device favorite ID for the given URL. The favorite must exist or there will be problems.
625941f5627d3e7fe0d6948c
def estimate_exchange_op(_route_a, _route_b, a_node_ind, b_node_ind): <NEW_LINE> <INDENT> new_route_a, new_route_b = do_exchange(_route_a.copy(), _route_b.copy(), a_node_ind, b_node_ind) <NEW_LINE> old_sub_solution_cost = self.calculate_solution_target_metric([_route_a, _route_b], False) <NEW_LINE> new_sub_solution_cos...
:param _route_a: :param _route_b: :param a_node_ind: :param b_node_ind: :return:
625941f55fdd1c0f98dc086f
def _prepare_xml(self, xml_string): <NEW_LINE> <INDENT> xml_string = xml_string.replace(" ", "") <NEW_LINE> xml_string = xml_string.replace("\n", "") <NEW_LINE> xml_string = xml_string.replace("\t", "") <NEW_LINE> return xml_string
Remove characters from string which hinder XML equality testing.
625941f5925a0f43d254a4b7
@getbundle2partsgenerator('phases') <NEW_LINE> def _getbundlephasespart(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, **kwargs): <NEW_LINE> <INDENT> if kwargs.get(r'phases', False): <NEW_LINE> <INDENT> if not 'heads' in b2caps.get('phases'): <NEW_LINE> <INDENT> raise ValueError(_('no common phases ex...
add phase heads part to the requested bundle
625941f556ac1b37e62647fc
def _compile_categories(self): <NEW_LINE> <INDENT> product_type = self.product_type <NEW_LINE> product_type_parent_category_id = '99' <NEW_LINE> product_type_category_found = None <NEW_LINE> for child in self.magento.category_children(product_type_parent_category_id): <NEW_LINE> <INDENT> if child['name'].lower() == pro...
return categories to assign and create them if needed
625941f5283ffb24f3c55f34
def get_instance( model, instance_or_pk, timeout=None, using=None, create=False, defaults=None ): <NEW_LINE> <INDENT> pk = getattr(instance_or_pk, 'pk', instance_or_pk) <NEW_LINE> key = instance_key(model, instance_or_pk) <NEW_LINE> data = cache.get(key) <NEW_LINE> if data is not None: <NEW_LINE> <INDENT> try: <NEW_LIN...
Returns the ``model`` instance with a primary key of ``instance_or_pk``. If the data is cached it will be returned from there, otherwise the regular Django ORM is queried for this instance and the data stored in the cache. If omitted, the timeout value defaults to ``settings.CACHE_TOOLBOX_DEFAULT_TIMEOUT`` instead of...
625941f54a966d76dd551650
def test__create_mass_action__marate_type_as_string(self): <NEW_LINE> <INDENT> test_reactants = {} <NEW_LINE> test_products = {"C": 1} <NEW_LINE> test_rate = "k1" <NEW_LINE> test_reaction = Reaction( name="test_reaction", reactants=test_reactants, products=test_products, rate=test_rate ) <NEW_LINE> test_reaction._creat...
Test Reaction._create_mass_action marate as string.
625941f567a9b606de4a84f0
def __ne__(self, *args): <NEW_LINE> <INDENT> return _DataModel.NodalPlanes___ne__(self, *args)
__ne__(NodalPlanes self, NodalPlanes other) -> bool
625941f5c432627299f05285
def __populateLists(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fp = open("assets/names.csv", "r") <NEW_LINE> <DEDENT> except IOError as detail: <NEW_LINE> <INDENT> print("unable to open file %s for READ - details:%s" % ("assets/names.csv", detail)) <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
Load the class lists from CSV files found within the assets folder
625941f576d4e153a657f16c
def add_share(self, jid, resource, hash, name='', size=0, files=None): <NEW_LINE> <INDENT> res = self.get_resource(jid, resource) <NEW_LINE> res['shares'][hash] = {} <NEW_LINE> res['shares'][hash]['name'] = name <NEW_LINE> res['shares'][hash]['size'] = size <NEW_LINE> res['shares'][hash]['files'] = files <NEW_LINE> res...
Add a Share to a JIDs Resource :param jid: :param resource: :param hash: SHA1 Hash :type hash: str :param name: name of the share :type name: str :param size: size of the share in bytes :type size: int :param files: list of files in the Share :type files: list of str :return:
625941f5be7bc26dc91cdc2e
def gated_linear_map(self, inputs, suffix, bias_start_reset, in_units, out_units): <NEW_LINE> <INDENT> def reset_gate(name): <NEW_LINE> <INDENT> prefix = self.prefix + name + suffix <NEW_LINE> reset = conv_linear_map(inputs, in_units * 2, in_units * 2, bias_start_reset, prefix) <NEW_LINE> return tf.nn.sigmoid(reset) <N...
Linear mapping with two reset gates. Args: inputs: Input tensor suffix: Linear map name suffix bias_start_reset: Bias start value for reset gate in_units: Size of input tensor feature map count out_units: Size of output tensor feature map count Return: tf.Tensor: Convolution apply to input tensor
625941f599cbb53fe679321e
def removeReader(self, reader): <NEW_LINE> <INDENT> self._sendToThread(dictRemove, self.reads, reader)
Remove a Selectable for notification of data available to read.
625941f54f88993c3716c69a
def merge(self): <NEW_LINE> <INDENT> end = False <NEW_LINE> count = 0 <NEW_LINE> for i in self.file_list(): <NEW_LINE> <INDENT> logger.info(i) <NEW_LINE> with open(i) as input_file: <NEW_LINE> <INDENT> obj = json.load(input_file) <NEW_LINE> self.merge_file(obj, end) <NEW_LINE> <DEDENT> count += 1 <NEW_LINE> <DEDENT> en...
merging driver function
625941f5bde94217f3683425
def create_plot(tree): <NEW_LINE> <INDENT> fig = plt.figure(1, facecolor='white') <NEW_LINE> fig.clf() <NEW_LINE> axis_props = dict(xticks=[], yticks=[]) <NEW_LINE> create_plot.ax1 = plt.subplot(111, frameon=False, **axis_props) <NEW_LINE> plot_tree.totalW = float(get_leaf_numbers(tree)) <NEW_LINE> plot_tree.totalD = f...
绘制决策树 :param tree:输入的树 :return:None
625941f5b5575c28eb68e640
def __init__(self, name, type, path, position=[0, 0, 0], orientation=[0, 0, 0, 1], world=None, color=[1, 1, 1, 1]): <NEW_LINE> <INDENT> self.world = world if world is not None else BulletWorld.current_bullet_world <NEW_LINE> self.name = name <NEW_LINE> self.type = type <NEW_LINE> self.path = path <NEW_LINE> self.color ...
The constructor loads the urdf file into the given BulletWorld, if no BulletWorld is specified the 'current_bullet_world' will be used. It is also possible to load .obj and .stl file into the BulletWorld. The color parameter takes the color as rgba. This is only used when spawning .obj or .stl files and will be ignored...
625941f50fa83653e46575f1
def __init__(self, config): <NEW_LINE> <INDENT> VapiInterface.__init__(self, config, _InboundStub)
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.
625941f516aa5153ce362ab3
def slotConfigureFileSharingDone(self): <NEW_LINE> <INDENT> pass
void KFileSharePropsPlugin.slotConfigureFileSharingDone()
625941f57d43ff24873a32e0
def _parse_Class(self, node): <NEW_LINE> <INDENT> self.assign(node.name, ClassScope(node,self.imports,self.localModules,self.rootScope,self))
Parse a class statement AST node
625941f56e29344779a62c4b
def encrypt(content): <NEW_LINE> <INDENT> content_list = list(content) <NEW_LINE> content_len = len(content) <NEW_LINE> encrypted_data = "" <NEW_LINE> w = math.ceil(content_len/3) <NEW_LINE> h = 3 <NEW_LINE> Matrix = [[0 for x in range(w)] for y in range(h)] <NEW_LINE> iter = 0 <NEW_LINE> for x in range(w): <NEW_LINE>...
encrypt content using a route cipher in which the content is put into a matrix top to bottom left to write then is added to the encrypted matrix from right to left top to bottom
625941f560cbc95b062c6b7e
def __init__(__self__, *, validation: pulumi.Input['VirtualNodeSpecBackendVirtualServiceClientPolicyTlsValidationArgs'], certificate: Optional[pulumi.Input['VirtualNodeSpecBackendVirtualServiceClientPolicyTlsCertificateArgs']] = None, enforce: Optional[pulumi.Input[bool]] = None, ports: Optional[pulumi.Input[Sequence[p...
:param pulumi.Input['VirtualNodeSpecBackendVirtualServiceClientPolicyTlsValidationArgs'] validation: The listener's Transport Layer Security (TLS) validation context. :param pulumi.Input['VirtualNodeSpecBackendVirtualServiceClientPolicyTlsCertificateArgs'] certificate: The listener's TLS certificate. :param pulumi.Inpu...
625941f5a8370b7717052ed7
def test_numbers_long(): <NEW_LINE> <INDENT> assert 1606938044258990275541962092341162602522202993782792835301376 == 2 ** 200
python numbers can be arbitrarily big unlike C
625941f566673b3332b926cb
def application(environ, start_response): <NEW_LINE> <INDENT> global OAS <NEW_LINE> path = environ.get('PATH_INFO', '').lstrip('/') <NEW_LINE> logger = logging.getLogger('oicServer') <NEW_LINE> if path == "robots.txt": <NEW_LINE> <INDENT> return static(environ, start_response, logger, "static/robots.txt") <NEW_LINE> <D...
The main WSGI application. Dispatch the current request to the functions from above and store the regular expression captures in the WSGI environment as `oic.url_args` so that the functions from above can access the url placeholders. If nothing matches call the `not_found` function. :param environ: The HTTP applicat...
625941f5956e5f7376d714a5
def __init__(self, handle: Callable, host: str = "127.0.0.1", port: int = 8040): <NEW_LINE> <INDENT> self.handle = handle <NEW_LINE> self.host = host <NEW_LINE> self.port = port
:param handle: A function receiving a bytes-like variable as it's only parameter. Handles all LiveFeed events :param host: The host of the LiveFeed to listen to :param port: The port on which LiveFeed is configured
625941f5e1aae11d1e74a2f8
def minSumOfLengths(self, arr, target): <NEW_LINE> <INDENT> N = len(arr) <NEW_LINE> dp = [float('inf')]*N <NEW_LINE> minLen = float('inf') <NEW_LINE> tot = 0 <NEW_LINE> start = 0 <NEW_LINE> res = float('inf') <NEW_LINE> for end in range(len(arr)): <NEW_LINE> <INDENT> tot += arr[end] <NEW_LINE> while tot > target: <NEW_...
:type arr: List[int] :type target: int :rtype: int
625941f5d10714528d600325
def classFactory(iface): <NEW_LINE> <INDENT> from .gdb2gpkg import Geodatabase2Geopackage <NEW_LINE> return Geodatabase2Geopackage(iface)
Load Geodatabase2Geopackage class from file Geodatabase2Geopackage. :param iface: A QGIS interface instance. :type iface: QgsInterface
625941f57cff6e4e81117fc0
def read_stdout_stderr_files(self, run_dir): <NEW_LINE> <INDENT> my_max_encoded_length = MAX_OUTPUT_LENGTH - 2000 <NEW_LINE> if self._output_file is None: <NEW_LINE> <INDENT> self._stdout_text = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> my_out_file = os.path.join(run_dir, self._output_file) <NEW_LINE> try: <NE...
This function reads both stdout and stderr files and populates these fields in the Job class.
625941f55fc7496912cc3fb8
def destroy(self, event): <NEW_LINE> <INDENT> if self.__destroy: <NEW_LINE> <INDENT> self.__destroy(event)
Handle DestroyNotifyEvent generated by X.DestroyNotify event.
625941f5d6c5a1020814468a
def __init__(self, stockID, barrierMinute, barrierDay, dateList, tradeFlags): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.stockID = stockID <NEW_LINE> self.barrierMinute = barrierMinute <NEW_LINE> self.barrierDay = barrierDay <NEW_LINE> self.dateList = dateList <NEW_LINE> self.tradeFlags = tradeFlags
Args: stockID:股票ID barrierMinute:进程同步器(分钟) barrierDay:进程同步器(日) dateList:传入日期列表 tradeFlags:交易信号数组(3)
625941f5ec188e330fd5adcc
def test_compress_mixed_sequence1(self): <NEW_LINE> <INDENT> orig_array = [255, 255, 0, 255, 0, 255] <NEW_LINE> actual = RLE.compress(orig_array) <NEW_LINE> expected = [128, 255, 3, 0, 255, 0, 255] <NEW_LINE> self.assertEqual(actual, expected)
Compress array that starts with the identical values and then has different values
625941f5bd1bec0571d90c6a
def suite(): <NEW_LINE> <INDENT> return TestSuite([RepositoryTest()])
returns all the testcases in this module
625941f571ff763f4b549cd2
def _write_summary(self, logdir='summary/'): <NEW_LINE> <INDENT> writer = tf.summary.FileWriter(logdir=logdir, graph=self.graph) <NEW_LINE> writer.close()
Write graph to summary-file so it can be shown in TensorBoard. This function is used for debugging and may be changed or removed in the future. :param logdir: Directory for writing the summary-files. :return: Nothing.
625941f5f7d966606f6aa646
def __init__(self): <NEW_LINE> <INDENT> pass
Initialize a IndexBam instance.
625941f538b623060ff0b427
def initialize_options (self): <NEW_LINE> <INDENT> self.bdist_dir = None <NEW_LINE> self.keep_temp = 0 <NEW_LINE> self.dist_dir = None <NEW_LINE> self.include_sources = False <NEW_LINE> self.plat_name = '' <NEW_LINE> self.edition = EDITION
Initialize the options
625941f5d10714528d600326
def transform_img(img_array, size= SINGLE_SIZE): <NEW_LINE> <INDENT> img_transformed = [img_array.reshape(size, size), img_array[::-1].reshape(size, size)] <NEW_LINE> for i in range(0, 2): <NEW_LINE> <INDENT> img_transformed.append(img_transformed[i].transpose()) <NEW_LINE> <DEDENT> for i in range(0, 4): <NEW_LINE> <IN...
returns list of eight transformations of img_array (all Pi/4 rotations & reflection) :param img_array: list of lists representing square matrix :param size: numcolumns/numrows of the square array (picture)
625941f544b2445a339326cc
def remove_waveforms(self): <NEW_LINE> <INDENT> for wave_name in [wf.name for wf in self.waveformArr]: <NEW_LINE> <INDENT> for session in self.sessions: <NEW_LINE> <INDENT> session.delete_named_waveform(wave_name) <NEW_LINE> <DEDENT> <DEDENT> self.waveformArr = []
Removes our written waveforms from the hsdio devices
625941f51f037a2d8b946836
def mumblestatus(self, irc, msg, args): <NEW_LINE> <INDENT> uptime = str(datetime.timedelta(seconds=self.server.getUptime())) <NEW_LINE> running = self.server.isRunning() <NEW_LINE> msg_str = _('The server is ') <NEW_LINE> if running: <NEW_LINE> <INDENT> msg_str += _('online and ') <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
takes no arguments Returns a status message of the mumble server
625941f53346ee7daa2b33ad
def _eval_func(self, f, args): <NEW_LINE> <INDENT> if not isinstance(f, NusFunction): <NEW_LINE> <INDENT> raise NuskellEnvError(f"`{f}' cannot be evaluated.") <NEW_LINE> <DEDENT> if isinstance(f.body, str): <NEW_LINE> <INDENT> return self._fun.eval_builtin_functions(f.body, args) <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
Evaluate a function. A function (or module, class, macro, etc.) as specified in the translation scheme. Args: f (:obj:`NusFunction()`): The function to evaluate. args (list): A list of arguments for the function.
625941f5507cdc57c6307325
def snapshot_get(context, id): <NEW_LINE> <INDENT> return IMPL.snapshot_get(context, id)
Get a snapshot by its id. :param context: The security context :param id: ID of the snapshot :returns: Dictionary-like object containing properties of the snapshot Raises SnapshotNotFound if snapshot with the given ID doesn't exist.
625941f599cbb53fe679321f
def quick_sort_growing(list_num: list) -> list: <NEW_LINE> <INDENT> if len(list_num) < 2: <NEW_LINE> <INDENT> return list_num <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pivot = list_num[0] <NEW_LINE> less_part = [i for i in list_num[1:] if i < pivot] <NEW_LINE> greater_part = [i for i in list_num[1:] if i > pivot] <...
Return the sorted list in growing order
625941f5aad79263cf391085
def make_server(host, port, app, server_class=AsyncWsgiServer, handler_class=AsyncWsgiHandler, ws_handler_class=None, ws_path='/ws'): <NEW_LINE> <INDENT> handler_class.ws_handler_class = ws_handler_class <NEW_LINE> handler_class.ws_path = ws_path <NEW_LINE> httpd = server_class((host, port), RequestHandlerClass=handler...
Create server instance with an optional WebSocket handler For pure WebSocket server ``app`` may be ``None`` but an attempt to access any path other than ``ws_path`` will cause server error. :param host: hostname or IP :type host: str :param port: server port :type port: int :param app: WSGI application :param server_...
625941f5dd821e528d63b7de
def svm_classification( instances, labels ): <NEW_LINE> <INDENT> X = np.array(instances) <NEW_LINE> y = np.array(labels) <NEW_LINE> print( "training size: ", len(instances) ) <NEW_LINE> clf = SVC(kernel='rbf', C=22.252, gamma=0.007848) <NEW_LINE> clf.fit(X, y) <NEW_LINE> return clf
SVM Classification for PCA pipeline http://scikit-learn.org/stable/auto_examples/plot_digits_pipe.html#example-plot-digits-pipe-py
625941f59f2886367277aec2
def install(self, file, destination=None): <NEW_LINE> <INDENT> installation_dir = destination or self.installation_dir <NEW_LINE> if not os.path.exists(installation_dir): <NEW_LINE> <INDENT> os.makedirs(installation_dir) <NEW_LINE> <DEDENT> new_file = os.path.join(installation_dir, os.path.basename(file)) <NEW_LINE> if...
Install. :param file: :param destination: :return:
625941f53539df3088e2e986
def get_primary_group(obj_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> security_descriptor = win32security.GetFileSecurity( obj_name, win32security.GROUP_SECURITY_INFORMATION) <NEW_LINE> primary_group_gid = security_descriptor.GetSecurityDescriptorGroup() <NEW_LINE> <DEDENT> except MemoryError: <NEW_LINE> <INDEN...
Gets the primary group of the passed object Args: obj_name (str): The path for which to obtain primary group information Returns: str: The primary group for the object Usage: .. code-block:: python salt.utils.win_dacl.get_primary_group('c:\file')
625941f5d4950a0f3b08c980
def create_only_one_json_file(files): <NEW_LINE> <INDENT> jobs_fr = open_json_file(files[0]) <NEW_LINE> jobs_en = open_json_file(files[1]) <NEW_LINE> data = jobs_en + jobs_fr <NEW_LINE> for i in files: <NEW_LINE> <INDENT> os.remove(i) <NEW_LINE> <DEDENT> create_a_json_file(data)
Open the first file Loads it's content Open the second files loads it's content append Second file to the first file delete all the previous json file# Create a json file (full.json)
625941f5d58c6744b4258297
def flatten_header(header,delete=False): <NEW_LINE> <INDENT> if not isinstance(header,pyfits.Header): <NEW_LINE> <INDENT> raise Exception("flatten_header requires a pyfits.Header instance") <NEW_LINE> <DEDENT> newheader = header.copy() <NEW_LINE> for key in newheader.keys(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT>...
Attempt to turn an N-dimensional fits header into a 2-dimensional header Turns all CRPIX[>2] etc. into new keywords with prefix 'A' header must be a `~astropy.io.fits.Header` instance
625941f51d351010ab856155
def test_get_oplog_cursor(self): <NEW_LINE> <INDENT> test_oplog, primary_conn, oplog_coll = self.get_oplog_thread() <NEW_LINE> self.assertEqual(test_oplog.get_oplog_cursor(None), None) <NEW_LINE> primary_conn['test']['test'].insert({'name': 'paulie'}) <NEW_LINE> ts = test_oplog.get_last_oplog_timestamp() <NEW_LINE> cur...
Test get_oplog_cursor in oplog_manager. Assertion failure if it doesn't pass
625941f530c21e258bdfaae0
def updateF(self, data): <NEW_LINE> <INDENT> self.setImage(data['corrected'])
Override.
625941f5956e5f7376d714a6
def getFWHM(x, y, fwhmFactor = 1.1, smooth = False, peakpos = 0): <NEW_LINE> <INDENT> if smooth == True: <NEW_LINE> <INDENT> y = butterLowpassFiltFilt(y) <NEW_LINE> <DEDENT> maxdices = detectMinima(-y) <NEW_LINE> if len(maxdices) == 0: <NEW_LINE> <INDENT> if peakpos != 0: <NEW_LINE> <INDENT> maxdices = np.array([abs(x ...
Estimates FWHM of largest peak in a given dataset
625941f5293b9510aa2c38ca
def remove_station(self): <NEW_LINE> <INDENT> self.rslbox.takeItem(self.rslbox.currentRow())
Remove station from RSL list
625941f5d4950a0f3b08c981
def calculate_rmes(task): <NEW_LINE> <INDENT> model_space_filename = "model_space.dat".format(**task) <NEW_LINE> if ("su3rme_mode" not in task): <NEW_LINE> <INDENT> task["su3rme_mode"] = "text" <NEW_LINE> <DEDENT> command_line = [ su3rme_executable, model_space_filename, model_space_filename, "relative_operators.dat", ...
Invoke lsu3shell SU3RME code to calculate rmes of relative unit tensors and symplectic raising/lowering/N operators in SU(3)-NCSM basis. Invokes SU3RME_MPI.
625941f550485f2cf553d3d7
def create_model(data_matrix, num_people, num_groups, alpha, B): <NEW_LINE> <INDENT> data_vector = data_matrix.reshape(num_people*num_people).T <NEW_LINE> alpha_vector = alpha <NEW_LINE> B_matrix = B <NEW_LINE> pi_list = np.empty(num_people, dtype=object) <NEW_LINE> for person in range(num_people): <NEW_LINE> <INDENT> ...
Function that takes in a set of data and returns a dictionary of MCMC object of each random variable. In addition, the hyperparameters for each random variable will be imbued in the objects. Overcommented for readibility's sake
625941f573bcbd0ca4b2c6b0
def __init__(self, name, segmentdata, N=256): <NEW_LINE> <INDENT> self.monochrome = False <NEW_LINE> Colormap.__init__(self, name, N) <NEW_LINE> self._segmentdata = segmentdata
Create color map from linear mapping segments segmentdata argument is a dictionary with a red, green and blue entries. Each entry should be a list of x, y0, y1 tuples. See makeMappingArray for details
625941f5cc40096d61595f88
def visualizations(x_train, y_train): <NEW_LINE> <INDENT> W= 7 <NEW_LINE> L=10 <NEW_LINE> fig, axes = plt.subplots(L,W, figsize = (15,15)) <NEW_LINE> axes = axes.ravel() <NEW_LINE> num_training = len(x_train) <NEW_LINE> for i in np.arange(0,W*L): <NEW_LINE> <INDENT> index=np.random.randint(0, num_training) <NEW_LINE> a...
Function that creates a visualization of training dataset's images with their classes. Implemented with matplotlib. Args: x_train (NumPy array): The first parameter, includes the training set images. y_train (NumPy array): Second paramater. The images labels in numbers mode. Values between (0,42). Returns: ...
625941f5d99f1b3c44c67bbd
def _compute_additional_sigma(self): <NEW_LINE> <INDENT> return 0.35
Additional "epistemic" uncertainty version of the model. The value is not published, only available from G. McVerry (pers. communication 9/8/18).
625941f5fbf16365ca6f680d
def command_id_from_name(self, name: str) -> Optional[str]: <NEW_LINE> <INDENT> cmd_id = self.command_dict.get(name) <NEW_LINE> return cmd_id
Returns the full cmd_id defined by apper Args: name: this is the value set in options for cmd_id Returns: The full cmd_id (i.e. CompanyName_AppName_cmd_id)
625941f5e76e3b2f99f3ae3b
def setNode(self,node): <NEW_LINE> <INDENT> self.node=node.lower()
Set the node part of the JID to new value. Specify None to remove the node part.
625941f50a366e3fb873ee5c
def generate_import_code(pipeline, operators): <NEW_LINE> <INDENT> def merge_imports(old_dict, new_dict): <NEW_LINE> <INDENT> for key in new_dict.keys(): <NEW_LINE> <INDENT> if key in old_dict.keys(): <NEW_LINE> <INDENT> old_dict[key] = set(old_dict[key]) | set(new_dict[key]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN...
Generate all library import calls for use in TPOT.export(). Parameters ---------- pipeline: List List of operators in the current optimized pipeline operators: List of operator class from operator library Returns ------- pipeline_text: String The Python code that imports all required library used in the c...
625941f5167d2b6e312191cf
def element_of(paramname, elementname=None): <NEW_LINE> <INDENT> def inner(f): <NEW_LINE> <INDENT> nonlocal elementname <NEW_LINE> if elementname is None: <NEW_LINE> <INDENT> if f.__name__.startswith(_config_token): <NEW_LINE> <INDENT> elementname = trim_token(f.__name__) <NEW_LINE> <DEDENT> <DEDENT> f._element_of = pa...
Append an elementname and a parentname attribute that will be used to generate parsers for lists and mappings of this function.
625941f557b8e32f52483adb
def __init__(self, ngram): <NEW_LINE> <INDENT> self.ngram = ngram <NEW_LINE> self.phrases = [] <NEW_LINE> self.reviews = set() <NEW_LINE> self.log_prob = float('nan')
Create an empty cluster around the given n-gram.
625941f556ac1b37e62647fd
def generate(N) : <NEW_LINE> <INDENT> G = np.atleast_2d(np.arange(1, N)) <NEW_LINE> return G * G.T % N
Generate the Cyclic Matrix multiplication Table :param N: Size :type N: int
625941f5f8510a7c17cf9d3d
def initUpload(self, upload): <NEW_LINE> <INDENT> if upload['size'] <= 0: <NEW_LINE> <INDENT> return upload <NEW_LINE> <DEDENT> upload['name'] = re.sub('\s+', ' ', upload['name']) <NEW_LINE> uid = uuid.uuid4().hex <NEW_LINE> key = '/'.join(filter(None, (self.assetstore.get('prefix', ''), uid[0:2], uid[2:4], uid))) <NEW...
Build the request required to initiate an authorized upload to S3.
625941f58c0ade5d55d3effc
def same_start_word(row): <NEW_LINE> <INDENT> if not row['question1'] or not row['question2']: <NEW_LINE> <INDENT> return np.nan <NEW_LINE> <DEDENT> return int(row['question1'][0] == row['question2'][0])
Check if the paired questions have the same first word :param row: dataframe row :return: boolean as int
625941f5435de62698dfe288
def initialise(self,identity,params=None, headers=None): <NEW_LINE> <INDENT> path = self._sub_url_params('/billing_request_flows/:identity/actions/initialise', { 'identity': identity, }) <NEW_LINE> if params is not None: <NEW_LINE> <INDENT> params = {'data': params} <NEW_LINE> <DEDENT> response = self._perform_request(...
Initialise a billing request flow. Returns the flow having generated a fresh session token which can be used to power integrations that manipulate the flow. Args: identity (string): Unique identifier, beginning with "BRQ". params (dict, optional): Request body. Returns: BillingRequestFlow
625941f591af0d3eaac9c059
def get_degree_sequence(graph, nodes, degree_dict=None, internal=True): <NEW_LINE> <INDENT> nodes = nodes[nodes != config.PAD_VALUE].cpu().numpy() <NEW_LINE> subgraph = graph.subgraph(nodes) <NEW_LINE> internal_degree_seq = [degree for node, degree in list(subgraph.degree(nodes))] <NEW_LINE> if internal: <NEW_LINE> <IN...
Returns the ordered degree sequence of a list of nodes
625941f5b545ff76a8914450
def solve(grid): <NEW_LINE> <INDENT> v=grid_values(grid) <NEW_LINE> return search(v)
Find the solution to a Sudoku grid. Args: grid(string): a string representing a sudoku grid. Example: '2.............62....1....7...6..8...3...9...7...6..4...4....8....52.............3' Returns: The dictionary representation of the final sudoku grid. False if no solution exists.
625941f50fa83653e46575f2