code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def rename(self, new_pid): <NEW_LINE> <INDENT> logger.info("rename(new_pid=\"%s\") [lid=%s, pid=%s]", new_pid, self.__lid, self.__pid) <NEW_LINE> evt = self._client._request_point_rename(self._type, self.__lid, self.__pid, new_pid) <NEW_LINE> self._client._wait_and_except_if_failed(evt) <NEW_LINE> self.__pid = new_pid
Rename the Point. Raises: IOTException: Infrastructure problem detected LinkException: Communications problem between you and the infrastructure Args: new_pid (string): The new local identifier of your Point
625941c93cc13d1c6d3c740e
def get( self, resource_group_name, activity_log_alert_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "20...
Get an Activity Log Alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param activity_log_alert_name: The name of the Activity Log Alert rule. :type activity_log_alert_name: str :keyword callable cls: A custom type or function that will...
625941c9d58c6744b4257cf4
def get_block_generations(self, block_locator): <NEW_LINE> <INDENT> course_struct = self._lookup_course(block_locator.course_agnostic())['structure'] <NEW_LINE> block_id = block_locator.block_id <NEW_LINE> update_version_field = 'blocks.{}.edit_info.update_version'.format(block_id) <NEW_LINE> all_versions_with_block = ...
Find the history of this block. Return as a VersionTree of each place the block changed (except deletion). The block's history tracks its explicit changes but not the changes in its children starting from when the block was created.
625941c991af0d3eaac9baac
def invert_list(list_of_lists): <NEW_LINE> <INDENT> inverted_list = [] <NEW_LINE> list_length = len(list_of_lists[0]) <NEW_LINE> for index in range(list_length): <NEW_LINE> <INDENT> new_row = [] <NEW_LINE> for row in list_of_lists: <NEW_LINE> <INDENT> if row: <NEW_LINE> <INDENT> new_row.append(row[index]) <NEW_LINE> <D...
Receives list of lists Returns a new list of lists with the rows to be columns inverted. Example: list of lists = [[a , b , c], [1 , 2 , 3], [do, re, mi]] returns: [[a , 1 , do], [b , 2 , re], [c , 3 , mi]] Note! All lists must be of same length
625941c97c178a314d6ef4f2
def redoMETsSignificance(self): <NEW_LINE> <INDENT> self.ensureNotCreated() <NEW_LINE> if not self.__jer_done or not self.__jec_done: <NEW_LINE> <INDENT> return self.process <NEW_LINE> <DEDENT> if self.verbose: <NEW_LINE> <INDENT> print("") <NEW_LINE> print("Applying METSignificanceProducer to METs: %r" %(self.__miniao...
Redo MET significance Adding two new collections: "METCovariance" and "METSignificance"
625941c95f7d997b87174b2b
def import_policy(self, file="testpolicy.xml", name="testpolicy"): <NEW_LINE> <INDENT> path = os.path.abspath(file) <NEW_LINE> self.zap.ascan.import_scan_policy(path) <NEW_LINE> self.zap.ascan.set_option_attack_policy(name) <NEW_LINE> self.zap.ascan.set_option_default_policy(name) <NEW_LINE> return self.generate_test_l...
Import testing policy from file. This makes the initial configuration of which tests that are enabled. As well as other policies such as strength and sensitivity :param path: File path to config file :type path: str :param name: Policy name, may be useful for the engine :type name: str
625941c99b70327d1c4e0e68
def get_post_by_id(self, post_id): <NEW_LINE> <INDENT> r = None <NEW_LINE> post_id = _as_int(post_id) <NEW_LINE> with self._engine.begin() as conn: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> post_statement = sqla.select([self._post_table]).where( self._post_table.c.id == post_id ) <NEW_LINE> post_result = conn.execut...
Fetch the blog post given by ``post_id`` :param post_id: The post identifier for the blog post :type post_id: str :return: If the ``post_id`` is valid, the post data is retrieved, else returns ``None``.
625941c90a366e3fb873e8ad
def read_bottom(self,index): <NEW_LINE> <INDENT> return self.data[(index-1) % self.size]
Decrement the size
625941c92eb69b55b151c942
def dict_to_str(self, param_dict: Dict[str, Any], num_tabs: int) -> str: <NEW_LINE> <INDENT> if not isinstance(param_dict, dict): <NEW_LINE> <INDENT> return str(param_dict) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> append_newline = "\n" if num_tabs > 0 else "" <NEW_LINE> return append_newline + "\n".join( [ "\t" + ...
Takes a parameter dictionary and converts it to a human-readable string. Recurses if there are multiple levels of dict. Used to print out hyperaparameters. param: param_dict: A Dictionary of key, value parameters. return: A string version of this dictionary.
625941c9cad5886f8bd2706d
def resize_subnet(self, subnet_id='', mask=''): <NEW_LINE> <INDENT> payload = { 'mask': mask } <NEW_LINE> uri = 'subnets/' + str(subnet_id) + '/resize/' <NEW_LINE> result = self.phpipam.api_send_request( path=uri, method='patch', payload=payload) <NEW_LINE> return result
update subnet
625941c9cdde0d52a9e530c7
def xo__to_boolean(xo): <NEW_LINE> <INDENT> return { 'X': False, 'O': True }.get(xo)
Converts the character of a grid to a boolean. :param xo: the character :return: a boolean
625941c9293b9510aa2c332b
def set_rgb(self, red, green, blue, effect="sudden", duration=100, callb=None): <NEW_LINE> <INDENT> if (0 <= red <= 255) and (0 <= green <= 255) and (0 <= blue <= 255): <NEW_LINE> <INDENT> if self.properties["power"] == "on" and "set_rgb" in self.support: <NEW_LINE> <INDENT> rgb = int( round(float(red) * 65535.0 + floa...
Set colour of light :param red: red as int :type red: int :param green: green as int :type green: int :param blue: blue as int :type blue: int :param effect: One of "smooth" or "suddent" :type effect: str :param duration: "smooth" effect duration in millisecs :type duration: int :param callb: a callback function. G...
625941c938b623060ff0ae82
def test_01_train(self): <NEW_LINE> <INDENT> log_file = os.path.join("logs", "train-test.log") <NEW_LINE> if os.path.exists(log_file): <NEW_LINE> <INDENT> os.remove(log_file) <NEW_LINE> <DEDENT> tag = "Some Country" <NEW_LINE> period = "('2017-12-01', '2019-05-29')" <NEW_LINE> eval_test = {'rmse':0.5} <NEW_LINE> runtim...
ensure log file is created
625941c91f037a2d8b946292
def test_removeWriter(self): <NEW_LINE> <INDENT> poller = _ContinuousPolling(Clock()) <NEW_LINE> writer = object() <NEW_LINE> poller.addWriter(writer) <NEW_LINE> poller.removeWriter(writer) <NEW_LINE> self.assertIsNone(poller._loop) <NEW_LINE> self.assertEqual(poller._reactor.getDelayedCalls(), []) <NEW_LINE> self.asse...
Removing a writer stops the C{LoopingCall}.
625941c93617ad0b5ed67f8b
def hide(self, image, background_color): <NEW_LINE> <INDENT> if self._position and self._size: <NEW_LINE> <INDENT> cv2.rectangle(image, self._position, (self._position[0] + self._size[0], self._position[1] + self._size[1]), background_color, thickness=-1)
Writes over itselfe with the given background color :param image: The image the button is drawn on :param background_color: The background color of the image :return: Returns the new image
625941c94a966d76dd5510a3
@tf_export('assert_proper_iterable') <NEW_LINE> def assert_proper_iterable(values): <NEW_LINE> <INDENT> unintentional_iterables = ( (ops.Tensor, sparse_tensor.SparseTensor, np.ndarray) + compat.bytes_or_text_types ) <NEW_LINE> if isinstance(values, unintentional_iterables): <NEW_LINE> <INDENT> raise TypeError( 'Expecte...
Static assert that values is a "proper" iterable. `Ops` that expect iterables of `Tensor` can call this to validate input. Useful since `Tensor`, `ndarray`, byte/text type are all iterables themselves. Args: values: Object to be checked. Raises: TypeError: If `values` is not iterable or is one of `Tensor`,...
625941c91f5feb6acb0c4be5
def replace_node(self, old_node_name, new_node): <NEW_LINE> <INDENT> if isinstance(new_node, tf.NodeDef): <NEW_LINE> <INDENT> old_node = tf.NodeDef() <NEW_LINE> for node in self.graph_pb.node: <NEW_LINE> <INDENT> if node.name == old_node_name: <NEW_LINE> <INDENT> old_node = node <NEW_LINE> break <NEW_LINE> <DEDENT> <DE...
the following operations are supported ---------------------------------------------- head_op------>op_1------>tail_op ---------------------------------------------- head_op------->op_2------>tail_op ---------------------------------------------- :param old_node_name: the name of old_node :param new_node: must be type...
625941c9442bda511e8be4ad
def test_plug_interface_portInUse( self, tenant_id='test_tenant', instance_tenant_id='nova', nova_user_id='novaadmin', instance_id=10, vif_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc', remote_interface='new_interface'): <NEW_LINE> <INDENT> LOG.debug("test_plug_interface_portInUse - START") <NEW_LINE> new_net_dict = self._...
Tests attachment of new interface to the port when there is an existing attachment
625941c910dbd63aa1bd2c38
def presentStimulus(consigne, eccen, taille): <NEW_LINE> <INDENT> stim = visual.TextStim(win, text=u"E", units='norm', height=angle2norm(taille, info['screen_distance'], info['screen_width']), color='black', pos=[angle2norm(eccen, info['screen_distance'], info['screen_width']), 0], alignHoriz='center', alignVert='cente...
Present stimulus
625941c9e64d504609d748d4
def get_image_swath(contour, image_array, begin, end, offset, depth, l_samples = None, d_samples = None, image_type = 'original'): <NEW_LINE> <INDENT> l = len(contour.points) <NEW_LINE> if begin is None: begin = 0 <NEW_LINE> if end is None: end = 0 <NEW_LINE> if end <= begin: <NEW_LINE> <INDENT> end += l <NEW_LINE> <DE...
Warp an image region into a rectangular "swath". One dimension of the warped region is defined by a contour, from contour point 'begin' to point 'end' (inclusive). Along this length, 'l_samples' points will be taken. The other dimension is defined by 'depth', which is a distance inward from the contour to be sample...
625941c90a366e3fb873e8ae
def attach_resource(self, resource_name, file_name, file_obj): <NEW_LINE> <INDENT> conn, headers, path_prefix = self.connection.https_connection() <NEW_LINE> url = "{}/applications/{}/resources/{}".format( path_prefix, self.name, resource_name) <NEW_LINE> data = file_obj.read() <NEW_LINE> headers['Content-Type'] = 'app...
Updates the resource for an application by uploading file from local disk to the Juju controller. :param str resource_name: Name of the resource to be updated. :param str file_name: Name of the local file to be uploaded. :param TextIOWrapper file_obj: Actual object to be read for data.
625941c9956e5f7376d70f02
def get(self,_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> resp = self.resource.get_edge(_id) <NEW_LINE> return initialize_element(self.resource,resp.results) <NEW_LINE> <DEDENT> except LookupError: <NEW_LINE> <INDENT> return None
Retrieves an element from Rexster and returns it.
625941c9435de62698dfdce1
def do_get(self, url, **kwargs): <NEW_LINE> <INDENT> self.http_response = self.http_hander.get(url, **kwargs) <NEW_LINE> Log.log_step("发送get请求,请求是:%s"%(url)) <NEW_LINE> return self.http_response
发送get请求
625941c992d797404e30421e
def _check(self, obj): <NEW_LINE> <INDENT> buckets = [] <NEW_LINE> actions = [] <NEW_LINE> if self._pass_lock(self.caller): <NEW_LINE> <INDENT> for bucket in self.buckets: <NEW_LINE> <INDENT> actions = self._check_actions(bucket, obj) <NEW_LINE> if actions: <NEW_LINE> <INDENT> buckets.append(bucket) <NEW_LINE> <DEDENT>...
displays bucket actions that an object has access to
625941c9f9cc0f698b140690
def user_info(ibutton): <NEW_LINE> <INDENT> response = requests.get(drink_url % 'users/info' + "&ibutton=%s" % ibutton).json <NEW_LINE> return (response['data']['uid'], int(response['data']['credits']), response['data']['admin'] == '1')
Gets the information about a user given their ibutton
625941c907d97122c417891f
def get_all_gejala_penyakit(penyakit_list, cursor): <NEW_LINE> <INDENT> rows = [] <NEW_LINE> items = [] <NEW_LINE> gejala_penyakit_list = [] <NEW_LINE> for penyakit in penyakit_list: <NEW_LINE> <INDENT> cursor.execute( "SELECT id_penyakit, bobot FROM gejala_penyakit WHERE id_penyakit = " + str(penyakit) ) <NEW_LINE> ro...
fungsi yang digunakan untuk mendapatkan semua daftar gejala dari penyakit berdasarkan daftar penyakit yang dipilih
625941c95fcc89381b1e1753
def validate(number): <NEW_LINE> <INDENT> number = compact(number) <NEW_LINE> if not isdigits(number): <NEW_LINE> <INDENT> raise InvalidFormat() <NEW_LINE> <DEDENT> if len(number) != 8: <NEW_LINE> <INDENT> raise InvalidLength() <NEW_LINE> <DEDENT> if calc_check_digits(number[:6]) != number[-2:]: <NEW_LINE> <INDENT> rai...
Check if the number is a valid VAT number. This checks the length, formatting and check digit.
625941c963d6d428bbe44584
def _pass_attr(self, ds, result): <NEW_LINE> <INDENT> pass_attr = self.__pass_attr <NEW_LINE> if pass_attr is not None: <NEW_LINE> <INDENT> ca = self.ca <NEW_LINE> ca_keys = self.ca.keys() <NEW_LINE> for a in pass_attr: <NEW_LINE> <INDENT> maxis = 0 <NEW_LINE> rcol = None <NEW_LINE> attr_newname = None <NEW_LINE> if is...
Pass a configured set of attributes on to the output dataset
625941c98c0ade5d55d3ea4f
def a_decorator(f): <NEW_LINE> <INDENT> def decorator(*args, **kwargs): <NEW_LINE> <INDENT> abort(404) <NEW_LINE> return f(*args, **kwargs) <NEW_LINE> <DEDENT> return decorator
Decorator for testing register an endpoint with a decorator :param f:
625941c9fb3f5b602dac3727
def contours_to_mask(self, cnts): <NEW_LINE> <INDENT> base = np.zeros(self.size[:2], dtype='uint8') <NEW_LINE> for cnt in cnts: <NEW_LINE> <INDENT> cv2.polylines(base, [cnt], True, 255, 1) <NEW_LINE> cv2.fillPoly(base, [cnt], 255) <NEW_LINE> <DEDENT> return base
将多个轮廓转化成mask
625941c945492302aab5e357
def __init__(self, phone_number, api_id, api_hash, allow_flashcall=None, current_number=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.result = None <NEW_LINE> self.content_related = True <NEW_LINE> self.phone_number = phone_number <NEW_LINE> self.api_id = api_id <NEW_LINE> self.api_hash = api_hash <NEW_...
:param str phone_number: :param int api_id: :param str api_hash: :param Optional[bool] allow_flashcall: :param Optional[TypeBool] current_number: :returns auth.SentCode: Instance of SentCode.
625941c98c3a87329515844f
def get_session(self, request): <NEW_LINE> <INDENT> if self.secure_key: <NEW_LINE> <INDENT> return self.session_type.load_session(request, self.session_key)
Get the current session in current request. If the session is not exist, it will create a new session. :param request: an instance of request_class.
625941c97047854f462a149f
def connect_spawn(self, argv): <NEW_LINE> <INDENT> info('Spawning a new nvim instance') <NEW_LINE> self._connect_spawn(argv)
Connect a new Nvim instance. Delegated to `_connect_spawn`.
625941c9d10714528d5ffd77
def gaussian_kernel(size, mean, std): <NEW_LINE> <INDENT> d = tf.distributions.Normal(mean, std) <NEW_LINE> vals = d.prob(tf.range(start = -size, limit = size + 1, dtype = tf.float32)) <NEW_LINE> gauss_kernel = tf.einsum('i,j->ij', vals, vals) <NEW_LINE> return gauss_kernel / tf.reduce_sum(gauss_kernel)
https://stackoverflow.com/questions/52012657/how-to-make-a-2d-gaussian-filter-in-tensorflow
625941c9eab8aa0e5d26dbec
def conv3x3(inplanes, planes, stride=1): <NEW_LINE> <INDENT> return nn.Conv2d(inplanes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
3x3 convolution with same padding
625941c996565a6dacc8f760
def fromNode(n): <NEW_LINE> <INDENT> pass
fromNode(n) -> String. Return the Node n as a string. This function is most useful when combining Python and TCL scripts for backwards compatibility reasons. @param n: A Node. @return: String.
625941c9566aa707497f45ff
def IsCCW(coords=[]): <NEW_LINE> <INDENT> sumarea = 0.0 <NEW_LINE> for i in range(0, len(coords) - 1, 1): <NEW_LINE> <INDENT> area = ComputeEdgeArea(coords[i], coords[i + 1]) <NEW_LINE> sumarea += area <NEW_LINE> <DEDENT> if sumarea > 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ret...
IsCCW: simplified version of CCW algorithm
625941c957b8e32f5248352f
def __init__(self, id=None, text=None, parents=None): <NEW_LINE> <INDENT> self._id = None <NEW_LINE> self._text = None <NEW_LINE> self._parents = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.id = id <NEW_LINE> if text is not None: <NEW_LINE> <INDENT> self.text = text <NEW_LINE> <DEDENT> if parents is not N...
JsonDropdownValueImpl - a model defined in Swagger
625941c926238365f5f0ef02
def set_series(self, first_month, series): <NEW_LINE> <INDENT> self._first_month = first_month <NEW_LINE> self._series = list(series)
*first_month* specifies the first month of the series where January of (a hypothetical) 0 AD is 1.
625941c9cc0a2c11143dcf25
def backward(self): <NEW_LINE> <INDENT> self.gradients = {n: np.zeros_like(n.value) for n in self.inbound_nodes} <NEW_LINE> for n in self.outbound_nodes: <NEW_LINE> <INDENT> grad_cost = n.gradients[self] <NEW_LINE> sigmoid = self.value <NEW_LINE> self.gradients[self.inbound_nodes[0]] += sigmoid * (1 - sigmoid) * grad_c...
Calculates the gradient using the derivative of the sigmoid function.
625941c94f6381625f114acf
def testGeneratedCodeword(self, codebook, trainedClassifiers, generatedCodeword, holdoutData, threshold): <NEW_LINE> <INDENT> trainer = Trainer() <NEW_LINE> codebookCopy = codebook.copy() <NEW_LINE> codebookCopy.append(generatedCodeword) <NEW_LINE> predictedCodewords = trainer.getPredictions(holdoutData, trainedClassif...
Used to test how well the trained classifiers are at generating the codeword developed for a new class. :param codebook: The original codebook that's being used. :param trainedClassifiers: List of trained classifiers used to generate codewords. :param generatedCodeword: The codeword generated for the holdout class. :p...
625941c9fff4ab517eb2f4d1
def get_assets(url, soup, asset_specification): <NEW_LINE> <INDENT> assets = [asset.get('href') for asset in soup.find_all('link')] <NEW_LINE> images = [image.get('src') for image in soup.find_all('img') if image.get('src') is not None] <NEW_LINE> scripts = [script.get('src') for script in soup.find_all('script') if sc...
We use a function to get all the 'assets' for a url. Assets are as we defined in the main functions. :param asset_specification: (list of strings) the list contains the asset specification (i.e. '.jpg' means any string containing '.jpg' is an asset). :param url: (string) this is the url we get the assets f...
625941c9c4546d3d9de72ac8
def __find_node(self, seeds=None): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> mongos_candidates = [] <NEW_LINE> candidates = seeds or self.__nodes.copy() <NEW_LINE> for candidate in candidates: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> node, ismaster, isdbgrid, res_time = self.__try_node(candidate) <NEW_LINE> self._...
Find a host, port pair suitable for our connection type. If only one host was supplied to __init__ see if we can connect to it. Don't check if the host is a master/primary so we can make a direct connection to read from a secondary or send commands to an arbiter. If more than one host was supplied treat them as a see...
625941c90c0af96317bb827d
@pytest.fixture <NEW_LINE> def load_check_test_cvs(): <NEW_LINE> <INDENT> branch = "master" <NEW_LINE> target = os.path.join(COMP_CHECK_CV_REPO_DIR, branch) <NEW_LINE> if not os.path.isdir(COMP_CHECK_CV_REPO_DIR): <NEW_LINE> <INDENT> os.makedirs(COMP_CHECK_CV_REPO_DIR) <NEW_LINE> <DEDENT> if not os.path.isdir(target): ...
This fixture ensures that the required test controlled vocab repository has been cloned to the cache directory within the home directory.
625941c9dc8b845886cb55c9
def one_sample_ttest(sample, mu): <NEW_LINE> <INDENT> s_arr = np.array(sample) <NEW_LINE> mean = s_arr.mean() <NEW_LINE> sem=scs.sem(s_arr) <NEW_LINE> t_val = abs(mean - mu)/sem <NEW_LINE> p_val = 2*scs.t.cdf(-abs(t_val),df=s_arr.size-1) <NEW_LINE> return (t_val, p_val)
INPUT: - sample(LIST) [Values in the sample] - mu(FLOAT) [The hypothesized mean value of the population] OUTPUT: - results(TUPLE) [Tuple containing t-statistic(FLOAT) and p-value(FLOAT)]
625941c921bff66bcd6849e9
def _get_used_before_calc_subs(group, input_srcs): <NEW_LINE> <INDENT> parallel_solver = {} <NEW_LINE> allsubs = group._subsystems_allprocs <NEW_LINE> for sub, i in allsubs.values(): <NEW_LINE> <INDENT> if hasattr(sub, '_mpi_proc_allocator') and sub._mpi_proc_allocator.parallel: <NEW_LINE> <INDENT> parallel_solver[sub....
Return Systems that are executed out of dataflow order. Parameters ---------- group : <Group> The Group where we're checking subsystem order. input_srcs : {} dict containing variable abs names for sources of the inputs. This describes all variable connections, either explicit or implicit, in the entire...
625941c97b25080760e394ee
def handle_event(self, resource, event, trigger, payload): <NEW_LINE> <INDENT> if self._is_session_semantic_violated( payload.context, resource, event): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> resource_id = payload.resource_id <NEW_LINE> self._resources_to_push.put((resource_id, payload.context.to_dict()))
Callback handler for resource change that pushes change to RPC. We always retrieve the latest state and ignore what was in the payload to ensure that we don't get any stale data.
625941c9e76e3b2f99f3a8a1
def count(self, sub, start=None, end=None): <NEW_LINE> <INDENT> return 0
S.count(sub[, start[, end]]) -> int Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
625941c976d4e153a657ebc6
def onDeleteStructures(self, confirm = True, all = False): <NEW_LINE> <INDENT> rows = self.structures.rowCount() <NEW_LINE> if confirm: <NEW_LINE> <INDENT> NoRowsToDelete = 0 <NEW_LINE> for i in range(rows): <NEW_LINE> <INDENT> if all or self.structures.item(i, 0).checkState() != 0: <NEW_LINE> <INDENT> NoRowsToDelete =...
delete all the structures
625941c9d6c5a102081440df
def format_exeception(): <NEW_LINE> <INDENT> return traceback.format_exec().rstrip()
Format the exception traceback. :return: The traceback string.
625941c99f2886367277a923
def __init__(self, *branches): <NEW_LINE> <INDENT> super().__init__(Brancher(self.process, *branches, proceed=True))
Construct the handler with the processor automatically created from the 'process' function and the including or branching based on the provided processors containers. @param branches: arguments[IBranch] The branches used in branching, attention the order provided for setups will be reflected in the provided ...
625941c9bde94217f3682e86
def gen_chart(df, title, y_title, date_ini, source=True): <NEW_LINE> <INDENT> df_final = df[df.index >= date_ini] <NEW_LINE> data = [] <NEW_LINE> color = np.array(['rgb(166,206,227)','rgb(31,120,180)','rgb(178,223,138)', 'rgb(51,160,44)','rgb(251,154,153)','rgb(227,26,28)', 'rgb(253,191,111)','rgb(255,127,0)','rgb(202,...
Produces plot.ly figure from a dataframe, the title, y title, initial date and add crosal label. inputs: ------ - df: Dataframe - tittle: str - y_title: str - date_ni: str (ex: Y%-%m-%d) -source: boolean Outputs: ------- - plot.ly figure
625941c9be8e80087fb20cd9
def RefreshGameServerInstanceHeartbeat(request, callback, customData = None, extraHeaders = None): <NEW_LINE> <INDENT> if not PlayFabSettings.DeveloperSecretKey: <NEW_LINE> <INDENT> raise PlayFabErrors.PlayFabException("Must have DeveloperSecretKey set to call this method") <NEW_LINE> <DEDENT> def wrappedCallback(playF...
Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. https://docs.microsoft.com/rest/api/playfab/server/matchmaking/refreshgameserverinstanceheartbeat
625941c99c8ee82313fbb80a
def test_full_auth(self): <NEW_LINE> <INDENT> fake_json = fake_user_json() <NEW_LINE> res = self.api.post('/register', json=fake_json) <NEW_LINE> e = {'email': "a@b.com", "first_name": "John", "last_name": "Smith", "salted_password": "123456"} <NEW_LINE> User(**e).save() <NEW_LINE> res = self.api.post("/gmail_oauth_url...
This only works when jwt_identity is disabled Returns:
625941c9796e427e537b065a
def test_kyc_participate_with_signed_address(chain, kyc_crowdsale, customer, customer_id, kyc_token, private_key, preico_starts_at, pricing, team_multisig): <NEW_LINE> <INDENT> time_travel(chain, kyc_crowdsale.call().startsAt() + 1) <NEW_LINE> event_filter = kyc_crowdsale.events.Invested().createFilter(fromBlock=0) <NE...
Buy tokens with a proper KYC payload.
625941c9283ffb24f3c55997
def p_type_spec(self, p): <NEW_LINE> <INDENT> p[0] = p[1]
type_spec : IDENT | INT | REAL | BOOL
625941c9b830903b967e99a1
def resetAlbum(self, execute = True): <NEW_LINE> <INDENT> if self.album: <NEW_LINE> <INDENT> self.album.reset() <NEW_LINE> <DEDENT> self.setGuiAttributesOnAlbum() <NEW_LINE> self.executeRules() <NEW_LINE> self.updateFinalScreen() <NEW_LINE> return None
resets data in album to previous stored data used to roll back effects from edits and rules should only be called from the final tab
625941c9d486a94d0b98e1da
def face_poset(self): <NEW_LINE> <INDENT> from sage.combinat.posets.posets import Poset <NEW_LINE> dim = self.dimension() <NEW_LINE> covers = {} <NEW_LINE> for n in range(dim, 0, -1): <NEW_LINE> <INDENT> idx = 0 <NEW_LINE> for s in self.n_cells(n): <NEW_LINE> <INDENT> covers[(n, idx)] = list(set([(n-1, i) for i in s]))...
The face poset of this `\Delta`-complex, the poset of nonempty cells, ordered by inclusion. EXAMPLES:: sage: T = delta_complexes.Torus() sage: T.face_poset() Finite poset containing 6 elements
625941c9090684286d50ed7a
def dict_name(self, ranges=None): <NEW_LINE> <INDENT> if not ranges: <NEW_LINE> <INDENT> ranges = [1, 5, 10, 20, 50] <NEW_LINE> <DEDENT> name = {"AUC": self.AUC, "MeanValue": self.mean_value} <NEW_LINE> for r in ranges: <NEW_LINE> <INDENT> name.update({"Range%02d" % r: self.CMC[r - 1]}) <NEW_LINE> <DEDENT> return name
:param ranges: :return:
625941c9460517430c39421c
@app.route('/qr/<email>') <NEW_LINE> def qr(email): <NEW_LINE> <INDENT> u = User.get_user(email) <NEW_LINE> if u is None: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> t = pyotp.TOTP(u.key) <NEW_LINE> q = qrcode.make(t.provisioning_uri(email)) <NEW_LINE> img = io.StringIO() <NEW_LINE> q.save(img) <NEW_LINE> img.see...
Return a QR code for the secret key associated with the given email address. The QR code is returned as file with MIME type image/png.
625941c9bde94217f3682e87
@ajax_request <NEW_LINE> @login_required <NEW_LINE> def get_total_number_of_buildings_for_user(request): <NEW_LINE> <INDENT> buildings_count = get_buildings_for_user_count(request.user) <NEW_LINE> return {'status': 'success', 'buildings_count': buildings_count}
gets a count of all buildings in the user's organaztions
625941c9009cb60464c63447
def block(char): <NEW_LINE> <INDENT> code = byteord(char) <NEW_LINE> i = bisect_right(Blocks.RANGES, code) <NEW_LINE> return Blocks.VALUES[i-1]
Return the block property assigned to the Unicode character 'char' as a string. >>> block("a") 'Basic Latin' >>> block(unichr(0x060C)) 'Arabic' >>> block(unichr(0xEFFFF)) 'No_Block'
625941c929b78933be1e5742
def test_cpu(): <NEW_LINE> <INDENT> cpu_times = psutil.cpu_times() <NEW_LINE> common_logger.info("cpu times:{0}".format(cpu_times)) <NEW_LINE> cpu_count = psutil.cpu_count() <NEW_LINE> common_logger.info("cpu 逻辑个数:{0}".format(cpu_count)) <NEW_LINE> cpu_count = psutil.cpu_count(logical=False) <NEW_LINE> common_logger.in...
测试cpu的相关信息。 :return:
625941c956b00c62f0f146ee
def delete_code(self, code): <NEW_LINE> <INDENT> orm_code = self.db.query(orm.OAuthCode).filter_by(code=code).first() <NEW_LINE> if orm_code is not None: <NEW_LINE> <INDENT> self.db.delete(orm_code) <NEW_LINE> self.db.commit()
Deletes an authorization code after its use per section 4.1.2. http://tools.ietf.org/html/rfc6749#section-4.1.2 :param code: The authorization code.
625941c9004d5f362079a3c9
def __init__(self, session, course_id, unrestricted_filenames=False): <NEW_LINE> <INDENT> self._session = session <NEW_LINE> self._course_id = course_id <NEW_LINE> self._unrestricted_filenames = unrestricted_filenames
Initialize Coursera OnDemand API. @param session: Current session that holds cookies and so on. @type session: requests.Session @param course_id: Course ID from course json. @type course_id: str @param unrestricted_filenames: Flag that indicates whether grabbed file names should endure stricter character filteri...
625941c93539df3088e2e3e0
def send_email(email_from, email_to, email_subject, email_body, email_body_type): <NEW_LINE> <INDENT> msg = MIMEText(email_body, email_body_type, 'utf-8') <NEW_LINE> from_name, from_addr = parseaddr(email_from) <NEW_LINE> msg['From'] = _format_addr(email_from) <NEW_LINE> to_addr_list = [] <NEW_LINE> if type(email_to) =...
封装了发送邮件功能 :param email_from: 邮箱地址,或者, '"名字" <邮箱地址>' :param email_to: 邮箱地址,或者, '"名字" <邮箱地址>',或者可以传入符合这个格式的list :param email_subject: 邮件标题 :param email_body: 邮件正文,可以是字符串或者html :param email_body_type: plain: 字符串, html: 页面
625941c98da39b475bd65009
@commandWrap <NEW_LINE> def nurbsPlane(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.nurbsPlane(*args, **kwargs)
:rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base
625941c9377c676e9127223e
def test_edit_reverse_chars(self): <NEW_LINE> <INDENT> url = reverse('edit', args=['dhaynes']) <NEW_LINE> self.assertEqual(url, '/edit/dhaynes')
/edit/<short> - Delete a link, no content display.
625941c91d351010ab855bb1
def cell_filter(data, num_expr_genes=2000, non_zero_threshold=2): <NEW_LINE> <INDENT> ai, bi = np.where(np.isnan(data)) <NEW_LINE> data[ai, bi] = 0 <NEW_LINE> num_transcripts, num_cells = data.shape <NEW_LINE> res = np.sum(data >= non_zero_threshold , axis=0) <NEW_LINE> return np.where(np.isfinite(res) & (res >= num_ex...
:param data: transcripts x cells data matrix :return: indices of valid cells
625941c994891a1f4081bb3e
def get_systemd_units(self): <NEW_LINE> <INDENT> service_file_section = "config" <NEW_LINE> systemd_service_pattern = r"^/usr/lib/systemd/system/[^/]*\.(mount|service|socket|target)$" <NEW_LINE> systemd_units = [] <NEW_LINE> if service_file_section not in self.packages: <NEW_LINE> <INDENT> return systemd_units <NEW_LIN...
get systemd unit files from the files module
625941c9cc0a2c11143dcf26
def get_wallet_from_puk(input_RSA_puk): <NEW_LINE> <INDENT> return RIPEMD160.new(data=SHA256.new(data= input_RSA_puk).digest()).hexdigest()
Class method, returns the Wallet object from the corresponding RSA Public Key for transaction verification. :param input_RSA_puk: STRING Representing the target RSA pubkey :return: Returns STRING representing the generated wallet
625941c94a966d76dd5510a4
def model_states_callback(self, msg): <NEW_LINE> <INDENT> if self._lock.locked(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self._lock.acquire() <NEW_LINE> self.current_model_state = msg <NEW_LINE> try: <NEW_LINE> <INDENT> gazebo_model_index = self.current_model_state.name.index( self.name) <NEW_LINE> self.gz_pose...
Gazebo model states callback Args: msg (ModelStates): message from gazebo with model states
625941c94e696a04525c94e1
def close(self, event=None): <NEW_LINE> <INDENT> self.destroy()
Close "DialogViewer".
625941c957b8e32f52483530
def vm_miss_fix(self, vm_uuid: str, user): <NEW_LINE> <INDENT> vm = self._get_user_perms_vm( vm_uuid=vm_uuid, user=user, related_fields=('host', 'user', 'image__ceph_pool__ceph')) <NEW_LINE> return VmInstance(vm).miss_fix()
宿主机上虚拟机丢失修复 :param vm_uuid: 虚拟机uuid :param user: 用户 :return: Vm() # success :raises: VmError
625941c9e76e3b2f99f3a8a2
def get_info(data_list): <NEW_LINE> <INDENT> info = [{TEST_SAMPLE: data_elem[TEST_SAMPLE], CONTROL_SAMPLE: data_elem[CONTROL_SAMPLE], N_UP: len(data_elem[REG_UP].index), N_DOWN: len(data_elem[REG_DOWN].index)} for data_elem in data_list]
print a set of useful information about a fold change dataset
625941c9167d2b6e31218c2c
def __init__(self, value=None, values=None): <NEW_LINE> <INDENT> self._value = None <NEW_LINE> self._values = None <NEW_LINE> self.discriminator = None <NEW_LINE> if value is not None: <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> if values is not None: <NEW_LINE> <INDENT> self.values = values
JsonAttributeValue - a model defined in Swagger
625941c9a8ecb033257d3163
def get_matrix(self): <NEW_LINE> <INDENT> matrix = RayTracingMatrix() <NEW_LINE> matrix.handle = pystir.cSTIR_parameter(self.handle, self.name, 'matrix') <NEW_LINE> check_status(matrix.handle) <NEW_LINE> return matrix
Returns the ray tracing matrix used for projecting; matrix: a RayTracingMatrix object representing G in acquisition model.
625941c9435de62698dfdce2
def test_beam_modes_01(self): <NEW_LINE> <INDENT> bdf_filename = os.path.join(MODEL_PATH, 'beam_modes', 'beam_modes.dat') <NEW_LINE> op2_filename = os.path.join(MODEL_PATH, 'beam_modes', 'beam_modes_m1.op2') <NEW_LINE> test = NastranGUI() <NEW_LINE> test.load_nastran_geometry(bdf_filename) <NEW_LINE> test.load_nastran_...
CBAR/CBEAM - PARAM,POST,-1
625941c93c8af77a43ae3836
def get_mem_per_node(jsonDict): <NEW_LINE> <INDENT> assert isinstance(jsonDict, dict) <NEW_LINE> return float(jdc.get_dict_field_val(jsonDict, ["data", "applicationDetails", "hostMemory", "plain", "value"]))
Gets the memory available per node from the JSON dictionary passed in Args: jsonDict (dict): Dictionary of JSON values representing a Performance Report Returns: Memory per node reported in the JSON dictionary passed in
625941c9187af65679ca51b4
def disjoint_union(self, other, labels='pairs'): <NEW_LINE> <INDENT> if not hasattr(other, 'hasse_diagram'): <NEW_LINE> <INDENT> raise TypeError("'other' is not a finite poset") <NEW_LINE> <DEDENT> return Poset(self.hasse_diagram().disjoint_union(other.hasse_diagram(), labels=labels))
Return a poset isomorphic to disjoint union (also called direct sum) of the poset with ``other``. The disjoint union of `P` and `Q` is a poset that contains every element and relation from both `P` and `Q`, and where every element of `P` is incomparable to every element of `Q`. Mathematically, it is only defined when...
625941c94428ac0f6e5ba888
def concate_rps(ret_df, top_n_week=12, top_n_rank=1000): <NEW_LINE> <INDENT> date_idx = ret_df.index <NEW_LINE> dict_rps = {} <NEW_LINE> for i in range(len(ret_df))[:30]: <NEW_LINE> <INDENT> rps = get_rps(ret_df.iloc[i]) <NEW_LINE> dict_rps[date_idx[i]] = pd.DataFrame(rps.values, columns=['increase', 'rank', 'rps'], in...
:param ret_df: stock_return :param top_n_week: rolling windlows, axis=0, e.g. in the past 10 weeks :param top_n_stock: top ranking stocks, axis=1, e.g the top 20 of the RPS ranking :return:
625941c9596a897236089b57
def test_load_saved_model_with_no_variables(self, builder_cls): <NEW_LINE> <INDENT> with ops.Graph().as_default(): <NEW_LINE> <INDENT> path = _get_export_dir("no_variable_saved_model") <NEW_LINE> with session.Session(graph=ops.Graph()) as sess: <NEW_LINE> <INDENT> x = variables.VariableV1( 5, name="x", collections=["no...
Test that SavedModel runs saver when there appear to be no variables. When no variables are detected, this may mean that the variables were saved to different collections, or the collections weren't saved to the SavedModel. If the SavedModel MetaGraphDef contains a saver, it should still run in either of these cases. ...
625941c97b180e01f3dc4894
def format_table(self, table, use_schema=True, name=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> name = table.name <NEW_LINE> <DEDENT> result = self.quote(name, table.quote) <NEW_LINE> if not self.omit_schema and use_schema and getattr(table, "schema", None): <NEW_LINE> <INDENT> result = self.quote(t...
Prepare a quoted table and schema name.
625941c99b70327d1c4e0e6b
def query_and_fetch(query, top_n=12): <NEW_LINE> <INDENT> global url_details, url_text <NEW_LINE> print('Query: ' + query + '; Top N: ' + str(top_n)) <NEW_LINE> url_details = [] <NEW_LINE> url_text = [] <NEW_LINE> driver = None <NEW_LINE> bad_request = False <NEW_LINE> try: <NEW_LINE> <INDENT> driver = Fetcher.get_sele...
Query Duck Duck Go (DDG) for top n results
625941c95510c4643540f47c
def coord_functions(self): <NEW_LINE> <INDENT> return [self.coord_function(i) for i in range(self.patch.manifold.dim)]
Returns a list of all coordinate functions. For more details see the coord_function method of this class.
625941c91f5feb6acb0c4be7
@roles('lb') <NEW_LINE> @task <NEW_LINE> def post_install_frontend(): <NEW_LINE> <INDENT> execute(pydiploy.require.nginx.web_configuration) <NEW_LINE> if env.goal != "dev": <NEW_LINE> <INDENT> put('nginx_with_load_balancer.patch', '/tmp/') <NEW_LINE> sudo("patch /etc/nginx/sites-available/%s.conf < /tmp/nginx_with_load...
Post installation of frontend
625941c910dbd63aa1bd2c3a
def ping(): <NEW_LINE> <INDENT> thisproxy['conn'].connected
Ping? Pong!
625941c9a4f1c619b28b00d1
def getControlFileDependentScheds(self,maestro_db, ctl_file): <NEW_LINE> <INDENT> conn = sqlite3.connect(maestro_db) <NEW_LINE> c = conn.cursor() <NEW_LINE> sql = [] <NEW_LINE> sql.append("WITH RECURSIVE ") <NEW_LINE> sql.append("ctrl_file_deps (deps) AS ( ") <NEW_LINE> sql.append("SELECT SCHEDULE FROM SCH_OPENS where ...
Find all nodes dependent on control file to the starting node @param: maestro_db: The location of the schedule database @param: ctl_file: the control file we are to work with @return: List of dependent schedules in Graphviz format
625941c90a366e3fb873e8b0
def DoUpload(self): <NEW_LINE> <INDENT> StatusUpdate('Uploading dispatch entries.', self.error_fh) <NEW_LINE> self.rpcserver.Send('/api/dispatch/update', app_id=self.dispatch.application, payload=self.dispatch.ToYAML())
Uploads the dispatch entries.
625941c963f4b57ef00011b1
def recursive_continued_frac(n_term, d_term, k): <NEW_LINE> <INDENT> def helper(n): <NEW_LINE> <INDENT> if n == 1: <NEW_LINE> <INDENT> return n_term(k) / d_term(k) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return n_term(k-n+1) / (d_term(k-n+1) + helper(n-1)) <NEW_LINE> <DEDENT> <DEDENT> return helper(k)
Returns the k-term continued fraction with numerators defined by n_term and denominators defined by d_term. >>> # golden ratio ... round(recursive_continued_frac(lambda x: 1, lambda x: 1, 8), 3) 0.618 >>> # 1 / (1 + (2 / (2 + (3 / (3 + (4 / 4)))))) ... round(recursive_continued_frac(lambda x: x, lambda x: x, 4), 6) 0....
625941c9d268445f265b4f04
def test_preproc_load(self): <NEW_LINE> <INDENT> self.preproc_widget = self.create_widget(OWPreprocess) <NEW_LINE> self.preproc_widget.add_preprocessor(self.preproc_widget.PREPROCESSORS[0]) <NEW_LINE> self.preproc_widget.unconditional_commit() <NEW_LINE> pp_out = self.get_output("Preprocessor", widget=self.preproc_widg...
Test that loading a preprocessor signal in the widget works
625941c956ac1b37e6264267
def make_scoreVsTime_plot(data): <NEW_LINE> <INDENT> p = figure(plot_width=600, plot_height=700, x_axis_type='datetime') <NEW_LINE> source = ColumnDataSource(data=data) <NEW_LINE> hover = HoverTool() <NEW_LINE> hover.tooltips = [('', '@text')] <NEW_LINE> p.add_tools(hover) <NEW_LINE> p.circle(x='date', y='score', line_...
Make a plot of score versus time for a set of (scored) documents
625941c99c8ee82313fbb80b
def __init__(self, func) -> None: <NEW_LINE> <INDENT> config = self._load_yaml('config/api.yml') <NEW_LINE> self._client = OAuth1Session( config['CONSUMER_KEY'], config['CONSUMER_SECRET'], config['ACCESS_TOKEN'], config['ACCESS_TOKEN_SECRET']) <NEW_LINE> self._func = func
:param func: 取得したデータに対して処理したい関数を指定します。
625941c907f4c71912b11518
def remove_file(self, dir): <NEW_LINE> <INDENT> c_packet = packet("SSH_FXP_REMOVE") <NEW_LINE> c_packet.assign_next_id() <NEW_LINE> c_packet.add(dir) <NEW_LINE> bytes = c_packet.bytes() <NEW_LINE> self.__send(bytes) <NEW_LINE> print("waiting on response") <NEW_LINE> response = self.__recv() <NEW_LINE> r_packet = packet...
Remove a file. :param dir: File to remove. Path is relative to user's ~. :return: None
625941c9cc40096d615959e7
def saved(self): <NEW_LINE> <INDENT> message = _(u'label_roles_successfully_changed', default=u'Local roles successfully changed') <NEW_LINE> api.portal.show_message( message=message, request=self.request, type='info') <NEW_LINE> return self.request.RESPONSE.redirect(self.context.absolute_url())
Redirects to absolute_url and adds statusmessage.
625941c94d74a7450ccd425a
def loadData(fpath, fname): <NEW_LINE> <INDENT> counter = 0 <NEW_LINE> csvfiles = [] <NEW_LINE> for file in os.listdir(fpath): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if file.endswith(fname) and file != "Freq_Phase.mat": <NEW_LINE> <INDENT> print(".mat Files found:\t", file) <NEW_LINE> csvfiles.append(loadmat(str(...
load all files of the same data and safe them in one list Parameters ---------- fname : string file name to look for fpath : string file path Return ------- data : list List of all elements
625941c9283ffb24f3c55998
def create_verification(distinct_id): <NEW_LINE> <INDENT> if not distinct_id: <NEW_LINE> <INDENT> raise errors.ValidationError('A value is required for distinct_id.') <NEW_LINE> <DEDENT> verification = VerificationRequest.create(str(distinct_id)) <NEW_LINE> return verification.hosted_page_url
Args: distinct_id: string Returns: string: Hosted verification page URL
625941c907d97122c4178921
def clear (self): <NEW_LINE> <INDENT> self.beginResetModel() <NEW_LINE> self.documents = [] <NEW_LINE> self.endResetModel()
Empty the document list.
625941c95166f23b2e1a51ef
def delete(self, *args, **kwargs): <NEW_LINE> <INDENT> deletable, _ = self.can_delete() <NEW_LINE> if deletable: <NEW_LINE> <INDENT> return super(Category, self).delete(*args, **kwargs)
Override to only delete if the object is deletable :param args: :param kwargs: :return:
625941c963d6d428bbe44586
def _gen_meta(self): <NEW_LINE> <INDENT> meta = {"encode_dict" : self.encode_dict, "word_length" : self.word_len, "data_length" : self.data_length, "magic_number" : MAGIC_NUMBER} <NEW_LINE> return meta
Generates meta data to be used during decompression. Returns a dictionary.
625941c9f9cc0f698b140693