code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def tensor(self, obj, *arg, **kwargs): <NEW_LINE> <INDENT> getattr(self, self.fol_plot)(obj.eigenfols[0], label=obj.name + '-E1', **kwargs) <NEW_LINE> getattr(self, self.fol_plot)(obj.eigenfols[1], label=obj.name + '-E2', **kwargs) <NEW_LINE> getattr(self, self.fol_plot)(obj.eigenfols[2], label=obj.name + '-E3', **kwar...
Plot tensor pricipal planes or directions
625941f663b5f9789fde7743
def isfile(self, path): <NEW_LINE> <INDENT> return os.path.isfile(self.fname(path))
>>> this.isfile("isfile") False >>> open(this.fname("isfile"), mode="w").close() >>> this.isfile("isfile") True
625941f62eb69b55b151cf16
def get_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=_DESCRIPTION) <NEW_LINE> parser.add_argument("-c", "--apache-ctl", default="apachectl", help="path to the `apachectl` binary") <NEW_LINE> parser.add_argument("-d", "--server-root", help=("location of the root directory of your Apache " "co...
Parses command line arguments :returns: Parsed command line options :rtype: argparse.Namespace
625941f666656f66f7cbc809
def getAccountInfo(self): <NEW_LINE> <INDENT> total_stocks = 0 <NEW_LINE> total_balance = 0 <NEW_LINE> details = [] <NEW_LINE> for exchange in self.exchanges: <NEW_LINE> <INDENT> account_info = _C(exchange.GetAccount) <NEW_LINE> total_balance = total_balance + account_info.Balance + account_info.FrozenBalance <NEW_LINE...
获取交易所的账号的信息
625941f6d10714528d600348
def tag_POS(line): <NEW_LINE> <INDENT> return nltk.pos_tag(line)
Given a list of words, find the part of speech of each word
625941f6bde94217f3683447
def repositories(self, organization=''): <NEW_LINE> <INDENT> return self.get_values(organization, 'repositories', filter="repositories", datatype=Repository)
Get list of all repositories in an organization. If organization is not given, or is empty, then this will list repositories for all organizations the authenticated user belongs to. :param: str organization: organization to list repositories for
625941f685dfad0860c3b4ba
def get_all_mtls_from_context(ctx, **kwargs): <NEW_LINE> <INDENT> ix = get_ix(kwargs.get("ix")) <NEW_LINE> ctx_members = get_items(ctx, kind=["MaterialPhysicalStandard", "MaterialPhysicalBlend"], **kwargs) <NEW_LINE> mtls = [] <NEW_LINE> for ctx_member in ctx_members: <NEW_LINE> <INDENT> if ctx_member.get_contextual_na...
"Returns the material from the context.
625941f6a4f1c619b28b0685
def setDescs(self,descs): <NEW_LINE> <INDENT> if isinstance(descs,tuple): <NEW_LINE> <INDENT> self.descs=descs <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise TypeError("must provide tuple") <NEW_LINE> <DEDENT> return
Set the descriptors of the Apd. @type descs: tuple @rtype: None
625941f6cb5e8a47e48b80fb
def transform(self, X, y =None ): <NEW_LINE> <INDENT> if self.do_pca: <NEW_LINE> <INDENT> X = self.pca.transform(X)[:,:self.n_components] <NEW_LINE> return pd.DataFrame(X) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return X
Parameters ---------- X : array-like, shape (n_samples, n_features) Training data. Returns ------- X : array-like consisting of transformed features or original dataset
625941f615fb5d323cde1177
@pytest.fixture <NEW_LINE> def editable_user(stored_users): <NEW_LINE> <INDENT> return stored_users['editable']
Returns a user that can be safely edited by the tests.
625941f676d4e153a657f18f
@app.route('/register-user', methods=['POST']) <NEW_LINE> def register_new_user(): <NEW_LINE> <INDENT> print("Registering User") <NEW_LINE> fname = request.values.get('fname') <NEW_LINE> lname = request.values.get('lname') <NEW_LINE> email = request.values.get('email').lower() <NEW_LINE> state = request.values.get('sta...
Register a new user with the given information
625941f6fb3f5b602dac3cf7
def ShowFrontPage(self): <NEW_LINE> <INDENT> front_page = FrontPage() <NEW_LINE> front_page.request = self.request <NEW_LINE> front_page.response = self.response <NEW_LINE> front_page.get()
Do an internal (non-302) redirect to the front page. Preserves the user agent's requested URL.
625941f6507cdc57c6307348
def request(self, url): <NEW_LINE> <INDENT> self.crawled_urls += 1 <NEW_LINE> try: <NEW_LINE> <INDENT> req = requests.get(url, timeout=3) <NEW_LINE> <DEDENT> except requests.exceptions.Timeout as timeout: <NEW_LINE> <INDENT> self.log.log(logger.LogLevel.DEBUG, 'Request timed out: %s' % url) <NEW_LINE> return None <NEW_...
sends a http request to url. Adds crawled url to self.crawl_history
625941f6e64d504609d74e9c
def set_training_mode(self, mode: bool) -> None: <NEW_LINE> <INDENT> self.actor.set_training_mode(mode) <NEW_LINE> self.critic.set_training_mode(mode) <NEW_LINE> self.training = mode
Put the policy in either training or evaluation mode. This affects certain modules, such as batch normalisation and dropout. :param mode: if true, set to training mode, else set to evaluation mode
625941f63346ee7daa2b33cf
def _chain_cmds(trans, *args): <NEW_LINE> <INDENT> assert isinstance(trans, bool) <NEW_LINE> cmds = [] <NEW_LINE> if trans: <NEW_LINE> <INDENT> cmds.append(_encode_req('MULTI')) <NEW_LINE> <DEDENT> for _ in args: <NEW_LINE> <INDENT> assert isinstance(_, str) <NEW_LINE> cmds.append(_) <NEW_LINE> <DEDENT> if trans: <NEW_...
对单条指令和pipe均支持 :param trans: 是否使用事务 :param args: 已通过相关函数编码后的字符串
625941f6aad79263cf3910a8
def __init__(self, N, d): <NEW_LINE> <INDENT> means = .05 * np.random.randn(2, d) <NEW_LINE> self.X_train = np.zeros((N, d)) <NEW_LINE> self.Y_train = np.zeros(N) <NEW_LINE> for i in range(N): <NEW_LINE> <INDENT> if np.random.random() > .5: <NEW_LINE> <INDENT> y = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> y = 0 <...
Create N instances of d dimensional input vectors and a 1D class label (-1 or 1).
625941f6287bf620b61d40bc
def add_definition(self, cat, def_name, def_val, no_prune=False, gram_file="default"): <NEW_LINE> <INDENT> self._rules_processed = False <NEW_LINE> self.add_to_cat_group(cat, gram_file, def_name) <NEW_LINE> if no_prune: <NEW_LINE> <INDENT> self.no_prunes.setdefault(cat, {}).setdefault(def_name, True) <NEW_LINE> <DEDENT...
Add a new rule definition named ``def_name`` having value ``def_value`` to the category ``cat``. :param str cat: The category to add the rule to :param str def_name: The name of the rule definition :param def_val: The value of the rule definition :param bool no_prune: If the rule should explicitly *NOT* be pruned ...
625941f6379a373c97cfb1a4
def pvsat(ermodule,Geff,Tmod,area, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> a1 = ermodule['a1'] <NEW_LINE> a2 = ermodule['a2'] <NEW_LINE> a3 = ermodule['a3'] <NEW_LINE> a = ermodule['a'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise Exception('pvsat method needs 4 coefficients to run: a,...
Origin: H2M Coefficients: four Result: efficiency and/or power Parameters ------------ ermodule: dict A dictionary containing the coefficients of the module It should contain the four fields required for this model data : A dataframe containing the following columns Datetime: Da...
625941f6a17c0f6771cbe6ab
def parse_response(self, data): <NEW_LINE> <INDENT> response = {} <NEW_LINE> response['name'] = data['name'] <NEW_LINE> response['description'] = data['info'] <NEW_LINE> response['license'] = data['licenses'][0] <NEW_LINE> response['source_repo'] = data['source_code_uri'] <NEW_LINE> if 'https://github.com' not in data[...
This is the implementation of the parse_response method tailored to work with the Rubygems registry. :param data: dictionary :return: dictionary
625941f696565a6dacc8fd26
def _move_to_done_dir(self, filepath): <NEW_LINE> <INDENT> dest_path = os.path.join(const.DATA_DIR, 'done', self._yyyymmdd, os.path.relpath(filepath, const.DATA_DIR)) <NEW_LINE> logger.debug('dest_path: %s' % dest_path) <NEW_LINE> os.makedirs(os.path.dirname(dest_path), exist_ok=True) <NEW_LINE> os.rename(filepath, des...
ファイルを完了済みディレクトリに移動します。 Args: filepath: 移動するファイル
625941f67d847024c06be91f
def mimeData(self, list_of_QListWidgetItem): <NEW_LINE> <INDENT> pass
QListWidget.mimeData(list-of-QListWidgetItem) -> QMimeData
625941f69b70327d1c4e1435
def get_rpn_proposals(self): <NEW_LINE> <INDENT> return self.proposal_boxes, self.objectness_scores
applies rpn bbox deltas to anchor boxes to get region proposals. Also filter by non-max suppression and limit to 2k boxes Arguments: rpn_bbox_deltas (Tensor) : (9*fH*fW, 4) rpn_cls_probs (Tensor) : (9*fH*fW,, 2) Return: proposals_boxes (Ndarray) : ( # proposal boxes, 4) scores (Ndarray) : ( # proposal ...
625941f691af0d3eaac9c07b
def reset(self, size): <NEW_LINE> <INDENT> self.name = "Board 1D" <NEW_LINE> self.version = 0.1 <NEW_LINE> self.size = size <NEW_LINE> self.NS = size + 1 <NEW_LINE> self.WE = 1 <NEW_LINE> self.suicide = True <NEW_LINE> self._is_empty = True <NEW_LINE> self.passes_white = 0 <NEW_LINE> self.passes_black = 0 <NEW_LINE> se...
Create an initial board position, or reset the board to a new size Arguments --------- size : int size of board to reset to
625941f6e64d504609d74e9d
@pytest.fixture <NEW_LINE> def ship_from_address(): <NEW_LINE> <INDENT> address = { 'line1': '123 Main Street', 'city': 'Irvine', 'region': 'CA', 'postalCode': '92615' } <NEW_LINE> return address
Different address for testing purpose.
625941f607f4c71912b11ae2
def get_pulse_velocity_from_momentum(coordinate_array_dict,mass,direction="z"): <NEW_LINE> <INDENT> clight = 299792458 <NEW_LINE> mean_p = numpy.mean(coordinate_array_dict["p"+direction]) <NEW_LINE> gamma = numpy.sqrt(1. + (mean_p/(mass*clight))**2 ) <NEW_LINE> return mean_p/(mass*gamma)
Calculates the boost to the mean "particle" assuming the mean momentums in the other two directions are 0. Args: coordinate_array_dict: A dictionary with at least the keys z, px, py, pz with values for the corresponding numpy arrays. mass: Mass of the particle to rescale the momentum. direction: The desired...
625941f60fa83653e4657614
def create_new_user( self, usr_dct ): <NEW_LINE> <INDENT> ( params, success_check, url ) = self.setup_create_user( usr_dct ) <NEW_LINE> try: <NEW_LINE> <INDENT> r = requests.post( url, data=params, verify=True, timeout=10 ) <NEW_LINE> log.debug( 'status_code, `%s`; content, ```%s```' % (r.status_code, r.content.decode(...
Hits internal api to create new user. Called by manage_new_user()
625941f6e76e3b2f99f3ae5d
def all_r_former_pdr(self): <NEW_LINE> <INDENT> return [a.research for a in self.agents if a.former_postdoc == 1 and a.made_redundant == False]
Return a list of r values of agents who were promoted.
625941f6d486a94d0b98e7a4
def submitFilterJobs(runner, chunkNames, inDir, outDir, isProt=False): <NEW_LINE> <INDENT> logging.info("Filtering sequences: Removing duplicates and short sequences") <NEW_LINE> maxCommon.mustBeEmptyDir(outDir, makeDir=True) <NEW_LINE> filterCmd = "filterSeqFile" <NEW_LINE> if isProt: <NEW_LINE> <INDENT> filterCmd = "...
submit jobs to clear annotation file from duplicate sequences
625941f663d6d428bbe44b4f
def make_ethnic_list(mapping_dir=None, mapping_root=None): <NEW_LINE> <INDENT> mapping_dir = mapping_dir or MAPPINGS_DIR <NEW_LINE> mapping_root = mapping_root or 'dummy' <NEW_LINE> parameters = ['name', 'more', 'category', 'wikidata', 'frequency'] <NEW_LINE> header = ('{{User:André Costa (WMSE)/mapping-head' '|categor...
Create a MappingList object for ethinc groups.
625941f601c39578d7e75499
def test_supporting_a_foreign_unit_does_not_prevent_dislodgement(self): <NEW_LINE> <INDENT> pieces = [ Fleet(self.state, 0, Nations.AUSTRIA, self.territories.TRIESTE), Army(self.state, 0, Nations.AUSTRIA, self.territories.VIENNA), Army(self.state, 0, Nations.ITALY, self.territories.VENICE), Army(self.state, 0, Nations....
If a foreign unit has enough support to dislodge your unit, you may not prevent that dislodgement by supporting the attack. Austria: F Trieste Hold A Vienna Supports A Venice - Trieste Italy: A Venice - Trieste A Tyrolia Supports A Venice - Trieste F Adriatic Sea Supports A Venice - Trieste The fleet in Trieste is d...
625941f663f4b57ef0001763
def is_reciprocated(self, from_id, to_id, scope=None): <NEW_LINE> <INDENT> if scope is None: <NEW_LINE> <INDENT> scope = self.options['default_scope_key'] <NEW_LINE> <DEDENT> return self.is_following( from_id, to_id, scope) and self.is_following( to_id, from_id, scope)
Check to see if one individual has reciprocated in following another individual. @param from_id [String] ID of the individual checking the reciprocated relationship. @param to_id [String] ID of the individual to see if they are following from_id. @param scope [String] Scope for the call.
625941f6498bea3a759ba10a
def create_folders(countries, sport='soccer'): <NEW_LINE> <INDENT> for country in countries: <NEW_LINE> <INDENT> for league in countries[country]: <NEW_LINE> <INDENT> location = os.path.join(sport, country, league) <NEW_LINE> if not os.path.exists(location): <NEW_LINE> <INDENT> os.makedirs(location)
Create folders for pickle files with annual coefs info
625941f624f1403a926011be
def roll(self): <NEW_LINE> <INDENT> return randint(1,self.num_sides)
:return:返回骰子点数
625941f645492302aab5e927
def test_keywords(self): <NEW_LINE> <INDENT> for name, default in self.keywords_exp.items(): <NEW_LINE> <INDENT> self.assertIn(name, self.keywords) <NEW_LINE> self.assertEqual(default, self.keywords[name])
Make sure that the parameter names and default values match
625941f60a50d4780f6674f5
def create_execution_input(self): <NEW_LINE> <INDENT> activity_input = dict() <NEW_LINE> try: <NEW_LINE> <INDENT> for requirement in self.runner.requirements(self.global_context): <NEW_LINE> <INDENT> value = self.global_context.get(requirement) <NEW_LINE> if value is not None: <NEW_LINE> <INDENT> activity_input.update(...
Create the input of the activity from the context. AWS has a limit on the number of characters that can be used (32k). If you use the `task.decorate`, the data sent to the activity is optimized to match the values of the context as well as the execution context. Return: dict: the input to send to the activity.
625941f6b7558d58953c5563
def eval_fct(self, population): <NEW_LINE> <INDENT> self.res_list = [] <NEW_LINE> if self.interruption: <NEW_LINE> <INDENT> return 0. <NEW_LINE> <DEDENT> self.update_population(population) <NEW_LINE> self.observable.simulate(self.sim_list) <NEW_LINE> scores = self.evaluate(population) <NEW_LINE> return self.update_scor...
Evaluation function used to test solution :param population: List of specimen to evaluate :return: Float population score
625941f6f548e778e58cdbde
def __cleanup(node): <NEW_LINE> <INDENT> cleaned = 0 <NEW_LINE> for child in list(node): <NEW_LINE> <INDENT> if child is not None: <NEW_LINE> <INDENT> cleaned += __cleanup(child) <NEW_LINE> <DEDENT> <DEDENT> if node.type == "selector": <NEW_LINE> <INDENT> rules = node.rules <NEW_LINE> if rules.scope.unused: <NEW_LINE> ...
The scanner part which looks for scopes with unused variables/params.
625941f621a7993f00bc835a
def replace_namespaced_horizontal_pod_autoscaler_status(self, body, namespace, name, **kwargs): <NEW_LINE> <INDENT> all_params = ['body', 'namespace', 'name', 'pretty'] <NEW_LINE> all_params.append('callback') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if ke...
replace status of the specified HorizontalPodAutoscaler 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.repla...
625941f6442bda511e8bea6c
def _r_force_fa(self, *args, **kwargs): <NEW_LINE> <INDENT> f = self.dir_file(self.get('SystemLabel', default='siesta') + '.FA') <NEW_LINE> _track_file(self._r_force_fa, f) <NEW_LINE> if f.is_file(): <NEW_LINE> <INDENT> return faSileSiesta(f).read_force() <NEW_LINE> <DEDENT> return None
Read forces from the FA file
625941f67047854f462a1a5f
def extract_pattern(filename, pattern, unique=True, nonempty=True): <NEW_LINE> <INDENT> matched = grep_re(filename, pattern) <NEW_LINE> if len(matched) > 1 and unique: <NEW_LINE> <INDENT> print('warn: not unique') <NEW_LINE> <DEDENT> vals = [] <NEW_LINE> for m in matched: <NEW_LINE> <INDENT> vals.append(m.split()[-1]) ...
Extract value of pattern from file name using
625941f694891a1f4081c10a
def settings_db_update(self, update: str): <NEW_LINE> <INDENT> translate = ("status", "rsa", "activities", "staff") <NEW_LINE> try: <NEW_LINE> <INDENT> mode = translate.index(update) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return "Unknown parameter" <NEW_LINE> <DEDENT> self._db["settings"].update_one...
Method to update MongoDB based on provided string to update either status or rsa Parameters ---------- update: str what mongoDB collection to update
625941f65166f23b2e1a57b7
def __init__(self, generation=0, ind_idx=0, params=[]): <NEW_LINE> <INDENT> super(ParameterGroup, self).__init__() <NEW_LINE> self.params = {} <NEW_LINE> for i in params: <NEW_LINE> <INDENT> k = list(i.keys())[0] <NEW_LINE> self.f_add_parameter(k, i[k]) <NEW_LINE> <DEDENT> self.generation = generation <NEW_LINE> self.i...
Initialization of the individual :param generation: ID of the generation to which this individual belongs to :param ind_idx: global ID of the individual :param params: individual parameters which are used to execute the optimizee simulate function
625941f607f4c71912b11ae3
def p_primitive(p): <NEW_LINE> <INDENT> p[0] = Primitive(p[1])
primitive : INTEGER | FLOAT | STRING | TRUE | FALSE
625941f64e696a04525c9aac
def date_rpt(start,end): <NEW_LINE> <INDENT> st = pd.to_datetime(start) <NEW_LINE> ed = pd.to_datetime(end) <NEW_LINE> dts = pd.to_datetime(pd.Series([str(y)+md for y in range(st.year-1, ed.year+1) for md in ['0331','0630','0930','1231']])) <NEW_LINE> dtsBYrpt = dts[(dts>=st) & (dts<=ed)].tolist() <NEW_LINE> return dts...
get date as rpt :start: start day :end: end day
625941f68a43f66fc4b546bb
def update(self, z, R=None, H=None): <NEW_LINE> <INDENT> for i, f in enumerate(self.filters): <NEW_LINE> <INDENT> f.update(z, R, H) <NEW_LINE> self.p[i] *= f.likelihood(z) <NEW_LINE> <DEDENT> self.p /= sum(self.p) <NEW_LINE> self.P = np.zeros(self.filters[0].P.shape) <NEW_LINE> is_row_vector = (self.filters[0].x.ndim =...
Add a new measurement (z) to the Kalman filter. If z is None, nothing is changed. Parameters ---------- z : np.array measurement for this update. R : np.array, scalar, or None Optionally provide R to override the measurement noise for this one call, otherwise self.R will be used. H : np.array, or None...
625941f68e05c05ec3eea9d8
def calculate_complex_drag(f, gamma0, rho_sample, bead_radius, distance_to_surface=None): <NEW_LINE> <INDENT> nu = gamma0 / (6.0 * np.pi * rho_sample * bead_radius) <NEW_LINE> frequency_nu = nu / (np.pi * bead_radius**2) <NEW_LINE> freq_ratio = f / frequency_nu <NEW_LINE> sqrt_freq_ratio = np.sqrt(freq_ratio) <NEW_LINE...
Calculates the complex drag coefficient which takes into account surface effects analogously to [1]. Parameters ---------- f : float Frequency [Hz] gamma0 : float Drag coefficient [mPas] bead_radius : float Bead radius [m] rho_sample : float Sample mass density [kg/m^3] distance_to_surface : float ...
625941f6097d151d1a2234b4
def tweet_response(tweets): <NEW_LINE> <INDENT> tweets = reversed(Tweet.objects.order_by('-id')[:tweets]) <NEW_LINE> response_objects = list(map(lambda x: x.serialized_data(), tweets)) <NEW_LINE> Group('tweety').send({ 'text': simplejson.dumps(response_objects) })
Helper: returns tweet results to clients
625941f6a8ecb033257d3728
def pc_output_buffers_full_var(self, *args): <NEW_LINE> <INDENT> return _noaa_swig.hrpt_deframer_sptr_pc_output_buffers_full_var(self, *args)
pc_output_buffers_full_var(hrpt_deframer_sptr self, int which) -> float pc_output_buffers_full_var(hrpt_deframer_sptr self) -> pmt_vector_float
625941f6b57a9660fec33eec
def _interpret(self): <NEW_LINE> <INDENT> if len(self.rawData) == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.bCompressed: <NEW_LINE> <INDENT> self.rawData = zlib.decompress(self.rawData) <NEW_LINE> <DEDENT> if self.id[0] == 'T': <NEW_LINE> <INDENT> encoding = ord(self.rawData[0]) <NEW_LINE> if 0 <= encod...
Examine self.rawData and create a self.value from it.
625941f67d43ff24873a3304
def test_sidebar_tree_display(self): <NEW_LINE> <INDENT> articles_after_search = self.browser.find_element_by_id("id_article_title") <NEW_LINE> articles_after_search.click() <NEW_LINE> sidebar = self.browser.find_element_by_id("id_sidebar") <NEW_LINE> self.assertIn("一级标题", sidebar.text) <NEW_LINE> self.assertIn("二级标题",...
测试打开一篇文章, 可以看到左边显示了目录树, 跟文章内容一一对应 :return:
625941f69c8ee82313fbbdd6
def calculate_resistance(self, file, fit=False): <NEW_LINE> <INDENT> x = self.data[file]["data"]["current"] <NEW_LINE> y = self.data[file]["data"]["voltage_vsrc"] <NEW_LINE> coef, cov_matrix = np.polyfit(x, y, 1, cov=True) <NEW_LINE> line = coef[0] * x + coef[1] <NEW_LINE> '''calculate Rc and standard deviation''' <NEW...
calculates Rc of given file, returns Rc and correspondinge standard deviation
625941f67c178a314d6efac9
def abortOperation(self): <NEW_LINE> <INDENT> pass
中斷運算
625941f6ad47b63b2c50a5de
def load_ag_params(temperature): <NEW_LINE> <INDENT> v0 = [16.8439,16.8439,16.8512,16.8815,16.9210,16.9644,17.0099,17.057,17.1055,17.1553,17.2063,17.2585] <NEW_LINE> k0 = [110.85,110.85,110.31,108.68,106.83,104.91,102.96,101.0,99.03,97.05,95.07,93.07] <NEW_LINE> kp0 = [6,6,6.01,6.03,6.05,6.08,6.12,6.15,6.19,6.22,6.26,6...
Load the Ag parameters for calculating the pressure. These parameters were extracted from Holzapfel et al., J. Phys. Chem. Ref. Data 30, 515 (2001). Parameters ----------- temperature: float Measurement temperature in Kelvin. Returns ----------- v0_out,k0_out,kp0_out: float Volume, K and K' calibrated paramet...
625941f630dc7b7665901fbd
def readSuccessMessage(self, option): <NEW_LINE> <INDENT> return self.readConfig(option=option, section="SuccessMessages", fileName="messages.ini")
Read success message from configuration file Required Parameters: option: Option to read from the file Optional Parameters: None Returns: Value associated with the option
625941f6cdde0d52a9e53697
def __init__(self): <NEW_LINE> <INDENT> raise RuntimeError(P2PInterface.__init__.__doc__)
Not to be called directly. Use P2PInterface.create_pair()
625941f6f7d966606f6aa66a
def subscription_manager_attach_pool(self, pool_list=[]): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for pool in pool_list: <NEW_LINE> <INDENT> result.append(self.execute(f'subscription-manager attach --pool={pool}')) <NEW_LINE> <DEDENT> return result
Attach pool ids to the host and return the result
625941f6aad79263cf3910a9
def key_mapping(self, key_func=lambda x: x): <NEW_LINE> <INDENT> return self.mapping(key_func=key_func)
Maps the keys by key_func
625941f68a349b6b435e87d1
def quality(self, offer): <NEW_LINE> <INDENT> warnings.warn( 'The behavior of .quality for the Accept-Encoding classes is ' 'currently being maintained for backward compatibility, but the ' 'method will be deprecated in the future, as its behavior does ' 'not conform to RFC 7231.', DeprecationWarning, ) <NEW_LINE> retu...
Return quality value of given offer, or ``None`` if there is no match. This is the ``.quality()`` method for when the header is invalid or not found in the request, corresponding to :meth:`AcceptEncodingValidHeader.quality`. .. warning:: This is currently maintained for backward compatibility, and will be depr...
625941f6796e427e537b0c2a
def get(self): <NEW_LINE> <INDENT> user = utils.get_user_from_header(request.headers) <NEW_LINE> user_configs = [] <NEW_LINE> for ds in user.configurations: <NEW_LINE> <INDENT> user_configs.append(ds.as_dict()) <NEW_LINE> <DEDENT> user_configs = list(reversed(user_configs)) <NEW_LINE> return make_response(jsonify({"con...
Fetch all configs according to the user_id :return: user's configutarions.
625941f6d486a94d0b98e7a5
@protocol.commands.add("currentsong") <NEW_LINE> def currentsong(context): <NEW_LINE> <INDENT> tl_track = context.core.playback.get_current_tl_track().get() <NEW_LINE> stream_title = context.core.playback.get_stream_title().get() <NEW_LINE> if tl_track is not None: <NEW_LINE> <INDENT> position = context.core.tracklist....
*musicpd.org, status section:* ``currentsong`` Displays the song info of the current song (same song that is identified in status).
625941f6566aa707497f4bbe
def register(self, switch, port): <NEW_LINE> <INDENT> url = self.object_url('switch', switch, 'port', port) <NEW_LINE> return self.check_response(self.httpClient.request("PUT", url))
Register a <port> with <switch>.
625941f68e71fb1e9831de04
def label_resize_vis(label, img=None,alpha=0.5): <NEW_LINE> <INDENT> label = cv.resize(label.copy(),None,fx=0.1,fy=0.1) <NEW_LINE> r = np.where(label == 1, 255, 0) <NEW_LINE> g = np.where(label == 2, 255, 0) <NEW_LINE> b = np.where(label == 3, 255, 0) <NEW_LINE> yellow = np.where(label == 4, 255, 0) <NEW_LINE> anno_vis...
:param label:原始标签 :param img: 原始图像 :param alpha: 透明度 :return: 可视化标签
625941f6b5575c28eb68e665
def _make_eport(self, ip, port): <NEW_LINE> <INDENT> remote_ip = self.remote_ip <NEW_LINE> if remote_ip.startswith('::ffff:'): <NEW_LINE> <INDENT> remote_ip = remote_ip[7:] <NEW_LINE> <DEDENT> if not self.permit_foreign_addresses and ip != remote_ip: <NEW_LINE> <INDENT> self.log("Rejected data connection to foreign add...
Establish an active data channel with remote client which issued a PORT or EPRT command.
625941f6004d5f362079a98c
def distance(self, kind='bailer-jones'): <NEW_LINE> <INDENT> kind = kind.lower() <NEW_LINE> if kind in ('bailer-jones', 'bj'): <NEW_LINE> <INDENT> lower = self.data['rest'].values-self.data['b_rest'].values <NEW_LINE> upper = self.data['B_rest'].values-self.data['rest'].values <NEW_LINE> return pd.DataFrame({'distance'...
Compute and return the distance in kpc :param kind: The kind of transformation. Current options are 'bailer-jones' or 'bj' for the distances estimated by Bailer-Jones or 'simple' for :math:`distance=1/parallax`. All other inputs raise a ValueError. :type kind: str :return: distance and its error in kpc :rt...
625941f6009cb60464c63a0a
def _getKey(self, keyName, keyClass): <NEW_LINE> <INDENT> keyLabel = None <NEW_LINE> attrDict = None <NEW_LINE> try: <NEW_LINE> <INDENT> keyNameUri = self._toInternalKeyName(keyName, keyClass) <NEW_LINE> keyLabel = CFSTR(keyNameUri) <NEW_LINE> attrDict = c_void_p(cf.CFDictionaryCreateMutable( None, 5, cf.kCFTypeDiction...
Get a key from the Keychain. :param Name keyName: The name of the key. :param keyClass: The class of the key, e.g. KeyClass.PUBLIC, KeyClass.PRIVATE, or KeyClass.SYMMETRIC. :return: None if not found, otherwise a Keychain ref to the key. You must use cf.CFRelease to free it. :rtype: c_void_p
625941f692d797404e3047eb
def append(self, collection): <NEW_LINE> <INDENT> self.data = pd.concat([self.data[:len(self)], collection.data], ignore_index=True) <NEW_LINE> self._n = len(self) + len(collection)
Append another collection. Internal method: does not check for consistency!
625941f694891a1f4081c10b
def _define_case_setcycle(p_vars, item, precurser, var_list): <NEW_LINE> <INDENT> name = strlit.JS_DICT['cyclename'] <NEW_LINE> cyclename = name.format(item.get('name')) <NEW_LINE> setcycles = get_js_setcycles(p_vars, cyclename) <NEW_LINE> if setcycles == "": <NEW_LINE> <INDENT> var_list.append("undefined") <NEW_LINE> ...
Special case #1: Setcycles, create js for setcycle
625941f6cc0a2c11143dd4f0
@contextlib.contextmanager <NEW_LINE> def streaming_to_client(): <NEW_LINE> <INDENT> for handler in client_logger.handlers: <NEW_LINE> <INDENT> if hasattr(handler, 'append_newlines'): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> handler = None <NEW_LINE> <DEDENT> old_propagate = clie...
Puts the client logger into streaming mode, which sends unbuffered input through to the socket one character at a time. We also disable propagation so the root logger does not receive many one-byte emissions. This context handler was originally created for streaming Compose up's terminal output through to the client an...
625941f60a50d4780f6674f6
def rgbColorFromNode(node, greyScale=False, darknessLimit=0): <NEW_LINE> <INDENT> colorStr = node.style.get('color', None) or node.attributes.get('color', None) <NEW_LINE> color = None <NEW_LINE> if colorStr: <NEW_LINE> <INDENT> color = _colorFromStr(colorStr.lower()) <NEW_LINE> if greyScale and color: <N...
Extract text color from node attributes/style. Result is a rgb triple w/ individual values between [0...1]
625941f6c4546d3d9de73099
def lightON(self, out): <NEW_LINE> <INDENT> for dgt in self.dgts: <NEW_LINE> <INDENT> dgt.setStyleSheet("background-color: #7FFFD4; color: #000; " + "font-size: 20px; border: 1px solid black;") <NEW_LINE> if out is not None: <NEW_LINE> <INDENT> self.dgts[out].setStyleSheet("background-color: #FFFF00; " + "color: #000; ...
Updates which digit has the "light on" depending on the network output.
625941f6460517430c3947d1
def __request(self, url, use_proxy): <NEW_LINE> <INDENT> page = self.__safe_request(use_proxy, url) <NEW_LINE> page = page.content.decode("utf-8") <NEW_LINE> if "('captcha')" in page: <NEW_LINE> <INDENT> return "detected" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return page
Parameters: url: url of the request use_proxy: use of Luminati proxy Makes request. Returns: - 'detected' if '('captcha')' in the content (Specially for Google) - the content decoded else
625941f6f9cc0f698b140c54
@app.route("/clear", methods=['POST','GET']) <NEW_LINE> def clear(): <NEW_LINE> <INDENT> myWorld.clear() <NEW_LINE> return flask_respond_json(myWorld.world())
Clear the world
625941f6d10714528d60034a
def mandatory_absents(resource, scope): <NEW_LINE> <INDENT> if scope not in ["input", "output"]: <NEW_LINE> <INDENT> raise ValueError("Scope must be either input or output") <NEW_LINE> <DEDENT> if not isinstance(resource, (BaseResource)): <NEW_LINE> <INDENT> raise TypeError("Resource must be a BaseResource, " "got {} {...
Returns a set of the trait names that are mandatory, but do not have a specified value (i.e. they are Absent). Parameters ---------- resource: Resource or ResourceFragment The resource to check scope: str Valid values are "input" and "output". Perform the check as if the resource is primed for an input ope...
625941f663b5f9789fde7745
def p_module_para_OPT(p): <NEW_LINE> <INDENT> p[0] = None if len(p) == 1 else p[1]
module_para_OPT : | module_para
625941f6851cf427c661ab67
def hom_generators_c(basis, edges): <NEW_LINE> <INDENT> cur_edges = edges[:] <NEW_LINE> cur_nodes = nodes[:] <NEW_LINE> while 1: <NEW_LINE> <INDENT> for end_edge in edge.end.endpt: <NEW_LINE> <INDENT> if end_edge == edge: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> end_edge.start = end_edge.start.symmetric_differe...
basis = list of HomNodeClass objects edges = list of HomEdgeClass objects does not modify basis or edges
625941f66fb2d068a760f706
def __init__(self, dynamo_db): <NEW_LINE> <INDENT> self.subject_table = dynamo_db.Table(SUBJECT_TABLE_NAME) <NEW_LINE> self.role_permission_table = dynamo_db.Table(ROLE_PERMISSION_TABLE_NAME) <NEW_LINE> self.object_table = dynamo_db.Table(OBJECT_TABLE_NAME) <NEW_LINE> self.object_access_list_table = dynamo_db.Table(OBJ...
:param dynamo_db: boto3.resource
625941f60c0af96317bb8845
def test_properties(self): <NEW_LINE> <INDENT> c = Circle(d=12.0) <NEW_LINE> self.assertAlmostEqual(c.A(), 113.097, places=2) <NEW_LINE> self.assertAlmostEqual(c.I(), 1017.875, places=2) <NEW_LINE> self.assertAlmostEqual(c.S(), 169.646, places=2) <NEW_LINE> self.assertAlmostEqual(c.Z(), 288.000, places=2) <NEW_LINE> se...
Test circle properties
625941f691af0d3eaac9c07c
@gpflow.decors.autoflow() <NEW_LINE> @gpflow.decors.params_as_tensors <NEW_LINE> def get_sgpr_parameters(self): <NEW_LINE> <INDENT> num_inducing_points = len(self.feature) <NEW_LINE> with tf.name_scope("Kuf"): <NEW_LINE> <INDENT> Kuf = gpflow.features.Kuf(self.feature, self.kern, self.X) <NEW_LINE> <DEDENT> with tf.nam...
Get parameters from a Gpflow Sparse Variational GP Regressor.
625941f6e64d504609d74e9e
@pytest.mark.parametrize( "image_data, num_images", [(1, 1), (8, 8)], indirect=["image_data"], ) <NEW_LINE> def test_imagefolder_directory_root_len(image_data: Path, num_images: int) -> None: <NEW_LINE> <INDENT> dataset = ImageFolderDataset(image_data) <NEW_LINE> assert len(dataset) == num_images
Ensure dataset length is correct given chunked image data.
625941f63346ee7daa2b33d1
def log(*args): <NEW_LINE> <INDENT> pass
function to activate the 'print' commands. Just comment or uncomment the following lines
625941f644b2445a339326f0
def load_data_vgg(opt): <NEW_LINE> <INDENT> mat_data = sio.loadmat(opt.data_path) <NEW_LINE> train_data = mat_data['trainCNN'] <NEW_LINE> train_targets = mat_data['trainLabels'].astype(np.int) <NEW_LINE> test_data = mat_data['testCNN'] <NEW_LINE> test_targets = mat_data['testLabels'].astype(np.int) <NEW_LINE> data = np...
加载对cifar10使用vgg提取的数据 Parameters opt: Parser 参数 Returns train_data, query_data, data: numpy.ndarray 数据 train_targets, query_targets, targets: numpy.ndarray 标签
625941f65fcc89381b1e1d23
def display_group(self): <NEW_LINE> <INDENT> self.group_entry.grid(row=0, column=3, sticky=tk.W, pady=10) <NEW_LINE> self.group_label.grid(row=0, column=2, sticky=tk.E) <NEW_LINE> self.group_max_entry.grid(row=1, column=3, sticky=tk.W, pady=10) <NEW_LINE> self.group_max_label.grid(row=1, column=2, sticky=tk.E, pady=10)...
Displays grouip archive specific portions of the GUI
625941f6dd821e528d63b802
def extract_wpts(protocols, get_trks_pkts, index): <NEW_LINE> <INDENT> i = iter(get_trks_pkts) <NEW_LINE> for pid, length, data in i: <NEW_LINE> <INDENT> if pid == protocols.link_proto.PID_TRK_HDR and data.index == index: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> for pkt in i: <NEW_LINE> <INDENT> if pkt.pi...
Given a collection of track points packets, return those which are members of given track index. Where PID_TRK_DATA_ARRAY is encountered, data is expanded such that result is equvalent to cas where each was its on packet of PID_TRK_DATA
625941f68c0ade5d55d3f020
def data_load(filename,label): <NEW_LINE> <INDENT> fl = pd.read_csv(filename) <NEW_LINE> fl = fl["Horizontal_vibration_signals"] <NEW_LINE> fl = fl.values <NEW_LINE> fl = (fl-fl.min())/(fl.max()-fl.min()) <NEW_LINE> data=[] <NEW_LINE> lab=[] <NEW_LINE> start,end=0,signal_size <NEW_LINE> while end<=fl.shape[0]: <NEW_LIN...
This function is mainly used to generate test data and training data. filename:Data location
625941f6287bf620b61d40be
def getflag(self, args: list[str]) -> None: <NEW_LINE> <INDENT> keys = OPTIONS.dict.keys() <NEW_LINE> if args[0] in keys and OPTIONS[args[0]]: <NEW_LINE> <INDENT> self.goto([args[0]])
Jumps to a different position in the script. :param args: A list of arguments for the function. :type args: list[str]
625941f64e696a04525c9aad
def get_interfaces(named=False): <NEW_LINE> <INDENT> pass
Get list of interfaces object supports. If parameter 'named' provided and True, return list of full-qualified class-paths instead of interface types.
625941f6004d5f362079a98d
def is_bound(self): <NEW_LINE> <INDENT> return all([h.is_bound() for h in self.__hook__.values()])
Returns True if the layer is bound to another layer, False otherwise Returns ------- bool True if the layer is bound to another layer, False otherwise
625941f666656f66f7cbc80c
def section_modulus(self, point=None): <NEW_LINE> <INDENT> x_c, y_c = self.center <NEW_LINE> if point is None: <NEW_LINE> <INDENT> x_min, y_min, x_max, y_max = self.bounds <NEW_LINE> y = max(y_c - y_min, y_max - y_c) <NEW_LINE> x = max(x_c - x_min, x_max - x_c) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> y = point.y ...
Returns a tuple with the section modulus of an ellipse Section modulus is a geometric property of an ellipse defined as the ratio of second moment of area to the distance of the extreme end of the ellipse from the centroidal axis. References ========== https://en.wikipedia.org/wiki/Section_modulus Parameters ======...
625941f6236d856c2ad44e43
def __init__(self, configfilename): <NEW_LINE> <INDENT> self._types = {} <NEW_LINE> self.set_type('mbox', mailbox.mbox, standard_pathgenerator) <NEW_LINE> self.set_type('maildir', mailbox.Maildir, standard_pathgenerator) <NEW_LINE> self.set_type('mh', mailbox.MH, standard_pathgenerator) <NEW_LINE> self.set_type('babyl'...
Initialize MailboxFactory files. The mailbox objects that can be generated must be described in configfilename.
625941f61f037a2d8b94685b
def main() -> typing.NoReturn: <NEW_LINE> <INDENT> args = _parse_cli_args() <NEW_LINE> _configure_logging(args) <NEW_LINE> _execute(args)
Setup and run the backup.
625941f6cad5886f8bd27637
def helper_has_an_infected_neighbor(city, position, expected_result): <NEW_LINE> <INDENT> actual_infection = sir.has_an_infected_neighbor(city, position) <NEW_LINE> if actual_infection != expected_result: <NEW_LINE> <INDENT> s = "Expected boolean ({:}) and actual boolean ({:}) do not match." <NEW_LINE> pytest.fail(s.fo...
Purpose: helper function for task 2 Inputs: city: (list) sir.py parameter for starting state position: (int) sir.py parameter for location in list
625941f65e10d32532c5f583
def show_list_media(request, slug, template_name='podcast/show_feed_media.html'): <NEW_LINE> <INDENT> return object_detail(request, queryset=Show.objects.all(), mimetype='application/rss+xml', slug_field='slug', slug=slug, template_name=template_name)
Episode Media feed for a given show Template: ``podcast/show_feed_media.html`` Context: object Story detail
625941f6d4950a0f3b08c9a4
def addWord(self, word: str) -> None: <NEW_LINE> <INDENT> def _insert(word, index, length, branch): <NEW_LINE> <INDENT> if index >= length: return <NEW_LINE> current_branch = self._search_char(word[index], branch) <NEW_LINE> if current_branch: <NEW_LINE> <INDENT> if index == length - 1: <NEW_LINE> <INDENT> if current_b...
Adds a word into the data structure.
625941f6ad47b63b2c50a5df
def apply_keys(self, keys): <NEW_LINE> <INDENT> for key in self.dynamic_text: <NEW_LINE> <INDENT> a = self.dynamic_text[key] <NEW_LINE> b = self.dynamic_text[key] % keys <NEW_LINE> if a != b: <NEW_LINE> <INDENT> self.dynamic_text_str[key] += b <NEW_LINE> <DEDENT> if not '%(' in self.dynamic_text[key]: <NEW_LINE> <INDEN...
TODO: docstring
625941f60a366e3fb873ee80
def test_customer_collection_put_no_entry_found(self): <NEW_LINE> <INDENT> response = self.webserver.put_json( self.collection_path, [{'name': 'plip'}], status=400) <NEW_LINE> assert response.status_code == 400
Customer FAILED PUT /customers (no id)
625941f61d351010ab856179
def cpnSourceGenerateVfbIcpnComment(self,name): <NEW_LINE> <INDENT> comments = ('/***********************************************************\n') <NEW_LINE> comments += ('* 组件输入初始化\n') <NEW_LINE> comments += ('***********************************************************/\n') <NEW_LINE> funcEntity = self.cpnSourceInitFun...
组件输入定义
625941f6be8e80087fb21295
def p_compound_list(p): <NEW_LINE> <INDENT> productions = p[1:] <NEW_LINE> try: <NEW_LINE> <INDENT> sep = get_production(productions, 'separator') <NEW_LINE> if sep[1]!=';': <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> term = ...
compound_list : term | newline_list term | term separator | newline_list term separator
625941f6ec188e330fd5adf0
def getArgsWithFunctor(self, ok = None): <NEW_LINE> <INDENT> return _AriaPy.ArConfigArg_getArgsWithFunctor(self, ok)
getArgsWithFunctor(self, bool ok = None) -> ArArgumentBuilderPtrList getArgsWithFunctor(self) -> ArArgumentBuilderPtrList
625941f67b25080760e39ab4
def __merge_address(self, free_form_address, addr, line, state): <NEW_LINE> <INDENT> title = '' <NEW_LINE> free_form_address = free_form_address.replace('\n', ', ') <NEW_LINE> if not (addr.get_street() or addr.get_locality() or addr.get_city() or addr.get_state() or addr.get_postal_code()): <NEW_LINE> <INDENT> addr.set...
Merge freeform and structured addrssses. n ADDR <ADDRESS_LINE> {0:1} +1 CONT <ADDRESS_LINE> {0:M} +1 ADR1 <ADDRESS_LINE1> {0:1} (Street) +1 ADR2 <ADDRESS_LINE2> {0:1} (Locality) +1 CITY <ADDRESS_CITY> {0:1} +1 STAE <ADDRESS_STATE> {0:1} +1 POST <ADDRESS_POSTAL_CODE> {0:1} +1 CTRY <ADDRESS_COUNTRY> {0:1} This is done...
625941f6627d3e7fe0d694b1
def create_issue( project, summary, description, template_engine="jinja", context=None, defaults=None, saltenv="base", issuetype="Bug", priority="Normal", labels=None, assignee=None, server=None, username=None, password=None, **kwargs ): <NEW_LINE> <INDENT> if template_engine: <NEW_LINE> <INDENT> summary = __salt__["fi...
Create a JIRA issue using the named settings. Return the JIRA ticket ID. project The name of the project to attach the JIRA ticket to. summary The summary (title) of the JIRA ticket. When the ``template_engine`` argument is set to a proper value of an existing Salt template engine (e.g., ``jinja``, ``...
625941f6d4950a0f3b08c9a5