code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def scale (X, autoscale): <NEW_LINE> <INDENT> nobj, nvar= np.shape(X) <NEW_LINE> wg = np.ones (nvar,dtype=np.float64) <NEW_LINE> if not autoscale: <NEW_LINE> <INDENT> return X, wg <NEW_LINE> <DEDENT> st = np.std (X, axis=0, ddof=1) <NEW_LINE> for i in range (nvar): <NEW_LINE> <INDENT> sti=st[i] <NEW_LINE> if sti<1.0e-7...
Scales the numpy matrix (X) provided as argument by dividing the values by the standard deviation The standard deviation is computed as SSX/(N-1) Return the scaled matrix and the inverse of the sd (weights)
625941d9596a897236089d65
def add_unique_identifiers(pipeline_str): <NEW_LINE> <INDENT> pipeline_str_modified = " {} ".format(pipeline_str) <NEW_LINE> reg_find_proc = r"[^\s{}{}{}]+".format(LANE_TOKEN, FORK_TOKEN, CLOSE_TOKEN) <NEW_LINE> process_names = re.findall(reg_find_proc, pipeline_str_modified) <NEW_LINE> identifiers_to_tags = {} <NEW_LI...
Returns the pipeline string with unique identifiers and a dictionary with references between the unique keys and the original values Parameters ---------- pipeline_str : str Pipeline string Returns ------- str Pipeline string with unique identifiers dict Match between process unique values and original n...
625941d9ec188e330fd5aa41
def tagName(self): <NEW_LINE> <INDENT> return QString()
QString KParts.SelectorInterface.Element.tagName()
625941d9adb09d7d5db6ca35
def update_city(city_id): <NEW_LINE> <INDENT> logging.info('初始化/更新城市信息... city_id={}'.format(city_id)) <NEW_LINE> city_info = get_city_info(city_id) <NEW_LINE> city = City(city_info) <NEW_LINE> db_session = Session() <NEW_LINE> db_session.merge(city) <NEW_LINE> for district_info in city_info['district']: <NEW_LINE> <IN...
初始化/更新城市信息
625941d9fb3f5b602dac393d
def waitTillRelease(self, timeout = 5000): <NEW_LINE> <INDENT> wait_for_edge(self.__pin, GPIO.FALLING, timeout = timeout)
Waits until the button is released. The program is paused.
625941d9d10714528d5fff8c
def register_site_thing(site_thing): <NEW_LINE> <INDENT> register_site_func(site_thing.ld_get_for_site) <NEW_LINE> return site_thing
Register a SiteThingLD class to be included in ``{% ld_for_site %}``.
625941d9aad79263cf390ceb
def issubaspect(subaspect, aspect): <NEW_LINE> <INDENT> subaspect = assert_aspect(subaspect) <NEW_LINE> aspect = assert_aspect(aspect) <NEW_LINE> aspect_qualname = (aspect.__qualname__ if isinstance( aspect, aspectclass) else type(aspect).__qualname__) <NEW_LINE> subaspect_qualname = (subaspect.__qualname__ if isinstan...
This function checks whether or not ``subaspect`` is a subaspect of ``aspect``.
625941d94f88993c3716c30c
def buildInstanceNode(self, instance): <NEW_LINE> <INDENT> nodePdo = self.__builder.Ec2InstanceNode(instance) <NEW_LINE> return nodePdo.build(self.__builder)
@types: ec2.Ami.Instance -> ObjectStateHolder
625941d94e696a04525c96f3
def dirname(pathname): <NEW_LINE> <INDENT> return os.path.dirname(pathname) or '.'
Same as `os.path.dirname` but return `.` in case of path names with no directory component.
625941d9656771135c3ebb18
def reset(self): <NEW_LINE> <INDENT> for p in self.pars: <NEW_LINE> <INDENT> p.reset()
Reset the parameter values. Restores each parameter to the last value it was set to. This allows the parameters to be easily reset after a fit.
625941d96e29344779a628b7
def _func_args_arity(func): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return len(inspect.signature(func).parameters) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return len(inspect.getargspec(func).args)
Inspect function arity: compatibility for Python 2.7 and 3
625941d923849d37ff7b3334
def get_key_pair(self, name: str): <NEW_LINE> <INDENT> action = "ReadKeypairs" <NEW_LINE> data = '{"Filters": {"KeypairNames" : ["' + name + '"]}}' <NEW_LINE> response = self._call_api(action, data) <NEW_LINE> if response.status_code == 200: <NEW_LINE> <INDENT> return self._to_key_pair(response.json()["Keypairs"][0]) <...
Get a specific key pair. :param name: the name of the key pair you want to select (required) :type name: ``str`` :return: the selected key pair :rtype: ``dict``
625941d960cbc95b062c67ea
def unload(self, _=None): <NEW_LINE> <INDENT> AardwolfBasePlugin.unload(self) <NEW_LINE> self.statdb.close()
handle unloading
625941d915baa723493c421e
def set_data(self, volume): <NEW_LINE> <INDENT> if volume.shape != self._volume_array.shape: <NEW_LINE> <INDENT> raise ValueError("New volume must be the same shape as the " "old one") <NEW_LINE> <DEDENT> self._volume_array[:] = volume <NEW_LINE> self._float_array.Modified() <NEW_LINE> self._render()
Change the data displayed. The new array must have the same shape as the current one.
625941d921a7993f00bc7f9a
def __init__(self, text, style, bulletText = None, dedent=0, maxLineLength=None, splitChars=None, newLineChars=""): <NEW_LINE> <INDENT> self.style = style <NEW_LINE> self.bulletText = bulletText <NEW_LINE> self.lines = _dedenter(text,dedent) <NEW_LINE> if text and maxLineLength: <NEW_LINE> <INDENT> self.lines = splitLi...
text is the text to display. If dedent is set then common leading space will be chopped off the front (for example if the entire text is indented 6 spaces or more then each line will have 6 spaces removed from the front).
625941d9be383301e01b5729
def testNoError(self): <NEW_LINE> <INDENT> schema = self.dataset.makeMinimalSchema() <NEW_LINE> config = self.makeConfig() <NEW_LINE> config.slots.centroid = "truth" <NEW_LINE> task = lsst.meas.base.SingleFrameMeasurementTask(schema=schema, config=config) <NEW_LINE> exposure, cat = self.dataset.realize(noise=100.0, sch...
Test that the ``resetToPeak`` flag is not set when no error seen.
625941d95f7d997b87174d41
def get_time(self, ch, start, stop): <NEW_LINE> <INDENT> q = self.qs[ch] <NEW_LINE> ts = self.timesteps[ch] <NEW_LINE> tstart, tstop, shift = self._mod_times(q, start, stop) <NEW_LINE> obj = self.fid[ch] <NEW_LINE> timeraw = obj.root.time[tstart:tstop+512/q] <NEW_LINE> tar = np.array(timeraw, 'float64')/1000 <NEW_LINE>...
return times, by upscaling according to each channel's individual q factor
625941d9fff4ab517eb2f6e4
def update_output_cubes(out_cubes, kout, basins, nbasin): <NEW_LINE> <INDENT> for key in out_cubes.keys(): <NEW_LINE> <INDENT> cube = out_cubes[key] <NEW_LINE> bind = np.where(basins.data.filled() == nbasin) <NEW_LINE> if len(cube.shape) == 3: <NEW_LINE> <INDENT> cube.data[:, bind[0], bind[1]] = kout[key][:, None] <NEW...
Update cubes with Kalman filter output for the specified basin in cubes.
625941d991af0d3eaac9bcc2
def socket_write(self, socket_num, buffer): <NEW_LINE> <INDENT> if self._debug: <NEW_LINE> <INDENT> print("Writing:", buffer) <NEW_LINE> <DEDENT> self._socknum_ll[0][0] = socket_num <NEW_LINE> resp = self._send_command_get_response(_SEND_DATA_TCP_CMD, (self._socknum_ll[0], buffer), sent_param_len_16=True) <NEW_LINE> se...
Write the bytearray buffer to a socket
625941d9435de62698dfdef4
def step(self, action_n): <NEW_LINE> <INDENT> logger.debug("World Step " + str(action_n)) <NEW_LINE> dx, dy = self.target_movement(self._target, self) <NEW_LINE> self._target.move(dx, dy, self._action_time_step) <NEW_LINE> for drone in self._drones: <NEW_LINE> <INDENT> drone.take_action(action_n[drone.id],self._action_...
Update state of the world in following sequence 1. Update target's position 2. Update drones' position 3. Update drones' observation 4. Rendering on canvas :param action_n: actions of drones :return:
625941d992d797404e304432
def get_song_byCd(id, param): <NEW_LINE> <INDENT> order_param = __check_param(param) <NEW_LINE> song = Song.objects.select_related().filter(cd__id=id).order_by(order_param) <NEW_LINE> song = __reverse(song, param, order_param) <NEW_LINE> return song
models.Cd.idの完全一致でmodels.Songクラスを取得する Parameters ---------- id : int or str 検索するCDのID param : request.GET['sort] リクエストのsortパラメーター Returns ------- song models.Songクラスを返す
625941d91f5feb6acb0c4df4
def get_pythread(): <NEW_LINE> <INDENT> global _pythread <NEW_LINE> if _pythread: <NEW_LINE> <INDENT> return _pythread <NEW_LINE> <DEDENT> import imp <NEW_LINE> fp, path, desc = imp.find_module('thread') <NEW_LINE> try: <NEW_LINE> <INDENT> _pythread = imp.load_module('pythread', fp, path, desc) <NEW_LINE> <DEDENT> fina...
Loads the 'thread' module, free of monkey patching.
625941d9eab8aa0e5d26de00
def test_set_handler_status_ignores_none_content(self): <NEW_LINE> <INDENT> self._prepare_handler_state() <NEW_LINE> self._prepare_handler_config() <NEW_LINE> status = "Ready" <NEW_LINE> code = 0 <NEW_LINE> message = "A message" <NEW_LINE> try: <NEW_LINE> <INDENT> with patch('json.dumps', return_value=None): <NEW_LINE>...
Validate that set_handler_status ignore cases where json.dumps returns a value of None.
625941d9b7558d58953c51b7
def saveiv(scene,filename): <NEW_LINE> <INDENT> from pivy import coin <NEW_LINE> wa=coin.SoWriteAction() <NEW_LINE> wa.getOutput().openFile(filename) <NEW_LINE> wa.getOutput().setBinary(False) <NEW_LINE> wa.apply(sc) <NEW_LINE> wa.getOutput().closeFile()
saveiv(scene,filename): saves an .iv file with the contents of the given coin node
625941d930dc7b7665901c0b
def testFromSavedModel(self): <NEW_LINE> <INDENT> predictor_factories.from_saved_model(self._export_dir)
Test loading from_saved_model.
625941d95166f23b2e1a5400
def build_plot_dict(gdpinfo, country_list): <NEW_LINE> <INDENT> plot_dict = {} <NEW_LINE> gdpdata_dict = read_csv_as_nested_dict(gdpinfo["gdpfile"], gdpinfo["country_name"], gdpinfo["separator"], gdpinfo["quote"]) <NEW_LINE> for country in country_list: <NEW_LINE> <INDENT> if country in gdpdata_dict: <NEW_LINE> <INDENT...
Inputs: gdpinfo - GDP data information dictionary country_list - List of strings that are country names Output: Returns a dictionary whose keys are the country names in country_list and whose values are lists of XY plot values computed from the CSV file described by gdpinfo. Countries from country_li...
625941d9e8904600ed9f21d7
def __call__(self,p): <NEW_LINE> <INDENT> zone=UTMzone(p[0]) <NEW_LINE> pxy=array([self.Proj[zone](p[0],p[1])]) <NEW_LINE> dz=self.xy[zone]-pxy <NEW_LINE> return sqrt((dz**2).sum(1))
Computes distances from p=[lon,lat] to each point of object grid (N,2) array with lon,lat coordinates using the UTMzone of p. Args: p(float array-like): point in lon,lat coordinates, shape (N,2) Returns: Distance of point p to grid points using UTM projection.
625941d9f548e778e58cd826
def overwrite_headers(self): <NEW_LINE> <INDENT> with open(self.path, "w", encoding="utf-8") as fh: <NEW_LINE> <INDENT> self.overwrite_headers_stream(fh)
Adds file metadata at top of file (removing existing metadata) This method can be used to work with real files.
625941d96aa9bd52df03704c
def w(self, z): <NEW_LINE> <INDENT> if np.isscalar(z): <NEW_LINE> <INDENT> return -1.0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return -1.0 * np.ones(np.asanyarray(z).shape)
Returns dark energy equation of state at redshift ``z``. Parameters ---------- z : array-like Input redshifts. Returns ------- w : ndarray or float The dark energy equation of state. Returns float if input scalar. Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\rho(z)`, where :...
625941d9ab23a570cc25042b
def get_ph_time(as_array=False): <NEW_LINE> <INDENT> utc = timezone('UTC') <NEW_LINE> phtz = timezone('Asia/Manila') <NEW_LINE> now = utc.localize(datetime.utcnow()) <NEW_LINE> now = now.astimezone(phtz) <NEW_LINE> if as_array == True: <NEW_LINE> <INDENT> return [now.year, now.month, now.day, now.hour, now.minute, now....
returns a philippines datetime >>> a = get_ph_time() >>> logging.info(a) >>> logging.info(a.strftime('%F_%H-%M-%S')) >>> a = get_ph_time(as_array=True) >>> logging.info(a)
625941d9a8370b7717052b45
def unzip(groups): <NEW_LINE> <INDENT> return zip(*groups)
Simple wrapper around zip(*groups). Providing a name is a lot clearer than having the raw code around and someone wondering what it's doing. [(1,'a'), (2, 'b'), (3, 'c')] -> [(1,2,3), ('a', 'b', 'c')]
625941d91d351010ab855dc3
def Fourier_series(x, f, n = 0): <NEW_LINE> <INDENT> a0, *cos_a = parameters(','.join(['a{}'.format(i) for i in range(0, n + 1)])) <NEW_LINE> sin_b = parameters(','.join(['b{}'.format(i) for i in range(1, n + 1)])) <NEW_LINE> series = a0 + sum(ai * cos(i * f * x) + bi * sin(i * f * x) for i, (ai, bi) in enumerate(zip(c...
Construit la série de Fourier comme modèle de référence pour le fitting.
625941d91b99ca400220ad59
def __init__(self, x, y, speed): <NEW_LINE> <INDENT> super().__init__("koopa.png", x, y) <NEW_LINE> self.speed = speed <NEW_LINE> self.dx = speed <NEW_LINE> self.health = 2 <NEW_LINE> self.regen = 0 <NEW_LINE> self.score = 200
Constructor for Enemy1 :param x: The horizontal position of the enemy's upper left corner (in pixels) :param y: The vertical position of the enemy's upper left corner (in pixels) :param speed: The speed of the enemy (negative is left, positive is right)
625941d9a8370b7717052b46
def __init__(self, cluster_manager): <NEW_LINE> <INDENT> self.indices = set() <NEW_LINE> metric_data = {} <NEW_LINE> self.last_search_query_total = 0 <NEW_LINE> self.current_search_query_total = 0 <NEW_LINE> self.last_search_query_time_in_millis = 0 <NEW_LINE> self.current_search_query_time_in_millis = 0 <NEW_LINE> met...
Constructor
625941d97b25080760e39700
def move_collider(self, offset_x, offset_y, *args): <NEW_LINE> <INDENT> points = self.debug_collider.points[:] <NEW_LINE> for i in range(0, self.debug_collider_len, 2): <NEW_LINE> <INDENT> points[i] += offset_x <NEW_LINE> points[i + 1] += offset_y <NEW_LINE> <DEDENT> self.debug_collider.points = points
Move debug collider when the shape moves.
625941d9e64d504609d74ae7
def contribute_to_class(self, cls, name, *args, **kwargs): <NEW_LINE> <INDENT> super(HtmlCacheField, self).contribute_to_class(cls, name, *args, **kwargs) <NEW_LINE> setattr(cls, self.name, HtmlCacheDescriptor(self, self.markdown_field))
Register the field and add ancillary attributes :param cls: Model instance. :param name: Field name.
625941d926238365f5f0f119
def init(self, strng, x, y, rgb, lineType): <NEW_LINE> <INDENT> self.setData(OBJ_TYPE, self.type()) <NEW_LINE> self.setData(OBJ_NAME, OBJ_NAME_TEXTSINGLE) <NEW_LINE> self.setFlag(QGraphicsItem.ItemIsSelectable, True) <NEW_LINE> self.objTextJustify = "Left" <NEW_LINE> self.setObjectText(strng) <NEW_LINE> self.setObjectP...
TOWRITE :param `strng`: TOWRITE :type `strng`: QString :param `x`: TOWRITE :type `x`: qreal :param `y`: TOWRITE :type `y`: qreal :param `rgb`: TOWRITE :type `rgb`: QRgb :param `lineType`: TOWRITE :type `lineType`: Qt.PenStyle
625941d9a17c0f6771cbe2f7
def fetch_all(term: str, db=const.DEFAULT_DB_VALUE, batch_size=None): <NEW_LINE> <INDENT> result = None <NEW_LINE> remaining_data = True <NEW_LINE> query_env = esearch.get_query_env(term=term, db=db) <NEW_LINE> curr_batch_size = const.DEFAULT_SEARCH_INCREMENT if batch_size is None else max(batch_size, 1) <NEW_LINE> new...
Creates an iterable coroutine over all search results in GEO. :param term: Query term for the current search. :param db: Optional; overrides the NCBI database to search. :param batch_size: Optional; max number of items to fetch in the current batch. Can be dynamically changed by .send()-ing to the c...
625941d9d486a94d0b98e3ee
@deprecated('imageio plugin') <NEW_LINE> def imread(filename): <NEW_LINE> <INDENT> img = imread_imageio(filename) <NEW_LINE> return img
img = imread(filename) Reads an image from file `filename` Parameters ---------- filename : file name Returns ------- img : ndarray
625941d99b70327d1c4e107d
def _process_response(self, response, object_mapping=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pretty_response = response.json() <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pretty_response = response <NEW_LINE> <DEDENT> for handler in self._response_handlers: <NEW_LINE> <INDENT> if handler.appl...
Attempt to find a ResponseHandler that knows how to process this response. If no handler can be found, raise an Exception.
625941d999fddb7c1c9de638
def process_request(self, request, spider): <NEW_LINE> <INDENT> proxy = "maozhaojun:ntkn0npx@114.67.224.167:16819" <NEW_LINE> request.meta['proxy'] = proxy
# 免费透明代理: proxy = "114.67.224.167:16819" request.meta['proxy'] = "http://" + proxy
625941d926068e7796caef89
def get_ecltest_result(ecltest_result): <NEW_LINE> <INDENT> return ecltest_result_templ.substitute({ 'ecltest_result': html.escape(ecltest_result) })
Returns HTML code for the ecltest result paragraph
625941d9627d3e7fe0d690f9
def open(self, block_name, track, time, version_tag): <NEW_LINE> <INDENT> self._process() <NEW_LINE> opened_version = HiveManager.open(self, block_name, track, time, version_tag) <NEW_LINE> self._checkout() <NEW_LINE> self._checkout_deps() <NEW_LINE> if os.path.exists(os.path.join(self.hive_disk_image.paths.deps, block...
Params: block_version. It time is None last version will be retrieved
625941d93539df3088e2e5f2
def get_job_jcl_log(self): <NEW_LINE> <INDENT> self.jcl_log = self.job_handle.get_spool_file("JES2.JESJCL")
Gets the entire contents of the jobs JESJCL log :return: Sets the class instance variable for access to the information.
625941d97047854f462a16af
def __init__(self): <NEW_LINE> <INDENT> self.Strategy = None <NEW_LINE> self.DBNames = None <NEW_LINE> self.InstanceId = None <NEW_LINE> self.BackupName = None
:param Strategy: 备份策略(0-实例备份 1-多库备份) :type Strategy: int :param DBNames: 需要备份库名的列表(多库备份才填写) :type DBNames: list of str :param InstanceId: 实例ID,形如mssql-i1z41iwd :type InstanceId: str :param BackupName: 备份名称,若不填则自动生成“实例ID_备份开始时间戳” :type BackupName: str
625941d9fbf16365ca6f646f
def init_agent(cm, sc, conf): <NEW_LINE> <INDENT> pass
Placeholder method to satisfy configurator module agent loading.
625941d9f8510a7c17cf99a5
def get_file_name_with_prefix(filename, prefix): <NEW_LINE> <INDENT> new_name = "{0}{1}".format(prefix, filename) <NEW_LINE> return new_name
Returns the new file name by adding the provided prefix
625941d9fff4ab517eb2f6e5
def get_submissions(self): <NEW_LINE> <INDENT> if self.finder is None: <NEW_LINE> <INDENT> raise RuntimeError('No submission finder provided.') <NEW_LINE> <DEDENT> yield from self.finder.get_submissions()
Get the submissions using the marking scheme finder. This is a generator.
625941d9851cf427c661a7b5
def _generate_nouns(root_word: str) -> None: <NEW_LINE> <INDENT> print('\nGenerating nouns.\n') <NEW_LINE> number: List[JString] = [JString('A3sg'), JString('A3pl')] <NEW_LINE> possessives: List[JString] = [ JString('P1sg'), JString('P2sg'), JString('P3sg'), ] <NEW_LINE> cases: List[JString] = [JString('Dat'), JString(...
Generates inflections of the given root word using possessive and case suffix combinations. Args: root_word (str): Root word to generate inflections from.
625941d921bff66bcd684bf8
def get_outcome_import_status(self, outcome_import, **kwargs): <NEW_LINE> <INDENT> if outcome_import == "latest": <NEW_LINE> <INDENT> outcome_import_id = "latest" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> outcome_import_id = obj_or_id( outcome_import, "outcome_import", (OutcomeImport,) ) <NEW_LINE> <DEDENT> respons...
Get the status of an already created Outcome import. Pass 'latest' for the outcome import id for the latest import. :calls: `GET /api/v1/courses/:course_id/outcome_imports/:id <https://canvas.instructure.com/doc/api/outcome_imports.html#method.outcome_imports_api.show>`_ :param outcome_import: The outcome imp...
625941d930c21e258bdfa746
def _parse_lines(self, c_file, sourcefile): <NEW_LINE> <INDENT> if self._parsed_c_files is None: <NEW_LINE> <INDENT> self._parsed_c_files = {} <NEW_LINE> <DEDENT> if c_file in self._parsed_c_files: <NEW_LINE> <INDENT> code_lines = self._parsed_c_files[c_file] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> match_source_p...
Parse a Cython generated C/C++ source file and find the executable lines. Each executable line starts with a comment header that states source file and line number, as well as the surrounding range of source code lines.
625941d9e64d504609d74ae8
def _check_reset_seed(env: gym.Env, seed: Optional[int] = None) -> None: <NEW_LINE> <INDENT> signature = inspect.signature(env.reset) <NEW_LINE> assert ( "seed" in signature.parameters or "kwargs" in signature.parameters ), "The environment cannot be reset with a random seed. This behavior will be deprecated in the fut...
Check that the environment can be reset with a random seed.
625941d997e22403b379d243
def initializeUniformly(self, gameState): <NEW_LINE> <INDENT> self.particles =[] <NEW_LINE> permComb = list(itertools.product(self.legalPositions, repeat = self.numGhosts)) <NEW_LINE> random.shuffle(permComb) <NEW_LINE> for i in range(self.numParticles): <NEW_LINE> <INDENT> self.particles.append(permComb[i%len(permComb...
Initialize particles to be consistent with a uniform prior. Particles should be evenly distributed across positions in order to ensure a uniform prior.
625941d9dd821e528d63b44f
def Stop(self): <NEW_LINE> <INDENT> self.__stop__ = True
Use this to close the thread running the scale
625941d94d74a7450ccd446b
def similarity(args): <NEW_LINE> <INDENT> s = read_index(args.index) <NEW_LINE> nodes = args.nodes <NEW_LINE> if len(nodes) == 0: <NEW_LINE> <INDENT> nodes = s.nodelist() <NEW_LINE> <DEDENT> if args.top <= 0: <NEW_LINE> <INDENT> to = args.to <NEW_LINE> if to is None: <NEW_LINE> <INDENT> to = s.nodelist() <NEW_LINE> <DE...
Computes the similarities between the given nodes using the given index file and prints them on the screen. Includes minimalistic top functionality. For better top computations, use **top**.
625941d94527f215b584c6fc
def parse_cli(self, cli): <NEW_LINE> <INDENT> if cli.endswith('basic-threat'): <NEW_LINE> <INDENT> return 'disable' if cli.startswith('no ') else self.on_value <NEW_LINE> <DEDENT> return cli
Override parse_cli
625941d95fdd1c0f98dc04dc
def getScreenWH(self): <NEW_LINE> <INDENT> return None
In some cases, the GUI module might be able to get screen resolution
625941d9b57a9660fec33b2f
def get_enumeration_sparql(rq, v, endpoint, auth=None): <NEW_LINE> <INDENT> glogger.info('Retrieving enumeration for variable {}'.format(v)) <NEW_LINE> vcodes = [] <NEW_LINE> tpattern_matcher = re.compile(".*?(FROM\s*(?P<gnames>\<.*\>+))?\s*(WHERE\s*)?\{(?P<tpattern>.*)\}.*", flags=re.DOTALL) <NEW_LINE> glogger.debug(r...
Returns a list of enumerated values for variable 'v' in query 'rq'
625941d9dd821e528d63b450
def default(self, line): <NEW_LINE> <INDENT> command = line.strip() <NEW_LINE> if not command: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> keyword = KEYWORD_SEP.split(command) <NEW_LINE> result = self.rf_bi.run_keyword(*keyword) <NEW_LINE> if result: <NEW_LINE> <INDENT> print('< ', repr(resu...
Run RobotFramework keywords
625941d915baa723493c421f
def abbrev(s: str) -> str: <NEW_LINE> <INDENT> if len(s)<1: return "" <NEW_LINE> first, rest = s[0], s[1:] <NEW_LINE> nonVowels = "".join(ch for ch in rest if ch not in "aeiou") <NEW_LINE> return first.upper() + nonVowels[:2].lower()
build an abbreviation string of a word. This takes the 1st letter then the next 2 non-vowel letters
625941d9b57a9660fec33b30
def seed(self, mu): <NEW_LINE> <INDENT> return self.domain().monomial(mu)
Return the eigenvector for `\mu` minuscule. INPUT: - ``mu`` -- an element `\mu` of the indexing set OUTPUT: an element of ``T.domain()`` This default implementation returns the monomial indexed by `\mu`. EXAMPLES:: sage: W = WeylGroup(["A",3]) sage: W.element_class._repr_=lambda x: "".join(str(i) for i in...
625941d9f9cc0f698b1408a1
def square(arg1, arg2): <NEW_LINE> <INDENT> return arg1 + arg2
if you hover your mouse over the function in other lines, this DocString will appear for this example check line 6 of this example
625941d95f7d997b87174d42
def add_lbmi(self, mode, scaling_factor): <NEW_LINE> <INDENT> lbmi = LBMI(mode, scaling_factor) <NEW_LINE> lbmi.impconf = self <NEW_LINE> self.lbmis.append(lbmi) <NEW_LINE> return lbmi
Add a Linear Buckling Mode-shaped Imperfection (LBMI) Parameters ---------- mode : int Mode number corresponding to this eigenvector. scaling_factor : float Amplitude of this eigenvector when applied as an imperfection. Returns ------- lbmi : :class:`.LBMI` object.
625941d9b5575c28eb68e2aa
def __init__(self, solver_type='l2r', C=1, eps=0.01, weight={}): <NEW_LINE> <INDENT> if solver_type not in self.SOLVER_TYPE: <NEW_LINE> <INDENT> raise ValueError("invalid solver_type") <NEW_LINE> <DEDENT> self._liblinear = liblinear.LibLinear( solver_type=self.SOLVER_TYPE[solver_type], C=C, eps=eps, weight=weight)
Initialization. :Parameters: solver_type : string solver, can be one of 'l2r', 'l2r_dual' (L2-regularized) and 'l1r' (L1-regularized). C : float cost of constraints violation eps : float stopping criterion weight : dict changes the penalty for some classes (if ...
625941d9d53ae8145f87a514
def main(): <NEW_LINE> <INDENT> oldtree, newtree = sys.argv[1], sys.argv[2] <NEW_LINE> if len(sys.argv) > 3: <NEW_LINE> <INDENT> link = sys.argv[3] <NEW_LINE> link_may_fail = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> link = LINK <NEW_LINE> link_may_fail = 0 <NEW_LINE> <DEDENT> if not os.path.isdir(oldtree): <NEW_...
Handle user inputs and initialize arguments.
625941d98da39b475bd6521e
def get_config_file_path(name, jails_directory): <NEW_LINE> <INDENT> return os.path.join(jails_directory, "%s.%s" % (name, JAIL_FILE_EXTENSION))
Gets the path of the configuration file with the given name in the given jails directory. :param name: name of the configuration file :param jails_directory: jails directory :return: configuration file path
625941d9f7d966606f6aa2af
def _dependencies(self, jobs): <NEW_LINE> <INDENT> parser = gclient.OptionParser() <NEW_LINE> options, args = parser.parse_args(['--jobs', jobs]) <NEW_LINE> write( '.gclient', 'solutions = [\n' ' { "name": "foo", "url": "svn://example.com/foo" },\n' ' { "name": "bar", "url": "svn://example.com/bar" },\n' ' { "name":...
Verifies that dependencies are processed in the right order. e.g. if there is a dependency 'src' and another 'src/third_party/bar', that bar isn't fetched until 'src' is done. Args: |jobs| is the number of parallel jobs simulated.
625941d94527f215b584c6fd
def get_upload_time(self, assignment, account): <NEW_LINE> <INDENT> upload_time_struct = self.get_upload_time_struct(assignment, account) <NEW_LINE> return get_datetime_from_time_struct(upload_time_struct)
Returns a datetime object with the upload time of the account's last submission
625941d9e76e3b2f99f3aab0
def _move_to_head(self, node): <NEW_LINE> <INDENT> self._remove_node(node) <NEW_LINE> self._add_node(node)
Move certain node in between to the head
625941d9be8e80087fb20ee8
def apply_to_start(self, f): <NEW_LINE> <INDENT> return self.map(f, lambda index, length: index == 0)
Apply a function to the last part of the text
625941d916aa5153ce362720
def get_code_complexity_diff(repository_name, commit_1, commit_2): <NEW_LINE> <INDENT> repository_dir = config.REPOSITORY_PATH + repository_name.replace('/', '___') <NEW_LINE> cd_to_repository = 'cd {};'.format(repository_dir) <NEW_LINE> os.system(cd_to_repository + 'git checkout --quiet {}'.format(commit_1)) <NEW_LINE...
Returns the code complexity difference between two commits using norm-1 operator. :param repository_name: The name of the repository in <USER_NAME>/<REPOSITORY_NAME> format :param commit_1: The first commit commit to analyze :param commit_2: The second commit commit to analyze :return: A vector with size of eight as...
625941d9e5267d203edcdf42
def deleted(fragment): <NEW_LINE> <INDENT> deleted = (u'/deleted.png" alt="[DELETED]" title="This post was deleted before its lifetime has expired" />' in fragment) <NEW_LINE> return deleted
Determine if deleted true/false deleted: Was post prematurely deleted from 4chan.
625941d9e1aae11d1e749f62
def _format_date(start, end, calendar, busy): <NEW_LINE> <INDENT> return { 'start' : arrow.get(start).isoformat(), 'end' : arrow.get(end).isoformat(), 'cal' : calendar, 'busy' : busy }
formats a start date, end date, calendar name, and business state into an object using an object builder. Raises an exception if data prams are invalid.
625941d9ff9c53063f47c49b
def findLength(self, A, B): <NEW_LINE> <INDENT> if len(A) > len(B): return self.findLength(B, A) <NEW_LINE> M, p = 10**9+7, 113 <NEW_LINE> p_inv = pow(p, M-2, M) <NEW_LINE> def check(guess): <NEW_LINE> <INDENT> def rolling_hashes(source, length): <NEW_LINE> <INDENT> if length == 0: <NEW_LINE> <INDENT> yield 0, 0 <NEW_L...
:type A: List[int] :type B: List[int] :rtype: int
625941d9099cdd3c635f0f03
def next_turn(turn): <NEW_LINE> <INDENT> if turn == X: <NEW_LINE> <INDENT> return O <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return X
switch turn
625941d9fbf16365ca6f6470
def test_config_highlight_overlap_full_type_same(pcre): <NEW_LINE> <INDENT> rule1 = chromaterm.Rule('hello', chromaterm.Color('b#123123'), pcre=pcre) <NEW_LINE> rule2 = chromaterm.Rule('hello', chromaterm.Color('b#456456'), pcre=pcre) <NEW_LINE> config = chromaterm.Config() <NEW_LINE> config.rules.append(rule1) <NEW_LI...
Two rules, fully overlapping matches, same color type. The reset of the first rule should be replaced with the color code of the second (most recent) rule to prevent the reset from interrupting the color. 1: ---------- 2: ----------
625941d9cad5886f8bd27281
def __call__(self, markets: str): <NEW_LINE> <INDENT> response = requests.get(server_api('/v1/ticker'), params={'markets': markets}) <NEW_LINE> return response.json()
요청 당시 종목의 스냅샷을 반환한다. :param markets: 반점으로 구분되는 마켓 코드 (ex. KRW-BTC, BTC-BCC) :return:
625941d98e7ae83300e4b276
def __init__(self, ctx, currentPage=1, msg=None, itemList=[], title='Paginator', option='CODE_BLOCKS', editableContent=True): <NEW_LINE> <INDENT> self.bot = ctx.bot <NEW_LINE> self.guild = ctx.guild <NEW_LINE> self.channel = ctx.channel <NEW_LINE> self.user = ctx.author <NEW_LINE> self.message = msg <NEW_LINE> self.ite...
Creates a paginator. Parameters ----------- ctx: discord.ext.commands.Context The current context (guild, channel, etc for bot to send messages). currentPage: int Specify which page to display. msg: discord.Message This is helpful for delete function. Specify which message the bot needs to update if an ele...
625941d9498bea3a759b9d57
def delete_livro_cmd(livro_id): <NEW_LINE> <INDENT> return DeleteNode(livro_id)
Construct a command to delete a Livro :param livro_id: livro's id :return: Command
625941d98e71fb1e9831da51
def test_Package_Allowance(self): <NEW_LINE> <INDENT> Swipes.down(self.driver) <NEW_LINE> Home_Function_Select(self.driver,'套餐余量') <NEW_LINE> Package_Allowance_Jump(self.driver,'短信')
进入套餐余量,查看并点击短信未办理提示语。 :return:none
625941d9d6c5a102081442f5
def __getitem__(self, key): <NEW_LINE> <INDENT> old_value = Dispatcher.__getitem__(self, key) <NEW_LINE> @wraps(old_value) <NEW_LINE> def wrapped(*args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return to_json(old_value(*from_json(args), **from_json(kwargs))) <NEW_LINE> <DEDENT> except Exception as except...
Override __getitem__ to support transparent translation. Translate function arguments, return value, and exceptions.
625941d98da39b475bd6521f
def within_between(path): <NEW_LINE> <INDENT> import pandas as pd <NEW_LINE> path = os.path.expanduser(path) <NEW_LINE> filename = 'within_between.csv' <NEW_LINE> if not os.path.exists(os.path.join(path, filename)): <NEW_LINE> <INDENT> url = 'http://dustintran.com/data/r/psych/withinBetween.csv' <NEW_LINE> maybe_downlo...
An example of the distinction between within group and between group corre lations A demonstration that a correlation may be decomposed to a within group correlation and a between group correlations and these two correlations are independent. Between group correlations are sometimes called ecological correlations, the...
625941d9adb09d7d5db6ca37
def reset_pypeman_channels(): <NEW_LINE> <INDENT> logger.info("clearing all_channels and _channel-names.") <NEW_LINE> all_channels.clear() <NEW_LINE> _channel_names.clear()
clears book keeping of all channels Can be useful for unit testing.
625941d93c8af77a43ae3a4b
def top_p_logits(logits, p): <NEW_LINE> <INDENT> batch = logits.shape[0] <NEW_LINE> sorted_logits, sorted_indices = torch.sort(logits, descending=True, dim=-1) <NEW_LINE> cumulative_probs = torch.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1) <NEW_LINE> sorted_indices_to_remove = cumulative_probs > p <NEW_LINE> sorte...
Nucleus sampling
625941d985dfad0860c3b104
def initialize_chain(test_dir): <NEW_LINE> <INDENT> if not os.path.isdir(os.path.join("cache", "node0")): <NEW_LINE> <INDENT> devnull = open("/dev/null", "w+") <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> datadir=initialize_datadir("cache", i) <NEW_LINE> args = [ os.getenv("BITCOIND", "mtapd"), "-keypool=1", "-dat...
Create (or copy from cache) a 200-block-long chain and 4 wallets. mtapd and mtap-cli must be in search path.
625941d98c3a873295158666
def category_exists(self, cat): <NEW_LINE> <INDENT> return helpers.category_exists( cat, site=self.commons, cache=self.category_cache)
Wrap helpers.self.category_exists with local variables. :param cat: category name (with or without "Category" prefix) :return: bool
625941d991af0d3eaac9bcc4
def _regex_strip_name(regexp): <NEW_LINE> <INDENT> stripper = re.compile(r'(.*?)\(\?P<.*?>(.*)\)(.*)') <NEW_LINE> stripped_regexp = stripper.sub(r'\1\2\3', regexp) <NEW_LINE> return stripped_regexp
Strip the name part of the regex (?P<.*>)
625941d9be7bc26dc91cd8a4
def add_point(self, point): <NEW_LINE> <INDENT> self.point_dictionary[point.id] = point
Adds a new point to a frame point: the point to add
625941d9be7bc26dc91cd8a5
def set_order(self, new_order): <NEW_LINE> <INDENT> newset = set(new_order) <NEW_LINE> oldset = set(self._subsystems) <NEW_LINE> if oldset != newset: <NEW_LINE> <INDENT> missing = oldset - newset <NEW_LINE> extra = newset - oldset <NEW_LINE> msg = "Unexpected new order. " <NEW_LINE> if len(missing) > 0: <NEW_LINE> <IND...
Specifies a new execution order for this system. This should only be called after all subsystems have been added. Args ---- new_order : list of str List of system names in desired new execution order.
625941d9b830903b967e9bb2
def test_timing_when_option_zero(self): <NEW_LINE> <INDENT> test_time_option = 0 <NEW_LINE> test_time = 1 <NEW_LINE> duration = Duration(option='{0}s'.format(test_time_option)) <NEW_LINE> iter_time = 0 <NEW_LINE> for iter_count, iter_time in duration.control_duration(timing='{0}s'.format(test_time)): <NEW_LINE> <INDENT...
Verify that test ends after value of timing when zero value of option is passed.
625941d92eb69b55b151cb5b
def slope(x1, y1, x2, y2): <NEW_LINE> <INDENT> m = (y2-y1)/(x2-x1) <NEW_LINE> return abs(m)
Absolute value of slope between 2 points
625941d95e10d32532c5f1cf
def get_code(self): <NEW_LINE> <INDENT> return "{element}-{number:0>4}".format(element=self.element, number=self.number)
beware: This format is parsed back by queryset.AccountQuerySet
625941d938b623060ff0b096
def testInlineResponse20086(self): <NEW_LINE> <INDENT> pass
Test InlineResponse20086
625941d9167d2b6e31218e3e
def set_up(self): <NEW_LINE> <INDENT> python_package = hitchpython.PythonPackage( python_version=self.settings['python_version'] ) <NEW_LINE> python_package.build() <NEW_LINE> call([ python_package.pip, "install", "-r", path.join(PROJECT_DIRECTORY, "requirements/local.txt") ]) <NEW_LINE> postgres_package = hitchpostgre...
Ensure virtualenv present, then run all services.
625941d97b25080760e39701
@pytest.mark.parametrize( "chunked_json_data", [ChunkedDataConfig(num_chunks=1), ChunkedDataConfig(num_chunks=8)], indirect=["chunked_json_data"], ) <NEW_LINE> def test_chunkedjson_valid_directory_root(chunked_json_data: Path) -> None: <NEW_LINE> <INDENT> ChunkedJSONDataset(chunked_json_data)
Ensure a dataset instance can be created with a regular directory root.
625941d9be383301e01b572c
def solution(sizes, directions): <NEW_LINE> <INDENT> DOWNSTREAM = 0 <NEW_LINE> alive = 0 <NEW_LINE> upstream = Stack() <NEW_LINE> for i in range(len(directions)): <NEW_LINE> <INDENT> if directions[i] == DOWNSTREAM: <NEW_LINE> <INDENT> alive += 1 <NEW_LINE> while upstream.length(): <NEW_LINE> <INDENT> fish_upstream = up...
Counts the number of fish alive after all possible meetings
625941d94f88993c3716c30f
def numConfigParams(item): <NEW_LINE> <INDENT> if hasattr(item,'getConfig'): <NEW_LINE> <INDENT> return len(item.getConfig()) <NEW_LINE> <DEDENT> elif isinstance(item,RigidObjectModel) or isinstance(item,coordinates.Frame): <NEW_LINE> <INDENT> return 12 <NEW_LINE> <DEDENT> elif isinstance(item,coordinates.Point) or isi...
Returns the number of free parameters in the flattened version of the configuration of the given item. Nearly all Klamp't objects are recognized, including RobotModel's, RigidObjectModel's, WorldModel's, IKObjectives, and all variable types in the coordinates module.
625941d997e22403b379d244
def find_module_path_and_all_py2(module: str, interpreter: str) -> Optional[Tuple[Optional[str], Optional[List[str]]]]: <NEW_LINE> <INDENT> cmd_template = '{interpreter} -c "%s"'.format(interpreter=interpreter) <NEW_LINE> code = ("import importlib, json; mod = importlib.import_module('%s'); " "print(mod.__file__); prin...
Return tuple (module path, module __all__) for a Python 2 module. The path refers to the .py/.py[co] file. The second tuple item is None if the module doesn't define __all__. Raise CantImport if the module can't be imported, or exit if it's a C extension module.
625941d9a79ad161976cc3ef
def fastaBufferToString(fastabuffer): <NEW_LINE> <INDENT> outstr = "".join(fastabuffer.split("\n")[1:]) <NEW_LINE> return (outstr)
Converts a fasta file as a buffer read from STDOUT to a string with just the sequence.
625941d97b25080760e39702
def getRandomChromosome(self): <NEW_LINE> <INDENT> chr = random.choice(self.chromosomes) <NEW_LINE> return chr
Get random chromosome in genome
625941d9d6c5a102081442f6