code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def post_assignment_with_grades(self, section_id, assignment_name, assignment_date, total_marks_possible, category_id, grading_scale_id, student_ids_and_grades_list): <NEW_LINE> <INDENT> new_assignment = self.post_assignment(section_id, assignment_name, assignment_date, total_marks_possible, category_id, grading_scale_...
POST new assignment and then POST grades to this same assignment. Please note that this method is dependant on post_assignment and post_grades. As a result, it will return the response of both of these methods. The final value returned is the status of the POST grades request
625941d632920d7e50b283f9
def __call__(self, x): <NEW_LINE> <INDENT> PADDING = 0 <NEW_LINE> STRIDE = 1 <NEW_LINE> channels = x.shape[0] <NEW_LINE> encoder = PoissonEncoder(time=self.time_per_patch, dt=self.dt) <NEW_LINE> patch_h, patch_w = self.patch_shape <NEW_LINE> input_size = channels * patch_h * patch_w <NEW_LINE> x_t = x.transpose(1, 2) <...
Make patches x: 3D tensor of size (channels, height, width), normalized to [0,1]
625941d655399d3f055888dc
def testdes_Sites(self): <NEW_LINE> <INDENT> pass
Destructor: >>> redun = RedundancyCom95() >>> seq1 = Fasta("n1", "AGTGCC") >>> seq2 = Fasta("n2", "TTGCAG") >>> sites = Sites(redun, seq1, seq2) >>> del sites
625941d6cc40096d61595b78
def create_requirements( self ): <NEW_LINE> <INDENT> requirements_node = self.doc.createElement("requirements") <NEW_LINE> requirement_node = self.doc.createElement("requirement") <NEW_LINE> requirement_node.setAttribute("type", "binary") <NEW_LINE> requirement_text_node = self.doc.createTextNode('@EXECUTABLE@') <NEW_L...
<requirements> <requirement type="binary">@EXECUTABLE@</requirement> <requirement type="package" version="1.1.1">TODO</requirement> </requirements>
625941d6796e427e537b07ef
def splitlinegraph(): <NEW_LINE> <INDENT> print("Split Graph Initalizing") <NEW_LINE> time.sleep(3) <NEW_LINE> b = pd.read_csv("src\kjpcjs.csv") <NEW_LINE> print("Split Line Graph Initialized") <NEW_LINE> b['Week'] = pd.to_datetime(b['Week']) <NEW_LINE> data_date = b['Week'] <NEW_LINE> java_data = b['Java'] <NEW_LINE> ...
Here we are going to plot seperated line graph.
625941d673bcbd0ca4b2c29e
def setTolerance(self, tolerance): <NEW_LINE> <INDENT> if not self.proxy: <NEW_LINE> <INDENT> self.proxy = ALProxy("ALGazeAnalysis") <NEW_LINE> <DEDENT> return self.proxy.setTolerance(tolerance)
Sets the tolerance (between 0 and 1) for deciding whether or not a person is looking at the robot after face analysis. This tolerance is used only when face analysis is enabled. :param float tolerance: New value of the tolerance (between 0 and 1).
625941d68e7ae83300e4b1f4
def __is_kms_response_with_plaintext(self, record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return all( ( record.name == "botocore.parsers", record.msg.startswith("Response body:"), b"KeyId" in cast(tuple, record.args)[0], b"Plaintext" in cast(tuple, record.args)[0], ) ) <NEW_LINE> <DEDENT> except Exception: <NEW_...
Determine if a record contains a KMS response with plaintext. :param record: Logging record to filter :type record: logging.LogRecord :rtype: bool
625941d6a79ad161976cc36d
def update_table_widget(self, new_usb_table): <NEW_LINE> <INDENT> self.block_device_table_widget.clear() <NEW_LINE> self.block_device_table_widget.setHorizontalHeaderLabels(self.block_header) <NEW_LINE> self.block_device_table_widget.setRowCount(len(new_usb_table)) <NEW_LINE> i = 0 <NEW_LINE> for device in new_usb_tabl...
Update connected devices table
625941d6656771135c3eba98
def get_data(db, sql): <NEW_LINE> <INDENT> table = db['smells'] <NEW_LINE> return all_rows
Get data from a database using the connection and cursor and defined sql.Output the data in a python list.
625941d64f6381625f114c63
def numberOfPorts(self): <NEW_LINE> <INDENT> idnString = self._ontRemote.receiveScpi('*idn?') <NEW_LINE> moduleName = idnString.split(',')[1] <NEW_LINE> modName = moduleName.upper() <NEW_LINE> result = 0 <NEW_LINE> if 'CFP2' in modName: <NEW_LINE> <INDENT> if 'DATA D' in modName or 'PHYD D' in modName: <NEW_LINE> <INDE...
Return the number of ports supported by this module. Note: When called for a module which is not a CFP2 module '0' is returned.
625941d616aa5153ce36269f
def test_against_myself(): <NEW_LINE> <INDENT> from pycoin_grs.contrib.msg_signing import ( parse_signed_message, sign_message, verify_message) <NEW_LINE> from pycoin_grs.encoding import bitcoin_address_to_hash160_sec_with_prefix <NEW_LINE> from pycoin_grs.encoding import wif_to_tuple_of_secret_exponent_compressed <NEW...
Test code that verifies against ourselves only. Useful but not so great.
625941d6d4950a0f3b08c575
def _filter_player_ids(self, client, player_ids): <NEW_LINE> <INDENT> players = [] <NEW_LINE> for player in self._iter(): <NEW_LINE> <INDENT> if self._get_player_id(player) not in player_ids: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if not self.feature.filter(client, player): <NEW_LINE> <INDENT> continue <NEW_L...
Filter out invalid IDs from the given list. :param client: Client that performs the action. :param list player_ids: Unfiltered list of IDs. :return: Filtered list of :class:`players.entity.Player` instances. :rtype: list
625941d6ac7a0e7691ed42f1
def test_one_req_one_acc_reject_trans(self): <NEW_LINE> <INDENT> context_a = PresentationContext(1, '1.2.840.10008.5.1.4.1.1.2', ['1.2.840.10008.1.2', '1.2.840.10008.1.2.1']) <NEW_LINE> context_b = PresentationContext(None, '1.2.840.10008.5.1.4.1.1.2', ['1.2.840.10008.1.2.2']) <NEW_LINE> result = self.test_func([contex...
Test negotiation one req/acc, matching rejected trans
625941d6004d5f362079a55a
def get_collection(self, filters=['Collection']): <NEW_LINE> <INDENT> found_values = [] <NEW_LINE> page_paragraphs = self.parsed_page.find_all( "p", {"class": "collection-text-label"}) <NEW_LINE> for value in page_paragraphs: <NEW_LINE> <INDENT> for filtered_value in filters: <NEW_LINE> <INDENT> if filtered_value in va...
Returns the collection name(s) as a list of strings It can also return the containers the item is found in, by setting the filtered_value to 'Case'
625941d6ec188e330fd5a9c4
def get_instance(self, payload): <NEW_LINE> <INDENT> return MemberInstance( self._version, payload, account_sid=self._solution['account_sid'], queue_sid=self._solution['queue_sid'], )
Build an instance of MemberInstance :param dict payload: Payload response from the API :returns: MemberInstance :rtype: MemberInstance
625941d6baa26c4b54cb1346
def jump(nums): <NEW_LINE> <INDENT> if not nums or len(nums) < 2: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> n = len(nums) <NEW_LINE> s, t, steps = 1, nums[0], 0 <NEW_LINE> while t < n - 1: <NEW_LINE> <INDENT> newT = t <NEW_LINE> for i in range(s, t + 1): <NEW_LINE> <INDENT> newT = max(newT, i + nums[i]) <NEW_LIN...
:type nums: List[int] :rtype: int
625941d67d43ff24873a2ec8
def _execute(self, bits: numpy.ndarray) -> Result: <NEW_LINE> <INDENT> bits_copy: numpy.ndarray = bits.copy() <NEW_LINE> bits_copy[bits_copy == 0] = -1 <NEW_LINE> forward_sum: int = 0 <NEW_LINE> backward_sum: int = 0 <NEW_LINE> forward_max: int = 0 <NEW_LINE> backward_max: int = 0 <NEW_LINE> for i in range(bits_copy.si...
Overridden method of Test class: check its docstring for further information.
625941d63c8af77a43ae39c9
def filter_lt(self, value) -> "Iter[T]": <NEW_LINE> <INDENT> return self.filter(lambda x: x < value)
Convenience method .. code-block:: python >>> Iter([1,2,3]).filter_lt(3).collect() [1, 2]
625941d63617ad0b5ed6811e
def test_global(self): <NEW_LINE> <INDENT> typo, good = 'this_is_a_global_lis', 'this_is_a_global_list' <NEW_LINE> this_is_a_global_list <NEW_LINE> self.assertFalse(good in locals()) <NEW_LINE> self.assertTrue(good in globals()) <NEW_LINE> sugg = "'{0}' (global)".format(good) <NEW_LINE> self.throws(typo, NAMEERROR, sug...
Should be this_is_a_global_list.
625941d69c8ee82313fbb99e
def set_bounds_from_bbox(self, bbox): <NEW_LINE> <INDENT> self.set_latlon_bounds(bbox) <NEW_LINE> minx, miny, maxx, maxy = [float(c) for c in bbox] <NEW_LINE> x = (minx + maxx) / 2 <NEW_LINE> y = (miny + maxy) / 2 <NEW_LINE> (center_x, center_y) = forward_mercator((x, y)) <NEW_LINE> xdiff = maxx - minx <NEW_LINE> ydiff...
Calculate zoom level and center coordinates in mercator.
625941d6435de62698dfde75
def readGSE2(filename, headonly=False, verify_chksum=True, **kwargs): <NEW_LINE> <INDENT> traces = [] <NEW_LINE> f = open(filename, 'rb') <NEW_LINE> for _k in xrange(10000): <NEW_LINE> <INDENT> pos = f.tell() <NEW_LINE> widi = f.readline()[0:4] <NEW_LINE> if widi == '': <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> eli...
Reads a GSE2 file and returns a Stream object. GSE2 files containing multiple WID2 entries/traces are supported. .. warning:: This function should NOT be called directly, it registers via the ObsPy :func:`~obspy.core.stream.read` function, call this instead. :type filename: string :param filename: GSE2 file ...
625941d68a43f66fc4b5428b
def test_multi_level_mask(self): <NEW_LINE> <INDENT> multi_level = MQTTUtils.convert_to_ereg('foo/bar/#', allow_wildcards=True) <NEW_LINE> self.assertIsMatch(multi_level, 'foo/bar') <NEW_LINE> self.assertIsMatch(multi_level, 'foo/bar/') <NEW_LINE> self.assertIsMatch(multi_level, 'foo/bar//') <NEW_LINE> self.assertIsMat...
tests for access_control.Authorization.is_subscription_allowed
625941d69f2886367277aab4
def vrrp_transmit(app, monitor_name, data): <NEW_LINE> <INDENT> transmit_request = vrrp_event.EventVRRPTransmitRequest(data) <NEW_LINE> app.send_event(monitor_name, transmit_request)
transmit a packet from the switch. this is internal use only. data is str-like, a packet to send.
625941d67047854f462a1630
def geometry_film(g,nz=1): <NEW_LINE> <INDENT> go = g.supercell([1,1,nz]) <NEW_LINE> go.dimensionality = 2 <NEW_LINE> go = sculpt.set_xy_plane(go) <NEW_LINE> go.get_fractional(center=True) <NEW_LINE> go.fractional2real() <NEW_LINE> return go
Create the geometry of a film
625941d65fc7496912cc3ba6
def test_login_with_a_wrong_password(self): <NEW_LINE> <INDENT> with self.client: <NEW_LINE> <INDENT> response_register = self.client.post( '/api/v2/auth/register', data=json.dumps(dict( name='Stacy Mboya', email='stacy@gmail.com', username='stacy', password='Mermaid12' )), content_type='application/json' ) <NEW_LINE> ...
Test login with wrong password
625941d63c8af77a43ae39ca
def on_close_child_widget(self): <NEW_LINE> <INDENT> self.dockwidget.treeView.doubleClicked.disconnect(self.run_script) <NEW_LINE> self.dockwidget.closingWidget.disconnect(self.on_close_child_widget) <NEW_LINE> self.dock_widget = None <NEW_LINE> self.pluginIsActive = False
Cleanup necessary items here when plugin dockwidget is closed
625941d6bd1bec0571d90858
def keep_true_keypoints(points, H, shape): <NEW_LINE> <INDENT> warped_points = warp_keypoints(points[:, [0, 1]], H) <NEW_LINE> warped_points[:, [0, 1]] = warped_points[:, [0, 1]] <NEW_LINE> mask = (warped_points[:, 0] >= 0) & (warped_points[:, 0] < shape[0]) & (warped_points[:, 1] >= 0) & (warped_points[:...
Keep only the points whose warped coordinates by H are still inside shape.
625941d6d10714528d5fff0d
def processEvent(self, event): <NEW_LINE> <INDENT> name, obj = event <NEW_LINE> if self.strict and name not in self._registered_events: <NEW_LINE> <INDENT> raise EventNotFound('The event "%s" was not registered' % name) <NEW_LINE> <DEDENT> inhibits = set() <NEW_LINE> try: <NEW_LINE> <INDENT> links = self._event_handler...
Process an incoming event
625941d6fb3f5b602dac38be
def save(self): <NEW_LINE> <INDENT> new_user = super(SignupFormExtra, self).save() <NEW_LINE> new_user.first_name = self.cleaned_data['first_name'] <NEW_LINE> new_user.last_name = self.cleaned_data['last_name'] <NEW_LINE> new_user.save() <NEW_LINE> return new_user
Override the save method to save the first and last name to the user field.
625941d6f548e778e58cd7a7
def test_update_category(self): <NEW_LINE> <INDENT> update_category = getattr(category, 'update_category') <NEW_LINE> random_number = self.random_number + 1000 <NEW_LINE> category_name = 'test'.__add__(str(random_number)) <NEW_LINE> logger.debug("category_name: {}".format(category_name)) <NEW_LINE> runner = CliRunner()...
expects to update a category using the self.category_id and a random name from the setUp function
625941d660cbc95b062c676c
def convert_tag_list_to_nested_list(tag_list): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ret = [tag_list[0]] <NEW_LINE> for i in range(1, len(tag_list)): <NEW_LINE> <INDENT> eval('ret{}.append([tag_list[i]])'.format((i-1)*'[1]')) <NEW_LINE> <DEDENT> return ret <NEW_LINE> <DEDENT> except Exception as err: <NEW_LINE> ...
Convert a list of tags to the corresponding nested tags returns: list with this format [tag1, [tag11, [tag111]]]
625941d6d53ae8145f87a496
def __init__(self, filepath): <NEW_LINE> <INDENT> self.__filepath__ = filepath <NEW_LINE> self.__inc_chunks__ = [] <NEW_LINE> self.__parse__()
Initialize the IncReco object Arguments: filepath -- the path to an inc_reco file
625941d63617ad0b5ed6811f
def __get_experiment_time_string(self, rec_time): <NEW_LINE> <INDENT> return str(int(round(rec_time * 1000)) - self.start_time)
Returns the current experiment time as string
625941d67c178a314d6ef68a
def read_grid_ang(filename): <NEW_LINE> <INDENT> grid_data = np.loadtxt(filename) <NEW_LINE> x,y,z,dat = extract_grid_ang(grid_data) <NEW_LINE> return x,y,z,dat
read data on regular grid in format: x y z data[x,y,z] return X,Y,Z,DATA
625941d624f1403a92600d8d
def optimize(self, parameters, loss, max_iters=1, verbose=False, *args, **kwargs): <NEW_LINE> <INDENT> self.optimizer = GPyOpt.methods.BayesianOptimization(f=loss, model_type='GP', acquisition_type='EI', acquisition_optimizer_type='lbfgs', num_cores=self.num_workers, verbosity=verbose, maximize=self.is_maximizing, verb...
Optimize the given loss function with respect to the given parameters. Args: parameters: parameters. loss: callable objective / loss function to minimize. max_iters (int): number of maximum iterations. verbose (bool): if True, it will display information during the optimization process. *args: list...
625941d656b00c62f0f14883
def get_text_fields(self): <NEW_LINE> <INDENT> if len(self.textmkup) > 0: <NEW_LINE> <INDENT> return [self.textid, self.textlede, str(self.textdate), self.textcmt, self.textbiblio, self.textmkup] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [self.textid, self.textlede, str(self.textdate), self.textcmt, self.tex...
returns textmkup if it is not null, otherwise textoriginal. If this is changed, *_INDEX globals in views.py also need to be modified
625941d65510c4643540f609
def unsign(self, message): <NEW_LINE> <INDENT> if len(message) < 2: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if self.__key is None: <NEW_LINE> <INDENT> if message[1:2] == self.SIGN_MODE_NONE: <NEW_LINE> <INDENT> return message[2:] <NEW_LINE> <DEDENT> <DEDENT> elif message[1:2] == self.SIGN_MODE_SHA256: <NEW_...
Unsign message
625941d699fddb7c1c9de5b9
def main(): <NEW_LINE> <INDENT> data = input() <NEW_LINE> data = data.split() <NEW_LINE> list1 = [] <NEW_LINE> for j in data: <NEW_LINE> <INDENT> list1.append(int(j)) <NEW_LINE> <DEDENT> apply_to_each(list1, square) <NEW_LINE> print(list1)
main function
625941d6596a897236089ce7
def initButtons(self): <NEW_LINE> <INDENT> InputButtons = [(self.ui.Button0,'0'), (self.ui.Button1,'1'), (self.ui.Button2,'2'), (self.ui.Button3,'3'), (self.ui.Button4,'4'), (self.ui.Button5,'5'), (self.ui.Button6,'6'), (self.ui.Button7,'7'), (self.ui.Button8,'8'), (self.ui.Button9,'9'), (self.ui.plusButton,'+'), (self...
initButtons -- 버튼마다 시그널/슬롯 설정
625941d631939e2706e4d091
def generate_batches_lstm(n_nodes, y, idx, window, shift, batch_size, device,test_sample): <NEW_LINE> <INDENT> N = len(idx) <NEW_LINE> features_lst = list() <NEW_LINE> y_lst = list() <NEW_LINE> adj_fake = list() <NEW_LINE> for i in range(0, N, batch_size): <NEW_LINE> <INDENT> n_nodes_batch = (min(i+batch_size, N)-i)*n_...
Generate batches for graphs for the LSTM
625941d63346ee7daa2b2f95
def nearest_neighbor(self, image, fx, fy): <NEW_LINE> <INDENT> w = image.shape[1] <NEW_LINE> h = image.shape[0] <NEW_LINE> newW = int(w*float(fx)) <NEW_LINE> newH = int(h*float(fy)) <NEW_LINE> ratioW = w/newW <NEW_LINE> ratioH = h/newH <NEW_LINE> import numpy as np <NEW_LINE> newImg = np.zeros((newH, newW), np.uint8) <...
resizes an image using bilinear interpolation approximation for resampling image: the image to be resampled fx: scale along x direction (eg. 0.5, 1.5, 2.5) fx: scale along y direction (eg. 0.5, 1.5, 2.5) returns a resized image based on the nearest neighbor interpolation method
625941d6167d2b6e31218dbe
def get_most_frequent(list_var): <NEW_LINE> <INDENT> if isinstance(list_var,list): <NEW_LINE> <INDENT> max_item = max(set(list_var), key=list_var.count) <NEW_LINE> return (max_item, list_var.count(max_item)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise TypeError()
returns a tuple with the most frequent object in the list with the corresponing number
625941d66fece00bbac2d969
def write_lammps_data(atoms, xyz, filename): <NEW_LINE> <INDENT> atom_types = {'Ne':1, 'W':2} <NEW_LINE> x, y, z = xyz <NEW_LINE> header = "LAMMPS bubble\n\n" "{n_atoms} atoms\n\n" "{n_types} atom types\n" "0 bond types\n" "0 angle types\n\n" "0 {x} xlo xhi\n0...
LAMMPS data format: atom idx, molecule idx, atom type, x, y, z,
625941d6460517430c3943aa
def on_event_unsubscribe(self, xml_dict): <NEW_LINE> <INDENT> pass
用户取消关注
625941d6796e427e537b07f0
def getAllAffichesByLettre(self, lettre): <NEW_LINE> <INDENT> wrapper = getSAWrapper('cenforsoc') <NEW_LINE> session = wrapper.session <NEW_LINE> AfficheTable = wrapper.getMapper('affiche') <NEW_LINE> query = session.query(AfficheTable) <NEW_LINE> query = query.filter(AfficheTable.affiche_titre.like("%%%s%%" % lettre))...
recuperation de tous les affiches commencant par la lettre
625941d6d18da76e23532700
def _RunPythonTests(tests_to_run, device_id): <NEW_LINE> <INDENT> results = [CallPythonTest(t, device_id, 0) for t in tests_to_run] <NEW_LINE> return TestResults.FromTestResults(results)
Runs a list of Python tests serially on one device and returns results. Args: tests_to_run: a list of objects inheriting from PythonTestBase. device_id: ID of the device to run tests on. Returns: A list of test results, aggregated across all the tests run.
625941d6cb5e8a47e48b7cd1
def testsuite(): <NEW_LINE> <INDENT> print("I am not really implemented yet. Sorry")
Test the GeometryEngine class, currently does nothing, sorry
625941d61d351010ab855d44
def __init__(self, num, den): <NEW_LINE> <INDENT> Racional.__simp = False <NEW_LINE> self.__set_numer(num) <NEW_LINE> self.__set_denom(den) <NEW_LINE> Racional.__simp = True <NEW_LINE> self.__simplificar()
Constructor que crea un racional a partir de un numerador y un denominador.
625941d6498bea3a759b9cd8
def load_data(self): <NEW_LINE> <INDENT> self._load_customer_info() <NEW_LINE> self._load_purchases()
Load all the customers data
625941d68e71fb1e9831d9d2
def build_man_model(model_config, is_training): <NEW_LINE> <INDENT> num_classes = model_config.num_classes <NEW_LINE> feature_extractor = _build_man_feature_extractor(model_config.feature_extractor, is_training) <NEW_LINE> box_coder = box_coder_builder.build(model_config.box_coder) <NEW_LINE> matcher = matcher_builder....
该函数的作用应该是将 config文件中的 网络模型的配置 转化为函数(或object)输入函数 MANMetaArch
625941d666673b3332b922bb
def nmi(A, B, bins=1000): <NEW_LINE> <INDENT> hist, bins_A, bins_B = np.histogram2d(np.sort(np.ravel(A)), np.sort(np.ravel(B)), bins=bins) <NEW_LINE> hist /= np.sum(hist) <NEW_LINE> H_A = entropy(np.sum(hist, axis=0)) <NEW_LINE> H_B = entropy(np.sum(hist, axis=1)) <NEW_LINE> H_AB = entropy(np.ravel(hist)) <NEW_LINE> re...
Compute the normalized mutual information. The normalized mutual information is given by: H(A) + H(B) Y(A, B) = ----------- H(A, B) where H(X) is the entropy ``- sum(x log x) for x in X``. Parameters ---------- A, B : ndarray Images to be registered. Returns ------- nmi : float ...
625941d6283ffb24f3c55b28
def PercentileRanks(self, xs): <NEW_LINE> <INDENT> return self.Probs(xs) * 100
Return the percentile rank of the value xs. :param xs: potential value in cdf, cdf中的潜在的值 :return:
625941d6fff4ab517eb2f665
def collect_bbvars(metadir): <NEW_LINE> <INDENT> bbvars = {} <NEW_LINE> for root,dirs,files in os.walk(metadir): <NEW_LINE> <INDENT> for name in files: <NEW_LINE> <INDENT> if name.find(".bb") >= 0: <NEW_LINE> <INDENT> for key in recipe_bbvars(os.path.join(root,name)).keys(): <NEW_LINE> <INDENT> if key in bbvars: <NEW_L...
Walk the metadir and collect the bbvars from each recipe found
625941d676e4537e8c35189d
def load_cookies(self, cookie_storage, keep_old=False): <NEW_LINE> <INDENT> cookie_jar = QNetworkCookieJar() <NEW_LINE> if cookie_storage.__class__.__name__ == 'str': <NEW_LINE> <INDENT> cj = LWPCookieJar(cookie_storage) <NEW_LINE> cj.load() <NEW_LINE> self.toQtCookieJar(cj, cookie_jar) <NEW_LINE> <DEDENT> elif cookie_...
load from cookielib's CookieJar or Set-Cookie3 format text file. :param cookie_storage: file location string on disk or CookieJar instance. :param keep_old: Don't reset, keep cookies not overridden.
625941d61d351010ab855d45
def _rrop_finish(self, op_rr): <NEW_LINE> <INDENT> op_rr.unlink = True <NEW_LINE> if hasattr(self, '_trial_run') and self._trial_run: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> op_rr.update_op = None <NEW_LINE> op_rr.ug_id = None
Detach a record from update group, and clear update_op
625941d63346ee7daa2b2f96
def getWork(workName, movementNumber=None, extList=None): <NEW_LINE> <INDENT> if not common.isListLike(extList): <NEW_LINE> <INDENT> extList = [extList] <NEW_LINE> <DEDENT> post = getWorkList(workName, movementNumber, extList) <NEW_LINE> if len(post) == 0: <NEW_LINE> <INDENT> wn = workName <NEW_LINE> if common.isListLi...
Search the corpus, then the virtual corpus, for a work, and return a file path or URL. This method will return either a list of file paths or, if there is a single match, a single file path. If no matches are found an Exception is raised. >>> from music21 import * >>> import os >>> a = corpus.getWork('opus74no2', 4) ...
625941d6462c4b4f79d1d8f9
def parse_index(self, index_o: list, index_c: dict, full_len: int): <NEW_LINE> <INDENT> new_index_o = [] <NEW_LINE> new_index_c = {} <NEW_LINE> current_block = [] <NEW_LINE> for index in index_o: <NEW_LINE> <INDENT> if index_c[index] >= 0.002 * full_len: <NEW_LINE> <INDENT> new_index_c, new_index_o = self._flush_blocks...
Parse index and merge too small contigs together :param index_o: index contigs order :type index_o: list :param index_c: index contigs def :type index_c: dict :param full_len: length of the sequence :type full_len: int :return: (new contigs def, new contigs order) :rtype: (dict, list)
625941d624f1403a92600d8e
def _log_multivariate_normal_density_tied(X, means, covars): <NEW_LINE> <INDENT> n_samples, n_dim = X.shape <NEW_LINE> icv = pinvh(covars) <NEW_LINE> lpr = -0.5 * (n_dim * np.log(2 * np.pi) + np.log(linalg.det(covars) + 0.1) + np.sum(X * np.dot(X, icv), 1)[:, np.newaxis] - 2 * np.dot(np.dot(X, icv), means.T) + np.sum(m...
Compute Gaussian log-density at X for a tied model
625941d6dc8b845886cb575f
def __getitem__(self, item): <NEW_LINE> <INDENT> if len(self.colnames) == 0: self._setup() <NEW_LINE> return super(SmartTable, self).__getitem__(item)
This function ... :param item: :return:
625941d6090684286d50ef10
def queryset(self, request, queryset): <NEW_LINE> <INDENT> if self.value(): <NEW_LINE> <INDENT> return queryset.filter(event__Price__Type=self.value())
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`.
625941d630dc7b7665901b8e
def put_dataframe( self, dataframe: pd.DataFrame, params: Dict = None, chunksize: Optional[int] = None, ) -> None: <NEW_LINE> <INDENT> if params: <NEW_LINE> <INDENT> raise NotImplementedError("Parameters not supported yet") <NEW_LINE> <DEDENT> if chunksize: <NEW_LINE> <INDENT> raise NotImplementedError("Buffered storin...
Store the pandas dataframe as a table. The default is not to store the dataframe's row index. Configure the DataSink's options dict to pass keyword arguments to `df.to_sql`. Example:: data_sinks["my_datasink"].put_dataframe(my_df) :param dataframe: The pandas dataframe to store :type dataframe: pandas DataFrame ...
625941d6d8ef3951e3243767
def test_retire_service(provider, myservice, register_event): <NEW_LINE> <INDENT> myservice.retire() <NEW_LINE> register_event('Service', myservice.service_name, 'service_retired')
Tests my service Metadata: test_flag: provision
625941d60383005118ecf80b
def draw(self): <NEW_LINE> <INDENT> assert False
virtual method! Will be called by screen with cursor already set to origin and all text attributes reset.
625941d6e1aae11d1e749ee2
def get_feature_name(self, feat_index): <NEW_LINE> <INDENT> return self._features_vectorizer.column_to_feature(feat_index)[1]
Gives the natural language representation of a feature. Args: feat_index: a non negative interger less than instances.shape[1] Returns: The name of the feature represented by index feat_index.
625941d6283ffb24f3c55b29
def plot(self, title: str=None) -> Tuple[plt.Figure, plt.Axes]: <NEW_LINE> <INDENT> from matplotlib.collections import PatchCollection <NEW_LINE> from matplotlib.patches import Rectangle <NEW_LINE> hf, ha = plt.subplots() <NEW_LINE> layers = [] <NEW_LINE> total_distance = self.distance * 1e3 <NEW_LINE> ha.set_title("Fr...
Plot the tissue layers in a new figure. :return: The figure and axes handle of the plot.
625941d623849d37ff7b32b8
def infect_random_passengers(passengers, params, k=None): <NEW_LINE> <INDENT> if not k: <NEW_LINE> <INDENT> k = random.binomial(len(passengers), params['initial_infected']) <NEW_LINE> <DEDENT> infected = random.choice(list(passengers), k, replace=False) <NEW_LINE> for i in infected: <NEW_LINE> <INDENT> infect_node(pass...
Infects k random passengers from a binomial draw. Returns the amount
625941d6a8370b7717052ac8
@app.route('/results', methods=['GET', 'POST']) <NEW_LINE> def results(): <NEW_LINE> <INDENT> searchtext = request.args.get('searchbar') <NEW_LINE> if searchtext.strip() == '': <NEW_LINE> <INDENT> return render_template('results.html', searchtext=searchtext, artists=artists_from_db, songs=songs_from_db, songline=get_al...
Get results from DB and render to browser
625941d68da39b475bd6519f
def log_errors(self, warnings, tracebacks): <NEW_LINE> <INDENT> if (warnings,tracebacks) == ([],[]): <NEW_LINE> <INDENT> LOGGER.info ("No warnings raised by the import process") <NEW_LINE> return <NEW_LINE> <DEDENT> if warnings: <NEW_LINE> <INDENT> LOGGER.warning("#"*60) <NEW_LINE> LOGGER.warning("# The following funct...
output any warnings captured during import all
625941d6379a373c97cfad70
def __init__(self): <NEW_LINE> <INDENT> self.DealName = None <NEW_LINE> self.OwnerUin = None <NEW_LINE> self.Count = None <NEW_LINE> self.FlowId = None <NEW_LINE> self.InstanceIds = None <NEW_LINE> self.PayMode = None
:param DealName: 订单号 :type DealName: str :param OwnerUin: 所属账号 :type OwnerUin: str :param Count: 商品数量 :type Count: int :param FlowId: 关联的流程 Id,可用于查询流程执行状态 :type FlowId: int :param InstanceIds: 只有创建实例的订单会填充该字段,表示该订单创建的实例的 ID。 :type InstanceIds: list of str :param PayMode: 付费模式,0后付费/1预付费 :type PayMode: int
625941d645492302aab5e4ef
def main(argv): <NEW_LINE> <INDENT> device = '/' <NEW_LINE> env = CatchPrey(agent_nmbr=FLAGS.agent_number) <NEW_LINE> q_bound = np.max([env.max_return(0.99), np.abs(env.min_return(0.99))]) <NEW_LINE> data_spec = {'float': tf.float32, 'int': tf.int32} <NEW_LINE> path = FLAGS.path <NEW_LINE> nmbr_agents = FLAGS.agent_num...
Runs a Logical Team Q-learning agent on the catch-prey game.
625941d697e22403b379d1c4
def get_floats(expression): <NEW_LINE> <INDENT> matches = re.findall(r'\d*\.?\d*', str(expression)) <NEW_LINE> return float([i for i in matches if i][0])
Given an expression, this function returns the digits and periods in that expression. Assumes the expression is a single value. Will round down if there is text in the middle of the digits :( Example: >>> get_floats("<2.506a:") 2.506
625941d601c39578d7e75065
def _generate_nbmax(self): <NEW_LINE> <INDENT> bmag = np.linalg.norm(self.b, axis=1) <NEW_LINE> b = self.b <NEW_LINE> phi12 = np.arccos(np.dot(b[0, :], b[1, :]) / (bmag[0] * bmag[1])) <NEW_LINE> sphi123 = np.dot(b[2, :], np.cross(b[0, :], b[1, :])) / (bmag[2] * np.linalg.norm(np.cross(b[0, :], b[1, :]))) <NE...
Helper function that determines maximum number of b vectors for each direction. This algorithm is adapted from WaveTrans (see Class docstring). There should be no reason for this function to be called outside of initialization.
625941d6dd821e528d63b3d2
def as_block(monolithic, blocks): <NEW_LINE> <INDENT> comm = mpi_comm_world() <NEW_LINE> elm_type, = element_types(blocks) <NEW_LINE> if elm_type is FunctionSpace: <NEW_LINE> <INDENT> offsets = np.cumsum(np.r_[0, [Wi.dim() for Wi in blocks]]) <NEW_LINE> idx = [] <NEW_LINE> for first, last in zip(offsets[:-1], offsets[1...
Turn monolithic operator into block-structured one with indices specified in blocks
625941d6a79ad161976cc36f
def generate_path(param_key, param_items): <NEW_LINE> <INDENT> total_lengths = split_name_values(param_items) <NEW_LINE> all_groups = get_variable_groups(total_lengths) <NEW_LINE> for single_group in all_groups: <NEW_LINE> <INDENT> path_list = list() <NEW_LINE> path_list.append(param_key) <NEW_LINE> sorted_items = sort...
Genrate all possible variables with their name. Args: param_key: The peak name element of each variable. param_items: The item contains peak variable type, sub-variable name and tester input string. Returns: The full name, the path to visit value, the initial value want to be set.
625941d68e7ae83300e4b1f7
def onDragLabel(self, widget, drag_context, data, info, time): <NEW_LINE> <INDENT> table, indexRow = self.treeview.get_selection().get_selected() <NEW_LINE> nameConnect = table[indexRow][0] <NEW_LINE> nameUnicode = nameConnect.encode() <NEW_LINE> if len(nameConnect) == len(nameUnicode): <NEW_LINE> <INDENT> filename = "...
Drag-and-Drop for create desktop-file of the connection
625941d67b180e01f3dc4a24
def __init__(self, image_size, image_features_size, word_embedding, words2ids, ids2words, lstm_hidden_size = 256, word_embedding_size = 300, cnn = models.alexnet(pretrained=True).features, start_symbol = DEF_START, end_symbol = DEF_SEND ): <NEW_LINE> <INDENT> super(LSTM_W2V_Net_Cnn_Preload, self).__init__() <NEW_LINE...
Init NN image_size - size of input image. lstm_hidden_size - size of cnn features output image_features_size - size of image features vector word_embedding - pretrained word embedding model words2ids - dictionary word -> id ids2words - dictionary id -> word cnn - pretrained cnn net (alexnet, vgg and other) start_symbol...
625941d6507cdc57c6306f08
def reverseBetween(self, head, m, n): <NEW_LINE> <INDENT> h = ListNode(0) <NEW_LINE> h.next = head <NEW_LINE> revt, revh, prev = None, None, h <NEW_LINE> while m > 1 or n >= 0: <NEW_LINE> <INDENT> if m == 1: <NEW_LINE> <INDENT> revt, revh = head, head <NEW_LINE> <DEDENT> if n == 0: <NEW_LINE> <INDENT> revt.next = head ...
:type head: ListNode :type m: int :type n: int :rtype: ListNode
625941d632920d7e50b283fc
def _single_class_reader(directory): <NEW_LINE> <INDENT> fnames = [os.path.join(directory, fname) for fname in os.listdir(directory) if re.search(r'jpe?g', fname)] <NEW_LINE> tf.logging.info('class %s, %d files', directory, len(fnames)) <NEW_LINE> fnames = tf.constant(fnames) <NEW_LINE> fname_queue = tf.train.string_in...
Get a reader which reads images one at a time from a particular directory.
625941d6eab8aa0e5d26dd82
def get_sharded_shape(self, shape, shard_index=None): <NEW_LINE> <INDENT> if self._shard_dimension is None or self._number_of_shards is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if shard_index is not None: <NEW_LINE> <INDENT> if shard_index < 0 or shard_index >= self.number_of_shards: <NEW_LINE> <INDENT...
Returns the shape of a shard of a full Tensor. When given the shape of a 'full-size' Tensor, returns the shape of the sub-Tensor after it has been sharded. Freezes the policy if it has not yet been frozen. Args: shape: The shape of the full-size Tensor to be sharded. shard_index: The index of the shard whose shap...
625941d663b5f9789fde730f
def __init__(self, f, verbose=False): <NEW_LINE> <INDENT> import sage.modular.modform.element <NEW_LINE> if not isinstance(f, sage.modular.modform.element.ModularForm_abstract): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> chi = f.character() <NEW_LINE> if not chi or not chi.is_trivial(): <NEW_LINE> <INDENT>...
EXAMPLES:: Level 3, weight 6:: sage: from psage.modform.rational.special import FastModularForm sage: f = CuspForms(3,6).0; g = FastModularForm(f); g (549/10)*E6(q^3)^1 + (-3/10)*E6(q^1)^1 + (312)*E2^*(q^3)^1*E4(q^3)^1 sage: type(g) <class 'psage.modform.rational.special.FastModularForm'> ...
625941d6e64d504609d74a6a
def f_grav(self, inp, t, ms): <NEW_LINE> <INDENT> no_masses = 2002 <NEW_LINE> dydt = np.zeros(no_masses*self.d*2) <NEW_LINE> dydt[:no_masses*self.d] = inp[no_masses*self.d:] <NEW_LINE> cols = inp[: self.d * no_masses].reshape(no_masses, self.d) <NEW_LINE> cols_matrix = np.repeat(cols[np.newaxis,...], self.no_heavies, a...
Input function for 'odeint', takes all r_i and dr_i/dt and gives back derivatives :param inp: Input vector of the form: [r_0, r_1, ..., r_n, dr_0/dt, dr_1/dt, ..., dr_n/dt] :param t: Current time in simulation :param ms: Suitably shaped np array of masses (for direct operation on other arrays) :return: The time derivat...
625941d61b99ca400220acdb
def build_model(self, input_shape, n_output=1, metrics=None): <NEW_LINE> <INDENT> self._fm.build_model(input_shape, n_output, metrics) <NEW_LINE> self._rm.build_model(input_shape, n_output, metrics)
Creates the computational graph for the Supervised Models. :param input_shape: :param n_output: number of output values. :param metrics: :return: self
625941d607d97122c4178ab8
def imageInsertCompose(self, imlbl, im2, x: float, y: float, z: float, val: float, band: list = None): <NEW_LINE> <INDENT> bands = [] <NEW_LINE> if band is None: <NEW_LINE> <INDENT> bands = range(0, self._jim_object.properties.nrOfBand()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> bands.exte...
Merge Jim instance with values of im2 if val of imlbl == val. Modifies the instance on which the method was called. :param imlbl: a Jim object :param im2: a Jim object :param x: x coordinate of 1st pixel :param y: y coordinate of 1st pixel :param z: z coordinate of 1st pixel :param val: integer for label value :param...
625941d621a7993f00bc7f1c
def authorMapping(url): <NEW_LINE> <INDENT> log = logging.getLogger("Author") <NEW_LINE> log.debug("Checking Commits for Author") <NEW_LINE> commits = curl2Json(url=url) <NEW_LINE> author = commits[0]['commit']['author']['name'] <NEW_LINE> log.debug( "Found author: %s", author ) <NEW_LINE> return author
Return the name of the author for github PR forvia the commands given.
625941d6167d2b6e31218dbf
def minNumberOperations(self, target): <NEW_LINE> <INDENT> return sum(max(b-a, 0) for b, a in itertools.izip(target, [0]+target))
:type target: List[int] :rtype: int
625941d6be7bc26dc91cd827
def read_pixels_low_level(self, x_start, y_start, x_end, y_end): <NEW_LINE> <INDENT> x_start = int(x_start) <NEW_LINE> y_start = int(y_start) <NEW_LINE> x_end = int(x_end) <NEW_LINE> y_end = int(y_end) <NEW_LINE> return ReadPixelsLowLevel(*self.ipcon.send_request(self, BrickletLCD128x64.FUNCTION_READ_PIXELS_LOW_LEVEL, ...
Reads pixels from the specified window. The x-axis goes from 0 to 127 and the y-axis from 0 to 63. The pixels are read from the window line by line top to bottom and each line is read from left to right. If automatic draw is enabled (default) the pixels that are read are always the same that are shown on the display....
625941d694891a1f4081bcd4
def _find_ad_user( self, cpr: str, ad_dump: Optional[List[Dict[str, str]]] = None ) -> ADUser: <NEW_LINE> <INDENT> if ad_dump: <NEW_LINE> <INDENT> cpr_field = self.all_settings["primary"]["cpr_field"] <NEW_LINE> ad_users = filter(lambda ad_user: ad_user.get(cpr_field) == cpr, ad_dump) <NEW_LINE> <DEDENT> else: <NEW_LIN...
Find a unique AD account from cpr, otherwise raise an exception.
625941d6cad5886f8bd27203
def showid(): <NEW_LINE> <INDENT> if scout: <NEW_LINE> <INDENT> print("%s" % scout.install_id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print("unknown")
Show Ambassador's installation ID
625941d6004d5f362079a55d
def create_space(self): <NEW_LINE> <INDENT> cur = self._conn.cursor() <NEW_LINE> cur.execute(SQL_MODEL) <NEW_LINE> self._conn.commit() <NEW_LINE> cur.close() <NEW_LINE> return
Set up a new table space for the first time
625941d63d592f4c4ed1d294
def replace_namespaced_deployment(self, name, namespace, body, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.replace_namespaced_deployment_with_http_info(name, namespace, body, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
replace the specified Deployment This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_deployment(name, namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str name: name of the D...
625941d6c4546d3d9de72c5f
def _node2xmlfields(self,noderecord): <NEW_LINE> <INDENT> recordtag = noderecord.pop('BOTSID') <NEW_LINE> del noderecord['BOTSIDnr'] <NEW_LINE> BOTSCONTENT = noderecord.pop('BOTSCONTENT',None) <NEW_LINE> attributemarker = self.ta_info['attributemarker'] <NEW_LINE> attributedict = {} <NEW_LINE> for key,value in nodereco...
write record as xml-record-entity plus xml-field-entities within the xml-record-entity. output is sorted alfabetically, attributes alfabetically.
625941d64d74a7450ccd43ed
def factory_reset(self, retry: bool = True) -> None: <NEW_LINE> <INDENT> self.logger.debug("Performing factory reset") <NEW_LINE> try: <NEW_LINE> <INDENT> self.process_command( "Factory", process_seconds=0.3, read_response=False, retry=retry ) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> raise excepti...
Resets sensor to factory config.
625941d68c0ade5d55d3ebe6
def on_channel_open(self, channel): <NEW_LINE> <INDENT> LOGGER.info('Channel opened') <NEW_LINE> channel.basic_qos(prefetch_count=self._prefetch_count) <NEW_LINE> self._channel = channel <NEW_LINE> self.add_on_channel_close_callback() <NEW_LINE> self.setup_exchange(self._exchange)
This method is invoked by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll declare the exchange to use. :param pika.channel.Channel channel: The channel object
625941d61f5feb6acb0c4d78
def __init__(self): <NEW_LINE> <INDENT> pass
SignatureType - a model defined in Swagger
625941d6e5267d203edcdec5
def test_post_users_list(self): <NEW_LINE> <INDENT> self.assertEqual(User.objects.count(), 3) <NEW_LINE> url = '/users/' <NEW_LINE> data = {'username': 'Phil', 'email': 'test@foo.com', 'password': 'something'} <NEW_LINE> request = self.client.post(url, data, format='json') <NEW_LINE> self.assertEqual(request.status_cod...
Assert that POST /users/ creates a new user.
625941d6f8510a7c17cf9927
def reward(self, history_id, rewards): <NEW_LINE> <INDENT> model = self._model_storage.get_model() <NEW_LINE> total_action_reward = model['total_action_reward'] <NEW_LINE> action_times = model['action_times'] <NEW_LINE> for action_id, reward in six.viewitems(rewards): <NEW_LINE> <INDENT> total_action_reward[action_id] ...
Reward the previous action with reward. Parameters ---------- history_id : int The history id of the action to reward. rewards : dictionary The dictionary {action_id, reward}, where reward is a float.
625941d6fb3f5b602dac38bf
def logger_set_up(file_name): <NEW_LINE> <INDENT> path = pathlib.Path(get_config('config')['logs_path']) <NEW_LINE> dt = datetime.datetime.today().strftime('%Y_%m_%d') <NEW_LINE> logger = logging.getLogger(file_name) <NEW_LINE> logger.setLevel(logging.DEBUG) <NEW_LINE> try: <NEW_LINE> <INDENT> (pathlib.Path("{}".format...
Set up function for logging of autonoms files
625941d645492302aab5e4f0
def submit_rgi_heatmap_job(analysis_group: AnalysisGroup, rgi_sample_list: [RGIResult]) -> RGIGroupResult: <NEW_LINE> <INDENT> analysis_dir = Path(upload_group_analysis_file(analysis_group=analysis_group, filename='x')).parent <NEW_LINE> outdir = MEDIA_ROOT / analysis_dir <NEW_LINE> outdir.mkdir(parents=True, exist_ok=...
Given an input AnalysisGroup instance and list of RGIResult instances, calls 'rgi heatmap' command on them all :param analysis_group: Instance of AnalysisGroup object :param rgi_sample_list: List of RGIResult object instances :return: Populated RGIGroupResult object generated by the method
625941d657b8e32f524836c6
def get_volume_paths(self, connection_properties: dict) -> list: <NEW_LINE> <INDENT> volume_paths: list = [] <NEW_LINE> if (('target_portal' not in connection_properties) and ('target_portals' not in connection_properties)): <NEW_LINE> <INDENT> return volume_paths <NEW_LINE> <DEDENT> host_devices = self._get_potential_...
Get the list of existing paths for a volume. This method's job is to simply report what might/should already exist for a volume. We aren't trying to attach/discover a new volume, but find any existing paths for a volume we think is already attached. :param connection_properties: The dictionary that describes all ...
625941d65e10d32532c5f151
def test_sendEvent(self): <NEW_LINE> <INDENT> self.publisher.chan = FakeAMQChannel() <NEW_LINE> event = {'message': 'test', 'timestamp': 1340634165} <NEW_LINE> self.publisher.sendEvent(event) <NEW_LINE> output = self.publisher.chan.published[-1] <NEW_LINE> body = output['content'].body <NEW_LINE> eventDict = simplejson...
An event is encoded to JSON and then sent to the channel.
625941d663b5f9789fde7310