code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def f2c(tf: float) -> float: <NEW_LINE> <INDENT> r = (tf - 32) * 5/9 <NEW_LINE> if r < -273.15: <NEW_LINE> <INDENT> raise ValueError('Input temperature below absolute zero!') <NEW_LINE> <DEDENT> return r
Convert degree Fahrenheit to Celsius
625941df566aa707497f48c8
def check(args, source_code, filename=None, options=None): <NEW_LINE> <INDENT> if args is None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> if options is not None: <NEW_LINE> <INDENT> args += options <NEW_LINE> <DEDENT> if any(['pyflakes' in arg for arg in args]): <NEW_LINE> <INDENT> source_code += '\n' <NEW_LINE...
Check source code with checker defined with *args* (list) Returns an empty list if checker is not installed
625941df45492302aab5e62b
def load(self, zips_csv): <NEW_LINE> <INDENT> zips_dict, city_dict = {}, {} <NEW_LINE> zips_f = open(zips_csv) <NEW_LINE> header = zips_f.readline().strip().split(',') <NEW_LINE> for l in zips_f: <NEW_LINE> <INDENT> zip,state_abr,lat,long_,city,state = l.strip().split('", "') <NEW_LINE> lat,long_ = float(lat), float(lo...
load the zipcode data into a dictionary from a csv
625941df4e696a04525c97b1
def get_parent(self): <NEW_LINE> <INDENT> return self._parent
Method gets parent Returns: any: Parent
625941dfab23a570cc2504e9
def format_bytes(self, data, with_ascii=True): <NEW_LINE> <INDENT> if not data: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> hexdump = [] <NEW_LINE> asciidump = [] <NEW_LINE> for b in data: <NEW_LINE> <INDENT> hexdump.append('{:0>2x}'.format(b)) <NEW_LINE> asciidump.append(self.format_byte(b)) <NEW_LINE> <DEDENT...
Formats byte data into hex/ascii using a terminal-friendly representation.
625941df566aa707497f48c9
def recognition(self, images: Union[Image.Image, List[Image.Image]] ) -> Union[RecognitionResult, List[RecognitionResult]]: <NEW_LINE> <INDENT> if self._recognition_model is None: <NEW_LINE> <INDENT> self._recognition_model = Recognition(**self._recognition_init_params) <NEW_LINE> <DEDENT> input_type = self._validate_i...
Run text recognition to "read" the word present in the image. :param images: One PIL image or a list of PIL images on which to run the recognition algorithm. The image should only contain one word, which should ideally be horizontally aligned. :return: If one image was supplied: one recognition result (...
625941df63b5f9789fde744a
def test_senmldocument_to_json(): <NEW_LINE> <INDENT> doc = senml.SenMLDocument.from_json(JS) <NEW_LINE> js_out = doc.to_json() <NEW_LINE> assert js_out == JS
test SenMLDocument.to_json
625941df0c0af96317bb854c
def __init__(self, version, response, solution): <NEW_LINE> <INDENT> super(IpAddressPage, self).__init__(version, response) <NEW_LINE> self._solution = solution
Initialize the IpAddressPage :param Version version: Version that contains the resource :param Response response: Response from the API :param account_sid: The account_sid :param ip_access_control_list_sid: The ip_access_control_list_sid :returns: IpAddressPage :rtype: IpAddressPage
625941df15fb5d323cde0e79
def test_generate_excel_file(self): <NEW_LINE> <INDENT> headers = UserHelpers.create_authentication_header(self.token) <NEW_LINE> headers['HTTP_CONTENT_DISPOSITION'] = 'attachment;filename="excel.xlsx"' <NEW_LINE> params = "?trigger=all&location=test" <NEW_LINE> ctype = ('application/vnd.openxmlformats-officedocument.'...
PUT an excel file, retrieve backdoored file
625941dfb7558d58953c5273
def novosibirsk(x, peak, width, tail): <NEW_LINE> <INDENT> x = np.asarray(x, dtype=float) <NEW_LINE> lnArg = 1.0 - (x - peak) * tail / width <NEW_LINE> log = np.ma.log(lnArg) <NEW_LINE> sigmaZero2 = _sigmaZero(tail) ** 2 <NEW_LINE> exponent = -0.5 / sigmaZero2 * log ** 2 - 0.5 * sigmaZero2 <NEW_LINE> return np.where(ln...
Novosibirsk function See H. Ikeda et al. / Nuclear Instruments and Methods in Physics Research A 441 (2000) 401-426
625941df4f88993c3716c3c9
def Cast(self,data,target): <NEW_LINE> <INDENT> pass
Cast(self: GH_UVIntervalHint,data: object) -> (bool,object)
625941df63f4b57ef0001475
def get(self): <NEW_LINE> <INDENT> if not self.__in.empty(): <NEW_LINE> <INDENT> return self.__out[-1]
Извлекает из очереди информацию.
625941df460517430c3944e1
def load_from_files(self): <NEW_LINE> <INDENT> if (not self.name is None and not self.importPath is None): <NEW_LINE> <INDENT> train_x = np.load(os.path.join(self.importPath,"x_train_"+ self.name + ".npy")) <NEW_LINE> train_y = np.load(os.path.join(self.importPath, "y_train_"+ self.name + ".npy")) <NEW_LINE> test_x = ...
loads images from previously preprocessed files. :return: a treplet of ( train_x, train_y, test_dic )
625941df44b2445a339323f8
def mvn_plot_contours(z, label=False, ax=None): <NEW_LINE> <INDENT> sess = ed.get_session() <NEW_LINE> mu = sess.run(z.mu) <NEW_LINE> mu_x, mu_y = mu <NEW_LINE> Sigma = sess.run(z.sigma) <NEW_LINE> sigma_x, sigma_y = np.sqrt(Sigma[0, 0]), np.sqrt(Sigma[1, 1]) <NEW_LINE> xmin, xmax = mu_x - 3 * sigma_x, mu_x + 3 * sigma...
Plot the contours of 2-d Normal or MultivariateNormalFull object. Scale the axes to show 3 standard deviations.
625941df1f5feb6acb0c4eaf
def excels_to_df(path, col_type='str', show=True): <NEW_LINE> <INDENT> df = pd.DataFrame() <NEW_LINE> excels = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and (f[-4:] == 'xlsx')] <NEW_LINE> for excel in excels: <NEW_LINE> <INDENT> if show: <NEW_LINE> <INDENT> print(excel) <NEW_LINE> <DEDENT> e...
将路径中所有excel文件的所有sheet工作表合并成一个DataFrame :param path: str, Excel文件所在路径,如d:/folder_name/ :param col_type: str or dict, 各字段数据类型 :param show: boolean, 是否打印过程 :return: DataFrame
625941df4527f215b584c7b8
def test_utc_conversion(self): <NEW_LINE> <INDENT> class TZ(tzinfo): <NEW_LINE> <INDENT> def utcoffset(self, dt): <NEW_LINE> <INDENT> return timedelta(minutes=+3) <NEW_LINE> <DEDENT> <DEDENT> q = Query({'hostname': 'test0'}, ['last_edited']) <NEW_LINE> s = q.get() <NEW_LINE> s['last_edited'] = datetime(1970, 1, 1, 0, 3...
Ensure datetimes are converted to UTC Users can pass datetimes in any timezone they want. Serveradmin will transform them to UTC and only ever return them in UTC form.
625941df16aa5153ce3627dc
def _search_bit_strings_for_merging(state_dict): <NEW_LINE> <INDENT> dif_qubits = [] <NEW_LINE> dif_values = [] <NEW_LINE> b_strings1 = b_strings2 = list(state_dict.keys()) <NEW_LINE> bitstr1 = None <NEW_LINE> bitstr2 = None <NEW_LINE> if len(b_strings1) == 2: <NEW_LINE> <INDENT> bit, t_0, t_1 = _maximizing_difference_...
Searches for the states described by the bit strings bitstr1 and bitstr2 to be merged Args: state_dict: A dictionary with the non-zero amplitudes associated to their corresponding binary strings as keys e.g.: {'001': <value>, '101': <value>} Returns: bitstr1: First binary string bitstr2: Second bina...
625941df0fa83653e465731d
def homogenize_pop(df, uid_cols=['registry_index', 'year_id', 'sex_id', 'age_group_id']): <NEW_LINE> <INDENT> mean_pop = df.groupby(uid_cols, as_index=False)['pop'].mean() <NEW_LINE> df = df.drop(labels=['pop'], axis=1, errors='ignore') <NEW_LINE> output = df.merge(mean_pop, how='left') <NEW_LINE> assert len(df) == len...
Returns a dataset with population homogenized by the uid_cols. Replaces population values with the mean population for each uid set Establishes consistency and fills some missing values
625941dfb57a9660fec33bed
def do_POST(self): <NEW_LINE> <INDENT> self.send_response(200) <NEW_LINE> print('Post request handled: ' + self.path) <NEW_LINE> return
Handle POST.
625941df627d3e7fe0d691b6
def test_delete_topic(self): <NEW_LINE> <INDENT> url = '/topics/' <NEW_LINE> response = self.client.post('/accounts/login/', {'username':'shakespeare', 'password':'anne'}) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> response = self.client.get(url, {"name":"testTopic"}, format = 'json') <NEW_LINE> ...
Trying to delete a topic with login creds should pass
625941df7c178a314d6ef7ca
def solve(tc): <NEW_LINE> <INDENT> parse_tc(tc) <NEW_LINE> len_pancake = len(tc.pancake) <NEW_LINE> pos = 0 <NEW_LINE> flip_count = 0 <NEW_LINE> while pos <= len_pancake - tc.flip_size: <NEW_LINE> <INDENT> if tc.pancake[pos] != '+': <NEW_LINE> <INDENT> flip_cake(tc.pancake, pos, tc.flip_size) <NEW_LINE> flip_count += 1...
Input: Test Case Return: None
625941df24f1403a92600ec8
def new_item_edit(self, bag, do_import): <NEW_LINE> <INDENT> logging.debug("New item edit dialog") <NEW_LINE> row = bag.currentRow() <NEW_LINE> column = bag.currentColumn() <NEW_LINE> current = bag.currentItem() <NEW_LINE> item = saves.empty_slot() <NEW_LINE> valid_slot = (type(current) is not QTableWidgetItem and curr...
Display a new item edit dialog using the select cell in a given bag.
625941df3cc13d1c6d3c76de
def read_CanFailDataSources(self, attr): <NEW_LINE> <INDENT> self.debug_stream("In read_CanFailDataSources()") <NEW_LINE> attr.set_value(self.__stg.canfaildatasources or "")
Read CanFailDataSources attribute :param attr: read attribute :type attr: :class:`PyTango.Attribute`
625941df23e79379d52ee8c5
def get_attribute(self, locator, name): <NEW_LINE> <INDENT> element = self.get_visible_element(locator) <NEW_LINE> logger.info('get attribute in %s' % locator) <NEW_LINE> return element.get_attribute(name)
获取属性
625941dfd7e4931a7ee9e283
def set_placeholder(self, placeholder=None): <NEW_LINE> <INDENT> if placeholder and self.selected is None: <NEW_LINE> <INDENT> self.placeholder = placeholder <NEW_LINE> self.bt_dropdown.setText(self.placeholder) <NEW_LINE> self.bt_dropdown.setStyleSheet(button_dropdown_placeholder_stylesheet)
Reset la valeur de la dropdown :param placeholder: La valeur intiale de la dropdown
625941df1d351010ab855e80
def test_wrong_trace_id_message(self): <NEW_LINE> <INDENT> tr, paz = _get_sample_data() <NEW_LINE> inv = read_inventory(os.path.join(self.path, 'IUANMO.xml')) <NEW_LINE> st = Stream([tr]) <NEW_LINE> ppsd = PPSD(tr.stats, inv) <NEW_LINE> with warnings.catch_warnings(record=True) as w: <NEW_LINE> <INDENT> warnings.simple...
Test that we get the expected warning message on waveform/metadata mismatch.
625941dffb3f5b602dac39fc
def menuItem(*args): <NEW_LINE> <INDENT> debugAll(not mel.eval('%s = %s' % (kGlobalAPIDebug, kGlobalAPIDebug)))
A function to call debugAll() from a menu item.
625941dfa934411ee37519f9
def kc_callback(option, opt_str, value, parser): <NEW_LINE> <INDENT> if ',' in value: <NEW_LINE> <INDENT> value_str = value.split(',') <NEW_LINE> for s in value_str: <NEW_LINE> <INDENT> val = int(s, 16) <NEW_LINE> if val < 0 or val > 255: <NEW_LINE> <INDENT> parser.error("Invalid Kc % s\n" % s) <NEW_LINE> <DEDENT> kc.a...
Callback function that parses Kc
625941df1b99ca400220ae17
def test_find_with_first_word_not_in_word_list(self): <NEW_LINE> <INDENT> word_path = WordPath() <NEW_LINE> with mock.patch('wp.main.open', create_mock_open(file_text='\n'.join(['one', 'two', 'three']))): <NEW_LINE> <INDENT> word_path.load_word_list('test', 3) <NEW_LINE> <DEDENT> with self.assertRaises(WordNotInWordLis...
Ensure that find method throw an exception if first word is not present on WordPath.word_list
625941dfde87d2750b8600fa
def update(self, z, R=None, H=None): <NEW_LINE> <INDENT> if H is None: <NEW_LINE> <INDENT> H = self.H <NEW_LINE> <DEDENT> for i, f in enumerate(self.filters): <NEW_LINE> <INDENT> f.update(z, R, H) <NEW_LINE> self.p[i] *= f.likelihood <NEW_LINE> <DEDENT> self.p /= sum(self.p) <NEW_LINE> self.P = np.zeros(self.filters[0]...
Add a new measurement (z) to the Kalman filter. If z is None, nothing is changed. Parameters ---------- z : np.array measurement for this update. R : np.array, scalar, or None Optionally provide R to override the measurement noise for this one call, otherwise self.R will be used. H : np.array, or None...
625941df8a43f66fc4b543c6
def swapBuffers(self): <NEW_LINE> <INDENT> pass
swapBuffers(self)
625941df3539df3088e2e6af
def template_info(source): <NEW_LINE> <INDENT> mixin=feedparser._FeedParserMixin <NEW_LINE> mixin._start_planet_source = mixin._start_source <NEW_LINE> mixin._end_planet_source = new.instancemethod(_end_planet_source, None, mixin) <NEW_LINE> data=feedparser.parse(source) <NEW_LINE> del mixin._start_planet_source...
get template information from a feedparser output
625941df5166f23b2e1a54be
def compress_ip(ip): <NEW_LINE> <INDENT> return str(IP(str(ip)).strCompressed())
Compress IPv6 addresses
625941df29b78933be1e5a0c
def file_strip_ext(afile, skip_version=False, only_known_extensions=False, allow_subformat=True): <NEW_LINE> <INDENT> import os <NEW_LINE> afile = afile.split(';') <NEW_LINE> if len(afile)>1 and allow_subformat and not afile[-1].isdigit(): <NEW_LINE> <INDENT> afile = afile[0:-1] <NEW_LINE> <DEDENT> if len(afile)>1 and ...
Strip in the best way the extension from a filename. >>> file_strip_ext("foo.tar.gz") 'foo' >>> file_strip_ext("foo.buz.gz") 'foo.buz' >>> file_strip_ext("foo.buz") 'foo' >>> file_strip_ext("foo.buz", only_known_extensions=True) 'foo.buz' >>> file_strip_ext("foo.buz;1", skip_version=False, ... only_known_extensions=Tr...
625941df8da39b475bd652dc
def set_pose(self, pose, override_initial=False): <NEW_LINE> <INDENT> pos = pose.position <NEW_LINE> quat = pose.quaternion <NEW_LINE> pb.resetBasePositionAndOrientation(self.__bulletId, pos, quat, physicsClientId=self.__client_id) <NEW_LINE> self.__last_sim_pose_update = -1 <NEW_LINE> if override_initial: <NEW_LINE> ...
Sets the current pose of the object. :param pose: Pose to set the object to. :type pose: Frame :param override_initial: Additionally set the given pose as initial pose. :type override_initial: bool
625941df090684286d50f04f
def debug(flag=None): <NEW_LINE> <INDENT> if flag is not None: <NEW_LINE> <INDENT> ez_env.debug = flag <NEW_LINE> <DEDENT> return ez_env.debug
get or set debug flag :param flag: :return:
625941dfb5575c28eb68e368
def segment_angle_map(needed_number_of_axis): <NEW_LINE> <INDENT> closure_guard, norm = 0, 360 <NEW_LINE> if needed_number_of_axis == 1: <NEW_LINE> <INDENT> return [(closure_guard, norm, norm)] <NEW_LINE> <DEDENT> angle_per_sect = norm / needed_number_of_axis <NEW_LINE> signed_correct_axis_shift = -angle_per_sect / 2 <...
return map of clockwise allocated angles for the needed axis segments from imagefilledarc: 0 degrees is located at the three-oclock position, ... and the arc is drawn clockwise. but we want one $angleMid allways point to 12 oclock, the rest ... determined by $neededNumberOfAxis and remember, we want the axis to point a...
625941df3617ad0b5ed6825b
def mknod_chrdev(name, major, minor, user=None, group=None, mode='0660'): <NEW_LINE> <INDENT> name = os.path.expanduser(name) <NEW_LINE> ret = {'name': name, 'changes': {}, 'comment': '', 'result': False} <NEW_LINE> log.debug('Creating character device name:%s major:%s minor:%s mode:%s', name, major, minor, mode) <NEW_...
.. versionadded:: 0.17.0 Create a character device. CLI Example: .. code-block:: bash salt '*' file.mknod_chrdev /dev/chr 180 31
625941dfbe8e80087fb20fa3
def SetAGWWindowStyleFlag(self, agwStyle): <NEW_LINE> <INDENT> if self._main_win: <NEW_LINE> <INDENT> self._main_win.SetAGWWindowStyleFlag(agwStyle) <NEW_LINE> <DEDENT> tmp = self._agwStyle <NEW_LINE> self._agwStyle = agwStyle <NEW_LINE> if abs(agwStyle - tmp) & TR_NO_HEADER: <NEW_LINE> <INDENT> self.DoHeaderLayout()
Sets the window style for :class:`HyperTreeList`. :param `agwStyle`: can be a combination of various bits. See :mod:`~wx.lib.agw.hypertreelist` for a full list of flags. :note: Please note that some styles cannot be changed after the window creation and that `Refresh()` might need to be be called after changing the...
625941df7b25080760e397bd
def check_config(config_obj): <NEW_LINE> <INDENT> msg = "{: <20} {: <30} {: <60}" <NEW_LINE> errors = [] <NEW_LINE> warnings = [] <NEW_LINE> mcfg = config_obj.mcfg.cfg <NEW_LINE> cfg = config_obj.cfg <NEW_LINE> all_checks = get_merged_checkers(config_obj) <NEW_LINE> for s, configured in cfg.items(): <NEW_LINE> <INDENT>...
Looks at the users provided config file and checks it to a master config file looking at correctness and missing info. Args: config_obj - UserConfig object produced by :class:`~inicheck.config.UserConfig` Returns: tuple: - **warnings** - Returns a list of string messages that are ...
625941dfa79ad161976cc4ab
def find_output_path_for_type(self, any_type: pydsdl.Any) -> pathlib.Path: <NEW_LINE> <INDENT> if isinstance(any_type, Namespace): <NEW_LINE> <INDENT> return any_type._output_path <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._data_type_to_outputs[any_type] <NEW_LINE> <DEDENT> excep...
Searches the entire namespace tree to find a mapping of the type to an output file path. :param Any any_type: Either a Namespace or pydsdl.CompositeType to find the output path for. :return: The path where a file will be generated for a given type. :raises KeyError: If the type was not found in th...
625941dfe5267d203edcdffe
def createEdge(self, src, dst): <NEW_LINE> <INDENT> p_src = Port({"index": str(len(src.ports)) }) <NEW_LINE> p_dst = Port({"index": str(len(dst.ports)) }) <NEW_LINE> p_src.address.address = self.subnet.format(*self._nextaddr()) <NEW_LINE> p_src.address.type = "ipv4" <NEW_LINE> p_dst.address.address = self.subnet.format...
:param src: Vertex on the ingress side of the edge. :param dst: Vertex on the egress side of the edge. :type src: :class:`Node <unis.models.models.UnisObject>` :type dst: :class:`Node <unis.models.models.UnisObject>` Adds an edge between two :class:`Nodes <unis.models.models.UnisObject>`.
625941df2ae34c7f2600d496
def getMaxFlow(self): <NEW_LINE> <INDENT> maxFlow = 0 <NEW_LINE> maxNode = None <NEW_LINE> for r in range(self.getRows()): <NEW_LINE> <INDENT> for c in range(self.getCols()): <NEW_LINE> <INDENT> if self._data[r,c]._flow > maxFlow: <NEW_LINE> <INDENT> maxFlow = self._data[r,c]._flow <NEW_LINE> maxNode = self._data[r,c] ...
extract the node with greatest flow value
625941dfd268445f265b51d4
def __migration_read_state(self): <NEW_LINE> <INDENT> LOG.info("LVNF %s migration: read state." % self.lvnf_id) <NEW_LINE> for handler in self.image.state_handlers: <NEW_LINE> <INDENT> LOG.info("LVNF %s migration: reading %s" % (self.lvnf_id, handler)) <NEW_LINE> func = getattr(self, handler) <NEW_LINE> module = func(c...
Read this LVNF state.
625941df01c39578d7e751a1
def translate(string): <NEW_LINE> <INDENT> output = "" <NEW_LINE> for index, part in enumerate(re.split(r"(%\([^\)]+\)?.|\%[^\(])", string)): <NEW_LINE> <INDENT> if index % 2 == 0: <NEW_LINE> <INDENT> output += translate_subpart(part) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> output += part <NEW_LINE> <DEDENT> <DED...
Takes a string that is to be translated and returns the translated string, doesn't translate the %(format)s parts, they must remain the same text as the msgid
625941dfd4950a0f3b08c6b0
@cli.command(name="token-status") <NEW_LINE> @click.option('--address', required=True, help="Token contract addrss") <NEW_LINE> @click.pass_obj <NEW_LINE> def status(config: BoardCommmadConfiguration, address): <NEW_LINE> <INDENT> logger = config.logger <NEW_LINE> assert is_ethereum_network(config.network) <NEW_LINE> f...
Print token contract status.
625941dfa17c0f6771cbe3b5
@register.inclusion_tag('uw_forms/file_list.html') <NEW_LINE> def show_files(can_add, can_edit, view_deleted, formset=None): <NEW_LINE> <INDENT> if formset: <NEW_LINE> <INDENT> return { 'can_add': can_add, 'can_edit': can_edit, 'view_deleted': view_deleted, 'forms': formset.forms } <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
Displays the list of associated files for an InventoryItem Positional arguments: can_add -- True if the currently logged-in user is allowed to upload files can_edit -- True if the currently logged-in user is allowed to edit file properties view_deleted -- True if the current...
625941df07f4c71912b117ea
def range_search(self, c_range, draw): <NEW_LINE> <INDENT> points = [] <NEW_LINE> if not self.rect.intersects(c_range): <NEW_LINE> <INDENT> return points <NEW_LINE> <DEDENT> for point in self.points: <NEW_LINE> <INDENT> if c_range.contains(point): <NEW_LINE> <INDENT> draw(point) <NEW_LINE> points.append(point) <NEW_LIN...
Search for all points in given c_range :param c_range: :param draw: Function for drawing point classified within c_range. :return:
625941df009cb60464c63715
def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None
PayloadType - a model defined in OpenAPI
625941df63d6d428bbe44855
def _SendLocalStatusMsg(self, msg): <NEW_LINE> <INDENT> PtSendKIMessage(kKILocalChatStatusMsg, msg)
Sends a status chat message (purple text) to the local player's KI.
625941df6fece00bbac2daa7
def test_treefactorial(): <NEW_LINE> <INDENT> assert treefactorial.factorial(0) == 1 <NEW_LINE> assert treefactorial.factorial(1) == 1 <NEW_LINE> assert treefactorial.factorial(2) == 2 <NEW_LINE> assert treefactorial.factorial(3) == 6 <NEW_LINE> assert treefactorial.factorial(4) == 24 <NEW_LINE> assert treefactorial.fa...
Test treefactorial with pytest.
625941dfd8ef3951e32438a3
@require(msgid=int) <NEW_LINE> def grib_get_message_size(msgid): <NEW_LINE> <INDENT> err, value = _internal.grib_c_get_message_size(msgid) <NEW_LINE> GRIB_CHECK(err) <NEW_LINE> return value
@brief Get the size of a coded message. @param msgid id of the message loaded in memory @return size in bytes of the message @exception GribInternalError
625941df56b00c62f0f149c1
def focus_previous_child(self): <NEW_LINE> <INDENT> self.focus_target().focusPreviousChild()
Give focus to the previous widget in the focus chain.
625941dfd99f1b3c44c678ef
def get_activated(self): <NEW_LINE> <INDENT> return self.__inhibition_activated
Returns True if inhibition was manually activated.
625941df4f6381625f114da1
def get_store_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> all_params = [] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> params = locals() <NEW_LINE> for ...
Returns a description of the store This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_store_with_http_info(c...
625941dfd53ae8145f87a5cf
def rgb_max(frame): <NEW_LINE> <INDENT> pass
for each pixel in the frame max out the color channel with the highest value and and zero out the other color channels.
625941df99fddb7c1c9de6f5
def search_dataset_data(self, request, **kwargs): <NEW_LINE> <INDENT> dataset = Dataset.objects.get(slug=kwargs['dataset_slug']) <NEW_LINE> try: <NEW_LINE> <INDENT> query = '(%s)' % request.GET['q'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> query = '' <NEW_LINE> <DEDENT> since = request.GET.get('since', ...
Perform a full-text search on only one dataset. See ``get_list``.
625941dfeab8aa0e5d26debf
def _handle_hidden_tables(tbl_list, attr_name, displayed_only=True): <NEW_LINE> <INDENT> if not displayed_only: <NEW_LINE> <INDENT> return tbl_list <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [ x for x in tbl_list if "display:none" not in getattr(x, attr_name).get("style", "").replace(" ", "") ]
Return list of tables, potentially removing hidden elements Parameters ---------- tbl_list : list of node-like Type of list elements will vary depending upon parser used attr_name : str Name of the accessor for retrieving HTML attributes Returns ------- list of node-like Return type matches `tbl_list`
625941df925a0f43d254a1df
def set_start_cluster(self, start_cluster: int) -> None: <NEW_LINE> <INDENT> self.start_cluster = start_cluster
set the start cluster id :param start_cluster: int, start cluster of the hidden data
625941df5510c4643540f741
def spin_wigner(rho, theta, phi): <NEW_LINE> <INDENT> if rho.type == 'bra': <NEW_LINE> <INDENT> rho = rho.dag() <NEW_LINE> <DEDENT> if rho.type == 'ket': <NEW_LINE> <INDENT> rho = ket2dm(rho) <NEW_LINE> <DEDENT> J = rho.shape[0] <NEW_LINE> j = (J - 1) / 2 <NEW_LINE> THETA, PHI = meshgrid(theta, phi) <NEW_LINE> W = np.z...
Wigner function for spins on the Bloch sphere. Parameters ---------- state : qobj A state vector or density matrix for a spin-j quantum system. theta : array_like theta-coordinates at which to calculate the Q function. phi : array_like phi-coordinates at which to calculate the Q function. Returns ------- ...
625941df8e7ae83300e4b333
def unique_rule(self, field, values): <NEW_LINE> <INDENT> if self.input.get(field): <NEW_LINE> <INDENT> table, col, *extra = values[0].split(',') <NEW_LINE> msg = error_messages.UNIQUE_ERROR.format(field) <NEW_LINE> ignoreCol = extra[0] if len(extra) > 0 else None <NEW_LINE> ignoreVal = extra[1] if len(extra) > 1 else ...
Unique database record
625941dfbf627c535bc13535
def get_ids(num_subjects=None, short=True): <NEW_LINE> <INDENT> if short: <NEW_LINE> <INDENT> subject_IDs = np.loadtxt(os.path.join(root_folder, 'subject_IDs.txt'), dtype=int) <NEW_LINE> subject_IDs = subject_IDs.astype(str) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> subject_IDs = np.loadtxt(os.path.join(root_folder...
num_subjects : number of subject IDs to get short : True of False, specifies whether to get short or long subject IDs return: subject_IDs : list of subject IDs (length num_subjects)
625941df8da39b475bd652dd
def _get_course_module(self): <NEW_LINE> <INDENT> field_data_cache = FieldDataCache([self.course], self.course.id, self.user) <NEW_LINE> return get_module_for_descriptor(self.user, MagicMock(), self.course, field_data_cache, self.course.id)
Returns the course module.
625941df4d74a7450ccd452a
def restart_game(self): <NEW_LINE> <INDENT> self.tree.clear_tree()
Restart the game
625941df55399d3f05588a1b
@app.route('/find/', methods=['GET']) <NEW_LINE> def find(): <NEW_LINE> <INDENT> query_string = request.args.get('query') <NEW_LINE> try: <NEW_LINE> <INDENT> obj = search(query_string) <NEW_LINE> <DEDENT> except SQLAlchemyError: <NEW_LINE> <INDENT> return render_template('noresults.html', query=query_string) <NEW_LINE>...
a function to search the database :return: json object with search results
625941dfbaa26c4b54cb1482
def stop(name, quiet=False): <NEW_LINE> <INDENT> data = _do(name, 'stop') <NEW_LINE> if data and not quiet: <NEW_LINE> <INDENT> salt.output.display_output(data, 'lxc_force_off', __opts__) <NEW_LINE> <DEDENT> return data
Stop the named container. .. code-block:: bash salt-run lxc.stop name
625941df26068e7796caf049
def add_async_request(self, method, relative_url, headers, body, source_ip, module_name=None, version=None, instance_id=None): <NEW_LINE> <INDENT> if module_name: <NEW_LINE> <INDENT> _module = self._get_module_with_soft_routing(module_name, version) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _module = self._module_f...
Dispatch an HTTP request asynchronously. Args: method: A str containing the HTTP method of the request. relative_url: A str containing path and query string of the request. headers: A list of (key, value) tuples where key and value are both str. body: A str containing the request body. source_ip: The source ...
625941dfe8904600ed9f2297
@tooled <NEW_LINE> def command_html(): <NEW_LINE> <INDENT> researchers: Option & ResearchersFile = default(None) <NEW_LINE> collection: Option = default(None) <NEW_LINE> if collection: <NEW_LINE> <INDENT> collection = PapersFile(collection, researchers=researchers) <NEW_LINE> <DEDENT> headers: Option & normalize = defa...
Generate html entries for a search.
625941df50812a4eaa59c684
def info_with_tree_conflicts(sbox): <NEW_LINE> <INDENT> svntest.actions.build_greek_tree_conflicts(sbox) <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> G = os.path.join(wc_dir, 'A', 'D', 'G') <NEW_LINE> scenarios = [ ('pi', 'edit', 'delete'), ('rho', 'delete', 'edit'), ('tau', 'delete', 'delete'), ] <NEW_LINE> for fname...
info with tree conflicts
625941df5fc7496912cc3ce4
def click(x, y): <NEW_LINE> <INDENT> log.debug("Clicking at (%d,%d) -> Actual (%d,%d) ", x - Globals.X_GAME , y - Globals.Y_GAME, x, y) <NEW_LINE> pyautogui.click(x, y)
Clicks left click one time Args: x (int): x to click y (int): y to click
625941df627d3e7fe0d691b7
def check_swig(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> run(['swig', '-version'], checkret = False) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> fatal(SWIG_MSG) <NEW_LINE> <DEDENT> if not 'SWIG_LIB' in os.environ: <NEW_LINE> <INDENT> fatal("ERROR: no SWIG_LIB\n" "please set SWIG_LIB in your environm...
Checks for the correct version of SWIG.
625941df9b70327d1c4e113c
def __init__(self, hidden_dims, input_dim=3*32*32, num_classes=10, dropout=0, use_batchnorm=False, reg=0.0, weight_scale=1e-2, dtype=np.float32, seed=None): <NEW_LINE> <INDENT> self.use_batchnorm = use_batchnorm <NEW_LINE> self.use_dropout = dropout > 0 <NEW_LINE> self.reg = reg <NEW_LINE> self.num_layers = 1 + len(hid...
Initialize a new FullyConnectedNet. Inputs: - hidden_dims: A list of integers giving the size of each hidden layer. - input_dim: An integer giving the size of the input. - num_classes: An integer giving the number of classes to classify. - dropout: Scalar between 0 and 1 giving dropout strength. If dropout=0 then th...
625941dfe64d504609d74ba6
def clearAll(self): <NEW_LINE> <INDENT> self.clearLineStationInfo() <NEW_LINE> self.setOrdinateRuler(None) <NEW_LINE> self._trains = [] <NEW_LINE> self._circuits = [] <NEW_LINE> self.typeList = [] <NEW_LINE> self.fullCheciMap = {} <NEW_LINE> self.singleCheciMap = {} <NEW_LINE> self._markdown = '' <NEW_LINE> self.filena...
清空所有数据
625941df0a366e3fb873eb83
def is_a_threat(self, precondition, effect): <NEW_LINE> <INDENT> if (str(effect.op) == 'Not' + str(precondition.op)) or ('Not' + str(effect.op) == str(precondition.op)): <NEW_LINE> <INDENT> if effect.args == precondition.args: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Check if effect is a threat to precondition
625941df1d351010ab855e81
def validate_update(self, document: dict) -> dict: <NEW_LINE> <INDENT> value = document.get(self.name) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> if not self._is_nullable_on_update: <NEW_LINE> <INDENT> return {self.name: ["Missing data for required field."]} <NEW_LINE> <DEDENT> return {} <NEW_LINE> <DEDENT> retur...
Validate this field for a document update request. :param document: Updated version (partial) of a Mongo document. Each entry if composed of a field name associated to a value. This field might not be in it. :return: Validation errors that might have occurred on this field. Empty if no error occurred. Entry would be c...
625941df76d4e153a657ee98
def deprecated(func=None, message=None, since=None, what=None, frame_correction=0): <NEW_LINE> <INDENT> if isinstance(func, string_types): <NEW_LINE> <INDENT> assert message is None <NEW_LINE> message = func <NEW_LINE> func = None <NEW_LINE> <DEDENT> if func is None: <NEW_LINE> <INDENT> return functools.partial( deprec...
Marks the specified function as deprecated, and emits a warning when it's called
625941df5f7d997b87174e01
def set_CallbackURL(self, value): <NEW_LINE> <INDENT> super(RevokeSubscriptionInputSet, self)._set_input('CallbackURL', value)
Set the value of the CallbackURL input for this Choreo. ((required, string) The URL used when subscribing to the notification service.)
625941dfcdde0d52a9e5339b
def adjust(orig, fill_value): <NEW_LINE> <INDENT> fill_dims = orig.get_shape().as_list()[1:] <NEW_LINE> dtype = orig.dtype.as_numpy_dtype <NEW_LINE> parts = [] <NEW_LINE> const_orig = tensor_util.constant_value(orig) <NEW_LINE> const_or_orig = const_orig if const_orig is not None else orig <NEW_LINE> prev_spatial_dim =...
Returns an `adjusted` version of `orig` based on `spatial_dims`. Tensor of the same type as `orig` and with shape `[max(spatial_dims), ...]` where: adjusted[spatial_dims[i] - 1, ...] = orig[i, ...] for 0 <= i < len(spatial_dims), and adjusted[j, ...] = fill_value for j != spatial_dims[i] - 1 for some i. If `o...
625941df55399d3f05588a1c
def generate_passwords(count,length): <NEW_LINE> <INDENT> passwords = [] <NEW_LINE> for x in range(count): <NEW_LINE> <INDENT> passwords.append(generate_password(length)) <NEW_LINE> <DEDENT> return passwords
Функция-генератор паролей, на вход получает количсетво паролей и их длину, через цикл вывзывает вспомогательную функцию.
625941df4a966d76dd551378
def test_get_tweets(): <NEW_LINE> <INDENT> get_tweets = Api.get_reversed().get_tweets <NEW_LINE> tweets = get_tweets(where=['Dublin'], lang=['en'], pages=1) <NEW_LINE> assert isinstance(tweets, types.GeneratorType) <NEW_LINE> tweets = tuple(tweets) <NEW_LINE> assert len(tweets) <NEW_LINE> for tweet in tweets: <NEW_LINE...
Test if get_tweets generator actually generate some tweets.
625941df2ae34c7f2600d497
def test_pdns_reverse_query(command_line_args): <NEW_LINE> <INDENT> response = robtex_python.pdns_reverse(command_line_args['ip']) <NEW_LINE> assert len(response) > 1 <NEW_LINE> assert response[0]['rrdata'] == command_line_args['ip']
Test the pdns reverse query.
625941df1f037a2d8b946563
def compute_features(images): <NEW_LINE> <INDENT> params = None <NEW_LINE> return np.array([ image2features(images[i,:], params) for i in range(images.shape[0]) ])
Computes the features for a list of images.
625941dfd58c6744b4257fc4
def rawlink(self, callback): <NEW_LINE> <INDENT> with self._condition: <NEW_LINE> <INDENT> if self.ready(): <NEW_LINE> <INDENT> self._handler.completion_queue.put( lambda: callback(self) ) <NEW_LINE> return <NEW_LINE> <DEDENT> if callback not in self._callbacks: <NEW_LINE> <INDENT> self._callbacks.append(callback)
Register a callback to call when a value or an exception is set
625941df8a349b6b435e84d9
def test_str_return_uuid(self): <NEW_LINE> <INDENT> img = UploadedImage() <NEW_LINE> img.save() <NEW_LINE> uuid = img.__str__() <NEW_LINE> self.assertTrue(is_valid_uuid(uuid))
Assert that image model __str__ method returns uuid
625941df187af65679ca5486
def _add_example(self, example): <NEW_LINE> <INDENT> if len(example.fields) != 1: <NEW_LINE> <INDENT> raise InvalidSpec( 'Example for union must specify exactly one tag.', example.lineno, example.path) <NEW_LINE> <DEDENT> example_field = list(example.fields.values())[0] <NEW_LINE> tag = example_field.name <NEW_LINE> fo...
Adds a "raw example" for this type. This does basic sanity checking to ensure that the example is valid (required fields specified, no unknown fields, correct types, ...). The example is not available via :meth:`get_examples` until :meth:`_compute_examples` is called. Args: example (stone.stone.parser.StoneExamp...
625941df046cf37aa974d0ab
def access(sandbox_name, asset_ids): <NEW_LINE> <INDENT> result = util.oauthgetm("%s/%s" % ('sandbox', 'access'), {'sandbox':sandbox_name, 'id':asset_ids}) <NEW_LINE> return result['response']['assets']
Returns a list of assets with expiring access urls that can be used to download them *Requires Oauth* Args: sandbox_name (str): A string representing the name of the sandbox asset_ids (list): A list of asset_ids (str) to fetch Kwargs: Returns: A list of asset dictionaries Example: >>> sandbox.acces...
625941df26238365f5f0f1d9
def hexstring_to_binstring(string): <NEW_LINE> <INDENT> return "".join(map(chr, map(lambda x: int(x, 16), string.split())))
Take an hexstring (such as the output of Wireshark withough the offset) and returns a binary string
625941dfd8ef3951e32438a4
def main(): <NEW_LINE> <INDENT> args = read_args() <NEW_LINE> connection = ClientConnection(args.addr, args.port) <NEW_LINE> client = QtClient(connection, QtClientView) <NEW_LINE> client.run() <NEW_LINE> client.close("Good Bye!")
Точка входа
625941dfb7558d58953c5274
def cmd(self, cmd, prefix=''): <NEW_LINE> <INDENT> s = prefix+' mongo -host {0.host} '+cmd <NEW_LINE> return env.doit((s.format(self)) % env)
Send command to mongo.
625941df4a966d76dd551379
def copyRequestedFrom (self, other): <NEW_LINE> <INDENT> if self.isOpValueDRequested(): <NEW_LINE> <INDENT> self.opValueD=other.opValueD <NEW_LINE> self._myHasOpValueD=other._myHasOpValueD <NEW_LINE> self._myOpValueDRequested=other._myOpValueDRequested
This method will copy from other only the leaves & descendant that are requested in ***self***
625941dfa05bb46b383ecb86
def start(self): <NEW_LINE> <INDENT> self._listen() <NEW_LINE> self._register() <NEW_LINE> try: <NEW_LINE> <INDENT> while self.active: <NEW_LINE> <INDENT> self.accept() <NEW_LINE> <DEDENT> <DEDENT> except EOFError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> except KeyboardInterrupt: <NEW_LINE> <INDENT> print("") <NEW...
Starts the server (blocking). Use :meth:`close` to stop
625941df30c21e258bdfa806
def create_node(self, name, numExecutors=2, nodeDescription=None, remoteFS='/var/lib/jenkins', labels=None, exclusive=False, launcher='hudson.slaves.JNLPLauncher', launcher_params={}): <NEW_LINE> <INDENT> if self.node_exists(name): <NEW_LINE> <INDENT> raise JenkinsException('node[%s] already exists' % (name)) <NEW_LINE...
@param name: name of node to create @type name: str @param numExecutors: number of executors for node @type numExecutors: int @param nodeDescription: Description of node @type nodeDescription: str @param remoteFS: Remote filesystem location to use @type remoteFS: str @param labels: Labels to associate with node @ty...
625941df0c0af96317bb854e
def update_data(self, data): <NEW_LINE> <INDENT> self._raw_state_data.update(data)
Updates the state data.
625941dffff4ab517eb2f7a4
def reset(self): <NEW_LINE> <INDENT> if self.was_real_done: <NEW_LINE> <INDENT> obs = self.env.reset() <NEW_LINE> self.was_realreset = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> obs, _, _, _ = self.env.step(0) <NEW_LINE> self.was_realreset = False <NEW_LINE> <DEDENT> self.lives = self.env.unwrapped.ale.lives() ...
Reset only when lives are exhausted. This way all states are still reachable even though lives are episodic, and the learner need not know about any of this behind-the-scenes.
625941df63f4b57ef0001477
def _resolve_output(self, out: DataFrame, obj: DataFrame) -> DataFrame: <NEW_LINE> <INDENT> if out.shape[1] == 0 and obj.shape[1] > 0: <NEW_LINE> <INDENT> raise DataError("No numeric types to aggregate") <NEW_LINE> <DEDENT> elif out.shape[1] == 0: <NEW_LINE> <INDENT> return obj.astype("float64") <NEW_LINE> <DEDENT> sel...
Validate and finalize result.
625941df5fcc89381b1e1a27
def add_postfix(name, plus_str): <NEW_LINE> <INDENT> str_list = name.split('.') <NEW_LINE> if len(str_list) != 2: <NEW_LINE> <INDENT> logger("invalid name") <NEW_LINE> return -1 <NEW_LINE> <DEDENT> prefix_plus_name = str_list[0] + plus_str <NEW_LINE> return prefix_plus_name + '.' + str_list[1]
Add postfix :param name: name[0] + '.' + name[1] :param plus_str: str to add :return name[0] + plus_str + '.' + name[1]
625941df73bcbd0ca4b2c3dd
def ensureDirectoryExists(directory): <NEW_LINE> <INDENT> d = os.path.dirname(directory) <NEW_LINE> if d != "" and not os.path.exists(d): <NEW_LINE> <INDENT> os.makedirs(d)
Check if a directory exists and creates it if not. :param directory: the directory path to check :return: void
625941dfd486a94d0b98e4ad
def save_out_dict_of_dfs(dict_dfs, added_text, subfolder): <NEW_LINE> <INDENT> for key in dict_dfs: <NEW_LINE> <INDENT> export_to_csv(dict_dfs[key], OUTPUTFILESSTORE + subfolder + '/', str(key) + '_' + added_text, False) <NEW_LINE> <DEDENT> return
Save out a dictionary of dataframes to csvs
625941df379a373c97cfaead
def set_family(self, family): <NEW_LINE> <INDENT> self._family = family
Set the route message family. family - integer - the route message type
625941dfe5267d203edcdfff
def run_experiment(m1, m2, m3, upper_limit, N): <NEW_LINE> <INDENT> b1 = Bandit(m1, upper_limit) <NEW_LINE> b2 = Bandit(m2, upper_limit) <NEW_LINE> b3 = Bandit(m3, upper_limit) <NEW_LINE> bandits = [b1, b2, b3] <NEW_LINE> data = np.empty(N) <NEW_LINE> for i in range(N): <NEW_LINE> <INDENT> bandits_means = [bi.mean for ...
m1, m2, m3 = means of the three bandits to be compared N = int, the number of times we pull Returns the cumulative average after every play
625941df76e4537e8c3519dc