code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def command_line_options(): <NEW_LINE> <INDENT> desc = "MooseDocs: A utility to build MOOSE documentation from a single source." <NEW_LINE> parser = argparse.ArgumentParser(description=desc) <NEW_LINE> subparser = parser.add_subparsers(dest='command', help='Available commands.') <NEW_LINE> subparser.required = True <NE...
The main command line parser, this creates the main parser and calls the calls the command_line_options method for each command.
625941d766673b3332b922f2
def __init__(self, *args): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> args = list(args) <NEW_LINE> if len(args) % 2 == 1: <NEW_LINE> <INDENT> args.append(1) <NEW_LINE> <DEDENT> self.args = args <NEW_LINE> self.threshs = args[::2] <NEW_LINE> self.scales = args[1::2] <NEW_LINE> self._transform = CutoffTransform(se...
Parameters ---------- *args : thresh_1, scale_1, ..., thresh_N, [scale_N], optional Sequence of "thresholds" and "scales". If the final scale is omitted (i.e. you passed an odd number of arguments) it is set to ``1``. Each ``scale_i`` in the sequence can be interpreted as follows: * If ``scale_i < ...
625941d7b545ff76a8914076
def analyze_crate_dependencies(path, data=None): <NEW_LINE> <INDENT> def get_dependencies(dependencies): <NEW_LINE> <INDENT> deps = [] <NEW_LINE> renames = {} <NEW_LINE> for dep in dependencies: <NEW_LINE> <INDENT> deps.append(dep['local_name']) <NEW_LINE> if dep['local_name'] != dep['name']: <NEW_LINE> <INDENT> rename...
Checks for unused externs and gives suggestions for both src and tests/benches directories. :param path: The path to the crate to analyze :param data: Optional crate data loaded from `load_cargo_toml` :return: A dict in the form: { 'name': <crate name>, 'remove': [<crate>, ...], 'move-to-dev': [<crate>, ......
625941d74a966d76dd551271
def process(self, labels): <NEW_LINE> <INDENT> self._screen_counter.inc(1) <NEW_LINE> screen_id, mtruk_labels = labels <NEW_LINE> json_path = self.dataset_path + screen_id + '.json' <NEW_LINE> for text in create_tf_example_fn.extract_token(json_path, screen_id, mtruk_labels, self._tokenizer): <NEW_LINE> <INDENT> yield ...
Emits tokens and phrases. Args: labels: A pair of <screen id, mturk labels>. Labels including captions and labeller-annotated attention bbx. Yields: Tokens and phrases.
625941d70a366e3fb873ea7c
def among_unless_none(self, **attributes): <NEW_LINE> <INDENT> attrs = {} <NEW_LINE> for key, value in attributes.items(): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> attrs[key] = value <NEW_LINE> <DEDENT> <DEDENT> return self.among(**attrs)
Uses among(), but removes keys whose values are None.
625941d7cc40096d61595bb1
def strStr(self, haystack, needle): <NEW_LINE> <INDENT> if len(needle) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if len(haystack) == 0: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> num = 0 <NEW_LINE> for i in range(len(haystack) - len(needle) + 1): <NEW_LINE> <INDENT> if needle[0] == haystack[i]: <NEW...
:type haystack: str :type needle: str :rtype: int
625941d74f88993c3716c2c6
def ModifySecurityGroupPolicies(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("ModifySecurityGroupPolicies", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Modif...
本接口(ModifySecurityGroupPolicies)用于重置安全组出站和入站规则(SecurityGroupPolicy)。 <ul> <li>接口是先删除当前所有的出入站规则,然后再添加 Egress 和 Ingress 规则,不支持自定义索引 PolicyIndex。</li> <li>在 SecurityGroupPolicySet 参数中:<ul> <li> 如果指定 SecurityGroupPolicySet.Version 为0, 表示清空所有规则,并忽略 Egress 和 Ingress。</li> <li> 如果指定 SecurityGroupPolicySet.Ver...
625941d73c8af77a43ae3a02
def create_instapush(self): <NEW_LINE> <INDENT> trigger = self.create_triggerservice() <NEW_LINE> event_name = 'signups' <NEW_LINE> tracker_name = 'email' <NEW_LINE> status = True <NEW_LINE> return Instapush.objects.create(trigger=trigger, app_id='1234', app_secret='k33p1ts3cr3t', event_name=event_name, tracker_name=tr...
Create a Instapush object related to the trigger object
625941d7bde94217f368304f
def insert(self, *args): <NEW_LINE> <INDENT> return _donutengine.StringVector_insert(self, *args)
insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const & x) -> std::vector< std::string >::iterator Parameters: pos: std::vector< std::string >::iterator x: std::vector< std::string >::value_type const & insert(StringVector self, std::vector< std::stri...
625941d71f5feb6acb0c4dad
def __create_smart_format_dict__(self, property_dict, smart_format_dict): <NEW_LINE> <INDENT> if property_dict is None: <NEW_LINE> <INDENT> return({}) <NEW_LINE> <DEDENT> format_dict = {} <NEW_LINE> for key_i, value_i in property_dict.items(): <NEW_LINE> <INDENT> for format_i in smart_format_dict: <NEW_LINE> <INDENT> i...
Create smart format dictionary. Args: property_dict: smart_format_dict:
625941d7e8904600ed9f2190
@blueprint.route("/") <NEW_LINE> def index(): <NEW_LINE> <INDENT> return render_template( "invenio_waitforme/index.html", module_name=_('invenio-waitforme'))
Basic view.
625941d7fbf16365ca6f6427
def _run_job_execution(self, job_id, cluster_id, input_id, output_id, configs, job_idx): <NEW_LINE> <INDENT> @atomic.action_timer("sahara.job_execution_%s" % job_idx) <NEW_LINE> def run(self): <NEW_LINE> <INDENT> job_execution = self.clients("sahara").job_executions.create( job_id=job_id, cluster_id=cluster_id, input_i...
Run a Job Execution and wait until it completes or fails. The Job Execution is accepted as successful when Oozie reports "success" or "succeeded" status. The failure statuses are "failed" and "killed". The timeout and the polling interval may be configured through "sahara_job_execution_timeout" and "sahara_job_check_...
625941d7d8ef3951e324379e
def clean_up_new_tag(tag): <NEW_LINE> <INDENT> if tag: <NEW_LINE> <INDENT> remove = ["crossorigin", "integrity"] <NEW_LINE> for attr in remove: <NEW_LINE> <INDENT> if tag.get(attr): <NEW_LINE> <INDENT> del tag[attr] <NEW_LINE> <DEDENT> <DEDENT> return tag <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return
Removes unnecessary attributes from soup DOM element
625941d744b2445a339322f5
def iterfilepaths(self): <NEW_LINE> <INDENT> for f, st in self.files: <NEW_LINE> <INDENT> yield st, os.path.join(self.path, f)
Yield (status, path) for files directly under this directory.
625941d78a349b6b435e83d4
def temp(*, city: str, unit: str = "metric") -> dict: <NEW_LINE> <INDENT> unit = "metric" if unit not in ["metric", "imperial"] else unit <NEW_LINE> result = {} <NEW_LINE> url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&appid={appid}&units={unit}' <NEW_LINE> try: <NEW_LINE> <INDENT> data = requests.get(...
Gets the weather of a place :param place: The name of the place whose weather would be found :param unit: The unit used for measuring amounts, (it can be either 'metric' or 'imperial) :return: Dictionary
625941d796565a6dacc8f92b
def test_carga(self): <NEW_LINE> <INDENT> self.ArchivoIP.load() <NEW_LINE> assert_not_empty(self.ArchivoIP.usuarios)
Test de carga
625941d715fb5d323cde0d73
def getThemes(): <NEW_LINE> <INDENT> return THEMES.keys()
Returns the list of available themes
625941d79b70327d1c4e1036
def removeFromIgnore(self, obj): <NEW_LINE> <INDENT> if obj in self.ignoreList: <NEW_LINE> <INDENT> self.ignoreList.remove(obj)
Remove obj from list of ignored searches
625941d76e29344779a62871
def f(z): <NEW_LINE> <INDENT> return z**4 - 1
Intend to find the roots of this function
625941d756b00c62f0f148bb
def printMax(x,y): <NEW_LINE> <INDENT> x = int(x) <NEW_LINE> y = int(y) <NEW_LINE> if(x > y): <NEW_LINE> <INDENT> print(x,"is maximum") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(y,"is maximum")
Prints the maximum of two numbers. the twon values must be integers.
625941d75510c4643540f640
def update_loan_item(user_manager: Users, id): <NEW_LINE> <INDENT> if "loanedto" not in request.json: <NEW_LINE> <INDENT> raise InvalidRequestException <NEW_LINE> <DEDENT> loan_dict = user_manager.Loans.update_loan(id, request.json["loanedto"]) <NEW_LINE> return jsonify({"loan-item": loan_dict})
Only accepts {"loanedto": <username>}
625941d75fcc89381b1e1922
def nextPermutation(self, nums: List[int]) -> None: <NEW_LINE> <INDENT> l = len(nums) <NEW_LINE> idx = l - 1 <NEW_LINE> while idx > 0: <NEW_LINE> <INDENT> if nums[idx-1] < nums[idx]: <NEW_LINE> <INDENT> n = nums[idx-1] <NEW_LINE> nidx = idx <NEW_LINE> while nidx < len(nums): <NEW_LINE> <INDENT> if nums[nidx] <= n: <NEW...
Do not return anything, modify nums in-place instead.
625941d7009cb60464c63611
def call_parallel(functions): <NEW_LINE> <INDENT> loop = get_event_loop() <NEW_LINE> executor = ThreadPoolExecutor(max_workers=len(functions)) <NEW_LINE> try: <NEW_LINE> <INDENT> tasks = [ loop.run_in_executor(executor, function) for function in functions ] <NEW_LINE> result = loop.run_until_complete(gather(*tasks)) <N...
Call functions in multiple threads. Create a pool of thread as large as the number of functions. Functions should accept no parameters (wrap then with partial or lambda).
625941d796565a6dacc8f92c
def update_aggregate_ratings(self, connection, user, new_user_rating, new_user_weight, old_user_rating=None, old_user_weight=None): <NEW_LINE> <INDENT> apcr = APCR.query.filter_by(community=self, connection=connection, aggregation='strict').first() <NEW_LINE> if apcr: <NEW_LINE> <INDENT> apcr.update_values(new_user_rat...
Update aggregate ratings Given a connection, a user, and new/old rating & weight values, update all affected aggregate ratings. Intended to be called in conjunction with or shortly after the rating has been updated.
625941d7d18da76e23532739
def affine(shape, matrix=None): <NEW_LINE> <INDENT> if matrix is None: <NEW_LINE> <INDENT> matrix = np.eye(3) <NEW_LINE> <DEDENT> if matrix.shape == (2, 3): <NEW_LINE> <INDENT> matrix = np.vstack( (matrix, [0, 0, 1]) ) <NEW_LINE> <DEDENT> if matrix.shape != (3, 3): <NEW_LINE> <INDENT> raise ValueError( "The shape of af...
Affine transformation encoded in a 2 x 3 matrix. Parameters ---------- shape : tuple Of the form (height, width). matrix : np.ndarray Transformation matrix of the shape 2 x 3. Raises ------ ValueError In case the transformation matrix has a wrong shape. Returns ------- delta_x : np.ndarray Displacem...
625941d7d53ae8145f87a4ce
def infer_hidden_states(single_step_model, state_size, data_x): <NEW_LINE> <INDENT> batch_size = data_x.shape[0] <NEW_LINE> seq_len = data_x.shape[1] <NEW_LINE> hidden = tf.zeros((batch_size, state_size)) <NEW_LINE> hidden_states = [hidden] <NEW_LINE> for t in range(seq_len): <NEW_LINE> <INDENT> print("hidden.shape", h...
Infers the hidden states of a single-step RNN model Args: single_step_model: RNN model taking a pair (inputs,old_hidden_state) as input and outputting new_hidden_state state_size: Size of the RNN model (=number of units) data_x: Input data for which the hidden states should be inferred Returns: Ten...
625941d71d351010ab855d7d
def test_login(self): <NEW_LINE> <INDENT> client = Client() <NEW_LINE> response = client.get( "/account/login/") <NEW_LINE> self.assertEquals(response.status_code, 200) <NEW_LINE> data = { "email": "tom@example.com", "password": "secret", } <NEW_LINE> response = client.post( "/account/login/", data) <NEW_LINE> self....
Docstring.
625941d7091ae356686671bc
def check_public_connstr(self, db, pub_connstr): <NEW_LINE> <INDENT> if self.options.nocheck: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> pub_db = self.get_database("pub_db", connstr=pub_connstr, profile='remote') <NEW_LINE> curs1 = db.cursor() <NEW_LINE> curs2 = pub_db.cursor() <NEW_LINE> q = "select oid, datname, ...
Look if public and local connect strings point to same db's.
625941d70fa83653e465721b
def _apply_rl_actions(self, rl_actions): <NEW_LINE> <INDENT> if self.env_params.additional_params["use_follower_stopper"]: <NEW_LINE> <INDENT> for veh_id in rl_actions.keys(): <NEW_LINE> <INDENT> self._av_controller.veh_id = veh_id <NEW_LINE> self._av_controller.v_des = rl_actions[veh_id][0] <NEW_LINE> acceleration = s...
See class definition.
625941d763b5f9789fde7347
@Command('bike') <NEW_LINE> def cmd(send, msg, args): <NEW_LINE> <INDENT> send(' _f_,_') <NEW_LINE> send('(_)`(_)')
I've got a bike, you can ride it if you like. It's got a basket, a bell that rings and things to make it look good. I'd give it to you if I could but I borrowed it. Syntax: !bike
625941d738b623060ff0b04f
def test_settings_noshow(capsys): <NEW_LINE> <INDENT> show = Show(where=False, retvalue=True) <NEW_LINE> show.say.setfiles([sys.stdout]) <NEW_LINE> out, err = capsys.readouterr() <NEW_LINE> show.sep.set(vsep=(1,1), char='*') <NEW_LINE> show.sep('two') <NEW_LINE> out, err = capsys.readouterr() <NEW_LINE> assert out == "...
Had some trouble where the formatting routines (e.g. sep. title, hr, blank_lines) were not properly responding to show=False in a transient context, based on the way their core implementation was "forwarded" to the say module. This test is a regression bulwark to make sure that that these routines specifically remember...
625941d730bbd722463cc029
def ParseCommand(m): <NEW_LINE> <INDENT> table = _GetParameterDescriptors(m) <NEW_LINE> if table is None: <NEW_LINE> <INDENT> raise ValueError("unknown command") <NEW_LINE> <DEDENT> out = {} <NEW_LINE> index = 2 <NEW_LINE> for t in table: <NEW_LINE> <INDENT> kind = t[0] <NEW_LINE> name = t[2:-1] <NEW_LINE> new_index, v...
ParseCommand decodes an API_APPLICATION_COMMAND request into a map of values
625941d744b2445a339322f6
def forward(self): <NEW_LINE> <INDENT> self.alpha = np.zeros((self.T, self.N), np.float) <NEW_LINE> for i in range(self.N): <NEW_LINE> <INDENT> self.alpha[0][i] = self.Pi[i] * self.B[i][self.obs[0]] <NEW_LINE> <DEDENT> for t in range(1, self.T): <NEW_LINE> <INDENT> for i in range(self.N): <NEW_LINE> <INDENT> sum_val = ...
前向算法
625941d7b545ff76a8914077
def get(self, name, default=None): <NEW_LINE> <INDENT> if name in self: <NEW_LINE> <INDENT> return self[name] <NEW_LINE> <DEDENT> return default
Retrieve the plugin referred to by ``name`` or return the default. :param str name: Name of the plugin to retrieve. :param default: Default value to return. :returns: Plugin object referred to by name, if it exists. :rtype: :class:`Plugin`
625941d7ff9c53063f47c454
def to_endpoint(self): <NEW_LINE> <INDENT> transport = 6 <NEW_LINE> r = [utils.ienc(self._ip.version), utils.ienc(transport)] <NEW_LINE> r += [self._ip.packed, struct.pack('>H', self.port)] <NEW_LINE> return r
struct Endpoint { unsigned network; // ipv4:4, ipv6:6 unsigned transport; // tcp:6, udp:17 unsigned address; // BE encoded 32-bit or 128-bit unsigned (layer3 address) unsigned port; // BE encoded 16-bit unsigned (layer4 port) }
625941d78c3a87329515861e
def connect_log_slot(obj: QObject) -> None: <NEW_LINE> <INDENT> metaobj = obj.metaObject() <NEW_LINE> for i in range(metaobj.methodCount()): <NEW_LINE> <INDENT> meta_method = metaobj.method(i) <NEW_LINE> qtutils.ensure_valid(meta_method) <NEW_LINE> if meta_method.methodType() == QMetaMethod.Signal: <NEW_LINE> <INDENT> ...
Helper function to connect all signals to a logging slot.
625941d7eab8aa0e5d26ddba
def login(self, username=None, password=None): <NEW_LINE> <INDENT> print("\n"*5+"=" * 50) <NEW_LINE> self.__loadCookie() <NEW_LINE> if self.getLoginToken(): <NEW_LINE> <INDENT> print('Cookies认证成功') <NEW_LINE> self.__is_login=True <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('Cookies 认证失败,将...
验证码错误返回 {'errcode': 1991829, 'r': 1, 'data': {'captcha': '请提交正确的验证码 :('}, 'msg': '请提交正确的验证码 :('} 登录成功返回 {'r': 0, 'msg': '登陆成功'}
625941d76fece00bbac2d9a2
def test_nfc_p2p_go_neg(dev): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _test_nfc_p2p_go_neg(dev) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> dev[0].global_request("SET p2p_go_intent 7")
NFC connection handover to form a new P2P group (initiator becomes GO)
625941d74e4d5625662d4637
@app.task <NEW_LINE> def generic_static_index_html(): <NEW_LINE> <INDENT> categorys = GoodsCategory.objects.all() <NEW_LINE> goods_banners = IndexGoodsBanner.objects.all().order_by('index') <NEW_LINE> promotion_banners = IndexPromotionBanner.objects.all().order_by('index') <NEW_LINE> for category in categorys: <NEW_LIN...
异步生成静态主页,运维改了之后调用该异步方法生成静态主页 用户访问index.html:80 是未登陆状态下是不需要购物车和登陆信息的 只需要渲染html,只需要上下文和模板, 不需要user,request等信息
625941d75fc7496912cc3bdf
def get_max_ver(fmt, filelist): <NEW_LINE> <INDENT> x, y, z = 0,0,0 <NEW_LINE> verpat = fmt%'(\d+).(\d+).(\d+)' <NEW_LINE> verre = re.compile(r''+verpat+'', re.M) <NEW_LINE> for f in filelist: <NEW_LINE> <INDENT> match = verre.search(f) <NEW_LINE> if match: <NEW_LINE> <INDENT> x1 = int(match.group(1)) <NEW_LINE> y1 = i...
有一堆字符串,文件名均包含 %d.%d.%d 形式版本号,返回其中版本号最大的那个。 我一般用它来检测一堆发行版中版本号最大的那个文件。 :param str fmt: 要检测测字符串形式,例如 zrong-%s.tar.gz ,其中 %s 会被正则替换。 :param list files: 字符串列表。 :returns: 版本号最大的字符串。 :rtype: str
625941d773bcbd0ca4b2c2d8
def test_inventory_adjustment_and_negative_quants_2(self): <NEW_LINE> <INDENT> productA = self.env['product.product'].create({'name': 'Product A', 'type': 'product'}) <NEW_LINE> stock_location = self.env.ref('stock.stock_location_stock') <NEW_LINE> customer_location = self.env.ref('stock.stock_location_customers') <NEW...
Make sure negative quants get wiped out with an inventory adjustment
625941d73539df3088e2e5ac
def test_binomial_input(self): <NEW_LINE> <INDENT> seed = None <NEW_LINE> kwds = {'seed': seed, 'binomial': [0, 1, 2]} <NEW_LINE> self.assertRaises(ValueError, randomu, **kwds)
Test that the a list != 2 for Binomial distribution raises a value error.
625941d7bd1bec0571d90891
def test_retrive_tags(self): <NEW_LINE> <INDENT> Tag.objects.create(user=self.user, name='Breakfast') <NEW_LINE> Tag.objects.create(user=self.user, name='Dessert') <NEW_LINE> res = self.client.get(TAGS_URL) <NEW_LINE> tags = Tag.objects.all().order_by('-name') <NEW_LINE> serializer = TagSerializer(tags, many=True) <NEW...
Test retrieving tags
625941d756ac1b37e626442e
def __init__(self, K, p, **opt): <NEW_LINE> <INDENT> def _f(w, th, K=K, p=p, angle_f=angle_state): <NEW_LINE> <INDENT> Fa, Fb, Fc = np.asanyarray(angle_f(th, p)) <NEW_LINE> ea = p * K * w * Fa <NEW_LINE> eb = p * K * w * Fb <NEW_LINE> ec = p * K * w * Fc <NEW_LINE> return np.asanyarray([[Fa, Fb, Fc, ea, eb, ec]]).resha...
Inputs = [w, th_m] Outputs = [Fa, Fb, Fc, ea, eb, ec] States = None Arguments --------- K : `float` Motor electric constant p : `int` Number of pole pairs
625941d7d4950a0f3b08c5ae
def remove_action(self, action_name, action_id): <NEW_LINE> <INDENT> action_obj = self.get_action(action_name, action_id) <NEW_LINE> if action_obj is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> action_obj.cancel() <NEW_LINE> return True
Remove an existing action. action_name -- name of the action action_id -- ID of the action Returns a boolean indicating the presence of the action.
625941d7090684286d50ef49
def get_last_update(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> timefile = open("updatetime.txt", "r") <NEW_LINE> t = timefile.readline() <NEW_LINE> if t != "": <NEW_LINE> <INDENT> return datetime.strptime(t, "%Y-%m-%d %H:%M:%S.%f") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return datetime(1900, 1, 1) <NEW_LINE...
Retrieve last datetime written to updatetime.txt
625941d7656771135c3ebad3
def save_config(model_dir, config): <NEW_LINE> <INDENT> param_path = os.path.join(model_dir, "params.json") <NEW_LINE> print("[*] PARAM path: %s" % param_path) <NEW_LINE> with open(param_path, 'w') as fp: <NEW_LINE> <INDENT> json.dump(config.__dict__, fp, indent=4, sort_keys=True)
save config params in a form of param.json in model directory
625941d755399d3f05588916
def formatIRISWebService(self): <NEW_LINE> <INDENT> return "%04d-%02d-%02dT%02d:%02d:%02d.%03d" % (self.year, self.month, self.day, self.hour, self.minute, self.second, self.microsecond // 1000)
Returns string representation usable for the IRIS Web services. :return: string .. rubric:: Example >>> dt = UTCDateTime(2008, 5, 27, 12, 30, 35, 45020) >>> dt.formatIRISWebService() '2008-05-27T12:30:35.045'
625941d71b99ca400220ad14
def request_missing(self, configured_domains, current_domains): <NEW_LINE> <INDENT> for main_domain, domain_group in configured_domains.items(): <NEW_LINE> <INDENT> domains = domain_group['domains'] <NEW_LINE> if set(domains) != set(current_domains.get(main_domain, [])): <NEW_LINE> <INDENT> timestamp = datetime.utcnow(...
Request new certificates where needed.
625941d77b25080760e396ba
def srv_cautare_problema(self, intrare): <NEW_LINE> <INDENT> validator_problema = ValidatorProblema() <NEW_LINE> try: <NEW_LINE> <INDENT> validator_problema.validare_cautare_problema(intrare) <NEW_LINE> param = intrare.split(" ") <NEW_LINE> nr_lab, nr_prob = int(param[0]), int(param[1]) <NEW_LINE> index_problema_gasita...
Functia primeste un sir de caractere, asigura validarea si daca totul este in regula, il prelucreaza si returneaza sub forma de tuple datele problemei din repo. :param intrare: Un sir de caractere ce ar trebui sa reprezinte numarul laboratorului si al problemei ce trebuie cautata.
625941d745492302aab5e528
def backtest(): <NEW_LINE> <INDENT> global storage <NEW_LINE> while True: <NEW_LINE> <INDENT> if info['current_time'] < info['end']: <NEW_LINE> <INDENT> data_slice = slice_candles(info['current_time'], data) <NEW_LINE> storage['high'] = data_slice['high'] <NEW_LINE> storage['low'] = data_slice['low'] <NEW_LINE> storage...
BACKTEST EVENT LOOP
625941d7c432627299f04ea9
def test_secrets_keyring(self): <NEW_LINE> <INDENT> yaml.keyring = None <NEW_LINE> yaml_str = 'http:\n api_password: !secret http_pw_keyring' <NEW_LINE> with pytest.raises(yaml.HomeAssistantError): <NEW_LINE> <INDENT> load_yaml(self._yaml_path, yaml_str) <NEW_LINE> <DEDENT> yaml.keyring = FakeKeyring({'http_pw_keyring...
Test keyring fallback & get_password.
625941d7b5575c28eb68e264
def decrypt(ciphertext): <NEW_LINE> <INDENT> output = [] <NEW_LINE> ciphertext = [ciphertext[x:x+2] for x in range(0,len(ciphertext),2)] <NEW_LINE> for x in ciphertext: <NEW_LINE> <INDENT> first = [] <NEW_LINE> second = [] <NEW_LINE> for y in x: <NEW_LINE> <INDENT> if y == x[0]: <NEW_LINE> <INDENT> first = findIndex(ta...
Decrypt using the Playfair cipher and return the plaintext.
625941d73539df3088e2e5ad
def deep_delete(self): <NEW_LINE> <INDENT> self.remove_content() <NEW_LINE> db.session.delete(self) <NEW_LINE> AppInformations.update()
Supprime completement une ressource et le fichier liee
625941d7a8ecb033257d332e
def _createPopupMenus(self): <NEW_LINE> <INDENT> ProjectBaseBrowser._createPopupMenus(self) <NEW_LINE> self.editPixmapAct = self.menu.addAction( self.tr('Open in Icon Editor'), self._editPixmap) <NEW_LINE> self.menu.addSeparator() <NEW_LINE> self.renameFileAct = self.menu.addAction( self.tr('Rename file'), self._rename...
Protected overloaded method to generate the popup menu.
625941d794891a1f4081bd0c
def do_loo_cross_validation(self, *, remove=None, max_z=4.2): <NEW_LINE> <INDENT> aparams, kf, flux_vectors = self.get_flux_vectors(max_z=max_z, kfunits="mpc") <NEW_LINE> if remove is None: <NEW_LINE> <INDENT> nsims = np.shape(aparams)[0] <NEW_LINE> rng = np.random.default_rng() <NEW_LINE> remove = rng.integers(0,nsims...
Do cross-validation by constructing an emulator missing a single simulation and checking accuracy. The remove parameter chooses which simulation to leave out. If None this is random.
625941d78e7ae83300e4b22f
def max_servers(self, resource_desc): <NEW_LINE> <INDENT> credentials = get_credentials() <NEW_LINE> rdesc, info = self._check_local(resource_desc) <NEW_LINE> if rdesc is None: <NEW_LINE> <INDENT> return (0, info[1]) <NEW_LINE> <DEDENT> with self._lock: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE...
Returns the total of :meth:`max_servers` across all :class:`LocalAllocator` in the cluster. resource_desc: dict Description of required resources.
625941d7be8e80087fb20ea2
def check_cell(self, row, col): <NEW_LINE> <INDENT> raise Exception("The abstract Board method check_cell must be overridden by the child class")
Checks the specified cell and returns the contents. :param row: integer between 0 and 2 specifying the vertical coordinate of the cell to check :param col: integer between 0 and 2 specifying the horizontal coordinate of the cell to check :return: Board.X if the cell is captured by X, Board.O if the cell is captured by ...
625941d70c0af96317bb844b
def init(self): <NEW_LINE> <INDENT> if not super(IFCISHAPEPROFILEDEF,self).init(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> arg = self.args.getNext() <NEW_LINE> if not isUnset(arg): <NEW_LINE> <INDENT> self.OverallWidth= spfToInteger(arg) <NEW_LINE> <DEDENT> arg = self.args.getNext() <NEW_LINE> if not isUns...
get every argument's value and parse inverses
625941d78a43f66fc4b542c5
def is_defined_before(var_node: nodes.Name) -> bool: <NEW_LINE> <INDENT> varname = var_node.name <NEW_LINE> for parent in var_node.node_ancestors(): <NEW_LINE> <INDENT> if is_defined_in_scope(var_node, varname, parent): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> stmt = var_node.statement(future=True) ...
Check if the given variable node is defined before. Verify that the variable node is defined by a parent node (list, set, dict, or generator comprehension, lambda) or in a previous sibling node on the same line (statement_defining ; statement_using).
625941d78c0ade5d55d3ec1e
def main(): <NEW_LINE> <INDENT> output = 0 <NEW_LINE> if check(): <NEW_LINE> <INDENT> uuid = sys.argv[1] <NEW_LINE> item = sys.argv[2] <NEW_LINE> output = get_value(uuid, item) <NEW_LINE> <DEDENT> return output
Main function. The function/script uses sysv arguments to find the BTRFS filesystem and what data is requested. argv0: uuid of the btrfs (as in /sys/fs/btrfs) argv1: data requests, can be anything from /sys/fs/btrfs/<uuid>/allocation For example argv1 can be 'data/bytes_used'.
625941d76fb2d068a760f302
def init_instances_ips(instance): <NEW_LINE> <INDENT> server = nova.get_instance_info(instance) <NEW_LINE> management_ip = None <NEW_LINE> internal_ip = None <NEW_LINE> for network_label, addresses in six.iteritems(server.addresses): <NEW_LINE> <INDENT> for address in addresses: <NEW_LINE> <INDENT> if address['OS-EXT-I...
Extracts internal and management ips. As internal ip will be used the first ip from the nova networks CIDRs. If use_floating_ip flag is set than management ip will be the first non-internal ip.
625941d74527f215b584c6b7
def _sorted_filtered_list(self, filter=None): <NEW_LINE> <INDENT> series_list = [] <NEW_LINE> for series in self.product.series: <NEW_LINE> <INDENT> if filter is None or filter(series): <NEW_LINE> <INDENT> series_list.append(series) <NEW_LINE> <DEDENT> <DEDENT> if self.product.development_focus in series_list: <NEW_LIN...
Return a sorted, filtered list of series. The series list is sorted by version in reverse order. It is also filtered by calling `filter` on every series. If the `filter` function returns False, don't include the series. With None (the default, include everything). The development focus is always first in the list.
625941d7442bda511e8be678
def convert_patient_info_df(pats): <NEW_LINE> <INDENT> pats = pd.DataFrame(pats) <NEW_LINE> def convert_to_gleason(obj): <NEW_LINE> <INDENT> return value_default(GleasonScore.parse, str(obj), default=np.nan) <NEW_LINE> <DEDENT> keys = ['GS sum SB', 'GS sum TB'] + [f'GS_L{x}' for x in lrange()] <NEW_LINE> pats[keys] = p...
Convert data types.
625941d7cdde0d52a9e53297
def nhl(self): <NEW_LINE> <INDENT> self.run_op(op_name='nhl', op_func=lambda a: socket.ntohl(int(a)), num_of_args=1)
Network to host long
625941d7187af65679ca5381
def readContinuousData(self): <NEW_LINE> <INDENT> isConnected = self._communicator.isConnected() <NEW_LINE> self.ui.sendButton.setEnabled(isConnected) <NEW_LINE> self.ui.clearButton.setEnabled(isConnected) <NEW_LINE> if isConnected and not self.commData.empty(): <NEW_LINE> <INDENT> self.ui.commLog.append(self.timeStamp...
This method continually reads telemetry from the AeroQuad
625941d74a966d76dd551273
def reparent_iter(treestore, itr, parent, move_siblings=False): <NEW_LINE> <INDENT> src = itr <NEW_LINE> def move_children(i, dest): <NEW_LINE> <INDENT> while i: <NEW_LINE> <INDENT> n_cols = treestore.append( dest, treestore.get(i, *range(treestore.get_n_columns())) ) <NEW_LINE> to_remove = i <NEW_LINE> if treestore.it...
This effectively moves itr plus it's children to be a child of parent in treestore Params: treestore (gtkTreeStore): the treestore itr (gtkTreeIter): the iter to move parent (gtkTreeIter): the new parent for itr move_siblings (bool): if True, it will move all itr's siblings to parent
625941d7fff4ab517eb2f69f
def convertTypeToNumber(dType): <NEW_LINE> <INDENT> dTypeFound = None <NEW_LINE> for num, typeName in typeFromNumDict.items(): <NEW_LINE> <INDENT> if dType == typeName: <NEW_LINE> <INDENT> dTypeFound = num <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> if dTypeFound == None: <NEW_LINE> <INDENT> raise DurationException("...
Convert a duration type string (`dType`) to a numerical scalar representation that shows how many of that duration type fits within a whole note. >>> convertTypeToNumber('quarter') 4 >>> convertTypeToNumber('half') 2 >>> convertTypeToNumber('1024th') 1024 >>> convertTypeToNumber('maxima') 0.125
625941d70a366e3fb873ea7e
def start_publishing(self): <NEW_LINE> <INDENT> super().start_publishing() <NEW_LINE> self.schedule_next_message()
This method will enable delivery confirmations and schedule the first message to be sent to RabbitMQ
625941d7099cdd3c635f0ebd
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941d7a8ecb033257d332f
def text_strip(text, strip=""): <NEW_LINE> <INDENT> if not strip: <NEW_LINE> <INDENT> return text <NEW_LINE> <DEDENT> stripped = re.sub( fr"[{''.join(map(re.escape, strip))}]", "", text, re.UNICODE ) <NEW_LINE> return stripped
Strips any characters in `strip` that are present in `text`. Parameters ---------- text : str Text to process and strip. strip : str, optional (default: '') Characters that should be stripped from `text`. Returns ------- stripped : str
625941d721bff66bcd684bb3
def enable_location_preprocessing(self, additional_subprograms=None): <NEW_LINE> <INDENT> p = LocationPreprocessor() <NEW_LINE> if not additional_subprograms is None: <NEW_LINE> <INDENT> for subprogram in additional_subprograms: <NEW_LINE> <INDENT> p.add_subprogram(subprogram) <NEW_LINE> <DEDENT> <DEDENT> self._locatio...
Enable location preprocessing, must be called before adding any files
625941d77047854f462a166a
def get_subscriptions(): <NEW_LINE> <INDENT> subscriptions_list = [] <NEW_LINE> page = 1 <NEW_LINE> while True: <NEW_LINE> <INDENT> subscriptions = requests.get('https://api.github.com/user/subscriptions?page=%d' % page, auth=('token', token)) <NEW_LINE> subscriptions = subscriptions.json() <NEW_LINE> if not subscripti...
Get my current subscriptions
625941d715baa723493c41da
def right_stitch(self, query_image, train_image, method, mode): <NEW_LINE> <INDENT> train_image, query_image = cv2.flip(train_image, +1), cv2.flip(query_image, +1) <NEW_LINE> result = cv2.flip(self.stitch(query_image, train_image, method, mode), +1) <NEW_LINE> return result
query_image, train_image: images to stich together
625941d7fb3f5b602dac38f8
def bump_and_store_timestamp( self, resource_name, parent_id, obj=None, modified_field=None, last_modified=None ): <NEW_LINE> <INDENT> current_resource_timestamp = self._timestamps[parent_id].get(resource_name, 0) <NEW_LINE> current, resource_timestamp = self.bump_timestamp( current_resource_timestamp, obj, modified_fi...
Use the bump_timestamp to get its next value and store the resource_timestamp.
625941d73617ad0b5ed68159
@pytest.mark.run(order=0) <NEW_LINE> @pytest.mark.upgrade <NEW_LINE> @pytest.allure.feature('Test Setup') <NEW_LINE> @pytest.allure.story('Upgrade PathFinder') <NEW_LINE> def test_upgrade_PathFinder(context): <NEW_LINE> <INDENT> pf_upgrader = context.PF.PathFinderSUT( PF_Hudson=env.PF_Hudson, PF_Branch=env.PF_Branch, P...
Upgrade PF in the SUT.
625941d71f5feb6acb0c4daf
def isHappy(self, n): <NEW_LINE> <INDENT> seq = set() <NEW_LINE> while (True): <NEW_LINE> <INDENT> def sum2(num): <NEW_LINE> <INDENT> s = 0 <NEW_LINE> while (num != 0): <NEW_LINE> <INDENT> s += pow((num% 10),2) <NEW_LINE> num = num/10 <NEW_LINE> <DEDENT> return s <NEW_LINE> <DEDENT> retVal = sum2(n) <NEW_LINE> if (retV...
:type n: int :rtype: bool
625941d71f5feb6acb0c4db0
def message_ports_out(self): <NEW_LINE> <INDENT> return _analog_swig.pll_freqdet_cf_sptr_message_ports_out(self)
message_ports_out(pll_freqdet_cf_sptr self) -> swig_int_ptr
625941d750485f2cf553cffd
def search_cmd(cmd, mode=os.F_OK | os.X_OK, path=None): <NEW_LINE> <INDENT> def _access_check(fn, mode): <NEW_LINE> <INDENT> return ( os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn) ) <NEW_LINE> <DEDENT> if os.path.dirname(cmd): <NEW_LINE> <INDENT> if _access_check(cmd, mode): <NEW_LINE> <INDENT> r...
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. Note: This function was backported from...
625941d7a219f33f34628bc9
@verify_rails_error <NEW_LINE> @verpick_message <NEW_LINE> def assert_message_contain(m): <NEW_LINE> <INDENT> if not any([m in fm.message for fm in get_messages()]): <NEW_LINE> <INDENT> raise FlashMessageException("No flash message contains '%s'" % m)
Asserts that a message contains a specific string
625941d7d10714528d5fff48
def create_generator(args): <NEW_LINE> <INDENT> if args.dataset_type == 'coco': <NEW_LINE> <INDENT> from ..preprocessing.coco import CocoGenerator <NEW_LINE> validation_generator = CocoGenerator( args.coco_path, 'val2017', image_min_side=args.image_min_side, image_max_side=args.image_max_side ) <NEW_LINE> <DEDENT> elif...
Create generators for evaluation.
625941d74e4d5625662d4638
def get_connectable_devices(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = [] <NEW_LINE> sub_proc = Popen(["hcitool", "scan"], stdout=PIPE, stderr=PIPE, shell=True) <NEW_LINE> out, errors = sub_proc.communicate() <NEW_LINE> out = out.split("\n") <NEW_LINE> device_name_re = re.compile("^\t([0-9,:,A-F]{17})\t(...
Get a list of connectable devices. Must install 'sudo apt-get install bluez blueztools' to use this
625941d7925a0f43d254a0db
def gen_add_num_ranodm(data): <NEW_LINE> <INDENT> retur = {} <NEW_LINE> for k1ery in data: <NEW_LINE> <INDENT> if not (k1ery == 'bild' and random.randrange(0, 2, 1)): <NEW_LINE> <INDENT> retur.update({k1ery: random.choice(data[k1ery])}) <NEW_LINE> <DEDENT> <DEDENT> return retur
Генерация случайной выборки :param data: :return:
625941d73317a56b86939eb7
def __contains__(self, item): <NEW_LINE> <INDENT> if self._first is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif self._first == item: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif self._rest is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self...
Return whether <item> is in this list. Use == to compare items. @type self: LinkedListRec @type item: object @rtype: bool >>> lst = LinkedListRec([1, 2, 3]) >>> 2 in lst # Equivalent to lst.__contains__(2) True >>> 4 in lst False
625941d7d486a94d0b98e3a9
def b58encode(v): <NEW_LINE> <INDENT> long_value = 0 <NEW_LINE> for (i, c) in enumerate(v[::-1]): <NEW_LINE> <INDENT> long_value += (256**i) * _bord(c) <NEW_LINE> <DEDENT> result = '' <NEW_LINE> while long_value >= __b58base: <NEW_LINE> <INDENT> div, mod = divmod(long_value, __b58base) <NEW_LINE> result = __b58chars[mo...
encode v, which is a string of bytes, to base58.
625941d792d797404e3043ee
def update(self, **kwargs): <NEW_LINE> <INDENT> from indigo.models import Notification <NEW_LINE> pre_state = self.mqtt_get_state() <NEW_LINE> kwargs['container_modified_ts'] = datetime.now() <NEW_LINE> if 'metadata' in kwargs: <NEW_LINE> <INDENT> metadata = meta_cdmi_to_cassandra(kwargs['metadata']) <NEW_LINE> kwargs[...
Update a collection
625941d7d6c5a102081442af
def _request(self, script, args): <NEW_LINE> <INDENT> url = self.baseurl + script <NEW_LINE> req = urllib.request.Request(url=url, data=urllib.parse.urlencode(args)) <NEW_LINE> req.add_header("X-Pvoutput-Apikey", self.apikey) <NEW_LINE> req.add_header("X-Pvoutput-SystemId", self.sid) <NEW_LINE> f = urllib.request.urlop...
Invoke a specific API script Args: script (str): The path to the script to invoke args (dict): Arguments to the script Returns: str. The data returned by the server Raises: pvoutputorg.Error
625941d7009cb60464c63613
def cap_cache(cap_queue, flag_queue, frame_queue, progress_count): <NEW_LINE> <INDENT> cache = None <NEW_LINE> flag = 1 <NEW_LINE> start_time = time.time() <NEW_LINE> while 1: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cache = cap_queue.get_nowait() <NEW_LINE> <DEDENT> except Exception:pass <NEW_LINE> try: <NEW_LINE>...
图像分配进程
625941d796565a6dacc8f92e
def compute_new_size(self, topology, node_coord, mask): <NEW_LINE> <INDENT> connectivity = topology.nodes_belonging_to_cell <NEW_LINE> size = node_coord[connectivity[:, 1]] - node_coord[connectivity[:, 0]] <NEW_LINE> cell_error = (size < 0) <NEW_LINE> if cell_error[mask].any(): <NEW_LINE> <INDENT> raise ValueError("Len...
Computation of the cells length at time t+dt :param topology: table to link nodes and cells index :param node_coord: array with the nodes coordinates at time t+dt :param mask: boolean array to identify classical cells :type topology: Topology1D :type node_coord: np.array([nbr_nodes, 1], dtype=np.float64) :type mask: ...
625941d7dc8b845886cb5799
def bin(label, src, l=None, o=None, R=None, C=None, r=None, c=None, a=None, A=None): <NEW_LINE> <INDENT> usage_string = "bin [-l d] [-o] [-R d] [-C d] [-a d] label src dst" <NEW_LINE> cmd_str = f'{BART_PATH} ' <NEW_LINE> cmd_str += 'bin ' <NEW_LINE> flag_str = '' <NEW_LINE> opt_args = f'' <NEW_LINE> multituples = [] <N...
Binning :param label array: :param src array: :param x OUTFILE: :param l int: Bin according to labels: Specify cluster dimension :param o bool: Reorder according to labels :param R int: Quadrature Binning: Number of respiratory labels :param C int: Quadrature Binning: Number of cardiac labels :param r VEC2: (Respi...
625941d71d351010ab855d7e
def get_trace_stream(self, core_id, stream_id): <NEW_LINE> <INDENT> if self.root_proc == self: <NEW_LINE> <INDENT> return self.traces[core_id] <NEW_LINE> <DEDENT> return self.root_proc.get_trace_stream(core_id, stream_id)
Retrieves parser for specified stream and core. Parameters ---------- core_id : int Parser's core ID. stream_id : int Parser's stream ID. Returns ------- SysViewTraceDataParser parser object for specified stream and core
625941d7d164cc6175782fb1
def issubclass_builtin(): <NEW_LINE> <INDENT> return ( issubclass(type(all), object) and "*all your base are belong to object")
issubclass: Check if a class is a subclass of an other one.
625941d71d351010ab855d7f
def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None)
Retrieve the value for the "Response" output from this Choreo execution. (The response from Amazon.)
625941d76e29344779a62874
def do_GET(path): <NEW_LINE> <INDENT> status = OK <NEW_LINE> mode = "r" <NEW_LINE> m = re.match(r'/www/(?P<location>.*)$', path) <NEW_LINE> location = STATIC_DIR + m.group('location') <NEW_LINE> content_type = mimetypes.guess_type(location)[0] <NEW_LINE> if content_type is None: <NEW_LINE> <INDENT> m = re.match(r'.*\.(...
Returns response to GET requests
625941d723e79379d52ee7c5
def run_episode(self): <NEW_LINE> <INDENT> action_probs = tf.TensorArray(dtype=tf.float32, size=0, dynamic_size=True) <NEW_LINE> values = tf.TensorArray(dtype=tf.float32, size=0, dynamic_size=True) <NEW_LINE> rewards = tf.TensorArray(dtype=tf.float32, size=0, dynamic_size=True) <NEW_LINE> fixed, moving, params = next(s...
Runs a single episode to collect training data.
625941d721bff66bcd684bb4
def add_measurer(measurer): <NEW_LINE> <INDENT> cursor = cnx.cursor() <NEW_LINE> query = "INSERT INTO measurers (code, name, description) VALUES (%s, %s, %s)" <NEW_LINE> cursor.execute(query, (measurer.code, measurer.name, measurer.description)) <NEW_LINE> measurer.id = cursor.lastrowid <NEW_LINE> cnx.commit() <NEW_LIN...
Add new measurer to database. Keyword arguments: cnx -- connection used to write measurement measurer -- Measurer to store
625941d70fa83653e465721d
def skin_mouth_upper_lower_boundary(m_b, d): <NEW_LINE> <INDENT> x = m_b["bottom_lip_boundary"][0] <NEW_LINE> y = m_b["bottom_lip_boundary"][1] <NEW_LINE> z1 = np.polyfit(x, y, 2) <NEW_LINE> p1 = np.poly1d(z1) <NEW_LINE> xu_min, xu_max = m_b["bottom_lip_boundary"][0].min(),m_b["bottom_lip_boundary"][0].max() <NEW_LINE>...
return the upper and lower boundary based on middle_part_boundary INPUT: d - num of blocks m_b - the output of mouth_middle_part_boundary OUTPUT: dict("top_skin_bounday", "bottom_skin_bounday") parameters: L - horizontal length H - original height of middle part r ...
625941d738b623060ff0b051
def scale_color(img, max_val=255.): <NEW_LINE> <INDENT> return img / max_val
Scales an image of color values (int) [0,255] to (float) [0,1]
625941d7507cdc57c6306f42
def isPowerOfThree(self, n): <NEW_LINE> <INDENT> if n <=0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if n!=1 and n%3 !=0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if n == 1 or n==3: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> x = n <NEW_LINE> while x!= 1: <NEW_LINE> <INDENT> if (x/3) %3 !...
:type n: int :rtype: bool
625941d7851cf427c661a770
def run_all(bitstring): <NEW_LINE> <INDENT> if is_binary(bitstring) and is_div_by_sevens(bitstring): <NEW_LINE> <INDENT> my_list = split_into_sevens(bitstring) <NEW_LINE> return add_parity(my_list) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "Input Error"
This function takes bitstring as input, if bitstring is only 0s and 1s with length evenly divisible by 7 it uses even parity to return the resulting list of 8-bit binary strings. otherwise it returns "Input Error"
625941d7f7d966606f6aa26a