code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def generate_named_key(instance_or_type, name, **vary_by): <NEW_LINE> <INDENT> opts = instance_or_type._meta <NEW_LINE> vary_string = ','.join('%s=%s' % (k, vary_by[k]) for k in sorted(vary_by)) <NEW_LINE> if vary_string: <NEW_LINE> <INDENT> return 'model:%s.%s:%s[%s]' % (opts.app_label, opts.module_name, name, vary_st...
Generate a named key (eg used for storing a list of results) :param instance_or_type: :param name: :return:
625941ed45492302aab5e800
def floatToken(self): <NEW_LINE> <INDENT> tok = self.token() <NEW_LINE> try: <NEW_LINE> <INDENT> return float(tok) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> raise SyntaxError("Syntax error in line %d: Float expected, got '%s' instead"%(self.linenr, tok))
Return the next token which must be a float.
625941ede76e3b2f99f3ad39
def load_base_csv(acct_csv, tx_csv, schema_data): <NEW_LINE> <INDENT> return None
Load account and transaction list CSV from the transaction graph generator (before running AMLSim) :param acct_csv: Account list CSV :param tx_csv: Transaction list CSV :param schema_data: Schema data from JSON file :return: Base transaction network as a NetworkX graph object
625941edd164cc6175783286
def trunk(self): <NEW_LINE> <INDENT> trunk = '' <NEW_LINE> vlans = None <NEW_LINE> max_vlans = 10 <NEW_LINE> if bool(self.is_trunk()) is True: <NEW_LINE> <INDENT> trunk = 'Trunk' <NEW_LINE> if 'jm_vlan' in self.port_data: <NEW_LINE> <INDENT> vlans = self.port_data['jm_vlan'] <NEW_LINE> if isinstance(vlans, list) is Tru...
Return string for trunk status of port. Args: None Returns: trunk: Trunk state
625941edd53ae8145f87a79c
def _match_greedy(self, content, start, end=None, match_all=None): <NEW_LINE> <INDENT> section_data = list() <NEW_LINE> if match_all: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> section_range = self._get_section_range(content, start, end) <NEW_LINE> if not section_range: <NEW_LINE> <INDENT> break <NEW_LINE> <DE...
Filter a section of the content text for matching :args content: The content to match against :args start: The start of the section data :args end: The end of the section data :args match_all: Whether or not to match all of the instances :returns: a list object of all matches
625941ed0c0af96317bb871e
def filter_dict(options, regexp): <NEW_LINE> <INDENT> filtered = {} <NEW_LINE> for section, options in options.items(): <NEW_LINE> <INDENT> match = re.search(regexp, section) <NEW_LINE> if match: <NEW_LINE> <INDENT> filtered[match.group(1)] = options <NEW_LINE> <DEDENT> <DEDENT> return filtered
Useful to handle groups of sections or options. Select keys from a dictionary and remove the common part from their names. >>> o = { ... 'core' : {'cron': ''}, ... 'component test 1' : {'option': 'value'}, ... 'new type' : {}, ... 'component test two': {'option': 'value'}, ... } >>> filter_dict(o, 'c...
625941edad47b63b2c50a4b6
def gcode_set_position(cmd): <NEW_LINE> <INDENT> return cmd
Set the absolute zero point by resetting current position to the values specified. Example: G92 X10 E90 This would set the extruder's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur. Since the X, Y, Z, E, and F values are set as parameters when this command is executed, no c...
625941ed656771135c3ebdac
def multiple_preprocessing(data_frame): <NEW_LINE> <INDENT> data_scale = data_frame.sub(data_frame.mean(0).values, axis=1).div( data_frame.std(0).values, axis=1 ) <NEW_LINE> pca = PCA() <NEW_LINE> pca.fit(data_scale) <NEW_LINE> pca_scale = pca.transform(data_scale) <NEW_LINE> pca_frame = pd.DataFrame(pca_scale) <NEW_LI...
Preprocessing of the multivariate data before segmentation Standardization with PCA
625941edab23a570cc2506be
def __init__(self, lmd=1.0, transform=None, **kwargs): <NEW_LINE> <INDENT> super(Exponential, self).__init__(transform) <NEW_LINE> self.lmd0 = lmd <NEW_LINE> self.covariance_prior = False <NEW_LINE> self.gradient_only = kwargs.get('gradient_only', False) <NEW_LINE> if self.gradient_only is True: <NEW_LINE> <INDENT> sel...
Parameters ---------- lambda : float Rate parameter for the Exponential distribution transform : str Whether to apply a transformation to the location variable - e.g. 'exp' or 'logit'
625941edbde94217f3683323
def event_m10_10_x154(z18=2255): <NEW_LINE> <INDENT> CompareChrStartUpState(0, z18, 3, 0) <NEW_LINE> CompareChrStartUpState(1, z18, 3, 1) <NEW_LINE> if ConditionGroup(0): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif ConditionGroup(1): <NEW_LINE> <INDENT> return 1
[Condition] Vegrant appeared with a hawk _ Character z18: Generator ID
625941ed26068e7796caf21e
def genre_count_books(): <NEW_LINE> <INDENT> genre_list = Genre.objects.all() <NEW_LINE> genre_books = {} <NEW_LINE> for genre in range(len(genre_list)): <NEW_LINE> <INDENT> genre_books[genre_list[genre].name] = Book.objects.filter(genre__name=genre_list[genre].name).count() <NEW_LINE> <DEDENT> return genre_books
Return dict {'Genre': count_books}
625941ed377c676e912726de
def VE(Net, QueryVar, EvidenceVars): <NEW_LINE> <INDENT> new_factors = [] <NEW_LINE> for factor in Net.factors(): <NEW_LINE> <INDENT> new_factor = factor <NEW_LINE> for var in new_factor.scope: <NEW_LINE> <INDENT> if (var in EvidenceVars): <NEW_LINE> <INDENT> new_factor = restrict_factor(new_factor, var, var.get_eviden...
Input: Net---a BN object (a Bayes Net) QueryVar---a Variable object (the variable whose distribution we want to compute) EvidenceVars---a LIST of Variable objects. Each of these variables has had its evidence set to a particular value fro...
625941ed0a366e3fb873ed56
def rank_items(self, items=None): <NEW_LINE> <INDENT> if items is None: <NEW_LINE> <INDENT> items = self.all_items <NEW_LINE> <DEDENT> seen = dict() <NEW_LINE> for item in items: <NEW_LINE> <INDENT> seen.setdefault(item, 0) <NEW_LINE> seen[item] += 1 <NEW_LINE> <DEDENT> items_set = self.remove_duplicates(items) <NEW_LI...
Orders the given items by frequency, removing duplicates. ~ Returns the result. ~ e.g. rank_items(['a', 'b', 'b', 'e', 's', 's']) -> ['b', 's', 'a', 'e'] :param items: List[X], list of items :return: List[X], list ordered by frequency
625941ed94891a1f4081bfe3
def isGoalLocation(self, x, y): <NEW_LINE> <INDENT> return self.goalPos == (x, y)
It checks whether the current node location is a goal node location :param x: current x-coordinate :param y: current y-coordinate :return: True if it's the goal location else False
625941edaad79263cf390f80
def xaccTransRollbackEdit(*args): <NEW_LINE> <INDENT> return _gnucash_core_c.xaccTransRollbackEdit(*args)
xaccTransRollbackEdit(Transaction trans)
625941edd8ef3951e3243a75
def compute_offset(tr): <NEW_LINE> <INDENT> TRAIN_ONLY_ROWS = 184967172.0 <NEW_LINE> n_click_tr = float(tr['IsClick'].sum()) <NEW_LINE> p_all = n_click_tr / TRAIN_ONLY_ROWS <NEW_LINE> p_sample = n_click_tr / tr.shape[0] <NEW_LINE> offset = log(p_all/(1.0 - p_all)) - log(p_sample/ (1.0 - p_sample)) <NEW_LINE> print('Off...
Using down sampled negative biases the mean prediction. This function computes an adjustment to correct that bias. args: tr - the data with negative instances down-sampled return: the offset to add to decision values to compensate sample bias
625941ed1f037a2d8b946734
def describe_plus(df): <NEW_LINE> <INDENT> describe = df.describe() <NEW_LINE> describe.loc['NaNs'] = [df[feature].isnull().sum() for feature in df.columns] <NEW_LINE> describe.loc['uniques'] = [len(df[feature].unique()) for feature in df.columns] <NEW_LINE> describe.loc['mode'] = [df[feature].mode()[0] for feature in ...
Function that returns describe dataframe plus number of NaNs, number of uniques values, the mode # and the std per column :param df: dataframe :return: dataframe
625941edb7558d58953c5440
def columnheaders(self, x0, y0, x1, y1): <NEW_LINE> <INDENT> if isinstance(self._data.columns, pd.MultiIndex): <NEW_LINE> <INDENT> return self._data.columns.values[x0 : x1 + 1].tolist() <NEW_LINE> <DEDENT> return [[str(c)] for c in self._data.columns]
return column headers for data
625941edde87d2750b8602d0
def queue_delayer() -> None: <NEW_LINE> <INDENT> time.sleep(0.05) <NEW_LINE> self.queues[USER_ACCOUNT_QUEUE].put(user_account)
Place messages to queue one at a time.
625941eda79ad161976cc67d
def testonedir(self, testdir, exitfirst=False): <NEW_LINE> <INDENT> for filename in abspath_listdir(testdir): <NEW_LINE> <INDENT> if this_is_a_testfile(filename): <NEW_LINE> <INDENT> prog = self.testfile(filename, batchmode=True) <NEW_LINE> if exitfirst and (prog is None or not prog.result.wasSuccessful()): <NEW_LINE> ...
finds each testfile in the `testdir` and runs it
625941edbe7bc26dc91cdb2d
def add_config(self, proj, conf): <NEW_LINE> <INDENT> self._configurations[conf] = proj
Add configuration to solution Parameters: - proj: (CVsProject) project - conf: (CVsProjectConfiguration) configuration to be added
625941ede1aae11d1e74a1f4
def _create_job(self, atype, files): <NEW_LINE> <INDENT> aid = self._create_artifact() <NEW_LINE> parameters = {'Input artifact' : aid} <NEW_LINE> data = {'command': dumps(['gnps-networking', '0.0.1', 'GNPS Networking']), 'parameters': dumps(parameters), 'status': 'running'} <NEW_LINE> job_id = self.qclient.post( '/api...
Creates a new job in Qiita so we can update its step during tests Parameters ---------- artifact: int The artifact id to be validated during tests command: int Qiita's command id for the 'Generate HTML summary' operation Returns ------- str, dict The job id and the parameters dictionary
625941edbaa26c4b54cb1651
def vgg11_bn(pretrained=False, **kwargs): <NEW_LINE> <INDENT> model = VGG(make_layers(cfg['A'], batch_norm=True), **kwargs) <NEW_LINE> if pretrained: <NEW_LINE> <INDENT> pretrained_dict = model_zoo.load_url(model_urls['vgg11_bn']) <NEW_LINE> model = model_helper.get_not_fc_para(model, pretrained_dict) <NEW_LINE> <DEDEN...
VGG 11-layer model (configuration "A") with batch normalization Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
625941ed9b70327d1c4e130f
def always_on_top(self): <NEW_LINE> <INDENT> self.setWindowFlags(self.windowFlags() ^ Qt.WindowStaysOnTopHint) <NEW_LINE> if self.on_top is True: <NEW_LINE> <INDENT> self.on_top = False <NEW_LINE> self.button_on_top.setIcon( QIcon(os.path.join("icons", "NotAlwaysOnTop.png")) ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
Toggle always on top window setting.
625941edf7d966606f6aa542
def comment(client, id, comment, reply_id=None): <NEW_LINE> <INDENT> if len(comment) == 0: <NEW_LINE> <INDENT> raise ValueError("comment can not be empty") <NEW_LINE> <DEDENT> params = { 'thread_id': id, 'comment': comment, } <NEW_LINE> if reply_id is not None: <NEW_LINE> <INDENT> params['reply_id'] = reply_id <NEW_LIN...
Writes a comment to a thread :param client: an instance of a :class:`Client <Client>` :param id: int thread id :param comment: str comment text :param reply_id: comment id (only when replying) :return: ? :rtype: ?
625941ed55399d3f05588bef
def receive_newblockhashes(self, proto, newblockhashes): <NEW_LINE> <INDENT> log.debug('received newblockhashes', num=len(newblockhashes), proto=proto) <NEW_LINE> newblockhashes = [h.hash for h in newblockhashes if not self.chainservice.knows_block(h.hash)] <NEW_LINE> if (proto not in self.protocols) or (not newblockha...
no way to check if this really an interesting block at this point. might lead to an amplification attack, need to track this proto and judge usefullness
625941ed63f4b57ef0001641
def parse_header(header): <NEW_LINE> <INDENT> trgt, rest = header.split(': ') <NEW_LINE> preqs = [piece for piece in rest.split() if piece not in {"|", ":"}] <NEW_LINE> return trgt, preqs
Split recipe header into target, pre-requisites.
625941ed57b8e32f524839d6
def testPartialBEROctetStringEncodings(self): <NEW_LINE> <INDENT> m = pureber.BEROctetString("x").toWire() <NEW_LINE> self.assertEqual(3, len(m)) <NEW_LINE> self.assertRaises(pureber.BERExceptionInsufficientData, pureber.berDecodeObject, pureber.BERDecoderContext(), m[:2]) <NEW_LINE> self.assertRaises(pureber.BERExcept...
BEROctetString(encoded="...") with too short input should throw BERExceptionInsufficientData
625941edd18da76e23532a14
def _add_vardiffs(self): <NEW_LINE> <INDENT> pool = self._create_pool() <NEW_LINE> vlist1 = set(_file1.get_varlist()) <NEW_LINE> vlist2 = set(_file2.get_varlist()) <NEW_LINE> vlist_shared = vlist1 & vlist2 <NEW_LINE> self._vardiffs_list = list(pool.map(_create_vardiffs_wrapper_nodim, vlist_shared)) <NEW_LINE> vlist_1_n...
Add all of the vardiffs to self. Assumes that globals _file1 and _file2 have already been set.
625941ed460517430c3946ae
def run(self): <NEW_LINE> <INDENT> def input_cb(key): <NEW_LINE> <INDENT> if self.shall_quit: <NEW_LINE> <INDENT> raise urwid.ExitMainLoop <NEW_LINE> <DEDENT> self.keypress(self.size, key) <NEW_LINE> <DEDENT> self.size = self.ui.get_cols_rows() <NEW_LINE> loop = asyncio.get_event_loop() <NEW_LINE> loop.create_task(self...
Setup input handler, invalidate handler to automatically redraw the interface if needed. Start mainloop.
625941ed8c3a8732951588f9
def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.object = self.get_object() <NEW_LINE> if not self.object.has_translation(get_language()): <NEW_LINE> <INDENT> raise Http404() <NEW_LINE> <DEDENT> self.object.set_current_language(get_language()) <NEW_LINE> if self.object.url != self.kwargs[self.slug_url_...
Override normal get method to return correct page based on the active language and slug Cases: 1. Page is not found: `raise Http404()` like django would. 2. No translation in active language for the page: `raise Http404()`. 3. Translation was found for active language, but the url doesn't match given url: ...
625941ed3346ee7daa2b32a8
def done(self) -> bool: <NEW_LINE> <INDENT> return self._session_state == SessionState.response_received
Return whether the session was complete. A session is complete when it has sent a request, read the response header and the response body.
625941ed23849d37ff7b35c3
def build(self): <NEW_LINE> <INDENT> self.find_frequent() <NEW_LINE> self.L_list = sorted(self.L_list, key=lambda k: k.values()[0], reverse=True) <NEW_LINE> self.build_ordered_transactions() <NEW_LINE> return self.L_list, self.ordered_transactions, self.min_support
runs the construction of the f-list and ordered transactions
625941edfff4ab517eb2f977
def config_logging(file_name="log.txt", log_level="NOSET"): <NEW_LINE> <INDENT> logs_dir = os.path.join(os.path.dirname(__file__), "logs") <NEW_LINE> if os.path.exists(logs_dir) and os.path.isdir(logs_dir): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> os.makedirs(logs_dir) <NEW_LINE> <DEDENT> ...
@summary: config logging to write logs to local file @param file_name: name of log file @param log_level: log level
625941edd6c5a10208144587
def runge_kutte4_4(u, f4, dt): <NEW_LINE> <INDENT> k1 = f4(u) <NEW_LINE> k2 = f4(u+dt/2.0*k1) <NEW_LINE> k3 = f4(u+dt/2.0*k2) <NEW_LINE> k4 = f4(u+dt*k3) <NEW_LINE> return u + dt/6.0 * (k1 + 2.0*k2 + 2.0*k3 + k4)
Returns the solution at the next time-step using the fourth-order accurate Runge Kutta (RK4) method. Parameters ---------- u : array of float solution at the previous time-step. f : function function to compute the right hand-side of the system of equations. f4(u) = u_dot dt : float time-increment. Re...
625941edd18da76e23532a15
@app.route('/', methods=['PUT']) <NEW_LINE> def update_entry(): <NEW_LINE> <INDENT> entry = Asimov.query.get(request.json['id']) <NEW_LINE> entry.title = request.json['title'] <NEW_LINE> entry.year = request.json['year'] <NEW_LINE> db.session.commit() <NEW_LINE> return jsonify(entry.to_dictionary())
Updates one record found in the database. @id: matching field to update record.
625941edbaa26c4b54cb1652
def get_file_md5(fp): <NEW_LINE> <INDENT> md5_obj = md5() <NEW_LINE> md5_obj.update(fp.read()) <NEW_LINE> return md5_obj.hexdigest().upper()
use: get file md5 params: fp: file object, such as fp = open('...', '...') return: file md5 upper
625941edcb5e8a47e48b7fd9
@app.route('/api/1.0/samples/<int:sid>/abstract/', methods=['POST']) <NEW_LINE> def api_set_sample_abstract(sid): <NEW_LINE> <INDENT> data = request.json <NEW_LINE> abstract = data['abstract'] <NEW_LINE> samp = api.samplecontrol.get_by_id(sid) <NEW_LINE> result = api.samplecontrol.set_abstract(samp, abstract) <NEW_LINE...
@arg: abstract Markdown for the abstract
625941ed1d351010ab856052
def convert_time(nmea_utc): <NEW_LINE> <INDENT> if not nmea_utc[0:2] or not nmea_utc[2:4] or not nmea_utc[4:6]: <NEW_LINE> <INDENT> return (float('NaN'), float('NaN')) <NEW_LINE> <DEDENT> utc_time = datetime.datetime.utcnow() <NEW_LINE> hours = int(nmea_utc[0:2]) <NEW_LINE> minutes = int(nmea_utc[2:4]) <NEW_LINE> secon...
Extract time info from a NMEA UTC time string and use it to generate a UNIX epoch time. Time information (hours, minutes, seconds) is extracted from the given string and augmented with the date, which is taken from the current system time on the host computer (i.e. UTC now). The date ambiguity is resolved by adding a ...
625941ed379a373c97cfb07e
def indexend(k): <NEW_LINE> <INDENT> return k
Return end index in papers (e.g. 0 or 1-based)
625941edf8510a7c17cf9c38
def __scrape_reference(self): <NEW_LINE> <INDENT> self.reference = self.result['true_summary'].values
:return:
625941ed92d797404e3046c4
def xml_prefix(self, project_name): <NEW_LINE> <INDENT> raise NotImplementedError( '%s.xml_prefix(self, project_name) not implemented' % self.__class__.__name__)
Generate the XML content that goes before the child list. Should return a string. This is one of the two virtual methods. The other one is ``xml_suffix()``.
625941ed507cdc57c630721f
def hashed_callback_name(name): <NEW_LINE> <INDENT> return DIGEST(name.encode("utf-8")).digest()[:8]
Get the hashed name of a callback
625941edbd1bec0571d90b67
def test_team_builder_configs_id_product_sizes_nk_products_fk_delete(self): <NEW_LINE> <INDENT> pass
Test case for team_builder_configs_id_product_sizes_nk_products_fk_delete Delete a related item by id for products.
625941eddd821e528d63b6dc
def save_performance(self, file_name): <NEW_LINE> <INDENT> self.auto_dbm.save_performance(file_name)
Save the training and validating losses. :param file_name: a string
625941ed3d592f4c4ed1d597
def adaptive_avg_pool3d(input, output_size): <NEW_LINE> <INDENT> if not torch.jit.is_scripting(): <NEW_LINE> <INDENT> if type(input) is not Tensor and has_torch_function((input,)): <NEW_LINE> <INDENT> return handle_torch_function( adaptive_avg_pool3d, (input,), input, output_size) <NEW_LINE> <DEDENT> <DEDENT> _output_s...
Applies a 3D adaptive average pooling over an input signal composed of several input planes. See :class:`~torch.nn.AdaptiveAvgPool3d` for details and output shape. Args: output_size: the target output size (single integer or triple-integer tuple)
625941ed07f4c71912b119bd
def transpose(self, tableau_only=False): <NEW_LINE> <INDENT> T = [[0 for i in range(self._max_x)] for j in range(self._max_y)] <NEW_LINE> z_tab = self.z_tableau() <NEW_LINE> for r in range(len(z_tab)): <NEW_LINE> <INDENT> for c in range(len(z_tab[r])): <NEW_LINE> <INDENT> T[c][r] = z_tab[r][c] <NEW_LINE> <DEDENT> <DEDE...
Return the transpose of ``self``. EXAMPLES:: sage: PP = PlanePartition([[4,3,3,1],[2,1,1],[1,1]]) sage: PP.transpose() Plane partition [[4, 2, 1], [3, 1, 1], [3, 1, 0], [1, 0, 0]] sage: PP.transpose(True) [[4, 2, 1], [3, 1, 1], [3, 1, 0], [1, 0, 0]]
625941ed92d797404e3046c5
def __init__(self, callable_fn, output_layer, hk, params, image_size, adv_noise): <NEW_LINE> <INDENT> self.output_layer = output_layer <NEW_LINE> self.callable_fn = callable_fn <NEW_LINE> self.hk = hk <NEW_LINE> self.params = params <NEW_LINE> self.image_size = image_size <NEW_LINE> self.adv_noise = adv_noise
Wrap a callable function that takes a tensor as input and returns a tensor as output with the given layer name. :param callable_fn: The callable function taking a tensor and returning a given layer as output. :param output_layer: A string of the output layer returned by the func...
625941ed4e696a04525c9985
def _get_utilized_bandwidth(self): <NEW_LINE> <INDENT> return self.__utilized_bandwidth
Getter method for utilized_bandwidth, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/mt_isis_neighbor_attribute/neighbors/neighbor/subTLVs/subTLVs/utilized_bandwidth/state/utilized_bandwidth (oc-types:ieeefloat32) YANG Descrip...
625941ed73bcbd0ca4b2c5ad
def process_input(self): <NEW_LINE> <INDENT> pass
collect files from all input-connections
625941edbf627c535bc13707
def gen_hash(): <NEW_LINE> <INDENT> return str(uuid.uuid4()).split('-')[0][:3]
generates a UUID
625941ed1d351010ab856053
def queue(self, action= None, queueName = '', envName = '', content = '4000', delay = 0,expired = 1000): <NEW_LINE> <INDENT> body = {'queueName': queueName, 'envName': envName} <NEW_LINE> if action != 'push' and action != 'pull': <NEW_LINE> <INDENT> return '{0}'.format('actionpush pull') <NEW_LINE> <DEDENT> if action =...
=========== ------------------------------- ,: :parma action: push() or pull(). :parma delay: (ms) :parma expired: (ms)
625941edd268445f265b53a7
def record_to_labeled_log_mel_examples(csv_record, clip_dir=None, hparams=None, label_class_index_table=None, num_classes=None, training=None): <NEW_LINE> <INDENT> [clip, labels_str] = tf.decode_csv(csv_record, record_defaults=[[''],['']]) <NEW_LINE> features = clip_to_log_mel_examples(clip, clip_dir=clip_dir, hparams=...
Creates a batch of log mel spectrum examples from a training record. Args: csv_record: a line from a training CSV file downloaded from Kaggle. clip_dir: path to a directory containing clips referenced by csv_record. hparams: tf.contrib.training.HParams object containing model hyperparameters. label_class_index...
625941ed67a9b606de4a83ef
def isGeneric(self): <NEW_LINE> <INDENT> return self._type == Name.Component.ComponentType.GENERIC
Check if this component is a generic component. :return: True if this is an generic component. :rtype: bool
625941ede64d504609d74d78
def test_defaultAction(self): <NEW_LINE> <INDENT> logger = MemoryLogger() <NEW_LINE> msg = Message.new(key=2) <NEW_LINE> msg.write(logger) <NEW_LINE> written = logger.messages[0] <NEW_LINE> del written["timestamp"] <NEW_LINE> nextLevel = _defaultAction._nextTaskLevel().level <NEW_LINE> prefix, suffix = nextLevel[:-1], ...
If no L{Action} is specified, and the current execution context has no L{Action}, the process-specific global L{Action} is used. This ensures all messages have a unique identity, as specified by task_uuid/task_level.
625941ed1b99ca400220afec
def rarefactionCurve(barcodes, *, maxpoints=1e5, logspace=True): <NEW_LINE> <INDENT> N = len(barcodes) <NEW_LINE> Ni = collections.Counter(barcodes) <NEW_LINE> K = len(Ni) <NEW_LINE> Mj = collections.Counter(Ni.values()) <NEW_LINE> Nk, num = map(numpy.array, zip(*Mj.items())) <NEW_LINE> nbarcodes = [] <NEW_LINE> lnFact...
Rarefaction curve from list of barcodes. Uses the analytical formula for the rarefaction curve defined `on Wikipedia <https://en.wikipedia.org/wiki/Rarefaction_(ecology)#Derivation>`_. Args: `barcodes` (list or pandas Series) Holds the list of unique barcodes for which we calculate the rarefaction...
625941edab23a570cc2506bf
def divide_two_ten(arg): <NEW_LINE> <INDENT> if arg == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if arg % 2 == 0: <NEW_LINE> <INDENT> arg //= 2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> arg //= 10 <NEW_LINE> <DEDENT> print (arg, end = "") <NEW_LINE> return divide_two_ten(arg)
arg: int
625941edbde94217f3683324
def isValid(self, S): <NEW_LINE> <INDENT> while 'abc' in S: <NEW_LINE> <INDENT> S = S.replace('abc','') <NEW_LINE> <DEDENT> return S==''
:type S: str :rtype: bool
625941ed1f5feb6acb0c5082
def by_column(self, mask=None): <NEW_LINE> <INDENT> column_indices = np.arange(self.ncols) <NEW_LINE> if mask is not None: <NEW_LINE> <INDENT> if not isinstance(mask, slice): <NEW_LINE> <INDENT> assert len(mask) == self.ncols <NEW_LINE> <DEDENT> column_indices = column_indices[mask] <NEW_LINE> <DEDENT> if isinstance(se...
Iterate over the columns of the array. Columns will be yielded either as a 1D array or as a single value (for a flat array). `mask`: either `None` or a boolean array indicating which columns should be included.
625941ed99cbb53fe679311d
def create(self, req, *args, **kwargs): <NEW_LINE> <INDENT> url = req.url <NEW_LINE> try: <NEW_LINE> <INDENT> if len(args) != 1: <NEW_LINE> <INDENT> raise BadRequest(resource="addrobj operation", msg=url) <NEW_LINE> <DEDENT> json_body = req.body <NEW_LINE> context = req.context <NEW_LINE> values = json.loads(json_body)...
create the addrobj
625941ed6fece00bbac2dc7d
@pexdoc.pcontracts.contract(wave=Waveform) <NEW_LINE> def real(wave): <NEW_LINE> <INDENT> return _operation(wave, "real", wave.dep_units, np.real)
Return the real part of a waveform's dependent variable vector. :param wave: Waveform :type wave: :py:class:`peng.eng.Waveform` :rtype: :py:class:`peng.eng.Waveform` .. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]] .. Auto-generated exceptions documentation for .. peng.wave_functions.real :raises: RuntimeErro...
625941ed66673b3332b925c9
def test_wait_for_with_interval(self): <NEW_LINE> <INDENT> query_mock = MagicMock(side_effect=[{'error': 'error'}, {}]) <NEW_LINE> with patch.object(salt.utils.http, 'query', query_mock): <NEW_LINE> <INDENT> with patch('time.sleep', MagicMock()) as sleep_mock: <NEW_LINE> <INDENT> self.assertEqual(http.wait_for_successf...
Test for wait_for_successful_query waits for request_interval
625941ed63d6d428bbe44a29
@app.callback( dash.dependencies.Output('bar-line-chart', 'figure'), [dash.dependencies.Input('gender-type', 'value')]) <NEW_LINE> def update_bar_chart(gendername): <NEW_LINE> <INDENT> value_list = list(qn1data['sum'][(qn1data['Gender'] == gendername)]) <NEW_LINE> name_list = list(qn1data['YEAR'][(qn1data['Gender'] == ...
Forms a Staced Bar Chart Keyword Arguments: statename1 -- Gets the first state name to compare statename2 -- Gets the second state name to compare The values of the states are fetched and compared using a stacked Bar chart List Operation - Functions - PandasDataFrame Operations Implemented
625941ed097d151d1a22338f
def stop(self): <NEW_LINE> <INDENT> pass
Close all websockets and stop listening.
625941ed6e29344779a62b49
def remove_redundant_chains(self): <NEW_LINE> <INDENT> all_chainScore_list = list(self.all_chainScore_set) <NEW_LINE> self.all_chainScore_set = set() <NEW_LINE> progbar = ProgressBar(100) <NEW_LINE> all_chainScore_listList_list = chunkIt(all_chainScore_list, scoop.SIZE) <NEW_LINE> try: <NEW_LINE> <INDENT> scoop.shared....
:return: all_chainScore_list: E.g. [ ('V126NH', 'S99NH', 'A111NH', 'T128NH', 7.187111855209132e-13), ...]
625941ed4f88993c3716c59a
def send_ether_over_wpa(self, pkt, **kwargs): <NEW_LINE> <INDENT> payload = LLC() / SNAP() / pkt[Ether].payload <NEW_LINE> dest = pkt.dst <NEW_LINE> if dest == "ff:ff:ff:ff:ff:ff": <NEW_LINE> <INDENT> self.send_wpa_to_group(payload, dest) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> assert dest == self.client <NEW_LIN...
Send an Ethernet packet using the WPA channel Extra arguments will be ignored, and are just left for compatibility
625941edc432627299f05182
def compute_loss(a, t, w, n, graph, name=None): <NEW_LINE> <INDENT> with tf.name_scope(name, "ComputeLoss", [a, t]) as name: <NEW_LINE> <INDENT> return py_func(forward_func, [a, t, w, n], [tf.float32], graph, name=name, grad=backprop_func_noise)
a: a=hw+b, is the log likelihood of data sample, shape=[batch_size, nb_labels] t: one-hot vector, ground truth label. shape=[batch_size, nb_labels]
625941ed0fa83653e46574f0
def __init__(self, stimfile, frame_rate, length, channel, filter_sample_rate=1000.0): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> nchannels = len(channel) <NEW_LINE> channel = int(channel[0]) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> channel = int(channel) <NEW_LINE> <DEDENT> super().__init__(stimfile,...
Construct an OnlineReceptiveField class. Parameters ---------- stimfile : str Filename of an HDF5 file containing the stimulus. Refer to the OnlineAnalysis base class for more details. frame_rate : float The effective frame rate of the stimulus. Refer to the OnlineAnalysis base class for more detail...
625941ed91f36d47f21aca31
def SetIamPolicy(self, request, context): <NEW_LINE> <INDENT> context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
Sets the access control policy on the specified dataset. Replaces any existing policy. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) See <a href="/iam/docs/managing-policies#setting_a_policy">Setti...
625941ed21a7993f00bc8232
def realize(self, X): <NEW_LINE> <INDENT> def _realize_(x): <NEW_LINE> <INDENT> assert (len(x.shape) == 2) <NEW_LINE> inds = np.argsort(-(x**2).sum(axis=0)**.5 + np.random.normal( 0, self.noise, x[0].shape)) <NEW_LINE> x = x[inds, :][:, inds] * 1 <NEW_LINE> x = x.flatten()[self.triuind] <NEW_LINE> return x <NEW_LINE> <...
Randomize features. Parameters: ---------- X: np.ndarray Features Returns: ------- X: np.ndarray Randomized features
625941ed01c39578d7e75374
def init(config: pyramid.config.Configurator, health_check: c2cwsgiutils.health_check.HealthCheck) -> None: <NEW_LINE> <INDENT> global_settings = config.get_settings() <NEW_LINE> if "checker" not in global_settings: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> settings = global_settings["checker"] <NEW_LINE> _routes(...
Initialize the checkers.
625941ed30dc7b7665901e98
def add_access_control_group_outbound_rule(self, add_access_control_group_outbound_rule_request, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async'): <NEW_LINE> <INDENT> return self.add_access_control_group_outbound_rule_with_http_info(add_access_control_group_outbou...
add_access_control_group_outbound_rule # noqa: E501 ACGOutboundRule추가 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.add_access_control_group_outbound_rule(add_access_control_group_outbound_rule_request, async=True) ...
625941ed73bcbd0ca4b2c5ae
def position_hold_measurements(self, xy_pos_mm, meas_time, filename, set_sample_size=256): <NEW_LINE> <INDENT> self.set_target_wp(xy_pos_mm) <NEW_LINE> self.start_moving_gantry_to_target() <NEW_LINE> while not self.confirm_arrived_at_target_wp(): <NEW_LINE> <INDENT> print('Moving to position = ' + str(xy_pos_mm)) <NEW_...
:param xy_pos_mm: :param meas_time: :param filename: :param set_sample_size: :return:
625941ed187af65679ca5658
def containsPointInX(self, *args) -> "bool": <NEW_LINE> <INDENT> return _PolyVoxCore.Region_containsPointInX(self, *args)
containsPointInX(Region self, float pos, float boundary=0.0) -> bool containsPointInX(Region self, float pos) -> bool containsPointInX(Region self, int32_t pos, uint8_t boundary=0) -> bool containsPointInX(Region self, int32_t pos) -> bool
625941edc4546d3d9de72f71
def stepBy(self, step): <NEW_LINE> <INDENT> if self.currentSectionIndex() == 1: <NEW_LINE> <INDENT> if step < 0: <NEW_LINE> <INDENT> minute = self.time().minute() <NEW_LINE> if minute == 0: <NEW_LINE> <INDENT> self.setTime( QtCore.QTime( self.time().hour() - 1, 60 - self.resolution ) ) <NEW_LINE> <DEDENT> else: <NEW_LI...
Custom stepBy function :param step: :return:
625941ed0a50d4780f6673cf
def pair(args): <NEW_LINE> <INDENT> def success(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> device_manager.trust_device() <NEW_LINE> device_manager.connect_device() <NEW_LINE> format_results({'result': 'Success', 'code': ''}) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> mainloop.quit() <NEW_LINE> <DEDENT> <DEDE...
Pair to the specified device Args: args (dict): args parsed on the command line Returns: results (dict): return message and code of the operation
625941ed3cc13d1c6d3c78b0
def _init_config_(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> echo = config.update_config_from_file(PATH_CONFIG, group='default') <NEW_LINE> utils.xprint(echo, newline=True) <NEW_LINE> if __debug__: <NEW_LINE> <INDENT> echo = config.update_config_from_file(PATH_CONFIG, group='debug') <NEW_LINE> utils.xprint(echo, n...
Initialize for global variables in config module.
625941ed45492302aab5e801
def __init__(self, scans=None): <NEW_LINE> <INDENT> self._scans = None <NEW_LINE> self.discriminator = None <NEW_LINE> if scans is not None: <NEW_LINE> <INDENT> self.scans = scans
InlineResponse20041w - a model defined in Swagger
625941ed56b00c62f0f14b95
@cli.command() <NEW_LINE> @click.argument('data_dir') <NEW_LINE> @click.argument('spec_str') <NEW_LINE> @click.argument('output_filename') <NEW_LINE> @click.option('--n_trials', default=5) <NEW_LINE> @click.option('--n_iterations', default=4000) <NEW_LINE> @click.option('--distance_metric', default='fm2011') <NEW_LINE>...
Re-run an experiment using an hdf from DATA_DIR specified by SPEC_STR in URL query format. Selects run with max polarization by default.
625941edd99f1b3c44c67abd
def class_from_module_path(module_path: Text) -> Any: <NEW_LINE> <INDENT> import importlib <NEW_LINE> from rasa_core.policies.keras_policy import KerasPolicy <NEW_LINE> from rasa_core.policies.fallback import FallbackPolicy <NEW_LINE> from rasa_core.policies.two_stage_fallback import TwoStageFallbackPolicy <NEW_LINE> f...
Given the module name and path of a class, tries to retrieve the class. The loaded class can be used to instantiate new objects.
625941ed6fece00bbac2dc7e
def requests_post_es(payload=None, url=ANALYZER_URL, headers=None, verbose=0): <NEW_LINE> <INDENT> headers = HEADERS if headers is None else headers <NEW_LINE> payload = payload if payload else json_data_bytes() <NEW_LINE> results = requests.post(url=url, headers=headers, data=payload) <NEW_LINE> if verbose: <NEW_LINE>...
post analysis request to Elasticsearch and return JSON results as a dict
625941edbe383301e01b59b4
def load_synthetic_data(data_name): <NEW_LINE> <INDENT> assert (data_name == 'A' or data_name == 'B' or data_name == 'C') <NEW_LINE> file_name = 'cluster_data_data' + data_name + '_X.txt' <NEW_LINE> x = [] <NEW_LINE> with open(file_name) as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> line = line.split() <...
Load synthetic data with the given name :param data_name: name of the data :return: (x, y)
625941edad47b63b2c50a4b8
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, Action): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return super(Action, self).__eq__(other)
Check the equality of the two objects. Do a straight data to data comparison.
625941ed60cbc95b062c6a7c
def get_object_id(self): <NEW_LINE> <INDENT> sha = hashlib.sha1() <NEW_LINE> sha.update(self.get_object_type()) <NEW_LINE> sha.update((' %d\0' % self.get_size()).encode('ascii')) <NEW_LINE> for x in self.iterate_contents(): <NEW_LINE> <INDENT> sha.update(x) <NEW_LINE> <DEDENT> return ObjectId(sha.digest())
Get id of this object.
625941ed925a0f43d254a3b5
def test_read_state(self): <NEW_LINE> <INDENT> with self.plc: <NEW_LINE> <INDENT> state = self.plc.read_state() <NEW_LINE> self.assertEqual(state[0], constants.ADSSTATE_RUN)
Test read_state for AdvancedHandler.
625941edec188e330fd5accd
def paths(): <NEW_LINE> <INDENT> sheet_paths = [ default_path(), cheatsheets.sheets_dir()[0], ] <NEW_LINE> if 'CHEATPATH' in os.environ and os.environ['CHEATPATH']: <NEW_LINE> <INDENT> for path in os.environ['CHEATPATH'].split(os.pathsep): <NEW_LINE> <INDENT> if os.path.isdir(path): <NEW_LINE> <INDENT> sheet_paths.appe...
Assembles a list of directories containing cheatsheets traversal of file system for multiple locations containing cheatsheets
625941ed8e71fb1e9831dce0
def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.delta = {}
Inputs: name (string): Name of the state.
625941ed10dbd63aa1bd30db
def questions(self): <NEW_LINE> <INDENT> self.__generate_question_noun() <NEW_LINE> self.__generate_question() <NEW_LINE> return self.question
Returns question in the format { question: <>, option1: <>, option2: <>, option3: <>, option4: <>, answer1: <>, answer2: <>, answer3: <>, score: <len(answer)> type: 3 }
625941ed56ac1b37e62646fe
def get_standard_deviation(marks): <NEW_LINE> <INDENT> average_mark = get_average(marks) <NEW_LINE> marks_total = 0 <NEW_LINE> for i in marks: <NEW_LINE> <INDENT> marks_total += (i - average_mark)**2 <NEW_LINE> <DEDENT> standard_deviation = math.sqrt(marks_total/(len(marks) - 1)) <NEW_LINE> return standard_deviation
Function to get the standard deviation
625941edbde94217f3683325
@cli.command() <NEW_LINE> def update(): <NEW_LINE> <INDENT> feeds = db_interface.get_feeds() <NEW_LINE> for feed in feeds: <NEW_LINE> <INDENT> url = feed["url"] <NEW_LINE> name = feed['name'] <NEW_LINE> r, f = parse_feed(url, etag=feed['etag'], modified=feed['last_modified']) <NEW_LINE> if r & (ResultType.HTTP_ERROR | ...
Update all feeds in feed db..
625941ed15baa723493c44b3
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, SampleSet): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.vartype != other.vartype or self.info != other.info: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.record.dtype.fields.keys() != other.record.dtype.fields.keys():...
SampleSet equality.
625941ed6aa9bd52df0372e0
def get_file_path(local): <NEW_LINE> <INDENT> if local: <NEW_LINE> <INDENT> local_path = os.path.join(os.getcwd(), "simtools.ini") <NEW_LINE> if not os.path.exists(local_path): <NEW_LINE> <INDENT> open(local_path,'w').close() <NEW_LINE> <DEDENT> return local_path <NEW_LINE> <DEDENT> return os.path.abspath(os.path.join(...
Get the file path for either the local ini or the global ini. Create the file if it doesnt exist. :param local: If true, opens the local ini file, if false opens the global one :return: Complete file path to the ini file
625941ed167d2b6e312190ce
def insert(self, element, index): <NEW_LINE> <INDENT> if self._test_input_is_markdown(element): <NEW_LINE> <INDENT> self._elements.append(element)
Insert an element at index. Args: index (int): Document index to insert. Raises: ValueError if element is not a Markdown subclass. IndexError for invalid index.
625941ed4f6381625f114f74
def stop(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pf = open(self.pidfile, 'r') <NEW_LINE> pid = int(pf.read().strip()) <NEW_LINE> pf.close() <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> pid = None <NEW_LINE> <DEDENT> if not pid: <NEW_LINE> <INDENT> message = "pidfile {0} does not exist. Daemon not...
Stop the daemon.
625941edaad79263cf390f82
def forStatus(self, status: Status) -> GMEPublicOfferQuery: <NEW_LINE> <INDENT> self._queryParameters.status = status <NEW_LINE> return self
Set the status to be queried. Args: status: Enum for the GME Public Offer status to be queried. Returns: GMEPublicOfferQuery.
625941ed30bbd722463cc303
def testDraftProspects(self): <NEW_LINE> <INDENT> pass
Test DraftProspects
625941ed3eb6a72ae02eca25
def OnUnComment(self,event): <NEW_LINE> <INDENT> self.parent.notebook.UnComment()
Edit.UnComment event handler
625941edbe7bc26dc91cdb2f
def setValue(self, x): <NEW_LINE> <INDENT> pyoArgsAssert(self, "O", x) <NEW_LINE> self._value = x <NEW_LINE> x, lmax = convertArgsToLists(x) <NEW_LINE> [obj.setValue(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
Replace the `value` attribute. :Args: x : float or PyoObject new `value` attribute.
625941ed283ffb24f3c55e35
def get_users_from_query(query): <NEW_LINE> <INDENT> return query.all()
Query all users
625941ed8e05c05ec3eea8b3
def query_yearly_stats(session, year): <NEW_LINE> <INDENT> now = datetime.datetime.now() <NEW_LINE> params = { "from": "01-01-{}".format(year), "to": "{:02}-{:02}-{}".format(now.day, now.month, year), "sport":["RUNNING"], "barType":"distance", "group":"week", "report":"time", "reportSubtype":"training", "timeFrame":"ye...
Users an active requests session to query the yearly stats for a given year. Returns the JSON information received from Polar flow on success.
625941edbaa26c4b54cb1653