code stringlengths 1 18.2k |
|---|
be the same?) val = self.interpreter.memory[self.interpreter.convert_to_integer(address)] val = self.convert_representation(val) message += "{}: {}\n".format(address, val) stream_content = {'name': 'stdout', 'text': message} self.send_response(self.iopub_socket, 'stream', stream_content) |
def magic_run(self, line): """ Run the current program Usage: Call with a numbe rto run that many steps, or call with no arguments to run to the end of the current program `%run` or `%run 1` """ i = float('inf') if line.strip(): i = int(line) try: with warnings.catch_warnings(record=True) as w: self.interpreter.run(i) ... |
= {'name': 'stdout', 'text': 'Warning: ' + str(warning_message.message) + '\n'} self.send_response(self.iopub_socket, 'stream', stream_content) except iarm.exceptions.EndOfProgram as e: f_name = self.interpreter.program[self.interpreter.register['PC'] - 1].__name__ f_name = f_name[:f_name.find('_')] message = "Error in... |
'execution_count': self.execution_count, 'ename': type(e).__name__, 'evalue': str(e), 'traceback': '???'} |
def magic_help(self, line): """ Print out the help for magics Usage: Call help with no arguments to list all magics, or call it with a magic to print out it's help info. `%help` or `%help run """ line = line.strip() if not line: for magic in self.magics: stream_content = {'name': 'stdout', 'text': "%{}\n".format(magic)... |
stream_content = {'name': 'stdout', 'text': "{}\n{}".format(line, self.magics[line].__doc__)} self.send_response(self.iopub_socket, 'stream', stream_content) elif line in self.interpreter.ops: # it's an instruction stream_content = {'name': 'stdout', 'text': "{}\n{}".format(line, self.interpreter.ops[line].__doc__)} se... |
def export_to_swagger(awsclient, api_name, stage_name, api_description, lambdas, custom_hostname=False, custom_base_path=False): """Export the API design as swagger file. :param api_name: :param stage_name: :param api_description: :param lambdas: :param custom_hostname: :param custom_base_path: """ print('Exporting to ... |
open('swagger_export.yaml', 'w') swagger_file.write(content) else: print('API name unknown') |
def list_apis(awsclient): """List APIs in account.""" client_api = awsclient.get_client('apigateway') apis = client_api.get_rest_apis()['items'] for api in apis: print(json2table(api)) |
def deploy_api(awsclient, api_name, api_description, stage_name, api_key, lambdas, cache_cluster_enabled, cache_cluster_size, method_settings=None): """Deploy API Gateway to AWS cloud. :param awsclient: :param api_name: :param api_description: :param stage_name: :param api_key: :param lambdas: :param cache_cluster_enab... |
_import_from_swagger for if api is existent! # _create_api(api_name=api_name, api_description=api_description) _import_from_swagger(awsclient, api_name, api_description, stage_name, lambdas) else: print('No swagger file (%s) found' % SWAGGER_FILE) api = _api_by_name(awsclient, api_name) if api is not None: _ensure_lamb... |
api_name) if api is not None: _ensure_lambdas_permissions(awsclient, lambdas, api) _create_deployment(awsclient, api_name, stage_name, cache_cluster_enabled, cache_cluster_size) _update_stage(awsclient, api['id'], stage_name, method_settings) else: print('API name unknown') |
def delete_api(awsclient, api_name): """Delete the API. :param api_name: """ _sleep() client_api = awsclient.get_client('apigateway') print('deleting api: %s' % api_name) api = _api_by_name(awsclient, api_name) if api is not None: print(json2table(api)) response = client_api.delete_rest_api( restApiId=api['id'] ) print... |
def create_api_key(awsclient, api_name, api_key_name): """Create a new API key as reference for api.conf. :param api_name: :param api_key_name: :return: api_key """ _sleep() client_api = awsclient.get_client('apigateway') print('create api key: %s' % api_key_name) response = client_api.create_api_key( name=api_key_name... |
def delete_api_key(awsclient, api_key): """Remove API key. :param api_key: """ _sleep() client_api = awsclient.get_client('apigateway') print('delete api key: %s' % api_key) response = client_api.delete_api_key( apiKey=api_key ) print(json2table(response)) |
def list_api_keys(awsclient): """Print the defined API keys. """ _sleep() client_api = awsclient.get_client('apigateway') print('listing api keys') response = client_api.get_api_keys()['items'] for item in response: print(json2table(item)) |
def deploy_custom_domain(awsclient, api_name, api_target_stage, api_base_path, domain_name, route_53_record, cert_name, cert_arn, hosted_zone_id, ensure_cname): """Add custom domain to your API. :param api_name: :param api_target_stage: :param api_base_path: :param domain_name: :param route_53_record: :param ssl_cert: ... |
if not domain: response = _create_custom_domain(awsclient, domain_name, cert_name, cert_arn) cloudfront_distribution = response['distributionDomainName'] else: response = _update_custom_domain(awsclient, domain_name, cert_name, cert_arn) cloudfront_distribution = response['distributionDomainName'] if _base_path_mapping... |
print('Route53 record set: %s --> %s' % (route_53_record, cloudfront_distribution)) else: print('Skipping creating and checking DNS record') return 0 |
def get_lambdas(awsclient, config, add_arn=False): """Get the list of lambda functions. :param config: :param add_arn: :return: list containing lambda entries """ if 'lambda' in config: client_lambda = awsclient.get_client('lambda') lambda_entries = config['lambda'].get('entries', []) lmbdas = [] for lambda_entry in la... |
else: return [] |
def _update_stage(awsclient, api_id, stage_name, method_settings): """Helper to apply method_settings to stage :param awsclient: :param api_id: :param stage_name: :param method_settings: :return: """ # settings docs in response: https://botocore.readthedocs.io/en/latest/reference/services/apigateway.html#APIGateway.Cli... |
def _convert_method_settings_into_operations(method_settings=None): """Helper to handle the conversion of method_settings to operations :param method_settings: :return: list of operations """ # operations docs here: https://tools.ietf.org/html/rfc6902#section-4 operations = [] if method_settings: for method in method_s... |
def generate_settings(): """ This command is run when ``default_path`` doesn't exist, or ``init`` is run and returns a string representing the default data to put into their settings file. """ conf_file = os.path.join(os.path.dirname(base_settings.__file__), 'example', 'conf.py') conf_template = open(conf_file).read() ... |
= conf_template.format(api_key=api_key, secret_key=secret_key, site_url=site_url) return output |
def configure_app(**kwargs): """Builds up the settings using the same method as logan""" sys_args = sys.argv args, command, command_args = parse_args(sys_args[1:]) parser = OptionParser() parser.add_option('--config', metavar='CONFIG') (options, logan_args) = parser.parse_args(args) config_path = options.config logan_c... |
def _reset_changes(self): """Stores current values for comparison later""" self._original = {} if self.last_updated is not None: self._original['last_updated'] = self.last_updated |
def whisper_filename(self): """Build a file path to the Whisper database""" source_name = self.source_id and self.source.name or '' return get_valid_filename("{0}__{1}.wsp".format(source_name, self.name)) |
def get_value_display(self): """Human friendly value output""" if self.display_as == 'percentage': return '{0}%'.format(self.latest_value) if self.display_as == 'boolean': return bool(self.latest_value) if self.display_as == 'byte': return defaultfilters.filesizeformat(self.latest_value) if self.display_as == 'second':... |
def time_between_updates(self): """Time between current `last_updated` and previous `last_updated`""" if 'last_updated' not in self._original: return 0 last_update = self._original['last_updated'] this_update = self.last_updated return this_update - last_update |
def do_transform(self): """Apply the transformation (if it exists) to the latest_value""" if not self.transform: return try: self.latest_value = utils.Transform( expr=self.transform, value=self.latest_value, timedelta=self.time_between_updates().total_seconds()).result() except (TypeError, ValueError): logger.warn("Inv... |
def do_counter_conversion(self): """Update latest value to the diff between it and the previous value""" if self.is_counter: if self._previous_counter_value is None: prev_value = self.latest_value else: prev_value = self._previous_counter_value self._previous_counter_value = self.latest_value self.latest_value = self.l... |
def source_group_receiver(self, sender, source, signal, **kwargs): """ Relay source group signals to the appropriate spec strategy. """ from imagekit.cachefiles import ImageCacheFile source_group = sender # Ignore signals from unregistered groups. if source_group not in self._source_groups: return #OVERRIDE HERE -- pas... |
ImageCacheFile(spec) call_strategy_method(file, callback_name) |
def replace_variable(self, variable): """Substitute variables with numeric values""" if variable == 'x': return self.value if variable == 't': return self.timedelta raise ValueError("Invalid variable %s", variable) |
def result(self): """Evaluate expression and return result""" # Module(body=[Expr(value=...)]) return self.eval_(ast.parse(self.expr).body[0].value) |
def get_people(self, user_alias=None): """ 获取用户信息 :param user_alias: 用户ID :return: """ user_alias = user_alias or self.api.user_alias content = self.api.req(API_PEOPLE_HOME % user_alias).content xml = self.api.to_xml(re.sub(b'<br />', b'\n', content)) try: xml_user = xml.xpath('//*[@id="profile"]') if not xml_user: ret... |
not None else None nickname = first(xml.xpath('//*[@id="db-usr-profile"]//h1/text()'), '').strip() or None signature = first(xml.xpath('//*[@id="display"]/text()')) xml_contact_count = xml.xpath('//*[@id="friend"]/h2')[0] contact_count = int(re.search(r'成员(\d+)', xml_contact_count.xpath('string(.)')).groups()[0]) text_... |
e) |
def email_login(request, *, email, **kwargs): """ Given a request, an email and optionally some additional data, ensure that a user with the email address exists, and authenticate & login them right away if the user is active. Returns a tuple consisting of ``(user, created)`` upon success or ``(None, None)`` when authe... |
user.is_active: # The is_active check is possibly redundant. auth.login(request, user) return user, created return None, None |
def dashboard(request): """Shows the latest results for each source""" sources = (models.Source.objects.all().prefetch_related('metric_set') .order_by('name')) metrics = SortedDict([(src, src.metric_set.all()) for src in sources]) no_source_metrics = models.Metric.objects.filter(source__isnull=True) if no_source_metric... |
def _create(self): """Create the Whisper file on disk""" if not os.path.exists(settings.SALMON_WHISPER_DB_PATH): os.makedirs(settings.SALMON_WHISPER_DB_PATH) archives = [whisper.parseRetentionDef(retentionDef) for retentionDef in settings.ARCHIVES.split(",")] whisper.create(self.path, archives, xFilesFactor=settings.XF... |
def _update(self, datapoints): """ This method store in the datapoints in the current database. :datapoints: is a list of tupple with the epoch timestamp and value [(1368977629,10)] """ if len(datapoints) == 1: timestamp, value = datapoints[0] whisper.update(self.path, value, timestamp) else: whisper.update_many(self.p... |
def fetch(self, from_time, until_time=None): """ This method fetch data from the database according to the period given fetch(path, fromTime, untilTime=None) fromTime is an datetime untilTime is also an datetime, but defaults to now. Returns a tuple of (timeInfo, valueList) where timeInfo is itself a tuple of (fromTime... |
values = whisper.fetch(self.path, from_time.strftime('%s'), until_time.strftime('%s')) # build up a list of (timestamp, value) start_time, end_time, step = time_info current = start_time times = [] while current <= end_time: times.append(current) current += step return zip(times, values) |
def build_list_result(results, xml): """ 构建带翻页的列表 :param results: 已获取的数据列表 :param xml: 原始页面xml :return: {'results': list, 'count': int, 'next_start': int|None} 如果count与results长度不同,则有更多 如果next_start不为None,则可以到下一页 """ xml_count = xml.xpath('//div[@class="paginator"]/span[@class="count"]/text()') xml_next = xml.xpath('//d... |
def ADCS(self, params): """ ADCS [Ra,] Rb, Rc Add Rb and Rc + the carry bit and store the result in Ra Ra, Rb, and Rc must be low registers if Ra is omitted, then it is assumed to be Rb """ # This instruction allows for an optional destination register # If it is omitted, then it is assumed to be Rb # |
As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_COMMA_SEPARATED, params) except iarm.exceptions.ParsingError: Rb, Rc = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) Ra = Rb self.check_arg... |
'add') return ADCS_func |
def ADD(self, params): """ ADD [Rx,] Ry, [Rz, PC] ADD [Rx,] [SP, PC], #imm10_4 ADD [SP,] SP, #imm9_4 Add Ry and Rz and store the result in Rx Rx, Ry, and Rz can be any register If Rx is omitted, then it is assumed to be Ry """ # This instruction allows for an optional destination register # If it is omitted, then it |
is assumed to be Rb # As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html # TODO can we have ADD SP, #imm9_4? try: Rx, Ry, Rz = self.get_three_parameters(self.THREE_PARAMETER_COMMA_SEPARATED, params) except iarm.exceptions.ParsingError: Ry, Rz = self.get_two_parameters(self.TWO... |
= self.register[Ry] + self.register[Rz] else: if Rx == 'SP': # ADD SP, SP, #imm9_4 self.check_arguments(imm9_4=(Rz,)) if Rx != Ry: raise iarm.exceptions.RuleError("Second parameter {} is not SP".format(Ry)) else: # ADD Rx, [SP, PC], #imm10_4 self.check_arguments(any_registers=(Rx,), imm10_4=(Rz,)) if Ry not in ('SP', '... |
def CMN(self, params): """ CMN Ra, Rb Add the two registers and set the NZCV flags The result is discarded Ra and Rb must be low registers """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(low_registers=(Ra, Rb)) # CMN Ra, Rb def CMN_func(): self.set_NZCV_flags(self.r... |
def CMP(self, params): """ CMP Rm, Rn CMP Rm, #imm8 Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result Rm and Rn can be R0-R14 """ Rm, Rn = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) if self.is_register(Rn): # CMP Rm, Rn self.check_arguments(R0_thru_R14=(Rm, Rn)) def CMP_fu... |
self.set_NZCV_flags(self.register[Rm], tmp, self.register[Rm] - tmp, 'sub') return CMP_func |
def MULS(self, params): """ MULS Ra, Rb, Ra Multiply Rb and Ra together and store the result in Ra. Set the NZ flags. Ra and Rb must be low registers The first and last operand must be the same register """ Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(low_reg... |
first parameter {}".format(Rc, Ra)) # MULS Ra, Rb, Ra def MULS_func(): self.register[Ra] = self.register[Rb] * self.register[Rc] self.set_NZ_flags(self.register[Ra]) return MULS_func |
def RSBS(self, params): """ RSBS [Ra,] Rb, #0 Subtract Rb from zero (0 - Rb) and store the result in Ra Set the NZCV flags Ra and Rb must be low registers if Ra is omitted, then it is assumed to be Rb """ # This instruction allows for an optional destination register # If it is omitted, then it is assumed to be |
Rb # As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_COMMA_SEPARATED, params) except iarm.exceptions.ParsingError: Rb, Rc = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) Ra = Rb self.chec... |
def SUB(self, params): """ SUB [SP,] SP, #imm9_4 Subtract an immediate from the Stack Pointer The first SP is optional """ # This instruction allows for an optional destination register # If it is omitted, then it is assumed to be Rb # As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/i... |
self.check_arguments(imm9_4=(Rc,)) if Ra != 'SP': raise iarm.exceptions.RuleError("First parameter {} is not equal to SP".format(Ra)) if Rb != 'SP': raise iarm.exceptions.RuleError("Second parameter {} is not equal to SP".format(Rb)) # SUB SP, SP, #imm9_4 def SUB_func(): self.register[Ra] = self.register[Rb] - self.con... |
def SUBS(self, params): """ SUBS [Ra,] Rb, Rc SUBS [Ra,] Rb, #imm3 SUBS [Ra,] Ra, #imm8 Subtract Rc or an immediate from Rb and store the result in Ra Ra, Rb, and Rc must be low registers If Ra is omitted, then it is assumed to be Rb """ # This instruction allows for an optional destination register # If it is omitted,... |
it is assumed to be Rb # As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html try: Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_COMMA_SEPARATED, params) except iarm.exceptions.ParsingError: Rb, Rc = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, param... |
#imm8 self.check_arguments(low_registers=(Ra,), imm8=(Rc,)) def SUBS_func(): oper_1 = self.register[Ra] self.register[Ra] = self.register[Ra] - self.convert_to_integer(Rc[1:]) self.set_NZCV_flags(oper_1, self.convert_to_integer(Rc[1:]), self.register[Ra], 'sub') else: # SUBS Ra, Rb, #imm3 self.check_arguments(low_regis... |
def initialize(template, service_name, environment='dev'): """Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template :param template: :param service_name: :param environment: :return: """ template.SERVICE_NAME = os.getenv('SERVICE_NAME', service_name) template.SERVICE_ENVIRONMENT = os.getenv('ENV', en... |
def get_dist(dist_name, lookup_dirs=None): """Get dist for installed version of dist_name avoiding pkg_resources cache """ # note: based on pip/utils/__init__.py, get_installed_version(...) # Create a requirement that we'll look for inside of setuptools. req = pkg_resources.Requirement.parse(dist_name) # We want to avo... |
pkg_resources.WorkingSet(lookup_dirs) # Get the installed distribution from our working set return working_set.find(req) |
def get_package_versions(package): """Get the package version information (=SetuptoolsVersion) which is comparable. note: we use the pip list_command implementation for this :param package: name of the package :return: installed version, latest available version """ list_command = ListCommand() options, args = list_com... |
def _load_hooks(path): """Load hook module and register signals. :param path: Absolute or relative path to module. :return: module """ module = imp.load_source(os.path.splitext(os.path.basename(path))[0], path) if not check_hook_mechanism_is_intact(module): # no hooks - do nothing log.debug('No valid hook configuration... |
def lifecycle(awsclient, env, tool, command, arguments): """Tool lifecycle which provides hooks into the different stages of the command execution. See signals for hook details. """ log.debug('### init') load_plugins() context = get_context(awsclient, env, tool, command, arguments) # every tool needs a awsclient so we ... |
'error' signal here return 1 ## initialized gcdt_signals.initialized.send(context) log.debug('### initialized') if 'error' in context: log.error(context['error']) return 1 check_gcdt_update() # config is "assembled" by config_reader NOT here! config = {} gcdt_signals.config_read_init.send((context, config)) log.debug('... |
config: # load hooks from hookfile _load_hooks(config['hookfile']) if 'kumo' in config: # deprecated: this needs to be removed once all old-style "cloudformation" entries are gone fix_old_kumo_config(config) # check_credentials gcdt_signals.check_credentials_init.send((context, config)) log.debug('### check_credentials... |
config)) log.debug('### config_validation_init') gcdt_signals.config_validation_finalized.send((context, config)) if context['command'] in \ DEFAULT_CONFIG.get(context['tool'], {}).get('non_config_commands', []): pass # we do not require a config for this command elif tool not in config and tool != 'gcdt': context['err... |
\ 'Your credentials have expired... Please renew and try again!' log.error(context['error']) gcdt_signals.error.send((context, config)) return 1 ## bundle step gcdt_signals.bundle_pre.send((context, config)) log.debug('### bundle_pre') gcdt_signals.bundle_init.send((context, config)) log.debug('### bundle_init') gcdt_s... |
the whole config else: conf = config.get(tool, {}) exit_code = cmd.dispatch(arguments, context=context, config=conf) except GracefulExit: raise except Exception as e: log.debug(traceback.format_exc()) context['error'] = str(e) log.error(context['error']) exit_code = 1 if exit_code: if 'error' not in context or context[... |
want to get a summary / output to the user) gcdt_signals.finalized.send(context) log.debug('### finalized') return 0 |
def main(doc, tool, dispatch_only=None): """gcdt tools parametrized main function to initiate gcdt lifecycle. :param doc: docopt string :param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen) :param dispatch_only: list of commands which do not use gcdt lifecycle :return: exit_code """ # Use signal handler to throw e... |
signal_handler) # Ctrl-C try: arguments = docopt(doc, sys.argv[1:]) command = get_command(arguments) # DEBUG mode (if requested) verbose = arguments.pop('--verbose', False) if verbose: logging_config['loggers']['gcdt']['level'] = 'DEBUG' dictConfig(logging_config) if dispatch_only is None: dispatch_only = ['version'] a... |
ENV variable! check_gcdt_update() return cmd.dispatch(arguments) else: env = get_env() if not env: log.error('\'ENV\' environment variable not set!') return 1 awsclient = AWSClient(botocore.session.get_session()) return lifecycle(awsclient, env, tool, command, arguments) except GracefulExit as e: log.info('Received %s ... |
def MOV(self, params): """ MOV Rx, Ry MOV PC, Ry Move the value of Ry into Rx or PC """ Rx, Ry = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(any_registers=(Rx, Ry)) def MOV_func(): self.register[Rx] = self.register[Ry] return MOV_func |
def MOVS(self, params): """ MOVS Ra, Rb MOVS Ra, #imm8 Move the value of Rb or imm8 into Ra Ra and Rb must be low registers """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) if self.is_immediate(Rb): self.check_arguments(low_registers=[Ra], imm8=[Rb]) def MOVS_func(): self.register[Ra] = ... |
raise iarm.exceptions.ParsingError("Unknown parameter: {}".format(Rb)) |
def MRS(self, params): """ MRS Rj, Rspecial Copy the value of Rspecial to Rj Rspecial can be APSR, IPSR, or EPSR """ Rj, Rspecial = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(LR_or_general_purpose_registers=(Rj,), special_registers=(Rspecial,)) def MRS_func(): # TODO add co... |
= self.register['APSR'] | self.register['IPSR'] | self.register['EPSR'] else: self.register[Rj] = self.register[Rspecial] return MRS_func |
def MSR(self, params): """ MSR Rspecial, Rj Copy the value of Rj to Rspecial Rspecial can be APSR, IPSR, or EPSR """ Rspecial, Rj = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(LR_or_general_purpose_registers=(Rj,), special_registers=(Rspecial,)) def MSR_func(): # TODO add co... |
= self.register[Rj] else: # Do nothing pass return MSR_func |
def MVNS(self, params): """ MVNS Ra, Rb Negate the value in Rb and store it in Ra Ra and Rb must be a low register """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(low_registers=(Ra, Rb)) def MVNS_func(): self.register[Ra] = ~self.register[Rb] self.set_NZ_flags(self.... |
def REV(self, params): """ REV Ra, Rb Reverse the byte order in register Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(low_registers=(Ra, Rb)) def REV_func(): self.register[Ra] = ((self.register[Rb] & 0xFF000000) >> 24) | \ ((self.reg... |
def REV16(self, params): """ REV16 Ra, Rb Reverse the byte order of the half words in register Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.check_arguments(low_registers=(Ra, Rb)) def REV16_func(): self.register[Ra] = ((self.register[Rb] & 0xFF00FF0... |
def REVSH(self, params): """ REVSH Reverse the byte order in the lower half word in Rb and store the result in Ra. If the result of the result is signed, then sign extend """ Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params) self.check_arguments(low_registers=(Ra, Rb)) def REVSH_fu... |
|= 0xFFFF0000 return REVSH_func |
def SXTB(self, params): """ STXB Ra, Rb Sign extend the byte in Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params) self.check_arguments(low_registers=(Ra, Rb)) def SXTB_func(): if self.register[Rb] & (1 << 7): self.register[Ra] = 0xFFFFFF00 + (self.... |
def SXTH(self, params): """ STXH Ra, Rb Sign extend the half word in Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params) self.check_arguments(low_registers=(Ra, Rb)) def SXTH_func(): if self.register[Rb] & (1 << 15): self.register[Ra] = 0xFFFF0000 + ... |
def UXTB(self, params): """ UTXB Ra, Rb Zero extend the byte in Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params) self.check_arguments(low_registers=(Ra, Rb)) def UXTB_func(): self.register[Ra] = (self.register[Rb] & 0xFF) return UXTB_func |
def UXTH(self, params): """ UTXH Ra, Rb Zero extend the half word in Rb and store the result in Ra """ Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params) self.check_arguments(low_registers=(Ra, Rb)) def UXTH_func(): self.register[Ra] = (self.register[Rb] & 0xFFFF) return UXTH_func |
def _get_event_type(evt_source): """Get type of event e.g. 's3', 'events', 'kinesis',... :param evt_source: :return: """ if 'schedule' in evt_source: return 'events' elif 'pattern' in evt_source: return 'events' elif 'log_group_name_prefix' in evt_source: return 'cloudwatch_logs' else: arn = evt_source['arn'] _, _, svc... |
def _get_event_source_obj(awsclient, evt_source): """ Given awsclient, event_source dictionary item create an event_source object of the appropriate event type to schedule this event, and return the object. """ event_source_map = { 'dynamodb': event_source.dynamodb_stream.DynamoDBStreamEventSource, 'kinesis': event_sou... |
def _add_event_source(awsclient, evt_source, lambda_arn): """ Given an event_source dictionary, create the object and add the event source. """ event_source_obj = _get_event_source_obj(awsclient, evt_source) # (where zappa goes like remove, add) # we go with update and add like this: if event_source_obj.exists(lambda_a... |
def _remove_event_source(awsclient, evt_source, lambda_arn): """ Given an event_source dictionary, create the object and remove the event source. """ event_source_obj = _get_event_source_obj(awsclient, evt_source) if event_source_obj.exists(lambda_arn): event_source_obj.remove(lambda_arn) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.