code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def let(self, name, value): <NEW_LINE> <INDENT> self.let_expr.append((name, value)) <NEW_LINE> return self
Add ``LET`` operation .. code:: LET variable-name = expression
625941db5fdd1c0f98dc0500
def write_precessed_data(df): <NEW_LINE> <INDENT> precessed_data_path = os.path.join( os.path.dirname(os.path.realpath(__file__)), os.path.pardir, os.path.pardir, 'data', 'processed' ) <NEW_LINE> write_sample_path = os.path.join(precessed_data_path, 'testing-set.csv') <NEW_LINE> df.to_csv(write_sample_path) <NEW_LINE> ...
In: DataFrame(df), str(file_name), Out: None Description: Write sample data to directory /data/interim
625941db379a373c97cfae12
def set_up_ssl_server_auth(self, event): <NEW_LINE> <INDENT> if self.opts.conn_ssl_trust_store: <NEW_LINE> <INDENT> event.container.ssl.client.set_trusted_ca_db(self.opts.conn_ssl_trust_store) <NEW_LINE> <DEDENT> if self.opts.conn_ssl_verify_peer_name: <NEW_LINE> <INDENT> event.container.ssl.client.set_peer_authenticat...
set-up SSLDomain for the server verification | VERIFY_PEER: Require peer to provide a valid identifying certificate | VERIFY_PEER_NAME: Require valid certificate and matching name :param event: reactor event :type event: proton.Event
625941db097d151d1a223124
def read(self): <NEW_LINE> <INDENT> pass
Implement in subclass
625941db293b9510aa2c355f
def update(self): <NEW_LINE> <INDENT> result = True <NEW_LINE> error = "" <NEW_LINE> if self.user.password != '': <NEW_LINE> <INDENT> self.db.open() <NEW_LINE> result, error = self.db.update('UPDATE users SET password=? WHERE username=?', (generate_password_hash(self.user.password), self.user.username)) <NEW_LINE> if n...
Update user details Return: (result (boolean), errors (string))
625941db73bcbd0ca4b2c342
def check_win(board, max_rows, max_cols, num_connect, row, col, player): <NEW_LINE> <INDENT> diagonal_win = check_win_diagonal(board, max_rows, max_cols, num_connect, row, col, player)
Возвращает True, если игрок player победил любым образом в заданных строке, столбце или диагонали (row, col), иначе False. >>> rows, columns, num_connect = 2, 2, 2 >>> board = create_board(rows, columns) >>> board = make_move(board, rows, columns, 0, 'X')[1] >>> board = make_move(board, rows, columns, 1, 'O')[1] >>> ...
625941db2eb69b55b151cb7e
def drop_if_too_many_nans(data, threshold=.33): <NEW_LINE> <INDENT> n_subjects = data.shape[0] <NEW_LINE> crit_nans_value = np.floor(n_subjects*threshold).astype(int) <NEW_LINE> keep = np.array(list(data))[(data.isna().sum() < crit_nans_value).values] <NEW_LINE> return data[keep]
Drops column from df if it has too many NaN values
625941db1f037a2d8b9464c9
def selectOrbital(self, value): <NEW_LINE> <INDENT> self.log.debug("selectOrbital: ...") <NEW_LINE> self.log.debug("Changing the orbital `values` to have a 0-based indexes") <NEW_LINE> for i in range(len(value)): <NEW_LINE> <INDENT> if value[i] >= 0: <NEW_LINE> <INDENT> value[i] += 1 <NEW_LINE> <DEDENT> <DEDENT> self.l...
value is a list with the values of orbital to select. Example: >>> foo = ProcarParser() >>> foo.readFile("PROCAR") >>> bar = ProcarSelect(foo) >>> bar.selectIspin([...]) >>> bar.selectAtoms([...]) >>> bar.selectOrbital([-1]) #the last (`tot`) field to select "p" orbitals just change the argument in the last line to [...
625941dba79ad161976cc412
def testGetObject(self): <NEW_LINE> <INDENT> folder_name = "testGetObject folder" <NEW_LINE> new_folder = self.repo.createFolder(self.test_folder, folder_name) <NEW_LINE> objectId = new_folder.getObjectId() <NEW_LINE> cmis_content = self.repo.getObject(objectId) <NEW_LINE> self.assertEquals(folder_name, cmis_content.ge...
Create a test folder then attempt to retrieve it as a :class:`CmisObject` object using its object ID
625941db8da39b475bd65242
def __init__( self, host, gateway_class=client.implicit, connection_path=None, configuration=None, **kwds ): <NEW_LINE> <INDENT> super( proxy_connected, self ).__init__( host, gateway_class=gateway_class, connection_path=connection_path, configuration=configuration, **kwds ) <NEW_LINE> self.route_path = False <NEW_LIN...
We use a route_path, send_path and connection_path to create the underlying "Implicit" connection.
625941db7cff6e4e81117c51
def _render_to_html(tree): <NEW_LINE> <INDENT> def molecule_count(tree, children): <NEW_LINE> <INDENT> if len(tree) == 1: <NEW_LINE> <INDENT> return tree[0][0] <NEW_LINE> <DEDENT> if len(tree) == 3: <NEW_LINE> <INDENT> return " <sup>{num}</sup>&frasl;<sub>{den}</sub> ".format(num=tree[0][0], den=tree[2][0]) <NEW_LINE> ...
Renders a cleaned tree to HTML
625941dbd99f1b3c44c67857
def correlation(u, v, w=None, centered=True): <NEW_LINE> <INDENT> u = _validate_vector(u) <NEW_LINE> v = _validate_vector(v) <NEW_LINE> if w is not None: <NEW_LINE> <INDENT> w = _validate_vector(w) <NEW_LINE> <DEDENT> if centered: <NEW_LINE> <INDENT> umu = np.average(u, weights=w) <NEW_LINE> vmu = np.average(v, weights...
Computes the correlation distance between two 1-D arrays. The correlation distance between `u` and `v`, is defined as .. math:: 1 - \frac{(u - \bar{u}) \cdot (v - \bar{v})} {{||(u - \bar{u})||}_2 {||(v - \bar{v})||}_2} where :math:`\bar{u}` is the mean of the elements of `u` and :math:`x \cdot y` i...
625941db15baa723493c4243
def get_zone_by_name(self, name) -> Optional['spectreapi.Zone']: <NEW_LINE> <INDENT> results = self.get('zone') <NEW_LINE> for zone in results: <NEW_LINE> <INDENT> if zone['name'] == name: <NEW_LINE> <INDENT> return spectreapi.Zone(zone['id'], zone['name'], zone['description'], server=self) <NEW_LINE> <DEDENT> <DEDENT>...
Returns the Zone configured on the server named <name> (if present)
625941dbd7e4931a7ee9e1ea
def test_read_word_by_definition(self): <NEW_LINE> <INDENT> define1 = self.lex['define'] <NEW_LINE> define2 = self.lex.read_word('define') <NEW_LINE> self.assertIsNot(define1, define2) <NEW_LINE> self.assertEqual(define1, define2)
lex.read_word('blah') is the same as lex('blah').
625941dbd268445f265b513a
def get_static_field(klass, name, sig): <NEW_LINE> <INDENT> env = get_env() <NEW_LINE> if isinstance(klass, _javabridge.JB_Object): <NEW_LINE> <INDENT> klass = env.get_object_class(klass) <NEW_LINE> <DEDENT> elif not isinstance(klass, _javabridge.JB_Class): <NEW_LINE> <INDENT> class_name = str(klass) <NEW_LINE> klass =...
Get the value for a static field on a class :param klass: the class or string name of class :param name: the name of the field :param sig: the signature, typically, 'I' or 'Ljava/lang/String;' >>> javabridge.get_static_field("java/lang/Short", "MAX_VALUE", "S") 32767
625941db76d4e153a657edfe
def get_record_type(self, sf_id): <NEW_LINE> <INDENT> if not self.record_type.get(sf_id): <NEW_LINE> <INDENT> result = self.connection.RecordType.get(sf_id) <NEW_LINE> self.record_type[result["Id"]] = result["Name"] <NEW_LINE> <DEDENT> return self.record_type.get(sf_id)
Get the record type name from the Id, caching the result
625941dbf548e778e58cd84b
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(navigateFeedback, self).__init__(*args, **kwds) <NEW_LINE> if self.feedback_msg is None: <NEW_LINE> <INDENT> self.feedback_msg = '' <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.feedback_msg = ''
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: feedback_msg :param args: complet...
625941dbbd1bec0571d908fb
def serialize(tag, headers=(), items=()): <NEW_LINE> <INDENT> if tag == "VADDRESSBOOK": <NEW_LINE> <INDENT> lines = [item.text for item in items] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> lines = ["BEGIN:%s" % tag] <NEW_LINE> for part in (headers, items): <NEW_LINE> <INDENT> if part: <NEW_LINE> <INDENT> lines.appen...
Return a text corresponding to given collection ``tag``. The text may have the given ``headers`` and ``items`` added around the items if needed (ie. for calendars).
625941db460517430c39444b
def _ntk_cov(op, ntk_td, nngp_dd, nngp_td, nngp_tt): <NEW_LINE> <INDENT> term_1 = op(np.transpose(ntk_td)) <NEW_LINE> cov = np.dot(nngp_dd, term_1) <NEW_LINE> cov = np.dot(np.transpose(term_1), cov) <NEW_LINE> term_2 = np.dot(ntk_td, op(np.transpose(nngp_td))) <NEW_LINE> term_2 += np.transpose(term_2) <NEW_LINE> cov +=...
Compute the covariance in the ntk approximation.
625941db01c39578d7e75108
def compute_cost(A2, Y, parameters): <NEW_LINE> <INDENT> m = Y.shape[1] <NEW_LINE> log_probs = np.multiply(np.log(A2), Y) + np.multiply(np.log(1 - A2), 1 - Y) <NEW_LINE> cost = - np.sum(log_probs) / m <NEW_LINE> cost = np.squeeze(cost) <NEW_LINE> return cost
:param A2: :param Y: :param parameters: :return:
625941db6e29344779a628dc
def cal_conditional_entropy(datasets, feature, data_size): <NEW_LINE> <INDENT> ent_a = 0 <NEW_LINE> feature_map = class_data_by_feature(datasets, feature) <NEW_LINE> for x in list(feature_map.keys()): <NEW_LINE> <INDENT> d_i = len(feature_map[x]) <NEW_LINE> ent_a += d_i / data_size * cal_empirical_entropy(class_data_by...
计算条件熵 ent_a :param datasets: 按照特征上不同取值分好的数据字典 :param feature: 特征在特征列表上的索引 :param data_size: 总的数据集的大小 :return: 条件熵
625941db10dbd63aa1bd2e6e
def signal_handler(code, frame): <NEW_LINE> <INDENT> fatal('\nSignal: {}, Program terminated by user'.format(code))
Handle CTRL-C
625941db507cdc57c6306fac
def gformat(val, length=11): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> expon = int(log10(abs(val))) <NEW_LINE> <DEDENT> except (OverflowError, ValueError): <NEW_LINE> <INDENT> expon = 0 <NEW_LINE> <DEDENT> length = max(length, 7) <NEW_LINE> form = 'e' <NEW_LINE> prec = length - 7 <NEW_LINE> if abs(expon) > 99: <NEW_...
Format a number with '%g'-like format, except that a) the length of the output string will be the requested length. b) positive numbers will have a leading blank. b) the precision will be as high as possible. c) trailing zeros will not be trimmed. The precision will typically be length-7. Arguments -...
625941db26238365f5f0f13e
def FindModels(self, func) -> iter: <NEW_LINE> <INDENT> for model in filter(func, self.ModelList): <NEW_LINE> <INDENT> yield model
Поиск подходящих по атрибутам моделей :param func: bool Функция реализующая условие поиска атрибутов в объекте модели :return: Model Найденные модели
625941db851cf427c661a7d9
def readList(self, reg, length): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> results =self.bus.read_i2c_block_data(self.address, reg, length) <NEW_LINE> if self.debug: <NEW_LINE> <INDENT> print ("I2C: Device 0x%02X returned the following from reg 0x%02X" %(self.address, reg)) <NEW_LINE> print (results) <NEW_LINE> <DED...
Read a list of bytes from the I2C device
625941db4527f215b584c720
def transform(self, data): <NEW_LINE> <INDENT> from scipy import sparse <NEW_LINE> self.cat_encoder.par = self.text_encoder.par = self.par <NEW_LINE> output_list = [] <NEW_LINE> col = 'text_cols' <NEW_LINE> if col in self.col_dict.keys(): <NEW_LINE> <INDENT> output_list.append(self.text_encoder.transform(data[self.col_...
:param data: a pandas data frame with all the columns listed in col_dict :return: scipy sparse matrix of features
625941db0383005118ecf8ae
def _check_payloads(self, payloads): <NEW_LINE> <INDENT> for i, payload in enumerate(payloads): <NEW_LINE> <INDENT> if '{}={}' not in payload: <NEW_LINE> <INDENT> raise InvalidFormatException("Payload of {} must include '{{}}={{}}'".format(self.key)) <NEW_LINE> <DEDENT> payloads[i] = payload.format(self._random, self._...
Checks if the payloads are adoptable for this class and modify the payloads to ajust to check function. InvalidFormatException is raised, if a payload is not adoptable. Children can override. :param payloads: list of payloads :return: list of modified payloads
625941dbfb3f5b602dac3962
def has_access(access_level, **kwargs): <NEW_LINE> <INDENT> if access_level in permissions: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> auth = permissions[access_level](lambda *a, **b: True, (), {}, (), **kwargs) <NEW_LINE> if type(auth) is bool and auth is True: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DE...
The method to check if the logged in user has specified access level or nor :param string access_level: name of access level :param dict kwargs: This is directly passed to permission manager :return: bool: True if passes the access else False
625941dba219f33f34628c32
def retrieve_status(self, job_key): <NEW_LINE> <INDENT> file_path = self.folder_path.joinpath(job_key) <NEW_LINE> if file_path.exists(): <NEW_LINE> <INDENT> return JobStatus.success <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return JobStatus.failure
Return the JobStatus of the given job.
625941db435de62698dfdf19
def runTest(self): <NEW_LINE> <INDENT> testroot = posixpath.join(self.dm.deviceRoot, 'infratest') <NEW_LINE> self.dm.removeDir(testroot) <NEW_LINE> self.dm.mkDir(testroot) <NEW_LINE> self.dm.pushDir( os.path.join(self.localsrcdir, 'push1'), posixpath.join(testroot, 'push1')) <NEW_LINE> self.dm.mkDir(posixpath.join(test...
This tests the getDirectory() function.
625941dbf8510a7c17cf99ca
def move_pawn(self, start, end): <NEW_LINE> <INDENT> start = tuple(start) <NEW_LINE> end = tuple(end) <NEW_LINE> pawn = self.grid[start[0]][start[1]].occupant <NEW_LINE> if pawn is None: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> eatable, land_cases = self.can_eat(start) <NEW_LINE> possible_moves = self.get_possi...
Move pawn from <start> to <end> :param start: (tuple) position of the pawn before the move :param end: (tuple) position of the pawn after the move :return: 0 if pawn can't move, 1 if the pawn moved, 2 if the pawn ate smtg
625941dbf7d966606f6aa2d4
def _request_path(environ): <NEW_LINE> <INDENT> base_path = wsgiref.util.application_uri(environ) <NEW_LINE> complete_path = wsgiref.util.request_uri(environ) <NEW_LINE> if not complete_path.startswith(base_path): <NEW_LINE> <INDENT> raise Exception("complete_path %s\ndoes not start with base_path %s" % (complete_path,...
application specific path
625941db442bda511e8be6e1
def read_config(file_path): <NEW_LINE> <INDENT> with open(file_path) as file_handle: <NEW_LINE> <INDENT> file_contents = yaml.safe_load(file_handle.read()) <NEW_LINE> <DEDENT> return file_contents
read YAML configs
625941db21a7993f00bc7fc0
def complements(self, element=None): <NEW_LINE> <INDENT> if element is None: <NEW_LINE> <INDENT> n = self.cardinality() <NEW_LINE> if n == 1: <NEW_LINE> <INDENT> return {self[0]: [self[0]]} <NEW_LINE> <DEDENT> jn = self.join_matrix() <NEW_LINE> mt = self.meet_matrix() <NEW_LINE> zero = 0 <NEW_LINE> one = n - 1 <NEW_LIN...
Return the list of complements of an element in the lattice, or the dictionary of complements for all elements. Elements `x` and `y` are complements if their meet and join are respectively the bottom and the top element of the lattice. INPUT: - ``element`` -- an element of the lattice whose complement is returned....
625941db8da39b475bd65243
@login_required <NEW_LINE> def add(request): <NEW_LINE> <INDENT> getinfo=request.GET <NEW_LINE> postinfo=request.POST <NEW_LINE> if getinfo.has_key("data"): <NEW_LINE> <INDENT> datatype=getinfo.get("data") <NEW_LINE> if datatype=="table": <NEW_LINE> <INDENT> pageindex=getinfo.get("page") <NEW_LINE> pageindex=int(pagein...
增加一个task
625941dbe1aae11d1e749f86
def testing(self, regressor, filter_bank, filter_parameters): <NEW_LINE> <INDENT> reg_error, ncc_error, reg_voxel_error, ncc_voxel_error = [], [], np.array([]), np.array([]); <NEW_LINE> ''' Create feature object ''' <NEW_LINE> feature = Feature(self._selected_filters, self._patch_size) <NEW_LINE> for target in self._te...
Empty list for storing displacement from target POI
625941dbde87d2750b860061
def TryToSell(price): <NEW_LINE> <INDENT> price -= 1 <NEW_LINE> index = 0 <NEW_LINE> canSellList = HoldManager.GetCanSellHolds(price) <NEW_LINE> if canSellList != None and len(canSellList) > 0: <NEW_LINE> <INDENT> for hold in canSellList: <NEW_LINE> <INDENT> index += 1 <NEW_LINE> operationId = hold.operationId <NEW_LIN...
这里尝试买入,因为想要尽量快点成交,所以这里要卖的便宜一点,比最低的买入者价格再低一1usdt
625941dbbe8e80087fb20f0c
def get_trading_capacity(self): <NEW_LINE> <INDENT> return {str(g) for g in self.goods}
Returns a set
625941db76e4537e8c351941
@login_required(login_url="/login/") <NEW_LINE> def toggle(request, expense_id): <NEW_LINE> <INDENT> expense = get_object_or_404(Expense, pk=expense_id) <NEW_LINE> if expense.user != request.user: <NEW_LINE> <INDENT> msg = "{}: access to expense id {} denied".format( request.user.username, expense.pk ) <NEW_LINE> log.e...
change amount sign
625941db099cdd3c635f0f27
def get_arguments(self): <NEW_LINE> <INDENT> super(SqlToCsv, self).get_arguments() <NEW_LINE> if self._args.sql is not None: <NEW_LINE> <INDENT> self._sql = self._args.sql <NEW_LINE> <DEDENT> if self._args.sql_file is not None: <NEW_LINE> <INDENT> self._sql_file = self._args.sql_file
Fetches the parsed arguments required by the CLI :return:
625941db30bbd722463cc095
def get_version(): <NEW_LINE> <INDENT> tag = get_git_tag() <NEW_LINE> ma = re.match(r'v(\d+)\.(\d+)\.(\d+)\-(\d+)\-(\w+)', tag) <NEW_LINE> if ma is None: <NEW_LINE> <INDENT> print("The git tag '{}' does not match the format of v1.y.z-n-abcdef1") <NEW_LINE> exit(1) <NEW_LINE> <DEDENT> major, minor, patch, dirty, hash = ...
Interrogate git to find our version string. We require tags of the form v1.y.z Development builds should happen on named branches (pref. `master`). When crafting a release, start a new branch named 1.y
625941dbaad79263cf390d11
def getLongitude(): <NEW_LINE> <INDENT> pass
return geo longitude
625941db8a43f66fc4b5432f
def index(request): <NEW_LINE> <INDENT> return HttpResponse("Testing")
Favorite index page.
625941db566aa707497f4832
def listen(self): <NEW_LINE> <INDENT> while self.subscription_count or self.channels or self.patterns: <NEW_LINE> <INDENT> r = self.parse_response() <NEW_LINE> msg_type = nativestr(r[0]) <NEW_LINE> if msg_type == 'pmessage': <NEW_LINE> <INDENT> msg = { 'type': msg_type, 'pattern': nativestr(r[1]), 'channel': nativestr(...
Listen for messages on channels this client has been subscribed to
625941dbeab8aa0e5d26de25
def get_command(self, ctx, name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ns = {} <NEW_LINE> fn = os.path.join(COMMANDS, "{}.py".format(name)) <NEW_LINE> with open(fn) as f: <NEW_LINE> <INDENT> code = compile(f.read(), fn, 'exec') <NEW_LINE> eval(code, ns, ns) <NEW_LINE> <DEDENT> return ns['cli'] <NEW_LINE> <DEDEN...
Go through each of the py files in the command directory and import them to the cli. This model allows for each subcommand to be its own file keeping code organized, and modular.
625941db91af0d3eaac9bce8
def test_42_feedback_follow(self): <NEW_LINE> <INDENT> case_data = get_test_data(self.data_list, 'test_user_feedback_zhibiao') <NEW_LINE> if not case_data: <NEW_LINE> <INDENT> logging.error("用例数据不存在") <NEW_LINE> <DEDENT> url = case_data.get('url') <NEW_LINE> data = case_data.get('data') <NEW_LINE> expect_res = case_dat...
客户反馈中发中沟通信息
625941db0fa83653e4657286
def make_mlp(sizes, activation, output_activation=None): <NEW_LINE> <INDENT> l = [layers.Input(sizes[0])] <NEW_LINE> for i in range(1, len(sizes)): <NEW_LINE> <INDENT> if i != len(sizes) - 1: <NEW_LINE> <INDENT> l.append(layers.Dense(sizes[i], activation=activation)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> l.appe...
Create MLP Args: sizes: unit size for each layer activation: activation for apply each layer except last layer output_activation: activation for last layer Returns: layer block
625941db236d856c2ad44aaa
def getScore(self): <NEW_LINE> <INDENT> W_score, B_score = 0, 0 <NEW_LINE> for x in range(8): <NEW_LINE> <INDENT> for y in range(8): <NEW_LINE> <INDENT> if self.board[x][y] == 'W': <NEW_LINE> <INDENT> W_score += 1 <NEW_LINE> <DEDENT> elif self.board[x][y] == 'B': <NEW_LINE> <INDENT> B_score += 1 <NEW_LINE> <DEDENT> <DE...
get the score of the players
625941db6aa9bd52df037072
def get_leg_vertices(self): <NEW_LINE> <INDENT> leg_vertices = [] <NEW_LINE> for leg_index in range(Robot.NUM_LEGS): <NEW_LINE> <INDENT> foot_vertex = self.footprints[leg_index].centre.coords + EPSILON_Z <NEW_LINE> hip_vertex = self.hip_vertices[leg_index] <NEW_LINE> intersections = get_intersection_between_two_circles...
Get the vertices for the given robot leg.
625941db73bcbd0ca4b2c343
@click.command() <NEW_LINE> @click.pass_context <NEW_LINE> def list_containers(ctx): <NEW_LINE> <INDENT> os_object.list_containers(ctx.obj["os_cloud"])
List available containers.
625941dbcdde0d52a9e53302
def GetPointer(self): <NEW_LINE> <INDENT> return _itkThinPlateSplineKernelTransformPython.itkThinPlateSplineKernelTransformD2_GetPointer(self)
GetPointer(self) -> itkThinPlateSplineKernelTransformD2
625941dbf548e778e58cd84c
def __init__(self): <NEW_LINE> <INDENT> self._data_types = {} <NEW_LINE> self._fields_by_tag = {}
Constructor.
625941db38b623060ff0b0ba
def test_async_download(self): <NEW_LINE> <INDENT> checks = [ {'url': 'http://invenio-software.org', 'content': 'About Invenio'}, {'url': 'http://rjfreijoiregjreoijgoirg.fr'}, {'url': 'http://1.2.3.4/'} ] <NEW_LINE> def finished(pagegetter, check, current_time): <NEW_LINE> <INDENT> is_ok = pagegetter.status is not None...
websearch_external_collections_getter - asynchronous download
625941db5fcc89381b1e198f
def StartAlpha(self, isShow): <NEW_LINE> <INDENT> if self._alphaTimer.IsRunning(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.amount = (isShow and [0] or [255])[0] <NEW_LINE> self.delta = (isShow and [5] or [-5])[0] <NEW_LINE> self._alphaTimer.Start(30)
Start the timer which set the alpha channel for L{SuperToolTip}. :param `isShow`: whether L{SuperToolTip} is being shown or deleted. :note: This method is available only on Windows and requires Mark Hammond's pywin32 package.
625941db8a349b6b435e8440
def sweep(self, number): <NEW_LINE> <INDENT> return self[number]
Return a SingleSweep object containing the data from the channel corresponding to the given integer. Parameters ---------- number : int The index of the sweep to use to create the new single-channel object. Returns ------- SingleSweep
625941db009cb60464c6367d
def GetArtifactDependencies(self, recursive=False, depth=1): <NEW_LINE> <INDENT> deps = set() <NEW_LINE> for source in self.sources: <NEW_LINE> <INDENT> if source.type == rdfvalue.ArtifactSource.SourceType.ARTIFACT: <NEW_LINE> <INDENT> if source.attributes.GetItem("names"): <NEW_LINE> <INDENT> deps.update(source.attrib...
Return a set of artifact dependencies. Args: recursive: If True recurse into dependencies to find their dependencies. depth: Used for limiting recursion depth. Returns: A set of strings containing the dependent artifact names. Raises: RuntimeError: If maximum recursion depth reached.
625941db57b8e32f5248376a
def pending_configs(self) -> Dict[Configuration, List[str]]: <NEW_LINE> <INDENT> return dict(self._pending_configs)
Returns a copy of pending initializations dict.
625941db6fece00bbac2da0e
def print_path(source, destination) : <NEW_LINE> <INDENT> if source == destination : <NEW_LINE> <INDENT> print(source) <NEW_LINE> <DEDENT> elif destination.parent == None : <NEW_LINE> <INDENT> print("No path found") <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> print_path(source, destination.parent) <NEW_LINE> print(d...
Printovanje puta izmedju 2 cvora
625941db97e22403b379d268
def __next__(self): <NEW_LINE> <INDENT> if self.coords is None: <NEW_LINE> <INDENT> self._init_coords() <NEW_LINE> <DEDENT> while self.idx < self.coords.shape[0]: <NEW_LINE> <INDENT> curr = self.coords[self.idx, :] <NEW_LINE> self.idx += 1 <NEW_LINE> if (np.all(curr - self.canvas.margin >= 0) and np.all(curr + self.can...
Returns the next seed point as (z, y, x). Does initial filtering of seed points to exclude locations that are too close to the image border. Returns: (z, y, x) tuples. Raises: StopIteration when the seeds are exhausted.
625941db4428ac0f6e5baac1
@app.route("/login", methods=["GET", "POST"]) <NEW_LINE> def login(): <NEW_LINE> <INDENT> session.clear() <NEW_LINE> if request.method == "POST": <NEW_LINE> <INDENT> if not request.form.get("username"): <NEW_LINE> <INDENT> return apology("must provide username", 403) <NEW_LINE> <DEDENT> elif not request.form.get("passw...
Log user in
625941dbac7a0e7691ed4395
def home(request): <NEW_LINE> <INDENT> return render(request, 'techposts/index')
Shows a menu of views for the user to try
625941db0383005118ecf8af
def __init__(self, parent=None): <NEW_LINE> <INDENT> super(MainWindow, self).__init__(parent) <NEW_LINE> self.setupUi(self) <NEW_LINE> self.btn_quit.clicked.connect(self.close) <NEW_LINE> self.ln_a.setFocus() <NEW_LINE> pg.setConfigOptions(antialias=True) <NEW_LINE> self.QEplot = self.graphicsView.addPlot(title="y=ax²+...
Constructor @param parent reference to the parent widget (QWidget)
625941db2c8b7c6e89b35a8d
def gridsearchsynth(self, func, **kwargs): <NEW_LINE> <INDENT> synth = core.synth <NEW_LINE> chop = core.chop <NEW_LINE> unsplit = core.unsplit <NEW_LINE> copy = self.data.copy() <NEW_LINE> copy.rotateto(0) <NEW_LINE> x, y = copy.x, copy.y <NEW_LINE> if 'rcvcorr' in kwargs: <NEW_LINE> <INDENT> rcvphi, rcvlag = self.__r...
Grid search for splitting parameters applied to data using the function defined in func rcvcorr = receiver correction parameters in tuple (fast,lag) srccorr = source correction parameters in tuple (fast,lag)
625941db6fece00bbac2da0f
def checkLib(self, lapackLibrary, blasLibrary = None): <NEW_LINE> <INDENT> if blasLibrary is None: <NEW_LINE> <INDENT> self.separateBlas = 0 <NEW_LINE> blasLibrary = lapackLibrary <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.separateBlas = 1 <NEW_LINE> <DEDENT> if not isinstance(lapackLibrary, list): lapack...
Checking for BLAS and LAPACK symbols
625941db99fddb7c1c9de65d
def branch_is_dirty(): <NEW_LINE> <INDENT> branch_status_msg = _run_cmd(['git', 'status', '--untracked-files=all', '--porcelain']) <NEW_LINE> if branch_status_msg: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
If any files are new, modified, or deleted in git's tracking return True. False otherwise.
625941db91f36d47f21ac7c2
def detect_sources(data, threshold, npixels, kernel=None, connectivity=8, mask=None): <NEW_LINE> <INDENT> return _detect_sources(data, (threshold,), npixels, kernel=kernel, connectivity=connectivity, mask=mask)[0]
Detect sources above a specified threshold value in an image and return a `~photutils.segmentation.SegmentationImage` object. Detected sources must have ``npixels`` connected pixels that are each greater than the ``threshold`` value. If the filtering option is used, then the ``threshold`` is applied to the filtered i...
625941db38b623060ff0b0bb
def test_unaligned_separated(): <NEW_LINE> <INDENT> expected = '\n'.join(['name|score', 'Alice|1', 'Bob|333']) <NEW_LINE> fmt = simple_separated_format("|") <NEW_LINE> result = tabulate([['Alice', 1],['Bob', 333]], ["name", "score"], tablefmt=fmt, stralign=None, numalign=None) <NEW_LINE> assert_equal(expected, result)
Output: non-aligned data columns
625941db1b99ca400220ad80
def jumpFloor(self, number): <NEW_LINE> <INDENT> a, b = 1, 1 <NEW_LINE> for i in range(number): <NEW_LINE> <INDENT> a, b = b, a+b <NEW_LINE> <DEDENT> return a
题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级。 求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。 :param number: 台阶总数 :return:
625941db851cf427c661a7da
def __iter__(self): <NEW_LINE> <INDENT> yield self.objects <NEW_LINE> yield self.properties <NEW_LINE> yield self.bools
Yield ``objects``, ``properties``, and ``bools`` (e.g. for triple unpacking).
625941db4a966d76dd5512df
def __init__(self, port, options, regular_output, buildbot_output, configure_logging): <NEW_LINE> <INDENT> self._port = port <NEW_LINE> self._options = options <NEW_LINE> self._stream = regular_output <NEW_LINE> self._buildbot_stream = buildbot_output <NEW_LINE> self._meter = None <NEW_LINE> self._last_remaining = None...
Args port interface to port-specific routines options OptionParser object with command line settings regular_output stream to which output intended only for humans should be written buildbot_output stream to which output intended to be read by ...
625941db7d847024c06be58c
@json_output_component.route('/getTerrainMap', methods=['GET']) <NEW_LINE> def get_terrain_map(): <NEW_LINE> <INDENT> db = get_db() <NEW_LINE> mission_id = request.args.get("mission_id") <NEW_LINE> if mission_id is None: <NEW_LINE> <INDENT> return jsonify({"error": "Missing key: mission_id"}) <NEW_LINE> <DEDENT> table_...
Purpose: Random choice of suitable terrain map. Request has to contain two keys: mission_id and type. Both are obligatory and cannot be empty :return: table info (img files names) as json
625941db236d856c2ad44aab
def applyff(self, side): <NEW_LINE> <INDENT> if side == 0: <NEW_LINE> <INDENT> ffconf = self.ffclientconf <NEW_LINE> ffsrc = self.xclientout <NEW_LINE> <DEDENT> if side == 1: <NEW_LINE> <INDENT> ffconf = self.ffserverconf <NEW_LINE> ffsrc = self.xserverout <NEW_LINE> <DEDENT> forkcmd = self.cmdfernflower.format(jarff...
Apply fernflower to the given side
625941dbd8ef3951e324380b
def command(word): <NEW_LINE> <INDENT> def dec(func): <NEW_LINE> <INDENT> print(word) <NEW_LINE> settings.commands[word] = func <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> func(*args, **kwargs) <NEW_LINE> <DEDENT> return wrapper <NEW_LINE> <DEDENT> return dec
The general command structure that is used to decorate all commands within commands.py :param word: The word that should be looked for to call the function when it is mentioned :return:
625941db63b5f9789fde73b3
def exec_sql(self, sql): <NEW_LINE> <INDENT> conn = MySQLdb.connect(self.host, self.user, self.passwd, self.db, self.port, charset='utf8') <NEW_LINE> cursor = conn.cursor() <NEW_LINE> count = cursor.execute(sql) <NEW_LINE> if count == 0: <NEW_LINE> <INDENT> sql = "SELECT '" + Date().get_yesterday().strftime('%Y%m%d') +...
:param mysql_host: 数据库主机带端口号 :param mysql_user: 数据库用户 :param mysql_password: 密码 :param mysql_schema: 库 :param sql: mysql_query_str: 查询语句
625941db187af65679ca53ed
def _get_format(self): <NEW_LINE> <INDENT> return self.__format
Getter method for format, mapped from YANG variable /jukebox/library/artist/album/song/format (string) YANG Description: An identifier string for the media type for the file associated with the 'location' leaf for this entry.
625941db29b78933be1e5976
def readbinary(filename): <NEW_LINE> <INDENT> binfile = open(filename, 'rb') <NEW_LINE> data = binfile.read() <NEW_LINE> binfile.close() <NEW_LINE> data_base64 = base64.b64encode(data) <NEW_LINE> return data_base64
Converts a binary file into a Python list of chars so that it can be pickled without problem.
625941db21bff66bcd684c1e
def _read_all_data(self): <NEW_LINE> <INDENT> self.true_bed = salem.GeoTiff( self.gdir.get_filepath('dem')).get_vardata() <NEW_LINE> self.ref_surf = salem.GeoTiff( self.gdir.get_filepath('ref_dem')).get_vardata() <NEW_LINE> self.first_guessed_bed = salem.GeoTiff( self.get_subdir_filepath('first_guessed_bed')).get_varda...
Reads all necessary information from files in gdir for minimization/optimization and logging.
625941db91af0d3eaac9bce9
def scale(self,scaling,filter='nearest'): <NEW_LINE> <INDENT> w,h=self.dimensions <NEW_LINE> to=(int(w*scaling),int(h*scaling)) <NEW_LINE> self.resize(to,filter=filter)
Scales the underlying image applying the provided filter
625941db50485f2cf553d069
def get_solved_state(self): <NEW_LINE> <INDENT> return self.solved_state
Returns the solved state of the cube
625941db82261d6c526ab770
def save(self, filepath, overwrite=True): <NEW_LINE> <INDENT> from ..models import save_model <NEW_LINE> save_model(self, filepath, overwrite)
Save into a single HDF5 file: - the model architecture, allowing to re-instantiate the model - the model weights - the state of the optimizer, allowing to resume training exactly where you left off. This allows you to save the entirety of the state of a model in a single file. Saved models can be ...
625941db5fdd1c0f98dc0502
def testActionSet_112(self): <NEW_LINE> <INDENT> actions = [ "collect", ] <NEW_LINE> extensions = ExtensionsConfig([], None) <NEW_LINE> options = OptionsConfig() <NEW_LINE> options.hooks = [PreActionHook("collect", "something")] <NEW_LINE> actionSet = _ActionSet(actions, extensions, options, None, False, True) <NEW_LIN...
Test with actions=[ collect ], extensions=[], pre-hook on 'collect' action.
625941dbb57a9660fec33b56
def find_macthing_files(match): <NEW_LINE> <INDENT> last_slash = match.rfind('/') <NEW_LINE> if last_slash == -1: <NEW_LINE> <INDENT> dirname = '.' <NEW_LINE> match_prefix = match <NEW_LINE> result_prefix = '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dirname = match[0:last_slash] <NEW_LINE> match_prefix = match[la...
Finds all of the files wihch match (used for completion).
625941db99cbb53fe6792eb4
def user_logout(session_id): <NEW_LINE> <INDENT> pass
用户注销 :param session_id: :return:
625941db0a50d4780f667162
def convert_pytorch(nlp: Pipeline, opset: int, output: Path, use_external_format: bool): <NEW_LINE> <INDENT> if not is_torch_available(): <NEW_LINE> <INDENT> raise Exception("Cannot convert because PyTorch is not installed. Please install torch first.") <NEW_LINE> <DEDENT> import torch <NEW_LINE> from torch.onnx import...
Export a PyTorch backed pipeline to ONNX Intermediate Representation (IR Args: nlp: The pipeline to be exported opset: The actual version of the ONNX operator set to use output: Path where will be stored the generated ONNX model use_external_format: Split the model definition from its parameters to all...
625941dbe8904600ed9f21fe
def gen_define(name, args, body, existing_defines, indent=' '): <NEW_LINE> <INDENT> if name in existing_defines: <NEW_LINE> <INDENT> log.error("Duplicate #define for " + name) <NEW_LINE> sys.exit(1) <NEW_LINE> <DEDENT> if len(args) != 0: <NEW_LINE> <INDENT> define_declare = '#define ' + name + '(' + ', '.join(args) + ...
Produces a #define string, will split into two lines if a single line has a width greater than 80 characters. Result includes newline. Arguments: name - Name of the #define args - List of arguments for the define, provide an empty list if there are none body - Body of the #define existing_defines - set of already ...
625941db097d151d1a223126
def _on_human_check_toggled(self, check_button): <NEW_LINE> <INDENT> if check_button.get_active(): <NEW_LINE> <INDENT> self.conf.classes.append("Human") <NEW_LINE> self.conf.classes = sorted(set(self.conf.classes)) <NEW_LINE> <DEDENT> elif "Human" in self.conf.classes: <NEW_LINE> <INDENT> self.conf.classes.remove("Huma...
Populate the tree view with a subset patterns.
625941db73bcbd0ca4b2c344
def load_data(path=os.path.join(os.sep, 'home', 'flann', 'spiced', 'data', 'ml-latest-small')): <NEW_LINE> <INDENT> logging.debug('Loading data to database') <NEW_LINE> data = dict( movies=pd.read_csv(os.path.join(path, 'movies.csv')), ratings=pd.read_csv(os.path.join(path, 'ratings.csv')), tags=pd.read_csv(os.path.joi...
load data from files
625941db63d6d428bbe447be
def sym_type(self): <NEW_LINE> <INDENT> r <NEW_LINE> return self._sym_type
Return the symmetry type of self, i.e. even (0) or odd (1). If not symmetric we return -1.
625941dbdd821e528d63b475
def create_site(): <NEW_LINE> <INDENT> sites = [ { 'name': '虎嗅', 'code': 'huxiu', 'home': 'https://www.huxiu.com/' }, { 'name': '观察者', 'code': 'guancha', 'home': 'https://www.guancha.cn/' }, { 'name': '澎湃', 'code': 'thepaper', 'home': 'https://www.thepaper.cn/' }, { 'name': 'cnBeta', 'code': 'cnbeta', 'home': 'https://...
采集站点初始化 :return:
625941dbd99f1b3c44c67859
def make_f_cols(self): <NEW_LINE> <INDENT> self.poptdf_cols = np.sort(list(self.inits)).tolist() <NEW_LINE> self.f_cols = ['idx', 'pvary', 'nvary', 'AIC', 'BIC', 'nfev', 'df', 'ndata', 'chi', 'rchi', 'logp', 'cnvrg']
make header names for various fit statistics in fitdf (model parameters, goodness-of-fit measures, etc)
625941dbd7e4931a7ee9e1ec
def normalize_keypoint(kp, K, center=None): <NEW_LINE> <INDENT> kp = kp.copy() <NEW_LINE> if center is not None: <NEW_LINE> <INDENT> kp -= center <NEW_LINE> <DEDENT> kp = get_homogeneous_coords(kp) <NEW_LINE> K_inv = np.linalg.inv(K) <NEW_LINE> kp = np.dot(kp, K_inv.T) <NEW_LINE> return kp
Normalize keypoint coordinate Convert pixel image coordinates into normalized image coordinates Args: kp (array): list of keypoints K (array): intrinsic matrix center (array, optional): principal point offset, for LFGC dataset because intrinsic matrix doensn't include principal offset Returns: array: normaliz...
625941db009cb60464c6367e
def reconstruct_from_patches_2d(patches, image_size): <NEW_LINE> <INDENT> i_h, i_w = image_size[:2] <NEW_LINE> p_h, p_w = patches.shape[1:3] <NEW_LINE> img = np.zeros(image_size, dtype=np.float32) <NEW_LINE> n_h = i_h - p_h + 1 <NEW_LINE> n_w = i_w - p_w + 1 <NEW_LINE> for p, (i, j) in zip(patches, product(range(n_h), ...
This is from scikit-learn. I thought it was a little overkill to require it just for this function.
625941db15baa723493c4245
def _cuspidal_new_submodule_dimension_formula(self): <NEW_LINE> <INDENT> if self.base_ring().characteristic() == 0: <NEW_LINE> <INDENT> N, k, sign = self.level(), self.weight(), self.sign() <NEW_LINE> if sign == 0: <NEW_LINE> <INDENT> m = 2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> m = 1 <NEW_LINE> <DEDENT> return ...
Return the dimension of the new cuspidal subspace, via the formula. EXAMPLES:: sage: M = ModularSymbols(100,2) sage: M._cuspidal_new_submodule_dimension_formula() 2 sage: M.cuspidal_subspace().new_subspace().dimension() 2
625941dbcdde0d52a9e53303
def macmain(): <NEW_LINE> <INDENT> os.environ['NAGSTAMON_VERSION'] = VERSION <NEW_LINE> subprocess.call(['pyinstaller --noconfirm macos/nagstamon.spec'], shell=True) <NEW_LINE> shutil.rmtree('Nagstamon {0} Staging DMG'.format(VERSION), ignore_errors=True) <NEW_LINE> shutil.move('dist/Nagstamon.app', 'Nagstamon {0} Stag...
execute steps necessary for compilation of MacOS X binaries and .dmg file
625941dbc4546d3d9de72d04
def add_logit_instance_image_to_summary(logit_prediction, groundtruth_image): <NEW_LINE> <INDENT> groundtruth_image = tf.cast(groundtruth_image, dtype=tf.uint8) <NEW_LINE> tf.summary.image('Instances/Original', tf.cast(groundtruth_image, dtype=tf.float32)) <NEW_LINE> prediction = tf.argmax(tf.nn.softmax(logit_predictio...
Checking the validity of the training labels. Here we draw instance segmentation only. Args: logit_prediction: A [1, H, W, 1] tensor. groundtruth_image: A [1, H, W, 1] tensor. Return: An image Tensor.
625941db507cdc57c6306fae
def regressionFormat_2_labelxFormat(regressionLine=None): <NEW_LINE> <INDENT> image_url = regressionLine.split('\t')[0] <NEW_LINE> imageName_or_url = 'http://oquqvdmso.bkt.clouddn.com/atflow-log-proxy/images/' + image_url <NEW_LINE> rg_bboxs_line = regressionLine.split('\t')[-1] <NEW_LINE> rg_bboxs_list = json.loads(rg...
input is : regression format line output is : labelx format line
625941dbb545ff76a89140e3
def STO(df, n): <NEW_LINE> <INDENT> SOk = pd.Series((df['close'] - df['low']) / (df['high'] - df['low']), name='SO%k') <NEW_LINE> result = pd.Series(SOk.ewm(span=n, min_periods=n - 1).mean(), name='SO%d_' + str(n)) <NEW_LINE> return out(SETTINGS, df, result)
Stochastic oscillator %D
625941db7047854f462a16d5
def __repr__(self): <NEW_LINE> <INDENT> return self['path']
Display info.
625941db091ae35668667228
def __str__(self): <NEW_LINE> <INDENT> out_str = 'Isochrone with log age {}, metallicity {}, and is'.format(self.age, self.metallicity) <NEW_LINE> if self.best_fit: <NEW_LINE> <INDENT> out_str += ' THE BEST FIT!' <NEW_LINE> <DEDENT> elif not self.best_fit: <NEW_LINE> <INDENT> out_str += ' not the best fit.' <NEW_LINE> ...
String representation of Isochrone
625941db10dbd63aa1bd2e71
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkBinaryImageToStatisticsLabelMapFilterIUC3IF3LM3.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj
New() -> itkBinaryImageToStatisticsLabelMapFilterIUC3IF3LM3 Create a new object of the class itkBinaryImageToStatisticsLabelMapFilterIUC3IF3LM3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the ne...
625941db0383005118ecf8b0