text stringlengths 81 112k |
|---|
REV16 Ra, Rb
Reverse the byte order of the half words in register Rb and store the result in Ra
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_PA... |
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
def REVSH(self, params):
"""
REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the resul... |
STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra
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.che... |
STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra
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)
... |
UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra
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.che... |
UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra
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)
... |
Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return:
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:
... |
Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object.
def _get_event_source_obj(awsclient, evt_source):
"""
Given awsclient, event_source dictionary item
create an event_source object of the appropria... |
Given an event_source dictionary, create the object and add the event source.
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 zap... |
Given an event_source dictionary, create the object and remove the event source.
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 e... |
Given an event_source dictionary, create the object and get the event source status.
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_sour... |
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 events: list of events
:param lambda_name:
:param alias_name:
:retu... |
Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code
def wire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None,
... |
Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code
def unwire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None, alia... |
Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return:
def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
suffix):
"""Use only prefix OR suffix
:param arn:
:param event:
:par... |
r'''
Try to find the Eigen library. If successful the include directory is returned.
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('ei... |
Helper to read the params for the logs command
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]... |
Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return:
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:
"""... |
Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return:
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('s... |
List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return:
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 p... |
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
def ORRS(self, params):
"""
ORRS [Ra,] Ra, Rb
OR Ra and Rb together and s... |
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
def TST(self, params):
"""
TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent... |
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
should contain everything required.
* Additional keyword ... |
Returns the confirmation URL
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)})
) |
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
URL (including protocol and domain) for the registration link.
... |
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 ``max_age``.
This method raises ``V... |
do_some_work
:param work_dict: dictionary for key/values
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,
... |
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 prefix to use
:param instance_reference: The EC2 troposphere reference which's private IP should be link... |
Use service discovery to get the host zone name from the default stack
:return: Host zone name as string
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
"""
glo... |
Load and register installed gcdt plugins.
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 ... |
Load and register installed gcdt plugins.
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 |
Delete the specified log group
:param log_group_name: log group name
:return:
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... |
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:
def put_retention_policy(awsclient, log_group_name, retention_in_days):
"""Sets the retention of ... |
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
def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
"""
Note: this is used to retrieve logs in ramuda.
... |
Get info on the specified log group
:param log_group_name: log group name
:return:
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 = {
... |
Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return:
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... |
Creates a log group with the specified name.
:param log_group_name: log group name
:return:
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')
r... |
Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return:
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
... |
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': 'string'}, ...]
:param sequence_token: the sequence token
:return: next_token
def put_log_events(awsclient, log_gro... |
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
:return:
def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):... |
Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False
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
... |
Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC
def decode_format_timestamp(timestamp):
"""Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
... |
Reload the configuration from disk returning True if the
configuration has changed from the previous values.
def reload(self):
"""Reload the configuration from disk returning True if the
configuration has changed from the previous values.
"""
config = self._default_configuratio... |
Load the configuration file into memory, returning the content.
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 = se... |
Load the configuration file in JSON format
:rtype: dict
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(
... |
Loads the configuration file from a .yaml or .yml file
:type: dict
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 ValueErro... |
Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str
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:
re... |
Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError
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:
... |
Read a remote config via URL.
:rtype: str
:raises: ValueError
def _read_remote_config(self):
"""Read a remote config via URL.
:rtype: str
:raises: ValueError
"""
try:
import requests
except ImportError:
requests = None
i... |
Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
def _read_s3_config(self):
"""Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
"""
try:
import boto3
impo... |
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 bool debug: Toggles use of debug_only loggers
:... |
Configure the Python stdlib logger
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.capt... |
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.
def _remove_debug_handlers(self):
"""Remove any handlers with an attribute of debug_only that is True and
remove the references to said... |
Iterate through each handler removing the invalid dictConfig key of
debug_only.
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.con... |
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF.
def as_dictionary(self):
"""
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the co... |
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 original object.
def _convert_to_dictionary(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.
def _get_object(class_, obj):
"""
Helper function that returns an object... |
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.g. 50
freq: Sound frequency in herz
pres: Atmosphe... |
Calculates the total sound pressure level based on multiple source levels
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:
co... |
Calculates the A-rated total sound pressure level
based on octave band frequencies
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_... |
Calculates the energy-equivalent (Leq3) value
given a regular measurement interval.
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 leve... |
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 sound pressure level for, in meters
reference_distance: reference distance in m... |
Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequency sound pressure levels in a reference distance
def distant_total_damped_rated_level(
octave_frequencies,
distance,
temp,
relhum,
... |
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 must be low registers
If Ra is omit... |
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
If Ra is omitted, then it is assumed to be R... |
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 registers
If Ra is omitted, then it... |
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
def RORS(self, params):
"""
RORS [Ra,] Ra, Rc
Rotate shift right Rb ... |
解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:return:
def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'):
"""... |
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
def search_groups(self, keyword, start=0):
"""
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (st... |
已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表
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.ap... |
加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败
def join_group(self, group_alias, message=None):
"""
加入小组
:param group_alias: 小组ID
... |
退出小组
:param group_alias: 小组ID
:return:
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': s... |
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表
def search_topics(self, keyword, sort='relevance', start=0):
"""
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param star... |
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表
def list_topics(self, group_alias, _type='', start=0):
"""
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start... |
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
def list_joined_topics(self, start=0):
"""
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_HOME, params={'start': start})
return build_list_result(s... |
发表的话题
:param start: 翻页
:return: 带下一页的列表
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})
... |
回复过的话题列表
:param start: 翻页
:return: 带下一页的列表
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... |
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
def list_liked_topics(self, user_alias=None, start=0):
"""
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_... |
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
def list_reced_topics(self, user_alias=None, start=0):
"""
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = use... |
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool
def add_topic(self, group_alias, title, content):
"""
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:retu... |
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
def remove_topic(self, topic_id):
"""
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
"""
comment_start = 0
while comment_start is not None:
commen... |
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
def update_topic(self, topic_id, title, content):
"""
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
"""
... |
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
def list_comments(self, topic_id, start=0):
"""
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_GET_TOPIC % topic_... |
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None
def add_comment(self, topic_id, content, reply_id=None):
"""
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: N... |
删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None
def remove_comment(self, topic_id, comment_id, reason='0', other=None):
"""
删除评论(自己发的话题所有的都可以删除,否则只能删... |
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
def list_user_comments(self, topic_id, user_alias=None):
"""
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
"""
... |
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
def remove_commented_topic(self, topic_id):
"""
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
"""
return [self.remove_comment(topic_id, item['id']) for item in self.list... |
Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`.
def shell(name=None, **attrs):
"""Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`comman... |
This is used by gcdt plugins to get a logger with the right level.
def getLogger(name):
"""This is used by gcdt plugins to get a logger with the right level."""
logger = logging.getLogger(name)
# note: the level might be adjusted via '-v' option
logger.setLevel(logging_config['loggers']['gcdt']['level'... |
Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent.
def _discover(self):
"""Discovers methods in the XML-RPC API and creates attributes for... |
If the session expired, logs back in.
def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise |
Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
def help(self):
"""Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
... |
Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own accord.
def run(self):
... |
Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
number of pieces. If ``piece_size`` has alre... |
Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting progress if dottorrent is used in a
GUI/thread... |
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
def info_hash_base32(self):
"""
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` mus... |
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
def info_hash(self):
"""
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` mu... |
请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:type auth: bool
:param auth: if True and sess... |
请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: dict
:return:
de... |
请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: html.HtmlElement
:return:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.