code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def moex_data(tickers, start_date, end_date, data_form='OHLCV', boardID='TQBR'): <NEW_LINE> <INDENT> dirty_data = web.DataReader(tickers, 'moex', start_date, end_date) <NEW_LINE> dirty_data = dirty_data[dirty_data['BOARDID'] == boardID] <NEW_LINE> if data_form == 'OHLCV': <NEW_LINE> <INDENT> returndata = dirty_data[['O...
Returns a pandas Data Frame with tickers that you input :param tickers: list with selected tickers ['MGNT', 'SBER'] with a datetime index :param start_date: string or datetime object :param end_date: string or datetime object :param boardID: string denoting ASTS trading board :param data_form: form of dataset to be ret...
625941f6498bea3a759ba104
@logger <NEW_LINE> def Click_and_Text(data_set): <NEW_LINE> <INDENT> sModuleInfo = inspect.currentframe().f_code.co_name + " : " + MODULE_NAME <NEW_LINE> global selenium_driver <NEW_LINE> try: <NEW_LINE> <INDENT> data_set_to = [] <NEW_LINE> data_set_to2 = [] <NEW_LINE> for row in data_set: <NEW_LINE> <INDENT> if row[0]...
Click and enter text specially for dropdown box
625941f671ff763f4b549cef
def transcribe_gcs(gcs_uri): <NEW_LINE> <INDENT> from google.cloud import speech <NEW_LINE> from google.cloud.speech import enums <NEW_LINE> from google.cloud.speech import types <NEW_LINE> client = speech.SpeechClient() <NEW_LINE> audio = types.RecognitionAudio(uri=gcs_uri) <NEW_LINE> config = types.RecognitionConfig(...
Asynchronously transcribes the audio file specified by the gcs_uri.
625941f624f1403a926011b8
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, DocumentAssignmentParameters): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
625941f6d58c6744b42582b4
def is_valid_relative_rotation(xy1, r1, xy2, r2, minimum_relative_orientation): <NEW_LINE> <INDENT> rot1 = relative_rotation(xy1, r1, xy2) <NEW_LINE> rot2 = relative_rotation(xy2, r2, xy1) <NEW_LINE> return (rot1 >= minimum_relative_orientation) and (rot2 >= minimum_relative_orientation)
Checks whether the relative_rotation of two positions is above a certain threshold. Arguments: xy1: np.array x, y coordinate of the first individual. r1: float Orientation on the plane of the first individual. xy2: np.array x, y coordinate of the second individual. r2: float ...
625941f6be383301e01b5ad0
def impulse_response(self, impulse_length=30): <NEW_LINE> <INDENT> sys = self.num, self.den, 1 <NEW_LINE> times, psi = dimpulse(sys, n=impulse_length) <NEW_LINE> psi = psi[0].flatten() <NEW_LINE> return psi
Get the impulse response corresponding to our model. Returns psi, where psi[j] is the response at lag j. Note: psi[0] is unity.
625941f6956e5f7376d714c2
def train(self, num_steps, init_logger_kwargs=None): <NEW_LINE> <INDENT> if init_logger_kwargs is None: <NEW_LINE> <INDENT> init_logger_kwargs = {} <NEW_LINE> <DEDENT> self.logger_kwargs = init_logger_kwargs <NEW_LINE> iterator = trange if self.verbose else range <NEW_LINE> num_vals = num_steps // self.val_interval <NE...
Train the specified model for the given number of steps.
625941f6fff4ab517eb2fa98
def test_mixed_dat_len(self, backend, dats): <NEW_LINE> <INDENT> assert len(op2.MixedDat(dats)) == len(dats)
MixedDat should have length equal to the number of contained Dats.
625941f6adb09d7d5db6cde3
def update(self): <NEW_LINE> <INDENT> if self._changed: <NEW_LINE> <INDENT> return self._tensor <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self
Return the tensor contains in ``self`` if it differs from that used for creating ``self``, otherwise return ``self``.
625941f63d592f4c4ed1d6b3
def test_struct_fields(self): <NEW_LINE> <INDENT> struct_foo = ConstantsTest.module.struct_foo <NEW_LINE> self.assertEqual( struct_foo._fields_, [ ("a", ctypes.c_int), ("b", ctypes.c_char), ("c", ctypes.c_int, 2), ("d", ctypes.c_int, 15), ("unnamed_1", ctypes.c_int, 17), ], )
Test whether fields are built correctly.
625941f65510c4643540fa2b
def get_peers_advertise_type(self): <NEW_LINE> <INDENT> if len(self.config_list) != 2: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> self.config_list = self.config.split('l2vpn-family evpn') <NEW_LINE> get = re.findall( r"peer ([0-9]+.[0-9]+.[0-9]+.[0-9]+)\s?as-number\s?(\S*)", self.config_list[0]) <NEW_LINE> if ...
get evpn peer address advertise type list
625941f610dbd63aa1bd31f9
def has_mirror(self, mirror): <NEW_LINE> <INDENT> if not isinstance(mirror, RepositoryURI): <NEW_LINE> <INDENT> mirror = RepositoryURI(mirror) <NEW_LINE> <DEDENT> return mirror in self.mirrors
Returns a boolean value indicating whether a matching 'mirror' exists for the repository. 'mirror' can be a RepositoryURI object or a URI string.
625941f6090684286d50f348
def _get_agents(self): <NEW_LINE> <INDENT> return self.__agents
Getter method for agents, mapped from YANG variable /proceedings/agents (list) YANG Description: Defines a list containing the Agent(s) needed for a VNF-BD test.
625941f682261d6c526abb01
def test_auto_assign_persistent_cas(self): <NEW_LINE> <INDENT> def m_get_affine_blocks(self, host, ip_version, pool): <NEW_LINE> <INDENT> return [BLOCK_V4_1, BLOCK_V4_2] <NEW_LINE> <DEDENT> block = _test_block_empty_v4() <NEW_LINE> m_resultb = Mock(spec=EtcdResult) <NEW_LINE> m_resultb.value = block.to_json() <NEW_LINE...
Test of auto assign with persistent CAS errors.
625941f60383005118ecfc37
def test_init(self): <NEW_LINE> <INDENT> self.assertDictEqual({}, self.app.users) <NEW_LINE> self.assertFalse(self.app.authenticated) <NEW_LINE> self.assertIsNone(self.app.current_user)
test class initialisation
625941f63eb6a72ae02ecb47
def get_logger(): <NEW_LINE> <INDENT> return logging.getLogger(__name__)
Get the :class:`logging.Logger`. :return: :class:`logging.Logger`
625941f699fddb7c1c9de9e5
def drawRowHeader(self): <NEW_LINE> <INDENT> self.delete('rowheader') <NEW_LINE> x_start=self.x_start <NEW_LINE> y_start=self.y_start <NEW_LINE> h=self.rowheight <NEW_LINE> rowpos=0 <NEW_LINE> for row in self.rowrange: <NEW_LINE> <INDENT> x1,y1,x2,y2 = self.getCellCoords(rowpos,0) <NEW_LINE> self.create_rectangle(0,y1,...
User has clicked to select a cell
625941f630bbd722463cc422
def __init__(self): <NEW_LINE> <INDENT> self.token = YamlConfig(config=APPLICATION_CONFIG_FILE).get("ding")["token"] <NEW_LINE> self.secret = YamlConfig(config=APPLICATION_CONFIG_FILE).get("ding")["secret"] <NEW_LINE> self.timestamp = str(round(time.time() * 1000))
从应用配置文件获取钉钉请求token及签名secret
625941f6c432627299f052a2
def test_tojson01(self) -> None: <NEW_LINE> <INDENT> s = {(1, 2): 'hello'} <NEW_LINE> with pytest.raises(TypeError): <NEW_LINE> <INDENT> qai_helper.tojson(s)
Encoding a dict with a complex key raises a TypeError
625941f68da39b475bd655d4
def test_unknown_applications_and_ports(self): <NEW_LINE> <INDENT> deployer = P2PManifestationDeployer( u'example.com', self.volume_service, node_uuid=self.node_uuid) <NEW_LINE> self.assertEqual( self.successResultOf(deployer.discover_state( self.EMPTY_NODESTATE)), [NodeState(hostname=deployer.hostname, uuid=deployer.n...
Applications and ports are left as ``None`` in discovery results.
625941f6c432627299f052a3
def _multiple_callbacks(callbacks, *args, **kwargs): <NEW_LINE> <INDENT> if isinstance(callbacks, list): <NEW_LINE> <INDENT> for cb in callbacks: <NEW_LINE> <INDENT> cb(*args, **kwargs) <NEW_LINE> <DEDENT> return <NEW_LINE> <DEDENT> if callbacks: <NEW_LINE> <INDENT> callbacks(*args, **kwargs)
Sends args and kwargs to any configured callbacks. This handles the cases where the 'callbacks' variable is ``None``, a single function, or a list.
625941f697e22403b379d5f4
def save_archived_week_index(self, index): <NEW_LINE> <INDENT> self.raw_data['archived_week_index'] = index
Stores the archived week index into the raw_data dict. :param int index: Archived week index to store
625941f667a9b606de4a850d
def Bvec(x, c, s, sgn=1): <NEW_LINE> <INDENT> s = np.asarray(s) <NEW_LINE> c = np.asarray(c) <NEW_LINE> n = np.arange(1, len(s) + 1).reshape(s.shape) <NEW_LINE> return Afunc(n, x, s, -c, sgn=sgn)
Vector expression of B
625941f607f4c71912b11add
def __init__(self, game, screen): <NEW_LINE> <INDENT> widget.__init__(self, game, screen) <NEW_LINE> self.name = "w_Calendar" <NEW_LINE> self.x = self.coo_right(400) <NEW_LINE> self.y = 180 <NEW_LINE> self.cal_url = "https://leCortho:ivrycestjoli@owncloud.2ohm.fr/remote.php/caldav/" <NEW_LINE> self.cal_client = caldav....
Initialize the widget.
625941f6e76e3b2f99f3ae58
def get_centers_from_bins(bins): <NEW_LINE> <INDENT> return 0.5 * (bins[:-1] + bins[1:])
return centers from bin sequence
625941f68c3a873295158a1b
def test_seq(self): <NEW_LINE> <INDENT> self.assertEqual('ATCAGT', str(self.hsp.hit.seq)) <NEW_LINE> self.assertEqual('AT-ACT', str(self.hsp.query.seq))
Test HSP sequence properties
625941f65166f23b2e1a57b1
def plot_precision_recall_curve(eval_dicts): <NEW_LINE> <INDENT> max_distance_ranges = np.max([len([key for key in eval_dict.keys() if not isinstance(key, str)][::-1]) for eval_dict in eval_dicts]) <NEW_LINE> fig, axs = plt.subplots(1, max_distance_ranges) <NEW_LINE> for ax in axs: <NEW_LINE> <INDENT> ax.set_xlabel('Re...
Plot precision recall curve using all available metrics stored in the evaluation dictionaries. :param eval_dicts: evaluation dictionary
625941f62ae34c7f2600d788
def get(self, slug): <NEW_LINE> <INDENT> return self.snapshots_obj.get(slug)
Return snapshot object.
625941f6d268445f265b54c7
def decode_stringcounted(self, cwd, addr): <NEW_LINE> <INDENT> return self._decode_string(cwd, addr + 1, self.snapshot[addr])
Decode a counted string (first byte of string is length).
625941f6e8904600ed9f2590
def query_and_own(self, request): <NEW_LINE> <INDENT> self.send_query_and_own(request) <NEW_LINE> return self.recv_query_and_own()
Parameters: - request
625941f68e05c05ec3eea9d2
def register_routes(app): <NEW_LINE> <INDENT> app.register_blueprint(index_routes) <NEW_LINE> app.register_blueprint(topic_routes, url_prefix='/topic') <NEW_LINE> app.register_blueprint(reply_routes, url_prefix='/reply') <NEW_LINE> app.register_blueprint(user_routes, url_prefix='/profile') <NEW_LINE> app.register_bluep...
在 flask 中,模块化路由的功能由 蓝图(Blueprints)提供 蓝图可以拥有自己的静态资源路径、模板路径(现在还没涉及) 用法如下
625941f6236d856c2ad44e3c
def flatten_k(a, k): <NEW_LINE> <INDENT> if not isinstance(a,list): <NEW_LINE> <INDENT> return lambda: k([a]) <NEW_LINE> <DEDENT> if len(a)==0: <NEW_LINE> <INDENT> return lambda: k([]) <NEW_LINE> <DEDENT> def k1(v1): <NEW_LINE> <INDENT> def k2(v2): <NEW_LINE> <INDENT> return lambda: k(v1 + v2) <NEW_LINE> <DEDENT> retur...
CPS/trampolined version of the flatten function. The original function, before the CPS transform, looked like this: def flatten(a): if not isinstance(a,(tuple,list)): return [a] if len(a)==0: return [] return flatten(a[0])+flatten(a[1:]) The following code is not meant for human consumption.
625941f6fbf16365ca6f682a
def idle_time(self) -> datetime.datetime: <NEW_LINE> <INDENT> return LazydogEvent.datetime_difference_from_now(self.latest_reworked_date)
Returns time difference between last time this event has been updated and now. .. note:: Event updates occur when the event is aggregated to another related event, or also when the event is transformed into a copied or a moved one...
625941f6d99f1b3c44c67bda
def read_delimited_as_dict( path: PathLike, sep: str = '\t', header: Union[bool, Sequence[str]] = False, key: Union[int, RowFunc] = 0, **kwargs) -> Dict[Any, Any]: <NEW_LINE> <INDENT> itr = None <NEW_LINE> if isinstance(key, str): <NEW_LINE> <INDENT> if not header: <NEW_LINE> <INDENT> raise ValueError( "'header' must b...
Parse rows in a delimited file and add rows to a dict based on a a specified key index or function. Args: path: Path to the file, or a file-like object. sep: Field delimiter. header: If True, read the header from the first line of the file, otherwise a list of column names. key: The column to u...
625941f69c8ee82313fbbdcf
def _wait_for_job_complete(self, conn, job): <NEW_LINE> <INDENT> self.retries = 0 <NEW_LINE> self.wait_for_job_called = False <NEW_LINE> def _wait_for_job_complete(): <NEW_LINE> <INDENT> if self._is_job_finished(conn, job): <NEW_LINE> <INDENT> raise loopingcall.LoopingCallDone() <NEW_LINE> <DEDENT> if self.retries > CO...
Given the job wait for it to complete.
625941f6a05bb46b383ece73
def keyPressEvent( self, event ): <NEW_LINE> <INDENT> if ( self.scrollWidget().isHidden() ): <NEW_LINE> <INDENT> if ( event.key() == Qt.Key_Escape ): <NEW_LINE> <INDENT> self.cancelEdit() <NEW_LINE> return <NEW_LINE> <DEDENT> elif ( event.key() in (Qt.Key_Return, Qt.Key_Enter) ): <NEW_LINE> <INDENT> self.acceptEdit() <...
Overloads the key press event to listen for escape calls to cancel the parts editing. :param event | <QKeyPressEvent>
625941f6dd821e528d63b7fb
def __init__(self, mat): <NEW_LINE> <INDENT> self.mat = mat <NEW_LINE> rows = [[] for i in range(9)] <NEW_LINE> cols = [[] for i in range(9)] <NEW_LINE> subs = [[] for i in range(9)] <NEW_LINE> for row_i in range(9): <NEW_LINE> <INDENT> for col_i in range(9): <NEW_LINE> <INDENT> v = self.mat[row_i][col_i] <NEW_LINE> un...
Create a new Sudoku instance. mat -- 9x9 array of digits 1-9 or None if no value is known for that spot
625941f6b57a9660fec33ee5
def keys(self): <NEW_LINE> <INDENT> return self._parsed('user/keys')
Get the public keys for a user.
625941f699cbb53fe679323c
def streaming_pearson_correlation(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None): <NEW_LINE> <INDENT> with variable_scope.variable_scope(name, 'pearson_r', [predictions, labels]): <NEW_LINE> <INDENT> predictions, labels = tensor_util.remove_squeezable_dimensions( predi...
Computes pearson correlation coefficient between `predictions`, `labels`. The `streaming_pearson_correlation` function delegates to `streaming_covariance` the tracking of three [co]variances: - streaming_covariance(predictions, labels), i.e. covariance - streaming_covariance(predictions, predictions), i.e. variance - ...
625941f69c8ee82313fbbdd0
def set_password(self, password): <NEW_LINE> <INDENT> self.password_hash = generate_password_hash(password)
Set password to a hashed value
625941f6566aa707497f4bb7
def _inky_and_clyde_movement_turns(self) -> None: <NEW_LINE> <INDENT> self._decrement_movement_turns() <NEW_LINE> if self.movement_turns == 0: <NEW_LINE> <INDENT> self.movement_turns = 15 <NEW_LINE> self.last_choice = None
Inky and clyde are the only enemy with movement_turns attribute, because their movement is based off a random choice that last for 15 updates.
625941f6b830903b967e9f5b
def load_tape_drive(self, tape_id, drive=0): <NEW_LINE> <INDENT> status = False <NEW_LINE> self.debug.output('check then load - {}, {}'.format(tape_id, drive)) <NEW_LINE> for attempt in range(3): <NEW_LINE> <INDENT> if self.drives_empty(drive_int=drive): <NEW_LINE> <INDENT> self.debug.output('calling load_tape - ', str...
load a given tape_id into a given drive=drive_int, unload if necessary. :type tape_id: label of tape to load :param tape_id: label of tape to load
625941f66fece00bbac2dd9f
def on_task_input(self, task, config): <NEW_LINE> <INDENT> parsedurl = urlparse(config.get('base_url')) <NEW_LINE> url = '%s://%s:%s%s/api/%s/?cmd=shows' % (parsedurl.scheme, parsedurl.netloc, config.get('port'), parsedurl.path, config.get('api_key')) <NEW_LINE> try: <NEW_LINE> <INDENT> json = task.requests.get(url).js...
This plugin returns ALL of the shows monitored by Sickbeard. This includes both ongoing and ended. Syntax: sickbeard: base_url=<value> port=<value> api_key=<value> Options base_url and api_key are required. Use with input plugin like discover and/or configure_series. Example: download-tv-task: configure_ser...
625941f66e29344779a62c69
def testCSSaveClientRequest(self): <NEW_LINE> <INDENT> pass
Test CSSaveClientRequest
625941f655399d3f05588d11
def Geom_Raster_to_np(geom, raster): <NEW_LINE> <INDENT> pol_srs = geom.GetSpatialReference() <NEW_LINE> ras_srs = raster.GetProjection() <NEW_LINE> target_SR = osr.SpatialReference() <NEW_LINE> target_SR.ImportFromWkt(ras_srs) <NEW_LINE> srs_trans = osr.CoordinateTransformation(pol_srs, target_SR) <NEW_LINE> geom.Tran...
Function that takes a geometry from a polygon shapefile and a rasterfile, and returns both features as 2d-arryas in the size of the geom --> can be later used for masking. Function does a coordinate transformation implicitely! PARAMETERS ----------- geom : geom object (required) geometry of the feature raster: gda...
625941f663f4b57ef000175e
def test_with_empty_outcomeDetail_argument(premis_args): <NEW_LINE> <INDENT> premis_args.pop('outcomeDetail') <NEW_LINE> util.createPREMISEventXML(**premis_args)
Check the function is successful without the outcomeDetail kwarg.
625941f63eb6a72ae02ecb48
def get_view(self, options={}): <NEW_LINE> <INDENT> request = self.request.clone() <NEW_LINE> request.form.update(options) <NEW_LINE> return api.content.get_view( 'case-manager', self.portal.apps['case-manager'], request, )
Get a fresh @@case-manager view adding options to the request
625941f6d18da76e23532b37
def get_parser(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) <NEW_LINE> parser.add_argument( 'shapefile_path', help='Path to a shapefile that contains the region polygons.', ) <NEW_LINE> parser.add_argument( 'output_dir', help='Dire...
Compute the sum of 12 rasterfiles in region given by polygons in a shapefile. The 12 raster files are suffixed by shapefile and compute the "ruimte-indicator". Optionally, a mask shapefile can be provided.
625941f68da39b475bd655d5
def action(self, method): <NEW_LINE> <INDENT> if self.json_data: <NEW_LINE> <INDENT> self.result = req(method, self.api_endpoint, self.api_key, self.json_data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.result = req(method, self.api_endpoint, self.api_key) <NEW_LINE> <DEDENT> return self.result
Call Zammad rest api Args: method: What method to use with requests. One of GET, PUT, POST or DELETE Returns: Whatever is returned from the rest_api function. Being data or an error message
625941f6f8510a7c17cf9d5a
def random_key(self): <NEW_LINE> <INDENT> from sage.misc.prandom import randint <NEW_LINE> bin = BinaryStrings() <NEW_LINE> return [bin(str(randint(0, 1))) for i in xrange(self._key_size)]
Return a random 10-bit key. EXAMPLES: The size of each key is the same as the block size:: sage: from sage.crypto.block_cipher.sdes import SimplifiedDES sage: sdes = SimplifiedDES() sage: key = sdes.random_key() sage: len(key) == sdes.block_length() True
625941f67b25080760e39aad
def print_data_block_directory(self): <NEW_LINE> <INDENT> if len(self.dblist) == 0: <NEW_LINE> <INDENT> self.directory(verbose=False) <NEW_LINE> <DEDENT> for s in self.dblist: <NEW_LINE> <INDENT> print(s)
Prints op2 data block directory. See also :func:`directory`.
625941f6091ae356686675ab
def regions(im, threshold=1): <NEW_LINE> <INDENT> regions = [] <NEW_LINE> start = None <NEW_LINE> width, height = im.size <NEW_LINE> for col in range(width): <NEW_LINE> <INDENT> if sum([im.getpixel((col, row)) is not WHITE for row in range(height)]) >= threshold: <NEW_LINE> <INDENT> start = start if start else col <NEW...
Iterates over the columns of an image from left-to-right and composes an ordered list of (start, end) column ranges referring to discrete, contiguous columns which contain at least `threshold` non-white pixel.
625941f62eb69b55b151cf11
def _make_argparse(self, parser, prefix): <NEW_LINE> <INDENT> pass
Add the config entry to an argparse parser
625941f632920d7e50b2882e
def __init__(self): <NEW_LINE> <INDENT> self.children = defaultdict(Trie) <NEW_LINE> self.end = False
Initialize your data structure here.
625941f6091ae356686675ac
def check_url(url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> req = urllib.request.Request(url, headers=headers) <NEW_LINE> response = urllib.request.urlopen(req) <NEW_LINE> return response.code in range(200, 209) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return False
Returns True if the url returns a response code between 200-300, otherwise return False.
625941f626068e7796caf342
def insert(self, row, cols): <NEW_LINE> <INDENT> row = DBRow(row, cols, self.cols, self.types) <NEW_LINE> self.rows.append(row) <NEW_LINE> for i in self.indexes: <NEW_LINE> <INDENT> i.insert(row)
Insert the given row into the table. Arguments: row -- a list of values for the columns, should be converted to a DBRow before adding it to the table cols -- a list of the columns that values have been specified for
625941f6baa26c4b54cb1770
def ping(self, callback=None): <NEW_LINE> <INDENT> _args = ["PING"] <NEW_LINE> self.send_message(_args, callback)
Ping the server
625941f6596a89723608a110
def test_URIMatcher_respects_querystring(): <NEW_LINE> <INDENT> matcher = URIMatcher('http://www.foo.com/?query=true', None) <NEW_LINE> info = URIInfo.from_uri('http://www.foo.com/', None) <NEW_LINE> assert matcher.matches(info) <NEW_LINE> matcher = URIMatcher('http://www.foo.com/?query=true', None, match_querystring=T...
URIMatcher response querystring
625941f64e4d5625662d4a26
def incon_std_series(self, username:str)->pd.Series: <NEW_LINE> <INDENT> nodes = self.nodes() <NEW_LINE> nodesWithKids = [node for node in nodes if node.has_children()] <NEW_LINE> rval = [self.incon_std(username, node.name) for node in nodesWithKids if node.has_children()] <NEW_LINE> rval = pd.Series(data=rval, index=[...
Calculates the inconsistency for all wrt nodes for a user / user group. See AHPTree.incon_std() for details about the actual calculation. :param username: The name/names of the user to calculate the inconsistency for. :return: A pandas.Series whose index is wrt node names, and whose values are the inconsistency of t...
625941f6cdde0d52a9e53692
def getStartUrl(self, startDir, recentDirClass): <NEW_LINE> <INDENT> return KUrl()
static KUrl KFileDialog.getStartUrl(KUrl startDir, QString recentDirClass)
625941f68c0ade5d55d3f019
def configureObservations(self, drifterSet="all", observationInterval=1, buoy_area='all'): <NEW_LINE> <INDENT> if drifterSet != "all": <NEW_LINE> <INDENT> self.observations.setDrifterSet(drifterSet) <NEW_LINE> <DEDENT> self.observations.setObservationInterval(observationInterval) <NEW_LINE> self.driftersPerOceanModel =...
Configuring which drifters we will observe and how often we will observe them. Arguments: drifterSet: can contain the keyword "all" (default), which means that all drifters in the Observation file is considered. Otherwise it should be a set of drifter indices represented by a list. observationInterval:...
625941f676d4e153a657f18b
def _topology_from_subset(topology, atom_indices): <NEW_LINE> <INDENT> newTopology = Topology() <NEW_LINE> old_atom_to_new_atom = {} <NEW_LINE> for chain in topology._chains: <NEW_LINE> <INDENT> newChain = newTopology.add_chain() <NEW_LINE> for residue in chain._residues: <NEW_LINE> <INDENT> resSeq = getattr(residue, '...
Create a new topology that only contains the supplied indices Note ---- This really should be a copy constructor (class method) on Topology, but I want it to work on either the mdtraj topology OR the OpenMM topology. An inplace version for the topology object we have here is also available. Parameters ---------- topo...
625941f69f2886367277aee0
def set_root_path(self, path, hide_extra_columns=True): <NEW_LINE> <INDENT> if os.path.isfile(path): <NEW_LINE> <INDENT> path = os.path.abspath(os.path.join(path, os.pardir)) <NEW_LINE> <DEDENT> self._fs_model_source = QtWidgets.QFileSystemModel() <NEW_LINE> self._fs_model_proxy = self.FilterProxyModel() <NEW_LINE> for...
Sets the root path to watch :param path: root path - str :param hide_extra_columns: Hide extra column (size, paths,...)
625941f6e64d504609d74e98
def isAdditiveNumber(self, num): <NEW_LINE> <INDENT> length = len(num) <NEW_LINE> if length < 3: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if num.startswith("0"): <NEW_LINE> <INDENT> i_range = (1, ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> i_range = range(1, length-1) <NEW_LINE> <DEDENT> for i in i_rang...
:type num: str :rtype: bool
625941f6442bda511e8bea67
def ladderLength(self, beginWord, endWord, wordList): <NEW_LINE> <INDENT> if endWord not in wordList: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> q = deque() <NEW_LINE> q.append([beginWord, endWord]) <NEW_LINE> ladder = 0 <NEW_LINE> while q: <NEW_LINE> <INDENT> if len(wordList) == 0: <NEW_LINE> <INDENT> return 0 <...
:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int
625941f68e7ae83300e4b628
def main(): <NEW_LINE> <INDENT> p = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description="") <NEW_LINE> p.add_argument('--v', dest = 'video_path', action = 'store', default = '', help = 'path file *.oni') <NEW_LINE> args = p.parse_args() <NEW_LINE> populate(args.video_path)
The entry point
625941f6462c4b4f79d1dd28
def get_month_list(cur_ym, count_each=5): <NEW_LINE> <INDENT> year = cur_ym[0] <NEW_LINE> month = cur_ym[1] <NEW_LINE> year = max(min(year, MAXYEAR), MINYEAR) <NEW_LINE> month = max(min(month, 12), 1) <NEW_LINE> mid_ym = (year, month) <NEW_LINE> count_before = (year - MINYEAR) * 12 + month - 1 <NEW_LINE> count_after = ...
cur_ym: (cur_year, cur_month) return: list of (year, month) valid range 2/1 ~ MAXYEAR/12
625941f696565a6dacc8fd22
def sendtosaas(ipx, clnt, evt, evtdata): <NEW_LINE> <INDENT> proc = subprocess.Popen(['/opt/corlina/bin/api/get-eventstamp', '--etype', evt, '--data', evtdata], stdout=subprocess.PIPE, stderr=subprocess.PIPE) <NEW_LINE> eventstamp_json, error = proc.communicate() <NEW_LINE> status_code = proc.wait() <NEW_LINE> if statu...
Sends message to SaaS for trust :param ipx: IP address of IOLM :param clnt: InfluxDB client connection :param evt: event type :param evtdata: event data as JSON list :return: None
625941f63617ad0b5ed6854f
def test_delete_removes_previous_next_ref(self): <NEW_LINE> <INDENT> node = Node("test") <NEW_LINE> node._next = Node("next") <NEW_LINE> node._previous = Node("previous") <NEW_LINE> node.delete() <NEW_LINE> self.assertEqual(node._next, None) <NEW_LINE> self.assertEqual(node._previous, None)
Removes the reference to the previous and next nodes when deleted
625941f682261d6c526abb02
def test_deployment_retrieval(self): <NEW_LINE> <INDENT> return self._namespaced_object_retrieval_by_name_test( deployments(self.model), self.model.v1beta1.Deployment, matches_deployment, )
A specific ``Deployment`` object can be retrieved by name using ``IKubernetesClient.get``.
625941f6eab8aa0e5d26e1b3
def fetch_existing_token_of_user(self, client_id, grant_type, user_id): <NEW_LINE> <INDENT> raise NotImplementedError
Fetches an access token identified by its client id, type of grant and user id. This method must be implemented to make use of unique access tokens. :param client_id: Identifier of the client a token belongs to. :param grant_type: The type of the grant that created the token :param user_id: Identifier of the user a t...
625941f61d351010ab856173
def get_resource_from_cid(cid): <NEW_LINE> <INDENT> return cid.strip(pathsep).split(pathsep)[0]
Get the resource name from the given cid string.
625941f691af0d3eaac9c077
def himmelblau(xy): <NEW_LINE> <INDENT> x = xy[0] <NEW_LINE> y = xy[1] <NEW_LINE> fvalues = (x ** 2 + y - 11) ** 2 + (x + y ** 2 - 7) ** 2 <NEW_LINE> return fvalues
Berechnung der zweidimensionalen Himmelblau-Funktion. Argumente --------- coordvals : float (2-tupel) x- und y-Koordinate (x,y) x und y können 1d numpy-arrays sein Output ------ fvalues : float 1d numpy-array mit den Funktionswerten der Himmelblau-Funktion Info ---- Die Minima dieser Funktion mit 18 Stel...
625941f61b99ca400220b10d
def tearDown(self): <NEW_LINE> <INDENT> super(TestNVMFHostTraffic, self).common_tear_down() <NEW_LINE> self.loopdev.delete()
Post section of testcase
625941f629b78933be1e5cfd
def get_message(self, msg_type, timeout=60): <NEW_LINE> <INDENT> config = None <NEW_LINE> start_time = time.time() <NEW_LINE> while not config and time.time() - start_time < timeout: <NEW_LINE> <INDENT> config = self._request(self.sock, msg_type).get("data", None) <NEW_LINE> <DEDENT> return config
Return the property of msg_type. :param msg_type: The property to request. :param timeout: Waiting time for the request (Default: ''60'') :return the property requested
625941f65510c4643540fa2c
def boolexp(): <NEW_LINE> <INDENT> boolexp_values = TagList('boolexp') <NEW_LINE> on_Enter_boolexp(boolexp_values) <NEW_LINE> boolexp_values.append(orexp()) <NEW_LINE> boolexp_values.append(boolexp_group5()) <NEW_LINE> on_Exit_boolexp(boolexp_values) <NEW_LINE> return boolexp_values
boolexp : orexp boolexp_group5
625941f6d164cc61757833a8
def add_filters(self, filter_mappings): <NEW_LINE> <INDENT> super(FieldMappingsMixin, self).add_filters(filter_mappings) <NEW_LINE> if self.get_field_mappings(): <NEW_LINE> <INDENT> self.set_field_mappings({key: [filter_mappings.get(value[0]), value[1]] for key, value in list(self.get_field_mappings().items())}) <NEW_L...
override add_filters method of config object
625941f6de87d2750b8603f3
def cross_entropy(self, x, y): <NEW_LINE> <INDENT> N = len(y) <NEW_LINE> o, s = self.forward_propagation(x) <NEW_LINE> predicted_output = o[np.arange(len(y)), y] <NEW_LINE> L = np.sum(np.log(predicted_output)) <NEW_LINE> return -1 * L / N
:param x: sentence
625941f666673b3332b926ea
def __init__(self, *coll, inner=None, **kwargs): <NEW_LINE> <INDENT> if inner: <NEW_LINE> <INDENT> self.inner = inner <NEW_LINE> <DEDENT> elif coll: <NEW_LINE> <INDENT> patterns = [self.create_pattern(obj) for obj in coll] <NEW_LINE> prev = patterns[0] <NEW_LINE> for p in patterns[1:]: <NEW_LINE> <INDENT> prev += p <NE...
Instantiated with zero or more arguments. Creates inner pattern, if matches continues with successor.
625941f601c39578d7e75494
def purgeBrE(self, mime, _old): <NEW_LINE> <INDENT> html = mime.html() <NEW_LINE> soup = BeautifulSoup(html, get_parser()) <NEW_LINE> audioSpan = soup.findAll('span', attrs={'class': 'dsl_p'}) <NEW_LINE> if len(audioSpan) > 1 and 'BrE' in audioSpan[1].string: <NEW_LINE> <INDENT> breSpan = audioSpan[1] <NEW_LINE> breSpa...
purge British pronunciation
625941f663f4b57ef000175f
@pytest.fixture <NEW_LINE> def client(): <NEW_LINE> <INDENT> from src.rest_api import app <NEW_LINE> with app.test_client() as client: <NEW_LINE> <INDENT> yield client
Provide the client session used by tests.
625941f624f1403a926011ba
def output_dword(self, range_, data, fmt=''): <NEW_LINE> <INDENT> if fmt != '': <NEW_LINE> <INDENT> d = struct.pack(fmt, data) <NEW_LINE> <DEDENT> elif type(data) in [list, tuple]: <NEW_LINE> <INDENT> if len(data) != 32: <NEW_LINE> <INDENT> msg = 'data length must be 32, not {0}'.format(len(data)) <NEW_LINE> raise Valu...
デジタル出力を4byte(32点)設定します。 (GPG-2000 10. DioOutputDword) Parameters ---------- range_ : str デジタル入力状況を取得する範囲を指定します ボードで使用可能なレンジは available_output_dword_ranges に格納されています。 .. list-table:: :header-rows: 1 * - `range` - 取得するチャンネル * - 'OUT1_32' - OUT1 から OUT32 まで...
625941f601c39578d7e75495
def convert_address_components(address_components): <NEW_LINE> <INDENT> return_dict = {} <NEW_LINE> valid_components = { 'street_number', 'route', 'locality', 'administrative_area_level_1', 'country', 'postal_code', 'premise' } <NEW_LINE> for component in address_components: <NEW_LINE> <INDENT> for type in component['t...
converts address components dictionary from google reverse geocoding results :param address_components: :return:
625941f69b70327d1c4e1432
def test_describe_sketch(self): <NEW_LINE> <INDENT> runner = CliRunner() <NEW_LINE> result = runner.invoke(sketch_group, ['describe'], obj=self.ctx) <NEW_LINE> assert result.output == 'Name: test\nDescription: test\n'
Test to get details for a sketch.
625941f6fff4ab517eb2fa9a
def minMoves2(self, nums): <NEW_LINE> <INDENT> nums.sort() <NEW_LINE> median = nums[len(nums) // 2] <NEW_LINE> res = 0 <NEW_LINE> for x in nums: <NEW_LINE> <INDENT> res += abs(x - median) <NEW_LINE> <DEDENT> return res
:type nums: List[int] :rtype: int
625941f6ff9c53063f47c849
def to_array(self): <NEW_LINE> <INDENT> return np.array(self.to_image())
Convert to numpy array. Returns ------- image : nd-array size (width, height, 3) Word cloud image as numpy matrix.
625941f6a934411ee3751cef
def getInstalledOfferingNames(self): <NEW_LINE> <INDENT> return list( self._siteStore.query(InstalledOffering).getColumn("offeringName"))
Get the I{offeringName} attribute of each L{InstalledOffering} in C{self._siteStore}.
625941f63eb6a72ae02ecb49
def detect_local_anomaly(self, htag_local_distribution) -> bool: <NEW_LINE> <INDENT> current_mean = StatAnalyzer.compute_first_moment(list(htag_local_distribution.values())) <NEW_LINE> current_std = StatAnalyzer.compute_second_moment(list(htag_local_distribution.values())) <NEW_LINE> running_mean, running_std = self._g...
Performs basic anonmaly detection by comapring of the firist moment for a current iteration against the global accumulated statistic Args: htag_local_distribution: histogram of tag specific to the current time frame Returns: True if anomaly is detected
625941f6d18da76e23532b38
def twoSum(self, nums, target): <NEW_LINE> <INDENT> hashMap = collections.defaultdict() <NEW_LINE> for idx,num in enumerate(nums): <NEW_LINE> <INDENT> if target-num in hashMap: return [hashMap.get(target-num),idx] <NEW_LINE> hashMap[num] = idx <NEW_LINE> <DEDENT> return [0,0]
:type nums: List[int] :type target: int :rtype: List[int]
625941f629b78933be1e5cfe
def cut_rod_recursive(p, n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> res = -sys.maxsize <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> res = max(res, p[i] + cut_rod_recursive(p, n-i-1)) <NEW_LINE> <DEDENT> return res
:param p: list of prices :param n: length of rod :example: p = [1 5 8 9 10 17 17 20 24 30] :return: maximum obtained value
625941f61b99ca400220b10e
def make_child_frame(self, formals, vals): <NEW_LINE> <INDENT> child = Frame(self) <NEW_LINE> if len(formals) != len(vals): <NEW_LINE> <INDENT> raise SchemeError <NEW_LINE> <DEDENT> bindings = {} <NEW_LINE> while formals != nil: <NEW_LINE> <INDENT> child.define(formals.first, vals.first) <NEW_LINE> vals = vals.second <...
Return a new local frame whose parent is SELF, in which the symbols in a Scheme list of formal parameters FORMALS are bound to the Scheme values in the Scheme list VALS. Raise an error if too many or too few vals are given. >>> env = create_global_frame() >>> formals, expressions = read_line('(a b c)'), read_line('(1 ...
625941f650812a4eaa59c974
def _ioctl_get_window_size(fd): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return struct.unpack("hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "1234")) <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> return
Calls TIOCGWINSZ for the given fd
625941f6f7d966606f6aa665
def create_user(self, email, name, password=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError('User must have email address') <NEW_LINE> <DEDENT> email = self.normalize_email(email) <NEW_LINE> user = self.model(email=email, name=name) <NEW_LINE> user.set_password(password) <NEW_LINE> user.sa...
Create a new user
625941f6c4546d3d9de73094
def register(self): <NEW_LINE> <INDENT> self.firstStepHash() <NEW_LINE> self.header = {'Authorization': self.basic_token, 'User-Agent': self.UserAgent, 'X-Api-Version': '2'} <NEW_LINE> data = {"deviceId": localIdGenerator(), "deviceName": self.UserAgent, "os": "Ubuntu 16 Server"} <NEW_LINE> result = self._request('regi...
Первичная авторизация на chatApi :return:
625941f6d53ae8145f87a8bc
def __init__(self, c_in, c_out, c_hidden_factor): <NEW_LINE> <INDENT> super(SimpleConvNet, self).__init__() <NEW_LINE> conv = Conv2d <NEW_LINE> c_hidden = c_hidden_factor <NEW_LINE> layers = nn.ModuleList() <NEW_LINE> layers += [conv(c_in, c_hidden, kernel_size=3, padding=1), nn.ReLU(inplace=False)] <NEW_LINE> for laye...
Module that summarizes the previous blocks to a full convolutional neural network. Inputs: c_in - Number of input channels c_hidden - Number of hidden dimensions to use within the network c_out - Number of output channels. If -1, 2 times the input channels are used (affine coupling) num_layers - Number ...
625941f63539df3088e2e9a5
def search_files_list(self, owner="'me' in owners", drive_query=""): <NEW_LINE> <INDENT> files_list = [] <NEW_LINE> try: <NEW_LINE> <INDENT> file_search = "%s and name contains '%s'" % (owner, drive_query) <NEW_LINE> r = json.loads(self.call_google_api(service=self.service, q=file_search, api_resource="files", api_meth...
Searches users drives files :param drive_query: q :param owner: q :return: list of files with name containing the searched term.
625941f6e8904600ed9f2592
def _find_cache(): <NEW_LINE> <INDENT> app = _find_app() <NEW_LINE> return app.cache
The application context will be automatically handled by _find_app method in flask
625941f67d43ff24873a32ff
def _set_config(self, v, load=False): <NEW_LINE> <INDENT> if hasattr(v, "_utype"): <NEW_LINE> <INDENT> v = v._utype(v) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> t = YANGDynClass( v, base=config.config, is_container="container", yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmetho...
Setter method for config, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/levels/level/authentication/config (container) If this variable is read-only (config: false) in the source YANG file, then _set_config is considered as a private method. Backends looking to populate this vari...
625941f630dc7b7665901fb8
def update(self,data, **kwargs): <NEW_LINE> <INDENT> n = {**self.constraints, **kwargs} <NEW_LINE> if "_global" in n: <NEW_LINE> <INDENT> n["global"] = n["_global"] <NEW_LINE> del n["_global"] <NEW_LINE> <DEDENT> return self.session.patch("api/notifications",data, n)
Modifies the notification
625941f6ab23a570cc2507e2
def is_target_temperature_reached(self): <NEW_LINE> <INDENT> if self.target_temp == 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if self.current_temp == 0: <NEW_LINE> <INDENT> self.target_temp = 0 <NEW_LINE> <DEDENT> err = abs(self.current_temp - self.target_temp) <NEW_LINE> reached = err < self.ok_range <NEW...
Returns true if the target temperature is reached
625941f6d99f1b3c44c67bdc