code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def parse_alignment(alignment_str): <NEW_LINE> <INDENT> alignment = defaultdict(list) <NEW_LINE> als = alignment_str.split() <NEW_LINE> for al in als: <NEW_LINE> <INDENT> src_ind, trg_ind = map(int, al.split('-')) <NEW_LINE> alignment[src_ind].append(trg_ind) <NEW_LINE> <DEDENT> for src_i, trg_is in alignment.items(): ...
Parses an alignment string (e.g. "0-0 0-1 1-0 2-2 3-4") into a dictionary.
625941c938b623060ff0ae71
def __init__(self): <NEW_LINE> <INDENT> super().__init__()
constructor
625941c9379a373c97cfabc8
def get(self, group_id): <NEW_LINE> <INDENT> return self._get("/consistencygroups/%s" % group_id, "consistencygroup")
Get a consistencygroup. :param group_id: The ID of the consistencygroup to get. :rtype: :class:`Consistencygroup`
625941c9dd821e528d63b22d
def lagged_matrix(spec, basis): <NEW_LINE> <INDENT> from scipy.linalg import hankel <NEW_LINE> if spec.ndim == 1: <NEW_LINE> <INDENT> spec = np.expand_dims(spec, 0) <NEW_LINE> <DEDENT> nf, nt = spec.shape <NEW_LINE> if np.isscalar(basis): <NEW_LINE> <INDENT> ntau = nbasis = basis <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
Convert a (nfreq, nt) spectrogram into a design matrix basis: can be a positive integer specifying the number of time lags. Or it can be a (ntau, nbasis) matrix specifying a set of temporal basis functions spanning ntau time lags (for example, the output of cosbasis). The output is an (nt, nfreq * nbasis) array. (nba...
625941c99b70327d1c4e0e58
def items(self): <NEW_LINE> <INDENT> for field, value in self.environ.items(): <NEW_LINE> <INDENT> if not field.startswith('HTTP_'): <NEW_LINE> <INDENT> yield (field, value)
Returns tuple pairs of environ vars and their values.
625941c9cad5886f8bd2705d
def validateDataTypes(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for check in self.requiredInt: <NEW_LINE> <INDENT> if not self.contains(self.notRequiredFields, check): <NEW_LINE> <INDENT> int(check.get()) <NEW_LINE> <DEDENT> <DEDENT> for check in self.requiredFloat: <NEW_LINE> <INDENT> if not self.contains(se...
Iterates over the arrays containing the fields that require integer and float data types Does a type conversion and if it fails and the try, except fails, It will know that the data entered was not of the right type :return: True if all is correct, False if any one is wrong
625941c9d58c6744b4257ce4
def unique_slug_generator(model_instance, reference_field_value): <NEW_LINE> <INDENT> slug = slugify(reference_field_value) <NEW_LINE> unique_slug = slug <NEW_LINE> nb = 1 <NEW_LINE> model_class = model_instance.__class__ <NEW_LINE> while model_class._default_manager.filter(slug=unique_slug).exists(): <NEW_LINE> <INDEN...
Create a unique slug based on the reference field indicated in parameters. Format : {reference_field value}-{incremental number if reference_field value already exists}
625941c90a366e3fb873e89d
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoRestAPI.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are yo...
Run administrative tasks.
625941c9009cb60464c63436
def setBandwidth(self, bandwidth: float) -> None: <NEW_LINE> <INDENT> self._bandwidth = bandwidth
Set bandwidth of each sample. Defaults to 1.0
625941c92ae34c7f2600d1b5
def create_dataset( filenames): <NEW_LINE> <INDENT> dataset = tf.data.TFRecordDataset(filenames) <NEW_LINE> dataset = dataset.map(_parse_function, num_parallel_calls=1) <NEW_LINE> iterator = tf.data.Iterator.from_structure(dataset.output_types, dataset.output_shapes) <NEW_LINE> dataset_init_op = iterator.make_initializ...
Function to read and decode TF records for further processsing - Read serialized file TF record and cast features variables to the right format This has to be changed for a new input pipeline. input : filenames - the string or list for ingesting TF records output : variables to feed
625941c9442bda511e8be49d
def _get_api_key(): <NEW_LINE> <INDENT> api_key_directory = os.getenv('KOKORO_GFILE_DIR') <NEW_LINE> api_key_file = os.path.join(api_key_directory, 'resultstore_api_key') <NEW_LINE> assert os.path.isfile(api_key_file), 'Must add --api_key arg if not on ' 'Kokoro or Kokoro envrionment is not set up properly.' <NEW_L...
Returns string with API key to access ResultStore. Intended to be used in Kokoro envrionment.
625941c991f36d47f21ac576
def startElement(self, name, attrs, ws_dict, is_short_tag, lineno): <NEW_LINE> <INDENT> attrs = collections.OrderedDict(attrs) <NEW_LINE> for attr, value in attrs.items(): <NEW_LINE> <INDENT> if name.startswith('tal:') or attr.startswith('tal:'): <NEW_LINE> <INDENT> if self._is_multi_expression(name, attr): <NEW_LINE> ...
Rewrite the attributes at the start of an element.
625941c930c21e258bdfa521
def _read_spcadd_mpcadd(model, card_name, datai): <NEW_LINE> <INDENT> if model.is_debug_file: <NEW_LINE> <INDENT> model.binary_debug.write(' %s - %s' % (card_name, str(datai))) <NEW_LINE> <DEDENT> iend = np.where(datai == -1)[0] <NEW_LINE> i0 = 0 <NEW_LINE> count_num = len(iend) <NEW_LINE> for iendi in iend: <NEW_LINE...
reads a SPCADD/MPCADD card Word Name Type Description 1 SID I Set identification number 2 S I Set identification number Word 2 repeats until End of Record
625941c91f5feb6acb0c4bd5
@group_required('type1staff', 'type2staff', 'type2staffunverified', 'type3staff', 'type4staff') <NEW_LINE> @can_view_project <NEW_LINE> def copy_project(request, pk): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> form = ProposalFormCreate(request.POST, request=request) <NEW_LINE> if form.is_valid...
Copy a proposal from a previous timeslot. Only for staff that is allowed to see the proposal to copy. :param pk: the id of proposal to copy :param request: :return:
625941c95fcc89381b1e1742
def _execute(self, *args, **kwargs): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> handler, memoize, timeout = self.handlers[self.queue.get()] <NEW_LINE> if isinstance(self.lock, threading._RLock): <NEW_LINE> <INDENT> self.lock.acquire() <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> r = se...
Executes all handlers stored in the queue
625941c9bd1bec0571d906b3
def printinfo(name, age=20): <NEW_LINE> <INDENT> print("name: ", name) <NEW_LINE> print("age:", age) <NEW_LINE> return;
打印任何传入的字符串
625941c985dfad0860c3aedf
def test02(self): <NEW_LINE> <INDENT> dburl = os.environ["DBS_TEST_DBURL_READER"] <NEW_LINE> dbowner = os.environ["DBS_TEST_DBOWNER_READER"] <NEW_LINE> dbi = DBFactory(self.logger, dburl).connect() <NEW_LINE> bo = DBSFile(self.logger, dbi, dbowner) <NEW_LINE> result = bo.listFileParents(logical_file_name='%') <NEW_LINE...
business.DBSFile.listFileParents: Basic
625941c931939e2706e4ceef
def load(self, filename, binary=None): <NEW_LINE> <INDENT> if binary is True: <NEW_LINE> <INDENT> return self.read(filename) <NEW_LINE> <DEDENT> if binary is False: <NEW_LINE> <INDENT> return self.scanf(filename) <NEW_LINE> <DEDENT> suffix = filename.suffix <NEW_LINE> if suffix == "bin": <NEW_LINE> <INDENT> return self...
Read my values from {filename} This method attempts to distinguish between text and binary representations of the data, based on the parameter {mode}, or the {filename} extension if {mode} is absent
625941c98c0ade5d55d3ea3e
def __init__(self, project, parent): <NEW_LINE> <INDENT> E4Led.__init__(self, parent, shape = E4LedRectangular, rectRatio = 1.0) <NEW_LINE> self.project = project <NEW_LINE> self.vcsMonitorLedColors = { "off" : QColor(Qt.lightGray), "ok" : QColor(Qt.green), "nok" : QColor(Qt.red), "op" : QColo...
Constructor @param project reference to the project object (Project.Project) @param parent reference to the parent object (QWidget)
625941c94c3428357757c3ac
def update(self): <NEW_LINE> <INDENT> if not self._verify_active: <NEW_LINE> <INDENT> self._available = True <NEW_LINE> self.schedule_update_ha_state() <NEW_LINE> return <NEW_LINE> <DEDENT> result = self._read_func(self._slave, self._verify_address, 1) <NEW_LINE> if result is None: <NEW_LINE> <INDENT> self._available =...
Update the entity state.
625941c976e4537e8c3516f6
def collect_links(url: str, session: HTMLSession): <NEW_LINE> <INDENT> url__netloc = urlparse(url).netloc <NEW_LINE> if not url__netloc.startswith("www."): <NEW_LINE> <INDENT> url__netloc = "www." + url__netloc <NEW_LINE> <DEDENT> site = url__netloc.split(".")[1] <NEW_LINE> to_visit = Queue() <NEW_LINE> visited_links =...
gathers links, returns sets of internal and external links
625941c9851cf427c661a594
def apply(self, transformation_func): <NEW_LINE> <INDENT> dataset = transformation_func(self) <NEW_LINE> if not isinstance(dataset, DatasetV2): <NEW_LINE> <INDENT> raise TypeError( f"`transformation_func` must return a `tf.data.Dataset` object. " f"Got {type(dataset)}.") <NEW_LINE> <DEDENT> dataset._input_datasets = [s...
Applies a transformation function to this dataset. `apply` enables chaining of custom `Dataset` transformations, which are represented as functions that take one `Dataset` argument and return a transformed `Dataset`. >>> dataset = tf.data.Dataset.range(100) >>> def dataset_fn(ds): ... return ds.filter(lambda x: x <...
625941c9187af65679ca51a3
def get_pipeline(self): <NEW_LINE> <INDENT> raise NotImplementedError
Return a list of ``View`` instances describing this integration's configuration pipeline. >>> def get_pipeline(self): >>> return []
625941c9b57a9660fec33908
@task(default=True) <NEW_LINE> @expand_env <NEW_LINE> @ensure_stage <NEW_LINE> def code_and_data(): <NEW_LINE> <INDENT> code_and_dependencies() <NEW_LINE> only_data()
Deploy the project.
625941c95fdd1c0f98dc02b7
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.config = login() <NEW_LINE> self.coin = VKCoin(key=self.config['key'], merchantId=self.config['uid'], token=self.config['token'])
Class exemplar initialisation
625941c95fc7496912cc3a02
@app.context_processor <NEW_LINE> def context_get_categories(): <NEW_LINE> <INDENT> categories = Category.query.all() <NEW_LINE> return dict(categories=categories)
Context processor to make all categories available. :return: dict containing list of all categories
625941c9507cdc57c6306d5e
def test_process_illumina_single_end_read_file2(self): <NEW_LINE> <INDENT> output_seqs_fp = get_tmp_filename( prefix='ParseIlluminaTests',suffix='.fasta') <NEW_LINE> output_qual_fp = get_tmp_filename( prefix='ParseIlluminaTests',suffix='.txt') <NEW_LINE> read_fp = get_tmp_filename( prefix='Parse...
process_illumina_single_end_read_file: alt seq max N
625941c9eab8aa0e5d26dbdc
def setAttribute(self, key, value): <NEW_LINE> <INDENT> self.attributes[key] = value
Store an C{<attribute>} tag for this action mapping.
625941c963d6d428bbe44574
def prepare_output_data(self, y): <NEW_LINE> <INDENT> self.classes = sorted(set(y)) <NEW_LINE> self.output_dim = len(self.classes) <NEW_LINE> y = self._onehot_encode(y) <NEW_LINE> return y
Format `y` into a vector of one-hot encoded vectors. Parameters ---------- y : list Returns ------- np.array with length the same as y and each row the length of the number of classes
625941c90c0af96317bb826c
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, OracleConfig): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941c9091ae35668666fe4
def removeLink(path): <NEW_LINE> <INDENT> if not os.path.islink(path): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> os.remove(path)
Remove link on a given path.
625941c9e8904600ed9f1fb0
def update(self, ent): <NEW_LINE> <INDENT> fields = [f for f in self.column_dict().keys() if f != self.primary_key()] <NEW_LINE> assignments = ', '.join(["%s = ?" % f for f in fields]) <NEW_LINE> query = 'UPDATE %s SET %s WHERE %s = ?' % (self.table_name(), assignments, self.primary_key()) <NEW_LINE> self.c.execute(que...
Updates the specified record. If the record is not found in the database it does nothing.
625941c9f9cc0f698b140681
def test_export_config_transfer(self): <NEW_LINE> <INDENT> nb = v4.new_notebook() <NEW_LINE> nb.metadata.language_info = { 'name': 'python', 'mimetype': 'text/x-python', 'nbconvert_exporter': 'python', } <NEW_LINE> exporter = self.exporter_class() <NEW_LINE> exporter.from_notebook_node(nb) <NEW_LINE> assert exporter._e...
delegate config to custom exporter from language_info
625941c9fb3f5b602dac3717
def install(package, force=False): <NEW_LINE> <INDENT> if force: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> log_package(package, "Force install: removing...") <NEW_LINE> os.remove(os.path.join(DEPS_DIR, package.name + package.extension)) <NEW_LINE> shutil.rmtree(os.path.join(DEPS_DIR, package.name)) <NEW_LINE> log_pa...
Install a specified package. package -- Package object to install. force -- Force remove and reinstall package. (default False)
625941c915fb5d323cde0b93
def test_view_pack_view(self, pack): <NEW_LINE> <INDENT> response = self.make_one(match_request(id=pack.id)).viewpack() <NEW_LINE> assert response['pack'] == pack
Ensure the view pack page is functional.
625941c95e10d32532c5efab
def nuclei_select(self): <NEW_LINE> <INDENT> self.showMinimized() <NEW_LINE> nuc_proc = NucleoSelect(self.image_info, parent=self) <NEW_LINE> nuc_proc.show() <NEW_LINE> nuc_proc.raise_() <NEW_LINE> nuc_proc.activateWindow()
Hand over to nuclei selection :return:
625941c94f6381625f114abf
def draw(self): <NEW_LINE> <INDENT> if self._goals_changed: <NEW_LINE> <INDENT> self.redraw_goals() <NEW_LINE> self._goals_changed = False <NEW_LINE> <DEDENT> if self._messages_changed: <NEW_LINE> <INDENT> self.redraw_messages() <NEW_LINE> self._messages_changed = False
Draw the goals and messages to the goal and message panel.
625941c90c0af96317bb826d
def showImage2(imageList, tops): <NEW_LINE> <INDENT> for num, index in enumerate (imageList[:tops]): <NEW_LINE> <INDENT> showImage (index[1], "Number %d " % (num + 1)) <NEW_LINE> <DEDENT> return 0
Display image :param imageList: :param tops: :return:
625941c9dd821e528d63b22e
def get_residue_annotations(self, seq_resnum, seqprop=None, structprop=None, chain_id=None, use_representatives=False): <NEW_LINE> <INDENT> if use_representatives: <NEW_LINE> <INDENT> if seqprop and structprop and chain_id: <NEW_LINE> <INDENT> raise ValueError('Overriding sequence, structure, and chain IDs with represe...
Get all residue-level annotations stored in the SeqProp ``letter_annotations`` field for a given residue number. Uses the representative sequence, structure, and chain ID stored by default. If other properties from other structures are desired, input the proper IDs. An alignment for the given sequence to the structure...
625941c94e4d5625662d445d
def getAllIndex(ldata, fldata): <NEW_LINE> <INDENT> return list(map(lambda e : fldata.index(e), ldata))
get ALL indexes of list elements Parameters ldata : list data to find index in fldata : list data for values for index look up
625941c9ab23a570cc250207
def setPosition(self, pos): <NEW_LINE> <INDENT> self._marker.setPosition(pos, 0)
Set the position of this ROI :param float pos: Horizontal position of this line
625941c95e10d32532c5efac
def conventional_factorial(number): <NEW_LINE> <INDENT> if number < 1: <NEW_LINE> <INDENT> print("There is no factorial value") <NEW_LINE> return 0 <NEW_LINE> <DEDENT> if number == 1: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return number * conventional_factorial(number - 1)
Calculate factorial n! = 1 x 2 x 3 x ... x n using recursive :param number: input number :return: number!, return 0 if number < 1
625941c963f4b57ef00011a0
def delete_license_with_http_info(self, license_id, **kwargs): <NEW_LINE> <INDENT> local_var_params = locals() <NEW_LINE> all_params = [ 'license_id' ] <NEW_LINE> all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth' ] ) <NEW_LINE> for key, val in six.iterit...
Delete a license # noqa: E501 Use this method to delete a license. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_license_with_http_info(license_id, async_req=True) >>> result = thread.get() :param licen...
625941c923e79379d52ee5e9
def setscreenshot(self, host, port, data, protocol="tcp", overwrite=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> port = [ p for p in host.get("ports", []) if p["port"] == port and p["protocol"] == protocol ][0] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> raise KeyError("Port %s/%d does not exist"...
Sets the content of a port's screenshot.
625941c9a05bb46b383ec8a7
def check_topology(self, *args, **kwargs): <NEW_LINE> <INDENT> return _qtgui_swig.time_raster_sink_f_sptr_check_topology(self, *args, **kwargs)
check_topology(time_raster_sink_f_sptr self, int ninputs, int noutputs) -> bool
625941c9b7558d58953c4f9a
def last_acceptance_variable_required(self): <NEW_LINE> <INDENT> if not self.__engine_type.is_FORWARD(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for entry in imap(lambda x: x.entry, self.__state_db.itervalues()): <NEW_LINE> <INDENT> if entry.has_command(E_Cmd.Accepter): return True <NEW_LINE> <DEDENT> retu...
If one entry stores the last_acceptance, then the correspondent variable is required to be defined.
625941c97cff6e4e81117a0b
def installDirectory(self): <NEW_LINE> <INDENT> t = self.executablePath <NEW_LINE> p = t.rfind("/") <NEW_LINE> if p == -1: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> return self.executablePath[:p]
:returns: the installation directory of the tool
625941c9b5575c28eb68e085
def motorcontinue(self, name, motorbuffer, otherchunk, temp_actrvariables, time, time_presses): <NEW_LINE> <INDENT> if motorbuffer.last_key[1]: <NEW_LINE> <INDENT> time = motorbuffer.last_key[1] <NEW_LINE> <DEDENT> initiation = time_presses[1] <NEW_LINE> execution = time_presses[2] <NEW_LINE> movement_finish = time_pre...
Carry out the rest of motor action. Motor action is split in two because of ACT-R assumption that the two parts can act independently of each other.
625941c9dc8b845886cb55b9
def _get_event_elements(event): <NEW_LINE> <INDENT> event_id = json.dumps(event['id']).encode('utf8').decode('string_escape') <NEW_LINE> event_id = event_id[1::] <NEW_LINE> event_id = event_id[:-1] <NEW_LINE> event_uuid = json.dumps(event['uuid']).encode('utf8').decode('string_escape') <NEW_LINE> event_uuid = event_uui...
Returns a dict object that contains elements of an event. event -- json snippet that contains an event.
625941c90383005118ecf668
def get_spreadsheet_data(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import gspread <NEW_LINE> from oauth2client.service_account import ServiceAccountCredentials <NEW_LINE> scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive.file",...
Func - to call the google spreadsheet that has been shared through Google API. This func will pull all the data fields and store them in a variable to be called upon. This will limit our API calls to a minimum (updating cells, deleting cells, etc.) *Must be sure the sheet file is saved as google sheet and NOT .xscl #S...
625941c9004d5f362079a3b8
def door_position_changed(self, new_position): <NEW_LINE> <INDENT> if new_position == DOOR_POSITION_OPEN: <NEW_LINE> <INDENT> self.door_model.set_new_state("Open") <NEW_LINE> <DEDENT> elif new_position == DOOR_POSITION_CLOSED: <NEW_LINE> <INDENT> self.door_model.set_new_state("Closed")
This method is called by the door model, when its positions is changed.
625941c9c432627299f04cca
def PMVcolorAssign(PMV): <NEW_LINE> <INDENT> color = [] <NEW_LINE> stat = [] <NEW_LINE> c_excold, c_cold, c_slcold, c_comf, c_slwarm, c_hot,c_exhot = 0,0,0,0,0,0,0 <NEW_LINE> for item in PMV: <NEW_LINE> <INDENT> if item == "": <NEW_LINE> <INDENT> color.append(color_Unoccupied) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
assigining color values based on PMV
625941c9fbf16365ca6f6248
def fc_backward(next_dz, W, z): <NEW_LINE> <INDENT> N = z.shape[0] <NEW_LINE> dz = np.dot(next_dz, W.T) <NEW_LINE> dw = np.dot(z.T, next_dz) <NEW_LINE> db = np.sum(next_dz, axis=0) <NEW_LINE> return dw / N, db / N, dz
全连接层的反向传播 :param next_dz: 下一层的梯度 :param W: 当前层的权重 :param z: 当前层的输出 :return:
625941c926068e7796caed63
def normalize_intensity(self, npzarray): <NEW_LINE> <INDENT> maxHU = 400.0 <NEW_LINE> minHU = -1000.0 <NEW_LINE> npzarray = (npzarray - minHU) / (maxHU - minHU) <NEW_LINE> npzarray[npzarray>1] = 1. <NEW_LINE> npzarray[npzarray<0] = 0. <NEW_LINE> return npzarray
Houndsunits to grayscale units
625941c997e22403b379d01e
def add_roles(self, member, *roles): <NEW_LINE> <INDENT> url = '{0}/{1.server.id}/members/{1.id}'.format(endpoints.SERVERS, member) <NEW_LINE> new_roles = [role.id for role in itertools.chain(member.roles, roles)] <NEW_LINE> payload = { 'roles': new_roles } <NEW_LINE> response = requests.patch(url, headers=self.headers...
Gives the specified :class:`Member` a number of :class:`Role` s. You must have the proper permissions to use this function. This method **appends** a role to a member. :param member: The :class:`Member` to give roles to. :param roles: An iterable of :class:`Role` s to give the member. :return: ``True`` if the operat...
625941c9283ffb24f3c55987
def test1writerWritesAllParts(self): <NEW_LINE> <INDENT> mockXsdFile = MockWriter() <NEW_LINE> mockGmlFile = MockWriter() <NEW_LINE> obj_list = HydroObjectFactory.hydroObjectListFromSUFHYD(self.fake_file) <NEW_LINE> HydroObjectFactory.propagateGeometries(obj_list) <NEW_LINE> HydroObjectFactory.writeGml(obj_list, mockXs...
- if the xsd file contains all expected parts
625941c930dc7b76659019ec
def rs_to_dict_with_certificate_titles(rs, key): <NEW_LINE> <INDENT> entities = rs_to_dict(rs) <NEW_LINE> places = len(str(Share.get_last_share_number())) <NEW_LINE> for e in entities: <NEW_LINE> <INDENT> e.update({ key : format_share_range( lower = e["first_share"], upper = e["last_share"], places = places ) }) <NEW_L...
Takes a query resultproxy, expecting that 'first_share' and 'last_share' are among the columns, converts the rows to dicts, and finally writes in certificate titles to each dict (under given key) in a standard format. This is best thought of as an extension of the more generic 'rs_to_dict' utility function for cases w...
625941c976d4e153a657ebb6
def collide_box(self, other): <NEW_LINE> <INDENT> x_or_y, drcs, _ = get_coll_side(other.left - self.rect.right, self.rect.left - other.right, other.top - self.rect.bottom, self.rect.top - other.bottom) <NEW_LINE> self.collide(x_or_y, drcs)
Handles collision
625941c945492302aab5e348
def t380291_x1(): <NEW_LINE> <INDENT> assert t380291_x11() <NEW_LINE> assert GetCurrentStateElapsedFrames() > 1 <NEW_LINE> if not GetEventStatus(1356) and not GetEventStatus(1357): <NEW_LINE> <INDENT> if GetDistanceToPlayer() < 10: <NEW_LINE> <INDENT> call = t380291_x7() <NEW_LINE> if call.Done(): <NEW_LINE> <INDENT> p...
State 0,9
625941c97d847024c06be340
def data(self, raw=False, bgr2rgb=True, resize=True, order=0): <NEW_LINE> <INDENT> de = self.directory_entry <NEW_LINE> self._fh.seek(self.data_offset) <NEW_LINE> if raw: <NEW_LINE> <INDENT> return self._fh.read(self.data_size) <NEW_LINE> <DEDENT> elif de.compression: <NEW_LINE> <INDENT> if de.compression not in DECOMP...
Read image data from file and return as numpy array.
625941c967a9b606de4a7f3f
def test_load_tarfile(): <NEW_LINE> <INDENT> registry = Registry() <NEW_LINE> with NamedTemporaryFile() as fileobj: <NEW_LINE> <INDENT> build_tar(fileobj) <NEW_LINE> fileobj.flush() <NEW_LINE> schema_ids = registry.load(fileobj.name) <NEW_LINE> assert_that(schema_ids, has_length(3)) <NEW_LINE> assert_that(schema_ids, h...
Registry can load a tar file.
625941c999cbb53fe6792c6c
def __init__(self, mozwebqa, url, expect='redirect'): <NEW_LINE> <INDENT> Base.__init__(self, mozwebqa) <NEW_LINE> self.selenium.get(url) <NEW_LINE> if expect == 'redirect': <NEW_LINE> <INDENT> WebDriverWait(self.selenium, self.timeout).until( lambda s: s.title != self._page_title, "Complete Registration page did not r...
class init method :Args: - url - the confirmation url from the email - expect - redirect/success/reset/verify (default redirect)
625941c9627d3e7fe0d68ed4
def negation_mutex(self, node_s1: PgNode_s, node_s2: PgNode_s) -> bool: <NEW_LINE> <INDENT> if node_s1.symbol == node_s2.symbol: <NEW_LINE> <INDENT> if (node_s1.is_pos and not node_s2.is_pos) or (not node_s1.is_pos and node_s2.is_pos): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Test a pair of state literals for mutual exclusion, returning True if one node is the negation of the other, and False otherwise. HINT: Look at the PgNode_s.__eq__ defines the notion of equivalence for literal expression nodes, and the class tracks whether the literal is positive or negative. :param node_s1: PgNode_s...
625941c95fc7496912cc3a03
@csrf_exempt <NEW_LINE> def request_add(request, **kwargs): <NEW_LINE> <INDENT> status_ret = {'status': 0, 'sum': 0} <NEW_LINE> if request.method != 'POST': <NEW_LINE> <INDENT> status_ret = {'status': 11} <NEW_LINE> return JsonResponse(status_ret) <NEW_LINE> <DEDENT> if 'val1' not in request.POST or 'val2' not in reque...
function: request_add() - http add interface
625941c9b7558d58953c4f9b
def addLayoutWidget(self, layout, *args, **kwargs): <NEW_LINE> <INDENT> return self._addLayout(layout, *args, **kwargs)
Add a layout that does not contain anything.
625941c9a4f1c619b28b00c0
def __init__(self, obj=None, prop=None, material=None): <NEW_LINE> <INDENT> self.obj = obj <NEW_LINE> self.prop = prop <NEW_LINE> self.material = material <NEW_LINE> self.customprops = [] <NEW_LINE> self.internalprops = [] <NEW_LINE> self.groups = [] <NEW_LINE> self.directory = FreeCAD.getResourceDir() + "Mod/Material"...
Initializes, optionally with an object name and a material property name to edit, or directly with a material dictionary.
625941c929b78933be1e5732
def isPowerOfThree(n): <NEW_LINE> <INDENT> if n <= 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> while(True): <NEW_LINE> <INDENT> if n == 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if n % 3: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> n = n // 3 <NEW_LINE> <DEDENT> <DED...
:type n: int :rtype: bool
625941c9cc40096d615959d6
def do1DCTScan(self, angle): <NEW_LINE> <INDENT> Scanner1 = Scanner(self.inputImage) <NEW_LINE> Scanner1.getOneSinogram(angle) <NEW_LINE> sinogram1DImage= cv2.imread("scanner_plot.png") <NEW_LINE> sinogram1DImage = cv2.cvtColor(sinogram1DImage, cv2.COLOR_RGB2GRAY) <NEW_LINE> displayImage = self.makeDisplayImage(sinogra...
Get 1D CT scan using CTScan class
625941c950485f2cf553ce1f
def check_wallet_creation(request) -> bool: <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if not "wallet_creation_notified_at" in request.user.user_data: <NEW_LINE> <INDENT> request.user.user_data["wallet_creation_notified_at"] = now().isoformat() <NEW_LINE> request.registry.notify(WalletCreated(request, user)) <N...
Check if we have notified this user about wallet creation yet. :return: True if this was a wallet creation event
625941c9eab8aa0e5d26dbdd
def get_user_details(self, response): <NEW_LINE> <INDENT> name = response.get('name') or '' <NEW_LINE> details = {'username': response.get('login'), 'email': response.get('email') or ''} <NEW_LINE> try: <NEW_LINE> <INDENT> first_name, last_name = name.split(' ', 1) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <IND...
Return user details from Github account
625941c96fb2d068a760f122
def alias(self): <NEW_LINE> <INDENT> return _lora_swig.encode_sptr_alias(self)
alias(encode_sptr self) -> std::string
625941c94428ac0f6e5ba877
def get_num_pixels(porosity): <NEW_LINE> <INDENT> r <NEW_LINE> return -np.log(porosity) * vol_total
Helper method to calculate number of pixels given a porosity
625941c9627d3e7fe0d68ed5
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> buff.write(_get_struct_B().pack(self.ping)) <NEW_LINE> <DEDENT> except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) <NEW_LINE> except TypeError as te: self._c...
serialize message into buffer :param buff: buffer, ``StringIO``
625941c944b2445a3393211c
def getResourceDict( self, resourceIndex ): <NEW_LINE> <INDENT> assert self.resourceList <NEW_LINE> return self.resourceList[resourceIndex]
Given an index into self.resourceList, returns the resource dict
625941c9ad47b63b2c50a005
def test_category_feed(self): <NEW_LINE> <INDENT> feed = CategoryFeed() <NEW_LINE> cat = factories.CategoryFactory() <NEW_LINE> factories.VideoFactory(category=cat) <NEW_LINE> v2 = factories.VideoFactory(category=cat) <NEW_LINE> eq_(len(feed.items()), 0) <NEW_LINE> v2.state = Video.STATE_LIVE <NEW_LINE> v2.save() <NEW_...
Tests for Category rss feed
625941c910dbd63aa1bd2c29
def get_probs(self, x, x_dropped, z, all_embeddings, mode='all'): <NEW_LINE> <INDENT> z_start = T.dot(z, self.W_z) <NEW_LINE> x_dropped_pre_padded = T.concatenate([T.shape_padaxis(z_start, 1), x_dropped], axis=1)[:, :-1] <NEW_LINE> hiddens = get_output(self.rnn, x_dropped_pre_padded) <NEW_LINE> probs_numerators = T.sum...
:param x: (S*N) * max(L) * E tensor :param z: (S*N) * dim(z) matrix :param all_embeddings: D * E matrix :param mode: 'all' returns probabilities for every element in the vocabulary, 'true' returns only the probability for the true word. :return probs: (S*N) * max(L) * E tensor
625941c9d18da76e2353255b
def test_field_restricted(self): <NEW_LINE> <INDENT> obj = JObj({'a': 1, 'b': 1}) <NEW_LINE> self.assertRaises(Exception, getattr, obj, 'a') <NEW_LINE> self.assertRaises(Exception, getattr, obj, 'b') <NEW_LINE> obj = JObj({}) <NEW_LINE> self.assertEqual(obj.b, 'hi')
when restricted, should not existed in key
625941c9d8ef3951e32435c3
@pytest.mark.ignore_stream("upstream") <NEW_LINE> @test_requirements.multi_tenancy <NEW_LINE> @pytest.mark.meta(blockers=[BZ(1759291)]) <NEW_LINE> def test_tenant_ldap_group_switch_between_tenants(appliance, setup_openldap_auth_provider, setup_openldap_user_group, soft_assert): <NEW_LINE> <INDENT> user, retrieved_group...
User who is member of 2 or more LDAP groups can switch between tenants Polarion: assignee: nachandr casecomponent: Configuration caseimportance: high tags: cfme_tenancy initialEstimate: 1/4h startsin: 5.5 testSteps: 1. Configure LDAP authentication on CFME 2. Create 2 differ...
625941c963d6d428bbe44575
def __init__(self, crcAlgorithm, value=None): <NEW_LINE> <INDENT> self.crcAlgorithm = crcAlgorithm <NEW_LINE> p = crcAlgorithm <NEW_LINE> self.bitMask = (1 << p.width) - 1 <NEW_LINE> word = 0 <NEW_LINE> for n in p.polynomial: <NEW_LINE> <INDENT> word |= 1 << n <NEW_LINE> <DEDENT> self.polyMask = word & self.bitMask <NE...
:param crcAlgorithm: The CRC algorithm to use. :type crcAlgorithm: `CrcAlgorithm` :param value: The initial register value to use. The result previous of a previous CRC calculation, can be used here to continue calculation with more data. If this parameter is ``None`` or not given, the register will ...
625941c9097d151d1a222ee0
def _check_for_failed_attempt(self): <NEW_LINE> <INDENT> if self: <NEW_LINE> <INDENT> user_inputs = self.search([ ('id', 'in', self.ids), ('state', '=', 'done'), ('scoring_success', '=', False), ('slide_partner_id', '!=', False) ]) <NEW_LINE> if user_inputs: <NEW_LINE> <INDENT> for user_input in user_inputs: <NEW_LINE>...
If the user fails his last attempt at a course certification, we remove him from the members of the course (and he has to enroll again). He receives an email in the process notifying him of his failure and suggesting he enrolls to the course again. The purpose is to have a 'certification flow' where the user can re-pu...
625941c9f7d966606f6aa089
def calculate_population_fitness(self): <NEW_LINE> <INDENT> total_fit = 0 <NEW_LINE> for equation in self.equations: <NEW_LINE> <INDENT> indiv_fitness = equation.calculate_fitness(self.target_inputs,self.target_outputs) <NEW_LINE> self.fitness_list.append(indiv_fitness) <NEW_LINE> total_fit += indiv_fitness <NEW_LINE> ...
Calculate the total fitness for the current population
625941c98a43f66fc4b540eb
def testNonDefaultDirCos3DVFF(self): <NEW_LINE> <INDENT> v = volumeFromFile(input3DdirectionCosines) <NEW_LINE> pipe = os.popen("mincinfo -attvalue xspace:direction_cosines %s" % input3DdirectionCosines, "r") <NEW_LINE> from_file = pipe.read().rstrip().split(" ") <NEW_LINE> pipe.close() <NEW_LINE> assert v._x_direction...
testing reading the direction cosines of a file with non-standard values (volumeFromFile)
625941c9d53ae8145f87a2f7
def left_ap(self, a, b): <NEW_LINE> <INDENT> return self.ap(self.ap(self.pure(const), a), b)
<* f a -> f b -> f a
625941c98da39b475bd64ff9
def vector_add(*v_list): <NEW_LINE> <INDENT> return tuple(sum(i) for i in zip(*v_list))
多個向量相加
625941c956b00c62f0f146df
def _objs(self): <NEW_LINE> <INDENT> return IShoppingSite(self.context).get_objects(IArticleContainer, depth=1, sort_on='getObjPositionInParent')
Return list of article container objects :rtype: list
625941c96e29344779a62698
def session_api(username=None, password=None): <NEW_LINE> <INDENT> if username is None or password is None: <NEW_LINE> <INDENT> username, password = auth(target='api') <NEW_LINE> <DEDENT> url = AUTH + '/oauth/token' <NEW_LINE> session = requests.Session() <NEW_LINE> data = { 'grant_type': 'client_credentials', } <NEW_L...
Creates authenticated API session If username and/or password is missing, it tries to get it from :func:`auth` (target='api') Args: username (str): CTU username password (str): CTU password Returns: session (obj): authenticated API session
625941c971ff763f4b549710
def field_value(field_name, fields): <NEW_LINE> <INDENT> for field in fields: <NEW_LINE> <INDENT> if field.startswith(field_name): <NEW_LINE> <INDENT> return int(field[len(field_name) + 1:]) <NEW_LINE> <DEDENT> <DEDENT> return 0;
Pulls the first field from a list of fields. :param field_name field to find :param fields list of fields from the file (name=value strings) :return value as int, or zero if no field found
625941c960cbc95b062c65c9
def filtrar(self, nombre): <NEW_LINE> <INDENT> return Comite.query.filter(Comite.nombre == nombre).first_or_404()
Busca por nombre de comite
625941c938b623060ff0ae73
def T_sv(self,s,v): <NEW_LINE> <INDENT> rho = 1./v <NEW_LINE> if self.ConvertUnits==False: <NEW_LINE> <INDENT> s*=1000. <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> s = self.converter.s_toSI(s)*1000. <NEW_LINE> rho = self.converter.rho_toSI(rho) <NEW_LINE> <DEDENT> value = CP.PropsSI('T','S',s,'D',rho,self.fluidName) ...
return temperature as a function of entropy and specific volume
625941c999fddb7c1c9de417
def test_rename_then_sed(self): <NEW_LINE> <INDENT> self.assertLines( [ "-X", "(a|b)", r"!\1!", "-R", 'a|apples,"b|B-Sharps!","c|Sea, shells "', "examples/dummy.csv", ], ['!a!pples,B-Sh!a!rps!,"Se!a!, shells "', "1,2,3"], )
renaming always happens first, then the slugging
625941c9009cb60464c63438
def address_type(address): <NEW_LINE> <INDENT> if type(address) == tuple: <NEW_LINE> <INDENT> if ':' in address[0]: <NEW_LINE> <INDENT> return 'AF_INET6' <NEW_LINE> <DEDENT> return 'AF_INET' <NEW_LINE> <DEDENT> elif isinstance(address, string_class) and address.startswith('\\\\'): <NEW_LINE> <INDENT> return 'AF_PIPE' <...
Return the types of the address This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
625941c9f8510a7c17cf9782
def dissociate(self, id): <NEW_LINE> <INDENT> return self._client.update_resource( self.resource_type, id, volcoll_id='' )
Dissociate the volume from a volume collection # Parameters id : ID of the volume.
625941c90fa83653e4657041
def removeInvalidParentheses(self, s): <NEW_LINE> <INDENT> def dfs(s): <NEW_LINE> <INDENT> mi = calc(s) <NEW_LINE> if mi == 0: <NEW_LINE> <INDENT> return [s] <NEW_LINE> <DEDENT> ans = [] <NEW_LINE> for x in xrange(len(s)): <NEW_LINE> <INDENT> if s[x] in ('(', ')'): <NEW_LINE> <INDENT> ns = s[:x] + s[x+1:] <NEW_LINE> if...
:type s: str :rtype: List[str]
625941c9287bf620b61d3aea
def demo(self, demoNumber=-1): <NEW_LINE> <INDENT> if (demoNumber < -1 or demoNumber > 9): <NEW_LINE> <INDENT> demoNumber = -1 <NEW_LINE> <DEDENT> self.send( DEMO ) <NEW_LINE> if demoNumber < 0 or demoNumber > 9: <NEW_LINE> <INDENT> self.send( chr(255) ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.send( chr(demo...
runs one of the built-in demos for Create if demoNumber is <omitted> or -1 stop current demo 0 wander the surrounding area 1 wander and dock, when the docking station is seen 2 wander a more local area 3 wander to a wall and then follow along it 4 figure 8 5 "wimp" demo: when pushed, move forward ...
625941c93617ad0b5ed67f7e
def make_api_call(url, method, kwargs): <NEW_LINE> <INDENT> client = httplib2.Http() <NEW_LINE> return client.request(url, method=method, **kwargs)
Perform the call allowed by httplib2 ``method`` :param url: Rest API url :param method: :py:class:httplib.HTTP request method: GET, POST, PUT, DELETE :param kwargs: dictionary of supported :py:class:httplib2.Http() request body, headers, redirections, connection_type return: The return value is a tuple of (...
625941c93d592f4c4ed1d0f6
def equalIndex(self, lhs): <NEW_LINE> <INDENT> return _DataModel.ResponsePAZ_equalIndex(self, lhs)
equalIndex(ResponsePAZ self, ResponsePAZ lhs) -> bool
625941c9fb3f5b602dac3718
def create_base_operations(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs): <NEW_LINE> <INDENT> if not router.allow_migrate(using, models.Operation): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> utils.get_operation(models.ADD_OP) <NEW_LINE> utils.get_operation(models.CHANGE_OP) <NEW_LINE>...
Create some basic operations, matching permissions from Django
625941c97b180e01f3dc4885
def __init__(self): <NEW_LINE> <INDENT> self.ReleaseAddress = None <NEW_LINE> self.UnsupportNetworks = None <NEW_LINE> self.StorageBlockAttr = None
:param ReleaseAddress: Release address Note: This field may return null, indicating that no valid value is found. :type ReleaseAddress: bool :param UnsupportNetworks: Not supported network. Value: <br><li>BASIC: classic network<br><li>VPC1.0: VPC1.0 Note: This field may return null, indicating t...
625941c9d10714528d5ffd68
def __init__( self, *, tags: Optional[Dict[str, str]] = None, profiles: Optional[List["AutoscaleProfile"]] = None, notifications: Optional[List["AutoscaleNotification"]] = None, enabled: Optional[bool] = True, name: Optional[str] = None, target_resource_uri: Optional[str] = None, target_resource_location: Optional[str]...
:keyword tags: A set of tags. Resource tags. :paramtype tags: dict[str, str] :keyword profiles: the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. :paramtype profiles: list[~$(python-base-namespace).v2015_04_01.m...
625941c9236d856c2ad4485f
def get_server_sql_filter(self, server_ids, app_str='app_id', is_server_table=True): <NEW_LINE> <INDENT> sql_filter = '' <NEW_LINE> app_server = {} <NEW_LINE> server_id_key = self.server_id_key if is_server_table else 'server_id' <NEW_LINE> for item in server_ids: <NEW_LINE> <INDENT> app_id = item.split('_')[0] <NEW_LI...
获取app_id和server_id的查询sql条件 :param server_ids: :return:
625941c931939e2706e4cef1