code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def date_greater_than_or_equal_to(d1, d2) -> bool: <NEW_LINE> <INDENT> d10 = np_datetime_to_datetime(d1) <NEW_LINE> d20 = np_datetime_to_datetime(d2) <NEW_LINE> return (d10 - d20).days >= 0
d1, d2 are datetime objects Returns True iff d1 >= d2
625941cf8e05c05ec3eea4c1
def create_listen_socket(self, ip='localhost', port=8999): <NEW_LINE> <INDENT> sock = socket.socket() <NEW_LINE> sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) <NEW_LINE> sock.bind((ip, port)) <NEW_LINE> sock.listen() <NEW_LINE> return SocketWrapper(sock=sock, loop=self)
创建listen的套接字
625941cf293b9510aa2c33e1
def zeroAdjust(self): <NEW_LINE> <INDENT> currSignal = self.get_signalValue() <NEW_LINE> currBias = self.get_signalBias() <NEW_LINE> return self.set_signalBias(currSignal + currBias)
Adjusts the signal bias so that the current signal value is need precisely as zero. Remember to call the saveToFlash() method of the module if the modification must be kept. @return YAPI.SUCCESS if the call succeeds. On failure, throws an exception or returns a negative error code.
625941cf5f7d997b87174be4
def _normalize_fourier_coefficients(fourier_coefficients): <NEW_LINE> <INDENT> U, _, V_transpose = np.linalg.svd( _reshape(fourier_coefficients), full_matrices=False) <NEW_LINE> return np.matmul(U, V_transpose)
Normalizes a group of fourier coefficients by power within group Parameters ---------- fourier_coefficients : array, shape (n_time_windows, n_trials, n_tapers, n_fft_samples, n_signals) Returns ------- normalized_fourier_coefficients : array, s...
625941cfd18da76e23532622
def insert(self, loc, item): <NEW_LINE> <INDENT> code = self.categories.get_indexer([item]) <NEW_LINE> if (code == -1) and not (is_scalar(item) and isna(item)): <NEW_LINE> <INDENT> raise TypeError("cannot insert an item into a CategoricalIndex " "that is not already an existing category") <NEW_LINE> <DEDENT> codes = se...
Make new Index inserting new item at location. Follows Python list.append semantics for negative values Parameters ---------- loc : int item : object Returns ------- new_index : Index Raises ------ ValueError if the item is not in the categories
625941cfaad79263cf390b8d
def multipass_disparity(img_left, img_right, outlier_percent=3, range_pad_percent=10): <NEW_LINE> <INDENT> disp_img = disparity(img_left, img_right) <NEW_LINE> border = 20 <NEW_LINE> disp_img = disp_img[border:-border, border:-border] <NEW_LINE> valid = disp_img >= 0 <NEW_LINE> valid_data = disp_img[valid] <NEW_LINE> l...
Compute dispartity in two passes The first pass obtains a robust estimate of the disparity range The second pass limits the search to the estimated range for better coverage. The outlier_percent variable controls which percentange of extreme values to ignore when computing the range after the first pass The range_pa...
625941cf4e696a04525c9597
def fifth_screen(self, *args): <NEW_LINE> <INDENT> if self.load_or_change == 'CHANGE': <NEW_LINE> <INDENT> _title = roboprinter.lang.pack['Filament_Wizard']['Title_45'] <NEW_LINE> back_dest = self.name+'[3]' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _title = roboprinter.lang.pack['Filament_Wizard']['Title_34'] <NEW...
Final screen / Confirm successful load: Extrude filament Display instruction to user -- Press okay when you see plastic extruding Display button that will move_to_main() AND stop extruding filament
625941cfcad5886f8bd27125
def load_classes(path): <NEW_LINE> <INDENT> with open(path, 'r') as fcls: <NEW_LINE> <INDENT> names = fcls.readlines() <NEW_LINE> <DEDENT> names = [name.strip() for name in names if name.strip()] <NEW_LINE> return names
Loads class labels at 'path'
625941cf57b8e32f524835e7
def write_cubes_emission(self): <NEW_LINE> <INDENT> log.info("Writing the emission cubes ...") <NEW_LINE> if self.do_write_cube_earth_emission: self.write_cube_earth_emission() <NEW_LINE> if self.do_write_cube_faceon_emission: self.write_cube_faceon_emission() <NEW_LINE> if self.do_write_cube_edgeon_emission: self.writ...
This function ... :return:
625941cfac7a0e7691ed4218
def histogram(input, bins=100, min=0, max=0): <NEW_LINE> <INDENT> if in_dygraph_mode(): <NEW_LINE> <INDENT> return _C_ops.histogram(input, "bins", bins, "min", min, "max", max) <NEW_LINE> <DEDENT> helper = LayerHelper('histogram', **locals()) <NEW_LINE> check_variable_and_dtype( input, 'X', ['int32', 'int64', 'float32'...
Computes the histogram of a tensor. The elements are sorted into equal width bins between min and max. If min and max are both zero, the minimum and maximum values of the data are used. Args: input (Tensor): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor s...
625941cf4f88993c3716c1b3
def get_user_input(prompt, validator=None): <NEW_LINE> <INDENT> reply = None <NEW_LINE> while reply is None: <NEW_LINE> <INDENT> reply = input(prompt) <NEW_LINE> if reply == 'Q' or reply == 'quit': <NEW_LINE> <INDENT> main() <NEW_LINE> <DEDENT> if validator: <NEW_LINE> <INDENT> if validator(reply) is None: <NEW_LINE> <...
Handle asking for user input and validation.
625941cff8510a7c17cf9847
def dummy(in0): <NEW_LINE> <INDENT> return in0
Just return input
625941cfe5267d203edcdde9
def pairs(items): <NEW_LINE> <INDENT> arr = [[np.array([])]] <NEW_LINE> for i in items: <NEW_LINE> <INDENT> for j in items: <NEW_LINE> <INDENT> if i.name == j.name: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> arr.append([i,j]) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return arr
takes a list of items of length m and returns a 2*m^2 array of all possible pairs of items, omitting self pairs eg (i,i)
625941cfe1aae11d1e749e03
def __code_executor(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> exec(open(self.py_file).read()) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> url = "http://stackoverflow.com/search?q=[python]+" + str(e) <NEW_LINE> webbrowser.open(url, new=2) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("...
This function execute code hook all the errors and open browser with results.
625941cfcc0a2c11143dcfdc
def extract_urls(text: str, extract_urls_without_protocol: bool = True) -> List[str]: <NEW_LINE> <INDENT> return [dic['url'] for dic in extract_urls_with_indices(text, extract_urls_without_protocol)]
Extract valid URLs present in ``text``. >>> extract_urls('http://twitter.com/これは日本語です。example.com中国語') ["url": "http://twitter.com/", "example.com"]
625941cfd164cc6175782e9a
def set_sundir(self,t): <NEW_LINE> <INDENT> self.sundir = self.orbit.sun_coords_at(t) <NEW_LINE> self.sunl = distant_light(direction=self.sundir,color=color.white) <NEW_LINE> self.sunl2 = distant_light(direction=self.sundir,color=color.white) <NEW_LINE> self.disp.lights=[self.sunl,self.sunl2] <NEW_LINE> if self.umbra i...
Sets the direction of the sun/lighting tp where it should be at time t.
625941cfb5575c28eb68e14d
def _add_dataset_labels(self, train_index, val_index, test_index): <NEW_LINE> <INDENT> self.labels['dataset'] = np.nan <NEW_LINE> self.labels.loc[train_index, 'dataset'] = 'train' <NEW_LINE> self.labels.loc[val_index, 'dataset'] = 'val' <NEW_LINE> self.labels.loc[test_index, 'dataset'] = 'test' <NEW_LINE> self.labels['...
Add to dataset split to labels DataFrame.
625941cfbe7bc26dc91cd74b
def set_people (self, people): <NEW_LINE> <INDENT> self.persons = people
Sets the people, that are represented by this proxy object. @param people: a schedule container object
625941cf5510c4643540f52f
def delete(key): <NEW_LINE> <INDENT> if key in CACHE: <NEW_LINE> <INDENT> del CACHE[key]
delete key from cache
625941cf460517430c3942d0
def build_score_offset_targets(default_boxes, gt_boxes, gt_corner_type_ids, config): <NEW_LINE> <INDENT> num_default_boxes = default_boxes.size()[0] <NEW_LINE> target_scores = torch.zeros((num_default_boxes, config.NUM_CORNER_TYPES * 2), requires_grad=False).long() <NEW_LINE> target_offsets = torch.zeros((num_default_b...
default_boxes: 所有的boxes,假设是输入是在图像域坐标 gt_boxes: 真实的点的标记,每个点都是一个正方形的box, 并且附带这个点的类别信息,假设是在图像域的坐标 这里的两个应该都要是tensor gt_type_ids: 1,2,3,4 top_left, top_right, bottom_right, bottom_left
625941cf711fe17d825424b7
def setUp(self): <NEW_LINE> <INDENT> options = Options() <NEW_LINE> self.fitting_problem = FittingProblem(options) <NEW_LINE> self.fitting_problem.function = f_ls <NEW_LINE> self.fitting_problem.jacobian = J_ls <NEW_LINE> self.fitting_problem.hessian = H_ls <NEW_LINE> self.fitting_problem.data_x = np.array([1, 2, 3, 4,...
Setting up tests
625941cf96565a6dacc8f817
def test_MultipleClips(self): <NEW_LINE> <INDENT> stage = Usd.Stage.Open('multiclip/root.usda') <NEW_LINE> stage.SetInterpolationType(Usd.InterpolationTypeHeld) <NEW_LINE> model = stage.GetPrimAtPath('/Model_1') <NEW_LINE> attr = model.GetAttribute('size') <NEW_LINE> self.assertTrue(attr.ValueMightBeTimeVarying()) <NEW...
Verifies behavior with multiple clips being applied to a single prim
625941cfec188e330fd5a8ea
def get_single_data_and_metadata(id_number): <NEW_LINE> <INDENT> query = 'select x, y from xy_values_stm312 where measurement = {} order by id desc' <NEW_LINE> query = query.format(id_number) <NEW_LINE> cursor.execute(query) <NEW_LINE> data = np.array(cursor.fetchall()) <NEW_LINE> fields = ['id', 'time', 'comment'] <NE...
Get data and metadata based by id
625941cf23e79379d52ee6b0
def clear_all_cookies(self): <NEW_LINE> <INDENT> list( map( self.clear_cookie, self.setcookies.keys() )) <NEW_LINE> return None
:meth:`pluggdapps.web.webinterfaces.IHTTPResponse.clear_all_cookies` interface method.
625941cf956e5f7376d70fb9
def all_consumed_offsets(self): <NEW_LINE> <INDENT> all_consumed = {} <NEW_LINE> for partition, state in six.iteritems(self.assignment): <NEW_LINE> <INDENT> if state.has_valid_position: <NEW_LINE> <INDENT> all_consumed[partition] = OffsetAndMetadata(state.position, '') <NEW_LINE> <DEDENT> <DEDENT> return all_consumed
Returns consumed offsets as {TopicPartition: OffsetAndMetadata}
625941cf091ae356686670aa
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, RecurrenceRead): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941cffff4ab517eb2f588
def _create_lun_meta(self, lun): <NEW_LINE> <INDENT> LOG.debug("Calling check_is_naelement(%s)", lun) <NEW_LINE> self.client.check_is_naelement(lun) <NEW_LINE> meta_dict = {} <NEW_LINE> meta_dict['Path'] = lun.get_child_content('path') <NEW_LINE> meta_dict['Volume'] = lun.get_child_content('path').split('/')[2] <NEW_LI...
Creates LUN metadata dictionary.
625941cfcc0a2c11143dcfdd
def register(self): <NEW_LINE> <INDENT> self.app.bind('User', User)
Registers The User Into The Service Container
625941cf8c0ade5d55d3eb08
def copy_from_db(self, srcdb): <NEW_LINE> <INDENT> self.drop_all_tables() <NEW_LINE> self.metadata.create_all() <NEW_LINE> for tbl in srcdb.metadata.sorted_tables: <NEW_LINE> <INDENT> data = [dict((col.key, x[col.name]) for col in tbl.c) for x in srcdb.engine.execute(tbl.select())] <NEW_LINE> if data: <NEW_LINE> <INDEN...
Make a complete copy from srcdb into this instance of MetricsDb This drops all tables in this instance and then recreates them, and then populates all tables with data from srcdb Args: srcdb(MetricsDb): The src db to copy from
625941cfd8ef3951e324368a
def _do_get_field_widget_args(self, field_name, field): <NEW_LINE> <INDENT> args = super(RecordViewBase, self)._do_get_field_widget_args( field_name, field) <NEW_LINE> args['field_name'] = field_name <NEW_LINE> if self.__provider__.is_relation(self.__entity__, field_name): <NEW_LINE> <INDENT> args['entity'] = self.__en...
Override this method do define how this class gets the field widget arguemnts
625941cfec188e330fd5a8eb
def delete_quotas_users( self, file_systems=None, references=None, users=None, file_system_names=None, file_system_ids=None, names=None, uids=None, user_names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None, ): <NEW_LINE> <INDENT> kwargs = dict( file_system_names=file_s...
Delete a hard limit file system quota for a user. Args: file_systems (list[FixedReference], optional): A list of file_systems to query for. Overrides file_system_names and file_system_ids keyword arguments. references (list[FixedReference], optional): A list of references to query for. Override...
625941cf97e22403b379d0e6
@register.inclusion_tag("planet/posts/full_details.html") <NEW_LINE> def post_full_details(post): <NEW_LINE> <INDENT> return {"post": post}
Displays full info about a post: title, date, feed, authors and tags, and it also displays external links to post and blog.
625941cf009cb60464c634fe
def main(): <NEW_LINE> <INDENT> string = input() <NEW_LINE> count_ = 0 <NEW_LINE> for i in range(len(string)-2): <NEW_LINE> <INDENT> if (string[i] == "b" and string[i+1] == "o" and string[i+2] == "b"): <NEW_LINE> <INDENT> count_ = count_+1 <NEW_LINE> <DEDENT> <DEDENT> print(count_)
"This program is used to count the 'bob' in a given string.
625941cf9c8ee82313fbb8c2
def test_delistPlayer(self): <NEW_LINE> <INDENT> self.setUp() <NEW_LINE> players = Players() <NEW_LINE> ref_players = [] <NEW_LINE> for pp in refPlayers(): <NEW_LINE> <INDENT> ref_players.append(player_format_DB(pp)) <NEW_LINE> <DEDENT> gameID1 = ref_players[0]['gameID'] <NEW_LINE> gameID2 = ref_players[2]['gameID'] <N...
Test players.delistPlayer
625941cf96565a6dacc8f818
def setup(self, node: rclpy.node.Node): <NEW_LINE> <INDENT> self.node = node <NEW_LINE> for service_name, service_type in [ ("get_variables", py_trees_srvs.GetBlackboardVariables), ("open", py_trees_srvs.OpenBlackboardStream), ("close", py_trees_srvs.CloseBlackboardStream) ]: <NEW_LINE> <INDENT> self.services[service_n...
This is where the ros initialisation of publishers and services happens. It is kept outside of the constructor for the same reasons that the familiar py_trees :meth:`~py_trees.trees.BehaviourTree.setup` method has - to enable construction of behaviours and trees offline (away from their execution environment) so that d...
625941cf2c8b7c6e89b3590d
def store_token(self, match): <NEW_LINE> <INDENT> current_token_idx = len(self.tokens) <NEW_LINE> self.tokens.append(match.group(1)) <NEW_LINE> self.tokens_by_type[self.current_pattern_name].append(current_token_idx) <NEW_LINE> replacement_text = ''.join([self.placeholder_prefix, self.current_pattern_name, str(current_...
Replace the matched token with an appropriate mask and store it for later retrieval.
625941cfc4546d3d9de72b81
def get_time_control_ascii_filename(scene, pps_control_path): <NEW_LINE> <INDENT> infiles = get_time_control_ascii_filename_candidates(scene, pps_control_path) <NEW_LINE> LOG.info("Time control ascii file candidates: " + str(infiles)) <NEW_LINE> if len(infiles) == 0: <NEW_LINE> <INDENT> raise FindTimeControlFileError("...
From the scene object and a file path get the time-control-ascii-filename (with path).
625941cfad47b63b2c50a0cc
def set_assists(info, p1=None, p2=None): <NEW_LINE> <INDENT> assists = get_assists(info) <NEW_LINE> if len(assists) == 0: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif len(assists) == 1: <NEW_LINE> <INDENT> if len(info[0]) == 5: <NEW_LINE> <INDENT> info[11].replace(assists[0], p1) <NEW_LINE> <DEDENT> return info[10...
Changes assisting players of info
625941cff7d966606f6aa151
def bridgesPerResponse(hashring): <NEW_LINE> <INDENT> pass
Get the current number of bridges to return in a response.
625941cf16aa5153ce3625c5
def write(self, *a, **kw): <NEW_LINE> <INDENT> self.response.out.write(*a, **kw)
write: Write response Args: *a: **kw:
625941cfd10714528d5ffe31
def model_offers_stat(self, model_id, geo_id=None, remote_ip=None): <NEW_LINE> <INDENT> params = {} <NEW_LINE> if geo_id is None and remote_ip is None: <NEW_LINE> <INDENT> raise NoGeoIdOrIP( "You must provide either geo_id or remote_ip") <NEW_LINE> <DEDENT> if geo_id: <NEW_LINE> <INDENT> params['geo_id'] = geo_id <NEW_...
Количество товарных предложений на модель по регионам :param model_id: Идентификатор модели :type model_id: int or str :param geo_id: Идентификатор региона :type geo_id: int or str :param remote_ip: IP-адрес пользователя :type remote_ip: str :raises NoGeoIdOrIP: не передан обязательный параметр geo_id или remote_ip ...
625941cf44b2445a339321e2
def connect_transport(protocol, factory=None): <NEW_LINE> <INDENT> if factory is None: <NEW_LINE> <INDENT> factory = ClientFactory() <NEW_LINE> <DEDENT> transport = StringTransportWithDisconnection() <NEW_LINE> protocol.makeConnection(transport) <NEW_LINE> transport.protocol = protocol <NEW_LINE> protocol.factory = fac...
Connect a StringTransport to a client protocol.
625941cf99cbb53fe6792d33
def apply_cmvn_sliding(feat, center=False, window=600, min_window=100, norm_vars=False): <NEW_LINE> <INDENT> feat = apply_cmvn_sliding_internal( feat=feat.astype(np.float64), center=center, window=window, min_window=min_window, norm_vars=norm_vars ).astype(feat.dtype) <NEW_LINE> return feat
Apply sliding-window cepstral mean (and optionally variance) normalization :param feat: Cepstrum. :param center: If true, use a window centered on the current frame (to the extent possible, modulo end effects). If false, window is to the left. (bool, default = false) :param window: Window in frames for running average...
625941cfa8370b77170529ec
def find_path(self, init_pos, time_limit=5 * 60): <NEW_LINE> <INDENT> self.reset() <NEW_LINE> if time_limit > 0: <NEW_LINE> <INDENT> self.end_time = timer.time() + time_limit <NEW_LINE> for planner in self.sub_search.itervalues(): <NEW_LINE> <INDENT> if hasattr(planner, 'end_time'): <NEW_LINE> <INDENT> planner.end_time...
Finds a path from init_pos to the goal specified when self was instantiated. init_pos - ((x1, y1), (x2, y2), ...) coordinates of initial position time_limit - time allocated to find a solution. Will raise an exception if a path cannot be found within this time period
625941cf21a7993f00bc7e3d
def _ingest_config_from_file(self): <NEW_LINE> <INDENT> config = configparser.ConfigParser() <NEW_LINE> for filename in self.__class__.CONFIG_FILE_LOCATIONS: <NEW_LINE> <INDENT> if os.path.isfile(filename): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> config.read(filename) <NEW_LINE> break <NEW_LINE> <DEDENT> except (c...
pull in config variables from a system file
625941cf85dfad0860c3afa8
@app.route("/wfreq/<sample>") <NEW_LINE> def sample_wfreq(sample): <NEW_LINE> <INDENT> sel = [ Samples_Metadata.sample, Samples_Metadata.ETHNICITY, Samples_Metadata.GENDER, Samples_Metadata.AGE, Samples_Metadata.LOCATION, Samples_Metadata.BBTYPE, Samples_Metadata.WFREQ, ] <NEW_LINE> results = db.session.query(*sel).fil...
Return the MetaData for a given sample.
625941cfbf627c535bc1331c
def multibox_layer(end_points,size = (300,300)): <NEW_LINE> <INDENT> multibox_params = mp.get_multibox_parameters(size) <NEW_LINE> classifications = [] <NEW_LINE> logits = [] <NEW_LINE> localizations = [] <NEW_LINE> for i, layer in enumerate(multibox_params.feat_layers): <NEW_LINE> <INDENT> with tf.variable_scope(layer...
Generate several branches from the net trunk, each branch has a multibox head which can transform feature layer into localizations and classification layer. :param end_points: the collections from the main stream network :param size: the mark of this type of ssd :return: localizations and classification from each bran...
625941cf0a50d4780f666fe0
def GetPointer(self): <NEW_LINE> <INDENT> return _itkIntensityWindowingImageFilterPython.itkIntensityWindowingImageFilterIUL3IUS3_Superclass_GetPointer(self)
GetPointer(self) -> itkIntensityWindowingImageFilterIUL3IUS3_Superclass
625941cf60cbc95b062c6690
def configure_options(self): <NEW_LINE> <INDENT> super(MROutputExoduswithSVD, self).configure_options() <NEW_LINE> self.add_passthrough_option( '--variable', dest='variable', help='--variable VAR, the variable need to be inserted in the exodus file' ) <NEW_LINE> self.add_passthrough_option( '--outputname', dest='output...
Add command-line options specific to this script.
625941cfbe7bc26dc91cd74c
def calculate_mutual_information(X, u, v): <NEW_LINE> <INDENT> if u > v: <NEW_LINE> <INDENT> u, v = v, u <NEW_LINE> <DEDENT> marginal_u = marginal_distribution(X, u) <NEW_LINE> marginal_v = marginal_distribution(X, v) <NEW_LINE> marginal_uv = marginal_pair_distribution(X, u, v) <NEW_LINE> I = 0. <NEW_LINE> for x_u, p_x...
X are the data points. u and v are the indices of the features to calculate the mutual information for.
625941cf24f1403a92600cb2
def createClusterDict_old(proteinList): <NEW_LINE> <INDENT> from operator import attrgetter <NEW_LINE> cluster = '' <NEW_LINE> clusterDict = {} <NEW_LINE> proteinCluster = [] <NEW_LINE> for aProtein in sorted(proteinList, key=attrgetter('cluster', 'pKd', 'ECnum'), reverse = True): <NEW_LINE> <INDENT> if aProtein.cluste...
create a dict of cluster, with each entry is the protein IDs of this cluster
625941cf460517430c3942d1
def healpix_to_image(healpix_data, coord_system_in, wcs_out, shape_out, order='bilinear', nested=False): <NEW_LINE> <INDENT> healpix_data = np.asarray(healpix_data, dtype=float) <NEW_LINE> yinds, xinds = np.indices(shape_out) <NEW_LINE> lon_out, lat_out = wcs_out.wcs_pix2world(xinds, yinds, 0) <NEW_LINE> coord_system_i...
Convert image in HEALPIX format to a normal FITS projection image (e.g. CAR or AIT). Parameters ---------- healpix_data : `numpy.ndarray` HEALPIX data array coord_system_in : str or `~astropy.coordinates.BaseCoordinateFrame` The coordinate system for the input HEALPIX data, as an Astropy coordinate frame o...
625941cf7b25080760e395a6
def network_values_for(field): <NEW_LINE> <INDENT> return [_format_value(field, nv[field]) for nv in NETWORK_DEFINITIONS.values()]
Return all prefixes for field, i.e.: prefix_wif, prefix_address_p2sh, etc >>> network_values_for('prefix_wif') [b'\x99', b'\x80', b'\xef', b'\xb0', b'\xb0', b'\xef', b'\xcc', b'\xef', b'\x9e', b'\xf1'] >>> network_values_for('prefix_address_p2sh') [b'\x95', b'\x05', b'\xc4', b'2', b'\x05', b':', b'\x10', b'\x13', b'\x...
625941cf73bcbd0ca4b2c1c3
def read_cfg(f): <NEW_LINE> <INDENT> if isinstance(f, str): <NEW_LINE> <INDENT> f = open(f) <NEW_LINE> <DEDENT> nat = read_int_key(f, 'Number of particles') <NEW_LINE> unit = read_float_key(f, 'A') <NEW_LINE> cell = np.zeros( [ 3, 3 ] ) <NEW_LINE> for i in range(3): <NEW_LINE> <INDENT> for j in range(3): <NEW_LINE...
Read atomic configuration from a CFG-file (native AtomEye format). See: http://mt.seas.upenn.edu/Archive/Graphics/A/
625941cfeab8aa0e5d26dca5
def __init__(self, qty, price_per_share, action, strategy, order, avg_price_per_share, commission=0.0, trade_date=None, ticker=None): <NEW_LINE> <INDENT> if trade_date: <NEW_LINE> <INDENT> self.trade_date = dt_utils.parse_date(trade_date) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.trade_date = pd.Timestamp(date...
:param datetime trade_date: corresponding to the date and time of the trade date :param int qty: number of shares traded :param float price_per_share: price per individual share in the trade or the average share price in the trade :param Asset ticker: a :py:class:`~.ticker.Asset`, the ``ticker`` object t...
625941cf97e22403b379d0e7
def assignF(self, *args): <NEW_LINE> <INDENT> return _pyUni10.Qnum_assignF(self, *args)
assignF(Qnum self, uni10::parityFType _prtF, int _U1=0, uni10::parityType _prt=PRT_EVEN) -> Qnum assignF(Qnum self, uni10::parityFType _prtF, int _U1=0) -> Qnum assignF(Qnum self, uni10::parityFType _prtF) -> Qnum
625941cfd164cc6175782e9b
def ensure_default_setup(self): <NEW_LINE> <INDENT> p=Path(self._config_dir) <NEW_LINE> if not(p.exists()): <NEW_LINE> <INDENT> p.mkdir(parents=True) <NEW_LINE> <DEDENT> if not Path(self.config_file).exists(): <NEW_LINE> <INDENT> self.LOGGER.info("Creating default configuration file.") <NEW_LINE> self.create_config_fil...
Make sure that all the required files and directories exist, creating them if not. Breakdown of what will be done here: * Check that the main configuration directory for the application exists; if not, create it. * Likewise, check that the main configuration file exists within that dir, and create...
625941cf24f1403a92600cb3
def set_fence_mode(self, on): <NEW_LINE> <INDENT> return self._arm.set_fense_mode(on)
Set the fence mode,turn on/off fense mode Note: 1. This interface relies on Firmware 1.2.11 or above :param on: True/False :return: code code: See the API code documentation for details.
625941cf63d6d428bbe4463c
def test_unknown_provider_in_url_scheme(providerstore: ProviderStore, url: URL) -> None: <NEW_LINE> <INDENT> packagepath = Path(filesystem=DictFilesystem({})) <NEW_LINE> package = Package("example", packagepath) <NEW_LINE> factories = [ConstProviderFactory(constprovider("default", package))] <NEW_LINE> registry = Provi...
It invokes providers with the original scheme.
625941cfa17c0f6771cbe19d
def extract_single_data_type(reader_list, feature='Symbol'): <NEW_LINE> <INDENT> d = [] <NEW_LINE> for row in reader_list: <NEW_LINE> <INDENT> x = row[feature] <NEW_LINE> if feature == 'Symbol': <NEW_LINE> <INDENT> xm = x.replace(" ", "") <NEW_LINE> d.append(xm) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pass <NEW_L...
Read in dict and return a single data type (feature) from the list of dicts.
625941cf956e5f7376d70fba
def svm_sci(): <NEW_LINE> <INDENT> corpus, y = load_data() <NEW_LINE> vectorizer = TfidfVectorizer(corpus, max_features=4000) <NEW_LINE> X = vectorizer.fit_transform(corpus).toarray() <NEW_LINE> X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) <NEW_LINE> svm = SVC(gamma="scale") <NEW_LINE> svm.f...
通过 scikit-learn 库的 svm 工具进行分析 :return:
625941cf7d43ff24873a2ded
def pca_show(labels, embedding, uid_file): <NEW_LINE> <INDENT> import matplotlib.pyplot as plt <NEW_LINE> from sklearn.decomposition import PCA <NEW_LINE> from collections import Counter <NEW_LINE> uids=[line.strip() for line in open(uid_file)] <NEW_LINE> X = numpy.array(map(lambda uid: embedding[uid], uids)) <NEW_LINE...
simple_evaluate function uses default params without any params tuning
625941cf3539df3088e2e498
def setup_apns_client(use_sandbox): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> apns_key = environment_vars.APNS_PROD_KEY_CONTENT <NEW_LINE> f = open('./apns_key.pem', 'w') <NEW_LINE> f.write(apns_key) <NEW_LINE> f.close() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> os.remove('./apns_key.pem') <NEW_...
Configura um cliente do servico apns2. Para mais informacoes, olhar a documentacao e o codigo dessa biblioteca. :param use_sandbox: :return: um objeto do tipo APNsClient para enviar push notifications.
625941cf287bf620b61d3bb1
def processCell(self,cell,cells): <NEW_LINE> <INDENT> pass
Abstract method: default does nothing
625941cf5f7d997b87174be5
def update(self): <NEW_LINE> <INDENT> for virus in list(self.getViruses()): <NEW_LINE> <INDENT> if virus.doesClear(): <NEW_LINE> <INDENT> self.viruses.remove(virus) <NEW_LINE> <DEDENT> <DEDENT> pop_density = float(self.getTotalPop()) / self.maxPop <NEW_LINE> for virus in list(self.getViruses()): <NEW_LINE> <INDENT> try...
Update the state of the virus population in this patient for a single time step. update() should execute these actions in order: - Determine whether each virus particle survives and update the list of virus particles accordingly - The current population density is calculated. This population density value is used...
625941cf1f037a2d8b94634b
def efficientnet(width_coefficient=None, depth_coefficient=None, dropout_rate=0.2, drop_connect_rate=0.2): <NEW_LINE> <INDENT> blocks_args = [ 'r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25', 'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25', 'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o1...
Creates a efficientnet model.
625941cf21a7993f00bc7e3e
def action(self, req, id, body): <NEW_LINE> <INDENT> ctxt = req.environ['nova.context'] <NEW_LINE> common.instance_exists(ctxt, id, self.compute_api) <NEW_LINE> _actions = { 'restart': self._action_restart, 'resize': self._action_resize } <NEW_LINE> for key in body: <NEW_LINE> <INDENT> if key in _actions: <NEW_LINE> <I...
Multi-purpose method used to take actions on an instance.
625941cf50485f2cf553cee8
def _decode(self, item): <NEW_LINE> <INDENT> return item
Decodes an item.
625941cf3c8af77a43ae38ee
@xl.register() <NEW_LINE> @xl.validate_args <NEW_LINE> def INT( number: func_xltypes.XlNumber ) -> func_xltypes.XlNumber: <NEW_LINE> <INDENT> if number < 0: <NEW_LINE> <INDENT> return _round(number, 0, _rounding=decimal.ROUND_UP) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return _round(number, 0, _rounding=decimal.R...
Rounds a number down to the nearest integer. https://support.office.com/en-us/article/ int-function-a6c4af9e-356d-4369-ab6a-cb1fd9d343ef
625941cf91f36d47f21ac641
def get_profiles(ids, VK_TOKEN=None): <NEW_LINE> <INDENT> if __param_cheker_vk_token(VK_TOKEN): <NEW_LINE> <INDENT> if VK_TOKEN is None: <NEW_LINE> <INDENT> VK_TOKEN = __ask_credentials() <NEW_LINE> <DEDENT> <DEDENT> ids_str = ', '.join([str(i) for i in ids]) <NEW_LINE> url_post = f'https://api.vk.com/method/users.get?...
Получаем расширенную информацию с профилей VK * ids: список id профилей, не более 100 за раз * return: сообщение об успешном выполнении
625941cf8c3a873295158508
def process_historical_ntdb(self, vendor_lod_items): <NEW_LINE> <INDENT> rev_1_1 = self[vendor_lod_items.cvs_branch.source_id] <NEW_LINE> rev_1_2_id = rev_1_1.next_id <NEW_LINE> if rev_1_2_id is None: <NEW_LINE> <INDENT> rev_1_2_timestamp = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rev_1_2_timestamp = self[rev...
There appears to have been a non-trunk default branch in the past. There is currently no default branch, but the branch described by file appears to have been imported. So our educated guess is that all revisions on the '1.1.1' branch (described by VENDOR_LOD_ITEMS) with timestamps prior to the timestamp of '1.2' wer...
625941cf498bea3a759b9bfc
def fib_list(n): <NEW_LINE> <INDENT> fib_list = [] <NEW_LINE> n1 = 0 <NEW_LINE> n2 = 1 <NEW_LINE> while n > 0: <NEW_LINE> <INDENT> fib_list.append(n1) <NEW_LINE> n1, n2 = n2, n1+n2 <NEW_LINE> n = n-1 <NEW_LINE> <DEDENT> return fib_list
Generate the first n fibonacci numbers, return the full list.
625941cf0a366e3fb873e968
def test_video_end_time_with_default_start_time(self): <NEW_LINE> <INDENT> data = {'end_time': '00:00:02'} <NEW_LINE> self.metadata = self.metadata_for_mode('youtube', additional_data=data) <NEW_LINE> self.navigate_to_video() <NEW_LINE> self.video.click_player_button('play') <NEW_LINE> self.video.wait_for_state('pause'...
Scenario: End time works for Youtube video if starts playing from beginning. Given we have a video in "Youtube" mode with end time set to 00:00:02 And I click video button "play" And I wait until video stop playing Then I see video slider at "0:02" position
625941cf3617ad0b5ed68045
def clean_vertex(adj, vertex): <NEW_LINE> <INDENT> for i in adj.values(): <NEW_LINE> <INDENT> if vertex in i: <NEW_LINE> <INDENT> i.remove(vertex)
Remove `vertex` from the neighbour nodes of every node in `adj` Given an adjacency list, it will remove an specific vertex from every list of neighbour vertexes in the adjacency list.
625941cf7cff6e4e81117ad3
def errorValidGraph(self, localRes, outputWitness): <NEW_LINE> <INDENT> validity = LogicalOr( LogicalAnd( Test(localRes, specifier=Test.IsNaN, precision=ML_Bool), Test(outputWitness, specifier=Test.IsNaN, precision=ML_Bool), precision=ML_Bool), LogicalNot(LogicalOr( Test(localRes, specifier=Test.IsNaN, precision=ML_Boo...
generation an operation graph to evaluate the validity of evaluation error expression
625941cfad47b63b2c50a0cd
def tocsr(self, copy=False): <NEW_LINE> <INDENT> return self.tocoo(copy=copy).tocsr(copy=False)
Convert this matrix to Compressed Sparse Row format. With copy=False, the data/indices may be shared between this matrix and the resultant csr_matrix.
625941cf9b70327d1c4e0f23
@register.filter <NEW_LINE> def gravatar(email, size="75"): <NEW_LINE> <INDENT> gravatar_url = "//www.gravatar.com/avatar/" + hashlib.md5(email.encode('utf-8')).hexdigest() + "?" <NEW_LINE> gravatar_url += urlencode({'d': 'retro', 's': str(size)}) <NEW_LINE> return gravatar_url
{% load gravatar_tags %} {{ request.user.email|gravatar:"75" }}
625941cfe64d504609d7498d
def check_callable(x: object) -> ResultComparison: <NEW_LINE> <INDENT> return compare_results(callable, x)
post: _
625941cfde87d2750b85fee1
def encrypt_message(self, message): <NEW_LINE> <INDENT> key = self.load_key() <NEW_LINE> encoded_message = message.encode() <NEW_LINE> f = Fernet(key) <NEW_LINE> encrypted_message = f.encrypt(encoded_message) <NEW_LINE> print(encrypted_message) <NEW_LINE> return encrypted_message
Encrypts a message
625941cf0fa83653e4657108
def doDoc_GetDocMeta(self,docUri): <NEW_LINE> <INDENT> params = {} <NEW_LINE> params['context'] = self.context <NEW_LINE> params['docUri'] = self.fixTypes(docUri) <NEW_LINE> ret= self.runMultipart("/doc", "GETDOCMETA", params) <NEW_LINE> return ret['response']
Retrieves only the meta data associated with a document, including version and user information. If the storage does notsupport metadata, this method returns a dummy object.
625941cfdd821e528d63b2f6
def test_generate_frames_all_servers_discovered(self): <NEW_LINE> <INDENT> pass
Test generate_frames() on a list of events that defines each server with a status by the end (so when the final frame is generated, no servers should be UNDISCOVERED)
625941cfcad5886f8bd27127
def _center_text(text): <NEW_LINE> <INDENT> spacing_left = (TextDocument.MAX_LINE_LEN - len(text)) // 2 <NEW_LINE> spacing_right = TextDocument.MAX_LINE_LEN - len(text) - spacing_left <NEW_LINE> centre_text = ' ' * spacing_left + text + ' ' * spacing_right <NEW_LINE> return centre_text
Centres text on the page.
625941cf21bff66bcd684aa0
def get_ipaddr(self): <NEW_LINE> <INDENT> if (len(self.loopbacks)): <NEW_LINE> <INDENT> for lo in self.loopbacks: <NEW_LINE> <INDENT> ips = lo.ips <NEW_LINE> if (len(ips)): <NEW_LINE> <INDENT> if ips[0].startswith('127.0.0.1'): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> ips.sort() <NEW_LINE> return util.strip_sla...
Return the best IP address for this device. Returns the first matching IP: - Lowest Loopback interface - Lowest SVI address/known IP
625941cf26238365f5f0efbc
def start(self): <NEW_LINE> <INDENT> self.create_workers(self._num_workers) <NEW_LINE> self._logger.info('Thread Pool Started with {} workers.'.format(self._num_workers))
创建线程池,开始运行 :return:
625941cf0c0af96317bb8336
def run(self, auto_start=True): <NEW_LINE> <INDENT> if auto_start: <NEW_LINE> <INDENT> for process in self.processes: <NEW_LINE> <INDENT> process.start() <NEW_LINE> <DEDENT> <DEDENT> self.is_running = True <NEW_LINE> while self.is_running: <NEW_LINE> <INDENT> for process in self.processes: <NEW_LINE> <INDENT> if proces...
Run processes at their defined intervals. Args: auto_start: Start all assigned processes (optional).
625941cfb5575c28eb68e14e
def _retrieve(self,seq,i): <NEW_LINE> <INDENT> if i == len(seq): <NEW_LINE> <INDENT> return list(self.null) <NEW_LINE> <DEDENT> dig = seq[i] <NEW_LINE> if "2" <= dig and dig <= "9": <NEW_LINE> <INDENT> index = int(dig) - 2 <NEW_LINE> if self.children[index] is None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> ret...
Recursively traces through to the node representing the ith digit of the sequence, or returns that there is no such path, indicating that no words match. Raises: ValueError: The sequence has an illegal character.
625941cf925a0f43d2549fc5
def set_current_level(self, new_logging_level): <NEW_LINE> <INDENT> if new_logging_level in self.config.logging_levels: <NEW_LINE> <INDENT> self.current_logging_level = new_logging_level <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Changes the current logging level Verify that the new logging level is valid and change the current logging level to the new logging level. Args: new_logging_level (str): the name of the new logging level Returns: bool: whether the operation was successful or not
625941cfd8ef3951e324368b
def __calc_ft(self, theta, coeffs): <NEW_LINE> <INDENT> ft = 0.0 <NEW_LINE> try: <NEW_LINE> <INDENT> for i, c in enumerate(coeffs): <NEW_LINE> <INDENT> ft += c * math.cos(theta * i * math.pi / 180) <NEW_LINE> <DEDENT> return ft <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> raise
所要値の計算 * θ, 係数配列から次式により所要値を計算する。 f(t) = C_0 + C_1 * cos(θ) + C_2 * cos(2θ) + ... + C_N * cos(Nθ) :param float theta: θ :param list coeffs: 係数配列 :return float ft: 所要値
625941cf5e10d32532c5f075
def extended_attributes_to_constructors(extended_attributes): <NEW_LINE> <INDENT> constructor_list = extended_attributes.get('Constructors', []) <NEW_LINE> constructors = [ IdlOperation.constructor_from_arguments_node('Constructor', arguments_node) for arguments_node in constructor_list] <NEW_LINE> custom_constructor_l...
Returns constructors and custom_constructors (lists of IdlOperations). Auxiliary function for IdlInterface.__init__.
625941cf85dfad0860c3afa9
def __iter__(self): <NEW_LINE> <INDENT> def iter_wrapper(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield self.generator.send(self.pop()) <NEW_LINE> <DEDENT> <DEDENT> return iter_wrapper()
Return the iterator for this class
625941cf5fcc89381b1e180d
def freq_str(_str): <NEW_LINE> <INDENT> print(f'Введенная строка: {_str}') <NEW_LINE> while len(_str) != 0: <NEW_LINE> <INDENT> print(f'Символ {_str[0]} используется {_str.count(_str[0])} раз(а)') <NEW_LINE> _str = _str.replace(_str[0],'') <NEW_LINE> print(_str)
Функция для определения частоты использования использования символов в тексте. Пользователь вводит строку, состоящую из любого набора букв/символов. Далее поэлементно пробегаем по каждому символу,и на экране происходит вывод каждого символа и частота его использования в введенной строке.
625941cf566aa707497f46b6
def write_max_min_ca_resi_versions(fname,ref_pdb_fname,non_ca_resis=[160,],overwrite=False): <NEW_LINE> <INDENT> fnames = {'max':'_resi_max'.join(os.path.splitext(fname))+'.bz2', 'min':'_resi_min'.join(os.path.splitext(fname))+'.bz2', 'abs':'_resi_abs'.join(os.path.splitext(fname))+'.bz2', 'ca' :'_resi_ca'.join( os.pat...
fname is the .dat file, a simple matrix file output by ptraj. ref_pdb_fname is used to get atom names and resi names, so that we can properly select the max,min,abs,ca atoms from each resi. overwrite tells us whether or not to overwrite existing files. non_ca_resis is a list of resis that do not contain a...
625941cf046cf37aa974ce95
def delete_block_from_canonical_chain(self, block_hash: Hash32) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> header_to_remove = self.get_block_header_by_hash(block_hash) <NEW_LINE> canonical_block_hash = self.get_canonical_block_hash(header_to_remove.block_number, header_to_remove.chain_address) <NEW_LINE> if ...
warning, this will only delete the block and transactions, it will not set the current head number of the chain.
625941cfe1aae11d1e749e05
def enter(self,key,val): <NEW_LINE> <INDENT> self[key] = val
add key=val to the table
625941cf6e29344779a62760
def reset_stats(self): <NEW_LINE> <INDENT> self.pads_left = self.ai_settings.pads_limit <NEW_LINE> self.score = 0 <NEW_LINE> self.level = 1
Initialize statistics that can change during the game.
625941cf3317a56b86939da5
def log_dot_mv(logM, logb): <NEW_LINE> <INDENT> return special.logsumexp(logM + np.expand_dims(logb, axis=0), axis=1)
通过log向量和log矩阵,计算log(矩阵 点乘 向量)
625941cf5510c4643540f531
def next(comp, min_length, max_length, floor, ceiling, min_slope, max_slope): <NEW_LINE> <INDENT> stopgap("Next uses the old implementation of IntegerListsLex, which does not allow for arbitrary input;" " non-allowed input can return wrong results," " please see the documentation for IntegerListsLex for details.", 1754...
Returns the next integer list after ``comp`` that satisfies the constraints. .. WARNING:: INTERNAL FUNCTION! DO NOT USE DIRECTLY! EXAMPLES:: sage: from sage.combinat.integer_list_old import next sage: IV = sage.combinat.integer_list_old.IntegerListsLex(n=2,length=3,min_slope=0) sage: next([0,1,1], 3,...
625941cfcc40096d61595a9e
def core_names(self): <NEW_LINE> <INDENT> valid_cores = list(self.cores.keys()) <NEW_LINE> if 'test' in valid_cores: <NEW_LINE> <INDENT> valid_cores.remove('test') <NEW_LINE> <DEDENT> return valid_cores
Returns a list of known valid cores in the Solr instance without making a request to Solr - this request excludes cores used for testing.
625941cf442bda511e8be566
def read_data(): <NEW_LINE> <INDENT> f = open(os.path.join(os.path.dirname(sys.argv[0]), r'./badCritiques.txt'), 'r') <NEW_LINE> bad = f.read().split('|') <NEW_LINE> bad = [sentence.replace('\n', '') for sentence in bad] <NEW_LINE> f.close() <NEW_LINE> f = open(os.path.join(os.path.dirname(sys.argv[0]), r'.\goodCritiqu...
reads data files and returns lists of comments and labels
625941cf92d797404e3042d8
def _get_list_item(self, st, li, key): <NEW_LINE> <INDENT> for i, item in enumerate(li): <NEW_LINE> <INDENT> if item[key] == st: <NEW_LINE> <INDENT> return i
returns index
625941cfec188e330fd5a8ec