code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def update_applicant_with_http_info(self, applicant_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['applicant_id', 'data'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> params = locals() <NEW_LINE> for key, v...
Update Applicant This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.update_applicant_with_http_info(applicant_id...
625941de32920d7e50b28512
def _first_page(self): <NEW_LINE> <INDENT> url = u'{}/serp?q={}'.format(self._base_url, self._query) <NEW_LINE> return {'url':url, 'data':None}
Returns the initial page and query.
625941de167d2b6e31218ed4
def find_minmax(lims, olims): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> limzip = zip(list(lims), list(olims), [np.min, np.max]) <NEW_LINE> limits = tuple([float(fn([l, ol])) for l, ol, fn in limzip]) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> limits = (np.NaN, np.NaN) <NEW_LINE> <DEDENT> return limits
Takes (a1, a2) and (b1, b2) as input and returns (np.min(a1, b1), np.max(a2, b2)). Used to calculate min and max values of a number of items.
625941debde94217f368312d
def setTooltips(self, switchOn): <NEW_LINE> <INDENT> self.funcViewer.model().sourceModel().setTooltips(switchOn)
Triggers showing python objects tooltips
625941de656771135c3ebbb2
def __init__(self, successful: bool, name: str, tokens: list, remainder: str): <NEW_LINE> <INDENT> self.successful = successful <NEW_LINE> self.name = name <NEW_LINE> self.tokens = tokens <NEW_LINE> self.remainder = remainder
:param successful: flag indicating if the match was successful :param name: the name of the matching function that was run to achieve this Match :param tokens: list of tokens matched by the Matcher (str or Match) :param remainder: the contents of the string following the match
625941de30bbd722463cc107
def construire(self, atelier): <NEW_LINE> <INDENT> nom = self.ajouter_choix("nom", "n", Uniligne, atelier, "nom") <NEW_LINE> nom.parent = self <NEW_LINE> nom.prompt = "Nom de la atelier : " <NEW_LINE> nom.apercu = "{valeur}" <NEW_LINE> nom.aide_courte = "Entrez le |ent|nom|ff| de l'atelier ou |cmd|/|ff| pour...
Construction de l'éditeur
625941de925a0f43d254a1b9
def get_whoami(self, name=None): <NEW_LINE> <INDENT> data = [self.daemon_host, str(os.getpid())] <NEW_LINE> if name: <NEW_LINE> <INDENT> data.append(name) <NEW_LINE> <DEDENT> res = ':'.join(data) <NEW_LINE> self.log.debug("get_whoami: %s" % res) <NEW_LINE> return res
Create a unique name for this client
625941de3eb6a72ae02ec825
def t_INITIAL_PSCONST_S(self, t): <NEW_LINE> <INDENT> self.lineno += 1 <NEW_LINE> t.value = t.value.strip().strip('&').strip("'") <NEW_LINE> t.lexer.push_state('sstring') <NEW_LINE> return t
(([A-Za-z]\w*)_)?\'([^\\\n\']|(\\.))*&\s*\n
625941de377c676e912724e7
def cat_boost_regressor(X_train, y_train, X_val, y_val, categorical_features_indices): <NEW_LINE> <INDENT> model = CatBoostRegressor(iterations=50, depth=3, learning_rate=0.1, loss_function='RMSE') <NEW_LINE> model.fit(X_train, y_train, cat_features=categorical_features_indices, eval_set=(X_val, y_val), plot=True) <NEW...
This trains the cat boost regressor on a training data set @param X_train: Training dataset input @param y_train: Training dataset output @param X_val: Validation dataset input @param y_val: Validation dataset output @param categorical_features_indices: List of indices which are categorical features in the X_train @ret...
625941de379a373c97cfae86
def download_target(EPIC, cadence="l", location=""): <NEW_LINE> <INDENT> assert type(EPIC) == int, "Must supply EPIC as an int" <NEW_LINE> file_format = "kplr{:0>9d}-2014044044430_{}-targ.fits" <NEW_LINE> if cadence == "l": <NEW_LINE> <INDENT> file = file_format.format(EPIC, "lpd") <NEW_LINE> url = base_url + "long_cad...
Given the EPIC number (as an integer), download the ~25Mb file to location. Cadence can be "l" or "s" to specify long or short cadence.
625941deff9c53063f47c532
@cpython_api([PyObject], rffi.ULONG, error=-1) <NEW_LINE> def PyLong_AsUnsignedLongMask(space, w_long): <NEW_LINE> <INDENT> return PyInt_AsUnsignedLongMask(space, w_long)
Return a C unsigned long from a Python long integer, without checking for overflow.
625941dea934411ee37519d4
def remove(self, *obj): <NEW_LINE> <INDENT> ht_list = [] <NEW_LINE> handles = self.selected_handles() <NEW_LINE> for hndl in handles: <NEW_LINE> <INDENT> if self.dbstate.db.has_source_handle(hndl): <NEW_LINE> <INDENT> ht_list.append(('Source', hndl)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ht_list.append(('Citati...
Method called when deleting source(s) or citations from the views.
625941def8510a7c17cf9a3e
def getObjectData(self, objIDs: (list, tuple)): <NEW_LINE> <INDENT> out = [] <NEW_LINE> for objID in objIDs: <NEW_LINE> <INDENT> if objID not in self.all_objs: <NEW_LINE> <INDENT> msg = 'Cannot find object with ID <{}>'.format(objID) <NEW_LINE> return RetVal(False, msg, None) <NEW_LINE> <DEDENT> obj = self.all_objs[obj...
Return State Variables of all ``objIDs``. This method aborts immediately if one or more objects in ``objIDs`` do not exists. :param list objIDs: the IDs of all objects to retrieve. :return: list of ``_BulletData`` instances. :rtype: list
625941de8da39b475bd652b7
def show_object_info(self, position, auto=True): <NEW_LINE> <INDENT> source_code = self.get_source_code() <NEW_LINE> offset = self.find_nearest_function_call(position) <NEW_LINE> helplist = self.introspection_plugin.get_calltip_and_docs(source_code, offset, self.filename) <NEW_LINE> if not helplist: <NEW_LINE> <INDENT>...
Show signature calltip and/or docstring in the Object Inspector
625941de97e22403b379d2db
def step_function(nbolos, nsamples, mean=1, std=0.05, nbreaks=1, seed=0): <NEW_LINE> <INDENT> state = np.random.RandomState(seed) <NEW_LINE> gains = np.ones((nbolos, nsamples)) <NEW_LINE> length = nsamples // nbreaks <NEW_LINE> sublength = nsamples // (2*nbreaks) <NEW_LINE> for pos in range(nbreaks): <NEW_LINE> <INDENT...
Generate step functions for each bolometer from 1 to a values drawn from N(mean, std). The full timestream is broken into nbreaks corresponding to retuning of bolometers (gains are reset to one after a break). Return the gains for all bolometers (2 bolo in a pair will have the same break to avoid differential gain). P...
625941de460517430c3944bd
def segment_to_asset(uri, segment, video): <NEW_LINE> <INDENT> asset = {} <NEW_LINE> asset['uri'] = uri <NEW_LINE> asset['videoUri'] = segment['videoUri'] or video['uri'] <NEW_LINE> asset['segmentUri'] = segment['uri'] <NEW_LINE> asset['type'] = 'Segment' <NEW_LINE> asset['keyframe'] = segment['keyframe'] <NEW_LINE> as...
Construct asset data type from a segment and the corresponding video.
625941de7b180e01f3dc4b37
def track_point_in_utc_time(self, action, point_in_time): <NEW_LINE> <INDENT> @ft.wraps(action) <NEW_LINE> def point_in_time_listener(event): <NEW_LINE> <INDENT> now = event.data[ATTR_NOW] <NEW_LINE> if now >= point_in_time and not hasattr(point_in_time_listener, 'run'): <NEW_LINE> <INDENT> point_in_time_...
Adds a listener that fires once after a specific point in UTC time.
625941de7047854f462a1746
def escape(raw): <NEW_LINE> <INDENT> escape_dict = { "<": "&lt;", ">": "&gt;", "\"": "&quot;", "\'": "&apos;", "&": "&amp;", } <NEW_LINE> for key in escape_dict: <NEW_LINE> <INDENT> raw = raw.replace(key, escape_dict[key]) <NEW_LINE> <DEDENT> return raw
HTML转义
625941de8a349b6b435e84b3
def handle_message( self, text_message, message_preprocessor=None, output_channel=None, sender_id=UserMessage.DEFAULT_SENDER_ID ): <NEW_LINE> <INDENT> processor = self._create_processor(message_preprocessor) <NEW_LINE> return processor.handle_message( UserMessage(text_message, output_channel, sender_id))
Handle a single message. If a message preprocessor is passed, the message will be passed to that function first and the return value is then used as the input for the dialogue engine. The return value of this function depends on the ``output_channel``. If the output channel is not set, set to ``None``, or set to ``Co...
625941de8c0ade5d55d3ecfd
def main_(): <NEW_LINE> <INDENT> import plac <NEW_LINE> plac.call(main)
Entry point for console_scripts
625941dea05bb46b383ecb5f
def title(soup, source_url=None): <NEW_LINE> <INDENT> for tag in TITLE_TAGS: <NEW_LINE> <INDENT> data = _extract_tag_data(soup, tag) <NEW_LINE> if data: <NEW_LINE> <INDENT> return text.prepare(data) <NEW_LINE> <DEDENT> <DEDENT> return text.prepare(soup.title.text.strip())
Extract meta title.
625941de460517430c3944be
def setup_platform(hass, config, add_entities, discovery_info=None): <NEW_LINE> <INDENT> hydrawise = hass.data[DATA_HYDRAWISE].data <NEW_LINE> monitored_conditions = config[CONF_MONITORED_CONDITIONS] <NEW_LINE> entities = [ HydrawiseSensor(zone, description) for zone in hydrawise.relays for description in SENSOR_TYPES ...
Set up a sensor for a Hydrawise device.
625941dee1aae11d1e749ffa
def set_ylim_spinner_range(self,ymin,ymax): <NEW_LINE> <INDENT> self.ymin_input.setMinimum(ymin) <NEW_LINE> self.ymax_input.setMinimum(ymin) <NEW_LINE> self.ymin_input.setMaximum(ymax) <NEW_LINE> self.ymax_input.setMaximum(ymax)
Sets the range of the spinners for adjusting ymin and ymax (will also change the size of the display elements) Arguments: ymin -- absolute minimum value to be expected ymax -- absolute maximum value to be expected
625941de711fe17d825426a4
def main(): <NEW_LINE> <INDENT> from lazydoc.lazydoc import generate, document <NEW_LINE> parser = argparse.ArgumentParser(description='Generate documentation - the lazy way') <NEW_LINE> parser.add_argument('-g', '--gen', '--generate', help="generate sphinx doc directories", action='store_true') <NEW_LINE> parser.add_a...
Run the main function
625941decdde0d52a9e53375
def index(request): <NEW_LINE> <INDENT> latest_question_list = Question.objects.order_by('-pub_date')[:5] <NEW_LINE> context = {'latest_question_list': latest_question_list} <NEW_LINE> return render(request, 'polls/index.html', context)
显示最新的一些问卷 :param request: :return:
625941dea05bb46b383ecb60
def get_data(config): <NEW_LINE> <INDENT> gh = config['GitHub'] <NEW_LINE> url = f"https://github.com/{gh.user}/{gh.repo}/archive/{gh.tag}.zip" <NEW_LINE> headers = { 'Authorization': f'token { gh.token}' } if gh.token else {} <NEW_LINE> logging.info(f'Retrieving {url}\n') <NEW_LINE> rq = urq.Request(url, headers=head...
Get the configured release from GitHub; return a ZipRepo for it.
625941de1f037a2d8b94653d
def __getattr__(self, name): <NEW_LINE> <INDENT> if name in self.params: <NEW_LINE> <INDENT> return self.params[name] <NEW_LINE> <DEDENT> raise AttributeError("Unknown folder attribute " + name + ".")
Returns folder parameter. Folder parameters stored in :py:attr:`Jobdict.params` can also be accessed via the ``.`` operator.
625941dee8904600ed9f2271
def set_speed(self, speed): <NEW_LINE> <INDENT> self._set_sub_text('speed', text=str(speed)) <NEW_LINE> return self
Set the value of the <speed> element. Arguments: speed -- The speed at which the entity is moving, in meters per second
625941dead47b63b2c50a2be
def mergeTwoLists(self, l1, l2): <NEW_LINE> <INDENT> result = ListNode(0) <NEW_LINE> dummyHead = result <NEW_LINE> while l1 is not None and l2 is not None: <NEW_LINE> <INDENT> if l1.val <= l2.val: <NEW_LINE> <INDENT> result.next = ListNode(l1.val) <NEW_LINE> l1 = l1.next <NEW_LINE> <DEDENT> elif l1.val > l2.val: <NEW_L...
:type l1: ListNode :type l2: ListNode :rtype: ListNode
625941de30dc7b7665901ca3
def get_default_encoder_name(self): <NEW_LINE> <INDENT> if sys.platform.startswith("linux"): <NEW_LINE> <INDENT> encoder_name = "mov64" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> encoder_name = "mov32" <NEW_LINE> try: <NEW_LINE> <INDENT> import nuke <NEW_LINE> if nuke.NUKE_VERSION_MAJOR >= 10 and nuke.NUKE_VERSION_R...
Returns the default encoder for use in quicktime generation. The value returned is dependent on the platform and the version of Hiero/NukeStudio being used. The "mov32" encoder does not work in newer versions of Hiero/NukeStudio (10.0v2 or greater) where there is no dependency on the Qt desktop application. :return:...
625941de283ffb24f3c55c3e
@pytest.mark.parametrize("obj", [bytearray(10), bytearray(10 ** 6)]) <NEW_LINE> def test_serializing_to_disk(obj): <NEW_LINE> <INDENT> pxy = proxy_object.asproxy(obj) <NEW_LINE> ProxifyHostFile.serialize_proxy_to_disk_inplace(pxy) <NEW_LINE> assert pxy._pxy_get().serializer == "disk" <NEW_LINE> assert obj == proxy_obje...
Check serializing to disk
625941de15baa723493c42b8
def archive_logs(self, target_dir_path): <NEW_LINE> <INDENT> to_archive = [ ('private/var/log', 'system.'), ('Library/Logs', None), ] <NEW_LINE> for log_path, log_file_prefix in to_archive: <NEW_LINE> <INDENT> log_dir_path = pathjoin(ROOT_PATH, log_path) <NEW_LINE> for file_name in listdir(log_dir_path): <NEW_LINE> <IN...
Main method for archiving files Args: target_dir_path: Path the directory files should be archived to
625941de0a50d4780f6671d5
def change_shift(self, shift): <NEW_LINE> <INDENT> self.shift = shift <NEW_LINE> self.encryption_dict = self.build_shift_dict(self, shift) <NEW_LINE> self.message_text_encrypted = self.apply_shift(self, shift)
Changes self.shift of the PlaintextMessage and updates other attributes determined by shift. shift (integer): the new shift that should be associated with this message. 0 <= shift < 26 Returns: nothing
625941de23849d37ff7b33cd
def cancel_subscription(self, subscription_id): <NEW_LINE> <INDENT> action = "Cancel subscription #%s" % subscription_id <NEW_LINE> db = current.db <NEW_LINE> s3db = current.s3db <NEW_LINE> stable = s3db.fin_subscription <NEW_LINE> row = db(stable.id == subscription_id).select(stable.refno, stable.status, limitby = (0,...
Cancel a subscription Args: subscription_id: the subscription record ID Returns: True if successful, or False on error
625941de442bda511e8be754
def ReadHillslopeData(DataDirectory, FilenamePrefix): <NEW_LINE> <INDENT> Suffix = '_HilltopData.csv' <NEW_LINE> Filename = FilenamePrefix+Suffix <NEW_LINE> HillslopeData = pd.read_csv(DataDirectory+Filename) <NEW_LINE> HillslopeData = HillslopeData.dropna() <NEW_LINE> HillslopeData = HillslopeData[HillslopeData.BasinI...
This function reads in the file with the suffix '_HilltopData.csv' to a pandas dataframe Args: DataDirectory: the data directory FilenamePrefix: the file name prefix Returns: pandas dataframe with data from the csv file Author: MDH
625941de73bcbd0ca4b2c3b6
def _create_rights_basis_license(db_stmt, license_information): <NEW_LINE> <INDENT> create_kwargs = {"rightsstatement": db_stmt} <NEW_LINE> create_kwargs.update( _get_dates( license_information, "license_applicable_dates", prefix="licenseapplicable" ) ) <NEW_LINE> create_kwargs.update( _get_simple_attr(license_informat...
Persist ``licenseInformation``. <xs:complexType name="licenseInformationComplexType"> <xs:choice> <xs:sequence> <xs:element ref="licenseDocumentationIdentifier" maxOccurs="unbounded"/> <xs:element ref="licenseTerms" minOccurs="0"/> <xs:element ref="licenseNote" minOccurs...
625941de4e696a04525c978d
def compute_depths(self, queue, depth_dict): <NEW_LINE> <INDENT> while queue: <NEW_LINE> <INDENT> table = queue.popleft() <NEW_LINE> table_obj = self.schema_graph.table_dictionary[table] <NEW_LINE> for relationship in table_obj.incoming_relationships: <NEW_LINE> <INDENT> if relationship.identifier in self.relationship_...
Do a BFS to compute min-distance of tables to set of tables already in queue.
625941de56ac1b37e626450a
def khop_graph(g, k, copy_ndata=True): <NEW_LINE> <INDENT> assert g.is_homogeneous, 'only homogeneous graph is supported' <NEW_LINE> n = g.number_of_nodes() <NEW_LINE> adj_k = g.adj(transpose=True, scipy_fmt=g.formats()['created'][0]) ** k <NEW_LINE> adj_k = adj_k.tocoo() <NEW_LINE> multiplicity = adj_k.data <NE...
Return the graph whose edges connect the :attr:`k`-hop neighbors of the original graph. More specifically, an edge from node ``u`` and node ``v`` exists in the new graph if and only if a path with length :attr:`k` exists from node ``u`` to node ``v`` in the original graph. The adjacency matrix of the returned graph i...
625941de4428ac0f6e5bab35
def get_object(self, ref, revision=None, never_decrypt=False, transparent_decrypt=True): <NEW_LINE> <INDENT> if revision is None: <NEW_LINE> <INDENT> obj = self.cache_get_indirect_object(ref.generation, ref.idnum) <NEW_LINE> if obj is None: <NEW_LINE> <INDENT> obj = self._read_object(ref, self.xrefs[ref], never_decrypt...
Read an object from the input stream. :param ref: :class:`~.generic.Reference` to the object. :param revision: Revision number, to return the historical value of a reference. This always bypasses the cache. The oldest revision is numbered `0`. See also :class:`.HistoricalResolver`. :param never_dec...
625941de5fc7496912cc3cbe
def __init__( self, datasource_spec, name, rrdtype=None, createCmd=None, isrow=None, rrdmin=None, rrdmax=None, description=None, aliases=None, shorthand=None, extra_params=None, _source_location=None, zplog=None ): <NEW_LINE> <INDENT> super(RRDDatapointSpec, self).__init__(_source_location=_source_location) <NEW_LINE> ...
Create an RRDDatapoint Specification :param rrdtype: TODO :type rrdtype: str :param createCmd: TODO :type createCmd: str :param isrow: TODO :type isrow: bool :param rrdmin: TODO :type rrdmin: int :param rrdmax: TODO :type rrdmax: int :param description: TODO :type description: str :param aliases: TODO :type aliases: d...
625941de8a43f66fc4b543a2
def get_birth_arv_visit_2000(infant_identifier): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> visit_2000 = InfantVisit.objects.get( subject_identifier=infant_identifier, appointment__visit_definition__code=2000) <NEW_LINE> infant_birth_arv = InfantBirthArv.objects.get(infant_visit=visit_2000) <NEW_LINE> return infant_b...
Check if infant was given AZT at birth
625941de187af65679ca5460
def set_pre_diff_code(self, *args, **kwargs): <NEW_LINE> <INDENT> return _ieee802_11_swig.constellation_64qam_sptr_set_pre_diff_code(self, *args, **kwargs)
set_pre_diff_code(constellation_64qam_sptr self, bool a)
625941debaa26c4b54cb145d
def get_instance(self, index): <NEW_LINE> <INDENT> if isinstance(index, list): <NEW_LINE> <INDENT> return [self.get_instance(elem) for elem in index] <NEW_LINE> <DEDENT> return self.__index2instance[index]
Get corresponding instance of query index. if index is invalid, then throws exception. :param index: is query index, possibly iterable. :return: is corresponding instance.
625941decc40096d61595c90
def get_binance(key, secret): <NEW_LINE> <INDENT> client = BinClient(key, secret) <NEW_LINE> acct = client.get_account() <NEW_LINE> df = pd.DataFrame(acct['balances']) <NEW_LINE> df['source'] = 'binance' <NEW_LINE> df = df[['free', 'asset', 'source']] <NEW_LINE> df.columns = ['balance', 'coin', 'source'] <NEW_LINE> ret...
Get balance from binance exchange API.
625941de9b70327d1c4e1117
def get_mono_init_scan_rate_nm(self): <NEW_LINE> <INDENT> init_scan_rate = c_double() <NEW_LINE> error_code = c_long() <NEW_LINE> PrincetonInstruments._SDK.ARC_get_Mono_Init_ScanRate_nm(self._mono_enum, init_scan_rate, error_code) <NEW_LINE> return init_scan_rate.value
Returns the initial wavelength scan rate (on instrument reboot). Returns ------- :class:`float` The power-up scan rate in nm / minute.
625941def8510a7c17cf9a3f
def __init__(self, setup=None, target=None, teardown=None): <NEW_LINE> <INDENT> self._started = threading.Event() <NEW_LINE> self._running = threading.Event() <NEW_LINE> self._resume = threading.Event() <NEW_LINE> self._setup = self.setup if setup is None else setup <NEW_LINE> self._target = self.run if target is None ...
:param func setup: specific setup function to use (otherwise self.setup) :param func target: specific target function to use (otherwise self.run) :param func teardown: specific teardown function to use (otherwise self.teardown)
625941de01c39578d7e7517c
def p_in_list(t): <NEW_LINE> <INDENT> t[0] = ListNode(t[2])
in_list : LBRACKET expression
625941de4527f215b584c794
def write_to_log(lines, init=False): <NEW_LINE> <INDENT> if init: <NEW_LINE> <INDENT> fp = open(threedhst.options['ROOT_GRISM']+'.iraf.log','w') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fp = open(threedhst.options['ROOT_GRISM']+'.iraf.log','a') <NEW_LINE> <DEDENT> fp.writelines(lines) <NEW_LINE> fp.close()
write_to_log(lines, init=False) Write output of IRAF tasks to options['ROOT_GRISM']+'.iraf.log'
625941de76e4537e8c3519b5
def app_uninstall(fn, prefix=config.root_dir): <NEW_LINE> <INDENT> import conda.cli.common as common <NEW_LINE> import conda.plan as plan <NEW_LINE> index = None <NEW_LINE> specs = [fn2spec(fn)] <NEW_LINE> if (plan.is_root_prefix(prefix) and common.names_in_specs(common.root_no_rm, specs)): <NEW_LINE> <INDENT> raise Va...
Uninstall application `fn` (but not its dependencies). Like `conda remove fn`.
625941de711fe17d825426a5
def make_component_url(api_endpoint, component_id): <NEW_LINE> <INDENT> if api_endpoint[-1] != '/': <NEW_LINE> <INDENT> api_endpoint += '/' <NEW_LINE> <DEDENT> component_base = urljoin(api_endpoint, 'v1/components/') <NEW_LINE> return urljoin(component_base, str(component_id))
Make the API URL of a Cachet component. Arguments: api_endpoint (str): HTTP API endpoint of Cachet, usually at `/api/`. component_id (int): Cachet component ID number. Returns: str: API URL of the component.
625941de377c676e912724e8
def reset_cables(self): <NEW_LINE> <INDENT> self.cables = {}
Remove all cables in a district.
625941de4e4d5625662d4714
def load(): <NEW_LINE> <INDENT> songs.load() <NEW_LINE> bibles.load() <NEW_LINE> static.load()
Entry point for setup script.
625941defff4ab517eb2f77e
def add_covariance(self, covariance): <NEW_LINE> <INDENT> if isinstance(covariance, BaseCovariance): <NEW_LINE> <INDENT> cov = covariance <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cov = BaseCovariance.make(covariance) <NEW_LINE> <DEDENT> expected_size = len(self) <NEW_LINE> if not cov.size == expected_size: <NEW_LI...
Once you have finished adding data points, add a covariance for the entire set. Parameters ---------- covariance: array or list 2x2 numpy array containing the covariance of the added data points OR a list of blocks Returns ------- None
625941de71ff763f4b5499d2
def foo(a): <NEW_LINE> <INDENT> pass
foo a (int): an integer.
625941de379a373c97cfae87
def _download_file(self, url): <NEW_LINE> <INDENT> req = requests.get(url) <NEW_LINE> if req.status_code != 200: <NEW_LINE> <INDENT> raise ValidationError(self._errors['failed']) <NEW_LINE> <DEDENT> return ContentFile(req.content)
Downloads the file at the given URL
625941def548e778e58cd8c0
def symmetry_involution(self): <NEW_LINE> <INDENT> R = self.parent().realization_of().a_realization() <NEW_LINE> A = R(self).symmetry_involution() <NEW_LINE> return self.parent().get_isometry(A)
Return the involutory isometry fixing the given point. EXAMPLES:: sage: z = HyperbolicPlane().UHP().get_point(3 + 2*I) sage: z.symmetry_involution() Isometry in UHP [ 3/2 -13/2] [ 1/2 -3/2] sage: HyperbolicPlane().UHP().get_point(I).symmetry_involution() Isometry in UHP [ 0 -1] ...
625941de5fc7496912cc3cbf
def __init__(self): <NEW_LINE> <INDENT> self.expect_header = None <NEW_LINE> self.filtered = False
initialize :class:`RequestMessage`
625941de5fdd1c0f98dc0575
def Grow(self,examples,attrs,nPossibleVals,buildDriver,pruner=None, nTries=10,pruneIt=0, needsQuantization=1,progressCallback=None, **buildArgs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> silent = buildArgs['silent'] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> silent = 0 <NEW_LINE> <DEDENT> buildArgs['silent']=1...
Grows the composite **Arguments** - examples: a list of examples to be used in training - attrs: a list of the variables to be used in training - nPossibleVals: this is used to provide a list of the number of possible values for each variable. It is used if the local quantBounds have not been set (for e...
625941de15fb5d323cde0e55
def setx(self, name, value, ttl): <NEW_LINE> <INDENT> if isinstance(ttl, datetime.timedelta): <NEW_LINE> <INDENT> ttl = ttl.seconds + ttl.days * 24 * 3600 <NEW_LINE> <DEDENT> ttl = get_positive_integer('ttl', ttl) <NEW_LINE> return self.execute_command('setx', name, value, ttl)
Set the value of key ``name`` to ``value`` that expires in ``ttl`` seconds. ``ttl`` can be represented by an integer or a Python timedelta object. Like **Redis.SETEX** :param string name: the key name :param string value: a string or an object can be converted to string :param int ttl: positive int seconds or timedel...
625941debd1bec0571d9096f
def totalNodeCount(self, radix): <NEW_LINE> <INDENT> current = radix <NEW_LINE> for k, v in current.items(): <NEW_LINE> <INDENT> self.totalNodes += 1 <NEW_LINE> if type(v) == dict: <NEW_LINE> <INDENT> self.totalNodeCount(v) <NEW_LINE> <DEDENT> <DEDENT> return self.totalNodes
Returns total amount of nodes
625941de0fa83653e46572fa
def stdlib_deployment_targets(): <NEW_LINE> <INDENT> system = platform.system() <NEW_LINE> machine = platform.machine() <NEW_LINE> if system == 'Linux': <NEW_LINE> <INDENT> if machine == 'x86_64': <NEW_LINE> <INDENT> return [ 'linux-x86_64', 'android-armv7', ] <NEW_LINE> <DEDENT> elif machine.startswith('armv6'): <NEW_...
Return deployment targets for the Swift stdlib, based on the host machine. If the host machine is not one of the recognized ones, return None.
625941de4e4d5625662d4715
def Builder(**kw): <NEW_LINE> <INDENT> composite = None <NEW_LINE> if 'generator' in kw: <NEW_LINE> <INDENT> if 'action' in kw: <NEW_LINE> <INDENT> raise UserError("You must not specify both an action and a generator.") <NEW_LINE> <DEDENT> kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {}) <NEW_LIN...
A factory for builder objects.
625941ded486a94d0b98e488
@receiver_subclasses(pre_save, ConfigEntity, "config_entity_pre_save") <NEW_LINE> def on_config_entity_pre_save(sender, **kwargs): <NEW_LINE> <INDENT> instance = InstanceBundle.extract_single_instance(**kwargs) <NEW_LINE> if instance._no_post_save_publishing: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not instan...
A presave event handler. Currently this just defaults the bounds of the instance to those of its parent :param sender: :param kwargs: :return:
625941debe8e80087fb20f7f
def __exit__(self, type, value, traceback): <NEW_LINE> <INDENT> self.close()
Function to exit a with block which closes the table object.
625941de1b99ca400220adf3
def roc(self, data, colX, colY, params, params_keys): <NEW_LINE> <INDENT> ax = self.axs[self.axs_ind] <NEW_LINE> ax.plot(np.array(data[colX]), np.array(data[colY]), 'b', label='AUC = %0.2f' % metrics.auc(np.array(data[colX]), np.array(data[colY]))) <NEW_LINE> ax.legend(loc='lower right') <NEW_LINE> ax.plot([0, 1], [0, ...
Send a data frame with two columns 1) array of false positive values and 2) array of true positive values
625941de26068e7796caf024
def created(self, user_id): <NEW_LINE> <INDENT> return list(map(self.to_notification_instance, list(Notification.select().where(Notification.user_id == user_id, Notification.status == NotificationStatus.CREATED.value))))
Returns notifications with CREATED status for user with ID == user_id
625941de50485f2cf553d0dc
def category_edit(params): <NEW_LINE> <INDENT> category = session.query(Category).filter(Category.category_id == params["category_id"]).one_or_none() <NEW_LINE> if category: <NEW_LINE> <INDENT> session.query(Category).filter(Category.category_id == params["category_id"]).update( {Category.name: params["name"], Category...
params = { "opr" : "edit", "data": { "category_id": n, "name": "", "sn": "" } } :param params: :return:
625941de283ffb24f3c55c3f
def test_integer(self): <NEW_LINE> <INDENT> self.check_integer(integer) <NEW_LINE> with self.assertRaises(SyntaxError): <NEW_LINE> <INDENT> integer(BDFCard([1.] ), 1, 'field') <NEW_LINE> <DEDENT> with self.assertRaises(SyntaxError): <NEW_LINE> <INDENT> integer(BDFCard([1.] ), 0, 'field') <NEW_LINE> <DEDENT> with self...
value = integer(card, n, fieldname)
625941de96565a6dacc8fa0b
def _analizeIndex(self, buf): <NEW_LINE> <INDENT> p1 = buf.find('(') <NEW_LINE> nm = buf[:p1].split(' ')[2].strip() <NEW_LINE> p2 = buf.rfind(')') <NEW_LINE> wk = buf[p1+1:p2] <NEW_LINE> return nm, {'columns': super().seqAndStrip(wk, ','), 'source': buf}
create index を解析する IN : 'create index (colA1, colA2)' OUT : ['colA1', 'colA2']
625941debe7bc26dc91cd93b
def editconfigfile(ui, rc_file): <NEW_LINE> <INDENT> with open(rc_file, 'rb') as f: <NEW_LINE> <INDENT> orig_contents = f.read() <NEW_LINE> <DEDENT> banner = _(b"#HG: editing hg config file: ") + rc_file + _(b"\n\n") <NEW_LINE> contents = banner + orig_contents <NEW_LINE> new_contents = ui.edit(contents, ui.username())...
Allows the user to edit the specified config file. This uses the `ui.edit` function, similar to the one used for editing commit messages.
625941deab23a570cc2504c6
def _create_payment_term(self): <NEW_LINE> <INDENT> PaymentTerm = POOL.get('account.invoice.payment_term') <NEW_LINE> return PaymentTerm.create([{ 'name': 'Direct', 'lines': [('create', [{'type': 'remainder'}])] }])
Create a simple payment term with all advance
625941de96565a6dacc8fa0c
@api.route('/posts/<id>/bookmarks/', methods=('POST',)) <NEW_LINE> @auth_required <NEW_LINE> @io_annotated <NEW_LINE> def bookmarks_create(id: fields.Int(location='view_args')) -> BookmarkSchema(): <NEW_LINE> <INDENT> kwargs = dict(post_id=id, user_id=current_user_data['id']) <NEW_LINE> b = Bookmark(**kwargs) <NEW_LINE...
收藏post.
625941de0383005118ecf923
def stop(self): <NEW_LINE> <INDENT> self.abort() <NEW_LINE> self.emit("done")
stop the thread, do not override
625941de5166f23b2e1a549a
def local_minima(a): <NEW_LINE> <INDENT> minima = np.r_[True, a[1:] < a[:-1]] & np.r_[a[:-1] < a[1:], True] <NEW_LINE> return minima.nonzero()[0]
Return indexes of local minima in a.
625941de8da39b475bd652b8
def test_now_jabber(self): <NEW_LINE> <INDENT> tp = product.TextProduct( get_file('NOWDMX.txt') ) <NEW_LINE> j = tp.get_jabbers("http://localhost") <NEW_LINE> self.assertEqual(j[0][0], ("DMX issues Short-term Forecast (NOW) " +"http://localhost?pid=201003041442-KDMX-FPUS73-NOWDMX"))
See if we can process a NOW and get the jabber result
625941deb545ff76a8914157
def __init__(self, base_model, params): <NEW_LINE> <INDENT> super(UnifiedModule, self).__init__(name="unified_module") <NEW_LINE> self._model_name = params.name <NEW_LINE> self._dropout_rate = params.cls_dropout_rate <NEW_LINE> self._modality = params.modality <NEW_LINE> self._num_classes = params.num_classes <NEW_LINE...
Unified Backbone Model. Args: base_model: the base model. params: Hyperparameters of the model.
625941de24f1403a92600ea5
def test_unsubscribe(handler): <NEW_LINE> <INDENT> e = Event() <NEW_LINE> e.subscribe(handler.func) <NEW_LINE> e.unsubscribe(handler.func) <NEW_LINE> e.notify("123") <NEW_LINE> assert handler.handled is False
Handler should not be called after unsubscribe
625941de097d151d1a223199
def get_taxon_by_name(self, name): <NEW_LINE> <INDENT> nodes_founded = self.taxonomy.tree.search_nodes(name=name) <NEW_LINE> if not nodes_founded: <NEW_LINE> <INDENT> raise KeyError('No node founded for the species name: {}'.format(name)) <NEW_LINE> <DEDENT> elif len(nodes_founded) == 1: <NEW_LINE> <INDENT> return node...
Get the :obj:`ete3.TreeNode` object of the :obj:`pyham.taxonomy.Taxonomy`.tree corresponding of the query name. Args: name (:obj:`str`): Name of the treeNode. Returns: :obj:`ete3.TreeNode` or raise KeyError
625941de67a9b606de4a81f9
def get_load(self): <NEW_LINE> <INDENT> return self.ask("OUTPUT:LOAD?","float")
Get the output load
625941de5510c4643540f71e
def restart_clnt(step): <NEW_LINE> <INDENT> stop_clnt() <NEW_LINE> fabric_sudo_command('(rm nohup.out; nohup ' + world.clntCfg["command"] + ' & ); sleep 1;')
This function shut downs and later starts dhclient on DUT. @step("Restart client.")
625941decc0a2c11143dd1d3
def calc_word_value(word): <NEW_LINE> <INDENT> return sum(LETTER_SCORES.get(c, 0) for c in word.upper())
Calculate the value of the word entered into function using imported constant mapping LETTER_SCORES
625941de187af65679ca5461
def record_sum(self, key: str, value: Any, exclude: Optional[Union[str, Tuple[str, ...]]] = None) -> None: <NEW_LINE> <INDENT> self.name_to_value[key] += value <NEW_LINE> self.name_to_excluded[key] = exclude
The same as record(), but if called many times, values summed. :param key: (Any) save to log this key :param value: (Number) save to log this value :param exclude: (str or tuple) outputs to be excluded
625941de50812a4eaa59c660
def __init__(self, msg=None, msgparts=None, hdrs_dict=None, body=None, reqid=None, msgctxt=None): <NEW_LINE> <INDENT> super(STMsgReq, self).__init__(msg=msg, msgparts=msgparts, hdrs_dict=hdrs_dict, body=body, reqid=reqid, msgctxt=msgctxt)
Initializes an instance of this class arguments -: 1) msg -> message as a string 2) msgparts -> msgparts as a tuple (parts separated by lineseparator) 3) hdrs_dict -> list of hdrs as a dictionary 4) body -> message body as a string 5) reqid -> as a uuid (typically as a uuid.uuid4() ...
625941de63d6d428bbe44831
def _bulk_create_part_inventories(api: Api, df: pd.DataFrame, parts_dict: dict) -> dict: <NEW_LINE> <INDENT> create_mutations = [] <NEW_LINE> for part_info in df.groupby(['Part number', 'Serial number']).indices: <NEW_LINE> <INDENT> mutation_input = {'serialNumber': part_info[1], 'quantity': 1, 'partId': parts_dict[par...
Bulk create inventory items for every unique serial and part number in CSV. Args: api (Api): API instance to send authenticated requests df (pd.DataFrame): Dataframe of batch run creation CSV parts_dict (dict): Mapping from part number to part id Returns: dict: Mapping of part/serial number tuple to n...
625941de26238365f5f0f1b4
def analyze_results(fragments, results, insert_number): <NEW_LINE> <INDENT> sum_ul = 0 <NEW_LINE> for key in results: <NEW_LINE> <INDENT> sum_ul += results[key] <NEW_LINE> if results[key] < 1: <NEW_LINE> <INDENT> print('ul too small for {key}. May want to dilute.'.format(key=key)) <NEW_LINE> <DEDENT> <DEDENT> if sum_ul...
Analyze results for values that may be too high or too low (WORK IN PROGRESS). test ul are within 10 ul available for standard reaction test ul amount is reasonable
625941de38b623060ff0b12f
def __init__( self, choice_rules: List[ChoiceRule], *, next_state: AbstractState, ): <NEW_LINE> <INDENT> super().__init__(next_state) <NEW_LINE> self.choice_rules = choice_rules
Initialize an AndChoice. Args: choice_rules: A list of Choice Rules which must ALL evaluate to true. next_state: The state to transition to if true.
625941debe8e80087fb20f80
def find_seed(coords, direc): <NEW_LINE> <INDENT> side = direc % 2 <NEW_LINE> axis = direc // 2 <NEW_LINE> a_side = ["np.argmin", "np.argmax"] <NEW_LINE> ext = eval(a_side[side])(coords[:, axis]) <NEW_LINE> return coords[ext]
Find (one of) the most distant voxels in a given direction and return its coordinates Parameters ---------- coords: np.array (coordinates of each voxel on lines) coordinates of voxels in the mask direc: int 0: x 1: -x 2: y 3: -y 4: z 5: -z Returns ------- ext: [(int)x, (int)y, (int)z] th...
625941de925a0f43d254a1bb
def test_offsetQuery(self): <NEW_LINE> <INDENT> ms = [] <NEW_LINE> for x in range(10): <NEW_LINE> <INDENT> ms.append(self.createIncomingMessage()) <NEW_LINE> <DEDENT> sq = MailboxSelector(self.store) <NEW_LINE> sq.refineByStatus(INCOMING_STATUS) <NEW_LINE> self.assertEquals(ms[3:5], sq.offsetQuery(3, 5-3))
Verify that offsetQuery can give us a slice of the middle of a mailbox.
625941de377c676e912724e9
def Expectation_Maximization(samples, k, model, max_iterations=100, learn_gsm=False): <NEW_LINE> <INDENT> N, d = samples.shape <NEW_LINE> c = np.ones((N, k)) <NEW_LINE> pi = model.mix <NEW_LINE> covariance = model.cov <NEW_LINE> r_squared = np.random.rand(k,1) <NEW_LINE> if learn_gsm: <NEW_LINE> <INDENT> mean = model.g...
Run the iterative EM Algorithm on the given data. :param samples: [numpy.ndarray] 2d array, each row contains a flattened image patch of size d. Nxd :param k: number of guassians :param max_iterations: stop at this number of iterations, if not yet converged :param learn_gsm: if True, do not learn mean and assume cov=r*...
625941ded164cc6175783090
def deleteDuplicates(self, head): <NEW_LINE> <INDENT> if head is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> last = head <NEW_LINE> p = head.next <NEW_LINE> while p is not None: <NEW_LINE> <INDENT> if p.val == last.val: <NEW_LINE> <INDENT> last.next = p.next <NEW_LINE> q = p <NEW_LINE> p = p.next <NEW_LIN...
:type head: ListNode :rtype: ListNode
625941ded6c5a1020814438f
def add_option(self, key, value): <NEW_LINE> <INDENT> self._validate_option(key) <NEW_LINE> if key not in self._options: <NEW_LINE> <INDENT> self._options[key] = [] <NEW_LINE> <DEDENT> self._options[key].append(value) <NEW_LINE> return self
Add an option @param key: @type key: str @param value: @type value: mixed @return: @rtype: self
625941ded58c6744b4257fa0
def get_chooser_context(request): <NEW_LINE> <INDENT> collections = Collection.objects.all() <NEW_LINE> if len(collections) < 2: <NEW_LINE> <INDENT> collections = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> collections = Collection.order_for_display(collections) <NEW_LINE> <DEDENT> return { 'searchform': SearchF...
Helper function to return common template context variables for the main chooser view
625941de15baa723493c42b9
def findCoalesceable(self): <NEW_LINE> <INDENT> candidates = [] <NEW_LINE> srSwitch = self.xapi.srRecord["other_config"].get(VDI.DB_COALESCE) <NEW_LINE> if srSwitch == "false": <NEW_LINE> <INDENT> Util.log("cleanup: Coalesce disabled for this SR") <NEW_LINE> return candidates <NEW_LINE> <DEDENT> journals = self.journal...
Find a coalesceable VDI. Return a vdi that should be coalesced (choosing one among all coalesceable candidates according to some criteria) or None if there is no VDI that could be coalesced
625941deec188e330fd5aadb
def _getStepsObjects(self): <NEW_LINE> <INDENT> return [self.stepsDiffBound]
Return a list of the steps objects that this named object holds.
625941deeab8aa0e5d26de9b
def update_index_settings(client): <NEW_LINE> <INDENT> index = get_aliased_index(client) <NEW_LINE> _update_index_analysis(client.conn, index, ANALYSIS_SETTINGS) <NEW_LINE> _update_index_mappings(client.conn, index, {client.t.annotation: ANNOTATION_MAPPING})
Update the index settings (analysis and mappings) to their current state. May raise if Elasticsearch throws a MergeMappingException indicating that the index cannot be updated without reindexing.
625941de30c21e258bdfa7e1
def _parseDatatypes(self): <NEW_LINE> <INDENT> umlNs = self.profile.getroot().nsmap['UML'] <NEW_LINE> qualifiedTag = ".//{{{0}}}DataType".format(umlNs) <NEW_LINE> dtpList = self.profile.getroot().findall(qualifiedTag) <NEW_LINE> datatypes = {} <NEW_LINE> for d in dtpList: <NEW_LINE> <INDENT> datatypes[d.attrib.get('nam...
Parse data types in the profile. Parse the UML profile (profiles/ODM.xmi) and make a dictionary of datatypes where the keys are the datatype names and the values are the datatype xmi.id's
625941de63d6d428bbe44832
def __init__(self, config, gpgkeyring, gpgkeyverifier, outbox_path): <NEW_LINE> <INDENT> self.logger = logging.getLogger('GpgMailer') <NEW_LINE> self.logger.info('Initializing gpgmailer module.') <NEW_LINE> self.config = config <NEW_LINE> self.gpgkeyring = gpgkeyring <NEW_LINE> self.gpgkeyverifier = gpgkeyverifier <NEW...
Constructs an instance of the class including creating local instances of mailsender and gpgmailbuilder. config: The config dictionary read from the program configuration file. gpgkeyring: The GpgKeyring object containing information on all the GPG keys in the program's keyring. gpgkeyverifier: The GpgKeyVerifier ob...
625941de8e05c05ec3eea6b9
def folder_ingest(self, course, author, ingest_folder_id): <NEW_LINE> <INDENT> course_folder_id = self.get_course_folder(course) <NEW_LINE> if not course_folder_id: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> session_mgr = self.get_session_manager() <NEW_LINE> for session in session_mgr.get_session_list(ingest_folde...
Ingest all videos within an identified Panopto folder. The passed author will own all ingested videos. This functionality is available to instructors within the Managed Course section of Mediathread.
625941de55399d3f055889f7
def parsehelper_392(self, node): <NEW_LINE> <INDENT> oldpos = self.pos <NEW_LINE> childs = [] <NEW_LINE> while True: <NEW_LINE> <INDENT> oldpos2 = self.pos <NEW_LINE> c = self.parsehelper_393(node) <NEW_LINE> if c is None: <NEW_LINE> <INDENT> self.pos = oldpos2 <NEW_LINE> break <NEW_LINE> <DEDENT> childs.extend(c) <NEW...
## subexpr ## GrammarNode('*', GrammarNode('S', ["'.'", 'NAME']))
625941dec432627299f04f8a
def get_vertex(self, label): <NEW_LINE> <INDENT> if label not in self.graph: <NEW_LINE> <INDENT> raise ValueError("Vertex not in graph.") <NEW_LINE> <DEDENT> return self.graph[label]
Method to retrieve specified vertices. Process: Verifies vertex presence then returns value. Args: self(Graph): self label(str): Label of vertex to be returned Returns: vertex(Vertex): Returns vertex object
625941de566aa707497f48a7