Search is not available for this dataset
text
stringlengths
75
104k
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 (timeInf...
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"...
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 # ...
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 a...
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...
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): ...
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.THRE...
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 destinat...
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:...
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 in...
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_...
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_n...
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 = ListComma...
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 ...
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 t...
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 """ # ...
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[R...
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_...
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,), sp...
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,), sp...
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_fun...
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...
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_...
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) ...
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(): i...
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(): ...
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(): s...
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(): ...
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 'clo...
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.DynamoDBStreamE...
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 eve...
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)
def _get_event_source_status(awsclient, evt_source, lambda_arn): """ Given an event_source dictionary, create the object and get the event source status. """ event_source_obj = _get_event_source_obj(awsclient, evt_source) return event_source_obj.status(lambda_arn)
def unwire(awsclient, events, lambda_name, alias_name=ALIAS_NAME): """Unwire a list of event from an AWS Lambda function. 'events' is a list of dictionaries, where the dict must contains the 'schedule' of the event as string, and an optional 'name' and 'description'. :param awsclient: :param event...
def wire_deprecated(awsclient, function_name, s3_event_sources=None, time_event_sources=None, alias_name=ALIAS_NAME): """Deprecated! Please use wire! :param awsclient: :param function_name: :param s3_event_sources: dictionary :param time_event_sources: :...
def unwire_deprecated(awsclient, function_name, s3_event_sources=None, time_event_sources=None, alias_name=ALIAS_NAME): """Deprecated! Please use unwire! :param awsclient: :param function_name: :param s3_event_sources: dictionary :param time_event_sources: :param alias_nam...
def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix, suffix): """Use only prefix OR suffix :param arn: :param event: :param bucket: :param prefix: :param suffix: :return: """ json_data = { 'LambdaFunctionConfigurations': [{ ...
def find_eigen(hint=None): r''' Try to find the Eigen library. If successful the include directory is returned. ''' # search with pkgconfig # --------------------- try: import pkgconfig if pkgconfig.installed('eigen3','>3.0.0'): return pkgconfig.parse('eigen3')['include_dirs'][0] except: ...
def check_and_format_logs_params(start, end, tail): """Helper to read the params for the logs command""" def _decode_duration_type(duration_type): durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'} return durations[duration_type] if not start: if tail: ...
def upload_file_to_s3(awsclient, bucket, key, filename): """Upload a file to AWS S3 bucket. :param awsclient: :param bucket: :param key: :param filename: :return: """ client_s3 = awsclient.get_client('s3') transfer = S3Transfer(client_s3) # Upload /tmp/myfile to s3://bucket/key ...
def remove_file_from_s3(awsclient, bucket, key): """Remove a file from an AWS S3 bucket. :param awsclient: :param bucket: :param key: :return: """ client_s3 = awsclient.get_client('s3') response = client_s3.delete_object(Bucket=bucket, Key=key)
def ls(awsclient, bucket, prefix=None): """List bucket contents :param awsclient: :param bucket: :param prefix: :return: """ # this works until 1000 keys! params = {'Bucket': bucket} if prefix: params['Prefix'] = prefix client_s3 = awsclient.get_client('s3') objects ...
def ORRS(self, params): """ ORRS [Ra,] Ra, Rb OR Ra and Rb together and store the result in Ra The equivalent of `Ra = Ra | Rc` Updates NZ flags Ra and Rb must be low registers The first register is optional """ # This instruction allows for an op...
def TST(self, params): """ TST Ra, Rb AND Ra and Rb together and update the NZ flag. The result is not set The equivalent of `Ra & Rc` Ra and Rb must be low registers """ Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params) self.c...
def render_to_mail(template, context, **kwargs): """ Renders a mail and returns the resulting ``EmailMultiAlternatives`` instance * ``template``: The base name of the text and HTML (optional) version of the mail. * ``context``: The context used to render the mail. This context instance ...
def get_confirmation_url(email, request, name="email_registration_confirm", **kwargs): """ Returns the confirmation URL """ return request.build_absolute_uri( reverse(name, kwargs={"code": get_confirmation_code(email, request, **kwargs)}) )
def send_registration_mail(email, *, request, **kwargs): """send_registration_mail(email, *, request, **kwargs) Sends the registration mail * ``email``: The email address where the registration link should be sent to. * ``request``: A HTTP request instance, used to construct the complete UR...
def decode(code, *, max_age): """decode(code, *, max_age) Decodes the code from the registration link and returns a tuple consisting of the verified email address and the payload which was passed through to ``get_confirmation_code``. The maximum age in seconds of the link has to be specified as ``m...
def do_some_work( self, work_dict): """do_some_work :param work_dict: dictionary for key/values """ label = "do_some_work" log.info(("task - {} - start " "work_dict={}") .format(label, work_dict)) ret_data = { "job_resul...
def create_record(awsclient, name_prefix, instance_reference, type="A", host_zone_name=None): """ Builds route53 record entries enabling DNS names for services Note: gcdt.route53 create_record(awsclient, ...) is used in dataplatform cloudformation.py templates! :param name_prefix: The sub domain pr...
def _retrieve_stack_host_zone_name(awsclient, default_stack_name=None): """ Use service discovery to get the host zone name from the default stack :return: Host zone name as string """ global _host_zone_name if _host_zone_name is not None: return _host_zone_name env = get_env() ...
def load_plugins(group='gcdt10'): """Load and register installed gcdt plugins. """ # on using entrypoints: # http://stackoverflow.com/questions/774824/explain-python-entry-points # TODO: make sure we do not have conflicting generators installed! for ep in pkg_resources.iter_entry_points(group, n...
def get_plugin_versions(group='gcdt10'): """Load and register installed gcdt plugins. """ versions = {} for ep in pkg_resources.iter_entry_points(group, name=None): versions[ep.dist.project_name] = ep.dist.version return versions
def delete_log_group(awsclient, log_group_name): """Delete the specified log group :param log_group_name: log group name :return: """ client_logs = awsclient.get_client('logs') response = client_logs.delete_log_group( logGroupName=log_group_name )
def put_retention_policy(awsclient, log_group_name, retention_in_days): """Sets the retention of the specified log group if the log group does not yet exist than it will be created first. :param log_group_name: log group name :param retention_in_days: log group name :return: """ try: ...
def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None): """ Note: this is used to retrieve logs in ramuda. :param log_group_name: log group name :param start_ts: timestamp :param end_ts: timestamp :return: list of log entries """ client_logs = awsclient.get_client('logs...
def describe_log_group(awsclient, log_group_name): """Get info on the specified log group :param log_group_name: log group name :return: """ client_logs = awsclient.get_client('logs') request = { 'logGroupNamePrefix': log_group_name, 'limit': 1 } response = client_logs....
def describe_log_stream(awsclient, log_group_name, log_stream_name): """Get info on the specified log stream :param log_group_name: log group name :param log_stream_name: log stream :return: """ client_logs = awsclient.get_client('logs') response = client_logs.describe_log_streams( ...
def create_log_group(awsclient, log_group_name): """Creates a log group with the specified name. :param log_group_name: log group name :return: """ client_logs = awsclient.get_client('logs') response = client_logs.create_log_group( logGroupName=log_group_name, )
def create_log_stream(awsclient, log_group_name, log_stream_name): """Creates a log stream for the specified log group. :param log_group_name: log group name :param log_stream_name: log stream name :return: """ client_logs = awsclient.get_client('logs') response = client_logs.create_log_st...
def put_log_events(awsclient, log_group_name, log_stream_name, log_events, sequence_token=None): """Put log events for the specified log group and stream. :param log_group_name: log group name :param log_stream_name: log stream name :param log_events: [{'timestamp': 123, 'message': '...
def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None): """Get log events for the specified log group and stream. this is used in tenkai output instance diagnostics :param log_group_name: log group name :param log_stream_name: log stream name :param start_ts: timestamp :r...
def check_log_stream_exists(awsclient, log_group_name, log_stream_name): """Check :param log_group_name: log group name :param log_stream_name: log stream name :return: True / False """ lg = describe_log_group(awsclient, log_group_name) if lg and lg['logGroupName'] == log_group_name: ...
def decode_format_timestamp(timestamp): """Convert unix timestamp (millis) into date & time we use in logs output. :param timestamp: unix timestamp in millis :return: date, time in UTC """ dt = maya.MayaDT(timestamp / 1000).datetime(naive=True) return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M...
def reload(self): """Reload the configuration from disk returning True if the configuration has changed from the previous values. """ config = self._default_configuration() if self._file_path: config.update(self._load_config_file()) if config != self._values:...
def _load_config_file(self): """Load the configuration file into memory, returning the content. """ LOGGER.info('Loading configuration from %s', self._file_path) if self._file_path.endswith('json'): config = self._load_json_config() else: config = self._l...
def _load_json_config(self): """Load the configuration file in JSON format :rtype: dict """ try: return json.loads(self._read_config()) except ValueError as error: raise ValueError( 'Could not read configuration file: {}'.format(error))
def _load_yaml_config(self): """Loads the configuration file from a .yaml or .yml file :type: dict """ try: config = self._read_config() except OSError as error: raise ValueError('Could not read configuration file: %s' % error) try: r...
def _normalize_file_path(file_path): """Normalize the file path value. :param str file_path: The file path as passed in :rtype: str """ if not file_path: return None elif file_path.startswith('s3://') or \ file_path.startswith('http://') or \...
def _read_config(self): """Read the configuration from the various places it may be read from. :rtype: str :raises: ValueError """ if not self._file_path: return None elif self._file_path.startswith('s3://'): return self._read_s3_config() ...
def _read_remote_config(self): """Read a remote config via URL. :rtype: str :raises: ValueError """ try: import requests except ImportError: requests = None if not requests: raise ValueError( 'Remote config URL...
def _read_s3_config(self): """Read in the value of the configuration file in Amazon S3. :rtype: str :raises: ValueError """ try: import boto3 import botocore.exceptions except ImportError: boto3, botocore = None, None if not ...
def update(self, configuration, debug=None): """Update the internal configuration values, removing debug_only handlers if debug is False. Returns True if the configuration has changed from previous configuration values. :param dict configuration: The logging configuration :param...
def configure(self): """Configure the Python stdlib logger""" if self.debug is not None and not self.debug: self._remove_debug_handlers() self._remove_debug_only() logging.config.dictConfig(self.config) try: logging.captureWarnings(True) except Att...
def _remove_debug_handlers(self): """Remove any handlers with an attribute of debug_only that is True and remove the references to said handlers from any loggers that are referencing them. """ remove = list() for handler in self.config[self.HANDLERS]: if self...
def _remove_debug_only(self): """Iterate through each handler removing the invalid dictConfig key of debug_only. """ LOGGER.debug('Removing debug only from handlers') for handler in self.config[self.HANDLERS]: if self.DEBUG_ONLY in self.config[self.HANDLERS][handler]...
def as_dictionary(self): """ Convert this object to a dictionary with formatting appropriate for a PIF. :returns: Dictionary with the content of this object formatted for a PIF. """ return {to_camel_case(i): Serializable._convert_to_dictionary(self.__dict__[i]) f...
def _convert_to_dictionary(obj): """ Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as a Pio object and otherwise returns obj. :param obj: Object to convert to a dictionary. :returns: Input object as a dictionary or the ori...
def _get_object(class_, obj): """ Helper function that returns an object, or if it is a dictionary, initializes it from class_. :param class_: Class to use to instantiate object. :param obj: Object to process. :return: One or more objects. """ if isinstance(obj, ...
def damping(temp, relhum, freq, pres=101325): """ Calculates the damping factor for sound in dB/m depending on temperature, humidity and sound frequency. Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm temp: Temperature in degrees celsius relhum: Relative humidity as percentage, e....
def total_level(source_levels): """ Calculates the total sound pressure level based on multiple source levels """ sums = 0.0 for l in source_levels: if l is None: continue if l == 0: continue sums += pow(10.0, float(l) / 10.0) level = 10.0 * math.l...
def total_rated_level(octave_frequencies): """ Calculates the A-rated total sound pressure level based on octave band frequencies """ sums = 0.0 for band in OCTAVE_BANDS.keys(): if band not in octave_frequencies: continue if octave_frequencies[band] is None: ...
def leq3(levels): """ Calculates the energy-equivalent (Leq3) value given a regular measurement interval. """ n = float(len(levels)) sums = 0.0 if sum(levels) == 0.0: return 0.0 for l in levels: if l == 0: continue sums += pow(10.0, float(l) / 10.0) ...
def distant_level(reference_level, distance, reference_distance=1.0): """ Calculates the sound pressure level in dependence of a distance where a perfect ball-shaped source and spread is assumed. reference_level: Sound pressure level in reference distance in dB distance: Distance to calculate s...
def distant_total_damped_rated_level( octave_frequencies, distance, temp, relhum, reference_distance=1.0): """ Calculates the damped, A-rated total sound pressure level in a given distance, temperature and relative humidity from octave frequenc...
def ASRS(self, params): """ ASRS [Ra,] Ra, Rc ASRS [Ra,] Rb, #imm5_counting Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra imm5 counting is [1, 32] In the register shift, the first two operands must be the same register Ra, Rb, and Rc...
def LSLS(self, params): """ LSLS [Ra,] Ra, Rc LSLS [Ra,] Rb, #imm5 Logical shift left Rb by Rc or imm5 and store the result in Ra imm5 is [0, 31] In the register shift, the first two operands must be the same register Ra, Rb, and Rc must be low registers ...
def LSRS(self, params): """ LSRS [Ra,] Ra, Rc LSRS [Ra,] Rb, #imm5_counting Logical shift right Rb by Rc or imm5 and store the result in Ra imm5 counting is [1, 32] In the register shift, the first two operands must be the same register Ra, Rb, and Rc must be low...
def RORS(self, params): """ RORS [Ra,] Ra, Rc Rotate shift right Rb by Rc or imm5 and store the result in Ra The first two operands must be the same register Ra and Rc must be low registers The first register is optional """ # This instruction allows for ...
def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'): """ 解析话题列表 :internal :param xml: 页面XML :param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec :param selector: 表在页面中的位置 :...
def search_groups(self, keyword, start=0): """ 搜索小组 :param keyword: 搜索的关键字 :param start: 翻页 :return: 含总数的列表 """ xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (start, keyword)) xml_results = xml.xpath('//div[@class="groups"]/div[@class="result"]') ...
def list_joined_groups(self, user_alias=None): """ 已加入的小组列表 :param user_alias: 用户名,默认为当前用户名 :return: 单页列表 """ xml = self.api.xml(API_GROUP_LIST_JOINED_GROUPS % (user_alias or self.api.user_alias)) xml_results = xml.xpath('//div[@class="group-list group-ca...
def join_group(self, group_alias, message=None): """ 加入小组 :param group_alias: 小组ID :param message: 如果要验证,留言信息 :return: 枚举 - joined: 加入成功 - waiting: 等待审核 - initial: 加入失败 """ xml = self.api.xml(API_GROUP_GROUP...
def leave_group(self, group_alias): """ 退出小组 :param group_alias: 小组ID :return: """ return self.api.req(API_GROUP_GROUP_HOME % group_alias, params={ 'action': 'quit', 'ck': self.api.ck(), })
def search_topics(self, keyword, sort='relevance', start=0): """ 搜索话题 :param keyword: 关键字 :param sort: 排序方式 relevance/newest :param start: 翻页 :return: 带总数的列表 """ xml = self.api.xml(API_GROUP_SEARCH_TOPICS % (start, sort, keyword)) return b...
def list_topics(self, group_alias, _type='', start=0): """ 小组内话题列表 :param group_alias: 小组ID :param _type: 类型 默认最新,hot:最热 :param start: 翻页 :return: 带下一页的列表 """ xml = self.api.xml(API_GROUP_LIST_GROUP_TOPICS % group_alias, params={ 'star...
def list_joined_topics(self, start=0): """ 已加入的所有小组的话题列表 :param start: 翻页 :return: 带下一页的列表 """ xml = self.api.xml(API_GROUP_HOME, params={'start': start}) return build_list_result(self._parse_topic_table(xml, 'title,comment,created,group'), xml)
def list_user_topics(self, start=0): """ 发表的话题 :param start: 翻页 :return: 带下一页的列表 """ xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start}) return build_list_result(self._parse_topic_table(xml, 'title,comme...
def list_commented_topics(self, start=0): """ 回复过的话题列表 :param start: 翻页 :return: 带下一页的列表 """ xml = self.api.xml(API_GROUP_LIST_USER_COMMENTED_TOPICS % self.api.user_alias, params={'start': start}) return build_list_result(self._parse_topic_table(xml, 'tit...
def list_liked_topics(self, user_alias=None, start=0): """ 喜欢过的话题 :param user_alias: 指定用户,默认当前 :param start: 翻页 :return: 带下一页的列表 """ user_alias = user_alias or self.api.user_alias xml = self.api.xml(API_GROUP_LIST_USER_LIKED_TOPICS % user_alias, p...