code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def new_loop( self, name ): <NEW_LINE> <INDENT> raise NotImplementedError
Requests that the engine create a new loop. Args: name (str): A string containing the name of the loop to be created. Returns: void
625941ccbaa26c4b54cb120e
def disconnect(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.cleanup() <NEW_LINE> if self.protocol == "ssh": <NEW_LINE> <INDENT> self.paramiko_cleanup() <NEW_LINE> <DEDENT> elif self.protocol == "telnet": <NEW_LINE> <INDENT> self.remote_conn.close() <NEW_LINE> <DEDENT> <DEDENT> except Exception: <NEW_LINE> <...
Try to gracefully close the SSH connection.
625941cc26238365f5f0ef5c
def assemble(fs, f): <NEW_LINE> <INDENT> deg = fs.element.degree ** 2 <NEW_LINE> cell = fs.element.cell <NEW_LINE> quad_rule = gauss_quadrature(cell, deg) <NEW_LINE> basis_at_quad = fs.element.tabulate(quad_rule.points) <NEW_LINE> basis_grad_at_quad = fs.element.tabulate(quad_rule.points, grad=True) <NEW_LINE> A = sp.l...
Assemble the finite element system for the Helmholtz problem given the function space in which to solve and the right hand side function.
625941ccb57a9660fec33972
def __repr__(self): <NEW_LINE> <INDENT> if self.rsp is not None: <NEW_LINE> <INDENT> return etree.tostring(self.rsp, pretty_print=True)
pprints the response XML attribute
625941ccd99f1b3c44c6767c
def create_sse_subscription(idrac_ip: str, idrac_username: str, idrac_password: str): <NEW_LINE> <INDENT> print("\n- INFO, starting SSE client, this may take a few seconds") <NEW_LINE> messages = SSEClient("https://%s/redfish/v1/SSE?$filter=EventFormatType eq MetricReport" % idrac_ip, headers={'content-type': 'applicat...
Creates an SSE subscription to the iDRAC. It will print all output to console in the foreground. :param idrac_ip: IP address of the target iDRAC :param idrac_username: Username of the target iDRAC :param idrac_password: Password of the target iDRAC
625941ccc432627299f04d33
def _run_loop(self): <NEW_LINE> <INDENT> print("Start loop") <NEW_LINE> run = True <NEW_LINE> while run: <NEW_LINE> <INDENT> self._handle_mqtt_updates() <NEW_LINE> self._input.update() <NEW_LINE> for event in pygame.event.get(): <NEW_LINE> <INDENT> if event.type == pygame.locals.KEYUP: <NEW_LINE> <INDENT> if event.key ...
Run pygame event loop
625941cc6fece00bbac2d82c
def __init__(self, packet): <NEW_LINE> <INDENT> self.packet = packet <NEW_LINE> self.response = None <NEW_LINE> self.response_handler = None <NEW_LINE> self.timed_out = False
Create a new message.
625941cccdde0d52a9e53121
def settings(): <NEW_LINE> <INDENT> @mc_states.api.lazy_subregistry_get(__salt__, __name) <NEW_LINE> def _settings(): <NEW_LINE> <INDENT> lxcSettings = __salt__['mc_utils.defaults']( 'makina-states.services.virt.lxc', { 'is_lxc': is_lxc(), }) <NEW_LINE> return lxcSettings <NEW_LINE> <DEDENT> return _settings()
Lxc registry virt defaults (makina-states.services.virt.lxc) is_lxc containers Mapping of containers defintions classified by host
625941cc283ffb24f3c559ef
def parse(string): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> txt = TextBlob(string) <NEW_LINE> for sentence in txt.sentences: <NEW_LINE> <INDENT> genQuestion(sentence) <NEW_LINE> <DEDENT> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> raise e
Parse a paragraph. Devide it into sentences and try to generate quesstions from each sentences.
625941ccd164cc6175782e3b
def release_sp(self,sp): <NEW_LINE> <INDENT> self.sesslock.acquire() <NEW_LINE> try: <NEW_LINE> <INDENT> if sp.get_listen_port() == self.tunnellistenport: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if len(sp.get_downloads()) == 0: <NEW_LINE> <INDENT> self.destroy_sp(sp) <NEW_LINE> <DEDENT> <DEDENT> finally: <NEW_LI...
Download no longer needs process. Apply process-cleanup policy
625941ccd4950a0f3b08c43d
def remove(self) -> object: <NEW_LINE> <INDENT> if self.is_empty(): <NEW_LINE> <INDENT> raise IndexError("Queue is empty.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._storage.pop(0)
Remove and return front object from Queue self. Queue self must not be empty. >>> q = Queue() >>> q.add(3) >>> q.add(5) >>> q.remove() 3
625941cc82261d6c526ab58d
def _reduce_and_reshape_grad(g, t): <NEW_LINE> <INDENT> shape = array_ops.shape(t) <NEW_LINE> g_shape = array_ops.shape(g) <NEW_LINE> bcast_dims, _ = gen_array_ops.broadcast_gradient_args(shape, g_shape) <NEW_LINE> return array_ops.reshape(math_ops.reduce_sum(g, bcast_dims), shape)
Returns the gradient, sum-reduced and reshaped to `t`'s shape.
625941cc6fb2d068a760f18b
def test_UploadFile_v2_Mock_Fail_INDEX_ERROR(self): <NEW_LINE> <INDENT> print("+++++++++ UploadFile_v2_Mock_Fail_INDEX_ERROR Test +++++++++") <NEW_LINE> server_urls_instance = ServerUrls().get_instance() <NEW_LINE> file_name = "test_up.txt" <NEW_LINE> src_file_full_path = os.path.join(type(self).ingestion_globals.data_...
Uploads file and checks if it was ingested correctly. It mocks KeyServer response so it will work in unit test environment It passes the wrong key name so the test will fail on purpose
625941cc3539df3088e2e439
def generate_ranks(duplicates_map, sorted_key_iterator, base_rank=0): <NEW_LINE> <INDENT> for key in sorted_key_iterator: <NEW_LINE> <INDENT> num_dups = len(duplicates_map[key]) <NEW_LINE> for value in duplicates_map[key]: <NEW_LINE> <INDENT> yield (base_rank + 1 + base_rank + num_dups)/2, value <NEW_LINE> <DEDENT> bas...
The function expects a map from the keys to the list of items for the key, An iterator for the keys in sorted order, and a base rank to start.
625941ccec188e330fd5a88d
@app.route("/lab/<lab_prefix>/search") <NEW_LINE> def searchLab(lab_prefix): <NEW_LINE> <INDENT> opened_pr=db.pulls.find({"$and":[{"Lab":lab_prefix},{"State": "open"}]}).count() <NEW_LINE> closed_pr=db.pulls.find({"$and":[{"Lab":lab_prefix},{"State": "closed"}]}).count() <NEW_LINE> percentage=round(closed_pr/(opened_pr...
Purpose: Search student submissions on specific lab Params: lab_prefix Returns: Number of open PR Number of closed PR Percentage of completeness (closed vs open) List number of missing pr from students The list of unique memes used for that lab Instructor grade time in hours: (pr...
625941cc63f4b57ef0001208
def unicode_(obj, encoding=None, errors='ignore'): <NEW_LINE> <INDENT> unicodeObj = None <NEW_LINE> encodings = ['utf-8', 'utf-16', 'ascii'] <NEW_LINE> defaultEncoding = encodings[0] <NEW_LINE> _processEncodings(encoding, encodings) <NEW_LINE> if isinstance(obj, unicode): <NEW_LINE> <INDENT> return obj <NEW_LINE> <DEDE...
Transform the object to Unicode.
625941cc236d856c2ad448c8
def coeff_binom(x, n): <NEW_LINE> <INDENT> fac_x = factorial(x) <NEW_LINE> fac_n = factorial(n) <NEW_LINE> fac_nx = factorial(n-x) <NEW_LINE> comb = fac_n / (fac_x *(fac_nx)) <NEW_LINE> return int(comb)
:Goal: determine the number of combinations that can be created when choosing x objects from a set of n objects. :Package(s): none. coeff_binom() is a 4 steps process: 1- x! is calculated and stored in the variable fac_x ; 2- n! is calculated and stored in the variable fac_n ; 3- (n-x)! is calculated and s...
625941cc0c0af96317bb82d6
def set(self, tube, bit): <NEW_LINE> <INDENT> for strand in self.tubes[tube]: <NEW_LINE> <INDENT> strand[bit] = 1 <NEW_LINE> <DEDENT> print('set:\t', self.tubes)
Sets the bit passed for every strand in the tube to one tube -> the tube label bit -> the bit position in the strand
625941ccdc8b845886cb5623
@blog_blueprint.route('/comment/', methods=["POST"]) <NEW_LINE> def add_comment(): <NEW_LINE> <INDENT> article_id = request.form.get('article_id', None) <NEW_LINE> comment_content = request.form.get("commentContent", None) <NEW_LINE> article_url = url_for('blog.detail', article_id=article_id) <NEW_LINE> result = add_co...
添加评论
625941ccd18da76e235325c4
def __prepare__(self): <NEW_LINE> <INDENT> G = FlightData.initialize_vertices(os.path.join(self.raw_data_path, FLIGHTS_DATA)) <NEW_LINE> FlightData.initialize_edges(G, os.path.join(self.raw_data_path, ROUTES_DATA)) <NEW_LINE> FlightData.delete_empty_airports(G) <NEW_LINE> components = G.components(mode=igraph.WEAK) <NE...
Takes files downloaded by __download__ and converts them into .graphml format. The graph prepared is **directed**, where the vertices are the airports, and there is an edge wherever there is a flight from one airport to another. Note that an edge a->b does not imply b->a.
625941cc1f037a2d8b9462ec
def getLensfunModifierFromExif(tags, width=None, height=None, lensfunDbObj=None, distance=10000, minAcceptedScore=MIN_ACCEPTED_SCORE): <NEW_LINE> <INDENT> cam, lens = findCameraAndLensFromExif(tags, lensfunDbObj, minAcceptedScore=minAcceptedScore) <NEW_LINE> if width is None: <NEW_LINE> <INDENT> width, height = tags['C...
WARNING: Not setting width and height may produce surprising results for RAW files. If width and height are not set, then Composite:ImageSize is used. This tag contains the full RAW size, but many RAW decoders produce slightly cropped images. Therefore it may be necessary to first decode the RAW image and determine the...
625941ccad47b63b2c50a06d
@application.route('/') <NEW_LINE> def index(): <NEW_LINE> <INDENT> page_number = int(request.args.get('page_num')) if request.args.get('page_num') else 1 <NEW_LINE> return render_template("index.html", page_number=page_number, results=get_data_from_database(page_number, results_per_page=RESULTS_PER_PAGE), pages_availa...
Main page
625941cc3cc13d1c6d3c7468
@order.route('/<int:id>/cancel', methods=['POST']) <NEW_LINE> @login_required <NEW_LINE> def cancel(id): <NEW_LINE> <INDENT> resp = TbBuy(current_app).post_json('/orders/{}'.format(id), json={ 'status': 'cancelled', }) <NEW_LINE> return json_response(resp['code'], resp['message'], **resp['data'])
取消订单
625941cc0a50d4780f666f80
def get_stages_model(self, params): <NEW_LINE> <INDENT> return params["stage_description"]
生成分级操作描述模板 :param dict params: 分级操作参数 :return: 分级操作描述模板 :rtype: list
625941cca8370b771705298e
def test_markdown_poll_mode_invalid(self): <NEW_LINE> <INDENT> comment = "[poll name=foo mode=foo]\n" "1. opt 1\n" "2. opt 2\n" "[/poll]" <NEW_LINE> md = Markdown(escape=True, hard_wrap=True) <NEW_LINE> comment_md = md.render(comment) <NEW_LINE> self.assertEqual(commen...
Should not accept unknown mode
625941cc38b623060ff0aedc
def test_upload_stocks_with_invalid_file_fails( self, init_db, client, auth_header_form_data, stock_file ): <NEW_LINE> <INDENT> data = dict( file=(stock_file, 'stock.pdf') ) <NEW_LINE> response = client.post( f'{API_V1_BASE_URL}/stocks', data=data, headers=auth_header_form_data ) <NEW_LINE> response_json = json.loads(r...
Should fail, and return both errors and a response code of 400
625941ccbe383301e01b5574
def complete_question(self): <NEW_LINE> <INDENT> done = [button for button in self.buttons if button["background"] == "green"] <NEW_LINE> return len(done) == len(self.cur['correct'])
:rtype: 已选择正确选项的数量是否等于答案选项数量
625941cc091ae3566866704c
def getDict(self): <NEW_LINE> <INDENT> retval= super(ISO898Steel,self).getDict() <NEW_LINE> name= None <NEW_LINE> if(self.name): <NEW_LINE> <INDENT> name= self.name <NEW_LINE> <DEDENT> retval.update({'name': name}) <NEW_LINE> return retval
Put member values in a dictionary.
625941cca8ecb033257d31bb
def indent(self): <NEW_LINE> <INDENT> assert self._indent + self._tab <= self._max_indent, 'indent greater than _max_indent ('+str(self._max_indent)+')' <NEW_LINE> self._indent += self._tab
Increments the indentation level by self._tab spaces.
625941cc60cbc95b062c6632
def __init__(self, num_lcores=None, numa_node_index=None): <NEW_LINE> <INDENT> self._num_lcores = None <NEW_LINE> self._numa_node_index = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.num_lcores = num_lcores <NEW_LINE> self.numa_node_index = numa_node_index
CpuCoreConfigForEnhancedNetworkingStackSwitch - a model defined in Swagger
625941cc66673b3332b9217f
@app.route('/remove_cell/<cell_id>', methods=['POST']) <NEW_LINE> def remove_cell(cell_id=0): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cell_id = int(cell_id) <NEW_LINE> if len(inputs) < 2: <NEW_LINE> <INDENT> raise ValueError('Cannot remove the last cell') <NEW_LINE> <DEDENT> if cell_id < 0 or cell_id >= len(inputs...
Removes a cell by number
625941cc7b25080760e39548
def __init__(self, parent, descendant=True): <NEW_LINE> <INDENT> super(TextSymbolizer, self).__init__(parent, 'Text*', descendant=descendant)
Create a new TextSymbolizer node, as a child of the specified parent. @type parent: L{Rule} @param parent: The parent class object. @type descendant: boolean @param descendant: A flag indicating if this is a descendant node of the parent.
625941cceab8aa0e5d26dc46
def city_value_ajax_servant(request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> city_id = int(request.GET.get("city_id") ) <NEW_LINE> res = [ item[1] for item in CITIES if item[0] == city_id ] <NEW_LINE> ret = { 'value' : res } <NEW_LINE> return HttpResponse(simplejson.dumps( ret ), content_type="application/json")...
return city name from id
625941cc55399d3f055887a2
def sim_pearson(prefs, person1, person2): <NEW_LINE> <INDENT> si = {item: 1 for item in prefs[person1] if item in prefs[person2]} <NEW_LINE> n = len(si) <NEW_LINE> if n == 0: return 1 <NEW_LINE> sum1 = sum([prefs[person1][it] for it in si]) <NEW_LINE> sum2 = sum([prefs[person2][it] for it in si]) <NEW_LINE> sum1Sq = su...
计算person1和person2的皮尔逊相关系数 :param prefs: 数据源 :param person1: :param person2: :return: 两person的Pearson相关系数
625941cc3cc13d1c6d3c7469
def is_product_in_menu(uid, prod_id, menu_id=1): <NEW_LINE> <INDENT> action = 'SELECT id_prod FROM menu_allusers WHERE id_user = {} AND id_menu = {}'.format(uid, menu_id) <NEW_LINE> answer = connect_to_db_and_action(action, True) <NEW_LINE> for i in answer: <NEW_LINE> <INDENT> if i[0] == prod_id: <NEW_LINE> <INDENT> re...
Проверяет есть ли в меню продукт
625941ccd486a94d0b98e234
def checkParashut(self): <NEW_LINE> <INDENT> pass
This function checks if the parashut is working well
625941cc56b00c62f0f14748
def ensure_tmpdir(): <NEW_LINE> <INDENT> path = tempfile.mkdtemp('aomi') <NEW_LINE> atexit.register(clean_tmpdir, path) <NEW_LINE> return path
Ensures a temporary directory exists
625941ccd6c5a10208144139
def donor_update(self, name, initial_donation=None): <NEW_LINE> <INDENT> if not initial_donation: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> formatted_donation = int(float(initial_donation) * 100) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> ret...
Method to add donation if donor exists or creates new Donor object if the donor does not exist. Returns True if actions are successful. Controls donation data and name data. :param name: donor's name :param initial_donation: initial donation value
625941cc1b99ca400220aba0
def set_linenum(self, linenum): <NEW_LINE> <INDENT> raise NotImplementedError()
Set the line number used by the controller and this manager.
625941cc2ae34c7f2600d220
def convert_intents_to_tensors(self, words, classes, documents): <NEW_LINE> <INDENT> train_all = [] <NEW_LINE> output = [] <NEW_LINE> output_empty = [0] * len(classes) <NEW_LINE> for doc in documents: <NEW_LINE> <INDENT> bow = [] <NEW_LINE> pattern_words = doc[0] <NEW_LINE> pattern_words = [self.stemmer.stem(word.lower...
Converts the information extracted from the intents (words, sentences, ...) into numbers to use for learning
625941ccc4546d3d9de72b22
def _grow_child(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError
生长子树
625941cc283ffb24f3c559f0
@click.command('get_unknown_courses') <NEW_LINE> @with_appcontext <NEW_LINE> def get_unknown_courses(): <NEW_LINE> <INDENT> course_db = CourseDB() <NEW_LINE> course_data = list(course_db.get_all_course_data()) <NEW_LINE> data = pd.DataFrame(columns=["known_courses", "unknown_courses"]) <NEW_LINE> for course in course_d...
Get all course codes that could not be matched.
625941cc85dfad0860c3af49
def days_to_datetime(days): <NEW_LINE> <INDENT> date = datetime.datetime.now() <NEW_LINE> if days > 0: <NEW_LINE> <INDENT> date -= datetime.timedelta(days=days) <NEW_LINE> <DEDENT> return date
Returns the datetime value of last N days. :param int days: From 0 to N days :returns int: The datetime of last N days or datetime.now() if days <= 0.
625941cc31939e2706e4cf59
def update(self): <NEW_LINE> <INDENT> self.angle += self.angle_vel <NEW_LINE> self.pos[0] = (self.pos[0] + self.vel[0]) % WIDTH <NEW_LINE> self.pos[1] = (self.pos[1] + self.vel[1]) % HEIGHT <NEW_LINE> if self.thrust: <NEW_LINE> <INDENT> acc = angle_to_vector(self.angle) <NEW_LINE> self.vel[0] += acc[0] * .1 <NEW_LINE> ...
Update method
625941cc30dc7b7665901a55
def compile(self, expr, timecontext=None, params=None, *args, **kwargs): <NEW_LINE> <INDENT> if timecontext is not None: <NEW_LINE> <INDENT> session_timezone = self._session.conf.get( 'spark.sql.session.timeZone' ) <NEW_LINE> timecontext = localize_context( canonicalize_context(timecontext), session_timezone ) <NEW_LIN...
Compile an ibis expression to a PySpark DataFrame object.
625941cc0383005118ecf6d1
def transformed(self, QTransform): <NEW_LINE> <INDENT> return QBitmap
transformed(self, QTransform) -> QBitmap
625941cc5fdd1c0f98dc0322
def _add_ref(script, path, ref): <NEW_LINE> <INDENT> script.run('git', 'update-ref', ref, 'HEAD', expect_stderr=True, cwd=path)
Add a new ref to a repository at the given path.
625941cc5510c4643540f4d3
def test_log_score(self): <NEW_LINE> <INDENT> self.assertTrue(FITTED_MODEL.log_score() < 0.0) <NEW_LINE> self.assertTrue(FITTED_MODEL.log_score(date_range=("2018-01-01", "2018-03-01"))) <NEW_LINE> df_mock = pd.DataFrame( { "date": ["2018-01-02"], "home_team": ["Man City"], "away_team": ["Arsenal"], "home_goals": [4.0],...
Test log score calculation
625941ccf548e778e58cd66c
def get_keywords(triples, whitelist_indexes=None): <NEW_LINE> <INDENT> keywords = [] <NEW_LINE> for triple in triples: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> index, binop, term = triple <NEW_LINE> index_allowed = (not whitelist_indexes) or (index in whitelist_indexes) or (index.lower() in whitelist_indexes) <NEW_...
compute list of keywords >>> triples = []; get_triples(parse_cql('txt=foo or (bi=bar or bi=baz)'), triples) >>> get_keywords(triples) [u'foo', u'bar', u'baz'] >>> triples = []; get_triples(parse_cql('pa all "central, intelligence, agency"'), triples) >>> get_keywords(triples) [u'central', u'intelligence', u'agency'] ...
625941cc4e696a04525c953a
def setDefaultField (fdict, model, viewCode): <NEW_LINE> <INDENT> fdict['header'] = model._meta.verbose_name.title() <NEW_LINE> fdict['type'] = 'string' <NEW_LINE> fdict['readOnly'] = True <NEW_LINE> fdict['sortable'] = True <NEW_LINE> fdict['flex'] = 1 <NEW_LINE> fdict['cellLink'] = True <NEW_LINE> fdict['zoomModel'] ...
set __str__ properties
625941cca05bb46b383ec910
def post(self,request): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if not user.is_authenticated(): <NEW_LINE> <INDENT> return JsonResponse({'msg': 0, 'errmsg': '请先登录'}) <NEW_LINE> <DEDENT> sku_id = request.POST.get('sku_id') <NEW_LINE> count = request.POST.get('count') <NEW_LINE> if not all([sku_id, count]): <N...
购物车记录更新
625941cc92d797404e304278
def close(self): <NEW_LINE> <INDENT> super().close()
:return:
625941cc99cbb53fe6792cd5
def brute_force_norm_cut(graph, max_size): <NEW_LINE> <INDENT> pass
Enumerate over all possible cuts of the graph, up to max_size, and compute the norm cut score. Params: graph......graph to be partitioned max_size...maximum number of edges to consider for each cut. E.g, if max_size=2, consider removing edge sets of size 1 or 2 edges. Returns: (unsorted) list of (score, edge_list) tupl...
625941cc63d6d428bbe445de
def __init__(self, statements : "CustomAST list node of statements", rng : "Permutation representing the original statement list" = None, precond : "Perform precondition checks for input values" = True, safe : "Perform sanity checks for things that won't need them if this is coded correctly" = False, limit : "Limit to ...
Initialise reorderer or raise TypeError.
625941ccb545ff76a8913f05
def __init__(self, alt_label=None, iri=None, pref_label=None): <NEW_LINE> <INDENT> self._alt_label = None <NEW_LINE> self._iri = None <NEW_LINE> self._pref_label = None <NEW_LINE> if alt_label is not None: <NEW_LINE> <INDENT> self.alt_label = alt_label <NEW_LINE> <DEDENT> if iri is not None: <NEW_LINE> <INDENT> self.ir...
ConceptEntry - a model defined in Swagger
625941cc6fece00bbac2d82d
def sammplesheet_pcr_exonuclease(lims, process_id, output_file): <NEW_LINE> <INDENT> process = Process(lims, id=process_id) <NEW_LINE> sample_count = len(process.analytes()[0]) <NEW_LINE> data = [ ['2X iProof', process.udf['2X iProof']], ['Illumina forward primer(100uM) MIP_OLD_BB_FOR', process.udf['Illumina forward pr...
Create manual pipetting samplesheet for PCR after Exonuclease protocol
625941cc8da39b475bd65062
def calculate_reshape_static_output_shapes(operator): <NEW_LINE> <INDENT> check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1) <NEW_LINE> check_input_and_output_types(operator, good_input_types=[FloatTensorType]) <NEW_LINE> params = operator.raw_operator.reshapeStatic <NEW_LINE> output_sh...
Allowed input/output patterns are 1. [N, C, H, W] ---> [N, C', H', W'] Note that C*H*W should equal to C'*H'*W'.
625941ccadb09d7d5db6c87e
def __enter__(self): <NEW_LINE> <INDENT> self.conn = lite.connect(self.db_file) <NEW_LINE> with self.conn: <NEW_LINE> <INDENT> self.conn.execute("CREATE TABLE IF NOT EXISTS " + self.table_name + "(agency TEXT, route TEXT, " + "stop TEXT, direction TEXT, qtime INT, " + "epochTime INT, seconds INT, vehicle INT, " + "trip...
Open DB connection and create predictions table.
625941cc8da39b475bd65063
def processing_file(): <NEW_LINE> <INDENT> filter_call = subprocess.Popen(['ls', FILEPATH], stdout=subprocess.PIPE) <NEW_LINE> if platform.system() == "Darwin": <NEW_LINE> <INDENT> sort_cmd = subprocess.Popen(['sort', '-f'], stdin=filter_call.stdout, stdout=subprocess.PIPE) <NEW_LINE> <DEDENT> elif platform.system() ==...
Function to create a temporary file for processing.
625941cc32920d7e50b282bf
def test_put_item(self): <NEW_LINE> <INDENT> conn = TableConnection(self.test_table_name) <NEW_LINE> with patch(PATCH_METHOD) as req: <NEW_LINE> <INDENT> req.return_value = HttpOK(), DESCRIBE_TABLE_DATA <NEW_LINE> conn.describe_table() <NEW_LINE> <DEDENT> with patch(PATCH_METHOD) as req: <NEW_LINE> <INDENT> req.return_...
TableConnection.put_item
625941cc2eb69b55b151c99e
def test_not_an_observable(self, stat_func): <NEW_LINE> <INDENT> dev = qml.device("lightning.qubit", wires=2) <NEW_LINE> @qml.qnode(dev) <NEW_LINE> def circuit(): <NEW_LINE> <INDENT> qml.RX(0.52, wires=0) <NEW_LINE> return stat_func(qml.CNOT(wires=[0, 1])) <NEW_LINE> <DEDENT> with pytest.raises(qml.QuantumFunctionError...
Test that a qml.QuantumFunctionError is raised if the provided argument is not an observable
625941cc76e4537e8c351761
def setUIClass(host=None,pref=None): <NEW_LINE> <INDENT> global uiadaptor <NEW_LINE> if host is None: <NEW_LINE> <INDENT> host = retrieveHost() <NEW_LINE> <DEDENT> if not host : <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> uiadaptor = getUClass(host,pref=pref)
Set the base class for UI design according the provide host. If the host is not provide,retrieveHost() will be called to guess the host. @type host: string @param host: name of the host application @type pref: string @param pref: UI interface prefernce for instance qt
625941cc566aa707497f4657
def clean_children_living_with_you_comments(self): <NEW_LINE> <INDENT> children_living_with_you_declare = self.cleaned_data[ "children_living_with_you_declare" ] <NEW_LINE> children_living_with_you_comments = self.cleaned_data[ "children_living_with_you_comments" ] <NEW_LINE> if children_living_with_you_declare is True...
Full name comments validation :return: string
625941cce64d504609d7492f
def npix(self): <NEW_LINE> <INDENT> np = 0 <NEW_LINE> for win in self.win: <NEW_LINE> <INDENT> np += win.nx*win.ny <NEW_LINE> <DEDENT> return np
Returns number of (binned) pixels per CCD
625941cc01c39578d7e74f2a
def _post_init(self): <NEW_LINE> <INDENT> pass
Post init setup.
625941ccbe7bc26dc91cd6ef
def matches(self, obj): <NEW_LINE> <INDENT> _matches = [] <NEW_LINE> for field in obj._meta.get_fields(): <NEW_LINE> <INDENT> related_model = field.related_model <NEW_LINE> if self._is_product_kind(related_model): <NEW_LINE> <INDENT> _matches.append(self.product_matcher(field, obj)) <NEW_LINE> <DEDENT> elif self._is_ca...
Tries to match filters, conditions, effects etc to shop product :return: True or False based on the match :rtype: bool
625941cccc40096d61595a40
def make_rock(canvas, center, diameter): <NEW_LINE> <INDENT> helper.make_circle( canvas, center, diameter / 2, stroke_width=0, outline='white', color=random.choice(["purple","blue","orange", "yellow"]) )
demo function that show you how to draw a rock, given the convenience functions that are available in this module
625941cc4a966d76dd5510fe
def create_empty_file(parent_directory, file_basename): <NEW_LINE> <INDENT> if not os.path.isdir(parent_directory): <NEW_LINE> <INDENT> os.makedirs(parent_directory) <NEW_LINE> <DEDENT> full_file_name = os.path.join(parent_directory, file_basename) <NEW_LINE> with open(full_file_name, 'w'): <NEW_LINE> <INDENT> print('C...
Creates an empty file with a given basename in a parent directory. Creates parent_directory and intermediate directories if it doesn't exist. This is mostly used for creating no-op actions in the Dockerfile. Args: parent_directory: The path to the parent directory. file_basename: The basename for the empty file.
625941cc442bda511e8be508
def test_par_wrapper_cyclotron_3(self): <NEW_LINE> <INDENT> k=0.35 * np.sqrt(2.) <NEW_LINE> kz = k <NEW_LINE> kp = 0 <NEW_LINE> betap = 1.0 <NEW_LINE> t_list=[1., 1., 4.] <NEW_LINE> a_list=[2.25, 1., 1.] <NEW_LINE> n_list=[1., 1.10,0.05] <NEW_LINE> q_list=[1., -1., 2.] <NEW_LINE> m_list=[1., 1/1836, 4.] <NEW_LINE> v_li...
benchmark parallel_wrapper() using dispersion relation of cyclotron instabilitiy. The benchmark data are taken from a figure in BA Maruca's PhD thesis (p.82). Maruca used SP Gary's code to generate the plot.
625941cc4527f215b584c546
def poincare_2d_visualization(model, tree, figure_title, num_nodes=50, show_node_labels=()): <NEW_LINE> <INDENT> vectors = model.kv.syn0 <NEW_LINE> if vectors.shape[1] != 2: <NEW_LINE> <INDENT> raise ValueError('Can only plot 2-D vectors') <NEW_LINE> <DEDENT> node_labels = model.kv.index2word <NEW_LINE> nodes_x = list(...
Create a 2-d plot of the nodes and edges of a 2-d poincare embedding. Parameters ---------- model : :class:`~gensim.models.poincare.PoincareModel` The model to visualize, model size must be 2. tree : set Set of tuples containing the direct edges present in the original dataset. figure_title : str Title of ...
625941cc23849d37ff7b317f
def get_pi(): <NEW_LINE> <INDENT> return math.pi
Get value of pi
625941cc5e10d32532c5f016
def shaders(self): <NEW_LINE> <INDENT> shaders = read_opengl_array( self.pid, self.shaders_count, gl.glGetAttachedShaders, c_uint) <NEW_LINE> return [ShaderObject(sid) for sid in shaders]
Return a list of shader objects linked to the program. The returned shader objects do not own the underlying shader.
625941cc15baa723493c4065
def start_thread_last_requested(endpoint): <NEW_LINE> <INDENT> BaseProfiler(endpoint).start()
Starts a thread that updates the last_requested time in the database. :param endpoint: Endpoint object
625941cce1aae11d1e749da6
def test_sub_resource_generates_okay(): <NEW_LINE> <INDENT> data = { "author": { "name": "This is the subresource" }, "slug": "this-is-the-resource", "another_thing": "this-is-also-the-resource" } <NEW_LINE> instance = SubResourcePeopleResource(**data) <NEW_LINE> assert isinstance(instance.author, AuthorSubResource) <N...
Test that we generate subresources as expected
625941ccdd821e528d63b298
def __init__(self, path): <NEW_LINE> <INDENT> rule_list = csv.reader(open(path), delimiter=',') <NEW_LINE> self.rules = self.process_rules(rule_list) <NEW_LINE> pp = pprint.PrettyPrinter(indent=2) <NEW_LINE> pp.pprint(self.rules)
Initialize the rules object after reading csv file.
625941cc56ac1b37e62642bf
def __init__(self, browser, xpath=None, elements=None): <NEW_LINE> <INDENT> self.browser = browser <NEW_LINE> if xpath is None and elements is None: <NEW_LINE> <INDENT> raise ValueError("Must supply either xpath or elements.") <NEW_LINE> <DEDENT> if xpath is not None: <NEW_LINE> <INDENT> self.xpath = xpath <NEW_LINE> <...
Initialise the selector. One of 'xpath' and 'elements' must be passed. Passing 'xpath' creates a selector delaying evaluation until it's needed, passing 'elements' stores the elements immediately.
625941cc63b5f9789fde71d5
def to_str(s): <NEW_LINE> <INDENT> if s is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if isinstance(s, str): <NEW_LINE> <INDENT> return s <NEW_LINE> <DEDENT> if PY3 and isinstance(s, bytes): <NEW_LINE> <INDENT> return s.decode('utf-8') <NEW_LINE> <DEDENT> elif not PY3 and isinstance(s, unicode): <NEW_LIN...
Converts byte or unicode string to bytes type assuming UTF-8 encoding
625941cc167d2b6e31218c85
def get_ids(self): <NEW_LINE> <INDENT> return self._id_vector
NOTE: NOT THREAD SAFE. Use the returned structure only in conjunction with this object's lock when in a parallel environment to prevent possible memory corruption. :return: Ordered vector of clip IDs along the row-edge of this object's feature matrix and along both edges of the kernel matrix. :rtype: numpy.core.mu...
625941cc3317a56b86939d48
def send_shape_creation(self, shape, x1, y1, x2, y2): <NEW_LINE> <INDENT> coordinates_text = ",".join([str(x1), str(y1), str(x2), str(y2)]) <NEW_LINE> seperator = ';' <NEW_LINE> color = self.__color <NEW_LINE> pre_work_out = seperator.join(['shape', shape, coordinates_text, color]) <NEW_LINE> text = str(pre_work_out + ...
This function creates a new shape upon our canvas and sends message to server
625941cc4e4d5625662d44c7
def to_tuple(self): <NEW_LINE> <INDENT> return (self.src_vertex.get_name(), self.dst_vertex.get_name())
Returns a tuple of the vertex names of the start and end of the edge
625941ccf548e778e58cd66d
def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data, headers=("#",)): <NEW_LINE> <INDENT> support_files = [(c, tz.get_in([c, "vrn_file"], calls_by_name)) for c in convert.SUBSET_BY_SUPPORT["cnvkit"]] <NEW_LINE> support_files = [(c, f) for (c, f) in support_files if f and vcfutils.vcf_has_varia...
Limit CNVkit input to calls with support from another caller. get_coords is a function that return chrom, start, end from a line of the input_file, allowing handling of multiple input file types.
625941ccbf627c535bc132be
def changerJoueurCourant(self): <NEW_LINE> <INDENT> joueur_courant_changer = self.liste_joueur[0] <NEW_LINE> self.liste_joueur.pop(0) <NEW_LINE> self.liste_joueur.insert(len(self.liste_joueur),joueur_courant_changer)
passe au joueur suivant (change le joueur courant donc) paramètres: joueurs la liste des joueurs cette fonction ne retourne rien mais modifie la liste des joueurs
625941cc45492302aab5e3b2
def compute_distances_two_loops(self, X): <NEW_LINE> <INDENT> num_test = X.shape[0] <NEW_LINE> num_train = self.X_train.shape[0] <NEW_LINE> dists = np.zeros((num_test, num_train)) <NEW_LINE> for i in xrange(num_test): <NEW_LINE> <INDENT> for j in xrange(num_train): <NEW_LINE> <INDENT> dist = np.sqrt(np.sum(np.square(se...
Compute the distance between each test point in X and each training point in self.X_train using a nested loop over both the training data and the test data. Inputs: - X: A numpy array of shape (num_test, D) containing test data. Returns: - dists: A numpy array of shape (num_test, num_train) where dists[i, j] is th...
625941ccf8510a7c17cf97ec
def SetInput1(self, *args): <NEW_LINE> <INDENT> return _itkCheckerBoardImageFilterPython.itkCheckerBoardImageFilterICVF22_SetInput1(self, *args)
SetInput1(self, itkImageCVF22 image1)
625941cc91f36d47f21ac5e2
def _get_gnss_site_pos_covariance(lsq: "LsqEstimator") -> np.ndarray: <NEW_LINE> <INDENT> dtype = [ ("estimate_cov_site_pos_xx", float), ("estimate_cov_site_pos_xy", float), ("estimate_cov_site_pos_xz", float), ("estimate_cov_site_pos_yy", float), ("estimate_cov_site_pos_yz", float), ("estimate_cov_site_pos_zz", float)...
Get GNSS site position covariance matrix Args: lsq: Least square estimator object. Returns: Covariance matrix of site position.
625941ccbaa26c4b54cb120f
def _monotonic_ms() -> float: <NEW_LINE> <INDENT> return _monotonic_to_ms(monotonic())
Return the current monotonic time in milliseconds using the most precise source available. On Python => 3.7 use :func:`time.monotonic_ns`, below use :func:`time.monotonic`
625941ccab23a570cc250272
def parse_alarm(self, global_params, region, alarm): <NEW_LINE> <INDENT> alarm['arn'] = alarm.pop('AlarmArn') <NEW_LINE> alarm['name'] = alarm.pop('AlarmName') <NEW_LINE> for k in ['AlarmConfigurationUpdatedTimestamp', 'StateReason', 'StateReasonData', 'StateUpdatedTimestamp']: <NEW_LINE> <INDENT> foo = alarm.pop(k) if...
Parse a single CloudWatch trail :param global_params: Parameters shared for all regions :param region: Name of the AWS region :param alarm: Alarm
625941cc1d351010ab855c0b
def guacamole_delete_connections_group(base_url, validate_certs, datasource, auth_token, group_numeric_id): <NEW_LINE> <INDENT> url_delete_connections_group = URL_DELETE_CONNECTIONS_GROUP.format( url=base_url, datasource=datasource, group_numeric_id=group_numeric_id, token=auth_token) <NEW_LINE> try: <NEW_LINE> <INDENT...
Delete a connections group
625941cc5f7d997b87174b88
def maxCount(self, m, n, ops): <NEW_LINE> <INDENT> if m==0 and n==0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if not ops: <NEW_LINE> <INDENT> return m*n <NEW_LINE> <DEDENT> minx=float("inf") <NEW_LINE> miny=float("inf") <NEW_LINE> for [x,y] in ops: <NEW_LINE> <INDENT> if x < minx: <NEW_LINE> <INDENT> minx=x <NE...
:type m: int :type n: int :type ops: List[List[int]] :rtype: int
625941cc07f4c71912b11572
def __init__(self): <NEW_LINE> <INDENT> self.deck = [] <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> for rank in RANKS: <NEW_LINE> <INDENT> self.deck.append(Card(rank))
deck refers to a list of cards. Since I am not accounting for suit, I add all of the cards 4 times to acheive the correct total
625941ccec188e330fd5a88f
def system_find_users(input_params={}, always_retry=True, **kwargs): <NEW_LINE> <INDENT> return DXHTTPRequest('/system/findUsers', input_params, always_retry=always_retry, **kwargs)
Invokes the /system/findUsers API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers
625941ccbe383301e01b5575
def forward(self, x): <NEW_LINE> <INDENT> h_relu = self.linear1(x).clamp(min=0) <NEW_LINE> y_pred = self.linear2(h_relu) <NEW_LINE> return y_pred
In the forward function we accept a Tensor of input data and we must return a Tensor of output data. We can use Modules defined in the constructor as well as arbitrary operators on Tensors.
625941ccf8510a7c17cf97ed
@pytest.mark.skip('Nodes use round robin primary selection') <NEW_LINE> def testPrimaryElectionWithAClearWinner( electContFixture, looper, txnPoolNodeSet): <NEW_LINE> <INDENT> A, B, C, D = txnPoolNodeSet <NEW_LINE> nodesBCD = [B, C, D] <NEW_LINE> checkPoolReady(looper, txnPoolNodeSet) <NEW_LINE> timeout = waits.expecte...
Primary selection (Sunny Day) A, B, C, D, E A, B, C, D startup. E is lagging. A sees the minimum number of nodes first, and then sends out a NOMINATE(A) message B, C, D all see the NOMINATE(A) message from A, and respond with NOMINATE(A) message to all other nodes A sees three other NOMINATE(A) votes (from B, C, D) A ...
625941cc236d856c2ad448ca
def expected_passes_count(data: DF) -> Dict[str, float]: <NEW_LINE> <INDENT> gender_ratio_passes = defaultdict( lambda: 0 ) <NEW_LINE> expected_passes = defaultdict(lambda: 0) <NEW_LINE> for score, point in iter_points(data): <NEW_LINE> <INDENT> offense = point[point["Event Type"] == "Offense"] <NEW_LINE> passes = offe...
Return the count of expected passes by gender.
625941cc3c8af77a43ae3890
def save_image(img, folder, save_text=False): <NEW_LINE> <INDENT> num = 0 <NEW_LINE> path = folder + img['date'] + '-#' + str(num) <NEW_LINE> while os.path.isfile(path + ".jpg") or os.path.isfile(path + ".error"): <NEW_LINE> <INDENT> num += 1 <NEW_LINE> path = folder + img['date'] + "-#" + str(num) <NEW_LINE> <DEDENT> ...
Saves an image to disk. Filename is on the form YYYY-MM-DD[-#N].jpg If save_text is true, save image description as separate .txt-file. If an error occurs while retrieving the image, that error is written to an .error-file.
625941cc44b2445a33932186
def parse_bandit_scan_result(self, json_file, target_name): <NEW_LINE> <INDENT> if not target_name: <NEW_LINE> <INDENT> raise Exception("No target name specified. Exiting...") <NEW_LINE> <DEDENT> target = Target.objects.get(name = target_name) <NEW_LINE> manage_bandit_results(json_file, target=target, session=self.sess...
will parse a Bandit JSON file and load into the DB as vulnerabilities. As Bandit does not provide a CWE, there will be NO link with Threat Models :param json_file for Bandit Scan: :param target_name: | parse bandit scan result | json_file | target_name |
625941cc0c0af96317bb82d8
def execute(self): <NEW_LINE> <INDENT> wiz_data = self <NEW_LINE> if wiz_data.name < 1: <NEW_LINE> <INDENT> raise ValueError(_('The number of customer invoice lines must be at least one')) <NEW_LINE> <DEDENT> company = self.env['res.users'].company_id <NEW_LINE> company_obj = self.env['res.company'] <NEW_LINE> company_...
In this method I will configure the maximum number of lines in your invoices.
625941cc5fcc89381b1e17af
def p_attribute(p): <NEW_LINE> <INDENT> if len(p) == 4: <NEW_LINE> <INDENT> p[0] = Attribute(p[2]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = Attribute()
attribute : LESS_THAN name GREATER_THAN | empty
625941ccd164cc6175782e3e
def __init__(self, ah_parameter): <NEW_LINE> <INDENT> self._ah_parameter = ah_parameter
Constructor. Should not be called directly but instead returned from an AudioUnit.
625941cc1d351010ab855c0c
def delWeak(self, table): <NEW_LINE> <INDENT> ids = self.getIdentifiers(table, True) <NEW_LINE> for id in ids: <NEW_LINE> <INDENT> if all([x == metmask.WEAK_CONF for x in self.getConfidence(table, id)]): <NEW_LINE> <INDENT> self.delIdentifiers(table, id)
delete all weak identifiers in table Parameters: -`table` : desired table
625941cc8c3a8732951584ab