code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def delete_fw_device(self, tenant_id, fw_id, data): <NEW_LINE> <INDENT> drvr_dict, mgmt_ip = self.sched_obj.get_fw_dev_map(fw_id) <NEW_LINE> ret = drvr_dict.get('drvr_obj').delete_fw(tenant_id, data) <NEW_LINE> if ret: <NEW_LINE> <INDENT> self.sched_obj.deallocate_fw_dev(fw_id) <NEW_LINE> <DEDENT> return ret
Deletes the Firewall.
625941f6d486a94d0b98e7ab
def unpack(self, component='images', **kwargs): <NEW_LINE> <INDENT> if not hasattr(self, component): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if component in ('images', 'masks'): <NEW_LINE> <INDENT> data_format = kwargs.get('data_format') <NEW_LINE> if np.all(self.images_shape == self.images_shape[0, :]): <N...
Basic way for unpacking components from batch. Parameters ---------- component : str component to unpack, can be 'images' or 'masks'. data_format : 'channels_last' or 'channels_first' or None Reflects where to put channels dimension: right after batch dimension or after all spatial axes or do not put it al...
625941f68e71fb1e9831de0a
def __init__(self, hass, config_entry, session, hub): <NEW_LINE> <INDENT> self.config_entry = config_entry <NEW_LINE> self.station_name = self.config_entry.data[CONF_STATION]["name"] <NEW_LINE> self.attr = {ATTR_ATTRIBUTION: ATTRIBUTION} <NEW_LINE> self._available = False <NEW_LINE> self._state = None <NEW_LINE> self._...
Initialize.
625941f6bd1bec0571d90c94
def historyMessage(self, date): <NEW_LINE> <INDENT> desc = {"name": "HistoryMessageReslut", "desc": "historyMessage返回结果", "fields": [{"name": "code", "type": "Integer", "desc": "返回码,200 为正常。"}, {"name": "url", "type": "String", "desc": "历史消息下载地址。"}, {"name": "date", "type": "String", "desc": "历史记录时间。"}]} <NEW_LINE> r =...
消息历史记录下载地址获取 方法消息历史记录下载地址获取方法。获取 APP 内指定某天某小时内的所有会话消息记录的下载地址。(目前支持二人会话、讨论组、群组、聊天室、客服、系统通知消息历史记录下载) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return url:历史消息下载地址。 @return date:历史记录时间。
625941f6566aa707497f4bc4
def load_json(json_str): <NEW_LINE> <INDENT> ret = create(Variable("x")) <NEW_LINE> ret._set_json_attr("json", json_str) <NEW_LINE> return ret.apply("LoadJSON")
Create a new graph by loading from json Parameters ---------- json_str : str The json string Returns ------- graph : Graph The loaded graph
625941f6283ffb24f3c55f5e
def news_scrapper(self, days_prior): <NEW_LINE> <INDENT> days_prior = int(days_prior) if days_prior != "" else 90 <NEW_LINE> date_included = pd.to_datetime(datetime.date.today() - datetime.timedelta(days = days_prior)) <NEW_LINE> news_url = "https://www.biznesradar.pl/wiadomosci/"+company <NEW_LINE> r = requests.get(ne...
Scrap news about the company using WSE code.
625941f6cc0a2c11143dd4f6
def callback(self, timestamp, event_type, payload): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = (event_type, payload) <NEW_LINE> if event_type in self._events_to_ignore: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> LOG.debug('RX NOTIFICATION ==>\nevent_type: %(event)s, ' 'payload: %(payload)s\n', ( {'event': ...
Callback method for processing events in notification queue. :param timestamp: time the message is received. :param event_type: event type in the notification queue such as identity.project.created, identity.project.deleted. :param payload: Contains information of an event
625941f61f037a2d8b946860
def test_peer_probe_snapd_running(self): <NEW_LINE> <INDENT> extra_node = self.servers[-1] <NEW_LINE> ret, _, _ = peer_detach(self.mnode, extra_node) <NEW_LINE> self.assertEqual(ret, 0, "Peer detach failed for %s" % extra_node) <NEW_LINE> g.log.info("Peer detach success for %s", extra_node) <NEW_LINE> self.servers.remo...
-> Create Volume -> Create snap for that volume -> Enable uss -> Check snapd running or not -> Probe a new node while snapd is running
625941f6091ae356686675b7
def complete_registration(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def wrap(*args, **kwargs): <NEW_LINE> <INDENT> if current_user.account_confirmed is False: <NEW_LINE> <INDENT> return redirect(url_for('complete_signup')) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return f(*args, **kwargs) <NEW_LINE> <DEDENT> <D...
This decorator is used to ensure that the second sign up form was filled up
625941f621bff66bcd684fb1
def __init__(self, app, model): <NEW_LINE> <INDENT> super().__init__(app, model) <NEW_LINE> self.set_title(self.app.name) <NEW_LINE> self.set_resizable(False) <NEW_LINE> self.resize(200, 400) <NEW_LINE> self.set_icon_from_file(self.getIcon())
Ctor of WindowViewBase.
625941f6851cf427c661ab6d
def p_expression_id(p): <NEW_LINE> <INDENT> p[0] = Symbol(p[1])
expression : ID
625941f6cdde0d52a9e5369e
def oracle_to_sqlite(sql, args): <NEW_LINE> <INDENT> res = sql <NEW_LINE> res_args = copy(args) <NEW_LINE> patterns = [ (r"MARKETDATA\.(\w)",r"\1"), ] <NEW_LINE> for pattern, replacement in patterns: <NEW_LINE> <INDENT> res = re.sub(pattern,replacement,res) <NEW_LINE> <DEDENT> for to_date in re.findall(r"to_date\([^\)]...
Roughly converts Oracle DML to SQLite DML :param sql: SQL :type sql: str :param args: Bind params :type args: dict :returns: (new sql, new args)
625941f663b5f9789fde774b
def create_line_for_downwards(board): <NEW_LINE> <INDENT> downwards_lines = [] <NEW_LINE> temporary_list = [] <NEW_LINE> for i in range(len(board[0])): <NEW_LINE> <INDENT> for line in board: <NEW_LINE> <INDENT> temporary_list.append(line[i]) <NEW_LINE> if len(temporary_list) == len(board): <NEW_LINE> <INDENT> downwards...
The function creates a list of the downwards line of the board.
625941f6e64d504609d74ea4
def sjis(source): <NEW_LINE> <INDENT> result = decoder.cp932(encoder.i2022(source)) <NEW_LINE> return result
Convert jis(iso-2022-jp) string to shift-jis
625941f68c0ade5d55d3f026
def makeReverseMetaMap(self): <NEW_LINE> <INDENT> revmap = {} <NEW_LINE> i = 0 <NEW_LINE> for mgids in self.sMkt.META_MAP.values(): <NEW_LINE> <INDENT> for mgid in mgids: <NEW_LINE> <INDENT> revmap[mgid] = i <NEW_LINE> <DEDENT> i += 1 <NEW_LINE> <DEDENT> return revmap
Form map which tells in which tab items of given metagroup are located
625941f6fb3f5b602dac3cff
def on_timeout(self, cmd, pipe): <NEW_LINE> <INDENT> logging.debug('the trigger %s is taking too long: killing it' % ' '.join(cmd)) <NEW_LINE> try: <NEW_LINE> <INDENT> pipe.proc.kill() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass
Kill a process that is taking too long to complete.
625941f676e4537e8c351cdd
def id_to_token(self, i): <NEW_LINE> <INDENT> return self._token_dict_inv[i]
id转换为对应的token
625941f616aa5153ce362ade
def translate_properties(self, properties, client_resolve=True, ignore_resolve_error=False): <NEW_LINE> <INDENT> rules = self.translation_rules(properties) or [] <NEW_LINE> properties.update_translation( rules, client_resolve=client_resolve, ignore_resolve_error=ignore_resolve_error)
Set resource specific rules for properties translation. The properties parameter is a properties object and the optional client_resolve flag is to specify whether to do 'RESOLVE' translation with client lookup.
625941f65fcc89381b1e1d2a
def Kill(self, request, context): <NEW_LINE> <INDENT> self.plugin.stop_plugin() <NEW_LINE> return ErrReply()
Responds to kill request by stopping the gRPC server
625941f61f037a2d8b946861
def __map_ext_names(self, ext_obj, ext_objs): <NEW_LINE> <INDENT> return {e.name: e for e in ext_objs if e.name in ext_obj.requires}
Return dictionary of extension objects that a given extension requires.
625941f6b545ff76a891447a
def create(self, waitForSync=False, **kwargs): <NEW_LINE> <INDENT> params = {"waitForSync": waitForSync, "name": self.name} <NEW_LINE> params.update(kwargs) <NEW_LINE> response = self.connection.post( self.CREATE_COLLECTION_PATH, data=params) <NEW_LINE> if response.status == 200: <NEW_LINE> <INDENT> return self <NEW_LI...
Create new **Collection**. You can specify ``waitForSync`` argument (boolean) to wait until collection will be synced to disk
625941f6eab8aa0e5d26e1bf
def SetupDefaultRpcModuleMock(rpc_mod): <NEW_LINE> <INDENT> rpc_mod.DnsOnlyRunner.return_value = CreateRpcRunnerMock()
Configures the given rpc_mod. All relevant functions in rpc_mod are stubbed in a sensible way. @param rpc_mod: the mock module to configure
625941f699cbb53fe6793249
def getInt(self): <NEW_LINE> <INDENT> return config.getInt(self._name, self._section, self._option, self._default)
Gets a value of the settings option converted to integer. If the option does not exist the 'None' is returned. :return: A value of the option :rtype: integer
625941f663d6d428bbe44b56
def multi_step_finish(self, out_obs, out_rews, out_dones): <NEW_LINE> <INDENT> obs, rews, dones = self._pull('multi_step') <NEW_LINE> hi = self._lo + obs.shape[1] <NEW_LINE> out_obs[:, self._lo:hi] = obs <NEW_LINE> out_rews[:, self._lo:hi] = rews <NEW_LINE> out_dones[:, self._lo:hi] = dones
wait until remote multi step completes
625941f60a366e3fb873ee85
def post(self, request): <NEW_LINE> <INDENT> question_data = json.loads(request.body.decode()) <NEW_LINE> type_id = question_data.get('type') <NEW_LINE> title = question_data.get('title') <NEW_LINE> answer = question_data.get('answer') <NEW_LINE> type_id = int(type_id) <NEW_LINE> print(type_id, title, answer) <NEW_LINE...
新增试题 :param request: :return:
625941f66aa9bd52df03740d
def get_all_data(): <NEW_LINE> <INDENT> res = {} <NEW_LINE> for folder in LANGUAGE_PATH.iterdir(): <NEW_LINE> <INDENT> path = Path(folder) <NEW_LINE> lan_name = path.name <NEW_LINE> if not _good_folder(path): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> for file in path.iterdir(): <NEW_LINE> <INDENT> if not file.na...
Get all language data. :return: All of the language data in a dict.
625941f666656f66f7cbc812
def output_max(self, maximum): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.red_pitaya.set_output_maximum(self.num_out, maximum) <NEW_LINE> <DEDENT> except socket.error as err: <NEW_LINE> <INDENT> self._warn_and_reconnect(err) <NEW_LINE> self.output_max(maximum)
Set the maximum output voltage for the specified channel.
625941f607f4c71912b11aea
def try_filetype_with_coverage_via_afl(self, parameter: str, dummyfiles_path: str, file_type: str) -> float: <NEW_LINE> <INDENT> dummyfiles = os.listdir(dummyfiles_path) <NEW_LINE> if not dummyfiles: <NEW_LINE> <INDENT> print(dummyfiles_path, "has no dummyfiles!") <NEW_LINE> return 0 <NEW_LINE> <DEDENT> try: <NEW_LINE>...
Try to infer the code coverage a certain filetype gives. :param parameter: The parameter that leads to the file processing :param dummyfiles_path: The path to a directory with files of that filetype :param file_type: The file type that is to be tested :return: The average code coverage.
625941f6cc40096d61595fb2
def __init__(self): <NEW_LINE> <INDENT> self.last = None <NEW_LINE> self.current = None
Creates a CircularLinkedList object Inputs: None Outputs: None
625941f61b99ca400220b119
def _instrument_migration(*args): <NEW_LINE> <INDENT> nonlocal migration_done <NEW_LINE> nonlocal migration_version <NEW_LINE> nonlocal migration_stall <NEW_LINE> migration_stall.wait() <NEW_LINE> try: <NEW_LINE> <INDENT> real_migration(*args) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> migration_done.set...
Control migration progress and check results.
625941f632920d7e50b2883b
def mount(self, app, path=None): <NEW_LINE> <INDENT> self.apps.append(MountedApp(app, path))
Mounts app inside project.
625941f6e64d504609d74ea5
def set_cover_position(self, position, **kwargs): <NEW_LINE> <INDENT> self.wink.set_state(float(position)/100)
Move the roller shutter to a specific position.
625941f6627d3e7fe0d694b7
def debugFit(self, stepname, xVector, yVector, yModel, mask, ampName): <NEW_LINE> <INDENT> frame = getDebugFrame(self._display, stepname) <NEW_LINE> if frame: <NEW_LINE> <INDENT> import matplotlib.pyplot as plt <NEW_LINE> fig, axs = plt.subplots(2) <NEW_LINE> if mask is None: <NEW_LINE> <INDENT> mask = np.ones_like(xVe...
Debug method for linearity fitting. Parameters ---------- stepname : `str` A label to use to check if we care to debug at a given line of code. xVector : `numpy.array`, (N,) The values to use as the independent variable in the linearity fit. yVector : `numpy.array`, (N,) The values to use as the de...
625941f6d164cc61757833b4
def norm(self, arg): <NEW_LINE> <INDENT> return IVM(*tuple(map(sub, arg, [min(arg)] * 4)))
Normalize such that 4-tuple all non-negative members.
625941f6be8e80087fb2129b
def print_vcf_header(stream): <NEW_LINE> <INDENT> stream.write("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n")
print vcf header
625941f6f8510a7c17cf9d67
def MakeDataAndDict(): <NEW_LINE> <INDENT> global database <NEW_LINE> database = OpenDatabase() <NEW_LINE> global keys <NEW_LINE> keys = database.keys() <NEW_LINE> signal_keys = sorted([key for key in keys if 'signal' in key]) <NEW_LINE> att_corr_keys = sorted([key for key in keys if 'attention/correct' in key]) <NEW_L...
Run this first, as it will create globals for other functions Database is a all data in HDF format (signals and organized results). Will be loaded into df. Keys is a result of dividing all the strings, which are apaths to the HDF database into conditions
625941f6fff4ab517eb2faa6
def test_write_dflt_file(): <NEW_LINE> <INDENT> known_dflt_file = os.path.join(data_dir, "HYDRO.IN.defaults") <NEW_LINE> tmpl_file = os.path.join(data_dir, "hydrotrend.in.tmpl") <NEW_LINE> parameters_file = os.path.join(data_dir, "parameters.yaml") <NEW_LINE> dflt_file = write_dflt_file(tmpl_file, parameters_file) <NEW...
Test the 'write_dflt_file' function versus a known dflt file.
625941f63eb6a72ae02ecb55
def trimTree(root, L, R): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if root.val < L: <NEW_LINE> <INDENT> return trimTree(root.right) <NEW_LINE> <DEDENT> if root.val > R: <NEW_LINE> <INDENT> return trimTree(root.left) <NEW_LINE> <DEDENT> root.left = trimTree(root.left, L, R) <N...
返回以root为根节点的子树的修建结果
625941f6de87d2750b860400
def dict_to_yaml(indict: Dict[str, Any]) -> str: <NEW_LINE> <INDENT> return yaml.dump(indict, default_flow_style=False)
This function makes the dictionnary to yaml formatted text Parameters: indict Dict[str, Any] The dictionnary containing the pipeline parameters, extracted from command line Return: str The yaml formatted string, directly built ...
625941f6e1aae11d1e74a323
def direct_to_template(request, template, extra_context=None, **kwargs): <NEW_LINE> <INDENT> context = extra_context or {} <NEW_LINE> context["params"] = kwargs <NEW_LINE> for (key, value) in context.items(): <NEW_LINE> <INDENT> if callable(value): <NEW_LINE> <INDENT> context[key] = value() <NEW_LINE> <DEDENT> <DEDENT>...
Replacement for Django's ``direct_to_template`` that uses Mezzanine's device-aware ``render_to_response``.
625941f666673b3332b926f6
def forwards(self, orm): <NEW_LINE> <INDENT> s = orm.EvaluationStatus() <NEW_LINE> s.name = "to process" <NEW_LINE> s.url = "to_process" <NEW_LINE> s.save() <NEW_LINE> s = orm.EvaluationStatus() <NEW_LINE> s.name = "in progress" <NEW_LINE> s.url = "in_progress" <NEW_LINE> s.save() <NEW_LINE> s = orm.EvaluationStatus(...
Write your forwards methods here.
625941f69b70327d1c4e143e
def get_model_variables(getter, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, rename=None, use_resource=None, **_): <NEW_LINE> <INDENT> short_name = name.split('/')[-1] <NEW_LINE> if rename and short_name in rename: <NEW_LINE> ...
This ensure variables are retrieved in a consistent way for core layers.
625941f6eab8aa0e5d26e1c0
def _more_than_one_index(s, brackets=2): <NEW_LINE> <INDENT> start = 0 <NEW_LINE> brackets_num = 0 <NEW_LINE> while start != -1 and brackets_num < brackets: <NEW_LINE> <INDENT> start = s.find('[', start) <NEW_LINE> if start == -1: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> start = s.find(']', start) <NEW_LINE> brack...
Search for two sets of [] [] @param s: string @param brackets: int
625941f630bbd722463cc42f
def _check_config(self): <NEW_LINE> <INDENT> if not self.__maven: <NEW_LINE> <INDENT> console.fatal('MavenCache is not configured')
Check whether maven is configured correctly.
625941f64527f215b584cab6
def test_load_already_registered(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> WinDivert() <NEW_LINE> <DEDENT> except WindowsError as e: <NEW_LINE> <INDENT> self.fail("WinDivert() constructor raised %s" % e)
Tests WinDivert loading from the default path (DLLs dir inside python's home). This assumes the driver has been previously registered
625941f629b78933be1e5d0a
def colorize(color=None, string=None, output=False): <NEW_LINE> <INDENT> ansicolors = odict([ ('black', '30'), ('red', '31'), ('green', '32'), ('yellow', '33'), ('blue', '34'), ('magenta', '35'), ('cyan', '36'), ('gray', '37'), ('bgblack', '40'), ('bgred', '41'), ('bggreen', '42'), ('bgyellow', '43'), ('bgblue', '44'),...
Colorize output text. Arguments: color = the color you want (use 'bg' with background colors, e.g. 'bgblue') string = the text to be colored output = whether to return the modified version of the string Examples: colorize('green', 'hi') # Simple example colorize(['yellow', 'bgblack']); print('Hello...
625941f63317a56b8693a2ad
def __init__(self, public_key=None, private_key=None): <NEW_LINE> <INDENT> self.__private_key = private_key <NEW_LINE> self.__public_key = public_key <NEW_LINE> if self.__public_key: <NEW_LINE> <INDENT> self.__public_key = ecdsa.VerifyingKey.from_string( public_key.decode('hex'), curve=ecdsa.NIST521p) <NEW_LINE> <DEDEN...
Constructor method for an indiecoin address. Parameters ---------- public_key : str string hexadecimal representation of a public key private_key : str string hexadecimal representation of a private key Attributes ----------- __private_key : ecdsa.VerifyinKey Object representation of pri...
625941f610dbd63aa1bd3207
def __init__( self, container_name, element_type_index, element_type_typedef, eraser, key_type_index=None, key_type_typedef=None, unordered_maps_and_sets=False): <NEW_LINE> <INDENT> self._name = container_name <NEW_LINE> self.element_type_index = element_type_index <NEW_LINE> self.element_type_typedef = element_type_ty...
:param container_name: std container name :param element_type_index: position of value\mapped type within template arguments list :param element_type_typedef: class typedef to the value\mapped type :param key_type_index: position of key type within template arguments list :param key_type_typedef: class typedef to the k...
625941f6956e5f7376d714d0
def p_Line(p): <NEW_LINE> <INDENT> p[0] = Line(p[1])
Line : CodeBlock | Statement | Embeded
625941f68da39b475bd655e2
def test_input_preprocessor(self): <NEW_LINE> <INDENT> randomize = Randomize() <NEW_LINE> self.send_signal("Preprocessor", randomize) <NEW_LINE> self.assertEqual( randomize, self.widget.preprocessors, 'Preprocessor not added to widget preprocessors') <NEW_LINE> self.widget.apply_button.button.click() <NEW_LINE> self.wa...
Check learner's preprocessors with an extra pp on input
625941f697e22403b379d601
def SetMotorSpeed(self, *args): <NEW_LINE> <INDENT> return _Box2D.b2LineJoint_SetMotorSpeed(self, *args)
SetMotorSpeed(self, float32 speed) Set the motor speed, usually in meters per second.
625941f65fc7496912cc3fe3
@yui.command('markov_optout') <NEW_LINE> def optout(user, argv): <NEW_LINE> <INDENT> m.delete_tag(user.nick) <NEW_LINE> yui.db.execute("INSERT OR IGNORE INTO markov_optout (nick) VALUES(?);", (user.nick,)) <NEW_LINE> yui.db.commit() <NEW_LINE> return 'Purged your Markov model. A new one will not be built from your mess...
Opt out of all markov functions. Your messages will no longer be incorporated into any models. Your personal markov model will be irreversibly deleted.
625941f6a05bb46b383ece80
def _get_sim(self, seed): <NEW_LINE> <INDENT> world_params = WorldParams(size=(self.floor_size, self.floor_size, 2.5), num_substeps=self.n_substeps) <NEW_LINE> successful_placement = False <NEW_LINE> failures = 0 <NEW_LINE> while not successful_placement: <NEW_LINE> <INDENT> if (failures + 1) % 10 == 0: <NEW_LINE> <IND...
Calls build_world_step and then modify_sim_step for each module. If a build_world_step failed, then restarts.
625941f6f7d966606f6aa671
def create(vm_): <NEW_LINE> <INDENT> log.info('Creating Cloud VM {0}'.format(vm_['name'])) <NEW_LINE> conn = get_conn() <NEW_LINE> kwargs = {} <NEW_LINE> kwargs['name'] = vm_['name'] <NEW_LINE> kwargs['image'] = get_image(conn, vm_) <NEW_LINE> kwargs['size'] = get_size(conn, vm_) <NEW_LINE> try: <NEW_LINE> <INDENT> dat...
Create a single VM from a data dict
625941f6c432627299f052b1
def getAnswer2IFC (self, stimulus): <NEW_LINE> <INDENT> if stimulus == True: <NEW_LINE> <INDENT> self.answer = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.answer = 2 <NEW_LINE> <DEDENT> return self.answer
where "stimulus" has to be a boolean this function checks whether the choosed picture contained a stimulus or not it returns a number 1 if the answer was correct, 2 if the answer was wrong
625941f64e4d5625662d4a33
def test_code_8c(gb): <NEW_LINE> <INDENT> gb.cpu.register.A = 0x00 <NEW_LINE> gb.cpu.register.H = 0x00 <NEW_LINE> gb.cpu.register.F = 0b00000000 <NEW_LINE> cycles = op.code_8c(gb) <NEW_LINE> assert cycles == 4 <NEW_LINE> assert_registers(gb, A=0x00, H=0x00, F=0b10000000) <NEW_LINE> gb.cpu.register.A = 0x00 <NEW_LINE> g...
ADC A,H - A=A+H+carry_flag (yes, '+carry_flag' is just +1 or +0)
625941f6d7e4931a7ee9e585
def is_hash_matching(self) -> bool: <NEW_LINE> <INDENT> piece_hash = sha1(self.data).digest() <NEW_LINE> return self.hash_value == piece_hash
Returns if the piece hash (SHA-1) is same as the hash received from torrent meta-info
625941f6e1aae11d1e74a324
def __init__(self, frequentPatterns, measure, threshold): <NEW_LINE> <INDENT> self.frequentPattern = frequentPatterns <NEW_LINE> self.measure = measure <NEW_LINE> self.threshold = threshold <NEW_LINE> self.finalPatterns = {}
:param inputFile: input file name or path :type inputFile: str :param sep:
625941f6d8ef3951e3243ba3
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, UploadLogo): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941f666673b3332b926f7
def test_defaults(): <NEW_LINE> <INDENT> t1 = Task() <NEW_LINE> t2 = Task(None, None, False, None) <NEW_LINE> assert t1 == t2
Using no paramaters should invoke defaults.
625941f607f4c71912b11aeb
@require_active_login <NEW_LINE> def activity_view(request): <NEW_LINE> <INDENT> username = request.matchdict["username"] <NEW_LINE> user = LocalUser.query.filter_by(username=username).first() <NEW_LINE> activity_id = request.matchdict["id"] <NEW_LINE> if request.user is None: <NEW_LINE> <INDENT> return render_404(requ...
/<username>/activity/<id> - Display activity This should display a HTML presentation of the activity this is NOT an API endpoint.
625941f6b57a9660fec33ef3
@main.route("/admin", methods=["GET"]) <NEW_LINE> @login_required <NEW_LINE> def dashboard(): <NEW_LINE> <INDENT> return render_template( "dashboard.html", title="Admin Dashboard", template="dashboard-template", current_user=current_user, body="You are now logged in!", posts=Post.query.order_by(Post.time_created.desc()...
Logged-in User Dashboard.
625941f6d164cc61757833b5
def rightSideView(self, root): <NEW_LINE> <INDENT> def inorder(root, level): <NEW_LINE> <INDENT> table[level] = root.val <NEW_LINE> max_depth[0] = max(max_depth[0], level) <NEW_LINE> if root.left: <NEW_LINE> <INDENT> inorder(root.left, level+1) <NEW_LINE> <DEDENT> if root.right: <NEW_LINE> <INDENT> inorder(root.right, ...
:type root: TreeNode :rtype: List[int]
625941f66aa9bd52df03740e
def uninstall_all_integration_alerts(self, id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.uninstall_all_integration_alerts_with_http_info(id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.uninstall...
Disable all alerts associated with this integration # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.uninstall_all_integration_alerts(id, async_req=True) >>> result = thread.get() :param async_req bo...
625941f63617ad0b5ed6855c
def run_test(ndk_path, abi, platform, _toolchain, build_flags): <NEW_LINE> <INDENT> ndk_build = os.path.join(ndk_path, 'ndk-build') <NEW_LINE> if sys.platform == 'win32': <NEW_LINE> <INDENT> ndk_build += '.cmd' <NEW_LINE> <DEDENT> project_path = 'project' <NEW_LINE> ndk_args = build_flags + [ 'APP_ABI=' + abi, 'APP_PLA...
Checks ndk-build V=1 output for correct compiler.
625941f6097d151d1a2234bc
def Pyunit_tests(self, name): <NEW_LINE> <INDENT> scenario = Scenarios.Pyunit_tests() <NEW_LINE> scenario.GivenAFeatureFileCalled(name) <NEW_LINE> scenario.WhenTheGeneratorIsPyunit_tests() <NEW_LINE> scenario.ThenTheGeneratedTestIsTheSameAsTheSaved()
Gherkin DSL scenario
625941f67d43ff24873a330c
def setup_s3(session, bucket_name): <NEW_LINE> <INDENT> s3_resource = session.resource("s3") <NEW_LINE> bucket = s3_resource.Bucket(bucket_name) <NEW_LINE> return bucket
Instantiates an S3 resource. Args: session: A boto3 Session. bucket_name: Your S3 bucket's name. Returns: An S3 bucket.
625941f6a8ecb033257d3730
def __init__(self, *args): <NEW_LINE> <INDENT> this = _Math.new_WWSSN_SPF(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this
__init__(Seiscomp::Math::Filtering::IIR::WWSSN_SP_Filter<(float)> self, Seiscomp::Math::GroundMotion input=Velocity) -> WWSSN_SPF __init__(Seiscomp::Math::Filtering::IIR::WWSSN_SP_Filter<(float)> self) -> WWSSN_SPF __init__(Seiscomp::Math::Filtering::IIR::WWSSN_SP_Filter<(float)> self, WWSSN_SPF other) -> WWSSN_SPF
625941f67cff6e4e81117feb
def test_quoted_printable(self): <NEW_LINE> <INDENT> quote_printable_rtf_path = join(DATA_BASE_DIR, "plain_text", "quoted_printable_01.rtf") <NEW_LINE> quote_printable_txt_path = join(DATA_BASE_DIR, "plain_text", "quoted_printable_01.txt") <NEW_LINE> with open(quote_printable_txt_path, 'r') as fp: <NEW_LINE> <INDENT> r...
Test that encoded text in an original quoted printable message is still quoted when de-encapsulated. This test checks that it is STILL NOT IMPLEMENTED. So, if you fix it this test will expose that and we will need to change the test.
625941f69c8ee82313fbbdde
def click_story_nav(self): <NEW_LINE> <INDENT> self.click("xpath->//div[@class='culture_title_content']/span")
点击分类名
625941f6f7d966606f6aa672
def forgot_password(self, login): <NEW_LINE> <INDENT> return self._post('/session/forgot_password', login=login)['user_found']
Trigger a password reset email. Returns true if the user was found, false otherwise.
625941f66fece00bbac2ddad
def location(self): <NEW_LINE> <INDENT> if self.geocode_attempted == False: <NEW_LINE> <INDENT> self.result() <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.lng = self.geocode_array[0]['geometry']['lng'] <NEW_LINE> self.lat = self.geocode_array[0]['geometry']['lat'] <NEW_LINE> return [self.lat, self.lng] <NEW_LINE>...
Returns a list of the latitude and longitude
625941f60383005118ecfc46
def _get_reads_file(self, reads_ref, reads_type, result_directory): <NEW_LINE> <INDENT> reads_file_paths = [] <NEW_LINE> download_reads_params = {'read_libraries': [reads_ref], 'interleaved': 'false', 'gzipped': None} <NEW_LINE> reads_files = self.ru.download_reads(download_reads_params)['files'][reads_ref]['files'] <N...
_get_reads_file: gets reads file from Single/Paired End Libiary
625941f621a7993f00bc8363
def make_function_name(name, param_types, returns): <NEW_LINE> <INDENT> parts = [name] <NEW_LINE> parts += make_types_string_parts(param_types) <NEW_LINE> if returns is not None: <NEW_LINE> <INDENT> parts.append('r') <NEW_LINE> parts += make_types_string_parts([returns]) <NEW_LINE> <DEDENT> return '_'.join(parts)
Create a function name from given name, parameters and return type.
625941f64a966d76dd55167d
@app.route('/signup', methods=["GET", "POST"]) <NEW_LINE> def signup(): <NEW_LINE> <INDENT> form = UserAddForm() <NEW_LINE> if form.validate_on_submit(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.signup( username=form.data['username'], password=form.data['password'], email=form.data['email'], image_url=f...
Handle user signup. Create new user and add to DB. Redirect to home page. If form not valid, present form. If the there already is a user with that username: flash message and re-present form.
625941f6be7bc26dc91cdc59
def __init__(self, jsonfilename=None, writable=True, **kwargs): <NEW_LINE> <INDENT> super(JSONFile, self).__init__(**kwargs) <NEW_LINE> if jsonfilename == None and 'parent' in kwargs and hasattr(kwargs['parent'], 'jsonfilename'): <NEW_LINE> <INDENT> jsonfilename = kwargs['parent'].jsonfilename <NEW_LINE> <DEDENT> if 'd...
Loads and optionally saves configuration files in JSON format. Since JSON has some support for typed values (supports numbers, lists, bools, but not dates or datetimes), data from this source are sometimes typed, sometimes only available as strings. :param jsonfile: The name of a JSON file, whose root element ...
625941f6d6c5a102081446b6
def edit_document_pptx_replace(self, req_config, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.edit_document_pptx_replace_with_http_info(req_config, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.edit_...
Replace string in PowerPoint PPTX presentation # noqa: E501 Replace all instances of a string in an Office PowerPoint Document (pptx) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.edit_document_pptx_replace(req_...
625941f6e5267d203edce2fb
def write(): <NEW_LINE> <INDENT> a1 = Atoms('H') <NEW_LINE> a1.constraints = FixAtoms(indices=[0]) <NEW_LINE> a2 = Atoms('HLi', cell=[1, 2, 3, 90, 80, 70], pbc=True) <NEW_LINE> with Trajectory('old.traj', 'w') as traj: <NEW_LINE> <INDENT> traj.write(a1) <NEW_LINE> traj.write(a2) <NEW_LINE> <DEDENT> b = Path('old.traj')...
Run this with an old version of ASE. Did it with 3.18.1.
625941f6a219f33f34628fc6
def changeable(*args): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> for item in args: <NEW_LINE> <INDENT> result = result + item <NEW_LINE> pass <NEW_LINE> <DEDENT> print('累加和为%d'%result) <NEW_LINE> pass
计算累加和 :param args: :return:
625941f68a349b6b435e87d9
def _construct_reg_costs(self): <NEW_LINE> <INDENT> obs_count = T.cast(self.Xd.shape[0], 'floatX') <NEW_LINE> act_reg_cost = (self.p_xt_given_z.act_reg_cost + self.p_zt_given_xt.act_reg_cost + self.p_x_given_xt_zt.act_reg_cost + self.q_z_given_x.act_reg_cost + ...
Construct the cost for low-level basic regularization. E.g. for applying l2 regularization to the network activations and parameters.
625941f631939e2706e4d4c6
def _get_actual_db_status(self): <NEW_LINE> <INDENT> options = _load_redis_options() <NEW_LINE> out = "" <NEW_LINE> err = "" <NEW_LINE> try: <NEW_LINE> <INDENT> if 'requirepass' in options: <NEW_LINE> <INDENT> LOG.info(_('Password is set running ping with password')) <NEW_LINE> out, err = utils.execute_with_timeout( sy...
Gets the actual status of the Redis instance First it attempts to make a connection to the redis instance by making a PING request. If PING does not return PONG we do a ps to see if the process is blocked or hung. This implementation stinks but redis-cli only returns 0 at this time. http://redis.googlecode.com/svn/trun...
625941f6bd1bec0571d90c96
def test_get_smb_sessions(self): <NEW_LINE> <INDENT> pass
Test case for get_smb_sessions
625941f6004d5f362079a994
def get_text(self): <NEW_LINE> <INDENT> return self.get_child('text')
Returns ------- The text content of the label. You can set the text content with set_text(text).
625941f62eb69b55b151cf1f
def solution(nums): <NEW_LINE> <INDENT> n = len(nums) <NEW_LINE> temp = [0] * (n+1) <NEW_LINE> result = [] <NEW_LINE> for i in nums: <NEW_LINE> <INDENT> temp[i] = 1 <NEW_LINE> <DEDENT> for i in range(1, n+1): <NEW_LINE> <INDENT> if not temp[i]: <NEW_LINE> <INDENT> result.append(i) <NEW_LINE> <DEDENT> <DEDENT> return re...
Method: One Pass x twice we want to find the missing number inclusive 1 - N where N = len(nums) - first we need an extra array with length + 1 since the element in nums start with 1 - new array index is the element from nums, value is 1 - goes through the new, which index has zero value is the missing number runtime:...
625941f62eb69b55b151cf20
def rangeText(self, key, pBand): <NEW_LINE> <INDENT> T = current.T <NEW_LINE> if key == -1: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> elif key == 0: <NEW_LINE> <INDENT> return T("At or below %s") % (pBand[1]) <NEW_LINE> <DEDENT> elif key == len(pBand)-1: <NEW_LINE> <INDENT> return T("Above %s") % (pBand[len(pBa...
@todo: docstring
625941f632920d7e50b2883c
def addWord(self, word): <NEW_LINE> <INDENT> node = self <NEW_LINE> for ch in word: <NEW_LINE> <INDENT> if ch not in node.links: <NEW_LINE> <INDENT> node.links[ch] = WordDictionary() <NEW_LINE> <DEDENT> node = node.links[ch] <NEW_LINE> <DEDENT> node.isEnd = True
Adds a word into the data structure. :type word: str :rtype: void
625941f6596a89723608a11d
def distance(self) -> float: <NEW_LINE> <INDENT> GPIO.output(self.GPIO_TRIGGER, True) <NEW_LINE> time.sleep(0.00001) <NEW_LINE> GPIO.output(self.GPIO_TRIGGER, False) <NEW_LINE> start_time = time.time() <NEW_LINE> stop_time = time.time() <NEW_LINE> while GPIO.input(self.GPIO_ECHO) == 0: <NEW_LINE> <INDENT> start_time = ...
Returns the sonic sensor distance
625941f64f88993c3716c6c6
@main_routes.route('/') <NEW_LINE> def main(): <NEW_LINE> <INDENT> return jsonify({ "status_code": 200, "message": "OK", })
Main route for testing Attributes: None
625941f621bff66bcd684fb3
def get_uploadjob(self, user_id, volume_id, node_id, uploadjob_id, hash_value, crc32): <NEW_LINE> <INDENT> user = self._get_user(user_id) <NEW_LINE> node = user.volume(volume_id).get_node(node_id) <NEW_LINE> uj = node.get_multipart_uploadjob(uploadjob_id, hash_value, crc32) <NEW_LINE> return self._process_uploadjob(uj)
Make an upload job for a node.
625941f6d58c6744b42582c3
def initialize(self): <NEW_LINE> <INDENT> super(self.__class__, self).initialize() <NEW_LINE> self.__neutron = neutron_utils.neutron_client(self._os_creds) <NEW_LINE> self.__ports = self.__query_ports(self.instance_settings.port_settings) <NEW_LINE> self.__lookup_existing_vm_by_name()
Loads the existing VMInst, Port, FloatingIps :return: VMInst domain object
625941f6d10714528d600352
def get_section_pk_list(self): <NEW_LINE> <INDENT> return np.array([section.pk for _, section in self.sections.items()])
Get list of pk section @return (numpy.array)
625941f67c178a314d6efad2
def get_smalljpegfilename(tiffname='', platenum=''): <NEW_LINE> <INDENT> if not tiffname: <NEW_LINE> <INDENT> return os.path.join(HDRDIR, 'ungrouped', 'plate%s.txt' % platenum) <NEW_LINE> <DEDENT> dirlist = os.path.split(os.path.dirname(tiffname)) <NEW_LINE> if len(dirlist) > 1: <NEW_LINE> <INDENT> subdir = dirlist[-1]...
Given a plate number, return a full path/filename to write the thumbnail JPEG file. Use the last directory component from the original file name as a subdirectory to create the thumbnailJPEG file in. :param tiffname: Full path/filename of original TIFF file :param platenum: plate number :return: output file path/name
625941f6fbf16365ca6f6839
def delete_processed_data(self, study, user, callback): <NEW_LINE> <INDENT> pd_id = int(self.get_argument('processed_data_id')) <NEW_LINE> try: <NEW_LINE> <INDENT> ProcessedData.delete(pd_id) <NEW_LINE> msg = ("Processed data %d has been deleted" % pd_id) <NEW_LINE> msg_level = "success" <NEW_LINE> pd_id = None <NEW_LI...
Delete the selected processed data Parameters ---------- study : Study The current study object user : User The current user object callback : function The callback function to call with the results once the processing is done
625941f6925a0f43d254a4e4
def request_parcel_info(self, parcel_id): <NEW_LINE> <INDENT> if type(parcel_id) == str: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> parcel_id = UUID(parcel_id) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> logger.warning('Parcel_id passed to request_parcel_info must but a valid UUID or string representat...
request information for a parcel by id
625941f60c0af96317bb884d
def offset_to_char(off,lang): <NEW_LINE> <INDENT> if not is_supported_language(lang): <NEW_LINE> <INDENT> raise IndicNlpException('Language {} not supported'.format(lang)) <NEW_LINE> <DEDENT> return chr(off+li.SCRIPT_RANGES[lang][0])
Applicable to Brahmi derived Indic scripts
625941f6dc8b845886cb5b9d
def _keyboard_set ( self, event ): <NEW_LINE> <INDENT> key_code = event.key_code <NEW_LINE> if len( key_code ) == 1: <NEW_LINE> <INDENT> key_code = KeyMap.get( key_code, key_code ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> key_code = key_code.lower().replace( '-', '_' ) <NEW_LINE> <DEDENT> method = None <NEW_LINE> ...
Handles the 'keyboard' event being fired.
625941f63317a56b8693a2ae
def test_area_Radius_update(self): <NEW_LINE> <INDENT> new_circle = c.Circle(4) <NEW_LINE> new_circle.radius = 10 <NEW_LINE> area = "{:.2f}".format(new_circle.area) <NEW_LINE> self.assertEqual(area, '62.83')
Test the area is updated when the radius is updated
625941f6ff9c53063f47c856
def LoadVolume(self, filename, dataset, description): <NEW_LINE> <INDENT> msg = protocol.ControllerRequest() <NEW_LINE> msg.type = protocol.ControllerRequest.LoadVolume <NEW_LINE> msg.volume_filename = filename <NEW_LINE> msg.volume_dataset = dataset <NEW_LINE> msg.volume_description = description <NEW_LINE> return sel...
Load volume from file on controller. Args: filename: The path of the volume, which should be accessible by the controller machine. dataset: The name of the dataset. description: The description of the dataset. Returns: True if command succeed, False otherwise.
625941f65166f23b2e1a57c0
def archive_bookmark(self, bookmark_id): <NEW_LINE> <INDENT> return self.update_bookmark(bookmark_id, archive=True)
Archives given bookmark. The requested bookmark must belong to the current user. :param bookmark_id: ID of the bookmark to archive.
625941f64e4d5625662d4a34
def decipher(string, key): <NEW_LINE> <INDENT> return encipher(string, key)
Decipher string using Beaufort cipher according to initialised key. For the Beaufort cipher, enciphering and deciphering are the same operation.
625941f6aad79263cf3910b2