code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def __init__(self, qgs_abs_geom, original_geom_type): <NEW_LINE> <INDENT> self.id = RbGeom.next_id() <NEW_LINE> self.original_geom_type = original_geom_type <NEW_LINE> qgs_geometry = qgs_abs_geom.constGet() <NEW_LINE> self.qgs_geom = QgsGeometry(qgs_geometry.clone()) <NEW_LINE> self.is_simplest = False <NEW_LINE> self.... | Constructor that initialize a RbGeom object.
:param: qgs_abs_geom: QgsAbstractGeometry to process
:param: original_geom_type: Original type of the geometry | 625941c4796e427e537b05a6 |
def set_entry_value(self, path, popdown=False): <NEW_LINE> <INDENT> self.path_entry.set_text(self.tree_store[path][0], set_file_chooser_folder=True, trigger_event=True) <NEW_LINE> if popdown: <NEW_LINE> <INDENT> self.popdown() | Sets the text of the entry to the value in path | 625941c4dd821e528d63b18c |
def add(self, additions, current=None): <NEW_LINE> <INDENT> pass | Add a sequence of strings to this set of constraints. Order is
not preserved and duplicates are implicitly removed.
Arguments:
additions The sequence of strings to be added. | 625941c457b8e32f5248347b |
def text_to_url(event): <NEW_LINE> <INDENT> if isinstance(event.media, MessageMediaWebPage): <NEW_LINE> <INDENT> webpage = event.media.webpage <NEW_LINE> if webpage and webpage.type in ["photo"]: <NEW_LINE> <INDENT> return webpage.display_url <NEW_LINE> <DEDENT> <DEDENT> return event.text | function to get media url (with|without) Webpage | 625941c4e8904600ed9f1f0d |
def profee(): <NEW_LINE> <INDENT> url = 'http://decorate.ishangzu.com/isz_decoration/NewDecorationProjectController/proCheck/profee' <NEW_LINE> IMG = upLoadPhoto(url=self.uploadPhotoURL, filename='PROPERTY_DELIVERY_ORDER.png') <NEW_LINE> data = { "air_switch": "", "door_card": "", "door_key": "", "electricity_card": ""... | 物业交割 | 625941c4d7e4931a7ee9deff |
def remove_container(self, container): <NEW_LINE> <INDENT> if isinstance(container, str): <NEW_LINE> <INDENT> container = self.find_image_by_name(container) <NEW_LINE> <DEDENT> self.remove_containers(host=container["host"], name=container["name"]) <NEW_LINE> del self.running_containers[container["host"]][container["nam... | Remove container from host
:param container: str - container name
dict - container obj | 625941c47b25080760e3943c |
def _createAttribute(self, attrName, attrValue): <NEW_LINE> <INDENT> attr = self.__doc.createAttribute(attrName) <NEW_LINE> if attrValue is None: <NEW_LINE> <INDENT> attr.nodeValue = u'' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> attr.nodeValue = getUnicode(attrValue) <NEW_LINE> <DEDENT> return attr | Creates an attribute node with utf8 data inside.
The text is escaped to an fit the xml text Format. | 625941c4f7d966606f6a9fe4 |
def getNonInstallableProfiles(self): <NEW_LINE> <INDENT> return [ 'rer.pubblicazioni:uninstall', ] | Hide uninstall profile from site-creation and quickinstaller | 625941c4377c676e9127218b |
def db_init(): <NEW_LINE> <INDENT> if not os.path.exists("./data.db"): <NEW_LINE> <INDENT> logger.info("START datebase init process") <NEW_LINE> create.create_base() <NEW_LINE> create.create_accounting() <NEW_LINE> create.create_cache() <NEW_LINE> insert.insert_cache(['', '', '', '', '', '', '', '', '']) <NEW_LINE> try... | アプリ起動時に、data.dbが存在するか、確認し、存在しない場合は初期化処理を行う
csvinに既存ファイルが存在する場合、自動でdbに登録する | 625941c4283ffb24f3c558e5 |
def find_best_classifier(data, possible_classifiers, target_classifier): <NEW_LINE> <INDENT> best_classifier=None <NEW_LINE> lowest_disorder=INF <NEW_LINE> for classifier in possible_classifiers: <NEW_LINE> <INDENT> disorder = average_test_disorder(data, classifier, target_classifier) <NEW_LINE> if disorder < lowest_di... | Given a list of points, a list of possible Classifiers to use as tests,
and a Classifier for determining the true classification of each point,
finds and returns the classifier with the lowest disorder. Breaks ties by
preferring classifiers that appear earlier in the list. If the best
classifier has only one branch, ... | 625941c4baa26c4b54cb1103 |
def health_check(): <NEW_LINE> <INDENT> return {'health':'ok'}, 200 | Check the microservice health
Returns:
200 - healthly
500 - not | 625941c438b623060ff0add0 |
def test_generic(self): <NEW_LINE> <INDENT> a = MockBundle(output='a') <NEW_LINE> self.assets_env.add(a) <NEW_LINE> self.cmd_env.build() <NEW_LINE> assert a.build_called | Test the build command. | 625941c43346ee7daa2b2d4d |
def test_card_products_save_nothing(self): <NEW_LINE> <INDENT> card_product = self.card_products.create() <NEW_LINE> updated = self.client.card_products.save(card_product.token, {}) <NEW_LINE> self.assertEqual(updated.name, card_product.name) | Verifies behavior is correct when no update options are specified. | 625941c4be383301e01b546b |
@transaction.atomic <NEW_LINE> def load_ms(folder, f): <NEW_LINE> <INDENT> match = ms_re.match(f) <NEW_LINE> if not match: <NEW_LINE> <INDENT> raise UnexpectedFilename("Unexpected filename {}".format(f)) <NEW_LINE> <DEDENT> book_num = int(match.group(1)) <NEW_LINE> name = match.group(2) <NEW_LINE> try: <NEW_LINE> <INDE... | Load a single XML file | 625941c456b00c62f0f1463a |
def inspect(self, *args): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=self.inspect.__doc__, prog="conan inspect") <NEW_LINE> parser.add_argument("path_or_reference", help="Path to a folder containing a recipe" " (conanfile.py) or to a recipe file. e.g., " "./my_project/conanfile.py. It could also b... | Displays conanfile attributes, like name, version, options
Works both locally, in local cache and remote | 625941c473bcbd0ca4b2c058 |
def test_results_prod_not_found(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('results'), {'query': 'error'}) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertTemplateUsed('purbeurre_results/prod_not_found.html') | Getting the results page with a wrong product should return a http code = 200. | 625941c48c0ade5d55d3e99b |
def list_by_resource_group( self, resource_group_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "2021-03-... | Lists all the hybrid machines in the specified resource group. Use the nextLink property in the
response to get the next page of hybrid machines.
:param resource_group_name: The name of the resource group. The name is case insensitive.
:type resource_group_name: str
:keyword callable cls: A custom type or function tha... | 625941c460cbc95b062c6525 |
def remove_crc(self, path): <NEW_LINE> <INDENT> with open(path, 'rb') as f: <NEW_LINE> <INDENT> data = f.read() <NEW_LINE> <DEDENT> checksum_data = data[:4] <NEW_LINE> checksum = struct.unpack('<L', checksum_data)[0] <NEW_LINE> self.logger.debug('Removing checksum: {}'.format(checksum)) <NEW_LINE> with open(path, 'wb')... | Remove the first 4 bytes of the firmware which contain the CRC-32 checksum. | 625941c492d797404e30416c |
def pre_verify(method): <NEW_LINE> <INDENT> @wraps(method) <NEW_LINE> def wrapper(self, *args, **kwargs): <NEW_LINE> <INDENT> self._verify_page() <NEW_LINE> return method(self, *args, **kwargs) <NEW_LINE> <DEDENT> return wrapper | Decorator that calls self._verify_page() before executing the decorated method
Args:
method (callable): The method to decorate.
Returns:
Decorated method | 625941c4f7d966606f6a9fe5 |
def create_factory(self, industry_id: int, building_type: int = 1) -> Response: <NEW_LINE> <INDENT> company_name = constants.INDUSTRIES[industry_id] <NEW_LINE> if building_type == 2: <NEW_LINE> <INDENT> company_name = "Storage" <NEW_LINE> <DEDENT> self.logger.info(f"{company_name} created!") <NEW_LINE> return self._pos... | param industry_ids: FRM={q1:7, q2:8, q3:9, q4:10, q5:11} WRM={q1:12, q2:13, q3:14, q4:15, q5:16}
HRM={q1:18, q2:19, q3:20, q4:21, q5:22} ARM={q1:24, q2:25, q3:26, q4:27, q5:28}
Factories={Food:1, Weapons:2, House:4, Aircraft:23} <- Building_type 1
Storage={10... | 625941c430dc7b766590194a |
def brake(self): <NEW_LINE> <INDENT> if self.mode == self.ONE_SPEED: <NEW_LINE> <INDENT> self.go(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._speed = 0 <NEW_LINE> self.in1.duty(100) <NEW_LINE> self.in2.duty(100) | Apply the motors brakes.
In ONE_SPEED mode, this is the same as coast. | 625941c4eab8aa0e5d26db3a |
def make_part(filepath): <NEW_LINE> <INDENT> (ctype, encoding) = mimetypes.guess_type(filepath) <NEW_LINE> if ctype is None or encoding is not None: <NEW_LINE> <INDENT> ctype = "application/octet-stream" <NEW_LINE> <DEDENT> maintype, subtype = ctype.split("/", 1) <NEW_LINE> if maintype == "image": <NEW_LINE> <INDENT> w... | Make a MIME data from given `filepath`.
:param filepath: :class:`pahtlib.Path` object points a file
:return: :class:`email.mime.base.MIMEBase` object | 625941c466673b3332b92073 |
def prepare_email(appointments): <NEW_LINE> <INDENT> body = [] <NEW_LINE> statement = 'Dear {},\nI look forward to meeting with you on {}.\nBest,\nMe' <NEW_LINE> for confirm in appointments: <NEW_LINE> <INDENT> body.append(statement.format(confirm[0], confirm[1])) <NEW_LINE> <DEDENT> return body | This function
Args:
appointments(list): client's name and appointment time (two-item tuple)
Returns:
list with strings that states information to be in e-mail body
Examples:
>>> prepare_email([('Jen', '2015'), ('Max', 'March 3')])
{'Dear Jen,
I look forward to meeting wit... | 625941c44a966d76dd550ff1 |
def _upload_img_dir(self, img_dir): <NEW_LINE> <INDENT> zipped = self._zip_dir(img_dir) <NEW_LINE> shareable_link = self._upload_to_drive(zipped) <NEW_LINE> return shareable_link | Zip a directory of images and upload them to Google Drive.
Returns a shareable Google Drive link. | 625941c48a43f66fc4b54049 |
def has_app(self, app_name): <NEW_LINE> <INDENT> app_config = self.app_configs.get(app_name.rpartition(".")[2]) <NEW_LINE> return app_config is not None and app_config.name == app_name | Checks whether an application with this name exists in the registry.
app_name is the full name of the app eg. 'django.contrib.admin'.
It's safe to call this method at import time, even while the registry
is being populated. It returns False for apps that aren't loaded yet. | 625941c4435de62698dfdc2e |
def clusterCmdLine(method, inFname, outFname, checkIn=True, checkOut=True): <NEW_LINE> <INDENT> if checkIn: <NEW_LINE> <INDENT> inFname = "{check in exists %s}" % inFname <NEW_LINE> <DEDENT> if checkOut: <NEW_LINE> <INDENT> outFname = "{check out exists %s}" % outFname <NEW_LINE> <DEDENT> cmd = "%s %s %s %s %s" % (sys.... | generate a cmdLine for batch system that calls this module
with the given parameters | 625941c4d164cc6175782d30 |
def updateTaskStatus(task): <NEW_LINE> <INDENT> if not task.deadline or datetime.datetime.now() < task.deadline: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if task.program.timeline.stop_all_work_deadline < datetime.datetime.now(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> transit_func = STATE_TRANS... | Method used to transit a task from a state to another state
depending on the context. Whenever the deadline has passed.
To be called by the automated system running on Appengine tasks or
whenever the public page for the task is loaded in case the Appengine task
framework is running late.
Args:
task: The task_model.... | 625941c423849d37ff7b3072 |
def send(self, message): <NEW_LINE> <INDENT> assert self._handshake_performed, "Perform a handshake first." <NEW_LINE> assert message.message_type in self.CALL_REQ_TYPES, ( "Message '%s' can't use send" % repr(message) ) <NEW_LINE> message.id = message.id or self.writer.next_message_id() <NEW_LINE> assert message.id no... | Send the given message up the wire.
Use this for messages which have a response message.
:param message:
Message to send
:returns:
A Future containing the response for the message | 625941c485dfad0860c3ae3d |
def action_revert(self): <NEW_LINE> <INDENT> if self.curfile: <NEW_LINE> <INDENT> proceed = self.dialog_confirm('Revert to Saved', 'Reverting to the saved copy on disk will revert any changes you have made. Continue?') <NEW_LINE> if proceed: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.load_from_file(self.curfile... | Handle our "Revert" action. | 625941c40fa83653e4656f9e |
def get_visible_page_objects(request, pages, site=None): <NEW_LINE> <INDENT> public_for = get_cms_setting('PUBLIC_FOR') <NEW_LINE> can_see_unrestricted = public_for == 'all' or ( public_for == 'staff' and request.user.is_staff) <NEW_LINE> is_auth_user = request.user.is_authenticated() <NEW_LINE> restricted_pages = load... | This code is basically a many-pages-at-once version of
Page.has_view_permission.
pages contains all published pages
check if there is ANY restriction
that needs a permission page visibility calculation | 625941c407f4c71912b11464 |
def sample_user(email='[email protected]', password='testpass123'): <NEW_LINE> <INDENT> return get_user_model().objects.create_user(email, password) | Create a sample user | 625941c426068e7796caecbf |
def test_parse_machine_bad(self): <NEW_LINE> <INDENT> baddata = (('host:port', ValueError), ('host:22:33', ValueError), (':22', ValueError), ('user@', ValueError), ('user@:22', ValueError), (':pass@host', ValueError), (':pass@host#fedora16', ValueError), ) <NEW_LINE> for machine, exception in baddata: <NEW_LINE> <INDEN... | test that bad data passed to parse_machine() will raise an exception | 625941c4e76e3b2f99f3a7f0 |
def get_withparams_from_copyparams(self, **copyparams): <NEW_LINE> <INDENT> array_begin, array_end = copyparams.get('array_begin'), copyparams.get('array_end') <NEW_LINE> if array_begin and array_end: <NEW_LINE> <INDENT> array_marker = array_begin + array_end <NEW_LINE> copyparams['array_marker'] = array_marker <NEW_LI... | Convert params passed by the user as with params ( https://www.omnisci.com/docs/latest/6_loading_data.html#csv )
:copyparams kwargs
:return dict | 625941c4bde94217f3682dd5 |
def ply_parser(fp): <NEW_LINE> <INDENT> tf = open(fp) <NEW_LINE> lines = tf.readlines() <NEW_LINE> flag = 0 <NEW_LINE> for l in lines: <NEW_LINE> <INDENT> if re.search("\s*element\s*vertex\s*\d*", l) is not None: <NEW_LINE> <INDENT> vertex_num = int(re.findall("\d+\.?\d*", l)[0]) <NEW_LINE> <DEDENT> if re.search("\s*el... | :param fp: PLY file path
:return: Surface coordinates and surface index | 625941c4d53ae8145f87a255 |
@templatedoc() <NEW_LINE> def sequence_concat(input, name=None): <NEW_LINE> <INDENT> assert not in_dygraph_mode(), ( "sequence layer is not supported in dygraph mode yet.") <NEW_LINE> helper = LayerHelper('sequence_concat', **locals()) <NEW_LINE> check_type(input, 'input', list, 'fluid.layers.sequence_concat') <NEW_LIN... | :api_attr: Static Graph
**Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use concat Op.(fluid.layers.** :ref:`api_fluid_layers_concat` ).
This operator only supports LoDTensor as input. It concatenates the multiple LoDTensor from input by the LoD information,
and outputs the conca... | 625941c4d486a94d0b98e128 |
def trip_duration_stats(df): <NEW_LINE> <INDENT> print('\nCalculating Trip Duration...\n') <NEW_LINE> start_time = time.time() <NEW_LINE> total_travel = df['Trip Duration'].sum() <NEW_LINE> print('\nTotal travel time was:', total_travel) <NEW_LINE> avg_travel = df['Trip Duration'].mean() <NEW_LINE> print('\nTotal trave... | Displays statistics on the total and average trip duration.
Args:
relevant dataframe
Returns:
statistics about trip duration (total and anverage) | 625941c43c8af77a43ae3781 |
@verbose <NEW_LINE> def find_blinks(raw, event_id=998, thresh=100e-6, l_freq=0.5, h_freq=10, filter_length='10s', ch_name=['A1', ], tstart=0., l_trans_bandwidth=0.15): <NEW_LINE> <INDENT> sampling_rate = raw.info['sfreq'] <NEW_LINE> first_samp = raw.first_samp <NEW_LINE> ch_eog = pick_channels(raw.ch_names, include=ch_... | Utility function to detect blink events from specified channel.
Parameters
----------
raw : instance of Raw
The raw data.
event_id : int
The index to assign to found events.
low_pass : float
Low pass frequency.
high_pass : float
High pass frequency.
filter_length : str | int | None
Number of taps t... | 625941c40a50d4780f666e73 |
def qubit_pairs_to_qubit_order( qubit_pairs: Sequence[Sequence[ops.Qid]] ) -> List[ops.Qid]: <NEW_LINE> <INDENT> if set(len(qubit_pair) for qubit_pair in qubit_pairs) != set((2,)): <NEW_LINE> <INDENT> raise ValueError( 'set(len(qubit_pair) for qubit_pair in qubit_pairs) != ' 'set((2,))') <NEW_LINE> <DEDENT> n_pairs = l... | Takes a sequence of qubit pairs and returns a sequence in which every
pair is at distance two.
Specifically, given pairs (1a, 1b), (2a, 2b), etc. returns
(1a, 2a, 1b, 2b, 3a, 4a, 3b, 4b, ...). | 625941c4be8e80087fb20c28 |
def upsample(self, new_domain_forward, new_domain_backward): <NEW_LINE> <INDENT> if self.dim == 2: <NEW_LINE> <INDENT> if self.forward != None: <NEW_LINE> <INDENT> self.forward = 2*np.array( tf.upsample_displacement_field( self.forward, np.array(new_domain_forward).astype(np.int32))) <NEW_LINE> <DEDENT> if self.backwar... | Upsamples the displacement fields and scales the affine
pre- and post-multiplication affine matrices by a factor of 2. The
final outcome is that this transformation can be used in an upsampled
domain. | 625941c4bf627c535bc131b1 |
def as_type(self, ch_type='grad', mode='fast'): <NEW_LINE> <INDENT> from .forward import _as_meg_type_evoked <NEW_LINE> return _as_meg_type_evoked(self, ch_type=ch_type, mode=mode) | Compute virtual evoked using interpolated fields in mag/grad channels.
.. Warning:: Using virtual evoked to compute inverse can yield
unexpected results. The virtual channels have `'_virtual'` appended
at the end of the names to emphasize that the data contained in
them are interpolated.
Parameters
------... | 625941c48da39b475bd64f54 |
def __mul__(self, count): <NEW_LINE> <INDENT> return LazyConcatenation([self] * count) | Return a list concatenating self with itself C{count} times. | 625941c4460517430c39416c |
def __init__(self, features_in: int, last: bool=False): <NEW_LINE> <INDENT> super(DecodingLayer, self).__init__() <NEW_LINE> self.basic = BasicBlock(features_in, features_in) <NEW_LINE> self.deconv = None <NEW_LINE> self.conv_fc = None <NEW_LINE> if last: <NEW_LINE> <INDENT> self.conv_fc = nn.Conv3d(features_in, 1, ker... | Initialisation.
Args:
features_in: Number of input feature channels.
last: Whether this is the last decoding layer. | 625941c415baa723493c3f57 |
def replace(self, item: str, count: Optional[int] = None) -> str: <NEW_LINE> <INDENT> return self._run('replace', item, count) | Replaces an item. | 625941c4462c4b4f79d1d6b3 |
def get_connection(self, service_name): <NEW_LINE> <INDENT> service = self.services.get(service_name, {}) <NEW_LINE> connection_class = service.get('connection', None) <NEW_LINE> if not connection_class: <NEW_LINE> <INDENT> msg = "Connection for '{0}' is not present in the cache." <NEW_LINE> raise NotCached(msg.format(... | Retrieves a connection class from the cache, if available.
:param service_name: The service a given ``Connection`` talks to. Ex.
``sqs``, ``sns``, ``dynamodb``, etc.
:type service_name: string
:returns: A <kotocore.connection.Connection> subclass | 625941c423e79379d52ee548 |
def reset_config_default(self, section=None): <NEW_LINE> <INDENT> logger.debug("Resetting to default: %s", section) <NEW_LINE> sections = [section] if section is not None else [key for key in self.tk_vars.keys()] <NEW_LINE> for config_section in sections: <NEW_LINE> <INDENT> for item, options in self.config.defaults[co... | Reset config to default values | 625941c46aa9bd52df036d86 |
def decode_image(key, raw_bytes): <NEW_LINE> <INDENT> img_batch_dims = tf.shape(raw_bytes) <NEW_LINE> if len(tensor_spec_dict[key].shape) < 3: <NEW_LINE> <INDENT> raise ValueError( 'Shape of tensor spec for image feature "%s" must ' 'be 3 dimensional (h, w, c), but is %s' % (tensor_spec_dict[key].name, tensor_spec_dict... | Decodes single or batches of JPEG- or PNG-encoded string tensors.
Args:
key: String key specified in feature map.
raw_bytes: String tensor to decode as JPEG or PNG.
Returns:
Decoded image tensor with shape specified by tensor spec.
Raises:
ValueError: If dtype other than uint8 or uint16 is supplied for image
... | 625941c41d351010ab855aff |
def toggle_crosshairs(self, event): <NEW_LINE> <INDENT> self.panel.wafer_map.toggle_crosshairs() | Call the WaferMapPanel toggle_crosshairs() method | 625941c482261d6c526ab480 |
def test_init_positive(self): <NEW_LINE> <INDENT> self.Transition({'a':1}, {'z':1}) <NEW_LINE> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> self.Transition({'a':0}, {'z':1}) <NEW_LINE> <DEDENT> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> self.Transition({'a':-1}, {'z':1}) <NEW_LINE> <DEDENT> with... | Reactants and products must be positive | 625941c4498bea3a759b9a92 |
@testing.requires_testing_data <NEW_LINE> def test_annot_io(tmp_path): <NEW_LINE> <INDENT> tempdir = str(tmp_path) <NEW_LINE> subject = 'fsaverage' <NEW_LINE> label_src = os.path.join(subjects_dir, 'fsaverage', 'label') <NEW_LINE> surf_src = os.path.join(subjects_dir, 'fsaverage', 'surf') <NEW_LINE> label_dir = os.path... | Test I/O from and to *.annot files. | 625941c4507cdc57c6306cba |
def subinplace(self, subs, value=None): <NEW_LINE> <INDENT> for constraint in self: <NEW_LINE> <INDENT> constraint.subinplace(subs, value) | Substitutes in place. | 625941c40383005118ecf5c6 |
def get_parallel_strategy_args(**kwargs): <NEW_LINE> <INDENT> dimension_names = [ "sample", "depth", "height", "width", "channel", "filter", ] <NEW_LINE> group_names = ["{}_groups".format(x) for x in dimension_names] <NEW_LINE> assert len(set(kwargs.keys())-set(group_names)) == 0 <NEW_LINE> parallel_strategy = {} <NEW_... | A wrapper function to create parallel_strategy arguments for
Distconv-enabled layers.
Args:
{sample, depth, height, width, channel, filter}_groups (int):
The number of processes for the corresponding dimension. | 625941c4d268445f265b4e51 |
def node_exists(self, node_name): <NEW_LINE> <INDENT> if self._node_inputs is None: <NEW_LINE> <INDENT> raise LookupError( "Nodes have not been loaded from partition graphs yet.") <NEW_LINE> <DEDENT> return node_name in self._node_inputs | Test if a node exists in the partition graphs.
Args:
node_name: Name of the node to be checked, as a str.
Returns:
A boolean indicating whether the node exists.
Raises:
LookupError: If no partition graphs have been loaded yet. | 625941c432920d7e50b281b1 |
def verify_permission_aci_missing(name, dn): <NEW_LINE> <INDENT> return dict( desc="Verify ACI of %s is missing #(%s)" % (name, lineinfo(2)), command=('aci_show', [name], dict( aciprefix=u'permission', location=dn, raw=True)), expected=errors.NotFound( reason='ACI with name "%s" not found' % name), ) | Return test dict that checks the ACI at the given location is missing | 625941c4566aa707497f454e |
def testLoadMLT(self): <NEW_LINE> <INDENT> loadTestMLT = rgStar(mltDir = self.testMLTDir) <NEW_LINE> testSEDs = loadTestMLT.loadmltSEDs() <NEW_LINE> testMLTList = os.listdir(self.testMLTDir) <NEW_LINE> testNames = [] <NEW_LINE> for testSED in testSEDs: <NEW_LINE> <INDENT> testNames.append(testSED.name) <NEW_LINE> <DEDE... | Test SED loading algorithm by making sure SEDs are all accounted for | 625941c4aad79263cf390a22 |
def _map_triggers_to_paths(self): <NEW_LINE> <INDENT> triggers = self.set_from_key_values('Triggers') <NEW_LINE> return {trigger: self.find_path_to_trigger_key(trigger) for trigger in triggers} | Returns a dictionary of triggers as key and their paths as values.
Setting each trigger as a key in one dictionary at the start of the
program increases the processing speed overall. Searching the
INFO.KEY_MAP dictionary (calling self.find_path_to_trigger_key) is
expensive. | 625941c4ec188e330fd5a785 |
def GetFont(self): <NEW_LINE> <INDENT> return wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) | Returns the font used for text.
:return: An instance of :class:`Font`. | 625941c416aa5153ce36245c |
def __init__(self, records='', name=None, alphabet=default_codon_alphabet): <NEW_LINE> <INDENT> MultipleSeqAlignment.__init__(self, records, alphabet=alphabet) <NEW_LINE> for rec in self: <NEW_LINE> <INDENT> if not isinstance(rec.seq, CodonSeq): <NEW_LINE> <INDENT> raise TypeError("CodonSeq objects are expected in each... | Initialize the class. | 625941c47d43ff24873a2c82 |
def tearDown(self): <NEW_LINE> <INDENT> sys.stdout = sys.__stdout__ | Reset redirected output to default | 625941c46e29344779a625f6 |
def getInvariants(self,thetar=0): <NEW_LINE> <INDENT> return Zinvariants(self.z,rotz=thetar) | Calculate the invariants of the impedance tensor according to
Weaver et al. [2003].
Arguments:
----------
**thetar** : float (angle in degrees)
rotation angle clockwise positive
Returns:
--------
**Zinvariants** : data type Zinvariants
:Example: ::
>>> z1 = Z.Z(edifile)
>>>... | 625941c4377c676e9127218c |
def get_stitcher_url(conn, cursor): <NEW_LINE> <INDENT> cursor.execute("SELECT stitcher_url, podcast_id FROM podcasts " "WHERE stitcher_url IS NOT NULL AND " "stitcher_id IS NULL AND " "processed NOT IN ('stitcher', 'in_stitcher', 'stitcher_problem') AND " "podcast_id IS NOT NULL " "LIMIT 1") <NEW_LINE> result = cursor... | Returns a stitcher url to scrape
Parameters
conn, cursor: active psycopg2 connection and cursor objects
Returns
stitcher_url | 625941c4d58c6744b4257c43 |
def setup_bipolar(electrode, ch_names, bads): <NEW_LINE> <INDENT> contacts = [i for i in ch_names if i.startswith(electrode)] <NEW_LINE> anodes = list() <NEW_LINE> cathodes = list() <NEW_LINE> ch_names = list() <NEW_LINE> num_contacts = find_num_contacts(contacts, electrode) <NEW_LINE> if contacts[0][-2] == '0': <NEW_L... | create lists of names for resetting and EEG to a bipolar montage
Parameters
----------
electrode : string
name of electrode
ch_names : list of strings
names of channels
bads : list of strings
names of bad channels
Returns
-------
anodes : list of strings
names of anode electrodes
cathodes : list of st... | 625941c4004d5f362079a317 |
def col(self, j, f=None): <NEW_LINE> <INDENT> if f is None: <NEW_LINE> <INDENT> return self[:, j] <NEW_LINE> <DEDENT> for i in range(0, self.rows): <NEW_LINE> <INDENT> self[i, j] = f(self[i, j], i) | Elementary column selector (default) or operation using functor
which is a function two args interpreted as (self[i, j], i).
>>> from sympy import ones
>>> I = ones(3)
>>> I.col(0, lambda v, i: v*3)
>>> I
[3, 1, 1]
[3, 1, 1]
[3, 1, 1]
>>> I.col(0)
[3]
[3]
[3]
See Also
========
row
col_swap
col_del
col_join
col_inser... | 625941c471ff763f4b54966c |
@xl.register() <NEW_LINE> @xl.validate_args <NEW_LINE> def LOG10( number: func_xltypes.Number ) -> func_xltypes.XlNumber: <NEW_LINE> <INDENT> return np.log10(float(number)) | Returns the base-10 logarithm of a number.
https://support.office.com/en-us/article/
log10-function-c75b881b-49dd-44fb-b6f4-37e3486a0211 | 625941c4d99f1b3c44c67574 |
def get_head_member( self, queue_id, **kwargs ): <NEW_LINE> <INDENT> kwargs['async_req'] = kwargs.get( 'async_req', False ) <NEW_LINE> kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) <NEW_LINE> kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) <NEW_LINE> kwargs['_reques... | Get Head Member # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_head_member(queue_id, async_req=True)
>>> result = thread.get()
Args:
queue_id (str): String that uniquely identifies the Queue that the ... | 625941c4ad47b63b2c509f63 |
def get_refcount(self, node_id): <NEW_LINE> <INDENT> pass | Return the reference count for a node. | 625941c44e696a04525c942f |
def calculate_maf_frequency(feature, groups=None, group_kind=None): <NEW_LINE> <INDENT> alleles = feature.qualifiers['alleles'] <NEW_LINE> read_groups = feature.qualifiers['read_groups'] <NEW_LINE> return _calculate_maf_frequency_for_alleles(alleles, groups=groups, group_kind=group_kind, read_groups=read_groups) | It returns the most frequent allele frequency | 625941c40c0af96317bb81cb |
def optimizeUnit(self): <NEW_LINE> <INDENT> pass; | Turns bytes into KB, MB or GB. | 625941c4adb09d7d5db6c774 |
def FillUserInfo(): <NEW_LINE> <INDENT> with open('demographic_data.csv', 'w') as csvFile: <NEW_LINE> <INDENT> demo_Labels = ['User', 'Gender', 'Age', 'Social Level', 'Salary', 'City'] <NEW_LINE> writer = csv.DictWriter(csvFile, fieldnames=demo_Labels) <NEW_LINE> writer.writeheader() <NEW_LINE> for user in range(0, int... | Generate random info about users to fill a csv file that contains some demographic info
the filename is demographic_data.csv | 625941c45e10d32532c5ef0a |
def pytest_pycollect_makeitem(collector, name, obj): <NEW_LINE> <INDENT> if name == 'TestNotebooks': <NEW_LINE> <INDENT> obj.setUpClass() | this is a hook for pytest to enforce the dynamic generated testcases
of 'TestNotebooks' are initialized. | 625941c43eb6a72ae02ec4bc |
def simplify(self, *, get_minterm=None) -> 'Tree': <NEW_LINE> <INDENT> evaluations = self.evaluate() <NEW_LINE> true_at_minterms = [ decimal for decimal in range(len(evaluations)) if evaluations[decimal]["truth_value"] ] <NEW_LINE> true_at_maxterms = [ decimal for decimal in range(len(evaluations)) if not evaluations[d... | Simplifies the boolean expression at the root
and returns the most simplified expression obtained from either minterm or maxterm
evaluation
:param get_minterm: Whether or not to get the Minterm or Maxterm of this Tree
By default, this will return the shortest one between the two.
:returns: The simplifed boolean ex... | 625941c4d7e4931a7ee9df00 |
def remove_signal_from_sweeper(self, demodulator, attribute): <NEW_LINE> <INDENT> signalstring = ('/' + self.device + '/demods/{}/sample/{}'.format(demodulator-1, attribute)) <NEW_LINE> if signalstring not in self._sweeper_signals: <NEW_LINE> <INDENT> log.warning('Can not remove signal with {} of'.format(attribute) + '... | Remove a signal from the output of the sweeper. If the signal
has not previously been added, a warning is logged.
Args:
demodulator (int): A number from 1-8 choosing the demodulator.
The same demodulator can be chosen several times for
different attributes, e.g. demod1 X, demod1 phase
attribute (st... | 625941c4bf627c535bc131b2 |
def get_order_ext_info(self, mb_order_id: int, info_type='related'): <NEW_LINE> <INDENT> api = API_MAP['related_order'] <NEW_LINE> data = { 'orderId': mb_order_id, 'type': 1, 'tableBase': 2, } <NEW_LINE> ret_data = self.request('post', api, data=data) <NEW_LINE> order_html = ret_data['order_html'] <NEW_LINE> tree = htm... | 获取相关订单
:param mb_order_id: 马帮的订单id
:param info_type: 信息类型
:return: 订单信息字典列表 | 625941c4d4950a0f3b08c334 |
def _create_languages(self, subject): <NEW_LINE> <INDENT> ret = set() <NEW_LINE> for s, p, o in self.graph.triples((subject, DCTERMS.language, None)): <NEW_LINE> <INDENT> ret.add(self.to_text(self._scrub_language(o))) <NEW_LINE> <DEDENT> for s, p, o in self.graph.triples((subject, DC.language, None)): <NEW_LINE> <INDEN... | Create the languages for this subject.
:param subject: Subject to get the sources for.
:returns: A :class:`list` of IANA language tags. | 625941c41f037a2d8b9461e2 |
def get_key( self, obj: Any, format: PyFormat ) -> Union[type, Tuple[type, ...]]: <NEW_LINE> <INDENT> return self.cls | Implementation of the `~psycopg.abc.Dumper.get_key()` member of the
`~psycopg.abc.Dumper` protocol. Look at its definition for details.
This implementation returns the *cls* passed in the constructor.
Subclasses needing to specialise the PostgreSQL type according to the
*value* of the object dumped (not only according... | 625941c4796e427e537b05a8 |
def D(n): <NEW_LINE> <INDENT> if type(n) != int: <NEW_LINE> <INDENT> print('Incorrect type') <NEW_LINE> sys.exit() <NEW_LINE> <DEDENT> if n <=2 : <NEW_LINE> <INDENT> print('n is less than 2') <NEW_LINE> <DEDENT> p = int(n*(n+1)/2) <NEW_LINE> nsquare = n**2 <NEW_LINE> Dt = np.zeros((p,nsquare)) <NEW_LINE> k, I = u_vecto... | Arguments:
n: integer >=2
Returns:
Numpy array of dimensions n**2 x n(n+1)/2 | 625941c4a17c0f6771cbe035 |
def get_all(self): <NEW_LINE> <INDENT> return self.__movies | Gets the dictionary of movies
Output: self.__movies - the dictionary of movies | 625941c43617ad0b5ed67edc |
def runEditorCode(self, text): <NEW_LINE> <INDENT> raise NotImplementedError | Run code on terminal. | 625941c4dd821e528d63b18e |
def get_all_photos_for_account(self, id): <NEW_LINE> <INDENT> raw_datas, next = self.connector.user_recent_media(id) <NEW_LINE> if (next == None): <NEW_LINE> <INDENT> next = defJsonRes <NEW_LINE> <DEDENT> names = ['id', 'object_type', 'service', 'resource_uri', 'from_id', 'from_object_type', 'from_resource_uri', 'from_... | GET API_PATH/[ACCOUNT_ID]/photos | 625941c4956e5f7376d70e52 |
def getHeight(self): <NEW_LINE> <INDENT> return _CsoundAC.Event_getHeight(self) | getHeight(Event self) -> double | 625941c4e8904600ed9f1f0f |
def max_positions(self): <NEW_LINE> <INDENT> if len(self.datasets.values()) == 0: <NEW_LINE> <INDENT> return {'%s-%s' % (self.args.source_lang, self.args.target_lang): (self.args.max_source_positions, self.args.max_target_positions)} <NEW_LINE> <DEDENT> return OrderedDict([ (key, (self.args.max_source_positions, self.a... | Return the max sentence length allowed by the task. | 625941c4167d2b6e31218b7a |
def ApplManagedData_uninstallXsdIDL(self, sessionHandle, app_name, version, config_domain): <NEW_LINE> <INDENT> self._oprot.rlock.acquire() <NEW_LINE> try: <NEW_LINE> <INDENT> self.send_ApplManagedData_uninstallXsdIDL(sessionHandle, app_name, version, config_domain) <NEW_LINE> result = self.recv_ApplManagedData_uninsta... | API to uninstall extensions to the network element's CLI parse tree
Parameters:
- sessionHandle
- app_name
- version
- config_domain | 625941c4ac7a0e7691ed40b3 |
def test_parse_capsule_user_agent(self): <NEW_LINE> <INDENT> parser = eventlogging.LogParser( '%q %{recvFrom}s %{seqId}d %D %o %u') <NEW_LINE> raw = ('?%7B%22wiki%22%3A%22testwiki%22%2C%22schema%22%3A%22Generic' '%22%2C%22revision%22%3A13%2C%22event%22%3A%7B%22articleId%2' '2%3A1%2C%22articleTitle%22%3A%22H%C3%A9ctor%2... | Parser test: client-side events with userAgent in submitted capsule.
If a capsule has a field that is also parsed from the raw event line,
the capsule's field should be preferred. | 625941c4507cdc57c6306cbb |
def multiHead(msg: str, permuteasdict=True, singlestr=False, lent=2): <NEW_LINE> <INDENT> log = logging.getLogger('multiHead') <NEW_LINE> if not msg: <NEW_LINE> <INDENT> log.error('Nothing available for parsing') <NEW_LINE> return <NEW_LINE> <DEDENT> if singlestr: <NEW_LINE> <INDENT> s = msg*lent <NEW_LINE> return s <N... | Multiplies a string n times to enlargen field
msg: can be either str or dict | 625941c4851cf427c661a4f4 |
def config_train_ops(self): <NEW_LINE> <INDENT> assert (self.opts['train_mode'] in ['train', 'fine-tune']) <NEW_LINE> if self.opts['verbose']: <NEW_LINE> <INDENT> print("Configuring training ops...") <NEW_LINE> <DEDENT> self.setup_loss_ops() <NEW_LINE> self.setup_metrics_ops() <NEW_LINE> self.setup_lr_sched() <NEW_LINE... | Configure training ops.
Called by the base class when building the TF graph to setup all the training ops, including:
- setting up loss computations,
- setting up metrics computations,
- creating a learning rate training schedule,
- selecting an optimizer,
- creating lists of output tensors. | 625941c4bd1bec0571d90613 |
def scale_noise(self, scale): <NEW_LINE> <INDENT> for a in self.agents: <NEW_LINE> <INDENT> a.scale_noise(scale) | Scale noise for each agent
Inputs:
scale (float): scale of noise | 625941c421a7993f00bc7cd1 |
def ui_load_backup(): <NEW_LINE> <INDENT> file = filedialog.askopenfilename( title='Load Backup', filetypes=[('Backup zip', '.zip')], ) <NEW_LINE> if not file: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> BACKUPS['backup_path'] = file <NEW_LINE> with open(file, 'rb') as f: <NEW_LINE> <INDENT> data = f.read() <NEW_LIN... | Prompt and load in a backup file. | 625941c40a366e3fb873e7fd |
def test_pagination_function(self): <NEW_LINE> <INDENT> assert create_pagination(1, 10, 100) == {'page': 1, 'total_pages': 10, 'total_results': 100, 'limit': 10, 'offset': 0} | Test creation of pagination. | 625941c4377c676e9127218d |
def test_shutdown_no_inputs(self): <NEW_LINE> <INDENT> self.render_config_template( inputs=False, ) <NEW_LINE> filebeat = self.start_beat() <NEW_LINE> self.wait_until( lambda: self.log_contains( "no modules or inputs enabled"), max_timeout=10) <NEW_LINE> filebeat.check_wait(exit_code=1) | In case no inputs are defined, filebeat must shut down and report an error | 625941c43617ad0b5ed67edd |
def discard(self, card): <NEW_LINE> <INDENT> if card not in self.hand: <NEW_LINE> <INDENT> raise HandError(card) <NEW_LINE> <DEDENT> self.hand.pop(self.hand.index(card)) <NEW_LINE> self.discard.append(card) | Discards the given card from the hand.
Raises an exception if the card is not in hand. | 625941c410dbd63aa1bd2b88 |
def test_vertical_extents(self): <NEW_LINE> <INDENT> result = self.acdd.check_vertical_extents(self.ds) <NEW_LINE> self.assert_result_is_good(result) | Test vertical extents are being checked | 625941c44e4d5625662d43be |
def get_ebv(self, dustmaps_cls=None): <NEW_LINE> <INDENT> if dustmaps_cls is None: <NEW_LINE> <INDENT> from dustmaps.sfd import SFDQuery <NEW_LINE> dustmaps_cls = SFDQuery <NEW_LINE> <DEDENT> c = self.get_skycoord(distance=False) <NEW_LINE> return dustmaps_cls().query(c) | Compute the E(B-V) reddening at this location
This requires the `dustmaps <http://dustmaps.readthedocs.io>`_ package
to run!
Parameters
----------
dustmaps_cls : ``dustmaps`` query class
By default, ``SFDQuery``. | 625941c4b830903b967e98f0 |
@grok.subscribe(IQuestion, IActionSucceededEvent) <NEW_LINE> def notification_qe(context, event): <NEW_LINE> <INDENT> _temp = PageTemplateFile('question_answered_lr_msg.pt') <NEW_LINE> if event.action in ['phase1-answer-to-lr']: <NEW_LINE> <INDENT> observation = aq_parent(context) <NEW_LINE> subject = u'New answer from... | To: QualityExpert
When: New answer from country | 625941c48e7ae83300e4afb0 |
def make_call(list1,cnt): <NEW_LINE> <INDENT> if len(list1)==3: <NEW_LINE> <INDENT> call([list1[0],list1[1],list1[2]]) | if len(list1)==1:
ll=list1[0]
ln=ll+":"
fp1=open("make","r")
line1=fp1.readline()
while(line1!=""):
list1=line1.split()
if list1!=[] and list1[0]==ln:
cnt=0
while(len(line1)!=1 and line1!=""):
list1=line1.split()
if cnt>0:
... | 625941c48c0ade5d55d3e99d |
def test_delete_user_credentials_google(self): <NEW_LINE> <INDENT> pass | Test case for delete_user_credentials_google
Delete Google Auth Credential | 625941c476e4537e8c351655 |
def setPlaybackMode(*args, **kwargs): <NEW_LINE> <INDENT> pass | setPlaybackMode(int) -> None
Set the current playback mode. | 625941c4a934411ee3751677 |
def test_game_log_view_invalid_parameters(self): <NEW_LINE> <INDENT> url = reverse('log_game') <NEW_LINE> response = self.client.post( url, { 'row': '0', 'column': '0', 'player': 'X', }, ) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> response_data = json.loads(response.content) <NEW_LINE> self.asse... | A test to test if GameLogView API endpoint returns correct data
if POST parameters are missing | 625941c44a966d76dd550ff2 |
def setvalue(self, value): <NEW_LINE> <INDENT> if self._constant: <NEW_LINE> <INDENT> raise TypeError("This Quantity is constant.") <NEW_LINE> <DEDENT> self.setfield(value, self.dtype) | sets this array to the new value, but keeps its info and owner | 625941c444b2445a3393207b |
def detect_clean_validation_report(ds): <NEW_LINE> <INDENT> rpt_path = ds.full_path / 'validation_report.txt' <NEW_LINE> if not rpt_path.is_file(): <NEW_LINE> <INDENT> rpt_path = ds.full_path / 'extras' / 'validation_report.txt' <NEW_LINE> <DEDENT> if rpt_path.is_file(): <NEW_LINE> <INDENT> return rpt_path.read_text().... | Returns True if there is a validation_report.txt file in the top level
or extras directory and that file starts with the string 'No errors!',
or False otherwise. | 625941c4ec188e330fd5a786 |
def toposort(G): <NEW_LINE> <INDENT> cycles = [] <NEW_LINE> res = [] <NEW_LINE> time = 0 <NEW_LINE> color = {} <NEW_LINE> pred = {} <NEW_LINE> discovered = {} <NEW_LINE> finished = {} <NEW_LINE> for u in G.keys(): <NEW_LINE> <INDENT> color[u] = "White" <NEW_LINE> pred[u] = None <NEW_LINE> discovered[u] = None <NEW_LINE... | Topologically sort a DAG. | 625941c456b00c62f0f1463d |
def binary_search(a, key): <NEW_LINE> <INDENT> lo, high = 0, len(a) - 1 <NEW_LINE> while lo <= high: <NEW_LINE> <INDENT> mid = lo + (high - lo) // 2 <NEW_LINE> if a[mid] == key: <NEW_LINE> <INDENT> return mid <NEW_LINE> <DEDENT> elif a[mid] > key: <NEW_LINE> <INDENT> high = mid - 1 <NEW_LINE> <DEDENT> elif a[mid] < key... | Iterative binary search implmentation | 625941c4097d151d1a222e3f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.