code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def UpdateGeometricParameters(self, dt): <NEW_LINE> <INDENT> self.etabav = self.etabav + self.DeltaEtaB * dt <NEW_LINE> self.Bc = self.Bc + (self.NarrowRate + self.WidenRate) * dt <NEW_LINE> self.Bf = self.Bf - (self.NarrowRate + self.WidenRate) * self.ChSin * dt <NEW_LINE> self.CumulativeNarrowing = self.CumulativeNar...
Method for updating the geometric parameters of the node. Parameters ---------- dt : float Timestep. Note ---- For simulating a node with partly alluvial cover on bedrock, the subroutine may need some adjustment. See comments in the code for ideas.
625941db0383005118ecf8b5
def get(self, network, hostmask): <NEW_LINE> <INDENT> query = self.dms.query(UserSession).filter(UserSession.network_id == network.id).filter( UserSession.hostmask == hostmask) <NEW_LINE> return query.first()
Get the session for this hostmask, if one exists, otherwise return False Args: network(database.models.Network): The network we are retrieving a session from hostmask(str): Hostmask the session should be mapped to Returns: database.models.UserSession.UserSession or False
625941db2c8b7c6e89b35a93
def test_create_token_no_user(self): <NEW_LINE> <INDENT> payload = {'email': 'test@test.com', 'password': 'testpass'} <NEW_LINE> res = self.client.post(TOKEN_URL, payload) <NEW_LINE> self.assertNotIn('token', res.data) <NEW_LINE> self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
Test that otken is not supported if user doesn't exist
625941db5166f23b2e1a542c
def test_bach(self): <NEW_LINE> <INDENT> start = time.time() <NEW_LINE> low,high,filtered = loudest_band(music,frame_rate,75) <NEW_LINE> duration = time.time() - start <NEW_LINE> testing_time['bach']=duration <NEW_LINE> self.assertEqual(music.shape,filtered.shape) <NEW_LINE> self.assertAlmostEqual(low/823.5,1.0,2) <NEW...
e. what is the loudest 75 Hz of Bach 10 seconds?
625941dba8370b7717052b71
def test_multivariate_aggregation(): <NEW_LINE> <INDENT> marginal_pdfs = [ [1 / 3, 1 / 3, 1 / 3], [1 / 4, 1 / 4, 2 / 4], [1 / 6, 1 / 6, 2 / 3], ] <NEW_LINE> marginal_cdfs = np.cumsum(marginal_pdfs, axis=1) <NEW_LINE> cdf_p, cdf_v = multivariate_marginal_to_univariate_joint_cdf( marginal_cdfs, a=10, b=100 ) <NEW_LINE> a...
Check different aggregation functions for multivariate aggregation, as well as a copula.
625941dba8370b7717052b72
def _thread_reading_online(self): <NEW_LINE> <INDENT> online_data = dict(zip(self.channel_list, [[] for i in range(len(self.channel_list))])) <NEW_LINE> counter = 0 <NEW_LINE> headset = Emotiv(display_output = False, serial_number = self.serial_number, write_values = False) <NEW_LINE> try: <NEW_LINE> <INDENT> start_tim...
Helper function for reading online data. To be used as a thread, putting data to queue.
625941db67a9b606de4a818b
def delete(self, key=None): <NEW_LINE> <INDENT> if self.config["SESSION_TYPE"] == "redis": <NEW_LINE> <INDENT> if key: <NEW_LINE> <INDENT> temp_value = self.redis.get(self.sid) <NEW_LINE> if temp_value: <NEW_LINE> <INDENT> temp_value = json_to_pyseq(temp_value.decode()) <NEW_LINE> if key and key in temp_value: <NEW_LIN...
删除当前的session中的key :return:
625941dbcc0a2c11143dd164
def test_public_key_handler_rsa_store(): <NEW_LINE> <INDENT> new_public_key_payload = generate_rsa_payload() <NEW_LINE> transaction_payload = TransactionPayload() <NEW_LINE> transaction_payload.method = PubKeyMethod.STORE <NEW_LINE> transaction_payload.data = new_public_key_payload.SerializeToString() <NEW_LINE> serial...
Case: send transaction request to store certificate public key. Expect: public key information is stored to blockchain linked to owner address. Owner paid tokens for storing.
625941db26238365f5f0f145
def apply_pointed_node(it): <NEW_LINE> <INDENT> assert isinstance(it, gdb.Value), 'it not a gdb.Value' <NEW_LINE> if (template_name(it.type) == 'boost::intrusive::list_iterator' or template_name(it.type) == 'boost::intrusive::slist_iterator' or template_name(it.type) == 'boost::intrusive::tree_iterator'): <NEW_LINE> <I...
Apply iterator::pointed_node.
625941db30dc7b7665901c37
def elapseTime(self, gameState): <NEW_LINE> <INDENT> tempParticles = [] <NEW_LINE> for oldPosition in self.particles: <NEW_LINE> <INDENT> newPositionDist = self.getPositionDistribution(self.setGhostPosition(gameState, oldPosition)) <NEW_LINE> tempParticles.append(util.sample(newPositionDist)) <NEW_LINE> <DEDENT> self.p...
Update beliefs for a time step elapsing. As in the elapseTime method of ExactInference, you should use: newPosDist = self.getPositionDistribution(self.setGhostPosition(gameState, oldPos)) to obtain the distribution over new positions for the ghost, given its previous position (oldPos) as well as Pacman's current p...
625941db7d847024c06be592
def __init__(self): <NEW_LINE> <INDENT> self._values = { 'ver': 2, 'name': None, } <NEW_LINE> self._initialize()
Initializes a new instance of the class.
625941dbe64d504609d74b13
def test_verify_run_against_sample_sheet_with_missing_fastq(self): <NEW_LINE> <INDENT> os.remove(os.path.join(self.mock_illumina_data.dirn, self.mock_illumina_data.unaligned_dir, "Project_CDE","Sample_CDE4", "CDE4_AGTCAA_L002_R2_001.fastq.gz")) <NEW_LINE> illumina_data = IlluminaData(self.mock_illumina_data.dirn) <NEW_...
Verify sample sheet against a CASAVA run with a missing fastq file
625941db3539df3088e2e61e
@workspace_cli.group('backup') <NEW_LINE> @click.pass_context <NEW_LINE> def workspace_backup_cli(ctx): <NEW_LINE> <INDENT> pass
Backing and restoring workspaces - dev edition
625941dbbe7bc26dc91cd8cf
def mid_in_file(mid): <NEW_LINE> <INDENT> return in_file('mid.txt', mid)
判断mid是否已经评论 :param mid: :return:
625941db4e4d5625662d46a8
def p_mult_operand_2(p): <NEW_LINE> <INDENT> pass
mult_operand : level_one_expr power_op mult_operand
625941db01c39578d7e7510f
def intersection(self, nums1, nums2): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for c in nums1: <NEW_LINE> <INDENT> if c in nums2 and c not in result: <NEW_LINE> <INDENT> result.append(c) <NEW_LINE> <DEDENT> <DEDENT> return result
:type nums1: List[int] :type nums2: List[int] :rtype: List[int]
625941db9c8ee82313fbba49
def Bodyweight(name): <NEW_LINE> <INDENT> engine = Connection(name) <NEW_LINE> bw_df = pd.read_sql_query("SELECT * FROM Bodyweight", engine, index_col="id") <NEW_LINE> bw_df = CorrectDate(bw_df, 'Time') <NEW_LINE> bw_df['Weight'] = bw_df['Weight'].apply(lambda weight: round(weight, 1)) <NEW...
Get bodyweight data over time from database and return correctly formatted dataframe
625941dbbf627c535bc134a3
def testInvalidUncertaintyType(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> Quantity([10.0,20.0,30.0],"cm","+-*/",1.0) <NEW_LINE> self.fail("Expected a QuantityError to be raised as a result of providing an invalid uncertainty type.") <NEW_LINE> <DEDENT> except QuantityError: <NEW_LINE> <INDENT> pass
Test that the correct Quantity object is created when a set of numbers with an incorrect set of uncertainties is provided.
625941db63b5f9789fde73b9
def save_img(image, imgname, use_JPEG=False): <NEW_LINE> <INDENT> if use_JPEG: <NEW_LINE> <INDENT> imsave(imgname+".JPEG", image) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> toimage(image, cmin=0.0, cmax=1.0).save(imgname+".png")
Save image as either .jpeg or .png
625941dbf7d966606f6aa2db
def static_url(): <NEW_LINE> <INDENT> pass
Returns the Zope or static URL of a file, depending on static_mode().
625941db8a43f66fc4b54336
def set_up(self): <NEW_LINE> <INDENT> python_package = hitchpython.PythonPackage( python_version=self.settings['python_version'] ) <NEW_LINE> python_package.build() <NEW_LINE> call([ python_package.pip, 'install', '-r', path.join(PROJECT_DIRECTORY, 'requirements/local.txt') ]) <NEW_LINE> postgres_package = hitchpostgre...
Ensure virtualenv present, then run all services.
625941db91af0d3eaac9bcef
def timeit(method): <NEW_LINE> <INDENT> def timed(*args, **kw): <NEW_LINE> <INDENT> print("Start timing {} ...".format(method.__name__)) <NEW_LINE> ts = time.time() <NEW_LINE> result = method(*args, **kw) <NEW_LINE> te = time.time() <NEW_LINE> print('%r %2.2f ms' %(method.__name__, (te - ts) * 1000)) <NEW_LINE> return...
Decorator function to help identified bottleneck in the code
625941dbd486a94d0b98e41b
def run(self, start_level): <NEW_LINE> <INDENT> self.world.set_level(self.world.levels[start_level]) <NEW_LINE> self.goal = self.world.level.end_time() <NEW_LINE> time_of_death = None <NEW_LINE> level_start = pygame.time.get_ticks() / 1000 <NEW_LINE> while True: <NEW_LINE> <INDENT> time = (pygame.time.get_ticks() / 100...
Run the game loop
625941dbd99f1b3c44c6785e
def make_Radiobutton_3(self, frame): <NEW_LINE> <INDENT> self.Radiobutton_3 = Radiobutton( frame , text="Radiobutton_3", value="3", width="15") <NEW_LINE> self.Radiobutton_3.grid(row=4, column=1) <NEW_LINE> self.Radiobutton_3.configure(variable=self.RadioGroup_1_StringVar)
Radiobutton: 3 : at RadioGroup_1(4,1)
625941db9b70327d1c4e10aa
def get_stri_conf(self, conf, n): <NEW_LINE> <INDENT> Stri = {} <NEW_LINE> Stri['dir'] = conf.get('stri_%s'%n, 'dir') <NEW_LINE> Stri['color'] = conf.get('stri_%s'%n, 'color') <NEW_LINE> Stri['transparency'] = conf.getint('stri_%s'%n, 'transparency') <NEW_LINE> Stri['coor'] = conf.get('stri_%s'%n, 'coor') <NEW_LINE> St...
get the configuration for the straight line number n
625941db30bbd722463cc09c
def onehot(value, length): <NEW_LINE> <INDENT> vector = [0.1] * length <NEW_LINE> vector[int(value)] = 0.9 <NEW_LINE> return vector
Convert a single value into a onehot vector of given length. A onehot vector is a vector with all values LOW except one value which is HIGH (i.e., a vector with _one_ _hot_ value). Uses 0.1 for the LOW value and 0.9 for the HIGH value (instead of 0.0 and 1.0) to regularize network training and reduce weight magnitude...
625941db5fdd1c0f98dc0508
def edit_address(email, address_id, name, address_line_1, address_line_2, city, state, zip_code, phone_no): <NEW_LINE> <INDENT> sql = text(("select email, address_id " "from customer_address " "where email = :email and address_id = :address_id")) <NEW_LINE> with engine.connect() as conn: <NEW_LINE> <INDENT> result = co...
Checks to see if the given email/address_id combination exists; if so, updates the row in the 'customer_address' table. :returns: True if the new address fields are complete, unique, and do not violate table 'customer_address' integrity constraints, False otherwise or if the update operation ...
625941dbb57a9660fec33b5c
def eventualSafeNodes(self, graph): <NEW_LINE> <INDENT> WHITE, GRAY, BLACK, BLUE = 0, 1, 2, 3 <NEW_LINE> colors = collections.defaultdict(int) <NEW_LINE> def dfs(v): <NEW_LINE> <INDENT> if colors[v] == BLACK: <NEW_LINE> <INDENT> colors[v] = BLUE <NEW_LINE> return False <NEW_LINE> <DEDENT> colors[v] = BLACK <NEW_LINE> f...
:type graph: List[List[int]] :rtype: List[int]
625941dbe8904600ed9f2204
def get_karaokes(self, url, params, request, response): <NEW_LINE> <INDENT> karaoke_id = url[0] if len(url) else None <NEW_LINE> since = params.get_int('since', None) <NEW_LINE> lang = params.get_string('lang', None) <NEW_LINE> table = 'songs' <NEW_LINE> fields = None <NEW_LINE> condition = [] <NEW_LINE> ordering_sql =...
Get karaokes information. [API] 1) GET RESOURCE/${KARAOKE_ID} Get target karaokes detail information. 2) GET RESOURCE?type=${TYPE} Get custom information. [Arguments] url[0] : string. Song ID to find. since : int string. Response data start from. limit : int stri...
625941dbcc0a2c11143dd165
def filter_kmers(kmers, kmer_len, rate): <NEW_LINE> <INDENT> low_comp = [re.compile(base * (kmer_len//2)) for base in "ACGTN"] <NEW_LINE> i, x = -1, -1 <NEW_LINE> while x != len(low_comp): <NEW_LINE> <INDENT> i += 1 <NEW_LINE> x = sum([not p.findall(kmers[i][0]) for p in low_comp]) <NEW_LINE> <DEDENT> max_hits = kmers[...
Return a clean set of k-mers in tuple. Filter low-complexity and low-frequency kmers.
625941db4d74a7450ccd4498
def set_process_name(name): <NEW_LINE> <INDENT> global _process_name <NEW_LINE> _process_name = name <NEW_LINE> global _process_pid <NEW_LINE> _process_pid = os.getpid()
Set a name to adorn log messages with.
625941db63d6d428bbe447c4
def convert_label(label): <NEW_LINE> <INDENT> return chr(label+64)
Returns the letter that is associated with the label
625941db32920d7e50b284a6
def IsVirtual(self): <NEW_LINE> <INDENT> return self.HasFlag(ULC_VIRTUAL)
Returns ``True`` if the window has the ``ULC_VIRTUAL`` style set.
625941db91f36d47f21ac7c9
def iter(self, token, skip=None, until=None): <NEW_LINE> <INDENT> while 1: <NEW_LINE> <INDENT> if skip: self.skip(skip) <NEW_LINE> if until and self.skip(until[0]): break <NEW_LINE> r = self.scan(token) <NEW_LINE> if self.last: yield r <NEW_LINE> elif until: <NEW_LINE> <INDENT> if until[1] is True: <NEW_LINE> <INDENT> ...
Returns a generator iterator which scans for L{token} every time it is invoked. @param token: The token to scan for. @param skip: An optional token to L{skip} before each L{scan} for L{token}. @type skip: token @param until: An optional 2-tuple. If defined, the iterator will scan for L{token} until it reaches the toke...
625941db15baa723493c424b
def evaluation_1_5_ES(self) : <NEW_LINE> <INDENT> if Agent.fitnessParent < Agent.bestFitness : <NEW_LINE> <INDENT> Agent.sigma = max(min(Agent.sigmaMax, self.sigma*2), Agent.sigmaMin) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> Agent.sigma = max(2 ** (-1./4.) * self.sigma , Agent.sigmaMin) <NEW_LINE> <DEDENT> Agent....
Evaluation du parametre Sigma avec la regle des 1/5
625941db76d4e153a657ee06
def not_scratch(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapper(self, view, *args, **kwargs): <NEW_LINE> <INDENT> if not view.is_scratch(): <NEW_LINE> <INDENT> return func(self, view, *args, **kwargs) <NEW_LINE> <DEDENT> <DEDENT> return wrapper
Don't execute the given function if the view is scratched
625941db507cdc57c6306fb4
def can_rotate(self, game, direction): <NEW_LINE> <INDENT> for brick in self.bricks: <NEW_LINE> <INDENT> dx, dy = brick.get_rotation_coords(direction, self.center) <NEW_LINE> if not brick.can_move(game, dx, dy): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True
Args: game (object): game instance direction (int): -1:left 1:right Returns: True if it can, and False otherwise
625941dbf9cc0f698b1408cd
def toggle_gui_visible(self): <NEW_LINE> <INDENT> if not self.fullscreen_node.is_hidden(): <NEW_LINE> <INDENT> self.fullscreen_node.hide() <NEW_LINE> self.overlay_node.hide() <NEW_LINE> self.error_msg_handler.hide() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fullscreen_node.show() <NEW_LINE> self.overlay_node.s...
Shows / Hides the gui
625941dbd268445f265b5143
def largestNumber(self, nums): <NEW_LINE> <INDENT> def compare(a, b): <NEW_LINE> <INDENT> t1 = str(a)+str(b) <NEW_LINE> t2 = str(b)+str(a) <NEW_LINE> if t1 > t2: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> elif t1 < t2: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return 0 <NEW_LINE> <DEDENT> num = sorted(num...
:type nums: List[int] :rtype: str
625941dbdc8b845886cb580a
def render_query(self, renderer, query): <NEW_LINE> <INDENT> renderer.table_header([ dict(name="expression", type="TreeNode", max_depth=15, width=40), dict(name="query", width=100, nowrap=True), ]) <NEW_LINE> self._render_node(query, query.root, renderer)
Render a single query object's analysis.
625941db090684286d50efbc
def get_rock_ridge_facade(self): <NEW_LINE> <INDENT> if not self._initialized: <NEW_LINE> <INDENT> raise pycdlibexception.PyCdlibInvalidInput('This object is not initialized; call either open() or new() to create an ISO') <NEW_LINE> <DEDENT> if self.rock_ridge == '': <NEW_LINE> <INDENT> raise pycdlibexception.PyCdlibIn...
Return a 'facade' that simplifies some of the complexities of the PyCdlib class, while giving up some of the full power. This facade only allows manipulation of the Rock Ridge portions of the ISO. Parameters: None. Returns: A PyCdlibRockRidge object that can be used to interact with the ISO.
625941db8c0ade5d55d3ec91
def as_dict(self): <NEW_LINE> <INDENT> d = { 'segment_name': self.segment_name, 'segment_polyline': self.segment_polyline, 'segment_strava_link': self.segment.strava_link, 'entries': self.entries, } <NEW_LINE> return d
Makes instance serializable
625941dbcc40096d61595c24
def test_multiple_actions(self): <NEW_LINE> <INDENT> self.render_config_template( modules=[{ "name": "system", "metricsets": ["process"], "period": "1s" }], processors=[{ "include_fields": {"fields": ["system.process"]}, }, { "drop_fields": {"fields": ["system.process.memory"]}, }] ) <NEW_LINE> metricbeat = self.start_...
Check the result when configuring two actions: include_fields and drop_fields.
625941db8c3a873295158691
def _delete_full_key(self, full_key, lock=None): <NEW_LINE> <INDENT> if lock is None: <NEW_LINE> <INDENT> lock = self.lock <NEW_LINE> <DEDENT> with lock: <NEW_LINE> <INDENT> self._pre_delete_full_key(full_key) <NEW_LINE> del self._data[full_key]
Helper method to delete an item based on the full key. :param full_key: Full key for the item to delete. :param lock=None: Optional lock to use. If None, use self.lock. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- PURPOSE: This is a helper method to be called by the delete method or by ...
625941dba219f33f34628c3a
def test_parsenum(self): <NEW_LINE> <INDENT> nums = (-MAXSIZE, -122, -1, 0, 8, 88, 888880, MAXSIZE) <NEW_LINE> for elem in nums: <NEW_LINE> <INDENT> result = pmlr.util.parsenum(elem) <NEW_LINE> expect = MAXSIZE if elem < 0 else elem <NEW_LINE> self.assertEqual(result, expect)
test parsenum
625941db656771135c3ebb46
def _get_neg_pos_thres(self, idx, input_scores, input_names): <NEW_LINE> <INDENT> dev_scores = clean_scores(input_scores[0]) <NEW_LINE> if self._eval: <NEW_LINE> <INDENT> eval_scores = clean_scores(input_scores[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> eval_scores = {"licit_neg": [], "licit_pos": [], "spoof": [...
Get scores and threshold for the given system at index idx for vuln Returns ------- dev_neg, dev_pos, eval_neg, eval_pos: list of arrays The scores negatives and positives for each set. Each element contains two lists: licit [0] and spoof [1] threshold: int The value of the threshold computed on the `dev` ...
625941db4f6381625f114d10
def cmd_smart_complete(self, *existing_args): <NEW_LINE> <INDENT> if len(existing_args) < 2: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> command_name = existing_args[1] <NEW_LINE> existing_args = existing_args[2:] <NEW_LINE> if not existing_args: <NEW_LINE> <INDENT> self.cmd_complete_command(query=command_name) <NEW...
Smart/opinionated completion. Only completes the next missing required arg if there are any. Afterward suggests optional args.
625941db7c178a314d6ef738
def test_bool_symbol(): <NEW_LINE> <INDENT> A, B, C = map(Boolean, symbols('ABC')) <NEW_LINE> assert And(A, True) == A <NEW_LINE> assert And(A, True, True) == A <NEW_LINE> assert And(A, False) == False <NEW_LINE> assert And(A, True, False) == False <NEW_LINE> assert Or(A, True) == True <NEW_LINE> assert Or(A, False)...
Test that mixing symbols with boolean values works as expected
625941db004d5f362079a606
def preprocess_for_train(image, labels, bboxes, out_shape, data_format='NHWC', scope='ssd_preprocessing_train'): <NEW_LINE> <INDENT> fast_mode = False <NEW_LINE> with tf.name_scope(scope, 'ssd_preprocessing_train', [image, labels, bboxes]): <NEW_LINE> <INDENT> if image.get_shape().ndims != 3: <NEW_LINE> <INDENT> raise ...
Preprocesses the given image for training. Note that the actual resizing scale is sampled from [`resize_size_min`, `resize_size_max`]. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after...
625941db4527f215b584c729
def AddStageBucketFlag(parser): <NEW_LINE> <INDENT> parser.add_argument( '--stage-bucket', help=('When deploying a function from a local directory, this flag\'s ' 'value is the name of the Google Cloud Storage bucket in which ' 'source code will be stored.'), type=api_util.ValidateAndStandarizeBucketUriOrRaise)
Add flag for specifying stage bucket to the parser.
625941db9c8ee82313fbba4a
def show_reconf(self, dynreconf_widget): <NEW_LINE> <INDENT> node_grn = dynreconf_widget.get_node_grn() <NEW_LINE> rospy.logdebug('ParameditWidget.show str(node_grn)=%s', str(node_grn)) <NEW_LINE> if not node_grn in self._dynreconf_clients.keys(): <NEW_LINE> <INDENT> self._dynreconf_clients.__setitem__(node_grn, dynrec...
Callback when user chooses a node. @param dynreconf_widget:
625941dbf7d966606f6aa2dc
def softmaxResults(self): <NEW_LINE> <INDENT> exponentialSum=0 <NEW_LINE> exponentialList=[] <NEW_LINE> valueList=[] <NEW_LINE> for i in range(self.nbNeuron): <NEW_LINE> <INDENT> value=np.exp(self.neuronList[i].getInputNeuron()) <NEW_LINE> exponentialSum+=value <NEW_LINE> valueList.append(value) <NEW_LINE> <DEDENT> exp...
Return a list of all the softmax probabilities
625941dbd164cc6175783023
def test_ltioauthdatastore_no_consumers(self): <NEW_LINE> <INDENT> store = LTIOAuthDataStore(None) <NEW_LINE> self.assertIsNone(store.lookup_consumer("key1")) <NEW_LINE> self.assertIsNone(store.lookup_cert("key1"))
If consumers are not given it there are no consumer to return.
625941dbdc8b845886cb580b
def Publish(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Publishes message on behalf of specified registry
625941db85dfad0860c3b130
def get_file_obj_from_zip(fullpath): <NEW_LINE> <INDENT> with zipfile.ZipFile(fullpath, "r") as jfile: <NEW_LINE> <INDENT> exported_name = "" <NEW_LINE> for name in jfile.namelist(): <NEW_LINE> <INDENT> if name.endswith('.json'): <NEW_LINE> <INDENT> exported_name = name <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> if ...
fullpath must point to a zip file. usage: nodes_json = get_file_obj_from_zip(fullpath) print(nodes_json['export_version'])
625941dbd6c5a10208144321
@login_required <NEW_LINE> @user_passes_test(is_admin) <NEW_LINE> def get_form_update_waypoint_group(request, id_waypoint_group): <NEW_LINE> <INDENT> if request.is_ajax() and request.method == 'GET': <NEW_LINE> <INDENT> waypoint_group = get_object_or_404(WaypointGroup, pk=id_waypoint_group) <NEW_LINE> init_update = {'i...
View that is called via ajax to render the form to confirm the deletion of a waypoint_group.
625941db3d592f4c4ed1d33c
def to_string(self, version=1): <NEW_LINE> <INDENT> return ElementTree.tostring(self._to_tree(version))
Converts this object to XML.
625941db50812a4eaa59c5f4
def find_quaternion_for_position(self, endeffector_position, additional_yaw, additional_pitch): <NEW_LINE> <INDENT> vector = geometry_msgs.msg.Point() <NEW_LINE> vector.x = self.camera_position_x - endeffector_position.x <NEW_LINE> vector.y = self.camera_position_y - endeffector_position.y <NEW_LINE> vector.z = self.ca...
This function will find the orientation for a given position. First the orientation is calculated so that the calibration object is orthogonal to the camera. Then the additional yaw and pitch is added. :param endeffector_position: The position for the endeffector :type endeffector_position: geometry_msgs.msg.Pose.Po...
625941db2eb69b55b151cb87
def configure_logging(self): <NEW_LINE> <INDENT> logger = logging.getLogger("ssl_proxy") <NEW_LINE> logger.setLevel(logging.DEBUG) <NEW_LINE> logger.propagate = False <NEW_LINE> self.handler = MementoHandler() <NEW_LINE> logger.addHandler(self.handler) <NEW_LINE> self.addCleanup(logger.removeHandler, self.handler)
Configure logging for the tests.
625941dbff9c53063f47c4c7
def modeScaler(self, latestCount): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.__accumCts += latestCount <NEW_LINE> self.__runtime += 1 <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> return
Take samples continuously and keep running until the program is killed or runs out of time.
625941db435de62698dfdf22
def put_file_bytes(self, commit, path, value, delimiter=NONE, target_file_datums=0, target_file_bytes=0): <NEW_LINE> <INDENT> if _is_iterator(value): <NEW_LINE> <INDENT> def _wrap(v): <NEW_LINE> <INDENT> for x in v: <NEW_LINE> <INDENT> yield PutFileRequest(file=File(commit=_commit_from(commit), path=path), value=x, del...
Uploads a binary bytes array as file(s) in a certain path :param commit: A tuple or string representing the commit :param path: Path in the repo the file(s) will be written to :param value: The data bytes array, or an iterator returning chunked byte arrays :param delimiter: Optional. causes data to be broken up into se...
625941db16aa5153ce36274c
def balance_dataset(ds): <NEW_LINE> <INDENT> y = ds[2] <NEW_LINE> class1 = np.where(y == 1)[0] <NEW_LINE> n_imbal = np.sum(y == 0) - np.sum(y == 1) <NEW_LINE> s0 = list(ds[0]) <NEW_LINE> s1 = list(ds[1]) <NEW_LINE> labels = list(ds[2]) <NEW_LINE> has_toklabels = len(ds) > 3 <NEW_LINE> if has_toklabels: <NEW_LINE> <INDE...
Supersample 1-labelled items to achieve a balanced dataset with random classifier giving 50%. This makes sense only for datasets with crisp 0/1 labels!
625941db30bbd722463cc09d
def test_is_valid_valid_wait_time(self): <NEW_LINE> <INDENT> c = Call('channel', wait_time=0) <NEW_LINE> self.assertTrue(c.is_valid())
Ensure `is_valid` works using a valid `wait_time` attribute.
625941db3317a56b86939f27
def split(delimiters, text): <NEW_LINE> <INDENT> import re <NEW_LINE> regex_pattern = '|'.join(map(re.escape, delimiters)) <NEW_LINE> return re.split(regex_pattern, text, 0)
Splits a string using all the delimiters supplied as input string :param delimiters: :param text: string containing delimiters to use to split the string, e.g. `,;? ` :return: a list of words from splitting text using the delimiters
625941dbd7e4931a7ee9e1f3
def generate_connectivity_matrix(time_series, kind='correlation'): <NEW_LINE> <INDENT> connectivity_measure = ConnectivityMeasure(kind=kind) <NEW_LINE> connectivity_matrix = connectivity_measure.fit_transform([time_series])[0] <NEW_LINE> return connectivity_matrix
Generate a connectivity matrix from a collection of time series. param :kind: Any kind accepted by nilearn ConnectivityMeasure
625941dbcad5886f8bd272ae
def test_wrongsyn(): <NEW_LINE> <INDENT> assert _socli.wrongsyn("sdf") == None
socli.wrongsyn() detects `"sdf"` as non-empty string
625941db046cf37aa974d01a
def matchHUC(string, HUCval=12): <NEW_LINE> <INDENT> match = re.search(r'\D(\d{' + str(HUCval) + '})(?!\d)', string) <NEW_LINE> return match.group(1)
Return the first 12digit value within a string
625941db23849d37ff7b3362
def delete_snapshot(self, snapshot): <NEW_LINE> <INDENT> LOG.debug("Enter in delete a disco snapshot.") <NEW_LINE> snap_id = snapshot['provider_location'] <NEW_LINE> LOG.debug("[start] Delete snapshot : %s.", snap_id) <NEW_LINE> reply = self.client.service.snapshotDelete(snap_id) <NEW_LINE> status = reply['status'] <NE...
Delete a disco snapshot.
625941dbac7a0e7691ed439c
def GetCareMap(which, imgname): <NEW_LINE> <INDENT> assert which in common.PARTITIONS_WITH_CARE_MAP <NEW_LINE> image_size = OPTIONS.info_dict.get(which + "_image_size") <NEW_LINE> if not image_size: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> image_blocks = int(image_size) // 4096 - 1 <NEW_LINE> assert image_bl...
Returns the care_map string for the given partition. Args: which: The partition name, must be listed in PARTITIONS_WITH_CARE_MAP. imgname: The filename of the image. Returns: (which, care_map_ranges): care_map_ranges is the raw string of the care_map RangeSet; or None.
625941db8a43f66fc4b54337
def hashFile(path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> longlongformat = 'Q' <NEW_LINE> bytesize = struct.calcsize(longlongformat) <NEW_LINE> fmt = "<%d%s" % (65536 // bytesize, longlongformat) <NEW_LINE> f = open(path, "rb") <NEW_LINE> filesize = os.fstat(f.fileno()).st_size <NEW_LINE> filehash = filesize <NE...
Produce a hash for a video file: size + 64bit chksum of the first and last 64k (even if they overlap because the file is smaller than 128k)
625941db3cc13d1c6d3c764e
def scheme_apply(procedure, args, env): <NEW_LINE> <INDENT> if isinstance(procedure, PrimitiveProcedure): <NEW_LINE> <INDENT> return apply_primitive(procedure, args, env) <NEW_LINE> <DEDENT> elif isinstance(procedure, LambdaProcedure): <NEW_LINE> <INDENT> func_frame = procedure.env.make_call_frame(procedure.formals, ar...
Apply Scheme PROCEDURE to argument values ARGS in environment ENV.
625941db4a966d76dd5512e6
def majorityCnt(classList): <NEW_LINE> <INDENT> import operator <NEW_LINE> classCount = {} <NEW_LINE> for vote in classList: <NEW_LINE> <INDENT> if vote not in classCount.keys(): <NEW_LINE> <INDENT> classCount[vote] = 0 <NEW_LINE> <DEDENT> classCount[vote] += 1 <NEW_LINE> <DEDENT> sortedClassCount = sorted( classCount....
采用多数表决的方法决定叶结点的分类 :param: 所有的类标签列表 :return: 出现次数最多的类
625941db1d351010ab855df0
def get_worst_flag_level(self): <NEW_LINE> <INDENT> return Flagable.get_worst_flag_level(self, self.get_relavent_flags())
Determines the worst flag present in the provided flags. If no flags are given then a 'minor' value is returned. No argument version of parent function.
625941db55399d3f0558898a
def validate(self): <NEW_LINE> <INDENT> resultOfValidate = self.userPrefsCfg.validate(self._validator, copy=True) <NEW_LINE> self.restoreBadPrefs(self.userPrefsCfg, resultOfValidate)
Validate (user) preferences and reset invalid settings to defaults
625941db23e79379d52ee836
def prepare_data(self): <NEW_LINE> <INDENT> processed_data = [] <NEW_LINE> for row in self.raw_data: <NEW_LINE> <INDENT> data_row = list(map(float, row[2:])) <NEW_LINE> processed_data.append(data_row) <NEW_LINE> <DEDENT> return processed_data
Delete id and title of movie from database
625941db91af0d3eaac9bcf0
def remove_all(self, delete=False): <NEW_LINE> <INDENT> return self.remove(self.all_questions(), delete)
Removes all questions from a queue, does not delete questions by default. delete Boolean indicating whether questions are deleted
625941dbad47b63b2c50a253
def setTitle(self, title): <NEW_LINE> <INDENT> self._title_widget.setText(title)
Set the title of the widget.
625941dbd53ae8145f87a540
def find_module(id: str, lib_path_arg: Iterable[str]) -> str: <NEW_LINE> <INDENT> lib_path = tuple(lib_path_arg) <NEW_LINE> def find() -> Optional[str]: <NEW_LINE> <INDENT> components = id.split('.') <NEW_LINE> dir_chain = os.sep.join(components[:-1]) <NEW_LINE> if (dir_chain, lib_path) not in find_module_dir_cache: <N...
Return the path of the module source file, or None if not found.
625941dbd18da76e235327ad
def test_negate(self): <NEW_LINE> <INDENT> test1 = "I don't like it" <NEW_LINE> test2 = "I do like it" <NEW_LINE> test3 = "It aint a good movie" <NEW_LINE> test4 = "This is the least good movie ever" <NEW_LINE> test5 = "I mean at least its a good movie" <NEW_LINE> self.assertEqual(TweetSentiment.negate(test1.split(' ')...
Tests the negate function 1. Simple negation word 2. Doesn't contain a negation word 3. Uses a misspelt word that is contained in the negation list 4. checks the least negation word 5. checks whether it was "at least" which should not negate the word
625941dbde87d2750b86006a
def _p_lsub(self): <NEW_LINE> <INDENT> self._p_simple_string(' ') <NEW_LINE> self.mailbox_name = self._p_mailbox() <NEW_LINE> self._p_simple_string(' ') <NEW_LINE> self.list_mailbox = self._p_list_mailbox()
lsub ::= 'LSUB' SPACE mailbox SPACE list_mailbox
625941db6e29344779a628e5
def ts_max(value: Series, period: int) -> Series: <NEW_LINE> <INDENT> return value.rolling(window=period, min_periods=period).max()
기간최댓값 <설명> 기간최댓값(ts_max)은 특정 기간(period)동안 값(value)들 중 최댓값을 구하는 함수입니다. <사용 방법> 첫 번째 인자는 기간최댓값(ts_max)을 구하고자 하는 값을, 두 번째 인자는 기간최댓값(ts_max)을 구하는데 사용하고자 하는 기간을 적으면 됩니다. 예를 들어, 최근 5일간 종가 중 최댓값을 구하고자 하는 경우에는 'ts_max(close, 5)' 또는 '기간최댓값(종가, 5)'와 같이 작성하면 됩니다. :param value: (데이터) 기간최댓값(ts_max)을 구하고자 하는 값 :param period: (기간)...
625941db379a373c97cfae1b
def run(self): <NEW_LINE> <INDENT> self.running = True <NEW_LINE> self.load_config() <NEW_LINE> if 'handlers_path' in self.config['server']: <NEW_LINE> <INDENT> handlers_path = self.config['server']['handlers_path'] <NEW_LINE> self.load_include_path([handlers_path]) <NEW_LINE> <DEDENT> self.load_handlers() <NEW_LINE> i...
Load handler and collector classes and then start collectors
625941dbf548e778e58cd854
def _get_node_instance_result(self, node_instance): <NEW_LINE> <INDENT> agent = node_instance.runtime_properties.get('cloudify_agent', {}) <NEW_LINE> broker_conf = { 'broker_ip': agent.get('broker_ip', broker_config.broker_hostname), 'broker_ssl_cert': self._broker_ssl_cert, 'broker_ssl_enabled': True } <NEW_LINE> retu...
Fill in the broker config info from the cloudify_agent dict, using the info from the bootstrap context as the fallback defaults
625941db3c8af77a43ae3a77
def request(self, url, data=None, headers=None, format='urlencoded', method='GET', content_type=None, token=None): <NEW_LINE> <INDENT> headers = dict(headers or {}) <NEW_LINE> if not token: <NEW_LINE> <INDENT> token = self.get_request_token() <NEW_LINE> <DEDENT> client = self.make_client(token) <NEW_LINE> url = self.ex...
Sends a request to the remote server with OAuth tokens attached. :param data: the data to be sent to the server. :param headers: an optional dictionary of headers. :param format: the format for the `data`. Can be `urlencoded` for URL encoded data or `json` for JSON. :param method: the HTTP request metho...
625941dbbf627c535bc134a4
def update(self, model, data): <NEW_LINE> <INDENT> J = np.zeros((len(data), len(model.get_param()))) <NEW_LINE> for i in range(len(data)): <NEW_LINE> <INDENT> J[i] = model.residual_gradient(data[i]) <NEW_LINE> <DEDENT> AH = np.dot(J.T, J) <NEW_LINE> AHInv = LA.pinv(AH) <NEW_LINE> R = np.array([model.residual( data[i]) ...
ガウスニュートン法でパラメータを更新する Args: model: データが従っているとされるモデル(modelsモジュール) data: 観測データ(numpy.array) Returns: 更新されたパラメータ(numpy.array)
625941db57b8e32f52483772
def getParameter(self, parameterName, index=-1): <NEW_LINE> <INDENT> assert not (parameterName in self.__dict__ and parameterName in self.ephemeral) <NEW_LINE> if parameterName in self.ephemeral: <NEW_LINE> <INDENT> assert parameterName not in self.__dict__ <NEW_LINE> return self.ephemeral[parameterName] <NEW_LINE> <DE...
Get the value of a NodeSpec parameter. Most parameters are handled automatically by PyRegion's parameter get mechanism. The ones that need special treatment are explicitly handled here.
625941dbc4546d3d9de72d0b
def copyrendersettings(scena, scenb): <NEW_LINE> <INDENT> scena.render.resolution_x = scenb.render.resolution_x <NEW_LINE> scena.render.resolution_y = scenb.render.resolution_y <NEW_LINE> scena.render.resolution_percentage = scenb.render.resolution_percentage <NEW_LINE> scena.rend...
Copy render settings for scene A to match original scene B
625941db2c8b7c6e89b35a94
def lock(self): <NEW_LINE> <INDENT> pass
Use with care. If locked, it must be unlocked before returning
625941db498bea3a759b9d84
def write_pipe( symboltable, arg=list(), kwarg=dict()): <NEW_LINE> <INDENT> code = list() <NEW_LINE> if len(arg)>1: <NEW_LINE> <INDENT> value = symboltable.getVar( arg[1] ) <NEW_LINE> code.append(" LDWR {0}".format(value.name)) <NEW_LINE> <DEDENT> code.append(" WRITEPIPE") <NEW_LINE> return code
write_pipe( parameter ) Write parameter to pipe to computer.
625941db8e71fb1e9831da7d
def store_test_data(self, json_data, error=None): <NEW_LINE> <INDENT> date_loaded = utils.get_now_timestamp() <NEW_LINE> error_flag = "N" if error is None else "Y" <NEW_LINE> error_msg = error or "" <NEW_LINE> self.sources["objectstore"].dhub.execute( proc='objectstore.inserts.store_json', placeholders=[ date_loaded, j...
Write the JSON to the objectstore to be queued for processing.
625941db66656f66f7cbc481
@monitor.command() <NEW_LINE> @click.argument('fqdn') <NEW_LINE> def disable(fqdn): <NEW_LINE> <INDENT> host_id = get_host_id(fqdn) <NEW_LINE> if host_id == "not found": <NEW_LINE> <INDENT> click.echo('Host not found in Zabbix : %s' % fqdn) <NEW_LINE> sys.exit(0) <NEW_LINE> <DEDENT> response = zapi.host.update( hostid=...
Disable monitoring for a host.
625941db4428ac0f6e5baac9
def construct_graph(self, input_seq_pl, dropout, test=False, just_middle=False): <NEW_LINE> <INDENT> return input_seq_pl
Get the output of the autoencoder This is a dummy function, it has to be defined in each specific class, inheriting class AE Args: input_seq_pl: tf placeholder for ae input data: [batch_size, sequence_length, DoF] dropout: how much of the input neurons will be activated, value in [0,1] just_middle ...
625941db9f2886367277ab61
def get_plate_contours(img, conf): <NEW_LINE> <INDENT> x1, y1, x2, y2 = np.asarray(np.matrix(conf['precrop'])[0])[0] <NEW_LINE> img = img[y1:y2, x1:x2] <NEW_LINE> img = cv2.warpPerspective(img, np.matrix(conf['prewarp']), img.shape[::-1]) <NEW_LINE> img = cv2.GaussianBlur(img, (3, 3), 0) <NEW_LINE> _, threshold_image =...
Find contours in the image `img`
625941db167d2b6e31218e6a
def isValidSerialization(self, preorder): <NEW_LINE> <INDENT> tokens = preorder.split(',') <NEW_LINE> degree = 1 <NEW_LINE> for token in tokens: <NEW_LINE> <INDENT> degree -= 1 <NEW_LINE> if degree < 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if token != '#': <NEW_LINE> <INDENT> degree += 2 <NEW_LINE> <DED...
:type preorder: str :rtype: bool
625941db711fe17d8254263a
@register.assignment_tag <NEW_LINE> def profile(qs, **kwargs): <NEW_LINE> <INDENT> if qs.is_authenticated(): <NEW_LINE> <INDENT> return get_object_or_404( UserProfile, user=qs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0
template tag which allows queryset filtering. Usage: {% query books author=author as mybooks %} {% for book in mybooks %} ... {% endfor %}
625941db596a897236089d93
def get_regex(self): <NEW_LINE> <INDENT> return self.data['regex']
get regural expression
625941db7b25080760e3972d
def featurize_context(conll, wordvecs, size=0): <NEW_LINE> <INDENT> featurized = [] <NEW_LINE> prev = None <NEW_LINE> for i, row in enumerate(conll): <NEW_LINE> <INDENT> if not row: <NEW_LINE> <INDENT> featurized.append([]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tag, feats = row[-1], [] <NEW_LINE> for j in range...
Create features of vectors for word and context words in a window of given size.
625941db5510c4643540f6b3
def specwv(fx,tstep=2**5,nfbins=2**10,nhs=2**8,nhwv=2**9-1,ngwv=2**3-1,df=1.0): <NEW_LINE> <INDENT> pst,tlst,flst=stft(fx,nh=nhs,tstep=tstep,nfbins=nfbins,df=df) <NEW_LINE> ntstep=len(fx)/(len(tlst)*2.) <NEW_LINE> pwv,twv,fwv=spwvd(fx,tstep=ntstep,nfbins=nfbins,df=df,nh=nhwv,ng=ngwv) <NEW_LINE> tfarray=pst/pst.max()*pw...
specwv(f,tstep=2**5,nfbins=2**10,nh=2**8-1,ng=1,df=1.0) will calculate the Wigner-Ville distribution mulitplied by the STFT windowed by the common gaussian window h for a function f. Inputs: fx = array to compute the specwv tstep = time step between windows nfbins = number of frequencies nhs = len...
625941db009cb60464c63685
def url(rel): <NEW_LINE> <INDENT> return url_root + rel
url for relative rel_link.
625941db3346ee7daa2b3043
def test_ellipse(): <NEW_LINE> <INDENT> random_state = check_random_state(0) <NEW_LINE> mean = np.array([0.0, 1.0]) <NEW_LINE> covariance = np.array([[0.5, 0.0], [0.0, 5.0]]) <NEW_LINE> mvn = MVN(mean=mean, covariance=covariance, random_state=random_state) <NEW_LINE> angle, width, height = mvn.to_ellipse() <NEW_LINE> a...
Test equiprobable ellipse.
625941dbbd1bec0571d90904