code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def spherical_to_cartesian(mock_catalog_tiled): <NEW_LINE> <INDENT> H0 = 70 <NEW_LINE> d = mock_catalog_tiled.cz.values/H0 <NEW_LINE> RA = mock_catalog_tiled.ra.values <NEW_LINE> DEC = mock_catalog_tiled.dec.values <NEW_LINE> x = d*np.cos(DEC)*np.cos(RA) <NEW_LINE> y = d*np.cos(DEC)*np.sin(RA) <NEW_LINE> z = d*np.sin(D... | Converts spherical RA,DEC,cz to cartesian x,y,z
Parameters
----------
mock_catalog_tiled: Pandas dataframe
Mock catalog tiled 8 times with redshift space distortions applied
Returns
---------
mock_catalog_tiled: Pandas dataframe
Mock catalog with cartesian x,y,z position information added | 625941cecdde0d52a9e53155 |
def get_session(self, session_key): <NEW_LINE> <INDENT> data_raw = self.redis_con.get(self.get_full_key(session_key)) <NEW_LINE> if not data_raw: <NEW_LINE> <INDENT> raise DneError <NEW_LINE> <DEDENT> return deserialize(data_raw) | Get the session Data
:param session_key:
:return: the deserialized data | 625941ce596a897236089be2 |
def vnl_c_vectorUC_fill(*args): <NEW_LINE> <INDENT> return _vnl_c_vectorPython.vnl_c_vectorUC_fill(*args) | vnl_c_vectorUC_fill(unsigned char x, unsigned int arg1, unsigned char v) | 625941ce004d5f362079a455 |
def normalize_node_feature_subject_wise(x, N): <NEW_LINE> <INDENT> s1, s2 = x.shape <NEW_LINE> x = x.view(N, -1) <NEW_LINE> mean_tensor = torch.mean(x, dim=0) <NEW_LINE> std_tensor = torch.std(x, dim=0) + 1e-10 <NEW_LINE> x = (x - mean_tensor) / std_tensor <NEW_LINE> x = x.view(s1, s2) <NEW_LINE> return x | Sample wise norm
Normalize node feature for node feature matrix x
:param N: number of samples
:param x: Node feature matrix with shape [num_nodes, num_node_features]
:return: | 625941cedc8b845886cb5657 |
def remove_tiny_sub_paths(bool_glyph, min_area, msg): <NEW_LINE> <INDENT> num_contours = len(bool_glyph.contours) <NEW_LINE> ci = 0 <NEW_LINE> while ci < num_contours: <NEW_LINE> <INDENT> contour = bool_glyph.contours[ci] <NEW_LINE> ci += 1 <NEW_LINE> on_line_pts = filter(lambda pt: pt[0] is not None, contour._points) ... | Removes tiny subpaths that are created by overlap removal when the start
and end path segments cross each other, rather than meet. | 625941ced486a94d0b98e267 |
def init(self, ui_xml): <NEW_LINE> <INDENT> treeview = ui_xml.get_object('treeview_action') <NEW_LINE> self.actions_model = treeview.get_model() <NEW_LINE> self.action_selection = treeview.get_selection() <NEW_LINE> show_button = ui_xml.get_object('button_action_do') <NEW_LINE> show_button.set_sensitive(self._isSelecte... | Initialization that is specific to the Action interface
(construct data models, connect signals to callbacks, etc.)
@param ui_xml: Interface viewer glade xml.
@type ui_xml: gtk.glade.XML | 625941ce167d2b6e31218cb8 |
def inst_tailcall(self, jmp, height, nargs): <NEW_LINE> <INDENT> jmp = self._ref(jmp) <NEW_LINE> self._move_stack(nargs, height) <NEW_LINE> self._do_jmp(jmp) | Tail call.
Will clear `height` values off the stack moving the last
`nargs` ones down to serve as arguments for the calls, then
jumps to the given reference. This does not push the pc on
the call stack.
Arguments:
jmp: stack reference to a callable (code position or partial).
height: height of the stack rela... | 625941ce3317a56b86939d7a |
def test_deactivate_profile(self): <NEW_LINE> <INDENT> self.client.post( '/api/profile/create_profile/', self.profile, format='json') <NEW_LINE> response = self.client.put( '/api/profile/deactivate_profile/', format='json') <NEW_LINE> result = json.loads(response.content) <NEW_LINE> self.assertEqual(result["profile"]["... | test deactivating a profile | 625941ce56ac1b37e62642f1 |
def test_dankort_number(self): <NEW_LINE> <INDENT> dankort_number = 5019717010103742 <NEW_LINE> self.assertTrue(formatter.is_dankort(dankort_number)) | should identify dankort card numbers. | 625941ced164cc6175782e70 |
def players_birthday(self): <NEW_LINE> <INDENT> return "Happy Birthday!" | Mumbaikar doesn't want to lose money :P. | 625941ce2c8b7c6e89b358e3 |
def get_previous_byday(dayname, start_date=None): <NEW_LINE> <INDENT> if start_date is None: <NEW_LINE> <INDENT> start_date = datetime.today() <NEW_LINE> <DEDENT> day_num = start_date.weekday() <NEW_LINE> day_num_target = weekdays.index(dayname) <NEW_LINE> days_ago = (7 + day_num - day_num_target) % 7 <NEW_LINE> if day... | 获得上周某耀日的日期 | 625941cea05bb46b383ec943 |
def plot_Jackpot(obj, peak,em_lines, savedir, counter): <NEW_LINE> <INDENT> fontP = FontProperties() <NEW_LINE> fontP.set_size('medium') <NEW_LINE> plt.suptitle(SDSSname(obj.RA,obj.DEC)+'\n'+'RA='+str(obj.RA)+ ', Dec='+str(obj.DEC) +', $z_{QSO}='+'{:03.3}'.format(obj.z)+ '$') <NEW_LINE> gs = gridspec.GridSpec(1,4) <NEW... | jptSave.plot_Jackpot(obj, peak,em_lines, savedir, counter)
=========================================================
Plots Jackpot lens candidates
Parameters:
obj: The SDSS object/spectra on which applied the subtraction
peak_candidates: The inquired peaks
savedir: Directory to save the plots/data
em_l... | 625941ced486a94d0b98e268 |
def fit_transform(self, X, y=None): <NEW_LINE> <INDENT> X = atleast2d_or_csr(X) <NEW_LINE> check_non_negative(X, "NMF.fit") <NEW_LINE> n_samples, n_features = X.shape <NEW_LINE> if not self.n_components: <NEW_LINE> <INDENT> self.n_components_ = n_features <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.n_components_... | Learn a NMF model for the data X and returns the transformed data.
This is more efficient than calling fit followed by transform.
Parameters
----------
X: {array-like, sparse matrix}, shape = [n_samples, n_features]
Data matrix to be decomposed
Returns
-------
data: array, [n_samples, n_components]
Transfor... | 625941ce57b8e32f524835bd |
def test_tags_limited_to_user(self): <NEW_LINE> <INDENT> user2 = get_user_model().objects.create_user( 'hi@gmail.com', '12344555' ) <NEW_LINE> Tag.objects.create(user=user2, name='Dessert') <NEW_LINE> tag = Tag.objects.create(user=self.user, name='Indian food') <NEW_LINE> res = self.client.get(TAGS_URL) <NEW_LINE> self... | Test that tags returned are for the authenticated user | 625941cee8904600ed9f204f |
def generate_people_csv(self): <NEW_LINE> <INDENT> people_sorted = sorted(self._data.person_event_list, key=lambda x: x.sort_key) <NEW_LINE> people_data_output = [ self.person_csv_data( p, num_problems=self._data.max_num_problems, distinguish_official=self._data.distinguish_official) for p in people_sorted] <NEW_LINE> ... | Generate the CSV file for all peoples. | 625941cebf627c535bc132f1 |
def handler(event, context): <NEW_LINE> <INDENT> _logger.debug('Request: {}'.format(json.dumps(event))) <NEW_LINE> body = json.loads(event.get('body')) <NEW_LINE> pickup_location = _get_pickup_location(body) <NEW_LINE> ride_resp = _get_ride(pickup_location) <NEW_LINE> resp = { 'statusCode': 201, 'body': json.dumps(ride... | Function entry | 625941ced10714528d5ffe05 |
def __init__(self, subject="", frm='', to=[''], cc=None, body="",): <NEW_LINE> <INDENT> self.subject = subject <NEW_LINE> self.body = body <NEW_LINE> self.frm = frm <NEW_LINE> self.to = to <NEW_LINE> self.cc = cc <NEW_LINE> self.host = 'smtp.gmail.com' <NEW_LINE> self.port = 587 | Initialize class variables. | 625941ce5fdd1c0f98dc0355 |
def validate_ureport1(ureport): <NEW_LINE> <INDENT> ureport2 = ureport1to2(ureport) <NEW_LINE> validate_ureport2(ureport2) | Validates uReport1 | 625941ce851cf427c661a631 |
def _logging_callback(level, domain, message, data): <NEW_LINE> <INDENT> domain = ffi.string(domain).decode() <NEW_LINE> message = ffi.string(message).decode() <NEW_LINE> logger = LibraryWrapper._logger.getChild(domain) <NEW_LINE> if level not in globals.LOG_LEVELS: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> logger... | Callback that outputs libgphoto2's logging message via
Python's standard logging facilities.
:param level: libgphoto2 logging level
:param domain: component the message originates from
:param message: logging message
:param data: Other data in the logging record (unused) | 625941cea4f1c619b28b015b |
def test_repl_integrity(self): <NEW_LINE> <INDENT> expected_dn_list = self.create_object_range(0, 400) <NEW_LINE> (orig_hwm, unused) = self._get_highest_hwm_utdv(self.test_ldb_dc) <NEW_LINE> self.repl_get_next() <NEW_LINE> for x in range(100, 200): <NEW_LINE> <INDENT> self.modify_object(expected_dn_list[x], "displayNam... | Modify the objects being replicated while the replication is still
in progress and check that no object loss occurs. | 625941ce283ffb24f3c55a23 |
def inverse_time_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False): <NEW_LINE> <INDENT> if not isinstance(global_step, Variable): <NEW_LINE> <INDENT> raise ValueError("global_step is required for inverse_time_decay.") <NEW_LINE> <DEDENT> div_res = global_step / decay_steps <NEW_LINE> if stairc... | Applies inverse time decay to the initial learning rate.
```python
if staircase:
decayed_learning_rate = learning_rate / (1 + decay_rate * floor(global_step / decay_step))
else
decayed_learning_rate = learning_rate / (1 + decay_rate * global_step / decay_step)
```
Args:
learning_rate: A scalar float32 value or... | 625941ce44b2445a339321b8 |
def no_routing(self, x): <NEW_LINE> <INDENT> unit = [self.conv_units[i](x) for i, l in enumerate(self.conv_units)] <NEW_LINE> unit = torch.stack(unit, dim=1) <NEW_LINE> batch_size = x.size(0) <NEW_LINE> unit = unit.view(batch_size, self.num_unit, -1) <NEW_LINE> return squash(unit, dim=2) | Get output for each unit.
A unit has batch, channels, height, width.
An example of a unit output shape is [128, 32, 6, 6]
:return: vector output of capsule j | 625941ce21bff66bcd684a75 |
def optimize(sources, num_detectors=1, function_type="worst_case_TTA", bounds=None, bad_sources=None, vis=True, interpolation_method="nearest"): <NEW_LINE> <INDENT> optimization_logger.info("Making bounds") <NEW_LINE> bounds = make_bounds(bounds, sources, num_detectors) <NEW_LINE> optimization_logger.info("Making the o... | sources : [SmokeSource]
Sources are now represented by their own class
num_detectors : int
The number of detectors to place
bounds : ArrayLike
[x_low, x_high, y_low, y_high] or [
x_low, x_high, y_low, y_high, z_low, z_high]
will be computed from sources if None. This determines whether to
op... | 625941cebe7bc26dc91cd722 |
def read_birthdays(file_path): <NEW_LINE> <INDENT> with open(file_path) as file: <NEW_LINE> <INDENT> return file.read() | Read the contents of the birthdays file into a string.
Arguments:
file_path (string): The path to the birthdays file.
Returns:
string: The contents of the birthdays file. | 625941ce07d97122c41789ae |
def Prepare(benchmark_spec): <NEW_LINE> <INDENT> server_partials = [functools.partial(_PrepareServer, mongo_vm) for mongo_vm in benchmark_spec.vm_groups['workers']] <NEW_LINE> client_partials = [functools.partial(_PrepareClient, client) for client in benchmark_spec.vm_groups['clients']] <NEW_LINE> vm_util.RunThreaded((... | Install MongoDB on one VM and YCSB on another.
Args:
benchmark_spec: The benchmark specification. Contains all data that is
required to run the benchmark. | 625941ceb545ff76a8913f38 |
def test_pos_hll_get_count(self): <NEW_LINE> <INDENT> ops = [ hll_operations.hll_get_count('hll_bin_big') ] <NEW_LINE> actual_count = 1000 <NEW_LINE> rel_error = self.relative_count_error(10) <NEW_LINE> _, _, res = self.as_connection.operate(self.test_keys[2], ops) <NEW_LINE> self.assert_within_error_bounds(res['hll_bi... | Invoke hll_get_count() to check an HLL's count. | 625941ce711fe17d8254248e |
def __init__(self): <NEW_LINE> <INDENT> self.desired_caps = { 'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': APP_PACKAGE, 'appActivity': APP_ACTIVITY } <NEW_LINE> self.driver = webdriver.Remote(DRIVER_SERVER,self.desired_caps) <NEW_LINE> self.wait = WebDriverWait(self.driver,TIMEOUT) <NEW_LINE> self... | 初始化 | 625941ce8da39b475bd65096 |
def to_latlon_tuple(self) -> LatLonTuple: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._caches['latlon_tuple'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> p = self if self.spatial_reference.srid == 4326 else self.transform(spatial_reference=4326) <NEW_LINE> latlon_tuple = LatLonTuple(latitude=p... | Get a lightweight latitude/longitude tuple representation of this point.
:return: the latitude/longitude tuple representation of this point | 625941ce6fb2d068a760f1c0 |
def get_can_change(self, obj: Section) -> bool: <NEW_LINE> <INDENT> if self.context.get('request'): <NEW_LINE> <INDENT> user = self.context['request'].user <NEW_LINE> return user.has_perm('main.change_section', obj) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Сериализует флаг возможности редактирования | 625941ce2eb69b55b151c9d2 |
def key_locked(id): <NEW_LINE> <INDENT> with codecs.open(master_keyring, 'r', 'utf-8') as mfile: <NEW_LINE> <INDENT> mconf.readfp(mfile) <NEW_LINE> if 'encrypted_' in mconf.get(id, 'privatekey'): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif not 'encrypted_' in mconf.get(id, 'privatekey'): <NEW_LINE> <INDENT... | Checks if private key of a given ID is protected by password | 625941ce96565a6dacc8f7ee |
def script(request, script): <NEW_LINE> <INDENT> return render_to_response("script/"+script, mimetype="text/javascript") | Render and return the javascript as regular rendered templates. | 625941cebde94217f3682f13 |
def move_to_element(self, index=0, **kwargs): <NEW_LINE> <INDENT> elem = get_element(index, **kwargs) <NEW_LINE> ActionChains(Seldom.driver).move_to_element(elem).perform() | Mouse over the element.
Usage:
self.move_to_element(css="#el") | 625941cefff4ab517eb2f55f |
def update_position_and_clean(self): <NEW_LINE> <INDENT> pos = self.position.get_new_position(self.direction, self.speed) <NEW_LINE> if self.room.is_position_valid(pos): <NEW_LINE> <INDENT> self.position = pos <NEW_LINE> self.room.clean_tile_at_position(self.position, self.capacity) <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Simulate the raise passage of a single time-step.
Move the robot to a new random position (if the new position is invalid,
rotate once to a random new direction, and stay stationary) and clean the dirt on the tile
by its given capacity. | 625941ce15fb5d323cde0c32 |
def GetPayload(payload_file): <NEW_LINE> <INDENT> return GetPayloadFromOffset(payload_file, 0) | Read payload and pad it to 64-byte aligned. | 625941ceab23a570cc2502a5 |
def print_adj_matrices(directory, diagrams): <NEW_LINE> <INDENT> with open(directory+"/adjacency_matrices.txt", "w") as mat_file: <NEW_LINE> <INDENT> for idx, diagram in enumerate(diagrams): <NEW_LINE> <INDENT> mat_file.write("Diagram n: %i\n" % (idx + 1)) <NEW_LINE> numpy.savetxt(mat_file, nx.to_numpy_matrix(diagram.g... | Print a computer-readable file with the diagrams' adjacency matrices.
Args:
directory (str): The path to the output directory.
diagrams (list): All the diagrams. | 625941ced10714528d5ffe06 |
def frameAt(self, idx: int): <NEW_LINE> <INDENT> prevKey = idx // (self.numBetweens + 1) <NEW_LINE> self._validateKeyIdx(prevKey) <NEW_LINE> if (idx / (self.numBetweens + 1)) > len(self._frames): <NEW_LINE> <INDENT> raise IndexError("Frame index out of bounds") <NEW_LINE> <DEDENT> betweenIdx = idx % (self.numBetweens +... | Returns the frame at the given position, 0 indexed.
Args:
idx (int): position of the frame, 0 indexed
Returns:
Frame: the frame at the given index
Raises:
IndexError: if no frame exists at that location | 625941ce507cdc57c6306dfe |
def _predict(self, X, threshold): <NEW_LINE> <INDENT> if not self.fitted_: <NEW_LINE> <INDENT> raise ValueError("SklearnGerryFairClassifier not fitted") <NEW_LINE> <DEDENT> if not isinstance(X, pd.DataFrame): <NEW_LINE> <INDENT> X = pd.DataFrame(X, columns=self.feature_names_) <NEW_LINE> <DEDENT> dataset = self._prep(X... | A reference implementation of a prediction for a classifier.
Parameters
----------
X : array-like, shape (n_samples, n_features)
The input samples.
Returns
-------
y : ndarray, shape (n_samples,)
The label for each sample is the label of the closest sample
seen during fit. | 625941ce596a897236089be3 |
def pc_work_time_avg(self): <NEW_LINE> <INDENT> return _AIUT_swig.Lora_Demodulator_sptr_pc_work_time_avg(self) | pc_work_time_avg(Lora_Demodulator_sptr self) -> float | 625941cefbf16365ca6f62e8 |
def anchor_center(self, anchors): <NEW_LINE> <INDENT> anchors_cx = (anchors[:, 2] + anchors[:, 0]) / 2 <NEW_LINE> anchors_cy = (anchors[:, 3] + anchors[:, 1]) / 2 <NEW_LINE> return torch.stack([anchors_cx, anchors_cy], dim=-1) | Get anchor centers from anchors.
Args:
anchors (Tensor): Anchor list with shape (N, 4), "xyxy" format.
Returns:
Tensor: Anchor centers with shape (N, 2), "xy" format. | 625941ce63f4b57ef000123c |
def __init__(self, hass: HomeAssistant, sequence, name: str = None, change_listener=None) -> None: <NEW_LINE> <INDENT> self.hass = hass <NEW_LINE> self.sequence = sequence <NEW_LINE> template.attach(hass, self.sequence) <NEW_LINE> self.name = name <NEW_LINE> self._change_listener = change_listener <NEW_LINE> self._cur ... | Initialize the script. | 625941cef9cc0f698b14071e |
def doctest_skip_parser(func): <NEW_LINE> <INDENT> lines = func.__doc__.split('\n') <NEW_LINE> new_lines = [] <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> match = SKIP_RE.match(line) <NEW_LINE> if match is None: <NEW_LINE> <INDENT> new_lines.append(line) <NEW_LINE> continue <NEW_LINE> <DEDENT> code, space, expr = ... | Decorator replaces custom skip test markup in doctests
Say a function has a docstring::
>>> something, HAVE_AMODULE, HAVE_BMODULE = 0, False, False
>>> something # skip if not HAVE_AMODULE
0
>>> something # skip if HAVE_BMODULE
0
This decorator will evaluate the expression after ``skip if``. If ... | 625941cea8ecb033257d31ef |
def _typedef_both( t, base=0, item=0, leng=None, refs=None, kind=_kind_static, heap=False, vari=_Not_vari, ): <NEW_LINE> <INDENT> v = _Typedef( base=_basicsize(t, base=base), item=_itemsize(t, item), refs=refs, leng=leng, both=True, kind=kind, type=t, vari=vari, ) <NEW_LINE> v.save(t, base=base, heap=heap) <NEW_LINE> r... | Add new typedef for both data and code. | 625941ce99fddb7c1c9de4b3 |
def generate_features(self, data, y_label, compress_data=True, log_transform=True): <NEW_LINE> <INDENT> data_array = np.array([]) <NEW_LINE> if compress_data: <NEW_LINE> <INDENT> for trial in range(data.shape[-1]): <NEW_LINE> <INDENT> for tbin in range(data.shape[-2]): <NEW_LINE> <INDENT> data_array = np.append( data_a... | Generates feature vectors for feeding into SVM.
Currently, that means taking the mean power in three frequency ranges:
(0 - 3 Hz, 3 - 12 Hz, 12 - 30 Hz) generating 18 in all (nchans = 6)
Inputs:
data_array: array with shape nchan x f x tbin x trials (see get_norm_array())
y_label label to be given (used t... | 625941ce66656f66f7cbc2cd |
def draw(scores): <NEW_LINE> <INDENT> import matplotlib.pyplot as plt <NEW_LINE> logger.info("scores are {}".format(scores)) <NEW_LINE> ax = plt.subplot(111) <NEW_LINE> ax.set_title('Evaluation Metrics (t-SNE Feature Extraction)') <NEW_LINE> precisions = [] <NEW_LINE> accuracies =[] <NEW_LINE> f1_scores = [] <NEW_LINE>... | draw scores. | 625941ce91af0d3eaac9bb3c |
def convert_to_dataframe(self, ticklist): <NEW_LINE> <INDENT> variables = ['date', 'time', 'askPrice1', 'askVolume1', 'bidPrice1', 'bidVolume1'] <NEW_LINE> dataframe = pandas.DataFrame([[getattr(i, j) for j in variables] for i in ticklist], columns=variables) <NEW_LINE> return dataframe | 转换为dataframe格式 | 625941ce4527f215b584c579 |
def ignore(self, **kwargs: Any) -> Query: <NEW_LINE> <INDENT> clone = self._clone() <NEW_LINE> for key, value in kwargs.items(): <NEW_LINE> <INDENT> if key.endswith(Lookup.IN): <NEW_LINE> <INDENT> key = Lookup.trim(key, Lookup.IN) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> value = [value] <NEW_LINE> <DEDENT> clone._... | Return results that do not match the given facet values.
:param **kwargs: Facet parameters, compatible with `in` field lookup | 625941ce97e22403b379d0bc |
def city_info(df): <NEW_LINE> <INDENT> df_select = df.groupby(['city']).size().reset_index() <NEW_LINE> df_select.columns = ['city', 'city_order_num'] <NEW_LINE> df_select['city_order_ratio'] = df_select['city_order_num'] / (1.0 * df.shape[0]) <NEW_LINE> df_select_1 = df[df['orderType'] == 1].groupby(['city']).size().r... | 城市订单特征 | 625941ce66656f66f7cbc2ce |
def test_screenip_unit_fw_mamm(self): <NEW_LINE> <INDENT> screenip_empty = self.create_screenip_object() <NEW_LINE> expected_results = pd.Series([0.172, 0.172, 0.172], dtype='float') <NEW_LINE> result = pd.Series([], dtype='float') <NEW_LINE> try: <NEW_LINE> <INDENT> screenip_empty.no_of_runs = len(expected_results) <N... | unittest for function screenip.fw_mamm:
:return: | 625941ce7c178a314d6ef583 |
def export_to_xml(self, path='settings.xml'): <NEW_LINE> <INDENT> root_element = ET.Element("settings") <NEW_LINE> self._create_run_mode_subelement(root_element) <NEW_LINE> self._create_particles_subelement(root_element) <NEW_LINE> self._create_batches_subelement(root_element) <NEW_LINE> self._create_inactive_subelemen... | Export simulation settings to an XML file.
Parameters
----------
path : str
Path to file to write. Defaults to 'settings.xml'. | 625941ce4c3428357757c44a |
@pytest.fixture(scope='function') <NEW_LINE> def strain_object_1(strain_builder): <NEW_LINE> <INDENT> common_data = { 'peak_tag': 'test', 'wavelength': 2.0, 'd_reference': 1.0, 'peak_profile': 'pseudovoigt', 'background_type': 'linear', 'error_fraction': 0.1, } <NEW_LINE> strain_1235_data = deepcopy(common_data) <NEW_L... | Serves a StrainField object made up of two non-overlapping StrainFieldSingle objects | 625941ce4f6381625f114b5e |
def _scroll_left(self): <NEW_LINE> <INDENT> self._scroll_with_flipping(-prefs['number of pixels to scroll per key event'], 0) | Scrolls left. | 625941ce009cb60464c634d4 |
def get_current_download_serials(download_root): <NEW_LINE> <INDENT> current_serials = {} <NEW_LINE> for release in distro_info.UbuntuDistroInfo().supported(): <NEW_LINE> <INDENT> url = os.path.join( download_root, release, 'current', 'unpacked', 'build-info.txt') <NEW_LINE> build_info_response = requests.get(url) <NEW... | Given a download root, determine the latest current serial.
This works, specifically, by inspecting
<download_root>/<suite>/current/unpacked/build-info.txt for supported
releases. | 625941cecdde0d52a9e53156 |
def __init__(self, filename, mode, iline=189, xline=193): <NEW_LINE> <INDENT> self._filename = filename <NEW_LINE> self._mode = mode <NEW_LINE> self._il = iline <NEW_LINE> self._xl = xline <NEW_LINE> self._ilines = None <NEW_LINE> self._xlines = None <NEW_LINE> self._tracecount = None <NEW_LINE> self._sorting = None <N... | Constructor, internal. | 625941ce7d847024c06be3de |
def fmt_iso(timestamp): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return fmt.iso_datetime(timestamp) <NEW_LINE> <DEDENT> except (ValueError, TypeError): <NEW_LINE> <INDENT> return "N/A".rjust(len(fmt.iso_datetime(0))) | Format a UNIX timestamp to an ISO datetime string.
| 625941ce85dfad0860c3af7e |
def removable(self): <NEW_LINE> <INDENT> return self.flowers - self.decrement_token | 減らせる桜花結晶の数を計算する
Returns:
減らせる桜花結晶の数 | 625941cee1aae11d1e749dda |
def looksLikeDraft(o): <NEW_LINE> <INDENT> if not hasattr(o, 'Shape') or o.Shape.isNull(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if len(o.Shape.Solids) > 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return o.Shape.Volume < 0.0000001 | Does this object look like a Draft shape? (flat, no solid, etc) | 625941cea79ad161976cc269 |
def lock_switched_files(sbox): <NEW_LINE> <INDENT> sbox.build() <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') <NEW_LINE> lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda') <NEW_LINE> iota_URL = sbox.repo_url + '/iota' <NEW_LINE> alpha_URL = sbox.repo_url + '/A/B/E/a... | lock/unlock switched files | 625941ce45492302aab5e3e6 |
def UNet(input_shape, high_performance_enable=False): <NEW_LINE> <INDENT> inputs = tf.keras.layers.Input(shape=input_shape) <NEW_LINE> down_stack = [ downsample(64, 4, apply_batchnorm=False), downsample(128, 4), downsample(256, 4), downsample(512, 4), downsample(512, 4), downsample(512, 4), downsample(512, 4), ] <NEW_L... | UNet 网络
如果在低配GPU中,可能发生网络结构过于复杂而显存不足的情况。禁用该选项时,会把UNet中的编码器最后一层与解码器第一层去除。
param: high_performance_enable: 启用高性能。 | 625941ce21bff66bcd684a76 |
def beans_to_dict(list, fieldName): <NEW_LINE> <INDENT> res = {} <NEW_LINE> for item in list: <NEW_LINE> <INDENT> key = getattr(item, fieldName) <NEW_LINE> value = item <NEW_LINE> res[key] = value <NEW_LINE> <DEDENT> return res | list相关属性和自身组成dict
:param list:
:param fieldName:
:return: | 625941ce851cf427c661a632 |
def _default_folded_cartan_type(self): <NEW_LINE> <INDENT> from sage.combinat.root_system.type_folded import CartanTypeFolded <NEW_LINE> letter = self._type.type() <NEW_LINE> if letter == 'BC': <NEW_LINE> <INDENT> n = self._type.classical().rank() <NEW_LINE> return CartanTypeFolded(self, ['A', 2*n - 1, 1], [[0]] + [[i,... | Return the default folded Cartan type.
EXAMPLES::
sage: CartanType(['A', 6, 2]).dual()._default_folded_cartan_type()
['BC', 3, 2]^* as a folding of ['A', 5, 1]
sage: CartanType(['A', 5, 2])._default_folded_cartan_type()
['B', 3, 1]^* as a folding of ['D', 4, 1]
sage: CartanType(['D', 4, 2])._defau... | 625941cebf627c535bc132f2 |
def __reports_get_fleet_summary_admin( self, start_date, end_date, x_chronosheets_auth, **kwargs ): <NEW_LINE> <INDENT> kwargs['async_req'] = kwargs.get( 'async_req', False ) <NEW_LINE> kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) <NEW_LINE> kwargs['_preload_content'] = kwargs.get( '_... | Gets a summary report, which includes total distance travelled and total running costs, for vehicles within your organisation Requires the 'ReportAdmin' permission. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api... | 625941cea17c0f6771cbe173 |
def compute_recipients(address: str, groups: pd.DataFrame = None) -> list: <NEW_LINE> <INDENT> def _expand_groups(_parts): <NEW_LINE> <INDENT> if not _parts: <NEW_LINE> <INDENT> return set() <NEW_LINE> <DEDENT> if groups is None: <NEW_LINE> <INDENT> return _parts <NEW_LINE> <DEDENT> _parts = tuple(_parts) <NEW_LINE> re... | Compute the persons for whom a payment was made. Groups will be expanded to their members.
:param address: str
Indicates the recipients for this payment, separated by one of ``+&;`` (+ optional whitespace around the
separator). Persons can be subtracted from the recipients list by using of one ``-\``.
:param g... | 625941ce5f7d997b87174bbb |
def for_entity(self, entity): <NEW_LINE> <INDENT> return [credential for credential in self.credentials if credential.entity == entity] | Returns a list of credentials for a particular entity. | 625941cea4f1c619b28b015c |
def test_relationship(self): <NEW_LINE> <INDENT> test_user = User(first_name="Test", last_name="User", image_url="https://www.kindpng.com/picc/m/451-4517876_default-profile-hd-png-download.png") <NEW_LINE> db.session.add(test_user) <NEW_LINE> db.session.commit() <NEW_LINE> test_post = Post(title="What's up", content="N... | Tests that relationship between Post and User is set up | 625941ced268445f265b4f91 |
def toWriteOutString(leoCoords): <NEW_LINE> <INDENT> numZerosX = 5 - len(str(leoCoords[0])) <NEW_LINE> numZerosY = 5 - len(str(leoCoords[1])) <NEW_LINE> print(" Coords from Kinect are ", leoCoords, "numZerosX is ", numZerosX, "numZerosY is ", numZerosY, end="\t") <NEW_LINE> return ('0'*numZerosX)+str(leoCoords[0])+('0'... | Convert a tuple of two integers to a string to send
to the Arduino Leonardo in the format:
xxxxxyyyyy.
where xxxxx is a right-aligned x coordinate precceded by 0's,
yyyyy is a right-aligned y coordinate precceded by 0's,
and a '.' terminates the string. | 625941ce956e5f7376d70f90 |
def get_full_order_book_level3(self, symbol): <NEW_LINE> <INDENT> data = { 'symbol': symbol } <NEW_LINE> return self._get('market/orderbook/level3', False, data=data) | Get a list of all bids and asks non-aggregated for a symbol.
This call is generally used by professional traders because it uses more server resources and traffic,
and Kucoin has strict access frequency control.
https://docs.kucoin.com/#get-full-order-book-atomic
:param symbol: Name of symbol e.g. KCS-BTC
:type symb... | 625941ce24f1403a92600c89 |
def solveFullQR(self): <NEW_LINE> <INDENT> Q, R = qr(self.A) <NEW_LINE> d = np.dot(Q.T, self.b) <NEW_LINE> dx = np.dot(inv(R), d) <NEW_LINE> dx[np.isnan(dx)] = 0 <NEW_LINE> for i in range(len(self.nodes)): <NEW_LINE> <INDENT> self.nodes[i].pose += dx[i*3:(i+1)*3, 0] | (1) Function
- solve linear system using QR decomposition | 625941ce07d97122c41789af |
def test_elements_not_string_post(self): <NEW_LINE> <INDENT> response = self.client.post("/api/v1/questions", data = json.dumps(self.incorrect_question), content_type = "application/json") <NEW_LINE> self.assertEqual(response.status_code, 400) | tests the creation of a question when there is an integer in title | 625941ceec188e330fd5a8c2 |
def store(self, path=None): <NEW_LINE> <INDENT> path = path or self.path <NEW_LINE> with open(path, 'w') as f: <NEW_LINE> <INDENT> json.dump(self, f, indent=2) | Cache the received settings locally. The cache will be used if
the remote is unreachable to load settings that are as close
to the user's as possible | 625941ceab23a570cc2502a6 |
def greet_user(): <NEW_LINE> <INDENT> username = get_stored_username() <NEW_LINE> if username: <NEW_LINE> <INDENT> print("Welcome back, " + username + "!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> username = get_new_username() <NEW_LINE> print("We'll remember you, " + username + "!") | Greet the user by name. | 625941cee5267d203edcddc0 |
def use_serial(self): <NEW_LINE> <INDENT> pass | Instructs the utility to use the isolated serializable session. | 625941cebe8e80087fb20d66 |
def test_check_metadata_match_fullname_postscript(): <NEW_LINE> <INDENT> check = CheckTester(googlefonts_profile, "com.google.fonts/check/metadata/match_fullname_postscript") <NEW_LINE> regular_font = TEST_FILE("merriweather/Merriweather-Regular.ttf") <NEW_LINE> lightitalic_font = TEST_FILE("merriweather/Merriweather-L... | METADATA.pb family.full_name and family.post_script_name
fields have equivalent values ? | 625941cef548e778e58cd6a1 |
def remove_tree(self, path): <NEW_LINE> <INDENT> raise NotImplementedError( "Abstract method `Transport.remove_tree()` called - " "this should have been defined in a derived class.") | Removes a directory tree. | 625941ce50485f2cf553cebd |
def nearest_bee(self, hive): <NEW_LINE> <INDENT> transition=0 <NEW_LINE> place = self.place <NEW_LINE> while place is not hive: <NEW_LINE> <INDENT> if place.bees: <NEW_LINE> <INDENT> if self.min_range <= transition and transition <= self.max_range: <NEW_LINE> <INDENT> return random_or_none(place.bees) <NEW_LINE> <DEDEN... | Return the nearest Bee in a Place that is not the HIVE, connected to
the ThrowerAnt's Place by following entrances.
This method returns None if there is no such Bee (or none in range). | 625941ce7047854f462a152d |
def merkle_parent_level(hashes): <NEW_LINE> <INDENT> if len(hashes) == 1: <NEW_LINE> <INDENT> raise RuntimeError('Cannot take a parent level with only 1 item') <NEW_LINE> <DEDENT> if len(hashes) % 2 == 1: <NEW_LINE> <INDENT> hashes.append(hashes[-1]) <NEW_LINE> <DEDENT> parent_level = [] <NEW_LINE> for i in range(0, le... | Takes a list of binary hashes and returns a list that's half
the length | 625941ce498bea3a759b9bd2 |
def process_message(self, msg, con): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = self.db.process_message(msg) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> log.debug(str(e)) <NEW_LINE> return <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if result is not None: <... | Feed message to Database and send response to client. | 625941ce29b78933be1e57cf |
def __init__(self, name, charCompRef, devIORef=None): <NEW_LINE> <INDENT> Pstring.__init__(self, name, charCompRef, devIORef) <NEW_LINE> return | Constructor
Params:
- name is the quite literally the name of the property
- charCompRef is the characteristic component object which contains this
property
- devIORef is a reference to a DevIO to be used with this property
Returns: Nothing
Raises: Nothing. | 625941cef7d966606f6aa128 |
def __init__(self): <NEW_LINE> <INDENT> self.Threshold = None <NEW_LINE> self.Id = None <NEW_LINE> self.Business = None | :param Threshold: DDoS清洗阈值,取值[0, 60, 80, 100, 150, 200, 250, 300, 400, 500, 700, 1000];
当设置值为0时,表示采用默认值;
:type Threshold: int
:param Id: 资源ID
:type Id: str
:param Business: 大禹子产品代号(bgpip表示高防IP;bgp表示独享包;bgp-multip表示共享包;net表示高防IP专业版)
:type Business: str
| 625941cea934411ee37517b7 |
def fill_feed_dict(net, batch_loader, batch_size=128, phase='test'): <NEW_LINE> <INDENT> if phase not in ['train', 'test']: <NEW_LINE> <INDENT> raise ValueError('phase must be "train" or "test"') <NEW_LINE> <DEDENT> if phase == 'train': <NEW_LINE> <INDENT> keep_prob = 0.5 <NEW_LINE> is_phase_train = True <NEW_LINE> <DE... | Fills the feed_dict for training the given step.
A feed_dict takes the form of:
feed_dict = {
<placeholder>: <tensor of values to be passed for placeholder>,
....
}
Args:
batch_loader: BatchLoader, that provides batches of the data
images_pl: The images placeholder, from placeholder_inputs().
labels_pl:... | 625941ce73bcbd0ca4b2c19a |
def set_vars(self, directory): <NEW_LINE> <INDENT> self._directory = directory | Sets the variables in the object to the ones passed in
:return: | 625941ce4d74a7450ccd42e7 |
def test_distance_mask(): <NEW_LINE> <INDENT> region = (0, 5, -10, -4) <NEW_LINE> coords = grid_coordinates(region, spacing=1) <NEW_LINE> mask = distance_mask((2.5, -7.5), maxdist=2, coordinates=coords) <NEW_LINE> true = [ [False, False, False, False, False, False], [False, False, True, True, False, False], [False, Tru... | Check that the mask works for basic input | 625941ce4e4d5625662d44fb |
def update_json(code_folder: str, temp_location: str, progress): <NEW_LINE> <INDENT> progress("loading json") <NEW_LINE> with open(temp_location + "/___ThIsisATemPoRaRyFiLE___.json") as content: <NEW_LINE> <INDENT> dot_vex_json: dict = json.load(content) <NEW_LINE> encode_files: list = os.listdir(code_folder) <NEW_LINE... | :param code_folder: the files you want to put into the .vex
:param temp_location: the folder containing ___ThIsisATemPoRaRyFiLE___.json
:param progress: optional way to output the progress | 625941ce71ff763f4b5497af |
def compress_files(files, archive, path=None, overwrite=True): <NEW_LINE> <INDENT> with swallow_outputs() as cmo: <NEW_LINE> <INDENT> if path: <NEW_LINE> <INDENT> opj_path = lambda p: opj(path, p) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> opj_path = lambda p: p <NEW_LINE> <DEDENT> if not overwrite: <NEW_LINE> <INDE... | Compress `files` into an `archive` file
Parameters
----------
files : list of str
archive : str
path : str
Alternative directory under which compressor will be invoked, to e.g.
take into account relative paths of files and/or archive
overwrite : bool
Either to allow overwriting the target archive file if one alr... | 625941ce38b623060ff0af11 |
def set_attributes(self, ncdict, delval='DELETE'): <NEW_LINE> <INDENT> netcdf_builder.set_attributes(self.netcdf_object, ncdict, delval) | Copy attribute names and values from a dict (or OrderedDict) to a netCDF
object.
Global attributes are keyed in the OrderedDict by the attribute name.
Variable attributes are keyed in the OrderedDict by the variable name and
attribute name separated by a colon, i.e. variable:attribute.
If any value is equal to delval ... | 625941ce8e05c05ec3eea498 |
def representation(self, sequence): <NEW_LINE> <INDENT> seq_motifs = {} <NEW_LINE> for motif in self._motifs: <NEW_LINE> <INDENT> seq_motifs[motif] = 0 <NEW_LINE> <DEDENT> for start in range(len(sequence) - (self._motif_size - 1)): <NEW_LINE> <INDENT> motif = sequence[start:start + self._motif_size].tostring() <NEW_LIN... | Represent a sequence as a set of motifs.
Arguments:
o sequence - A Bio.Seq object to represent as a motif.
This converts a sequence into a representation based on the motifs.
The representation is returned as a list of the relative amount of
each motif (number of times a motif occured divided by the total
number of ... | 625941ce91f36d47f21ac617 |
def evaluate_orig(): <NEW_LINE> <INDENT> with tf.Graph().as_default() as g: <NEW_LINE> <INDENT> eval_data = FLAGS.eval_data == 'test' <NEW_LINE> images, labels = cifar10.inputs(eval_data=eval_data) <NEW_LINE> logits = cifar10.inference(images) <NEW_LINE> top_k_op = tf.nn.in_top_k(logits, labels, 1) <NEW_LINE> variable_... | Eval CIFAR-10 for a number of steps. | 625941ce566aa707497f468c |
def finalize_round(self, round_id, date): <NEW_LINE> <INDENT> old_round = self.get_round_by_id(round_id) <NEW_LINE> if not old_round: <NEW_LINE> <INDENT> raise ValueError('Round %d not found' % round_id) <NEW_LINE> <DEDENT> if not date: <NEW_LINE> <INDENT> raise ValueError('Will not end round %d with no date' % round_i... | Finalize round and delete it if its empty | 625941ce99cbb53fe6792d0a |
def chi2(a, b, err, trans=None): <NEW_LINE> <INDENT> if trans is None: <NEW_LINE> <INDENT> trans = pg.RTrans() <NEW_LINE> <DEDENT> d = (trans(a) - trans(b)) / trans.error(a, err) <NEW_LINE> return pg.dot(d,d) / len(d) | Return chi square value.
| 625941ce8e7ae83300e4b0f0 |
def do_signup(self, qcontext): <NEW_LINE> <INDENT> values = {key: qcontext.get(key) for key in ( 'login', 'name', 'password', 'phone', 'street', 'street2', 'zip', 'city', 'state_id', 'country_id', 'birthday')} <NEW_LINE> if not values: <NEW_LINE> <INDENT> raise UserError(_("The form was not properly filled in.")) <NEW_... | Shared helper that creates a res.partner out of a token | 625941ce66673b3332b921b5 |
def testTakenUUID(self): <NEW_LINE> <INDENT> self.assertRaises(UUIDInUseException, ActorTestActor, **{'uuid': 'noexist_actor'}) | Raise UUIDInUseException when uuid is already taken. | 625941ce4f88993c3716c18a |
def validate(self, full: bool = True) -> None: <NEW_LINE> <INDENT> errors = {} <NEW_LINE> for k in self._storage.keys(): <NEW_LINE> <INDENT> if k not in self._settings.keys(): <NEW_LINE> <INDENT> errors[k] = SettingValidationError('Invalid setting name') <NEW_LINE> <DEDENT> <DEDENT> for k, v in self._settings.items(): ... | Validate the resource adapter settings profile.
:param bool full: perform a full validation. A full validation
validates required fields, mutually exclusive,
and requires. A partial validation makes sure
that non-valid field names are not permitted,
... | 625941ce5510c4643540f508 |
def test_clone(): <NEW_LINE> <INDENT> print() <NEW_LINE> print('-----------------------------------------------------------') <NEW_LINE> print('Testing the CLONE method of the Point class.') <NEW_LINE> print('-----------------------------------------------------------') <NEW_LINE> p1 = Point(10, 8) <NEW_LINE> print... | Tests the CLONE method of the Point class.
Here is the specification for the clone method:
What comes in:
-- self
What goes out:
Returns a new Point whose x and y coordinates are the same
as the x and y coordinates of this Point.
Side effects: None.
EXAMPLE: The following shows CLONE in action.
You... | 625941ce004d5f362079a457 |
def fix_argv_paths(paths, argv=None): <NEW_LINE> <INDENT> if argv is None: <NEW_LINE> <INDENT> argv = sys.argv <NEW_LINE> <DEDENT> for path in paths: <NEW_LINE> <INDENT> for count in xrange(len(argv)): <NEW_LINE> <INDENT> if path == argv[count]: <NEW_LINE> <INDENT> argv[count] = os.path.abspath(path) <NEW_LINE> <DEDENT... | Given the argv vector of cli parameters, and a list of path that
can be relative and may have been specified within argv,
it substitute all the occurencies of these paths in argv.
argv is changed in place and returned. | 625941ced486a94d0b98e269 |
def __init__(self, params, learn_rate=1e-3, reg=0, momentum=0.9): <NEW_LINE> <INDENT> super().__init__(params) <NEW_LINE> self.learn_rate = learn_rate <NEW_LINE> self.reg = reg <NEW_LINE> self.momentum = momentum <NEW_LINE> self.curr_grad = [0] * len(params) | :param params: The model parameters to optimize
:param learn_rate: Learning rate
:param reg: L2 Regularization strength
:param momentum: Momentum factor | 625941ce3c8af77a43ae38c4 |
def calcFieller(self): <NEW_LINE> <INDENT> va = self.sa * self.sa <NEW_LINE> vb = self.sb * self.sb <NEW_LINE> cov = self.r * self.sa * self.sb <NEW_LINE> self.g = self.tval * self.tval * vb /(self.b * self.b) <NEW_LINE> self.ratio = self.a / self.b <NEW_LINE> rat2 = self.ratio * self.ratio <NEW_LINE> disc = va - 2.0 *... | Fieller formula calculator. | 625941ce925a0f43d2549f9b |
def test_add_wish(self): <NEW_LINE> <INDENT> url = reverse("library:add-wish", kwargs={"game_": self.game.id}) <NEW_LINE> response = self.client.get(url, HTTP_REFERER=self.HTTP_REFERER) <NEW_LINE> self.assertEqual(response.status_code, 302) | Load add wish | 625941ce167d2b6e31218cba |
def remove(table, id_): <NEW_LINE> <INDENT> for index, record in enumerate(table): <NEW_LINE> <INDENT> if record[0] == id_: <NEW_LINE> <INDENT> table.pop(index) <NEW_LINE> <DEDENT> <DEDENT> save_data_to_file(table) <NEW_LINE> return table | Remove a record with a given id from the table.
Args:
table: table to remove a record from
id_ (str): id of a record to be removed
Returns:
Table without specified record. | 625941ce0c0af96317bb830c |
def expectation_value_multi_sites(self, operators, i0): <NEW_LINE> <INDENT> op = operators[0] <NEW_LINE> if (isinstance(op, str)): <NEW_LINE> <INDENT> op = self.sites[self._to_valid_index(i0)].get_op(op) <NEW_LINE> <DEDENT> theta = self.get_B(i0, 'Th') <NEW_LINE> C = npc.tensordot(op, theta, axes=['p*', 'p']) <NEW_LINE... | Expectation value ``<psi|op0_{i0}op1_{i0+1}...opN_{i0+N}|psi>/<psi|psi>``.
Calculates the expectation value of a tensor product of single-site operators
acting on different sites next to each other.
In other words, evaluate the expectation value of a term
``op0_i0 op1_{i0+1} op2_{i0+2} ...``.
Parameters
----------
o... | 625941cec432627299f04d6a |
def yield_entry(self): <NEW_LINE> <INDENT> with open(self.get_file(), "r") as fh: <NEW_LINE> <INDENT> aaseq = "" <NEW_LINE> header = "" <NEW_LINE> did_first = False <NEW_LINE> for line in fh: <NEW_LINE> <INDENT> if line[0] == ">": <NEW_LINE> <INDENT> if did_first == True: <NEW_LINE> <INDENT> if len(aaseq) > 0: <NEW_LIN... | generator that yields one entry of a fasta-file at a time,
as tuple (header, aaseq)
:return: tuple(Str, Str) | 625941ce29b78933be1e57d0 |
def execute_hook(hook_name, *args): <NEW_LINE> <INDENT> hook_module = nimp.system.try_import('hooks.' + hook_name) <NEW_LINE> if hook_module is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> logging.info('Found %s hook', hook_name) <NEW_LINE> return hook_module.run(*args) | Executes a hook in the .nimp/hooks directory | 625941ced164cc6175782e72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.