code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_hit_map_no_func(self): <NEW_LINE> <INDENT> mapped = self.qresult.hit_map() <NEW_LINE> self.compare_search_obj(mapped, self.qresult) <NEW_LINE> self.assertNotEqual(id(mapped), id(self.qresult)) <NEW_LINE> self.assertEqual(1102, mapped.seq_len) <NEW_LINE> self.assertEqual("refseq_rna", mapped.target)
Test QueryResult.hit_map, without arguments.
625941d3004d5f362079a509
def state_sucessors(state): <NEW_LINE> <INDENT> states = [] <NEW_LINE> for s in state: <NEW_LINE> <INDENT> if state[s] == "0": <NEW_LINE> <INDENT> for n in get_moves(s, state): <NEW_LINE> <INDENT> state2 = state.copy() <NEW_LINE> state2[s] = n <NEW_LINE> states.append(state2) <NEW_LINE> <DEDENT> break <NEW_LINE> <DEDEN...
return all the possible valid states should return nothing if nothing is valid
625941d3460517430c394358
def test_propfind(self): <NEW_LINE> <INDENT> self.con.response.status = 207 <NEW_LINE> self.con.response.content = MULTISTATUS <NEW_LINE> self.assertEqual(self.dav.propfind("/foobar"), 207) <NEW_LINE> self.assertEqual(self.con.method, "PROPFIND") <NEW_LINE> self.assertEqual(self.con.path, "/foobar") <NEW_LINE> self.ass...
Test CoreWebDAVClient.propfind.
625941d3dc8b845886cb570b
def __init__(self): <NEW_LINE> <INDENT> required_fields = [ "mediathek_path" ] <NEW_LINE> with open("config.yml", 'r') as stream: <NEW_LINE> <INDENT> self.config = yaml.safe_load(stream) <NEW_LINE> <DEDENT> for f in required_fields: <NEW_LINE> <INDENT> if f not in self.config: <NEW_LINE> <INDENT> print(f"{self.prä} FAT...
loads config from file
625941d399fddb7c1c9de567
@mock.patch('longbow.configuration.saveconfigs') <NEW_LINE> @mock.patch('longbow.scheduling._testhandler') <NEW_LINE> def test_testenv_handler(mock_hand, mock_save): <NEW_LINE> <INDENT> jobs = { "jobone": { "resource": "test-machine", "scheduler": "lsf", "handler": "" }, "jobtwo": { "resource": "test-machine", "schedul...
Test that a multi job with the scheduler and handlers set does not try to set them.
625941d38e05c05ec3eea54c
def init_colours_nt_xterm_dark(): <NEW_LINE> <INDENT> curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) <NEW_LINE> curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_GREEN) <NEW_LINE> curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK) <NEW_LINE> curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_...
Initialise nucleotide colour scheme for xterm colour terminals without colour-changing capabilities. Coloured text on a black background.
625941d330bbd722463cbf9d
@app.route("/api/v1.0/stations") <NEW_LINE> def stations(): <NEW_LINE> <INDENT> station = session.query(Station.station, Station.name).all() <NEW_LINE> return jsonify(station)
Return a list of stations
625941d3a79ad161976cc31c
def add_attachment(self, course_id, coursework_id, submission_id): <NEW_LINE> <INDENT> service = self.service <NEW_LINE> request = { 'addAttachments': [ {'link': {'url': 'http://example.com/quiz-results'}}, {'link': {'url': 'http://example.com/quiz-reading'}} ] } <NEW_LINE> coursework = service.courses().courseWork() <...
Adds an attachment to a student submission.
625941d3d7e4931a7ee9e0f3
def submit(self, fun, *args, **kwargs): <NEW_LINE> <INDENT> fut = self.create_enriched_future() <NEW_LINE> workerid = random_string() <NEW_LINE> should_keep_output = False <NEW_LINE> if "__cfut_options" in kwargs: <NEW_LINE> <INDENT> should_keep_output = True <NEW_LINE> output_pickle_path = kwargs["__cfut_options"]["ou...
Submit a job to the pool. kwargs may contain __cfut_options which currently should look like: { "output_pickle_path": str } output_pickle_path defines where the pickled result should be stored. That file will not be removed after the job has finished.
625941d39c8ee82313fbb94b
def loss_function_kernel(self, weights, x_in, ind): <NEW_LINE> <INDENT> ref = self.reference_solution(ind) <NEW_LINE> trial = self.trial_function(x_in, weights) <NEW_LINE> return (ref - trial)**2
Return the data-based loss function.
625941d37d43ff24873a2e76
def compute_question_matrix(question_text): <NEW_LINE> <INDENT> spacy_q_obj = Doc(vocab).from_bytes(spacy_NLP(question_text).to_bytes()) <NEW_LINE> for span_idx, span in enumerate(spacy_q_obj.sents): <NEW_LINE> <INDENT> curr_arcset = MotifsExtractor.get_arcs(span.root, True) <NEW_LINE> fragments = list(curr_arcset) <NE...
Helper function to classify_question. Computes and returns a representation of question_text as a matrix in the latent space
625941d315fb5d323cde0ce7
def on_finish(self): <NEW_LINE> <INDENT> super(BashTaskRunner, self).on_finish()
删除临时配置文件 .
625941d34f88993c3716c23d
def stop_snapshot(self): <NEW_LINE> <INDENT> self._bus.camera.stop_recording() <NEW_LINE> self.camera_stop()
Take a snaphot
625941d307f4c71912b11659
def get_predict_fn(self, data): <NEW_LINE> <INDENT> def predict_fn(logits, output_dir, name, prefix): <NEW_LINE> <INDENT> output = os.path.join(output_dir, 'pred-probs-{}-{}.tsv'.format(name, prefix)) <NEW_LINE> probs = softmax(logits, axis=-1) <NEW_LINE> with open(output, 'w', encoding='utf-8') as fs: <NEW_LINE> <INDE...
Calcuate metrics based on prediction results
625941d38da39b475bd6514a
def get_sequence_as_string(self, filename=None, width=80, sequence_letters_only = False): <NEW_LINE> <INDENT> sequences = self.get_sequence(filename=filename) <NEW_LINE> if sequence_letters_only: <NEW_LINE> <INDENT> output = '\n\n'.join([s.sequence for s in sequences]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> outp...
Same as get_sequence, but returns a single string with all the sequences separated by blank lines. If sequence_letters_only,remove all lines starting with ">" removed and all spaces and line breaks
625941d3ff9c53063f47c3c9
def set_data_(self, X, y): <NEW_LINE> <INDENT> self.X = X <NEW_LINE> self.y = y <NEW_LINE> start_layer_size = X.shape[1] <NEW_LINE> self.n_classes = max(y) + 1 <NEW_LINE> self.layer_sizes = [start_layer_size] + self.hidden_layer_sizes + [self.n_classes] <NEW_LINE> self.n_layers_ = len(self.layer_sizes) <NEW_LINE> self....
Calculates and saves parameters and sizes, used in later methods :param X: matrix, consisting of samples and their attributes :param y: vector, consisting of classes to which the samples belong
625941d363d6d428bbe446c5
def setup_app_config(app: Sanic): <NEW_LINE> <INDENT> config_file_path = os.environ.get('CONFIG_FILE') <NEW_LINE> yml_cfg = yaml.safe_load(open(config_file_path, 'r')) <NEW_LINE> conf_value( var_name='DEBUG', cfg=app.config, yml_cfg=yml_cfg, default='false') <NEW_LINE> conf_value(var_name='PORT', cfg=app.config, yml_cf...
Setup the sanic app configs
625941d323e79379d52ee738
def visualize(self, features, targets): <NEW_LINE> <INDENT> raise NotImplementedError()
This function should produce a single plot containing a scatter plot of the features and the targets, and the perceptron fit by the model should be graphed on top of the points. DO NOT USE plt.show() IN THIS FUNCTION. Args: features (np.ndarray): 2D array containing real-valued inputs. targets (np.ndarray): 1...
625941d3be7bc26dc91cd7d4
def concatenateURLs(urlPieces): <NEW_LINE> <INDENT> print(urlPieces) <NEW_LINE> nodeIndex = 0 <NEW_LINE> urls = [] <NEW_LINE> header = False <NEW_LINE> url = "" <NEW_LINE> for piece in urlPieces: <NEW_LINE> <INDENT> if piece == "Similar": <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif (piece[:4] == "http" or piece[:...
Takes individual parts of the URL returned by requests and puts them together into correct URLs
625941d3a4f1c619b28b020c
@when('bigtop.available') <NEW_LINE> @when_not('zookeeper.installed') <NEW_LINE> def install_zookeeper(): <NEW_LINE> <INDENT> hookenv.status_set('maintenance', 'installing zookeeper') <NEW_LINE> zookeeper = Zookeeper() <NEW_LINE> data_changed('zkpeer.nodes', zookeeper.read_peers()) <NEW_LINE> data_changed( 'zk.network_...
After Bigtop has done the initial setup, trigger a puppet install, via our Zooekeeper library. puppet will start the service, as a side effect.
625941d399cbb53fe6792dbd
def _get_adjacent_squares(self, pos: Pos2D, direction: str = _OMNI) -> List[Square]: <NEW_LINE> <INDENT> adjacent_squares: List[Square] = [] <NEW_LINE> if (direction == Board._OMNI): <NEW_LINE> <INDENT> adjacent_squares.extend( self._get_adjacent_squares(pos, Board._HORIZONTAL)) <NEW_LINE> adjacent_squares.e...
Returns a list of max 4 squares which are directly adjacent (up, down, left, right) of the given position. Can specify if only adjacent squares in a certain direction are wanted using the 'direction' parameter. :param pos: The position which we want adjacent squares for. :param direction: The desired direction to get t...
625941d35fc7496912cc3b54
def get_app_yml_data(): <NEW_LINE> <INDENT> return YamlHandle(APP_YAML).read_data()
获取 app_yml 数据
625941d3009cb60464c63587
def go(url): <NEW_LINE> <INDENT> _DRIVER.get(url)
Navigates to an URL Args: url: the URL to nagivate to
625941d307f4c71912b1165a
@must_be_logged_in <NEW_LINE> def dataverse_add_user_account(auth, **kwargs): <NEW_LINE> <INDENT> user = auth.user <NEW_LINE> provider = DataverseProvider() <NEW_LINE> host = request.json.get('host').rstrip('/') <NEW_LINE> api_token = request.json.get('api_token') <NEW_LINE> client.connect_or_error(host, api_token) <NE...
Verifies new external account credentials and adds to user's list
625941d316aa5153ce36264e
def select_driver(driver_name=None): <NEW_LINE> <INDENT> pass
Choose and return an `IDBDriver`. The *driver_name* of "auto" is equivalent to a *driver_name* of `None` and means to choose the highest priority available driver.
625941d35510c4643540f5b7
@login_required <NEW_LINE> def comment_remove(request, pk): <NEW_LINE> <INDENT> comment = get_object_or_404(Comment, pk=pk) <NEW_LINE> comment.delete() <NEW_LINE> return redirect('post_detail', pk=comment.post.pk)
Вьюха, которая удаляет комментарий
625941d3a8ecb033257d32a2
def table2excel(pathfile,step=1,usecols=None,columns=None, sep='\t',): <NEW_LINE> <INDENT> data=pd.read_table(pathfile,usecols=usecols,sep=sep).iloc[::step].reset_index(drop=True) <NEW_LINE> if columns!=None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data=data[columns] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT>...
step:保存间隔,usecols:使用那些列, columns:使用那些列,或者重命名数 delimiter ,分隔符
625941d3596a897236089c95
def __init__(self, channel): <NEW_LINE> <INDENT> self.HandleUplinkMetaData = channel.unary_unary( '/nc.NetworkControllerService/HandleUplinkMetaData', request_serializer=chirpstack__api_dot_nc_dot_nc__pb2.HandleUplinkMetaDataRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromS...
Constructor. Args: channel: A grpc.Channel.
625941d3ad47b63b2c50a155
@pytest.mark.parametrize( "before_state,purview,alpha", [ ((1, 1, 1), (0, 2), 0.0), ((1, 1, 0), (0, 2), 1.0), ], ) <NEW_LINE> def test_background_3_node(before_state, purview, alpha, background_3_node): <NEW_LINE> <INDENT> after_state = (1, 1, 1) <NEW_LINE> transition = actual.Transition( background_3_node, before_stat...
Looking at transition (AB = 11) -> (AC = 11)
625941d376d4e153a657ed08
def joystick_to_carmove(angle: int, r: int = 100): <NEW_LINE> <INDENT> m_v1 = 0.0 <NEW_LINE> m_v2 = 0.0 <NEW_LINE> m_max = 100.0 <NEW_LINE> if angle >= 0 and angle < 90: <NEW_LINE> <INDENT> m_v1 = m_max <NEW_LINE> m_v2 = m_max * (1 - (2 * (angle / 90.0))) <NEW_LINE> <DEDENT> elif angle >= 90 and angle < 180: <NEW_LINE>...
:return: (v1, v2), v1, v2: float, 0 -- 100
625941d3f9cc0f698b1407d0
def __init__(self, alpha=1.0, beta=0.0, initialtime=0.0): <NEW_LINE> <INDENT> self.alpha = alpha <NEW_LINE> self.beta = beta <NEW_LINE> self.initialtime = initialtime <NEW_LINE> self.lastsample = Sample(initialtime, 0.0) <NEW_LINE> self.lastderivative = 0 <NEW_LINE> self.dt = 0
Alpha Beta filter class.
625941d35fcc89381b1e1896
def gzip_file(in_filename, out_filename=None, cleanup=True): <NEW_LINE> <INDENT> in_file = open(in_filename, 'rb') <NEW_LINE> if out_filename is None: <NEW_LINE> <INDENT> out_filename = in_filename + ".gz" <NEW_LINE> <DEDENT> out_file = gzip.open(out_filename, 'wb') <NEW_LINE> out_file.write( in_file.read() ) <NEW_LINE...
Compress a file using gzip. **Parameters** :in_filename: string The filename of the file to be gzipped. :out_filename: string, optional The filename where the zipped file will be saved. If set to None, this will be the ``in_filename`` with a ``.gz`` suffix. Default: None :cleanup: boolean, option...
625941d3d8ef3951e3243714
def bias_variable(shape, verbose=False): <NEW_LINE> <INDENT> with tf.device('/cpu:0'): <NEW_LINE> <INDENT> with tf.name_scope('biases'): <NEW_LINE> <INDENT> biases = tf.get_variable( 'biases', shape, initializer=tf.constant_initializer(0.1), dtype=tf.float32) <NEW_LINE> variable_summaries(biases, verbose) <NEW_LINE> <D...
Creates a CPU variable with constant initialization. Adds summaries. Args: shape: list, the shape of the variable. verbose: if set add histograms. Returns: Bias variable tensor with shape=shape.
625941d33c8af77a43ae3977
def assert_async_iterable(obj): <NEW_LINE> <INDENT> if not is_async_iterable(obj): <NEW_LINE> <INDENT> raise TypeError(f"{type(obj).__name__!r} object is not async iterable")
Raise a TypeError if the given object is not an asynchronous iterable.
625941d376e4537e8c351849
def __init__(self, xmlfile="publications_%Y-%m-%dT%H-%M-%S.xml", export_annote=True, no_arxiv_urls=False, fixes_for_ethz=False, print_diff_to_last=False): <NEW_LINE> <INDENT> BibFilter.__init__(self); <NEW_LINE> self.xmlfilepattern = xmlfile <NEW_LINE> self.xmlfile = datetime.now().strftime(xmlfile) <NEW_LINE> self.exp...
Bib2EnXmlFilter constructor. Arguments: - xmlfile: The name of the XML file to output to. This string will be parsed with `strftime()`, see [https://docs.python.org/2/library/time.html#time.strftime]. If the file exists, it will not be overwritten and an error will be reported. The default value is 'publica...
625941d3435de62698dfde23
def is_right_truncatable(n): <NEW_LINE> <INDENT> return all(is_prime(n % 10 ** d) for d in range(1, num_digits(n)))
Return True if n is a right truncatable prime, assuming that n is prime.
625941d315baa723493c414d
@sig(H/ (H/ "a" >> "a" >> "a") >> ["a"] >> ["a"]) <NEW_LINE> def scanl1(f, xs): <NEW_LINE> <INDENT> return L[itertools.accumulate(xs, f)]
scanl1 :: (a -> a -> a) -> [a] -> [a] scanl1 is a variant of scanl that has no starting value argument
625941d35f7d997b87174c6f
def islink(path): <NEW_LINE> <INDENT> return False
Return ``True`` if *path* refers to a directory entry that is a symbolic link. Always ``False`` if symbolic links are not supported.
625941d371ff763f4b549864
def load_parameters(self): <NEW_LINE> <INDENT> self._parameters = None <NEW_LINE> self._parameters = parameters.Parameters(self._parameters_file) <NEW_LINE> section = __name__.lower() <NEW_LINE> if self._parameters: <NEW_LINE> <INDENT> self._max_hold_to_shoot_time = self._parameters.get_value(section, "MAX_HOLD_TO_SHOO...
Load values from a parameter file and create and initialize objects. Read parameter values from the specified file, instantiate required objects, and update status variables. Returns: True if the parameter file was processed successfully.
625941d3c4546d3d9de72c0b
def get_action(self, action_name): <NEW_LINE> <INDENT> if action_name in self._actions: <NEW_LINE> <INDENT> return self._actions[action_name] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
retrieve an action by its name
625941d301c39578d7e75012
def transaction_levy(amt): <NEW_LINE> <INDENT> return amt*TRANSACTION_LEVY/100.0
flat rate
625941d38c3a873295158591
def unequipWeaponRight(self, Weapon): <NEW_LINE> <INDENT> print(Weapon.name + " unequipped") <NEW_LINE> self.equipWeaponRight(None)
Unequip Weapon from Right Hand
625941d34527f215b584c62c
def get_quadrature(self): <NEW_LINE> <INDENT> return self._quad
Return the :py:class:`Quadrature` subclass instance used for evaluation of this inner product. :return: The current instance of the quadrature.
625941d3a8ecb033257d32a3
def run(self): <NEW_LINE> <INDENT> print('测试器开始运行') <NEW_LINE> try: <NEW_LINE> <INDENT> count = self.redis.count() <NEW_LINE> print('当前剩余', count, '个代理') <NEW_LINE> for i in range(0, count, BATCH_TEST_SIZE): <NEW_LINE> <INDENT> start = 1 <NEW_LINE> stop = min(i + BATCH_TEST_SIZE, count) <NEW_LINE> print('正在测试第', start ...
测试主函数 :return:
625941d32eb69b55b151ca87
def __init__(self, id=None, owner=None): <NEW_LINE> <INDENT> self._id = None <NEW_LINE> self._owner = None <NEW_LINE> self.id = id <NEW_LINE> self.owner = owner
DatasetIdentifier - a model defined in Swagger
625941d38e7ae83300e4b1a3
def _args_required(params): <NEW_LINE> <INDENT> return len([param for param in params if param.default == inspect.Parameter.empty])
Return count of positional arguments needed.
625941d3460517430c394359
def __init__(self,train_data): <NEW_LINE> <INDENT> np.random.seed(1) <NEW_LINE> l1_size=np.shape(train_data)[1] <NEW_LINE> hidden_l1 = 20 <NEW_LINE> hidden_l2 = 10 <NEW_LINE> n_class = 1 <NEW_LINE> stddev1 = np.sqrt(2/(l1_size+hidden_l1)) <NEW_LINE> stddev2 = np.sqrt(2/(hidden_l1+hidden_l2)) <NEW_LINE> stddev3 = np.sqr...
Seed the random number generator
625941d3f8510a7c17cf98d3
@secure_function <NEW_LINE> def exec_(scope, data): <NEW_LINE> <INDENT> conn = scope.get('__connection__') <NEW_LINE> response = [] <NEW_LINE> for line in data: <NEW_LINE> <INDENT> conn.send(line) <NEW_LINE> conn.expect_prompt() <NEW_LINE> response += conn.response.split('\n')[1:] <NEW_LINE> <DEDENT> scope.define(_...
Sends the given data to the remote host and waits until the host has responded with a prompt. If the given data is a list of strings, each item is sent, and after each item a prompt is expected. This function also causes the response of the command to be stored in the built-in __response__ variable. @type data: stri...
625941d321a7993f00bc7ec8
def translate_nd(self, source: mx.nd.NDArray, source_length: int) -> Translation: <NEW_LINE> <INDENT> return self._get_best_from_beam(*self._beam_search(source, source_length))
Translates source of source_length, given a bucket_key. :param source: Source ids. Shape: (1, bucket_key). :param source_length: Bucket key. :return: Sequence of translated ids, attention matrix, length-normalized negative log probability.
625941d35510c4643540f5b8
def convert_to_mb(value): <NEW_LINE> <INDENT> if isinstance(value, str): <NEW_LINE> <INDENT> if value.endswith('T'): <NEW_LINE> <INDENT> value = int(value.strip('T')) * 1024 * 1024 <NEW_LINE> <DEDENT> elif value.endswith('G'): <NEW_LINE> <INDENT> value = int(value.strip('G')) * 1024 <NEW_LINE> <DEDENT> elif value.endsw...
Converts size to megabytes.
625941d35fdd1c0f98dc040a
def pcamap_sync_up(**kwargs): <NEW_LINE> <INDENT> return a.pcamap.sync_up(**kwargs)
:menu: (enable=True, name=SYNC PCAMAP, section=PCAMAP, num=4, args={})
625941d33539df3088e2e521
def create_snapshot( self, guest_request: GuestRequest, snapshot_request: SnapshotRequest ) -> Result[ProvisioningProgress, Failure]: <NEW_LINE> <INDENT> raise NotImplementedError()
Create snapshot of a guest. If the returned snapshot is not active, ``update_snapshot`` would be scheduled by Artemis core. :param SnapshotRequest snapshot_request: snapshot request to process :param Guest guest: a guest, which will be snapshoted :rtype: result.Result[Snapshot, Failure] :returns: :py:class:`result.res...
625941d38a43f66fc4b5423a
def get_all_archived_allowances(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> archivedallowances = self._blallowance.get_archived_allowance() <NEW_LINE> <DEDENT> except DatabaseError: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> except DataError: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> except ETInputValueE...
main function to get all archived allowances
625941d3d10714528d5ffebb
def to_euler(self, unit="deg"): <NEW_LINE> <INDENT> abs_sine_theta = self.matrix[0, 2] ** 2 + self.matrix[1, 2] ** 2 <NEW_LINE> abs_sine_theta = numpy.sqrt(abs_sine_theta) <NEW_LINE> if not numpy.isclose(abs_sine_theta, 0.0, atol=1e-05): <NEW_LINE> <INDENT> phi = numpy.arctan2(self.matrix[2, 0], -self.matrix[2, 1]) <NE...
Converts rotation matrix to equivalent euler angles. Algorithm from Chapter 1 of "Computational Methods for Three-Dimensional Microscopy Reconstruction" Ed. Joachim Frank, Gabor Herman. Args: unit (:obj:`str`, optional): Whether to return the Euler angles in degrees or radians. Returns: :obj:`i3assis...
625941d30383005118ecf7b9
def testComparison_004(self): <NEW_LINE> <INDENT> postgresql1 = PostgresqlConfig("user", "none", True, ["whatever"]) <NEW_LINE> postgresql2 = PostgresqlConfig("user", "none", True, ["whatever"]) <NEW_LINE> self.assertEqual(postgresql1, postgresql2) <NEW_LINE> self.assertTrue(postgresql1 == postgresql2) <NEW_LINE> self....
Test comparison of two identical objects, all attributes non-None, list non-empty.
625941d38e7ae83300e4b1a4
def search_dashboard_entities(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.search_dashboard_entities_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.search_dashboard_entities_with_...
Search over a customer's non-deleted dashboards # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_dashboard_entities(async_req=True) >>> result = thread.get() :param async_req bool :param Sorta...
625941d34e4d5625662d45ad
def atoms2model(atoms): <NEW_LINE> <INDENT> return pdbmolecule(atoms=atoms)
Return a pdbmolecule object built from provided atoms.
625941d37cff6e4e81117b5c
def __activate_all(self): <NEW_LINE> <INDENT> self.new_vertex_button.config(state=tk.ACTIVE) <NEW_LINE> if len(self.ovals) >= 1: <NEW_LINE> <INDENT> self.del_vertex_button.config(state=tk.ACTIVE) <NEW_LINE> <DEDENT> if len(self.ovals) >= 2: <NEW_LINE> <INDENT> self.new_edge_button.config(state=tk.ACTIVE) <NEW_LINE> <DE...
Activates all buttons that should be active based on the current state of the graph
625941d355399d3f0558888b
def remove_table(self, table): <NEW_LINE> <INDENT> self.execute("DROP TABLE %s" % table)
Removes a table. @param table table name @return return a cursor
625941d3566aa707497f473e
def get(name, require=None): <NEW_LINE> <INDENT> if require is not None and name not in require: <NEW_LINE> <INDENT> raise ExtensionNotRequired(name) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> ext = _EXTENSIONS[name] <NEW_LINE> if ext.__class__ is Transport: <NEW_LINE> <INDENT> return ext.cls(*ext.args, **ext.kwargs)...
Get extension by name :param name: extension name :type name: basestring :param require: allow extensions list :type require: list or tuple
625941d35166f23b2e1a5330
def post(self,request): <NEW_LINE> <INDENT> data=json.loads(request.body.decode()) <NEW_LINE> sku_id=data.get("sku_id") <NEW_LINE> count=data.get('count') <NEW_LINE> selected=data.get('selected') <NEW_LINE> if not all([sku_id,count]): <NEW_LINE> <INDENT> return JsonResponse({ 'code':400, 'errmsg':'缺少参数' }) <NEW_LINE> <...
添加购物车
625941d36aa9bd52df036f7b
def lookahead(self, expr): <NEW_LINE> <INDENT> f = ast.Lambda([], [], 0, expr) <NEW_LINE> f.filename = self.name <NEW_LINE> return ast.CallFunc(ast.Getattr(ast.Name("self"), "lookahead"), [f], None, None)
Create a call to self.lookahead(lambda: expr).
625941d385dfad0860c3b032
def process_tweets(tweet): <NEW_LINE> <INDENT> stemmer = PorterStemmer() <NEW_LINE> stopwords_english = stopwords.words('english') <NEW_LINE> stemmer = PorterStemmer() <NEW_LINE> stopwords_english = stopwords.words('english') <NEW_LINE> tweet = re.sub(r'^RT[\s]+', '', tweet) <NEW_LINE> tweet = re.sub(r'https?:\/\/.*[\r...
process tweets Input: tweet: a string Output: tweets_clean: a list of clean tweet
625941d345492302aab5e49c
def test_get_app_dev_latest_counter(self): <NEW_LINE> <INDENT> pass
Test case for get_app_dev_latest_counter getAppDevLatestCounter() - Gets the latest counter for a given application and device.
625941d399fddb7c1c9de568
def ladderLength(self, beginWord, endWord, wordList): <NEW_LINE> <INDENT> words = set() <NEW_LINE> for word in wordList: <NEW_LINE> <INDENT> words.add(word) <NEW_LINE> <DEDENT> if endWord not in words: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> from collections import deque <NEW_LINE> beginq = deque() <NEW_LINE> ...
:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int
625941d3287bf620b61d3c3a
def bottom_line_string(self): <NEW_LINE> <INDENT> progress_characters = int(round(self.percentage * self.characters)) <NEW_LINE> bar_string = "█" * progress_characters + " " * (self.characters - progress_characters) <NEW_LINE> percentage_string = "{0:.0f}%".format(self.percentage * 100) ....
Generate string to be printed as bottom line. Containing the bar itself, percentage of progress and expected time.
625941d34a966d76dd5511e8
def quadratic_solver(a, b, c): <NEW_LINE> <INDENT> positive = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a) <NEW_LINE> negative = (-b - math.sqrt(b**2 - 4*a*c)) / (2*a) <NEW_LINE> return positive, negative
Function to Solve a quadratic formula, given it's 3 coefficients. Returns the two possible values (plus or minus)
625941d3627d3e7fe0d69028
def __init__(self, stream, encoding, nsHints=None, isHtml=False, indent=False, canonical=False, addedAttributes=None, removedNsDecls=None): <NEW_LINE> <INDENT> if indent and isHtml: <NEW_LINE> <INDENT> self.writer = HtmlPrettyPrinter.HtmlPrettyPrinter(stream, encoding) <NEW_LINE> <DEDENT> elif indent: <NEW_LINE> <INDEN...
Initializes an instance of the class, selecting the appropriate printer to use, depending on the isHtml and indent flags. nsHints, if given, is a dictionary of namespace mappings that help determine if namespace declarations need to be emitted when visiting the first Element node.
625941d32ae34c7f2600d308
def block(self, user): <NEW_LINE> <INDENT> return self.__post('/blocks/create/%s.xml' % user)
Block the given user. Returns no useful data.
625941d3d4950a0f3b08c525
def prediction(test_data, model_name=None, columns_=None, label_col=None): <NEW_LINE> <INDENT> model = load_from_pickle(model_name) <NEW_LINE> return concat([test_data, DataFrame(model.predict(test_data[columns_]), columns=[label_col+'_predicted'])], axis=1)
:param test_data: testing data-frame :param model_name: classification model name for dumping and loading :param columns_: list of columns specified for testing data :param label_col: class label column name :return: concatenated data-frame
625941d3a17c0f6771cbe227
def getDetails(self): <NEW_LINE> <INDENT> if self.__details is None: <NEW_LINE> <INDENT> self.__details = {} <NEW_LINE> <DEDENT> return self.__details
Get the details dict that will be reported with this test's outcome. For more details see pydoc testtools.TestResult.
625941d366656f66f7cbc383
@app.route('/project/<int:project_id>/', methods=['GET']) <NEW_LINE> @app.route('/project/<int:project_id>/overview', methods=['GET', 'POST']) <NEW_LINE> def project_overview(project_id): <NEW_LINE> <INDENT> project = Project.query.get(project_id) <NEW_LINE> form = DeleteProjectForm() <NEW_LINE> if form.delete.data is ...
Project overview with project name, max_count and automatically updated model connection status. :param project_id: :return: render project overview
625941d3cdde0d52a9e5320b
def run_kraken_report(kraken_db, kraken_output, outdir): <NEW_LINE> <INDENT> command = ['kraken-report', '--db', kraken_db, kraken_output] <NEW_LINE> run_successfully, kraken_results, _ = utils_run_command(command=command, shell_True=False, timeout_sec_None=None, print_comand_True=True) <NEW_LINE> if run_successfully: ...
Get the Kraken report from kraken run Parameters ---------- kraken_db : str Kraken DB name or path to the directory containing the Kraken DB kraken_output : str Path to Kraken output file outdir : str Path to the output directory Returns ------- run_successfully : bool Boolean stating if Kraken ran su...
625941d344b2445a3393226c
def mincostTickets(self, days, costs): <NEW_LINE> <INDENT> k, P, cost = 3, [1,7,30], 0 <NEW_LINE> Q = [deque() for _ in range(k)] <NEW_LINE> for d in days: <NEW_LINE> <INDENT> for i in range(k): <NEW_LINE> <INDENT> while Q[i] and Q[i][0][0] + P[i] <= d: Q[i].popleft() <NEW_LINE> Q[i].append([d, cost + costs[i]]) <NEW_L...
:type days: List[int] :type costs: List[int] :rtype: int
625941d3bf627c535bc133a7
def _leapfrog_step(current_momentums, target_log_prob_fn, current_state_parts, step_sizes, current_grads_target_log_prob, name=None): <NEW_LINE> <INDENT> with tf.name_scope( name, '_leapfrog_step', [current_momentums, current_state_parts, step_sizes, current_grads_target_log_prob]): <NEW_LINE> <INDENT> proposed_momentu...
Applies one step of the leapfrog integrator.
625941d3b5575c28eb68e1d8
def wallsAndGates(self, rooms): <NEW_LINE> <INDENT> for i in range(len(rooms)): <NEW_LINE> <INDENT> for j in range(len(rooms[0])): <NEW_LINE> <INDENT> if rooms[i][j] == 0: <NEW_LINE> <INDENT> stack = [ (i + 1, j, 1), (i - 1, j, 1), (i, j + 1, 1), (i, j - 1, 1) ] <NEW_LINE> while stack: <NEW_LINE> <INDENT> ii, jj, dist ...
:type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead.
625941d30c0af96317bb83c0
def get_index_from_style(style): <NEW_LINE> <INDENT> return ToolBar.STYLE_SYMBOLS.index(style)
Return the toolbar style (combobox) index for the symbolic name
625941d321bff66bcd684b29
def run_parallel(self, date): <NEW_LINE> <INDENT> os.chdir(self.xpiddir + date + '/workSODA') <NEW_LINE> self.prepare_preps(date) <NEW_LINE> with open('soda.out', 'w') as f: <NEW_LINE> <INDENT> p = subprocess.call('./soda.exe', stdout=f) <NEW_LINE> if p != 0: <NEW_LINE> <INDENT> raise RuntimeError('SODA crashed, check ...
This method allows to run soda inside a parallelized assimilation sequence. /!\ soda is not parallelized (NOMPI mode).
625941d33d592f4c4ed1d243
def mStep(self,discourseGraphList): <NEW_LINE> <INDENT> tol = 0 <NEW_LINE> for class_ in range(self.numClasses): <NEW_LINE> <INDENT> for comp in range(self.classTransitionMat.shape[1]): <NEW_LINE> <INDENT> partialDeriv = (-1 * self.classTransitionMat[class_,comp] / self.transitionWeightVar) <NEW_LINE> for discourseGrap...
helper for maximizing the likelihood of generating our corpus
625941d391af0d3eaac9bbf2
def build_gaussian_pyramid(im, max_levels, filter_size): <NEW_LINE> <INDENT> filter_vec = get_filter(filter_size) <NEW_LINE> pyr = [im] <NEW_LINE> for i in range(max_levels - 1): <NEW_LINE> <INDENT> if pyr[i].shape[ROWS] // 2 <= MIN_DIM or pyr[i].shape[COLS] // 2 <= MIN_DIM: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT...
Building a Gaussian pyramid from a given image with maximum max_levels :param im: a grayscale image with double values in [0,1] :param max_levels: the maximal number of levels in the resulting pyramid :param filter_size: the size of the Gaussian filter (an odd scalar that represents a squared filter) :return: array wit...
625941d38e71fb1e9831d981
def sample_prior(self, num_samples=1): <NEW_LINE> <INDENT> p_z = self.prior <NEW_LINE> z = p_z.sample(num_samples) <NEW_LINE> return z, p_z
Sample the Gaussian prior. Args: num_samples: Number of samples to draw from the prior. Returns: A tuple of a float Tensor of shape [num_samples, batch_size, latent_size] representing z samples drawn from the Gaussian prior, and a MultivariateNormalDiag distribution modelling the prior distributi...
625941d3090684286d50eebe
def _cdf(self, xloc, graph): <NEW_LINE> <INDENT> if "left" in graph.keys and "right" in graph.dists: <NEW_LINE> <INDENT> num, dist = graph.keys["left"], graph.dists["right"] <NEW_LINE> assert numpy.all(num>0), "imaginary result" <NEW_LINE> y = numpy.log(numpy.abs(xloc) + 1.*(xloc<=0))/ numpy.log(nump...
Cumulative distribution function.
625941d30a366e3fb873e9f3
@group.command() <NEW_LINE> def ls() -> None: <NEW_LINE> <INDENT> logging.info("group ls")
List existing *ssh group*.
625941d37b180e01f3dc49d3
def join_hub(self, from_instance, to_instance): <NEW_LINE> <INDENT> to_replicas = Replicas(to_instance) <NEW_LINE> try: <NEW_LINE> <INDENT> to_r = to_replicas.get(self._suffix) <NEW_LINE> self._log.warning("{} is already a replica for this suffix".format(to_instance.serverid)) <NEW_LINE> return <NEW_LINE> <DEDENT> exce...
Join a new hub to this instance. This will complete a total init of the data "from instance" to "to instance". This can be conducted from any supplier or hub in the topology as "from" supplier. Not implement yet. :param from_instance: An instance already in the topology. :type from_instance: lib389.DirSrv :param to_...
625941d3baa26c4b54cb12f6
def addProperties(node): <NEW_LINE> <INDENT> _addProperties(node)
Create the HDA parameters and nodes (if not already done) :hou.HDADefinition node: the node calling onCreated.
625941d3656771135c3eba48
def siftdown(ar,start,end): <NEW_LINE> <INDENT> root=start <NEW_LINE> while root*2+1<=end: <NEW_LINE> <INDENT> child=root*2+1 <NEW_LINE> swap=root <NEW_LINE> if ar[swap]<ar[child]: <NEW_LINE> <INDENT> swap=child <NEW_LINE> <DEDENT> if child+1<=end and ar[swap]<ar[child+1]: <NEW_LINE> <INDENT> swap=child+1 <NEW_LINE> <D...
finds approprite position in heap
625941d3460517430c39435a
def get_channel_bandwidth_hz(self): <NEW_LINE> <INDENT> self.capsule_ensure() <NEW_LINE> return _vis_header_lib.channel_bandwidth_hz(self._capsule)
Returns the width of each frequency channel, in Hz.
625941d3498bea3a759b9c87
def load_texture(image_file, repeat=False): <NEW_LINE> <INDENT> img = Image.open(image_file) <NEW_LINE> data = numpy.array(list(img.getdata()), numpy.int8) <NEW_LINE> tex = glGenTextures(1) <NEW_LINE> glPixelStorei(GL_UNPACK_ALIGNMENT, 1) <NEW_LINE> glBindTexture(GL_TEXTURE_2D, tex) <NEW_LINE> if repeat: <NEW_LINE> <IN...
Carga una textura desde un archivo image_file
625941d3d58c6744b4257e36
def action_view_all_rating(self): <NEW_LINE> <INDENT> if self.portal_show_rating: <NEW_LINE> <INDENT> return { 'type': 'ir.actions.act_url', 'name': "Redirect to the Website Projcet Rating Page", 'target': 'self', 'url': "/outsourcing/rating/%s" % (self.id,) } <NEW_LINE> <DEDENT> action = self.env['ir.actions.act_windo...
return the action to see all the rating of the outsourcing, and activate default filters
625941d34f88993c3716c23e
def get_hourstotal(self): <NEW_LINE> <INDENT> value = self.__get_long(75, 1) <NEW_LINE> if(value is not None): <NEW_LINE> <INDENT> value = int(value) <NEW_LINE> <DEDENT> return value
Gets the hours the inverter generated electricity.
625941d31f037a2d8b9463d5
def get_sub_pages(): <NEW_LINE> <INDENT> ignore_chars = ['/', '?'] <NEW_LINE> image_chars = ['.jpg', '.png'] <NEW_LINE> confs = {} <NEW_LINE> images = [] <NEW_LINE> subs = [] <NEW_LINE> response = requests.get(URL_BASE) <NEW_LINE> text = response.text <NEW_LINE> subs_raw = [x[:x.index('"')] for x in text.split('<a href...
Returns a dictionary of conf files (keys) found in the sub-menu along with images (values) if there are any
625941d37d43ff24873a2e78
def get_todo_items(self, todo_list_id): <NEW_LINE> <INDENT> todo_list = self.repository[todo_list_id] <NEW_LINE> return tuple(todo_list.items)
Returns a tuple of to-do items.
625941d32eb69b55b151ca88
def feedforward(self, inputs): <NEW_LINE> <INDENT> weighted_inputs = map(operator.mul, inputs, self.weights) <NEW_LINE> total = sum(weighted_inputs) <NEW_LINE> return self.activation(total)
Inputs fed forward into the next Perceptron as an weighted activation output.
625941d3379a373c97cfad1d
def test_partially_missing_columns(db, clients, upload_version): <NEW_LINE> <INDENT> client = clients.get("Administrators") <NEW_LINE> study = StudyFactory(kf_id="SD_ME0WME0W") <NEW_LINE> resp = upload_version( "SD_ME0WME0W/s3_scrape_partial.csv", study_id=study.kf_id, client=client, ) <NEW_LINE> version = resp.json()[...
Test that an error outlining missing columns is returned correctly
625941d3ac7a0e7691ed42a2
def click_coordinates(img, window_title='', block=False): <NEW_LINE> <INDENT> global_click_coord = {} <NEW_LINE> fig, ax = plt.subplots() <NEW_LINE> ax.set_title(window_title) <NEW_LINE> implot = ax.imshow(img, 'gray') <NEW_LINE> def onclick(event): <NEW_LINE> <INDENT> if event.xdata != None and event.ydata != None: <N...
Returns the coordinates of the first click on an image. Warning: Makes use of a global variable: global_click_coord INPUTS img - cv2 image (Numpy array of intensities) window_title - string that becomes the title of the window, typically displays instructions of what to click on in the window. block - B...
625941d3627d3e7fe0d69029
def test_token_get(self): <NEW_LINE> <INDENT> user = fake_clients.FakeUser( name="test@example.com", password="123", email="test@example.com" ) <NEW_LINE> setup_identity_cache(users=[user]) <NEW_LINE> url = "/v1/actions/ResetPassword" <NEW_LINE> data = {"email": "test@example.com"} <NEW_LINE> response = self.client.pos...
Token should contain actions, task_type, required fields.
625941d3ff9c53063f47c3cb
def main(global_config, **settings): <NEW_LINE> <INDENT> config = Configurator(settings=settings) <NEW_LINE> routes.add_route(config) <NEW_LINE> config.scan() <NEW_LINE> return config.make_wsgi_app()
This function returns a Pyramid WSGI application.
625941d3fbf16365ca6f63a0
def __init__(self, device, xiaomi_hub): <NEW_LINE> <INDENT> self._state = False <NEW_LINE> self._data_key = 'alarm' <NEW_LINE> XiaomiDevice.__init__(self, device, 'Natgas Sensor', xiaomi_hub)
Initialize the XiaomiNatgasSensor.
625941d3adb09d7d5db6c967
def test_remove_with_query(self): <NEW_LINE> <INDENT> b = self.insert_sample_data(10) <NEW_LINE> assert len(b.query()) == 10 <NEW_LINE> where = {"key": {"$gt": 3}} <NEW_LINE> res = b.remove_with_query(where=where) <NEW_LINE> assert res["result"] == "ok" <NEW_LINE> assert res["deletedObjects"] == 6 <NEW_LINE> assert len...
正常に一括削除できること
625941d329b78933be1e5882
def format_restaurant(restaurant): <NEW_LINE> <INDENT> return ('Great! The restaurant you want is', str(restaurant.index[0]), '. On a scale of $ to $$$$, its price is', str(restaurant['Price'][0]), '. The location is', str(restaurant['Address'][0]), ', which is', str(restaurant['Distance'][0])[:3], 'miles away from you...
Description: formats dataframe of restaurant into a readable output Params: restaurant- dataframe of restaurant being printed Return: string containing a readable format of the restaurant and its info
625941d3e1aae11d1e749e90