code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _populate_property_dictionaries(self): <NEW_LINE> <INDENT> section_name = xml_constants.SECTION_NAMES[HedSectionKey.Properties] <NEW_LINE> properties_section = self._get_elements_by_name(section_name) <NEW_LINE> if properties_section: <NEW_LINE> <INDENT> properties_section = properties_section[0] <NEW_LINE> def_ele...
Populates a dictionary of dictionaries associated with properties Parameters ---------- Returns -------
625941f6c4546d3d9de73085
@command.register <NEW_LINE> def users(bot, event, *args): <NEW_LINE> <INDENT> segments = [hangups.ChatMessageSegment('Seznam uživatelů (celkem {}):'.format(len(event.conv.users)), is_bold=True), hangups.ChatMessageSegment('\n', hangups.SegmentType.LINE_BREAK)] <NEW_LINE> for u in sorted(event.conv.users, key=lambda x:...
Výpis všech uživatelů v aktuálním Hangoutu (včetně G+ účtů a emailů)
625941f663b5f9789fde7731
def clone(self): <NEW_LINE> <INDENT> raise NotImplementedError
Returns a (deep) copy of this object.
625941f6596a89723608a102
def get_car_input(board_size): <NEW_LINE> <INDENT> def get_color_input(): <NEW_LINE> <INDENT> available_colors = ''.join(str(col) for col in (','.join(str(col) for col in VALID_COLORS))) <NEW_LINE> color_input = input(MESSAGE_GET_COLOR_INPUT + available_colors) <NEW_LINE> while not color_input in VALID_COLORS: <NEW_LIN...
The function asks the user for input for initializing a car. The function asks for the following parameters: 1. color of car - string 2. length of car - int in range of (2,4) 3. location of car a - tuple of (x, y)) representing the requested coordinate. 4. orientation of car - int in range of (0,1) and returns a touple...
625941f666656f66f7cbc7f7
def __init__(self, mdate, today=None): <NEW_LINE> <INDENT> self._date = mdate <NEW_LINE> if not today: <NEW_LINE> <INDENT> self._today = date.today() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._today = today <NEW_LINE> <DEDENT> self._year = self._date.isocalendar()[0] <NEW_LINE> self.year_start = self.iso_year_...
Initialize a date in regular calendar with the given datetime.date object. :param mdate: the given datetime.date object. :param today: default is the current date (today), if not specified. :return:
625941f6ff9c53063f47c83a
def __getitem__(self, index): <NEW_LINE> <INDENT> img_name = self.data.iloc[index, 0] <NEW_LINE> img_name = os.path.join(self.root_dir, img_name) <NEW_LINE> img = Image.open(img_name) <NEW_LINE> label = self.data.iloc[index, 1].astype(np.float32) <NEW_LINE> if label == 1: <NEW_LINE> <INDENT> mask = np.ones((1, self.map...
Get image, output map and label for a given index Args: index (int): index of image Returns: img (PIL Image): mask: output map (14x14) label: 1 (genuine), 0 (fake)
625941f6cdde0d52a9e53684
def lemmatizationButtonClickEvent(self): <NEW_LINE> <INDENT> verb = self.verbContent.toPlainText() <NEW_LINE> if verb is "" : <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> verbs = searchVerb(verb) <NEW_LINE> if verbs is not None and isinstance(verbs,set) and verbs : <NEW_LINE> <INDENT> verbs = list(verbs) <NEW_LINE> s...
词形还原按钮点击事件
625941f6ab23a570cc2507d3
def create_tmp_collection(): <NEW_LINE> <INDENT> hash_code = random.getrandbits(32) <NEW_LINE> collection_name = '%x' % hash_code <NEW_LINE> while collection_name in [coll.name for coll in bpy.data.collections]: <NEW_LINE> <INDENT> hash_code = random.getrandbits(32) <NEW_LINE> collection_name = '%x' % hash_code <NEW_LI...
Create a tmp collection and link it to the actual scene
625941f666656f66f7cbc7f8
def run_batch(harn, batch): <NEW_LINE> <INDENT> inputs, labels = ub.take(batch, ['input', 'label']) <NEW_LINE> inputs.shape <NEW_LINE> outputs = harn.model(inputs) <NEW_LINE> loss = harn.criterion(outputs, labels) <NEW_LINE> return outputs, loss
Custom function to compute the output of a batch and its loss. The primary purpose of `FitHarn` is to abstract away the boilerplate code necessary to run these lines of code. After the `FitHarn` prepares the batch it tries to run it. In most cases it is best to explicitly override this function to describe (in code) ...
625941f60c0af96317bb8831
@run_once <NEW_LINE> def configure_null_logger(): <NEW_LINE> <INDENT> nullhandler = logging.NullHandler() <NEW_LINE> NULL_LOGGER.addHandler(nullhandler)
Configure null logger if it is not configured.
625941f65fcc89381b1e1d0f
def post_updates(updates: List[Update]): <NEW_LINE> <INDENT> xda = XDAPoster(XDA_KEY) <NEW_LINE> for update in updates: <NEW_LINE> <INDENT> message = Message(update) <NEW_LINE> telegram_message, reply_markup = message.generate_telegram_message() <NEW_LINE> UPDATER.bot.send_message(chat_id=TG_CHAT, text=telegram_message...
Post updates to telegram and xda
625941f6dd821e528d63b7ee
def dataset_to_stream(dataset, input_name, n_chunks=0, append_targets=False): <NEW_LINE> <INDENT> for example in backend.dataset_as_numpy(dataset): <NEW_LINE> <INDENT> inp, out = example[0][input_name], example[1] <NEW_LINE> with tf.device("cpu:0"): <NEW_LINE> <INDENT> if isinstance(inp, np.uint8): <NEW_LINE> <INDENT> ...
Takes a tf.Dataset and creates a numpy stream of ready batches.
625941f6925a0f43d254a4c8
def __str__(self): <NEW_LINE> <INDENT> s0 = str(self.fanins[0]) <NEW_LINE> s1 = str(self.fanins[1]) <NEW_LINE> return '(%s ^ %s)' % (s0, s1)
Return a string representation of this node.
625941f6adb09d7d5db6cdd6
def validate_authentication(self, user): <NEW_LINE> <INDENT> if not self.validate_access_token(user): <NEW_LINE> <INDENT> self.refresh_access_token(user)
Check if user has a valid access token and if not refresh it.
625941f6be8e80087fb21281
def getCharSequenceArrayList(self, key): <NEW_LINE> <INDENT> pass
Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key. :param key: String: a String, or null :return: ArrayList<CharSequence>. an ArrayList value, or null
625941f6ec188e330fd5addc
def __init__(self): <NEW_LINE> <INDENT> self.pytrend = TrendReq() <NEW_LINE> kwd = 'Voting' <NEW_LINE> df_count_by_geo = self.interest_by_region([kwd]) <NEW_LINE> sys.stdout.write(f"\nFirst 10 cities count for '{kwd}':\n") <NEW_LINE> print(df_count_by_geo.head(10)) <NEW_LINE> _ax = self.plot_term_freq(f'{kwd}', df_coun...
Put this module through its paces: call each method to illustrate its use.
625941f6fbf16365ca6f681d
def _handleSignals(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import signal <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> log.msg("Warning: signal module unavailable -- " "not installing signal handlers.") <NEW_LINE> return <NEW_LINE> <DEDENT> if signal.getsignal(signal.SIGINT) == signal.default_...
Install the signal handlers for the Twisted event loop.
625941f623e79379d52eeba6
def test_code_to_category_storage(self): <NEW_LINE> <INDENT> c2c = code_to_category <NEW_LINE> for code in range(0xA700, 0xA800): <NEW_LINE> <INDENT> assert c2c(code) == "Failure" <NEW_LINE> <DEDENT> for code in range(0xA900, 0xAA00): <NEW_LINE> <INDENT> assert c2c(code) == "Failure" <NEW_LINE> <DEDENT> for code in ran...
Test converting storage service class status code to its category
625941f67c178a314d6efab6
def duration_format(value): <NEW_LINE> <INDENT> from msrest.serialization import Deserializer <NEW_LINE> from msrest.exceptions import DeserializationError <NEW_LINE> try: <NEW_LINE> <INDENT> duration_obj = Deserializer.deserialize_duration(value) <NEW_LINE> <DEDENT> except DeserializationError: <NEW_LINE> <INDENT> mes...
Validate the correct format of a timespan string and deserilize.
625941f6e64d504609d74e8a
def test_ofp_version(self): <NEW_LINE> <INDENT> self.assertEqual(self.switch.ofp_version, '0x04')
Test ofp_version property.
625941f6a219f33f34628fab
def onchange_date(self, cr, uid, ids, date, currency_id, company_id, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> res = {'value': {}} <NEW_LINE> period_pool = self.pool.get('account.period') <NEW_LINE> currency_obj = self.pool.get('res.currency') <NEW_LINE>...
@param date: latest value from user input for field date @param args: other arguments @param context: context arguments, like lang, time zone @return: Returns a dict which contains new values, and context
625941f63617ad0b5ed68541
def config(self, config_data): <NEW_LINE> <INDENT> if 'preamble' in config_data: <NEW_LINE> <INDENT> preamble = config_data['preamble'] <NEW_LINE> if isinstance(preamble, str): <NEW_LINE> <INDENT> self._config['preamble'] = preamble <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._config['preamble'] = preamble['code...
Configure the generator.
625941f67b180e01f3dc4e3a
def translate(self, v): <NEW_LINE> <INDENT> self.center += np.asarray(v) <NEW_LINE> if self.polygon: <NEW_LINE> <INDENT> self.polygon = affine.translate(self.polygon, xoff=v[0], yoff=v[1])
Translates the object.
625941f65e10d32532c5f56f
@pytest.mark.parametrize( "db_value,scalar", [ (0.0, 1.0), (-10.0, 0.1), (10.0, 10.0), (30.0, 1e3), (60.0, 1e6), ], ) <NEW_LINE> def test_db_conversion(module_registry, db_value, scalar): <NEW_LINE> <INDENT> Q_ = module_registry.Quantity <NEW_LINE> assert Q_(db_value, "dB").to("dimensionless").magnitude == pytest.appro...
Test that a dB value can be converted to a scalar and back.
625941f650485f2cf553d3e7
def GetSampleSEData(sample, SE_signal): <NEW_LINE> <INDENT> SE_dict = {} <NEW_LINE> with open(SE_signal) as f: <NEW_LINE> <INDENT> header = f.readline().strip() <NEW_LINE> sample_idx = GetSampleIdx(header, sample) <NEW_LINE> for line in f: <NEW_LINE> <INDENT> line = line.strip().split("\t") <NEW_LINE> chrom, start, sto...
Get the data for each SE for that sample. Args: sample = Sample from the input file name. SE_signal = Name of file containing the signal data for each SE in every sample. Returns: SE_dict = Dict containing signal of every SE position for the sample {(chr,(start, stop)): (se_id, signal)}
625941f673bcbd0ca4b2c6c0
def GetLocalAnchorA(self): <NEW_LINE> <INDENT> return _Box2D.b2WheelJoint_GetLocalAnchorA(self)
GetLocalAnchorA(b2WheelJoint self) -> b2Vec2
625941f64f88993c3716c6ab
def __neg__(self): <NEW_LINE> <INDENT> print('Negativo') <NEW_LINE> return -self.valor
Função negativa o valor da instância
625941f6167d2b6e312191df
def isSubsequenceDP(self, s: str, t: str) -> bool: <NEW_LINE> <INDENT> if len(s) == 0: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if len(t) == 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> n = len(s) <NEW_LINE> m = len(t) <NEW_LINE> dp = [[0 for i in range(m)] for _ in range(n)] <NEW_LINE> dp[0][0] =...
A Dynamic Programming approach
625941f6b545ff76a8914460
def sgolay1d(h, window=3, order=1, deriv=0, dt=1.0, mode="nearest", time=None): <NEW_LINE> <INDENT> if isinstance(h, (pd.Series, xr.DataArray)): <NEW_LINE> <INDENT> h = h.values <NEW_LINE> <DEDENT> if isinstance(time, (pd.Series, xr.DataArray)): <NEW_LINE> <INDENT> time = time.values <NEW_LINE> <DEDENT> _h = h.copy() <...
Savitztky-Golay filter with support for NaNs. If time is given, interpolate NaNs otherwise pad w/zeros. If time is given, calculate dt as t[1]-t[0]. Args: dt (int): spacing between samples (for correct units). Notes: Works with numpy, pandas and xarray objects.
625941f65fcc89381b1e1d10
def same(set1, set2): <NEW_LINE> <INDENT> return len(set1) == len(set2) and len([x for x in set1 if not x in set2]) == 0
两个组合内的内容化为 set 后是否完全相同 :param set1: :param set2: :return:
625941f61b99ca400220b0ff
def transform(self, transformation): <NEW_LINE> <INDENT> self.points = [transformation(*point) for point in self._points]
Transforms the curve in-place by sending all the points to a given callable one by one. The given callable must expect two real numbers and return the transformed point as a tuple.
625941f6956e5f7376d714b6
def plot_graph(weights, display = True, output_file = None, output_format = "pdf"): <NEW_LINE> <INDENT> cues = weights.index <NEW_LINE> outcomes = weights.columns <NEW_LINE> minimum = np.min(weights.values) <NEW_LINE> maximum = np.max(weights.values) <NEW_LINE> normalization = colors.Normalize(vmin = minimum, vmax = ma...
Plot a two dimensional array of weights. Parameters ---------- display: boolean, optional show the plot of the graph output_file: str or path, optional path to file to save graph in, does not save per default output_format: "pdf", "png" or "jpg"
625941f69b70327d1c4e1423
def floats_tensor(shape, scale=1.0, rng=None, name=None): <NEW_LINE> <INDENT> if rng is None: <NEW_LINE> <INDENT> rng = random.Random() <NEW_LINE> <DEDENT> total_dims = 1 <NEW_LINE> for dim in shape: <NEW_LINE> <INDENT> total_dims *= dim <NEW_LINE> <DEDENT> values = [] <NEW_LINE> for _ in range(total_dims): <NEW_LINE> ...
Creates a random float32 tensor of the shape within the vocab size.
625941f63cc13d1c6d3c79c2
def __init__(self, size, sys, goal, seed=None, prevgen=None): <NEW_LINE> <INDENT> if not isinstance(size, int): <NEW_LINE> <INDENT> raise TypeError("Population size expects an int"); <NEW_LINE> <DEDENT> if size > Population.MAX_POPULATION_SIZE: <NEW_LINE> <INDENT> raise TypeError("Population size larger than MAX_POPULA...
@param size (int) Number of individuals in the population. It's expected that this will remain constant. @param sys (System) Defines all of the programs within the system and their possible versions/commits. @param goal (System) The given goal system
625941f62ae34c7f2600d77b
@raises(AttributeError) <NEW_LINE> def test_readonly_attr2(): <NEW_LINE> <INDENT> tree = st.Tree() <NEW_LINE> tree.root_id = 'new_id'
Test tree readonly member variable: root_id
625941f607f4c71912b11ad0
@click.group(name="config", invoke_without_command=True) <NEW_LINE> @click.option( "--scope", help="Save configuration to given scope", type=click.Choice(["system", "user", "project"], case_sensitive=False), default="project", ) <NEW_LINE> @click.option("--profile", help="Save configuration for given profile. " "By def...
Run configuration wizard for flox.
625941f6de87d2750b8603e6
def test_debug(self): <NEW_LINE> <INDENT> logfilter = log.LogFilter(["eggs"]) <NEW_LINE> record = self._make_record("eggs") <NEW_LINE> self.assertTrue(logfilter.filter(record)) <NEW_LINE> record = self._make_record("bacon") <NEW_LINE> self.assertFalse(logfilter.filter(record)) <NEW_LINE> record = self._make_record("egg...
Test if messages more important than debug are never filtered.
625941f64e4d5625662d4a19
def list_followers_for_channel_example(self): <NEW_LINE> <INDENT> self.__resource.create_channel("Test channel") <NEW_LINE> response = self.__resource.list_followers( channel_name="Test channel" ) <NEW_LINE> print(response) <NEW_LINE> return response
Lists all your followers for this particular channel. :return:
625941f6a4f1c619b28b0674
def isString(val): <NEW_LINE> <INDENT> return isinstance(val, compat.string_types)
Return True if `val` is string-like, False otherwise.
625941f660cbc95b062c6b8f
def create_circle_fixture(self, radius=0.2, position=(0,0), **kwargs): <NEW_LINE> <INDENT> shape = shapes.Circle(radius, position) <NEW_LINE> return self.create_fixture(shape, **kwargs)
TODO
625941f6187af65679ca576c
def get_args(): <NEW_LINE> <INDENT> parser = ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter) <NEW_LINE> parser.add_argument('-y', '--yes', action='store_true', help='Automatic yes to prompts; assume "yes" as answer to all prompts') <NEW_LINE> parser.add_argument('-q', '--quiet', action='store_...
parse arguments
625941f61d351010ab856166
def get_client_labels(self, client=None, agent=None): <NEW_LINE> <INDENT> return []
See :func:`burpui.misc.backend.interface.BUIbackend.get_client_labels`
625941f645492302aab5e915
def addstr(self, str): <NEW_LINE> <INDENT> pass
Insert a string at the current cursor location. Handles newline chars.
625941f6a05bb46b383ece66
def update_nearest_waypoint(self): <NEW_LINE> <INDENT> if not self.wp_tree: <NEW_LINE> <INDENT> self.nearest_idx = 0 <NEW_LINE> return <NEW_LINE> <DEDENT> nearest_idx = self.wp_tree.query([self.car_pose_x, self.car_pose_y], 1)[1] <NEW_LINE> nearest_wp = self.waypoints[nearest_idx].pose.pose.position <NEW_LINE> prev_wp ...
Find the index of the currently nearest waypoint.
625941f6ac7a0e7691ed470b
def open(self, include=[], exclude=[], limit=None): <NEW_LINE> <INDENT> self._ensure_walker_allocated() <NEW_LINE> lib.git_revwalk_reset(self._walker) <NEW_LINE> if not include: <NEW_LINE> <INDENT> include = self._repo().branches.values() <NEW_LINE> <DEDENT> for sha in include: <NEW_LINE> <INDENT> lib.git_revwalk_push(...
open the walker for walking Note that this walker can only perform one walk at once. Create multiple Walkers if you need to perform multiple walks simultaneously.
625941f6f7d966606f6aa657
def subdirect_decomposition(self): <NEW_LINE> <INDENT> H = self._hasse_diagram <NEW_LINE> cong_ji, congs = H.principal_congruences_poset() <NEW_LINE> if self.cardinality() <= 2 or cong_ji.has_bottom(): <NEW_LINE> <INDENT> return [self.relabel(self._element_to_vertex_dict)] <NEW_LINE> <DEDENT> L_ = cong_ji.order_ideals_...
Return the subdirect decomposition of the lattice. The subdirect decomposition of a lattice `L` is the list of smaller lattices `L_1, \ldots, L_n` such that `L` is a sublattice of `L_1 \times \ldots \times L_n`, none of `L_i` can be decomposed further and `L` is not a sublattice of any `L_i`. (Except when the list ha...
625941f6cc0a2c11143dd4dd
def __configure(self): <NEW_LINE> <INDENT> e4App().getObject("UserInterface").showPreferences("shellPage")
Private method to open the configuration dialog.
625941f645492302aab5e916
def update_holdings_from_fill(self, fill): <NEW_LINE> <INDENT> fill_dir = 0 <NEW_LINE> if fill.direction == 'BUY': <NEW_LINE> <INDENT> fill_dir = 1 <NEW_LINE> <DEDENT> if fill.direction == 'SELL': <NEW_LINE> <INDENT> fill_dir = -1 <NEW_LINE> <DEDENT> fill_cost = self.bars.get_latest_bar_value( fill.symbol, "adj_close" ...
Takes a Fill object and updates the holdings matrix to reflect the holdings value. Parameters: fill - The Fill object to update the holdings with.
625941f6090684286d50f33c
def __init__(self): <NEW_LINE> <INDENT> super(MMGroup, self).__init__()
TODO: Yet to be documented
625941f6e76e3b2f99f3ae4c
def visit_module(self, node): <NEW_LINE> <INDENT> self._to_consume = [(copy(node.locals), {}, 'module')] <NEW_LINE> self._vars = [] <NEW_LINE> for name, stmts in list(node.locals.items()): <NEW_LINE> <INDENT> if is_builtin(name): <NEW_LINE> <INDENT> self.add_message('W0622', args=name, node=stmts[0])
visit module : update consumption analysis variable checks globals doesn't overrides builtins
625941f6796e427e537b0c17
def parameters(self) -> ParameterIndex: <NEW_LINE> <INDENT> return self._parameters
Get parameter declaration for application runs. Returns ------- flowserv.model.template.parameters.ParameterIndex
625941f607f4c71912b11ad1
def __init__(self, name_project, author, domain): <NEW_LINE> <INDENT> StructProject.__init__(self, name_project, author, domain) <NEW_LINE> if not os.path.exists(self.projectfolder): <NEW_LINE> <INDENT> logger.error("[ \u2717 ] Not exist name of project.") <NEW_LINE> raise Exception("Not exist name of project.") <NEW_L...
Init function.
625941f6090684286d50f33d
def test_detach_with_relations(self): <NEW_LINE> <INDENT> t = Team.objects.create(name='Raining Rats') <NEW_LINE> t_pk = t.pk <NEW_LINE> m = Mascot.objects.create(name="Drippy", team=t) <NEW_LINE> p = Player.objects.create(name="Robby", team=t) <NEW_LINE> p_pk = p.pk <NEW_LINE> a = Award.objects.create(name="Most slipp...
ManyToMany and reverse ForeignKey relationships are not kept. ForeignKey relationships are kept.
625941f65166f23b2e1a57a5
def insert(self, index, item): <NEW_LINE> <INDENT> if not isinstance(index, int): <NEW_LINE> <INDENT> raise TypeError('list indices must be integers') <NEW_LINE> <DEDENT> item = item if isinstance(item, Node) else Node(item) <NEW_LINE> if index < 0: <NEW_LINE> <INDENT> index = len(self) + index <NEW_LINE> <DEDENT> if i...
Insert the given item at the given index.
625941f6d8ef3951e3243b89
def rename_pickled_ontology(filename, newname): <NEW_LINE> <INDENT> pickledfile = os.path.join(ONTOSPY_LOCAL_CACHE, filename + ".pickle") <NEW_LINE> newpickledfile = os.path.join(ONTOSPY_LOCAL_CACHE, newname + ".pickle") <NEW_LINE> if os.path.isfile(pickledfile) and not GLOBAL_DISABLE_CACHE: <NEW_LINE> <INDENT> os.rena...
try to rename a cached ontology
625941f6d7e4931a7ee9e56b
def eval_i(expr): <NEW_LINE> <INDENT> return int(eval(expr))
Evaluate expression an cast result as int
625941f6097d151d1a2234a2
def __get_stickers(self, update: Update, context: CallbackContext) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> message, user, chat = get_message_meta(update) <NEW_LINE> if chat.type != UserModes.PRIVATE: <NEW_LINE> <INDENT> message.reply_text("This command only works in private chats.") <NEW_LINE> raise_wrong...
Sends all the stickers linked with a tag.
625941f64f6381625f115086
def get_asset_associated_computer_info(self, asset_ci_id): <NEW_LINE> <INDENT> fields = ( 'manufacturer', 'model_number', 'operational_status', 'hardware_status', 'ip_address', 'cpu_name', 'cpu_speed', 'cpu_count', 'os', 'os_version', 'disk_space', 'ram', 'sys_created_on', 'mac_address', 'warranty_expiration', 'model_i...
Fetch the general computer-specific information associated with the asset
625941f6b5575c28eb68e652
def refresh_current_source(self) -> None: <NEW_LINE> <INDENT> current_source_raw = self.command("input-selector query") <NEW_LINE> if not current_source_raw: <NEW_LINE> <INDENT> self._current_source = self.last_source <NEW_LINE> _LOGGER.debug( "Updated source=%s for entity_id=%s from last_source", self.source, self.ent...
Get current selected source from the device or the last active source.
625941f6a8ecb033257d3716
def maxValue(self, state, alpha, beta, depth = 1): <NEW_LINE> <INDENT> if self.isTerminal(state, depth): return self.utility(state) <NEW_LINE> v = self.negativeInfinity() <NEW_LINE> for successorAction,successorState in self.successors(state): <NEW_LINE> <INDENT> v = max(v, self.minValue(successorState, alpha, beta, de...
docstring for maxValue alpha = the value of the best alternative for MAX along the path to state beta = the value of the best alternative for MIN along the path to state
625941f67cff6e4e81117fd1
def resnet18(num_classes, dtype='float32', batch_size=None): <NEW_LINE> <INDENT> input_shape = (224, 224, 3) <NEW_LINE> img_input = layers.Input(shape=input_shape, dtype=dtype, batch_size=batch_size) <NEW_LINE> if backend.image_data_format() == 'channels_first': <NEW_LINE> <INDENT> x = layers.Lambda(lambda x: backend.p...
Instantiates the ResNet50 architecture. Args: num_classes: `int` number of classes for image classification. dtype: dtype to use float32 or float16 are most common. batch_size: Size of the batches for each step. Returns: A Keras model instance.
625941f65fdd1c0f98dc0882
def encode(self, filename=None, mp3=None): <NEW_LINE> <INDENT> if not mp3 and filename.lower().endswith('.wav'): <NEW_LINE> <INDENT> mp3 = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> mp3 = True <NEW_LINE> <DEDENT> if mp3: <NEW_LINE> <INDENT> foo, tempfilename = tempfile.mkstemp(".wav") <NEW_LINE> os.close(foo) ...
Outputs an MP3 or WAVE file to `filename`. Format is determined by `mp3` parameter.
625941f6ad47b63b2c50a5cc
def format_date(date, gmt_offset=0, relative=True, shorter=False, full_format=False): <NEW_LINE> <INDENT> if not date: <NEW_LINE> <INDENT> return '-' <NEW_LINE> <DEDENT> if isinstance(date, float) or isinstance(date, int): <NEW_LINE> <INDENT> date = datetime.datetime.utcfromtimestamp(date) <NEW_LINE> <DEDENT> now = dat...
Formats the given date (which should be GMT). By default, we return a relative time (e.g., "2 minutes ago"). You can return an absolute date string with ``relative=False``. You can force a full format date ("July 10, 1980") with ``full_format=True``. This method is primarily intended for dates in the past. For dates...
625941f6377c676e912727f2
def to_string( self, parent: 'Color', *, alpha: Optional[bool] = None, precision: Optional[int] = None, fit: Union[str, bool] = True, none: bool = False, **kwargs: Any ) -> str: <NEW_LINE> <INDENT> if precision is None: <NEW_LINE> <INDENT> precision = parent.PRECISION <NEW_LINE> <DEDENT> options = kwargs <NEW_LINE> if ...
Convert to CSS.
625941f6b57a9660fec33ed9
def fetch_department_list(self, dept_id: str = 'root', has_child: bool = False): <NEW_LINE> <INDENT> assert dept_id != '' <NEW_LINE> data = { "has_child": has_child } <NEW_LINE> method = 'POST' <NEW_LINE> path = f'department/{dept_id}/department_list' <NEW_LINE> response = self._request(method=method, path=path, data=d...
POST /api/v1/department/{ dept_id }/department_list (递归)获取指定部门的子部门列表 能够(递归)获取指定部门id的所有子部门。
625941f6283ffb24f3c55f46
def __init__(self): <NEW_LINE> <INDENT> self.GroupId = None <NEW_LINE> self.RequestId = None
:param GroupId: Connection group ID. :type GroupId: str :param RequestId: The unique request ID, which is returned for each request. RequestId is required for locating a problem. :type RequestId: str
625941f63346ee7daa2b33be
def first_sample(self): <NEW_LINE> <INDENT> player_card1 = self.card() <NEW_LINE> player_card2 = self.card() <NEW_LINE> self.player_sum = player_card1 + player_card2 <NEW_LINE> self.usable_ace = player_card1 == 1 or player_card2 == 1 <NEW_LINE> if self.usable_ace: <NEW_LINE> <INDENT> self.player_sum += 10 <NEW_LINE> <D...
deal first cards and check for naturals
625941f6b7558d58953c5552
def create_index(self, columns, name=None, **kw): <NEW_LINE> <INDENT> columns = [normalize_column_name(c) for c in ensure_tuple(columns)] <NEW_LINE> with self.db.lock: <NEW_LINE> <INDENT> if not self.exists: <NEW_LINE> <INDENT> raise DatasetException("Table has not been created yet.") <NEW_LINE> <DEDENT> for column in ...
Create an index to speed up queries on a table. If no ``name`` is given a random name is created. :: table.create_index(['name', 'country'])
625941f667a9b606de4a8502
def conversation_hide(self, conversation_id, from_message_nr = None): <NEW_LINE> <INDENT> return self._webapi_call('api/conversation/hide', conversation_id, from_message_nr = from_message_nr)
Hide conversation from view
625941f66e29344779a62c5e
def test_scene_has_name(self): <NEW_LINE> <INDENT> scene1 = Scene.objects.get(name='michel_scene') <NEW_LINE> self.assertEqual(scene1.__str__(), 'michel_scene')
Scene has a name
625941f64f88993c3716c6ac
def _get_all_message_buttons(self): <NEW_LINE> <INDENT> timeline = self.driver.find_element_by_id('tm-tl') <NEW_LINE> all_buttons = timeline.find_elements_by_class_name( 'jfk-button-standard' ) <NEW_LINE> return all_buttons
Return all the message buttons on the page.
625941f6f9cc0f698b140c42
def _create_cfstring_array(lst): <NEW_LINE> <INDENT> cf_arr = None <NEW_LINE> try: <NEW_LINE> <INDENT> cf_arr = CoreFoundation.CFArrayCreateMutable( CoreFoundation.kCFAllocatorDefault, 0, ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), ) <NEW_LINE> if not cf_arr: <NEW_LINE> <INDENT> raise MemoryError("Unable to all...
Given a list of Python binary data, create an associated CFMutableArray. The array must be CFReleased by the caller. Raises an ssl.SSLError on failure.
625941f68e7ae83300e4b61b
def main(): <NEW_LINE> <INDENT> ck=0 <NEW_LINE> pygame.init() <NEW_LINE> random.seed(time.clock()) <NEW_LINE> size = [SCREEN_WIDTH, SCREEN_HEIGHT] <NEW_LINE> colors=[WHITE, GREEN, RED, BLUE, YELLOW, ORANGE, VIOLET] <NEW_LINE> screen = pygame.display.set_mode(size) <NEW_LINE> pygame.display.set_caption("Bouncing Balls: ...
This is our main program.
625941f6bde94217f3683437
def gaussian_estimator(galaxy_data,p,h): <NEW_LINE> <INDENT> M = 2**p <NEW_LINE> n = np.size(galaxy_data) <NEW_LINE> length = len(galaxy_data) <NEW_LINE> a = 0 <NEW_LINE> b = length <NEW_LINE> bin_width = (b-a)/M <NEW_LINE> data_discrete, xedges, yedges = np.histogram2d(galaxy_data[0], galaxy_data[1], bins = M) <NEW_LI...
estimates the density function using the FFT method the raw data is finely discretised into 2^p bins the fourier transform of the raw data is taken a gaussian kernel is generated the fourier transform of the gaussian kernel is taken the kernel and the data are convolved by multiplying their fourier transforms an invers...
625941f6cc0a2c11143dd4de
def dynamodb_prewrite_empty_str_in_dict_to_null_transform(d: dict) -> dict: <NEW_LINE> <INDENT> return {k: (v if not (isinstance(v, str) and not v) else None) for k, v in d.items()}
DynamoDB will break if you try to provide an empty string as a String value of a key that is used as an index. It requires you to provide these attributes as None rather than the empty string. It _used_ to break if any attribute in any Map (nested or not) was the empty String. This behavior seems to have changed relat...
625941f6187af65679ca576d
def augment_with_pretrained(dictionary, ext_emb_path, chars): <NEW_LINE> <INDENT> assert os.path.isfile(ext_emb_path) <NEW_LINE> pretrained = set([line.rstrip().split()[0].strip() for line in codecs.open(ext_emb_path, 'r', 'utf-8') if len(ext_emb_path) > 0]) <NEW_LINE> if chars is None: <NEW_LINE> <INDENT> for char in ...
:param dictionary:频率字典 :param ext_emb_path:预训练好的向量 :param sentence:对应的词列表 :return:
625941f67b25080760e39aa1
def unindent(s): <NEW_LINE> <INDENT> s = s.rstrip() <NEW_LINE> lines = s.splitlines() <NEW_LINE> if len(lines) == 0: <NEW_LINE> <INDENT> return s.strip() <NEW_LINE> <DEDENT> mini = sys.maxsize <NEW_LINE> for ln in lines: <NEW_LINE> <INDENT> ln = ln.rstrip() <NEW_LINE> if len(ln) > 0: <NEW_LINE> <INDENT> mini = min(mini...
Reduces indentation of a docstring to the minimum. Empty lines don't count. Examples: >>> from atelier.utils import unindent >>> unindent('') '' >>> print(unindent(''' ... foo ... foo ... ''')) <BLANKLINE> foo foo >>> print(unindent(''' ... foo ... foo ... ''')) <BLANKLINE> foo foo
625941f6c4546d3d9de73087
def get_conv_output_shape(image_shape, kernel_shape, border_mode, subsample, filter_dilation=(1, 1)): <NEW_LINE> <INDENT> bsize, imshp = image_shape[0], image_shape[2:] <NEW_LINE> nkern, kshp = kernel_shape[0], kernel_shape[2:] <NEW_LINE> if isinstance(border_mode, tuple): <NEW_LINE> <INDENT> out_shp = tuple(get_conv_s...
This function compute the output shape of convolution operation. Parameters ---------- image_shape: tuple of int (symbolic or numeric) corresponding to the input image shape. Its four (or five) element must correspond respectively to: batch size, number of input channels, height and width (and possibly dep...
625941f62c8b7c6e89b35e08
def test_parse_id_no_view(): <NEW_LINE> <INDENT> url = 'https://www.voobly.com/profile/123684015' <NEW_LINE> with assert_raises(ValueError): scrape_ratings.parse_id(url)
Tests that a ValueError is raised when the url does not contain view.
625941f68e71fb1e9831ddf3
def __init__(self, version, response, solution): <NEW_LINE> <INDENT> super(PublicKeyPage, self).__init__(version, response) <NEW_LINE> self._solution = solution
Initialize the PublicKeyPage :param Version version: Version that contains the resource :param Response response: Response from the API :returns: twilio_code.rest.accounts.v1.credential.public_key.PublicKeyPage :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage
625941f6091ae356686675a0
def test_levi_output(self): <NEW_LINE> <INDENT> assert np.isclose(fx.levi_func(self.input2), self.target).all()
Test levi function output.
625941f6009cb60464c639f9
def async_manager(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> (request, args, kwargs) = self.pool.get() <NEW_LINE> if request is None: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> request(*args, **kwargs)
Daemon; take requests from the queue and execute them in background.
625941f666656f66f7cbc7f9
def main(): <NEW_LINE> <INDENT> sys.exit(sctl.sctl())
The main routine.
625941f6cdde0d52a9e53686
def prepare_output_ir(sorted_bbox_buf, remove_mask_buf, out_buf): <NEW_LINE> <INDENT> batch, num_bbox, _ = get_const_tuple(sorted_bbox_buf.shape) <NEW_LINE> rpn_post_nms_top_n = get_const_int(out_buf.shape[0]) // batch <NEW_LINE> nthread_tx = batch <NEW_LINE> tx = te.thread_axis("threadIdx.x") <NEW_LINE> ib = tvm.tir.i...
Copy output after applying nms to continuous memory. Parameters ---------- sorted_bbox_buf : tvm.te.schedule.Buffer 3-D with shape [batch, num_bbox, 5]. The last dimension is in format of [w_start, h_start, w_end, h_end, score]. remove_mask_buf : tvm.te.schedule.Buffer 2-D with shape [batch, num_bbox]. Bo...
625941f676d4e153a657f17f
def compute_log_likelihood(self, X=None, Y=None): <NEW_LINE> <INDENT> assert X is None and Y is None, "{} does not support minibatch mode".format(str(type(self))) <NEW_LINE> num_inducing = self.Z.size(0) <NEW_LINE> num_data = self.Y.size(0) <NEW_LINE> output_dim = self.Y.size(1) <NEW_LINE> err = self.Y - self.mean_func...
For a derivation of the terms in here, see the associated SGPR notebook.
625941f6fb3f5b602dac3ce7
def before(self, p): <NEW_LINE> <INDENT> self._validate(p) <NEW_LINE> if self.left(p): <NEW_LINE> <INDENT> return self._subtree_last_position(self.left(p)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> walk = p <NEW_LINE> above = self.parent(walk) <NEW_LINE> while above is not None and walk == self.left(above): <NEW_LI...
Return the inorder predecessor of the node p
625941f63539df3088e2e998
def start(self): <NEW_LINE> <INDENT> if self._start_time is not None: <NEW_LINE> <INDENT> raise TimerError(f"Timer is running. Use .stop() to stop it") <NEW_LINE> <DEDENT> self._start_time = time.perf_counter()
Starts timer. Raises TimerError if timer is running. Use .stop() to stop it.
625941f631939e2706e4d4ad
def set_for_request(self, request): <NEW_LINE> <INDENT> request.price_display_options = self
Set price display options of given request to self.
625941f6004d5f362079a97b
def placelist(self): <NEW_LINE> <INDENT> placelistPath = os.path.join(self.dpath, 'highlightPlaces.txt') <NEW_LINE> if not os.path.exists(placelistPath): <NEW_LINE> <INDENT> placePopPath = os.path.join(self.dpath, 'placespops.csv') <NEW_LINE> self.logf('%s -> %s', placePopPath, placelistPath) <NEW_LINE> if self.options...
placespops.csv -> highlightPlaces.txt short list of place ids
625941f6442bda511e8bea5b
def __init__(self, _filename): <NEW_LINE> <INDENT> self.__filename = str(_filename) <NEW_LINE> self.__mcpsinfo = str("") <NEW_LINE> self._newSensorName_list = [] <NEW_LINE> self._newSensorValue_list = [] <NEW_LINE> self._newSensorMax_list = [] <NEW_LINE> self._newSensorDiff_list = [] <NEW_LINE> self.__read_mcpsFile(sel...
object need a filename or path _filename = name of the mcps file
625941f65f7d997b871750eb
def check(i): <NEW_LINE> <INDENT> return (has_palindrome(i, 2, 4) and has_palindrome(i+1, 1, 5) and has_palindrome(i+2, 1, 4) and has_palindrome(i+3, 0, 6))
Checks if the integer (i) has the desired properties. i: int
625941f685dfad0860c3b4aa
def create_frozen_mv(self, **fmv_kwargs) -> FrozenMultiverse: <NEW_LINE> <INDENT> mv = FrozenMultiverse(model_name=self.name, **fmv_kwargs) <NEW_LINE> self._store_mv(mv) <NEW_LINE> return mv
Create a :class:`utopya.multiverse.FrozenMultiverse`, coupling it to a run directory. Use this method if you want to load an existing simulation run. Args: **fmv_kwargs: Passed on to FrozenMultiverse.__init__
625941f691af0d3eaac9c06a
def __deepcopy__(self, memo): <NEW_LINE> <INDENT> cls = self.__class__ <NEW_LINE> result = cls.__new__(cls) <NEW_LINE> memo[id(self)] = result <NEW_LINE> for k, v in self.__dict__.items(): <NEW_LINE> <INDENT> setattr(result, k, copy.deepcopy(v, memo)) <NEW_LINE> <DEDENT> return result
deep copy
625941f696565a6dacc8fd16
@coffee_blueprint.route('/shop/search') <NEW_LINE> def search_shop(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> search_term = request.args['q'] <NEW_LINE> search_term = f'%{search_term}%' <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> shops = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> shops = db.se...
Search for a coffeeshop by name or address. A full text search could be implemented in postgresql (or MySQL or SQLite) but then you spend a lot of time writing platform specifc code. A better solution (I think) is the solution using Elasticsearch as outlined by Miguel Grinberg here: https://blog.miguelgrinberg.com/pos...
625941f6d4950a0f3b08c992
def threshold(mask): <NEW_LINE> <INDENT> grayMask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY) <NEW_LINE> ret, thresh = cv2.threshold(grayMask, 0, 255, 0) <NEW_LINE> return thresh
Thresholding into a binary mask
625941f65166f23b2e1a57a6
def write_file(filename,message): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fp = open(filename,'w',encoding='utf-8') <NEW_LINE> fp.write(message) <NEW_LINE> fp.close() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> print("Write file error!")
密文将写入text.txt文件中
625941f6379a373c97cfb194
@contextlib.contextmanager <NEW_LINE> def hidden_cursor(): <NEW_LINE> <INDENT> if sys.stdout.isatty(): <NEW_LINE> <INDENT> _LOGGER.debug("Hiding cursor.") <NEW_LINE> print("\x1B[?25l", end="") <NEW_LINE> sys.stdout.flush() <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> yield <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDEN...
Temporarily hide the terminal cursor.
625941f615fb5d323cde1167
def initialize(self): <NEW_LINE> <INDENT> init_finished = tensor.fill_constant_batch_size_like( input=self.start_tokens, shape=[-1], dtype="bool", value=False, force_cpu=True) <NEW_LINE> init_inputs = self.embedding_fn(self.start_tokens) <NEW_LINE> return init_inputs, init_finished
GreedyEmbeddingHelper initialization produces inputs for the first decoding step by using `start_tokens` of the constructor, and gives initial status telling whether each sequence in the batch is finished. It is the partial of the initialization of `BasicDecoder`. Returns: tuple: A tuple( :code:`(initial_inputs, ...
625941f63c8af77a43ae3df5
def test_empty_value(self): <NEW_LINE> <INDENT> t1 = self.create(self.test_model, name="Test") <NEW_LINE> self.assertInstanceEqual(t1, name="Test", title=None) <NEW_LINE> self.assertTagModel(self.tag_model, {})
Check the descriptor returns None for no value
625941f67d847024c06be90e
def error_engine_json_decode(engine_file, silent): <NEW_LINE> <INDENT> message = "Unable to parse '{}'.\n".format(engine_file) <NEW_LINE> if not silent and HAS_WIN_MODULES: <NEW_LINE> <INDENT> MESSAGEBOX(None, message, 'Unable to parse cryengine file', win32con.MB_OK | win32con.MB_ICONERROR) <NEW_LINE> <DEDENT> else: <...
Error to specify that the json file is corrupt and couldn't be parsed.
625941f61d351010ab856167