code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@register_specialize <NEW_LINE> @register_canonicalize <NEW_LINE> @register_useless <NEW_LINE> @gof.local_optimizer([T.Join]) <NEW_LINE> def local_join_1(node): <NEW_LINE> <INDENT> if not isinstance(node.op, T.Join): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> tensors = node.inputs[1:] <NEW_LINE> if len(tensors) == ...
Join(i, x) => x Remove Join() when only one element is joined.
625941dc287bf620b61d3d67
def write_bluetooth(self, address, value): <NEW_LINE> <INDENT> return self._write(address, value, "$$w")
Writes to one of the JAKE Bluetooth microcontroller registers. :param address: the address of the register to write into (see the user manual for details). :param value: the new value to be written to the register. :returns: JAKE_SUCCESS or JAKE_ERROR
625941dc30bbd722463cc0cd
def __init__(self, locants = None): <NEW_LINE> <INDENT> if locants: <NEW_LINE> <INDENT> self._locants = locants <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._locants = []
Constructs a locator :param locants: list of locants
625941dc66673b3332b92396
def build_compose(i, ex, args): <NEW_LINE> <INDENT> i.compose_vector = hive.modifier(compose_modifier) <NEW_LINE> i.result = hive.attribute("euler") <NEW_LINE> i.pull_result = hive.pull_out(i.result) <NEW_LINE> for name in ('x', 'y', 'z'): <NEW_LINE> <INDENT> attr = hive.attribute("float") <NEW_LINE> setattr(i, name, a...
Compose a euler from its x, y and z components
625941dcbe8e80087fb20f43
def get_trades(self, stock, period=None): <NEW_LINE> <INDENT> def include_trade(trade): <NEW_LINE> <INDENT> if trade.get_stock() == stock: <NEW_LINE> <INDENT> if period: <NEW_LINE> <INDENT> timestamp = trade.get_timestamp() <NEW_LINE> t1, t2 = period <NEW_LINE> return timestamp >= t1 and timestamp < t2 <NEW_LINE> <DEDE...
get all trades for the given stock chronologically, optionally within the given period. @param stock - name of the stock @param period - optional tuple of (t1, t2) in microseconds (default is all trades)
625941dcd7e4931a7ee9e223
def get_string_from_template(file_path=None, template_key=None): <NEW_LINE> <INDENT> assert file_path, "Key '{}' must be defined in 'templates' key of report JSON!".format(template_key) <NEW_LINE> assert os.path.isfile( file_path), "File '{0}' from key '{1}' in 'templates' key of report JSON does not exist!".format(fil...
asserts and read template text file :param file_path: string with file path :param template_key: string with template key (used in error messages) :return:
625941dc26068e7796caefe7
def speaker_id(_, edu): <NEW_LINE> <INDENT> return speaker(edu.turn)
Get the speaker ID
625941dcb545ff76a891411a
def make_id(midi_instrument): <NEW_LINE> <INDENT> name = midi_instrument.name if midi_instrument.name != "" else "unknown" <NEW_LINE> id_ = name <NEW_LINE> return id_
midi instrument representation with program number of instrument name args : midi_instrument : pretty_midi instrument object return : id_ : 'program_X_name_Y' where X = instrument's program number, Y = instrument name
625941dc99cbb53fe6792eeb
def setup(hass, config): <NEW_LINE> <INDENT> _LOGGER.debug("Creating new Weback component") <NEW_LINE> hass.data[WEBACK_DEVICES] = [] <NEW_LINE> weback_api = WebackApi( config[DOMAIN].get(CONF_USERNAME), config[DOMAIN].get(CONF_PASSWORD), ) <NEW_LINE> devices = weback_api.device_list() <NEW_LINE> _LOGGER.debug("Weback ...
Set up the Weback component.
625941dc460517430c394483
def with_prefix(self, prefix: str) -> "StringBookBinder": <NEW_LINE> <INDENT> self._paginator._prefix = prefix <NEW_LINE> return self
Sets the prefix. Returns this.
625941dcd4950a0f3b08c650
def maxProfit(self, prices): <NEW_LINE> <INDENT> if prices is None or len(prices) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return sum([max(prices[i] - prices[i - 1], 0) for i in range(1, len(prices))])
:type prices: List[int] :rtype: int
625941dcde87d2750b86009a
def test_file_managed_http_source(self): <NEW_LINE> <INDENT> ret = self.run_state('file.managed', name=self.name, source=self.source, source_hash=self.source_hash, skip_verify=False) <NEW_LINE> log.debug('ret = %s', ret) <NEW_LINE> self.assertSaltTrueReturn(ret)
Test a remote file with no hash
625941dc4a966d76dd551317
@utils.multicase(ea=six.integer_types, n=six.integer_types) <NEW_LINE> def op_segment(ea, n): <NEW_LINE> <INDENT> op = operand(ea, n) <NEW_LINE> segment = (op.specval & 0xffff0000) >> 16 <NEW_LINE> selector = (op.specval & 0x0000ffff) >> 0 <NEW_LINE> if segment: <NEW_LINE> <INDENT> return reg.by_index(segment) <NEW_LI...
Returns the segment register name of the ``n``th operand for the instruction at the address ``ea``.
625941dcd6c5a10208144352
def genPotion(quality, randDesc): <NEW_LINE> <INDENT> if quality < 5: <NEW_LINE> <INDENT> prefix = "Light" <NEW_LINE> healing = 2 <NEW_LINE> cost = 1 <NEW_LINE> <DEDENT> elif 5 <= quality < 10: <NEW_LINE> <INDENT> prefix = "Medium" <NEW_LINE> healing = 5 <NEW_LINE> cost = 2 <NEW_LINE> <DEDENT> elif 10 <= quality < 15: ...
Generates potion object. @param quality: Quality statistic (1-20) that determines potion attributes. @param randDesc: Random number used to generate potion description. @return: A potion object.
625941dc38b623060ff0b0f2
def is_abelian(self): <NEW_LINE> <INDENT> return bool(self._libgap_().IsAbelian())
Return ``True`` if this group is abelian. EXAMPLES:: sage: G = PermutationGroup(['(1,2,3)(4,5)', '(1,2,3,4,5)']) sage: G.is_abelian() False sage: G = PermutationGroup(['(1,2,3)(4,5)']) sage: G.is_abelian() True
625941dccc40096d61595c54
def size(self): <NEW_LINE> <INDENT> return self.length
返回節點長度
625941dcfff4ab517eb2f743
def rem_one_card(self, cardName): <NEW_LINE> <INDENT> if cardName in self.deck: <NEW_LINE> <INDENT> self.deck[cardName][0] -= 1 <NEW_LINE> if self.get_card_count(cardName) == 0: <NEW_LINE> <INDENT> self.deck.pop(cardName) <NEW_LINE> self.numEmptyPiles += 1 <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> raise Na...
subtracts 1 card from cardName pile in deck if remaining pile is empty, cardName is deleted from deck and self.numEmptyPiles is incremented by 1
625941dcb5575c28eb68e308
@keras_mxnet_symbol <NEW_LINE> def concatenate(tensors, axis=-1): <NEW_LINE> <INDENT> if axis < 0: <NEW_LINE> <INDENT> rank = ndim(tensors[0]) <NEW_LINE> if rank: <NEW_LINE> <INDENT> axis %= rank <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> axis = 0 <NEW_LINE> <DEDENT> <DEDENT> tensors = [t.symbol for t in tensors] <N...
Concatenates a list of tensors alongside the specified axis. # Arguments tensors: list of tensors to concatenate. axis: concatenation axis. # Returns A tensor.
625941dc6fece00bbac2da47
def func_clear(): <NEW_LINE> <INDENT> entry_day_input.delete(0, "end") <NEW_LINE> entry_month_input.delete(0, "end") <NEW_LINE> entry_year_input.delete(0, "end") <NEW_LINE> entry_tillyear_input.delete(0, "end") <NEW_LINE> entry_tillmonth_input.delete(0, "end") <NEW_LINE> entry_tillyear_input.delete(0, "end")
Clear entries of input fields
625941dc97e22403b379d2a0
def restrict_to_rules_relevant_for(self, relationship): <NEW_LINE> <INDENT> if isinstance(relationship, GORelationship): <NEW_LINE> <INDENT> relationship = relationship.__class__ <NEW_LINE> <DEDENT> if not isinstance(relationship, type): <NEW_LINE> <INDENT> raise TypeError("GORelationship or GORelationship instance exp...
Constructs another `Rules`_ instance where only those inference rules will be kept that are relevant for inferring the given `relationship` (a subclass of `GORelationship`_). Returns the new `Rules`_ instance and the list of relationships that are relevant for inferring `relationship`. For instance, in order to infer...
625941dcab23a570cc25048a
def close(self): <NEW_LINE> <INDENT> self.__f.close()
close the debug.txt file after this object is closed
625941dc8e7ae83300e4b2d3
def test_cc_stim(): <NEW_LINE> <INDENT> stim = {'square': {'delay': 10, 'duration': 100, 'Sfreq': 10, 'PT': 0, 'NP': 1, 'amp': 100.}, 'hyp': {'delay': 10, 'duration': 100, 'Sfreq': 10, 'PT': 0, 'NP': 1, 'amp': 100., 'hypamp': -50, 'hypdur': 50}, 'timedSpikes': {'delay': 10, 'duration': 1, 'PT': 0, 'amp': 100., 'spikeTi...
stim: a dictionary with keys [required] delay (delay to start of pulse train, msec [all] duration: duration of pulses in train, msec [all] Sfreq: stimulus train frequency (Hz) [timedSpikes] PT: post-train test delay [all] NP: number of pulses in the train [timedSpikes, exp] amp: amplitude of the...
625941dc3539df3088e2e650
def _insert_headers_nan_test(ann, table): <NEW_LINE> <INDENT> for ix, content in enumerate(table['table_content']): <NEW_LINE> <INDENT> wvi = find_str_wvi_full_match(content, ann['question_tok']) <NEW_LINE> if wvi: <NEW_LINE> <INDENT> tmp_str = ''.join(ann['question_tok'][wvi[0]:(wvi[1]+1)]) <NEW_LINE> if len(table['co...
对val和test进行操作,将可能是table_content中的值的header信息插入到content之前
625941dcd58c6744b4257f64
def drop_db(): <NEW_LINE> <INDENT> require('environment', provided_by=[ubuntu, fedora]) <NEW_LINE> db_type = _get_database_type() <NEW_LINE> if confirm('\nDropping the %s DB loses ALL its data! Are you sure?' % (env['db_name']), default=False): <NEW_LINE> <INDENT> if db_type == 'mysql': <NEW_LINE> <INDENT> _drop_db_mys...
Drops the current DB - losing all data!
625941dc7047854f462a170c
def update_vertex_batch_property(self, body, auth=None): <NEW_LINE> <INDENT> url = "/graphs/%s/graph/vertices/batch" % _cfg.graph_name <NEW_LINE> code, res = Request(auth=auth).request(method='put', path=url, json=body) <NEW_LINE> return code, res
批量更新顶点属性 :return:
625941dc187af65679ca5425
def dist_replicated_cmd_builder(hosts, kwargs, num_ps=None): <NEW_LINE> <INDENT> num_ps = num_ps or len(hosts) <NEW_LINE> ps_hosts = hosts[:num_ps] <NEW_LINE> kwargs = kwargs.copy() <NEW_LINE> def generate_host_flags(): <NEW_LINE> <INDENT> cmds = {} <NEW_LINE> cmds["ps_hosts"] = ",".join([h + ":50000" for h in hosts][:...
Args: hosts: List of hosts num_ps: Defaults to number of hosts. kwargs: Args used to build command
625941dc3d592f4c4ed1d36c
def remove_unwanted_parent_classes_for_entity(self, classes): <NEW_LINE> <INDENT> lock = self.lock <NEW_LINE> lock.acquire() <NEW_LINE> for class_uri in classes: <NEW_LINE> <INDENT> if class_uri not in self.ancestors: <NEW_LINE> <INDENT> d = dict() <NEW_LINE> ancestors = self.tgraph.get_ancestors(class_uri) <NEW_LINE> ...
:param classes: a list of classes uris :return: list
625941dc5166f23b2e1a545e
def get_current_science_week(self): <NEW_LINE> <INDENT> science_week = self.get_science_week_from_date(datetime.date.today()) <NEW_LINE> return science_week
Get the science week number for today. Returns ------- science_week: int The current science week.
625941dc8e05c05ec3eea67c
def setFilter(self, filters=[logging.INFO, logging.ERROR]): <NEW_LINE> <INDENT> self._filters = filters
Sets up default filters. With no args, only logs with severity INFO and ERROR are allowed. It is useful for a console command based program.
625941dc656771135c3ebb77
def _do_flip(self): <NEW_LINE> <INDENT> border_x, border_y = self._window_sizer.border_shift <NEW_LINE> screen = pygame.Surface( (self.size[0] + 2*border_x, self.size[1] + 2*border_y), 0, self.canvas ) <NEW_LINE> screen.set_palette(self.work_palette) <NEW_LINE> border_colour = pygame.Color(0, 0, self.border_attr % self...
Draw the canvas to the screen.
625941dc8da39b475bd6527c
def get_by(self, field, value): <NEW_LINE> <INDENT> return self._client.get_by(field, value)
Gets all interconnects that match the filter The search is case-insensitive Args: field: Field name to filter. value: Value to filter. Returns: list: A list of interconnects.
625941dc50485f2cf553d0a1
def testApiKey(self): <NEW_LINE> <INDENT> model = esp_sdk.models.api_key.ApiKey()
Test ApiKey
625941dc009cb60464c636b5
def main(): <NEW_LINE> <INDENT> print("Reading in data") <NEW_LINE> model = pickle.load(open("models/model.xgb", "rb")) <NEW_LINE> with open("models/time_dict.yaml", "r") as f: <NEW_LINE> <INDENT> time_dict = yaml.load(f) <NEW_LINE> <DEDENT> vld_idx = pd.read_csv(VALID_IDX_PATH) <NEW_LINE> tmp_d = tempfile.TemporaryDir...
main inferecne function
625941dc29b78933be1e59ad
def __call__(self, context, product, quantity=1): <NEW_LINE> <INDENT> options = PriceDisplayOptions.from_context(context) <NEW_LINE> if options.hide_prices: <NEW_LINE> <INDENT> return ("", "") <NEW_LINE> <DEDENT> request = context.get('request') <NEW_LINE> priced_children = product.get_priced_children(request, quantity...
:type product: shoop.core.models.Product
625941dcbe7bc26dc91cd900
def set_window_coords(window_handle, left, top, right=0, bottom=0): <NEW_LINE> <INDENT> width = right - left <NEW_LINE> height = bottom - top <NEW_LINE> if (right == 0) or (bottom == 0): <NEW_LINE> <INDENT> (curLeft, curTop, curRight, curBottom) = get_window_coords(window_handle) <NEW_LINE> width = curRight - curLeft <...
Repositions a window to new coordinates. If the right and bottom coordinates are ignored, the window size is preserved.
625941dc711fe17d8254266a
def utils_seed_length(self, length): <NEW_LINE> <INDENT> return self.request('get', '/utils/seed/{}'.format(length))
Generate random seed of specified length on node :param length: :return:
625941dc283ffb24f3c55c04
def first(self): <NEW_LINE> <INDENT> self._cursor = 0 <NEW_LINE> self._lastItemPos = -1
将cursor重置到backingStore的开始位置.
625941dcd53ae8145f87a571
def _build_deeplab(inputs_queue, outputs_to_num_classes, ignore_label): <NEW_LINE> <INDENT> samples = inputs_queue.dequeue() <NEW_LINE> model_options = common.ModelOptions( outputs_to_num_classes=outputs_to_num_classes, crop_size=FLAGS.train_crop_size, atrous_rates=FLAGS.atrous_rates, output_stride=FLAGS.output_stride)...
Builds a clone of DeepLab. Args: inputs_queue: A prefetch queue for images and labels. outputs_to_num_classes: A map from output type to the number of classes. For example, for the task of semantic segmentation with 21 semantic classes, we would have outputs_to_num_classes['semantic'] = 21. ignore_label:...
625941dc56ac1b37e62644d0
def test_models(self): <NEW_LINE> <INDENT> self.setup_CombustionChamber_model() <NEW_LINE> self.setup_CombustionChamberStoich_model() <NEW_LINE> m1 = round(self.nw1.get_conn('flue gas after cc').m.val, 6) <NEW_LINE> m2 = round(self.nw2.get_conn('flue gas after cc').m.val, 6) <NEW_LINE> msg = ( 'The outlet mass flow of ...
Tests the results of both gas turbine models.
625941dc1f5feb6acb0c4e52
def clear(self): <NEW_LINE> <INDENT> self.cv = 0.0 <NEW_LINE> self.prev_cv = 0.0 <NEW_LINE> self.error = 0.0 <NEW_LINE> self.prev_error = 0.0 <NEW_LINE> self._prev_deriv = 0.0 <NEW_LINE> self._deriv_err = 0.0 <NEW_LINE> self._deriv = 0.0 <NEW_LINE> if self.discrete_time: <NEW_LINE> <INDENT> self.prev2_error = 0.0 <NEW_...
Resets all initial values of the controller
625941dc4d74a7450ccd44c9
def find_msys_registry(): <NEW_LINE> <INDENT> subkey = ('Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall' '\\{AC2C1BDB-1E91-4F94-B99C-E716FE2E9C75}_is1') <NEW_LINE> for hkey in [_winreg.HKEY_CURRENT_USER, _winreg.HKEY_LOCAL_MACHINE]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> key = _winreg.OpenKey(hkey, subke...
Return the MSYS 1.0 directory path stored in the Windows registry The return value is an encoded ascii str. The registry entry for the uninstaller is used. Raise a LookupError if not found.
625941dc07d97122c4178b97
def histogram(self, metric, value, tags=None, sample_rate=None): <NEW_LINE> <INDENT> self._report(metric, 'h', value, tags, sample_rate)
Sample a histogram value, optionally setting tags and a sample rate. >>> statsd.histogram('uploaded.file.size', 1445) >>> statsd.histogram('album.photo.count', 26, tags=["gender:female"])
625941dc63d6d428bbe447f6
def test_ip6tables_drop_everything_focal(host): <NEW_LINE> <INDENT> with host.sudo(): <NEW_LINE> <INDENT> c = host.run("ip6tables -S") <NEW_LINE> assert c.rc != 0 <NEW_LINE> assert c.stdout == ""
Ensures that IPv6 firewall settings are inaccessible, due to fully disabling IPv6 functionality at boot-time, via boot options.
625941dc8e05c05ec3eea67d
def plotDetectorOrigin(self, which='both', frame=None): <NEW_LINE> <INDENT> if frame is None: frame = self._last_plot_frame <NEW_LINE> for ap in self._getFullApertures(): <NEW_LINE> <INDENT> ap.plotDetectorOrigin(frame=frame, which=which)
Mark on the plot the detector's origin in Det and Sci coordinates Parameters ----------- which : str Which detector origin to plot: 'both', 'Det', 'Sci' frame : str Which coordinate system to plot in: 'Tel', 'Idl', 'Sci', 'Det' Optional if you have already called plot() to specify a coordinate frame.
625941dc0fa83653e46572bf
def match(self, test, kwd): <NEW_LINE> <INDENT> if not kwd: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> kwd = kwd.upper() <NEW_LINE> return ( kwd in test.guid() or kwd in test.runscript.upper() or kwd in test.name.upper() or kwd in ' '.join(test.options).upper() )
Match by key word
625941dc5e10d32532c5f22c
def select_last_item(self): <NEW_LINE> <INDENT> if len(self.droplist.droplist_items) > 0: <NEW_LINE> <INDENT> last_index = self.droplist.get_last_index() <NEW_LINE> if last_index != None: <NEW_LINE> <INDENT> self.droplist.item_select_index = last_index <NEW_LINE> self.droplist.active_item() <NEW_LINE> self.droplist.dro...
Select last item.
625941dcbaa26c4b54cb1423
def create_port(self, context, port): <NEW_LINE> <INDENT> LOG.debug(_("QuantumPluginPLUMgrid Status: create_port() called")) <NEW_LINE> port["port"]["admin_state_up"] = True <NEW_LINE> return super(QuantumPluginPLUMgridV2, self).create_port(context, port)
Create port core Quantum API
625941dc7b180e01f3dc4afe
@contextmanager <NEW_LINE> def capture_new_data_pipeline_messages(topic): <NEW_LINE> <INDENT> with capture_new_messages(topic) as get_kafka_messages: <NEW_LINE> <INDENT> def get_data_pipeline_messages(count=100): <NEW_LINE> <INDENT> kafka_messages = get_kafka_messages(count) <NEW_LINE> return [ create_from_offset_and_m...
contextmanager that moves to the tail of the given topic, and waits to receive new messages, returning a function that can be called zero or more times which will retrieve decoded data pipeline messages from the topic. Returns: Callable[[int], List[Message]]: Function that takes a single optional argument,...
625941dc55399d3f055889bb
def init_app(self, app: Flask) -> None: <NEW_LINE> <INDENT> app.url_map.converters['arxiv'] = ArXivConverter <NEW_LINE> app_version = app.config.get("APP_VERSION", "null") <NEW_LINE> app_static_path = f'/static/{app.name}/{app_version}' <NEW_LINE> app.static_url_path = app_static_path <NEW_LINE> for rule in app.url_map...
Create and register the base UI blueprint.
625941dc4c3428357757c62c
def test_load_indirect_nn_hl(self): <NEW_LINE> <INDENT> instruction = LdIndirectNNHL(self._z80) <NEW_LINE> address = self._get_random_word() <NEW_LINE> word = self._get_random_word() <NEW_LINE> self._z80.hl.bits = word <NEW_LINE> high_order_byte, low_order_byte = self._split_word(address) <NEW_LINE> instruction.execute...
Test LD (nn), HL
625941dc1f037a2d8b946503
def update_position(self): <NEW_LINE> <INDENT> for i in range(self.num_candidates): <NEW_LINE> <INDENT> self.pos[i] += self.velocity[i] <NEW_LINE> <DEDENT> return None
Move the candidates based on their velocities
625941dc7b25080760e3975e
def initEnv(self): <NEW_LINE> <INDENT> if self.__ftp is None: <NEW_LINE> <INDENT> self.__ftp = FTP() <NEW_LINE> <DEDENT> if (not self.__log_file or self.__log_file.closed): <NEW_LINE> <INDENT> self.__log_file = open("log.txt", 'a')
环境初始化 :return:
625941dc76d4e153a657ee38
def post(self, request: Any) -> Response: <NEW_LINE> <INDENT> serializer = CustumerSerializer(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> serializer.save() <NEW_LINE> return Response({"serializer.data": 200, "status": status.HTTP_201_CREATED}) <NEW_LINE> <DEDENT> return Response(serializ...
:param request: :return:
625941dc3eb6a72ae02ec7ea
def read_cartesian(self, input_file='geom.xyz'): <NEW_LINE> <INDENT> self.cartesian = [] <NEW_LINE> with open(input_file, 'r') as f: <NEW_LINE> <INDENT> f.readline() <NEW_LINE> f.readline() <NEW_LINE> for line in f.readlines(): <NEW_LINE> <INDENT> if not line.strip(): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> coord...
Read the Cartesian coordinates file (assumes no errors) :param input_file: xyz formatted geometry The Cartesian coordinates consist of a list of atoms formatted as follows: [name, np.array([x, y, z]), mass]
625941dc236d856c2ad44ae4
def MEDCouplingUMesh_ExtractFromIndexedArrays(*args): <NEW_LINE> <INDENT> return _MEDCouplingRemapper.MEDCouplingUMesh_ExtractFromIndexedArrays(*args)
MEDCouplingUMesh_ExtractFromIndexedArrays(PyObject li, DataArrayInt arrIn, DataArrayInt arrIndxIn) -> PyObject 1
625941dc090684286d50efef
def is_standard_wrf_var(wrfin, varname): <NEW_LINE> <INDENT> multifile = is_multi_file(wrfin) <NEW_LINE> if multifile: <NEW_LINE> <INDENT> if not is_mapping(wrfin): <NEW_LINE> <INDENT> wrfin = next(iter(wrfin)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> entry = wrfin[next(iter(viewkeys(wrfin)))] <NEW_LINE> return is...
Return True if the variable is a standard WRF variable and not a diagnostic. If *wrfin* is a sequence, only the first file is used. Args: wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an iterable): Input WRF ARW NetCDF data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile` ...
625941dc8da39b475bd6527d
def update_category(self, signal_id, category_url, message): <NEW_LINE> <INDENT> category_data = self._check_category(signal_id) <NEW_LINE> current_cat_url = urlparse(category_data['category_url']).path <NEW_LINE> if current_cat_url == category_url: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> payload = copy.deepcopy...
Move given signal to category with descriptive message in logs.
625941dc07f4c71912b1178a
def flash(self, duration = 0.01): <NEW_LINE> <INDENT> self.on() <NEW_LINE> sleep(duration) <NEW_LINE> self.off()
Flashes the LED once Args: duration: Duration of the flash in seconds (default: 0.01 seconds)
625941dccdde0d52a9e5333c
def uqadd16(self, cond: Condition, rn: Reg, rd: Reg) -> None: <NEW_LINE> <INDENT> struct.pack_into("<I", self.buf, self.pos, (((106958608 | cond) | (rn << 16)) | (rd << 12))) <NEW_LINE> self.pos += 4
Emits an 'uqadd16' instruction.
625941dc07d97122c4178b98
def __init__(self, environment_id: str, status: str) -> None: <NEW_LINE> <INDENT> self.environment_id = environment_id <NEW_LINE> self.status = status
Initialize a DeleteEnvironmentResponse object. :param str environment_id: The unique identifier for the environment. :param str status: Status of the environment.
625941dc3346ee7daa2b3074
def get_p(self, xhtmlElem, odfAttrs, baseStyle): <NEW_LINE> <INDENT> createNew, styleName = self.getStyleName(xhtmlElem, odfAttrs) <NEW_LINE> if not createNew: return styleName <NEW_LINE> names = [name for name, value in odfAttrs] <NEW_LINE> parent = baseStyle and baseStyle.getOdfParentAttributes(names) or '' <NEW_LINE...
Generates a paragraph style
625941dceab8aa0e5d26de5f
def getAllLocation(self, **kwargs): <NEW_LINE> <INDENT> allParams = [] <NEW_LINE> params = locals() <NEW_LINE> for (key, val) in list(params['kwargs'].items()): <NEW_LINE> <INDENT> if key not in allParams: <NEW_LINE> <INDENT> raise TypeError("Got an unexpected keyword argument '%s' to method getAllLocation" % key) <NEW...
Retrieves all locations Args: Returns: LocationNIOListResult
625941dcaad79263cf390d4c
def remove_nexusnve_binding(vni, switch_ip, device_id): <NEW_LINE> <INDENT> LOG.debug("remove_nexusnve_binding() called") <NEW_LINE> session = db.get_session() <NEW_LINE> binding = (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_ip, device_id=device_id).one()) <NEW_LINE> if binding:...
Remove the nexus nve binding.
625941dc925a0f43d254a180
def check_parameters(self, node): <NEW_LINE> <INDENT> arg_names = [] <NEW_LINE> if isinstance(node, astroid.ClassDef): <NEW_LINE> <INDENT> for constructor in node.body: <NEW_LINE> <INDENT> if isinstance(constructor, astroid.FunctionDef) and constructor.name == "__init__": <NEW_LINE> <INDENT> arg_names = [arg.name for a...
Parse the docstring for any params and types and compares it to the function's parameters. Throws a pylint error if... 1. Missing param in docstring. 2. Missing a param type in the docstring. 3. Missing a return doc in the docstring when a function returns something. 4. Missing an rtype in the docstring when a functio...
625941dc8c3a8732951586c4
def call(self, x, *args, **kwargs): <NEW_LINE> <INDENT> output = self.output_model(x) <NEW_LINE> number_of_input = x.shape[1].value // self.embedding_size <NEW_LINE> gating_inp = tf.concat([output, x], axis=-1) <NEW_LINE> gatings = tf.nn.softmax(self.gating_f(gating_inp)[:, :number_of_input+1], axis=1) <NEW_LINE> weigh...
:param x: zero padded input [batch, <= input_size * emb] :return: [clones, batch, output_size]
625941dce5267d203edcdfa0
def test_AddCustomer_request_without_special_instructions(self): <NEW_LINE> <INDENT> self.mock_request( customer_name=self.CUSTOMER_NAME, address_1=self.ADDRESS_1, country=self.COUNTRY, selling_channel_id=self.SELLING_CHANNEL_ID, special_instructions=None, ) <NEW_LINE> self.assertDataSent(self.request_class.SPECIAL_INS...
Test False is send for special instructions when no note is passed.
625941dcbe383301e01b5787
def set_object_texture(self, obj_name: str, filepath: str): <NEW_LINE> <INDENT> if not os.path.exists(filepath) or filepath in [None, '']: <NEW_LINE> <INDENT> self.logger.info(f'Path {filepath} to object texture does not exist. Skipping') <NEW_LINE> return <NEW_LINE> <DEDENT> tree = bpy.data.objects[obj_name].active_ma...
Set a specific (image) texture for the specified object. NOTE: if the object has specific material properites, these will be overwritten Args: obj(str): bpy object name to select filepath(str): path to texture image
625941dc4527f215b584c75a
def variation(self, move: Union[int, chess.Move, GameNode]) -> ChildNode: <NEW_LINE> <INDENT> return self[move]
Gets a child node by either the move or the variation index.
625941dc6e29344779a62916
def fit(self, X, col_y): <NEW_LINE> <INDENT> self.y = X[col_y] <NEW_LINE> X_drop = [col_y] <NEW_LINE> for colmn in X.columns: <NEW_LINE> <INDENT> if len(X[X[colmn].isna()]) < self.null_pct*len(X)/100: <NEW_LINE> <INDENT> if X[colmn].dtype == 'object': <NEW_LINE> <INDENT> X[colmn] = X[colmn].fillna('nofeature') <NEW_LIN...
Преобразование X
625941dc796e427e537b08ce
def ex_create_network(self, name, cidr, description=None, mode="legacy"): <NEW_LINE> <INDENT> network_data = {} <NEW_LINE> network_data['name'] = name <NEW_LINE> network_data['description'] = description <NEW_LINE> if mode.lower() not in ['auto', 'custom', 'legacy']: <NEW_LINE> <INDENT> raise ValueError("Invalid networ...
Create a network. In November 2015, Google introduced Subnetworks and suggests using networks with 'auto' generated subnetworks. See, the `subnet docs <https://cloud.google.com/compute/docs/subnetworks>`_ for more details. Note that libcloud follows the usability pattern from the Cloud SDK (e.g. 'gcloud compute' comman...
625941dc76e4537e8c35197c
def make_github_issue(title, body=None, assignee=None, labels=None): <NEW_LINE> <INDENT> url = 'https://api.github.com/repos/%s/%s/issues' % (REPO_OWNER, REPO_NAME) <NEW_LINE> session = requests.session() <NEW_LINE> session.auth=(USERNAME, PASSWORD) <NEW_LINE> issue = {'title': title, 'body': body, 'assignee': assignee...
Create an issue on github.com using the given parameters.
625941dc0383005118ecf8e8
def export_file(default_filename='', binary=False, allow_abort=True): <NEW_LINE> <INDENT> return open_file(default_filename, mode='wb+' if binary else 'w+', message='Enter the output filename', allow_abort=allow_abort)
Allows user to enter the output filename. Returns a file object. Returns default filename or raises Abort if filename not specified.
625941dc71ff763f4b549997
def test_search_roles(self): <NEW_LINE> <INDENT> print_test_name() <NEW_LINE> try: <NEW_LINE> <INDENT> roles = review.find_roles(Role(name='Customer*')) <NEW_LINE> for role in roles: <NEW_LINE> <INDENT> print_role(role) <NEW_LINE> <DEDENT> <DEDENT> except RbacError as e: <NEW_LINE> <INDENT> print_exception(e) <NEW_LINE...
Search for roles that match the characters passed into with wildcard appended. Will return zero or more records, one for each user in result set.
625941dc4e696a04525c9753
def sample_meetup(name='Meetup Beer'): <NEW_LINE> <INDENT> meetup = Meetup.objects.create( user=sample_user(), date='2020-01-01', name=name, description='Description Meetup', count_beer=36, maximum_temperature=30.0, count_participants=10, direction="Avenida siempre viva 223" ) <NEW_LINE> return meetup
Create a sample meetup
625941dc099cdd3c635f0f61
def CaptureProfile(options, interval, modules, output=None, compress=False, write_json=False): <NEW_LINE> <INDENT> agents_with_config = tracing_controller.CreateAgentsWithConfig(options, modules) <NEW_LINE> if chrome_startup_tracing_agent in modules: <NEW_LINE> <INDENT> controller_config = tracing_controller.GetChromeS...
Records a profiling trace saves the result to a file. Args: options: Command line options. interval: Time interval to capture in seconds. An interval of None (or 0) continues tracing until stopped by the user. modules: The list of modules to initialize the tracing controller with. output: Output file nam...
625941dcb5575c28eb68e309
def parse(self, dict_: Dict, header: bool = False) -> str: <NEW_LINE> <INDENT> if not isinstance(dict_, dict): <NEW_LINE> <INDENT> raise TypeError("Second argument must be a dictionary") <NEW_LINE> <DEDENT> if not self.template_file: <NEW_LINE> <INDENT> raise OpagMissingPrecondition("Template path is not set") <NEW_LIN...
Parse the open file object passed, replacing any keys found using the replacement dictionary passed.
625941dc4428ac0f6e5baafb
def login_menu(self): <NEW_LINE> <INDENT> self.main_Window = tk.Tk() <NEW_LINE> self.welcome_label = self.create_label(self.main_Window, "Bienvenue sur l'Appli Ce2Phil", 0, 0, 2) <NEW_LINE> self.login_label = self.create_label(self.main_Window, "Pseudo : ", 2, 0) <NEW_LINE> self.login_field = self.create_entry(self.mai...
Displays the login menu on apps launch
625941dc1d351010ab855e22
def paint(self, painter, option, widget): <NEW_LINE> <INDENT> self.custom_pen.setColor(SELECTED_COLOR) <NEW_LINE> painter.setPen(self.custom_pen) <NEW_LINE> painter.setBrush(self.custom_brush) <NEW_LINE> painter.drawRect( min(self.start_coord[0], self.end_coord[0]), min(self.start_coord[1], self.end_coord[1]), abs(self...
Paints a rectangle that will define beam size :param painter: :param option: :param widget: :return:
625941dcbe8e80087fb20f45
@main.route('/create_payrate', methods=['GET', 'POST']) <NEW_LINE> @login_required <NEW_LINE> @admin_required <NEW_LINE> def pay(): <NEW_LINE> <INDENT> current_app.logger.info('Start function pay()') <NEW_LINE> form = CreatePayRateForm() <NEW_LINE> if form.validate_on_submit(): <NEW_LINE> <INDENT> current_app.logger.in...
View function used to render HTML to create a payrate. :return: HTML template to create payrates.
625941dc435de62698dfdf54
def counter(string): <NEW_LINE> <INDENT> count_of_word = string.count(word) <NEW_LINE> return count_of_word
Counts the number of occurrences of a given word
625941dcb545ff76a891411c
def test_parciales_de_materia_ordenados_con_primeros_parciales_diferente_anio(self): <NEW_LINE> <INDENT> anio1 = 2018 <NEW_LINE> anio2 = 2017 <NEW_LINE> cuatri1 = ConjuntoDeEnunciadosConCuatrimestre.PRIMERO <NEW_LINE> cuatri2 = ConjuntoDeEnunciadosConCuatrimestre.VERANO <NEW_LINE> cuatri3 = ConjuntoDeEnunciadosConCuatr...
Debería devolver el diccionario con los primeros parciales ordenados de último año a primero.
625941dcf548e778e58cd886
def load_factory(name, directory, configuration=None): <NEW_LINE> <INDENT> for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT): <NEW_LINE> <INDENT> if entry_point.name == name: <NEW_LINE> <INDENT> factory_class = entry_point.load(require=False) <NEW_LINE> return factory_class(directory, configuration) <NEW_...
Load a factory and have it initialize in a particular directory :param name: the name of the plugin to load :param directory: the directory where the factory will reside :return:
625941dcbde94217f36830f5
def compile(self, code, options=''): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = self.client.cli.compile_contract(body=dict( code=code, options=options )) <NEW_LINE> return data.bytecode <NEW_LINE> <DEDENT> except OpenAPIClientException as e: <NEW_LINE> <INDENT> raise ContractError(e)
Compile a sophia contract from source :param code: the source code of the the contract :param options: additional options for the contract TODO: link the documentation for the options :return: the contract bytecode
625941dce76e3b2f99f3ab0e
def calc_spot(option): <NEW_LINE> <INDENT> nodes = option.nodes <NEW_LINE> current_spot = option.S_0 <NEW_LINE> if nodes > 2: <NEW_LINE> <INDENT> spots = np.empty(nodes) <NEW_LINE> for i in range(nodes): <NEW_LINE> <INDENT> spots[i] = float(option.upper**(nodes - 1 - i)*option.lower**(i)*option.S_0) <NEW_LINE> <DEDENT>...
Calculates the final terminal node spots for an Option with N terminal nodes
625941dc4527f215b584c75b
def on(self, image): <NEW_LINE> <INDENT> if is_np_array(image): <NEW_LINE> <INDENT> shape = image.shape <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> shape = image <NEW_LINE> <DEDENT> if shape[0:2] == self.shape[0:2]: <NEW_LINE> <INDENT> return self.deepcopy() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> bounding_boxe...
Project bounding boxes from one image to a new one. Parameters ---------- image : ndarray or tuple of int New image onto which the bounding boxes are to be projected. May also simply be that new image's shape tuple. Returns ------- bounding_boxes : imgaug.BoundingBoxesOnImage Object containing all project...
625941dc0fa83653e46572c0
def show_slices(slices, suptitle): <NEW_LINE> <INDENT> fig, axes = plt.subplots(1, len(slices)) <NEW_LINE> plt.tick_params( axis='x', which='both', bottom='off', top='off', labelbottom='off') <NEW_LINE> plt.tick_params( axis='y', which='both', bottom='off', top='off', labelbottom='off') <NEW_LINE> for i, slice in enume...
Function to display row of image slices
625941dc5fdd1c0f98dc053b
def train_model(model, training_inputs, training_labels): <NEW_LINE> <INDENT> earlystop = keras.callbacks.EarlyStopping( monitor='val_acc', min_delta=0.0001, patience=8, verbose=args.verbose, mode='auto') <NEW_LINE> callbacks_list = [earlystop] <NEW_LINE> return model.fit( training_inputs, training_labels, validation_s...
Train given model with given data. Returns history of keras fit function.
625941dc6fb2d068a760f3a8
def _reset_connection(self): <NEW_LINE> <INDENT> self.connected = False <NEW_LINE> self.gearman_socket = None <NEW_LINE> self.allowed_connect_time = 0.0 <NEW_LINE> self._is_client_side = None <NEW_LINE> self._is_server_side = None <NEW_LINE> self._incoming_buffer = b'' <NEW_LINE> self._outgoing_buffer = b'' <NEW_LINE> ...
Reset the state of this connection
625941dc1b99ca400220adb9
def set_port(self, port): <NEW_LINE> <INDENT> self.port = port <NEW_LINE> self.check_port()
Set the process port
625941dcbe383301e01b5788
def _parse_author_details(self, jira_issue_fields, at_name_jira): <NEW_LINE> <INDENT> people = getattr(jira_issue_fields, at_name_jira) <NEW_LINE> if people is not None: <NEW_LINE> <INDENT> return self._get_people(people.name, self._get_user_email(people), people.displayName) <NEW_LINE> <DEDENT> return None
Parses the author detail fields from the original issue :param jira_issue_fields: fields of the original jira issue :param at_name_jira: attribute name that should be returned
625941dc046cf37aa974d04d
def is_verbose(self): <NEW_LINE> <INDENT> return self._output.is_verbose()
Returns whether the verbosity is VERBOSE or greater.
625941dca8ecb033257d33d3
def draw_bs_reps(data, func, size=1): <NEW_LINE> <INDENT> bs_replicates = np.empty(size) <NEW_LINE> for i in range(size): <NEW_LINE> <INDENT> bs_replicates[i] = bootstrap_replicate(data, func) <NEW_LINE> <DEDENT> return bs_replicates
Draw bootstrap replicates.
625941dc30c21e258bdfa7a6
def _coerce_impl(self, x): <NEW_LINE> <INDENT> if not isinstance(x, FiniteFieldHomomorphism_generic): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> if x.parent() is self: <NEW_LINE> <INDENT> return x <NEW_LINE> <DEDENT> if x.parent() == self: <NEW_LINE> <INDENT> return FiniteFieldHomomorphism_generic(self, x....
Coercion of other morphisms. EXAMPLES:: sage: k.<a> = GF(25) sage: l.<b> = GF(625) sage: H = Hom(k, l) sage: G = loads(dumps(H)) sage: H == G True sage: H is G # this should change eventually False sage: G.coerce(list(H)[0]) # indirect doctest Ring morphism: From: Finite ...
625941dcd486a94d0b98e44e
def accountsMerge(self, accounts): <NEW_LINE> <INDENT> owner = {} <NEW_LINE> parents = {} <NEW_LINE> unions = {} <NEW_LINE> for a in accounts: <NEW_LINE> <INDENT> for i in range(1, len(a)): <NEW_LINE> <INDENT> parents[a[i]] = a[i] <NEW_LINE> owner[a[i]] = a[0] <NEW_LINE> <DEDENT> <DEDENT> for a in accounts: <NEW_LINE> ...
:type accounts: List[List[str]] :rtype: List[List[str]]
625941dc8a349b6b435e847a
def writeArchiveRecord(self, data): <NEW_LINE> <INDENT> self.out.write(data)
Same as write() but suppresses the version number. This method is used by RiArchiveRecord(), everyone else uses write().
625941dc507cdc57c6306fe8
def parse(string_iter, weighted=False): <NEW_LINE> <INDENT> parser = Parser(weighted) <NEW_LINE> parser.parse(string_iter) <NEW_LINE> return parser.result
Given an iterator that yields strings (like a file object), returns the parsed results. The results may be returned as a list if there are no discernible string keys; results are returned as a (possibly nested) dictionary otherwise. If ``weighted`` is ``True``, indicates that the values are affixed with a comma-separa...
625941dc92d797404e304493
def subsub1(*, baz=None): <NEW_LINE> <INDENT> return baz
:type baz: int
625941dc8da39b475bd6527e
def nexus_groovy_details(self, data): <NEW_LINE> <INDENT> return self._nexus_groovy_result(data, 'action_details')
Return the action_details part of the groovy call result if available or some as relevant as possible info. :param data: A registered var after calling the nexus groovy script though uri module :return: A list of maps for each action in the script if available or a string with the best relevant info
625941dcd7e4931a7ee9e226
def insert(self, word, ID, type): <NEW_LINE> <INDENT> node=self.root <NEW_LINE> for i in word: <NEW_LINE> <INDENT> if i not in node.children: <NEW_LINE> <INDENT> node.children[i]=Node() <NEW_LINE> <DEDENT> node=node.children[i] <NEW_LINE> <DEDENT> node.complete=True <NEW_LINE> node.ID.append(ID) <NEW_LINE> node.type.ap...
Inserts a word into the trie. :type word: str :rtype: void
625941dc656771135c3ebb79
def _get_headings(self, tr): <NEW_LINE> <INDENT> tds = tr.find_all('td') <NEW_LINE> [self.page_content.add_heading(td.get_text(strip=True).strip()) for td in tds]
Utility function used to get heading values and return them into a list. :param tr: :return: list: headings
625941dc009cb60464c636b7