code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def qual_name(self, target: str, opts: VimOptions) -> Optional[Tuple[str, str]]: <NEW_LINE> <INDENT> success, locate, _ = self.do_query(f"Locate {target}.", opts=opts) <NEW_LINE> if not success: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> locate = re.sub(r"\n +", " ", locate) <NEW_LINE> match = locate.split("\n...
Find the fully qualified name of 'target' using 'Locate'.
625941f060cbc95b062c6ad7
@_deprecate_positional_args <NEW_LINE> def safe_sparse_dot(a, b, *, dense_output=False): <NEW_LINE> <INDENT> if a.numdims() > 2 or b.numdims() > 2: <NEW_LINE> <INDENT> if sparse.issparse(a): <NEW_LINE> <INDENT> b_ = np.rollaxis(b, -2) <NEW_LINE> b_2d = b_.reshape((b.shape[-2], -1)) <NEW_LINE> ret = a @ b_2d <NEW_LINE> ...
Dot product that handle the sparse matrix case correctly Parameters ---------- a : array or sparse matrix b : array or sparse matrix dense_output : boolean, (default=False) When False, ``a`` and ``b`` both being sparse will yield sparse output. When True, output will always be a dense array. Returns ------- dot...
625941f0dc8b845886cb5aca
@task_or_dryrun <NEW_LINE> def configure(site=None, full=0): <NEW_LINE> <INDENT> full = int(full)
Installs and configures proftpd.
625941f08e05c05ec3eea90d
def set_control_data(self,**kwargs): <NEW_LINE> <INDENT> time=kwargs.get('time',int(0)) <NEW_LINE> name=kwargs.get('name') <NEW_LINE> val=kwargs.get('val') <NEW_LINE> init=kwargs.get('init',int(0)) <NEW_LINE> assert isinstance(time, int), "Argument 'time' should have the type 'int'" <NEW_LINE> if self.DictData is None:...
Method to define event based data value with name, time, and value. Uses a python dictionary instead of a numpy array for more efficient insertions. The 'time' column acts as the dictionary key, the remaining columns are stored as the value. Parameters ---------- **kwargs : time: int, 0 name: str val: type...
625941f03317a56b8693a1de
def get(self): <NEW_LINE> <INDENT> parser = reqparse.RequestParser() <NEW_LINE> parser.add_argument('acctCode', type=str, help='Account number/code to Filter', trim=True, required=False) <NEW_LINE> parser.add_argument('clientId', type=str, help='Client ID to Filter', trim=True, required=False) <NEW_LINE> parser.add_arg...
Use optional filter params in querystring to retrieve execDetails from past 24hrs (IB API limitation): https://www.interactivebrokers.com/en/software/api/apiguide/java/executionfilter.htm
625941f0711fe17d825428f2
def test_distinct_for_non_unique_related_object_in_list_filter(self): <NEW_LINE> <INDENT> parent = Parent.objects.create(name='Mary') <NEW_LINE> Child.objects.create(parent=parent, name='Daniel') <NEW_LINE> Child.objects.create(parent=parent, name='Daniel') <NEW_LINE> m = ParentAdmin(Parent, admin.site) <NEW_LINE> requ...
Regressions tests for #15819: If a field listed in list_filters is a non-unique related object, distinct() must be called.
625941f08e71fb1e9831dd3a
@flag.command("list") <NEW_LINE> @click.option( "--type", "type_", type=FTYPE, metavar="TYPE", default=None, help="Type of flag to list. If not set, list all flags.", ) <NEW_LINE> @click.option( "--time", type=TIMEZONE, default="utc", help="Timezone/format to display times in. UNIX time gives a UNIX time in seconds.", ...
List known revisions of TYPE.
625941f0b5575c28eb68e599
def find_record(species, alignment): <NEW_LINE> <INDENT> for idx, track in enumerate(alignment): <NEW_LINE> <INDENT> if track.name == species: <NEW_LINE> <INDENT> return idx <NEW_LINE> <DEDENT> <DEDENT> sys.stderr.write('Warning, reference species not found.\n') <NEW_LINE> return None
Return the index of the record that is associated with the given species.
625941f0bd1bec0571d90bc3
def convert_date(date_str): <NEW_LINE> <INDENT> return datetime.datetime.strptime(date_str, '%Y-%m-%d').date()
Map string with date to date obj :param date_str: string containing date :rtype: date object
625941f07d43ff24873a3238
def ping(self): <NEW_LINE> <INDENT> if not self.proxy: <NEW_LINE> <INDENT> self.proxy = ALProxy("ALModularity") <NEW_LINE> <DEDENT> return self.proxy.ping()
Just a ping. Always returns true :returns bool: returns true
625941f0a4f1c619b28b05bf
def as_csv(self): <NEW_LINE> <INDENT> import csv <NEW_LINE> import cStringIO <NEW_LINE> out = cStringIO.StringIO() <NEW_LINE> writer = csv.writer(out) <NEW_LINE> self.period = None <NEW_LINE> history = self.make_tables() <NEW_LINE> writer.writerow((_("date and time (UTC)"), _("unique impressions"), _("total impressions...
Return the traffic data in CSV format for reports.
625941f030bbd722463cc35d
@experimental(as_of="0.4.0") <NEW_LINE> def clr(mat): <NEW_LINE> <INDENT> mat = closure(mat) <NEW_LINE> lmat = np.log(mat) <NEW_LINE> gm = lmat.mean(axis=-1, keepdims=True) <NEW_LINE> return (lmat - gm).squeeze()
Performs centre log ratio transformation. This function transforms compositions from Aitchison geometry to the real space. The :math:`clr` transform is both an isometry and an isomorphism defined on the following spaces :math:`clr: S^D \rightarrow U` where :math:`U= \{x :\sum\limits_{i=1}^D x = 0 \; \forall x \in \m...
625941f0dc8b845886cb5acb
def initial_reporting(config, run_tracker): <NEW_LINE> <INDENT> reports_dir = os.path.join(config.getdefault('pants_workdir'), 'reports') <NEW_LINE> link_to_latest = os.path.join(reports_dir, 'latest') <NEW_LINE> run_id = run_tracker.run_info.get_info('id') <NEW_LINE> if run_id is None: <NEW_LINE> <INDENT> raise Report...
Sets up the initial reporting configuration. Will be changed after we parse cmd-line flags.
625941f031939e2706e4d3f5
def debuglevel(self, argv): <NEW_LINE> <INDENT> self._client.debug = int(argv[1])
debuglevel <n> Sets the IMAP client debug level (causes message to print to stdout).
625941f031939e2706e4d3f6
def append_task(self, rule_class, options=None, study_rule_criteria=None): <NEW_LINE> <INDENT> if options is None: <NEW_LINE> <INDENT> options = {} <NEW_LINE> <DEDENT> if study_rule_criteria is None: <NEW_LINE> <INDENT> study_rule_criteria = StudyRuleCriteria() <NEW_LINE> <DEDENT> self.append((rule_class, options, copy...
Append a task to the list. Parameters ---------- rule_class : class Subclass of :class:`Rule`. options : dict A dictionary of options. If None (default), then options will be an empty dictionary, which amounts to using the default options for this voting rule. study_rule_criteria : StudyRuleCriteria If...
625941f0462c4b4f79d1dc63
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.trajectory is None: <NEW_LINE> <INDENT> self.trajectory = trajectory_msgs.msg.JointTrajectory() <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 12 <NEW_LINE> (_x.trajectory.header.seq, _x.trajector...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941f0097d151d1a2233ea
def count_friends(users): <NEW_LINE> <INDENT> import collections <NEW_LINE> from collections import Counter <NEW_LINE> m = Counter() <NEW_LINE> for a in range(len(users)): <NEW_LINE> <INDENT> m.update(users[a]['friends']) <NEW_LINE> <DEDENT> return (m) <NEW_LINE> pass
Count how often each friend is followed. Args: users: a list of user dicts Returns: a Counter object mapping each friend to the number of candidates who follow them. Counter documentation: https://docs.python.org/dev/library/collections.html#collections.Counter In this example, friend '2' is followed by th...
625941f067a9b606de4a844a
def multi_graphics(graphics_list): <NEW_LINE> <INDENT> return MultiGraphics(graphics_list)
Plot a list of graphics at specified positions on a single canvas. If the graphics positions define a regular array, use :func:`graphics_array` instead. INPUT: - ``graphics_list`` -- a list of graphics along with their positions on the canvas; each element of ``graphics_list`` is either - a pair ``(graphics, po...
625941f0cc0a2c11143dd425
def test_optional_key_convert_failed_randomly_while_with_another_optional_object(): <NEW_LINE> <INDENT> import datetime <NEW_LINE> fmt = "%Y-%m-%d %H:%M:%S" <NEW_LINE> _datetime_validator = Or(None, Use(lambda i: datetime.datetime.strptime(i, fmt))) <NEW_LINE> for i in range(1024): <NEW_LINE> <INDENT> s = Schema( { Opt...
In this test, created_at string "2015-10-10 00:00:00" is expected to be converted to a datetime instance. - it works when the schema is s = Schema({ 'created_at': _datetime_validator, Optional(basestring): object, }) - but when wrapping the key 'created_at' ...
625941f099cbb53fe6793178
def detele_host(self,hosts): <NEW_LINE> <INDENT> self.__key.delete_key(hosts) <NEW_LINE> self.log_write(log_content="删除主机%s" % hosts,type='host') <NEW_LINE> return 'OK'
删除一个主机 :param hosts: :return:
625941f091f36d47f21aca8d
def compute_abs_and_rel_distances_from_raw_split(self,distances): <NEW_LINE> <INDENT> result_abs = self.quantise_distances(distances) <NEW_LINE> result_rel = self.compute_rankings(distances) <NEW_LINE> return result_abs,result_rel
:param distances: the raw distances :return: a list of abs and a list of rel distances for each transmitter BUT the ones of the same id
625941f073bcbd0ca4b2c609
def _parse_record_type(self, lexer: TigerLexer) -> RecType: <NEW_LINE> <INDENT> raise NotImplementedError("TODO")
recTy → { fieldDec∗, }
625941f09f2886367277ae1c
def fourSumCount(self, A, B, C, D): <NEW_LINE> <INDENT> ABsum=collections.Counter(a+b for a in A for b in B) <NEW_LINE> count = sum(ABsum[-c-d] for c in C for d in D) <NEW_LINE> return count
:type A: List[int] :type B: List[int] :type C: List[int] :type D: List[int] :rtype: int
625941f0fb3f5b602dac3c2d
def __str__(self): <NEW_LINE> <INDENT> tempstr = "" <NEW_LINE> templist = [] <NEW_LINE> if self.__size == 0: <NEW_LINE> <INDENT> tempstr = "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for i in range(self.__size): <NEW_LINE> <INDENT> templist.append("{}{}".format(" " * self.__position[0], "#" * self.__size)) <NEW_LI...
format for printing
625941f09b70327d1c4e136c
def get_current_date(): <NEW_LINE> <INDENT> return datetime.date.today()
A function using the datetime.date.today() to return the current day as a date object. Args: None given Return: To return the current date Example: >>> import datetime >>> task_01.CURDATE None >>> task_01.get_current_date() datetime.date(2015, 3, 5) $ python -i task_01.py 2015-03-05
625941f0f548e778e58cdb14
def retrieve_json_from_url(gs_conf, relative_url): <NEW_LINE> <INDENT> url = gs_conf.geoserver_admin_url + '/' + relative_url.lstrip('/') <NEW_LINE> r = requests.get(url, auth=(gs_conf.username, gs_conf.password)) <NEW_LINE> response_json = None <NEW_LINE> try: <NEW_LINE> <INDENT> response_json = r.json() <NEW_LINE> <D...
:param gs_conf: :param relative_url: :return: json response
625941f085dfad0860c3b3f1
def run_action(self, action_ex_id, action_class_str, attributes, action_params): <NEW_LINE> <INDENT> def send_error_back(error_msg): <NEW_LINE> <INDENT> if action_ex_id: <NEW_LINE> <INDENT> self._engine_client.on_action_complete( action_ex_id, wf_utils.Result(error=error_msg) ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND...
Runs action. :param action_ex_id: Corresponding task id. :param action_class_str: Path to action class in dot notation. :param attributes: Attributes of action class which will be set to. :param action_params: Action parameters.
625941f050485f2cf553d330
def wx_drag_any(self, x, y, data, drag_result): <NEW_LINE> <INDENT> ui_provider = isinstance(data, IDockUIProvider) <NEW_LINE> if ui_provider or isinstance(data, DockControl): <NEW_LINE> <INDENT> if ui_provider and ( not self.handler.can_drop(*(self.handler_args + (data,))) ): <NEW_LINE> <INDENT> return wx.DragNone <NE...
Handles a Python object being dragged over the control.
625941f0be8e80087fb211ce
def setup(self, admin_username, admin_password, admin_isp_name, name, email, comment, admin_has_otp, admin_request_limit): <NEW_LINE> <INDENT> self.admin_username = admin_username <NEW_LINE> self.admin_password = admin_password <NEW_LINE> self.admin_isp_name = admin_isp_name <NEW_LINE> self.name = name <NEW_LINE> self....
Setup required parameters. :param str admin_username: admin authentication username :param str admin_password: admin authentication password :param str admin_isp_name: admin isp name :param str name: admin real name :param str email: admin email :param str comment: comment about this action :param bool admin_has_otp: ...
625941f060cbc95b062c6ad8
def predictTrajectory(self, trajectory_timestamps): <NEW_LINE> <INDENT> predictions = [] <NEW_LINE> sigmas = [] <NEW_LINE> for timestamp in trajectory_timestamps: <NEW_LINE> <INDENT> prediction, sigma = self.predictValue(timestamp) <NEW_LINE> predictions.append(prediction[0]) <NEW_LINE> sigmas.append(sigma[0]) <NEW_LIN...
Predict the output value for each timestamp in the trajectory_timestamp. Args: trajectory_timestamps (TODO data type?): List of timestamps to predict the coordinate value for. Returns: Tuple of 2 numpy arrays. First contains the predicted output values for the given timestamps, the second contains the stan...
625941f055399d3f05588c4c
def expire_format(dtime): <NEW_LINE> <INDENT> import email.Utils <NEW_LINE> import time <NEW_LINE> import datetime <NEW_LINE> return email.Utils(time.mktime(dtime.timetuple()))
Convert datetime.datetime instance to cookie expires format
625941f01f5feb6acb0c50de
def run_apidoc(app): <NEW_LINE> <INDENT> import better_apidoc <NEW_LINE> better_apidoc.APP = app <NEW_LINE> better_apidoc.main( [ "better-apidoc", "-t", os.path.join(".", "web", "_templates"), "--force", "--separate", "-o", os.path.join(".", "web", "api"), os.path.join(".", "nltk"), ] )
Generage API documentation
625941f04f88993c3716c5f5
def detect_min_val(input_mat, var, threshold=1e-6, name='', debug=False): <NEW_LINE> <INDENT> eigen_min = tf.reduce_min(input_tensor=input_mat) <NEW_LINE> eigen_max = tf.reduce_max(input_tensor=input_mat) <NEW_LINE> eigen_ratio = eigen_max / eigen_min <NEW_LINE> input_mat_clipped = clipout_neg(input_mat, threshold) <NE...
If debug is not set, will run clipout_neg. Else, will clip and print out odd eigen values :param input_mat: (TensorFlow Tensor) :param var: (TensorFlow Tensor) variable :param threshold: (float) the cutoff threshold :param name: (str) the name of the variable :param debug: (bool) debug function :return: (TensorFlow Te...
625941f0fbf16365ca6f6764
def ransac(meter_clusters, rel_inlier_margin=0.05): <NEW_LINE> <INDENT> max_cluster_size = max(meter_clusters, key=lambda x: x['len'])['meter'] <NEW_LINE> margin = rel_inlier_margin * max_cluster_size <NEW_LINE> best_vote_count = 0 <NEW_LINE> best_support = [] <NEW_LINE> for clust in meter_clusters: <NEW_LINE> <INDENT>...
Very simple RANSAC implementation for finding the value with most support in a list of scale estimates. I.e. only one parameter is searched for. The number of points in the cluster on which the scale estimate was based is taken into account.
625941f04e4d5625662d4964
def get_quantizer(q_str): <NEW_LINE> <INDENT> if q_str == "": <NEW_LINE> <INDENT> q_str=None <NEW_LINE> <DEDENT> if q_str is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> qtype, qargs= split_quantizer_str(q_str) <NEW_LINE> quantizer = quantizer_selector(qtype, qargs) <NEW_LINE> return quantizer
Get a quantizer instance based on string. If quantizer is empty string or None, None is returned. Args: q_str: quantizer string to be interpreted. Returns: Quantizer object or None.
625941f0dd821e528d63b739
def _bbai_id(self): <NEW_LINE> <INDENT> board_value = self.detector.get_device_model() <NEW_LINE> if "BeagleBone AI" in board_value: <NEW_LINE> <INDENT> return boards.BEAGLEBONE_AI <NEW_LINE> <DEDENT> return None
Try to detect id of a Beaglebone AI related board.
625941f0cdde0d52a9e535cc
def is_912(self): <NEW_LINE> <INDENT> return self.num == 912
Verify whether num property is 912
625941f05f7d997b87175031
def getJointAngleParam(pJoint, qJoint, prefJoint, qrefJoint): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> for i in range(len(pJoint)): <NEW_LINE> <INDENT> angle = getJointAngle(pJoint[i], qJoint[i], prefJoint[i], qrefJoint[i]) <NEW_LINE> ret.append(angle) <NEW_LINE> <DEDENT> return np.array(ret)
Calculates the joint angle for angle p with confidence score Params: indexes for joints where p is the joint for which to calculate the angle q is another end of a limb connected to p pref and qref form a limb to form the angle with along with p and q. frame is the state of all keypoints at some point ...
625941f0cb5e8a47e48b8035
def create_superuser(self, email, date_of_birth, password, **extra_fields): <NEW_LINE> <INDENT> user = self.create_user( email, password=password, date_of_birth=date_of_birth, **extra_fields ) <NEW_LINE> user.is_verified = True <NEW_LINE> user.is_admin = True <NEW_LINE> user.save(using=self._db) <NEW_LINE> return user
Creates and saves a superuser with the given email, date of birth and password
625941f0fbf16365ca6f6765
def report_streamsets(pipelines_by_country): <NEW_LINE> <INDENT> report_html = '' <NEW_LINE> column_list = [STREAMSET_INFO_COUNTRY_NAME, STREAMSET_INFO_TOTAL_COUNT_NAME, STREAMSET_INFO_MONITORED_COUNT_NAME, STREAMSET_INFO_FAILED_COUNT_NAME] <NEW_LINE> title_list = STREAMSET_REPORT_GENERAL_INFO_TITLES <NEW_LINE> report_...
Pipelines general info: pipelines counts by countries
625941f02eb69b55b151ce4c
def make_operation(self, view, params: dict, ctx: dict): <NEW_LINE> <INDENT> description = self.extract_description(view, ctx) <NEW_LINE> summary = self.extract_summary(view, ctx) <NEW_LINE> parameters = self.build_parameters(view, params, ctx) <NEW_LINE> responses = self.extract_responses(view, ctx) <NEW_LINE> others ...
Convert view to swagger opration object.
625941f0d18da76e23532a72
def register_users(users): <NEW_LINE> <INDENT> for user in users: <NEW_LINE> <INDENT> username = user["username"] <NEW_LINE> is_admin = user.get("is_admin", False) <NEW_LINE> if sql_db.session.query( exists().where(User.username == username) ).scalar(): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> user = User(usern...
Register a list of users in the system. Example input structure:: [ {"username": "magic.mirror", "is_admin": True}, {"username": "snow.white", "is_admin": False}, {"username": "dopey"}, {"username": "sleepy"}, ] If a user is already registered in the system it is skipped. To c...
625941f029b78933be1e5c3a
def run(name, onlyif=None, unless=None, cwd='/root', user=None, group=None, shell=None, env=(), **kwargs): <NEW_LINE> <INDENT> ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} <NEW_LINE> if not os.path.isdir(cwd): <NEW_LINE> <INDENT> ret['comment'] = 'Desired working directory is not available' <NEW_...
Run a command if certain circumstances are met name The command to execute, remember that the command will execute with the path and permissions of the salt-minion. onlyif A command to run as a check, run the named command only if the command passed to the ``onlyif`` option returns true unless A ...
625941f07b180e01f3dc4d85
def __startTRPreviewer(self): <NEW_LINE> <INDENT> self.__startProc("eric6_trpreviewer.py", "--config={0}".format( Utilities.getConfigDir()))
Private slot to start the eric6 translations previewer.
625941f05f7d997b87175032
def determine_db_dir(): <NEW_LINE> <INDENT> if platform.system() == "Darwin": <NEW_LINE> <INDENT> return os.path.expanduser("~/Library/Application Support/coolnode/") <NEW_LINE> <DEDENT> elif platform.system() == "Windows": <NEW_LINE> <INDENT> return os.path.join(os.environ['APPDATA'], "coolnode") <NEW_LINE> <DEDENT> r...
Return the default location of the coolnode data directory
625941f066656f66f7cbc742
def getOverlayTextureUnit(self): <NEW_LINE> <INDENT> return _osgSim.OverlayNode_getOverlayTextureUnit(self)
getOverlayTextureUnit(OverlayNode self) -> unsigned int
625941f08c3a873295158956
def check_dict_with_msg(d, location, exceptions = {}, except_class = ConfigError): <NEW_LINE> <INDENT> import racy <NEW_LINE> for opt, val in d.items(): <NEW_LINE> <INDENT> racy.renv.configs.allowedvalues.check_value_with_msg( opt = opt, val = val, location = location, exceptions = exceptions, e...
Check every item in d. Raise an exception if checkvalue return False.
625941f0a05bb46b383ecdb1
def reqTradingTask3(self, request_iterator, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
reqTradingTask3 - request trading task
625941f0fff4ab517eb2f9d5
def get_contacts(tokin): <NEW_LINE> <INDENT> msg = JimGetContact(tokin) <NEW_LINE> request = msg.jsonmsg() <NEW_LINE> data = connection(request) <NEW_LINE> json_data = json.loads(data.decode('utf-8')) <NEW_LINE> return json_data
Функция получения контактов :param tokin: :return:
625941f02ae34c7f2600d6c5
def is_str(val: str) -> str: <NEW_LINE> <INDENT> assert isinstance(val, str), f"Must be a String type value!: {type(val)}" <NEW_LINE> return val
Assertion for a string type value. Args: val: check value (expect string type) Returns: Same value to input. Raises: Assertion Error: if a value not match a string type.
625941f0ff9c53063f47c785
def p_peq(p): <NEW_LINE> <INDENT> if len(p) == 5: <NEW_LINE> <INDENT> if not p[2] in variables: <NEW_LINE> <INDENT> variables[p[2]] = p[4] <NEW_LINE> <DEDENT> elif not p[2] in ivars: <NEW_LINE> <INDENT> variables[p[2]] += p[4] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> textvalue = expand(p[4],variables) <NEW_LINE> v...
var : end textstr PEQ textlst | end textstr PEQ
625941f03617ad0b5ed6848b
def get_fan_info(self, index): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = self.mongo_get.find_one({'_id': index}) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> raise Exception <NEW_LINE> <DEDENT> return data
从数据库中获取一个用户的关注列表json数据 :param index: 数据id :return:
625941f099fddb7c1c9de923
def format_quote(quote): <NEW_LINE> <INDENT> if not isinstance(quote, Quote): <NEW_LINE> <INDENT> raise click.ClickException("The quote parameter must be type class Quote.") <NEW_LINE> <DEDENT> quotestr = quote.quote <NEW_LINE> author = quote.author <NEW_LINE> publication = quote.publication <NEW_LINE> if publication i...
Given a Quote object, this function returns a single-line string containing the quote formatted as it will be written to the file: <quote> | <author> | [<publication>] | [<tag1>,<tag2>,...]
625941f03c8af77a43ae3d3c
def test_whole_range_same_right(check_ranges, nft): <NEW_LINE> <INDENT> nft.transferRange(accounts[3], 5000, 10001, {"from": accounts[1]}) <NEW_LINE> nft.transferRange(accounts[3], 10001, 20001, {"from": accounts[2]}) <NEW_LINE> check_ranges([(1, 5000)], [], [(5000, 30001)], [])
whole range, merge both sides, absolute right
625941f0462c4b4f79d1dc64
def update_stats(self, stats, delta, sample_rate=1): <NEW_LINE> <INDENT> if not isinstance(stats, list): <NEW_LINE> <INDENT> stats = [stats] <NEW_LINE> <DEDENT> data = dict((stat, "%s|c" % delta) for stat in stats) <NEW_LINE> self.send(data, sample_rate)
Updates one or more stats counters by arbitrary amounts.
625941f0566aa707497f4af5
def users_info(self, username=None, id=None, data={}, authenticate=False): <NEW_LINE> <INDENT> if username: <NEW_LINE> <INDENT> data['username'] = username <NEW_LINE> <DEDENT> elif id: <NEW_LINE> <INDENT> data['id'] = id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ForrstAPIError('missing argument: expected user...
Return user info.
625941f07cff6e4e81117f1a
def kilojoules_conversions(amount, unit): <NEW_LINE> <INDENT> unit = unit.lower() <NEW_LINE> if unit == 'kcal': <NEW_LINE> <INDENT> conversion = amount * 0.239 <NEW_LINE> return '{} {}'.format(conversion, 'kcal') <NEW_LINE> <DEDENT> elif unit == 'cal': <NEW_LINE> <INDENT> conversion = amount * 239.0057 <NEW_LINE> retur...
converts kilojoules to various food energy units. cal -> calorie kj -> kilojoules j -> joules
625941f032920d7e50b2876a
def segment_str(sentences_list,lexicon=None): <NEW_LINE> <INDENT> segmentor = Segmentor() <NEW_LINE> SEGDIR = os.path.join(MODELDIR,"cws.model") <NEW_LINE> print("loading models from "+ SEGDIR + "...") <NEW_LINE> if lexicon == None: <NEW_LINE> <INDENT> segmentor.load(SEGDIR) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
:param sentences_list: :param lexicon: :return:
625941f023e79379d52eeaf1
def motion(self,address,value): <NEW_LINE> <INDENT> self.logger.info("Got Motion for node %s '%s'" % (address, value) ) <NEW_LINE> if address in self.nodes: <NEW_LINE> <INDENT> return self.nodes[address].motion(value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.send_error("No node for motion on address %s" % (ad...
Poll Camera's
625941f08c0ade5d55d3ef55
def meaning_of_life_url() -> str: <NEW_LINE> <INDENT> url = "https://en.wikipedia.org/api/rest_v1/page/summary/Monty_Python's_The_Meaning_of_Life" <NEW_LINE> r = requests.get(url) <NEW_LINE> r.raise_for_status() <NEW_LINE> j = r.json() <NEW_LINE> return j["extract"]
Fetch the meaning of life from http://en.wikipedia.org.
625941f0a4f1c619b28b05c0
def getValidDiffsForInputDiff(inputDiff): <NEW_LINE> <INDENT> global possibleOutputDifferences <NEW_LINE> if not possibleOutputDifferences: <NEW_LINE> <INDENT> possibleOutputDifferences = [set([]) for _ in range(256)] <NEW_LINE> for diffIn in range(256): <NEW_LINE> <INDENT> for diffOut in range(256): <NEW_LINE> <INDENT...
Get all possible output differences for a given input difference.
625941f08e7ae83300e4b564
def start_timer(self, ms: int, timer_id=None): <NEW_LINE> <INDENT> p = sciter.capi.sctypes.UINT_PTR(timer_id) <NEW_LINE> ok = _api.SciterSetTimer(self, ms, p) <NEW_LINE> self._throw_if(ok) <NEW_LINE> return self
Start Timer for the element. Element will receive on_timer event.
625941f091f36d47f21aca8e
def __init__(self, channel): <NEW_LINE> <INDENT> self.SayHello = channel.unary_unary( '/srecon.Greeter/SayHello', request_serializer=HelloRequest.SerializeToString, response_deserializer=HelloReply.FromString, ) <NEW_LINE> self.ManyHellos = channel.stream_stream( '/srecon.Greeter/ManyHellos', request_serializer=HelloRe...
Constructor. Args: channel: A grpc.Channel.
625941f07cff6e4e81117f1b
def get_log(self): <NEW_LINE> <INDENT> return self._tx_log
Retrieve the event log. :return: The log, a list of strings in the order they were added.
625941f0090684286d50f284
@functools.lru_cache(maxsize=128) <NEW_LINE> def clean_string(text): <NEW_LINE> <INDENT> text = "".join([word for word in text if word not in string.punctuation]) <NEW_LINE> text = text.lower() <NEW_LINE> text = "".join([word for word in text.split() if word not in stopwords]) <NEW_LINE> return text
Return cleaned string.
625941f03539df3088e2e8e1
def shutdown_guest(self, vm_id): <NEW_LINE> <INDENT> return self._post('vcenter/vm/{}/guest/power?action=shutdown'.format(vm_id))
Issues a request to the guest operating system asking it to perform a clean shutdown of all services. :param vm_id: Virtual machine identifier :type vm_id: string
625941f00c0af96317bb877c
def get_start_positions(self): <NEW_LINE> <INDENT> self.start_coordinates = [] <NEW_LINE> x_coordinates, y_coordinates = np.where(self.racetrack == constants.START_VALUE) <NEW_LINE> for x, y in zip(x_coordinates, y_coordinates): <NEW_LINE> <INDENT> self.start_coordinates.append((x, y))
Select start position by random (from a list of start positions). :return: None.
625941f092d797404e304722
def readTextFromFile(self, filename): <NEW_LINE> <INDENT> f= open(filename) <NEW_LINE> self.text = f.read() <NEW_LINE> f.close() <NEW_LINE> self.text = self.text.replace("\n"," ") <NEW_LINE> return(self.text)
Accept a filename (a string) and set self.text to all of the text in that file, represented as a single, very large string.
625941f0bd1bec0571d90bc4
def predict(self, image_array): <NEW_LINE> <INDENT> image_tensor = torch.from_numpy(image_array).permute([2, 0, 1]).float().div_(255) <NEW_LINE> image = Image(image_tensor) <NEW_LINE> category, category_id, scores = self.model.predict(image) <NEW_LINE> output_dict = { 'category': category.obj, 'category_id': category_i...
Run inference on a a single image :param image_array: numpy array with shape [?,?,3] :returns: dict containing category, category_id and scores
625941f03617ad0b5ed6848c
def close(self): <NEW_LINE> <INDENT> _DLL.HidSmbus_Close(self.handle)
Close the device handle.
625941f0236d856c2ad44d78
def _clean_translation(self, value): <NEW_LINE> <INDENT> translation_parts = value.split() <NEW_LINE> return string.join(translation_parts, '')
Concatenate a translation value to one long protein string.
625941f06aa9bd52df03733d
def contains(self, searchstr: str): <NEW_LINE> <INDENT> return mybinsearch (self.a, searchstr, self.sa_strcmp_str) != -1
Returns true of searchstr is coontained in document.
625941f0de87d2750b86032f
def _build_url(self, prefix, first_id, second_id=None): <NEW_LINE> <INDENT> site_address = 'http://vk.com/' <NEW_LINE> if second_id: <NEW_LINE> <INDENT> return '{}{}{}{}{}'.format(site_address, prefix, str(first_id), '_', str(second_id)) <NEW_LINE> <DEDENT> return '{}{}{}'.format(site_address, str(prefix), str(first_id...
Build the link to vk item from id. :param prefix: :param first_id: :param second_id: :return:
625941f015fb5d323cde10ae
def get_service(self): <NEW_LINE> <INDENT> http_authorized = self._authorize() <NEW_LINE> return build('bigquery', 'v2', http=http_authorized)
Returns a BigQuery service object.
625941f0379a373c97cfb0dc
def pc_work_time(self): <NEW_LINE> <INDENT> return _foo_swig.burst_tagger_sptr_pc_work_time(self)
pc_work_time(self) -> float
625941f0656771135c3ebe0b
def titleCase(string, exceptions): <NEW_LINE> <INDENT> string = re.sub(r'[^a-zA-Z_]+', '', string) <NEW_LINE> if len(string) > 0: <NEW_LINE> <INDENT> word_list = re.split('_', string) <NEW_LINE> final = [word_list[0].capitalize()] <NEW_LINE> for word in word_list[1:]: <NEW_LINE> <INDENT> final.append(word if word in ex...
Converts a file name to a heading Args: string: the file name, expects underscore word separation exceptions: words not to capitalise if they are not first in the title
625941f0b830903b967e9e9a
def drawField(self): <NEW_LINE> <INDENT> time.sleep(1) <NEW_LINE> os.system('clear') <NEW_LINE> final_draw = "" <NEW_LINE> for y in reversed(range(self.height)): <NEW_LINE> <INDENT> line_draw = "" <NEW_LINE> for x in range(self.width): <NEW_LINE> <INDENT> self.point_representation(Point(x, y)) <NEW_LINE> line_draw += s...
Return the the UI field draw.
625941f015baa723493c4510
def copy_dir_structure(datapath, output_path_new_files): <NEW_LINE> <INDENT> for dirpath, dirnames, filenames in os.walk(datapath): <NEW_LINE> <INDENT> structure = os.path.join(output_path_new_files, dirpath[len(datapath):]) <NEW_LINE> print(structure) <NEW_LINE> if not os.path.isdir(structure): <NEW_LINE> <INDENT> os....
DESCRIPTION: copy folders structure in a new route. Parameters ---------- datapath: str. Directory whose structure I want to replicate output_path_new_files: str. Root directory on which I want to re-create the sub-folder structure.
625941f0bf627c535bc13765
def update_data(): <NEW_LINE> <INDENT> pass
Update data in memory from data read from storage. This method does not load data from disk in storage, but does data synchronize data in memory with data that has been loaded from memory. The sychronization is sub-type specific; it may mean data from storage replaces that in memory, or that data is memory is upd...
625941f0d18da76e23532a73
def split_by(self,plane): <NEW_LINE> <INDENT> from .dc_intersection import Intersector <NEW_LINE> xsec = Intersector() <NEW_LINE> if not xsec.of(self, plane): return False <NEW_LINE> pts = xsec.results + [self.ept] <NEW_LINE> delts = [j-i for i, j in zip([0]+xsec.angs, xsec.angs+[self.angle])] <NEW_LINE> angs = xsec.an...
Splits this arc by a given Plane :result: Origin of this Arc's basis. :rtype: Point :: my_arc.origin
625941f04e696a04525c99e3
def __getVersion(self): <NEW_LINE> <INDENT> version = __version__ + "." + self.versionLabel + "." + ( self.__mydb.version() or "<DB_NOT_CONNECTED>" ) <NEW_LINE> return version
get method for version attribute :returns: server and configuration version :rtype: :obj:`str`
625941f094891a1f4081c042
@app.route(f'{base}tobs') <NEW_LINE> def tobs(): <NEW_LINE> <INDENT> query_result = session.query(Measurement.date,func.avg(Measurement.tobs)).filter( extract('year',Measurement.date) == date.today().year-1).group_by(Measurement.date).all() <NEW_LINE> dates = [response[0] for response in query_result] <NEW_LINE> avg_to...
query for observed temperature measurements over the last year
625941f08e05c05ec3eea90f
def setAccessory(self, mail_body): <NEW_LINE> <INDENT> self.accessory = MIMEText(mail_body, 'html', 'utf-8') <NEW_LINE> self.accessory['Content-Type'] = self.Content_Type <NEW_LINE> self.accessory["Content-Disposition"] = self.Content_Disposition <NEW_LINE> self.msg.attach(self.accessory)
设置附件
625941f04527f215b584c9e7
def predict(self, inputs): <NEW_LINE> <INDENT> LOG.debug("FourPointSevenNet - Prediction") <NEW_LINE> h1 = np.matmul(inputs, self.weights["w1"]) + self.weights["b1"] <NEW_LINE> a1 = np.greater(h1, 0) * h1 <NEW_LINE> h2 = np.matmul(a1, self.weights["w2"]) + self.weights["b2"] <NEW_LINE> a2 = np.exp(h2) <NEW_LINE> a2 = a...
Predict classification for input images Pass the input images through the neural network forward propogration, and return a vector of the labels with the highest probability. Args: inputs (numpy.ndarray) - Flattened (C-style) image data (number_of_examples, 784) Returns: preds (numpy.ndarray) - A vector of p...
625941f07d43ff24873a323a
def move(self): <NEW_LINE> <INDENT> new_snake_point = self.cal_new_pos() <NEW_LINE> if self.food.position == new_snake_point: <NEW_LINE> <INDENT> self.point_earned += 1 <NEW_LINE> self.queue.put({"points_earned": self.point_earned}) <NEW_LINE> self.snake_points.append(new_snake_point) <NEW_LINE> self.food.new_foods() <...
负责蛇的移动:1.重新计算的蛇头的坐标 2.当蛇头跟实物相遇,则加分,重新生成食物,通知world,加分 3.否则,蛇头需要动 :return:
625941f04f6381625f114fd1
@spiceErrorCheck <NEW_LINE> def spk14b(handle, segid, body, center, framename, first, last, chbdeg): <NEW_LINE> <INDENT> handle = ctypes.c_int(handle) <NEW_LINE> segid = stypes.stringToCharP(segid) <NEW_LINE> body = ctypes.c_int(body) <NEW_LINE> center = ctypes.c_int(center) <NEW_LINE> framename = stypes.stringToCharP(...
Begin a type 14 SPK segment in the SPK file associated with handle. See also :func:`spk14a` and :func:`spk14e`. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spk14b_c.html :param handle: The handle of an SPK file open for writing. :type handle: int :param segid: The string to use for segment identifier. :ty...
625941f0bd1bec0571d90bc5
def update_status(self, new_status): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> index = LOG_STATUS.index(new_status) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> log = self.detail <NEW_LINE> old_status = log.status <NEW_LINE> if index > LOG_STATUS.index(old_status): <NEW_LINE>...
:param new_status: :return:
625941f099cbb53fe679317a
def get_owner_object(self): <NEW_LINE> <INDENT> return False
Muscle has no owner information
625941f0099cdd3c635f11ee
def __init__(self, ref: firestore.DocumentReference, max_stale_time: float): <NEW_LINE> <INDENT> self.ref = ref <NEW_LINE> self.max_stale_time = max_stale_time <NEW_LINE> self._value = {} <NEW_LINE> self.updated = 0.0 <NEW_LINE> _caches[self.ref.path] = self
Set a document cache. Args: ref (firestore.DocumentReference): Reference to document that is cached. max_stale_time (float): Maximum number of seconds that pass before document is reloaded.
625941f091f36d47f21aca8f
def batch_samples(batch_size,filename,shuffle=False): <NEW_LINE> <INDENT> image,label=_read_single_sample(filename) <NEW_LINE> label=tf.reshape(label,[-1,2]) <NEW_LINE> label = gene_hm.resize_label(label) <NEW_LINE> if shuffle: <NEW_LINE> <INDENT> image_batch, label_batch = tf.train.shuffle_batch([image, label], batch_...
filename:tfrecord文件名
625941f05166f23b2e1a56ef
def pc_output_buffers_full(self, *args): <NEW_LINE> <INDENT> return _sdesign_swig.zybo_fft_sptr_pc_output_buffers_full(self, *args)
pc_output_buffers_full(zybo_fft_sptr self, int which) -> float pc_output_buffers_full(zybo_fft_sptr self) -> pmt_vector_float
625941f066673b3332b92627
def append_code_expr(self, code): <NEW_LINE> <INDENT> assert(isinstance(code, str)) <NEW_LINE> logger.debug("compiling code {0}...".format(code)) <NEW_LINE> try: <NEW_LINE> <INDENT> code_obj = compile(code, '<string>', 'eval') <NEW_LINE> self.code_objs[code] = code_obj <NEW_LINE> <DEDENT> except SyntaxError as syntax_e...
Compiles argument and adds it to the list of code objects.
625941f097e22403b379d532
def wrapped(message_object, bot_object): <NEW_LINE> <INDENT> return func(message_object, bot_object)
Wrapper around user's function :param message_object: incoming message, Message object :param bot_object: Sheldon object :return:
625941f09f2886367277ae1f
def state_gethost(self): <NEW_LINE> <INDENT> raise NotImplementedError("Subclass must provide implementation")
Return string, hostname or addr of running job, likely by parsing self.job_status
625941f02c8b7c6e89b35d52
def write_key(port, key, value): <NEW_LINE> <INDENT> r = requests.put('http://127.0.0.1:' + port + '/v1/kv/' + key, data = value) <NEW_LINE> return r.text
Key writes happen by sending a PUT to the consul agent Data field must contain the data you wish to add. It does not have to be json-ized. Data will be b64 encoded upon receipt Returns true if write was successful
625941f0a219f33f34628ef7
def name(self): <NEW_LINE> <INDENT> return QString()
QString KNameAndUrlInputDialog.name()
625941f06fb2d068a760f63d
def calculateNonce(realm, algorithm=MD5): <NEW_LINE> <INDENT> assert algorithm in SUPPORTED_ALGORITHM <NEW_LINE> try: <NEW_LINE> <INDENT> encoder = DIGEST_AUTH_ENCODERS[algorithm] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise NotImplementedError( "The chosen algorithm (%s) does not have " "an implement...
This is an auxaliary function that calculates 'nonce' value. It is used to handle sessions.
625941f05510c4643540f96c
def update(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return super().update(request, *args, **kwargs)
更新用户工作经历视图
625941f06fece00bbac2dcdc
def cleanup(word): <NEW_LINE> <INDENT> clean_text_str, new_text = '', [] <NEW_LINE> char_and_punct_list = list(word) <NEW_LINE> CharsToKeep = string.ascii_letters + string.punctuation <NEW_LINE> if ('@' or 'http' or 'www' or '\.com' or '\.edu' or '\.org' or '\.gov') in word: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DE...
Cleans a word of punctuation, numbers, and web & email addresses.
625941f0fb3f5b602dac3c30
def get_dataset(X1, X2, y, config): <NEW_LINE> <INDENT> if (config.model_type == 'text_classifier') or (config.model_type == 'text_regressor'): <NEW_LINE> <INDENT> text_a, text_b, labels = X1, X2, y <NEW_LINE> dataset = TextFeaturesDataset(text_a, text_b, labels, config.model_type, config.label2id, config.max_seq_lengt...
Get daatset. Parameters ---------- X1 : list of strings text_a for input data pairs for text classification/regression OR list of list of strings for sequence/token tasks X2 : list of strings text_b for input data text pairs for text classification/regression y : list of string or list of floats ...
625941f09b70327d1c4e136e