code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
@functools.wraps(gen_func) def wrapper(*args, **kwargs): with warnings.catch_warnings(): for cls in [DeprecationWarning, PendingDeprecationWarning]: warnings.filterwarnings( action="ignore", message=".* raised StopIteration", ...
def allow_implicit_stop(gen_func)
Fix the backwards-incompatible PEP-0479 gotcha/bug https://www.python.org/dev/peps/pep-0479
2.822579
2.71436
1.039869
# Sanity checks to reduce risk of having a segfault: jac = _ensure_5args(jac) if check_callable: _check_callable(rhs, jac, x0, y0) if check_indexing: _check_indexing(rhs, jac, x0, y0) return adaptive(rhs, jac, np.asarray(y0, dtype=np.float64), x0, xend, atol, rtol, dx0, dx_max...
def integrate_adaptive(rhs, jac, y0, x0, xend, atol, rtol, dx0=.0, dx_max=.0, check_callable=False, check_indexing=False, **kwargs)
Integrates a system of ordinary differential equations. Parameters ---------- rhs: callable Function with signature f(t, y, fout) which modifies fout *inplace*. jac: callable Function with signature j(t, y, jmat_out, dfdx_out) which modifies jmat_out and dfdx_out *inplace*. ...
3.826209
4.696705
0.814658
# Sanity checks to reduce risk of having a segfault: jac = _ensure_5args(jac) if check_callable: _check_callable(rhs, jac, xout[0], y0) if check_indexing: _check_indexing(rhs, jac, xout[0], y0) return predefined(rhs, jac, np.asarray(y0, dtype=np.float64), np.asarray(xout, dtyp...
def integrate_predefined(rhs, jac, y0, xout, atol, rtol, dx0=0.0, dx_max=0.0, check_callable=False, check_indexing=False, **kwargs)
Integrates a system of ordinary differential equations. Parameters ---------- rhs: callable Function with signature f(t, y, fout) which modifies fout *inplace*. jac: callable Function with signature j(t, y, jmat_out, dfdx_out) which modifies jmat_out and dfdx_out *inplace*. ...
3.754811
4.396512
0.854043
start_result = requests.post(url + '/' + pipeline_id + '/start', headers=X_REQ_BY, auth=auth, verify=verify_ssl, json=runtime_parameters) start_result.raise_for_status() logging.info('Pipeline start requested.') poll_pipeline_status(STATUS_RUNNING, url, pipeline_id...
def start_pipeline(url, pipeline_id, auth, verify_ssl, runtime_parameters={})
Start a running pipeline. The API waits for the pipeline to be fully started. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. r...
3.849659
4.516205
0.85241
export_result = requests.get(url + '/' + pipeline_id + '/export', headers=X_REQ_BY, auth=auth, verify=verify_ssl) if export_result.status_code == 404: logging.error('Pipeline not found: ' + pipeline_id) export_result.raise_for_status() return export_result.json()
def export_pipeline(url, pipeline_id, auth, verify_ssl)
Export the config and rules for a pipeline. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. verify_ssl (bool): whether to verify ssl certificates ...
2.641385
3.335443
0.791914
status_result = requests.get(url + '/' + pipeline_id + '/status', headers=X_REQ_BY, auth=auth, verify=verify_ssl) status_result.raise_for_status() logging.debug('Status request: ' + url + '/status') logging.debug(status_result.json()) return status_result.json()
def pipeline_status(url, pipeline_id, auth, verify_ssl)
Retrieve the current status for a pipeline. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. verify_ssl (bool): whether to verify ssl certificate...
3.039919
3.88426
0.782625
preview_status = requests.get(url + '/' + pipeline_id + '/preview/' + previewer_id + "/status", headers=X_REQ_BY, auth=auth, verify=verify_ssl) preview_status.raise_for_status() logging.debug(preview_status.json()) return preview_status.json()
def preview_status(url, pipeline_id, previewer_id, auth, verify_ssl)
Retrieve the current status for a preview. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. previewer_id (str): the previewer id created by starting a preview or validation auth (tuple): a tuple o...
2.810332
3.65447
0.769012
stop_result = requests.post(url + '/' + pipeline_id + '/stop', headers=X_REQ_BY, auth=auth, verify=verify_ssl) stop_result.raise_for_status() logging.info("Pipeline stop requested.") poll_pipeline_status(STATUS_STOPPED, url, pipeline_id, auth, verify_ssl) logging.info('Pipeline stopped.') ...
def stop_pipeline(url, pipeline_id, auth, verify_ssl)
Stop a running pipeline. The API waits for the pipeline to be 'STOPPED' before returning. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. verify_ssl (b...
3.764011
4.600169
0.818233
validate_result = requests.get(url + '/' + pipeline_id + '/validate', headers=X_REQ_BY, auth=auth, verify=verify_ssl) validate_result.raise_for_status() previewer_id = validate_result.json()['previewerId'] poll_validation_status(url, pipeline_id, previewer_id, auth, verify_ssl) preview_result...
def validate_pipeline(url, pipeline_id, auth, verify_ssl)
Validate a pipeline and show issues. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. verify_ssl (bool): whether to verify ssl certificates Returns...
2.861634
3.110907
0.919871
''' :param url: (str): the host url in the form 'http://host:port/'. :param pipeline_id: (string) the pipeline identifier :param auth: (tuple) a tuple of username, password :return: (boolean) ''' try: pipeline_status(url, pipeline_id, auth, verify_ssl)['status'] return True ...
def pipeline_exists(url, pipeline_id, auth, verify_ssl)
:param url: (str): the host url in the form 'http://host:port/'. :param pipeline_id: (string) the pipeline identifier :param auth: (tuple) a tuple of username, password :return: (boolean)
4.357096
2.116839
2.058302
parameters = { 'overwrite' : overwrite } import_result = requests.post(url + '/' + pipeline_id + '/import', params=parameters, headers=X_REQ_BY, auth=auth, verify=verify_ssl, json=json_payload) if import_result.status_code != 200: logging.error('Import error r...
def import_pipeline(url, pipeline_id, auth, json_payload, verify_ssl, overwrite = False)
Import a pipeline. This will completely overwrite the existing pipeline. Args: url (str): the host url in the form 'http://host:port/'. pipeline_id (str): the ID of of the exported pipeline. auth (tuple): a tuple of username, and password. json_payload (dict): ...
3.141232
3.984872
0.788289
title = json_payload['pipelineConfig']['title'] description = json_payload['pipelineConfig']['description'] params = {'description':description, 'autoGeneratePipelineId':True} logging.info('No destination pipeline ID provided. Creating a new pipeline: ' + title) put_result = requests.put(url +...
def create_pipeline(url, auth, json_payload, verify_ssl)
Create a new pipeline. Args: url (str): the host url in the form 'http://host:port/'. auth (tuple): a tuple of username, and password. json_payload (dict): the exported json paylod as a dictionary. verify_ssl (bool): whether to verify ssl certificates Returns...
4.041542
4.821139
0.838296
sysinfo_response = requests.get(url + '/info', headers=X_REQ_BY, auth=auth, verify=verify_ssl) sysinfo_response.raise_for_status() return sysinfo_response.json()
def system_info(url, auth, verify_ssl)
Retrieve SDC system information. Args: url (str): the host url. auth (tuple): a tuple of username, and password.
3.446588
4.448706
0.774739
# Export the source pipeline and save it to file src = conf.config['instances'][args.src_instance] src_url = api.build_pipeline_url(build_instance_url(src)) src_auth = tuple([conf.creds['instances'][args.src_instance]['user'], conf.creds['instances'][args.src_instance]['pass']...
def export_pipeline(conf, args)
Export a pipeline to json.
3.69417
3.774721
0.97866
with open(args.pipeline_json) as pipeline_json: dst = conf.config['instances'][args.dst_instance] dst_url = api.build_pipeline_url(build_instance_url(dst)) dst_auth = tuple([conf.creds['instances'][args.dst_instance]['user'], conf.creds['instances'][args.dst_in...
def import_pipeline(conf, args)
Import a pipeline from json.
3.855413
3.765436
1.023896
src = conf.config['instances'][args.src_instance] src_url = api.build_pipeline_url(build_instance_url(src)) src_auth = tuple([conf.creds['instances'][args.src_instance]['user'], conf.creds['instances'][args.src_instance]['pass']]) verify_ssl = src.get('verify_ssl', True) export_json = api.expor...
def promote_pipeline(conf, args)
Export a pipeline from a lower environment and import into higher environment.
2.32654
2.262553
1.028281
host = conf.config['instances'][args.host_instance] url = api.build_pipeline_url(build_instance_url(host)) auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']]) runtime_parameters = {} verify_ssl = host.get('verify_ssl', True) ...
def start_pipeline(conf, args)
Start a pipeline
4.030155
3.978857
1.012893
host = conf.config['instances'][args.host_instance] url = api.build_pipeline_url(build_instance_url(host)) auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']]) verify_ssl = host.get('verify_ssl', True) stop_result = api.stop_p...
def stop_pipeline(conf, args)
Stop a pipeline.
4.635243
4.684775
0.989427
src = conf.config['instances'][args.src] src_url = api.build_system_url(build_instance_url(src)) src_auth = tuple([conf.creds['instances'][args.src]['user'], conf.creds['instances'][args.src]['pass']]) verify_ssl = src.get('verify_ssl', True) sysinfo_json = api.system_info...
def system_info(conf, args)
Retieve SDC system information.
4.390831
4.170228
1.052899
host = conf.config['instances'][args.host_instance] host_url = api.build_pipeline_url(build_instance_url(host)) host_auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']]) verify_ssl = host.get('verify_ssl', Tru...
def validate_pipeline(conf, args)
Validate a pipeline configuration.
4.106262
4.085107
1.005178
host = conf.config['instances'][args.host_instance] url = api.build_pipeline_url(build_instance_url(host)) auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']]) verify_ssl = host.get('verify_ssl', True) status_result = api.pipe...
def status_pipeline(conf, args)
Stop a pipeline.
4.544248
4.6204
0.983518
frames = self._validateFrames(frames) if frames[1] == -1: frames[1] = None if (len(bp) != 2): raise ValueError("bp should be a list containing first and last bp of a segment. See, documentation!!!") if bp[0] > bp[1]: raise ValueError("bp sh...
def extractGlobalParameters(self, dna, bp, frames=None, paxis='Z', masked=False)
Extract the parameters for calculations .. currentmodule:: dnaMD Parameters ---------- dna : :class:`dnaMD.DNA` Input :class:`dnaMD.DNA` instance. bp : list List of two base-steps forming the DNA segment. For example: with ``bp=[5, 50]``, 5...
3.395189
3.281557
1.034628
r if self.esType == 'ST': raise KeyError(' Use dnaEY.getStretchTwistModulus for Stretching-Twisting modulus.') frames = self._validateFrames(frames) name = '{0}-{1}-{2}-{3}'.format(bp[0], bp[1], frames[0], frames[1]) if name not in self.esMatrix: time...
def getStretchTwistBendModulus(self, bp, frames=None, paxis='Z', masked=True, matrix=False)
r"""Calculate Bending-Stretching-Twisting matrix It calculate elastic matrix and modulus matrix. .. math:: \text{modulus matrix} = 4.1419464 \times \begin{bmatrix} K_{Bx} & K_{Bx,By} & K_{Bx,S} & K_{Bx,T} \\ K_{Bx,By} & K_{By} & K_{By,S} & K_{By,T} \\ ...
5.93203
4.146969
1.430449
r if self.esType == 'BST': props_name = [ 'bend-1', 'bend-2', 'stretch', 'twist', 'bend-1-bend-2', 'bend-2-stretch', 'stretch-twist', 'bend-1-stretch', 'bend-2-twist', 'bend-1-twist'] else: props_name = ['stretch', 't...
def getModulusByTime(self, bp, frameGap, masked=False, paxis='Z', outFile=None)
r"""Calculate moduli as a function of time for convergence check It can be used to obtained elastic moduli as a function of time to check their convergence. .. note:: Elastic properties cannot be calculated using a single frame because fluctuations are required. Therefore, here time ...
2.788131
2.22535
1.252895
r if which not in self.enGlobalTypes[:5]: raise ValueError('{0} is not a supported energy keywords.\n Use any of the following: \n {1}'.format( which, self.enGlobalTypes[:5])) energy = None if which == 'full': temp = np.matrix(diff) ...
def _calcEnergyStretchTwist(self, diff, es, which)
r"""Calculate energy for ``estype='ST'`` using a difference vector. It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame. Parameters ---------- diff : numpy.ndarray Array of difference between minimum and current parameter values. ...
3.251451
3.065961
1.0605
if helical: props_name = helical_local_props_vector else: props_name = local_props_vector segments, errors, elasticities = [], OrderedDict(), OrderedDict() for name in props_name: elasticities[name] = [] errors[name] = [] ...
def calculateLocalElasticitySegments(self, bp, span=2, frameGap=None, helical=False, unit='kT', err_type='block', tool='gmx analyze', outFile=None)
Calculate local elastic properties of consecutive overlapped DNA segments Calculate local elastic properties of consecutive overlapped DNA segments of length given by `span`. Parameters ---------- bp : list List of two base-steps forming the global DNA segment. ...
2.784481
2.67793
1.039789
r if which not in self.enLocalTypes: raise ValueError('{0} is not a supported energy keywords.\n Use any of the following: \n {1}'.format( which, self.enLocalTypes)) energy = None if which == 'full': temp = np.matrix(diff) energy = 0...
def _calcLocalEnergy(self, diff, es, which)
r"""Calculate local deformation energy using a difference vector. It is called in :meth:`dnaEY.getLocalDeformationEnergy` for energy calculation of each frame. Parameters ---------- diff : numpy.ndarray Array of difference between minimum and current parameter values. ...
2.106781
2.03845
1.033521
assert isinstance(L, cspmatrix) and L.is_factor is True, "L must be a cspmatrix factor" n = L.symb.n snpost = L.symb.snpost snptr = L.symb.snptr chptr = L.symb.chptr chidx = L.symb.chidx relptr = L.symb.relptr relidx = L.symb.relidx blkptr = L.symb.blkptr blkval = L.blkva...
def llt(L)
Supernodal multifrontal Cholesky product: .. math:: X = LL^T where :math:`L` is lower-triangular. On exit, the argument `L` contains the product :math:`X`. :param L: :py:class:`cspmatrix` (factor)
5.182928
4.875879
1.062973
patterns = [re.sub(r'\*|:\d+', '', pattern) for pattern in re.findall(r'{[\+#\./;\?&]?([^}]+)*}', href)] variables = [] for pattern in patterns: for part in pattern.split(","): if not part in variables: variables.append(part) return variables
def extract_variables(href)
Return a list of variable names used in a URI template.
6.960165
6.055228
1.149447
if self.is_templated: return uritemplate.expand(self.template, kwargs) else: return self.template
def url(self, **kwargs)
Returns a URL for the link with optional template expansion. If the link is marked as templated, the href will be expanded according to RFC6570, using template variables provided in the keyword arguments. If the href is a valid URI Template, but the link is not marked as templated, the ...
4.17791
3.544737
1.178623
if isinstance(o, list): if len(o) == 1: return cls.from_object(o[0], base_uri) return [cls.from_object(x, base_uri) for x in o] return cls(o, base_uri)
def from_object(cls, o, base_uri)
Returns a new ``Link`` based on a JSON object or array. Arguments: - ``o``: a dictionary holding the deserializated JSON for the new ``Link``, or a ``list`` of such documents. - ``base_uri``: optional URL used as the basis when expanding relative...
1.861402
2.152171
0.864895
content_encoding = self.headers.get('content-encoding') decoder = self.CONTENT_DECODERS.get(content_encoding) data = self._fp and self._fp.read(amt) try: if amt: return data if not decode_content or not decoder: if cach...
def read(self, amt=None, decode_content=True, cache_content=False)
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, decoding and caching is skipped because we can't decode partial content nor does it make ...
3.343779
3.314272
1.008903
return HTTPResponse(body=r, headers=dict(r.getheaders()), status=r.status, version=r.version, reason=r.reason, strict=r.strict, origin...
def from_httplib(r, **response_kw)
Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``.
3.047593
2.6676
1.142447
from . import version _LOGGER.debug(version) loop = asyncio.get_event_loop() mediaroom_protocol = MediaroomProtocol(responses_callback, box_ip) sock = create_socket() await loop.create_datagram_endpoint(lambda: mediaroom_protocol, sock=sock) return mediaroom_protocol
async def install_mediaroom_protocol(responses_callback, box_ip=None)
Install an asyncio protocol to process NOTIFY messages.
3.397324
3.065799
1.108137
if self._node.get('activities'): tune = self._node['activities'].get('tune') if type(tune) is collections.OrderedDict: return tune elif type(tune) is list: return tune[0] return tune return None
def tune(self)
XML node representing tune.
4.779684
4.135826
1.155678
if self.tune and self.tune.get('@stopped'): return True if self.tune.get('@stopped') == 'true' else False else: raise PyMediaroomError("No information in <node> about @stopped")
def stopped(self)
Return if the stream is stopped.
15.083374
13.202147
1.142494
if self.tune and self.tune.get('@src'): return True if self.tune.get('@src').startswith('timeshift') else False else: raise PyMediaroomError("No information in <node> about @src")
def timeshift(self)
Return if the stream is a timeshift.
19.238729
13.96611
1.37753
if self.tune and self.tune.get('@src'): return True if self.tune.get('@src').startswith('mbr') else False else: raise PyMediaroomError("No information in <node> about @src")
def recorded(self)
Return if the stream is a recording.
23.391867
18.401699
1.27118
if self._device: return self._device return GEN_ID_FORMAT.format(self.src_ip)
def device_uuid(self)
Return device UUID.
14.300286
11.586308
1.23424
#_LOGGER.debug(data) if not self.box_ip or self.box_ip == addr[0]: self.responses(MediaroomNotify(addr, data))
def datagram_received(self, data, addr)
Datagram received callback.
14.587442
17.219921
0.847126
if exception is None: pass else: import pprint pprint.pprint(exception) _LOGGER.error('Error received: %s', exception)
def error_received(self, exception)
Datagram error callback.
5.090651
4.675345
1.088829
'''xxxxx.xxxxx.adgroups.get =================================== 取得一个推广计划的所有推广组,或者根据一个推广组Id列表取得一组推广组; 如果同时提供了推广计划Id和推广组id列表,则优先使用推广计划Id,当使用 推广计划ID获取数据时,返回的结果是有分页的。如果是用推广组ID列表作查询 则将一次返回所有查询的结果。''' request = TOPRequest('xxxxx.xxxxx.adgroups.get') request['pag...
def get(self, page_size, page_no=1, campaign_id=None, adgroup_ids=None, nick=None)
xxxxx.xxxxx.adgroups.get =================================== 取得一个推广计划的所有推广组,或者根据一个推广组Id列表取得一组推广组; 如果同时提供了推广计划Id和推广组id列表,则优先使用推广计划Id,当使用 推广计划ID获取数据时,返回的结果是有分页的。如果是用推广组ID列表作查询 则将一次返回所有查询的结果。
5.583943
1.883358
2.964886
'''xxxxx.xxxxx.adgroups.item.exist =================================== 判断在一个推广计划中是否已经推广了一个商品''' request = TOPRequest('xxxxx.xxxxx.adgroups.item.exist') request['campaign_id'] = campaign_id request['item_id'] = item_id if nick!=None: request['nick'] = nick ...
def item_exist(self, campaign_id, item_id, nick=None)
xxxxx.xxxxx.adgroups.item.exist =================================== 判断在一个推广计划中是否已经推广了一个商品
6.637743
3.273477
2.027735
'''xxxxx.xxxxx.creatives.record.get =================================== 根据一个创意Id列表取得创意对应的修改记录''' request = TOPRequest('xxxxx.xxxxx.creatives.record.get') request['creative_ids'] = creative_ids if nick!=None: request['nick'] = nick self.create(self.execute(request)...
def record_get(self, creative_ids, nick=None)
xxxxx.xxxxx.creatives.record.get =================================== 根据一个创意Id列表取得创意对应的修改记录
7.969844
4.426773
1.800374
'''xxxxx.xxxxx.creatives.get =================================== 取得一个推广组的所有创意或者根据一个创意Id列表取得一组创意; 如果同时提供了推广组Id和创意id列表,则优先使用推广组Id;''' request = TOPRequest('xxxxx.xxxxx.creatives.get') if adgroup_id!=None: request['adgroup_id'] = adgroup_id if creative_ids!=None: req...
def get(self, adgroup_id=None, creative_ids=None, nick=None)
xxxxx.xxxxx.creatives.get =================================== 取得一个推广组的所有创意或者根据一个创意Id列表取得一组创意; 如果同时提供了推广组Id和创意id列表,则优先使用推广组Id;
5.296706
2.490316
2.126922
'''xxxxx.xxxxx.keywords.add =================================== 创建一批关键词''' request = TOPRequest('xxxxx.xxxxx.keywords.add') request['adgroup_id'] = adgroup_id request['keyword_prices'] = keyword_prices if nick!=None: request['nick'] = nick self.create(self...
def add(self, adgroup_id, keyword_prices, nick=None)
xxxxx.xxxxx.keywords.add =================================== 创建一批关键词
7.045149
4.412354
1.596687
'''xxxxx.xxxxx.keywords.delete =================================== 删除一批关键词''' request = TOPRequest('xxxxx.xxxxx.keywords.delete') request['adgroup_id'] = adgroup_id request['keyword_ids'] = keyword_ids if nick!=None: request['nick'] = nick self.create(self...
def delete(self, adgroup_id, keyword_ids, nick=None)
xxxxx.xxxxx.keywords.delete =================================== 删除一批关键词
6.55119
4.407179
1.486481
'''xxxxx.xxxxx.keywords.price.set =================================== 设置一批关键词的出价''' request = TOPRequest('xxxxx.xxxxx.keywords.price.set') request['adgroup_id'] = adgroup_id request['keywordId_prices'] = keywordId_prices if nick!=None: request['nick'] = nick ...
def price_set(self, adgroup_id, keywordId_prices, nick=None)
xxxxx.xxxxx.keywords.price.set =================================== 设置一批关键词的出价
5.210593
3.045227
1.711069
'''xxxxx.xxxxx.keywords.recommend.get =================================== 取得一个推广组的推荐关键词列表''' request = TOPRequest('xxxxx.xxxxx.keywords.recommend.get') request['adgroup_id'] = adgroup_id for k, v in kwargs.iteritems(): if k not in ('nick', 'order_by', 'search'...
def recommend_get(self, adgroup_id, **kwargs)
xxxxx.xxxxx.keywords.recommend.get =================================== 取得一个推广组的推荐关键词列表
7.401261
5.30306
1.395659
'''xxxxx.xxxxx.customers.authorized.get =================================== 取得当前登录用户的授权账户列表''' request = TOPRequest('xxxxx.xxxxx.customers.authorized.get') self.create(self.execute(request)) return self.result
def authorized_get(self)
xxxxx.xxxxx.customers.authorized.get =================================== 取得当前登录用户的授权账户列表
14.443875
5.055919
2.856825
'''xxxxx.xxxxx.account.balance.get =================================== 取得当前登录用户的授权账户列表''' request = TOPRequest('xxxxx.xxxxx.account.balance.get') request['nick'] = nick self.create(self.execute(request)) return self.result
def balance_get(self, nick)
xxxxx.xxxxx.account.balance.get =================================== 取得当前登录用户的授权账户列表
10.897001
4.51181
2.415217
'''xxxxx.xxxxx.account.records.get =================================== 获取账户财务记录''' request = TOPRequest('xxxxx.xxxxx.account.records.get') request['nick'] = nick if start_time!=None: request['start_time'] = start_time if end_time!=None: request['end_time'] = end_t...
def records_get(self, nick, start_time=None, end_time=None)
xxxxx.xxxxx.account.records.get =================================== 获取账户财务记录
6.061386
3.699707
1.638342
'''xxxxx.xxxxx.tools.items.top.get =================================== 取得当前登录用户的授权账户列表''' request = TOPRequest('xxxxx.xxxxx.tools.items.top.get') request['keyword'] = keyword if nick!=None: request['nick'] = nick self.create(self.execute(request), models={'result'...
def items_top_get(self, keyword, nick=None)
xxxxx.xxxxx.tools.items.top.get =================================== 取得当前登录用户的授权账户列表
10.504648
5.281502
1.988951
''' 检查Session是否过期, 验证Session可用性 ''' now = time() ts = session_ts / 1000; if ts > ( now + 60 * 10 ) or now > ( ts + 60 * 30 ): return False return True
def validate_session(self, session_ts)
检查Session是否过期, 验证Session可用性
5.907388
3.704396
1.594697
''' Refresh Session Token ''' if not refresh_token: refresh_token = sessionkey params = { 'appkey' : self.API_KEY, 'sessionkey' : sessionkey, 'refresh_token': refresh_token } src = ''.join(["%s%s" % (k, v) for k, v ...
def refresh_session(self, sessionkey, refresh_token=None)
Refresh Session Token
2.92915
2.81025
1.042309
'''taobao.users.get 获取多个用户信息''' request = TOPRequest('taobao.users.get') request['nicks'] = ','.join(nicks) if not fields: user = User() fields = user.fields request['fields'] = ','.join(fields) self.create(self.execute(request)) return sel...
def get(self, nicks=[], fields=[])
taobao.users.get 获取多个用户信息
4.393353
3.433782
1.27945
if self.status == RUNNING: self.status = PAUSED self.previous_intervals.append(time.time() - self.interval_start) self.current_interval_duration = 0.0 elif self.status == PAUSED: self.interval_start = time.time() self.status = RUNNING
def pause(self)
Pauses the clock to continue running later. Saves the duration of the current interval in the previous_intervals list.
2.622296
2.182498
1.201511
if not hasattr(self,"thread") or not self.thread.isAlive(): self.thread = threading.Thread(target=self.__run) self.status = RUNNING self.reset() self.thread.start() else: print("Clock already running!")
def start(self)
Starts the clock from 0. Uses a separate thread to handle the timing functionalities.
3.223078
2.811317
1.146465
self.interval_start = time.time() while self.status != STOPPED: if self.status == RUNNING: self.current_interval_duration = time.time() - self.interval_start # If max_duration is set, stop the clock if it is reached if self.max_duration and self.time > self.max_duration: self.status == STOPPED ...
def __run(self)
Internal function that is run in a separate thread. Do not call directly.
4.036739
4.046615
0.997559
seconds = cvsecs(value) self.reset() self.previous_intervals.append(seconds)
def time(self, value)
Sets the time of the clock. Useful for seeking. Parameters ---------- value : str or int The time to seek to. Can be any of the following formats: >>> 15.4 -> 15.4 # seconds >>> (1,21.5) -> 81.5 # (min,sec) >>> (1,1,2) -> 3662 # (hr, min, sec) >>> '01:01:33.5' -> 3693.5 #(hr,min,s...
13.70707
28.78669
0.47616
if not self.__fps: raise RuntimeError("fps not set so current frame number cannot be" " calculated") else: return int(self.__fps * self.time)
def current_frame(self)
The current frame number that should be displayed.
6.472908
5.900663
1.09698
if not value is None: if not type(value) == float: raise ValueError("fps needs to be specified as a float") if value<1.0: raise ValueError("fps needs to be greater than 1.0") self.__fps = value
def fps(self,value)
Sets the frames per second of the current movie the clock is used for. Parameters ---------- value : float The fps value.
2.661144
3.390214
0.784949
if not value is None: if not type(value) in [float, int]: raise TypeError("max_duration needs to be specified as a number") if value<1.0: raise ValueError("max_duration needs to be greater than 1.0") value = float(value) self.__max_duration = value
def max_duration(self,value)
Sets the value of max duration Parameters ---------- value : float The value for max_duration Raises ------ TypeError If max_duration is not a number. ValueError If max_duration is smaller than 0.
2.589272
2.826764
0.915985
relative_path = "share/dose/v{0}/{1}".format(__version__, fname) prefixed_path = os.path.join(sys.prefix, *relative_path.split("/")) # Look for the file directly on sys.prefix try: return "\n".join(read_plain_text(prefixed_path, encoding=encoding)) except IOError: pass # H...
def get_shared(fname, encoding="utf-8")
Loads the string data from a text file that was packaged as a data file in the distribution. Uses the setuptools ``pkg_resources.resource_string`` function as a fallback, as installing Dose with it directly instead of using wheel/pip would store the setup.py ``data_files`` otherwhere. For more info...
5.071891
4.995269
1.015339
if limit_neighbors: agents = self.global_topology.neighbors(self.id) else: agents = self.get_all_nodes() if state_id is None: return [self.global_topology.node[_]['agent'] for _ in agents] # return all regardless of state else: r...
def get_agents(self, state_id=None, limit_neighbors=False)
Returns list of agents based on their state and connectedness Parameters ---------- state_id : int, str, or array-like, optional Used to select agents that have the same specified "state". If state = None, returns all agents regardless of its current state limit_...
3.122672
3.242219
0.963128
agent_id = int(len(self.global_topology.nodes())) agent = agent_type(self.env, agent_id=agent_id, state=state, name=name, **state_params) self.global_topology.add_node(agent_id, {'agent': agent}) return agent_id
def add_node(self, agent_type=None, state=None, name='network_process', **state_params)
Add a new node to the current network Parameters ---------- agent_type : NetworkAgent subclass Agent in the new node will be instantiated using this agent class state : object State of the Agent, this may be an integer or string or any other name : str, o...
2.982561
4.021023
0.741742
if agent_id1 in self.global_topology.nodes(data=False): if agent_id2 in self.global_topology.nodes(data=False): self.global_topology.add_edge(agent_id1, agent_id2, edge_attr_dict=edge_attr_dict, *edge_attrs) else: raise ValueError('\'agent_id2\'[{...
def add_edge(self, agent_id1, agent_id2, edge_attr_dict=None, *edge_attrs)
Add an edge between agent_id1 and agent_id2. agent_id1 and agent_id2 correspond to Networkx node IDs. This is a wrapper for the Networkx.Graph method `.add_edge`. Agents agent_id1 and agent_id2 will be automatically added if they are not already present in the graph. Edge attributes can be spe...
2.117725
2.329672
0.909023
headers = {} if accept_encoding: if isinstance(accept_encoding, str): pass elif isinstance(accept_encoding, list): accept_encoding = ','.join(accept_encoding) else: accept_encoding = 'gzip,deflate' headers['accept-encoding'] = accept_encod...
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None)
Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used as provid...
1.701533
1.927847
0.882608
# This code is actually similar to urlparse.urlsplit, but much # simplified for our needs. port = None scheme = 'http' if '//' in url: scheme, url = url.split('://', 1) if '/' in url: url, _path = url.split('/', 1) if ':' in url: url, port = url.split(':', 1) ...
def get_host(url)
Given a url, return its scheme, host and port (None if it's not there). For example: :: >>> get_host('http://google.com/mail/') ('http', 'google.com', None) >>> get_host('google.com:80') ('http', 'google.com', 80)
3.08723
3.407066
0.906126
self.num_connections += 1 log.info("Starting new HTTP connection (%d): %s" % (self.num_connections, self.host)) return HTTPConnection(host=self.host, port=self.port)
def _new_conn(self)
Return a fresh :class:`httplib.HTTPConnection`.
3.991205
3.203768
1.245785
conn = None try: conn = self.pool.get(block=self.block, timeout=timeout) # If this is a persistent connection, check if it got disconnected if conn and conn.sock and select([conn.sock], [], [], 0.0)[0]: # Either data is buffered (bad), or the...
def _get_conn(self, timeout=None)
Get a connection. Will return a pooled connection if one is available. If no connections are available and :prop:`.block` is ``False``, then a fresh connection is returned. :param timeout: Seconds to wait before giving up and raising :class:`urllib3.exceptions.EmptyPool...
6.648752
6.086288
1.092415
self.num_requests += 1 if timeout is _Default: timeout = self.timeout conn.request(method, url, **httplib_request_kw) conn.sock.settimeout(timeout) httplib_response = conn.getresponse() log.debug("\"%s %s %s\" %s %s" % (method, ur...
def _make_request(self, conn, method, url, timeout=_Default, **httplib_request_kw)
Perform a request on a given httplib connection object taken from our pool.
2.869573
2.793969
1.02706
# TODO: Add optional support for socket.gethostbyname checking. return (url.startswith('/') or get_host(url) == (self.scheme, self.host, self.port))
def is_same_host(self, url)
Check if the given ``url`` is a member of the same host as this conncetion pool.
9.074757
8.349369
1.086879
self.num_connections += 1 log.info("Starting new HTTPS connection (%d): %s" % (self.num_connections, self.host)) if not ssl: return HTTPSConnection(host=self.host, port=self.port) connection = VerifiedHTTPSConnection(host=self.host, port=self.port)...
def _new_conn(self)
Return a fresh :class:`httplib.HTTPSConnection`.
2.730172
2.442337
1.117852
if not super().can_document_member(member, membername, isattr, parent): return False return iscoroutinefunction(member)
def can_document_member(cls, member, membername, isattr, parent)
Called to see if a member can be documented by this documenter.
3.365987
3.235948
1.040186
'''taobao.areas.get 查询地址区域 查询标准地址区域代码信息 参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20100623_402652267.htm''' request = TOPRequest('taobao.areas.get') if not fields: area = Area() fields = area.fields request['fields'] = fields self.create(sel...
def get(self, fields=[])
taobao.areas.get 查询地址区域 查询标准地址区域代码信息 参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20100623_402652267.htm
7.801748
2.651473
2.94242
'''taobao.delivery.template.add 新增运费模板 新增运费模板''' request = TOPRequest('taobao.delivery.template.add') request['name'] = name request['assumer'] = assumer request['valuation'] = valuation request['template_types'] = template_types request['template...
def add(self, name, assumer, valuation, template_types, template_dests, template_start_standards, template_start_fees, template_add_standards, template_add_fees, session)
taobao.delivery.template.add 新增运费模板 新增运费模板
2.023926
1.722617
1.174913
'''taobao.delivery.template.delete 删除运费模板 根据用户指定的模板ID删除指定的模板''' request = TOPRequest('taobao.delivery.template.delete') request['template_id'] = template_id self.create(self.execute(request, session), fields=['complete', ]) return self.complete
def delete(self, template_id, session)
taobao.delivery.template.delete 删除运费模板 根据用户指定的模板ID删除指定的模板
9.226458
4.778751
1.930726
'''taobao.delivery.template.get 获取用户指定运费模板信息 获取用户指定运费模板信息''' request = TOPRequest('taobao.delivery.template.get') request['template_ids'] = template_ids if not fields: fields = self.fields request['fields'] = fields self.create(self.execute(re...
def get(self, template_ids, session, fields=[])
taobao.delivery.template.get 获取用户指定运费模板信息 获取用户指定运费模板信息
4.714859
3.28362
1.435872
'''taobao.delivery.template.update 修改运费模板 修改运费模板''' request = TOPRequest('taobao.delivery.template.update') if name!=None: request['name'] = name request['assumer'] = assumer request['template_id'] = template_id request['template_types'] = template_types ...
def update(self, template_id, assumer, template_types, template_dests, template_start_standards, template_start_fees, template_add_standards, template_add_fees, session, name=None)
taobao.delivery.template.update 修改运费模板 修改运费模板
2.324075
1.97173
1.178698
'''taobao.logistics.companies.get 查询物流公司信息 查询淘宝网合作的物流公司信息,用于发货接口。''' request = TOPRequest('taobao.logistics.companies.get') if not fields: lc = LogisticsCompany() fields = lc.fields request['fields'] = fields if is_recommended!=None: reque...
def get(self, session, is_recommended=None, order_mode=None, fields=[])
taobao.logistics.companies.get 查询物流公司信息 查询淘宝网合作的物流公司信息,用于发货接口。
5.341046
3.145849
1.697807
'''taobao.postage.add 添加邮费模板 添加邮费模板 新增的邮费模板属于当前会话用户 postage_mode_types、postage_mode_dests、postage_mode_prices、 postage_mode_increases四个字段组合起来表示邮费的子模板列表。每个邮费子模板都包含了type(邮费类型,有post、 express、ems可以选择)、dest(邮费模板应用地区,每个模板可以使用于多个地区,每个地区填入他的代码,地区与地区之间用半角逗号分隔)、 price(...
def add(self, name, session, **kwargs)
taobao.postage.add 添加邮费模板 添加邮费模板 新增的邮费模板属于当前会话用户 postage_mode_types、postage_mode_dests、postage_mode_prices、 postage_mode_increases四个字段组合起来表示邮费的子模板列表。每个邮费子模板都包含了type(邮费类型,有post、 express、ems可以选择)、dest(邮费模板应用地区,每个模板可以使用于多个地区,每个地区填入他的代码,地区与地区之间用半角逗号分隔)、 price(邮费基价)、incre...
7.694958
1.619509
4.751415
'''taobao.postage.delete 删除单个运费模板 删除单个邮费模板 postage_id对应的邮费模板要属于当前会话用户''' request = TOPRequest('taobao.postage.delete') request['postage_id'] = postage_id self.create(self.execute(request, session)['postage']) return self
def delete(self, postage_id, session)
taobao.postage.delete 删除单个运费模板 删除单个邮费模板 postage_id对应的邮费模板要属于当前会话用户
6.597157
2.665464
2.47505
'''taobao.postages.get 获取卖家的运费模板 获得当前会话用户的所有邮费模板''' request = TOPRequest('taobao.postages.get') if not fields: postage = Postage() fields = postage.fields request['fields'] = fields self.create(self.execute(request, session)) retur...
def get(self, session, fields=[])
taobao.postages.get 获取卖家的运费模板 获得当前会话用户的所有邮费模板
8.478373
3.702923
2.289643
'''taobao.logistics.partners.get 查询支持起始地到目的地范围的物流公司 查询物流公司信息(可以查询目的地可不可达情况)''' request = TOPRequest('taobao.logistics.partners.get') request['service_type'] = service_type if source_id!=None: request['source_id'] = source_id if target_id!=None: request['target_id...
def get(self, service_type, source_id=None, target_id=None, goods_value=None)
taobao.logistics.partners.get 查询支持起始地到目的地范围的物流公司 查询物流公司信息(可以查询目的地可不可达情况)
4.68823
2.162782
2.167685
'''taobao.logistics.address.modify 卖家地址库修改 卖家地址库修改''' request = TOPRequest('taobao.logistics.address.modify') request['contact_id'] = contact_id request['contact_name'] = contact_name request['province'] = province request['city'] = city request['...
def modify(self, contact_id, contact_name, province, city, addr, session, **kwargs)
taobao.logistics.address.modify 卖家地址库修改 卖家地址库修改
4.079478
3.388341
1.203975
'''taobao.logistics.address.remove 删除卖家地址库 用此接口删除卖家地址库''' request = TOPRequest('taobao.logistics.address.remove') request['contact_id'] = contact_id self.create(self.execute(request, session)) return self.address_result
def remove(self, contact_id, session)
taobao.logistics.address.remove 删除卖家地址库 用此接口删除卖家地址库
8.228744
3.842421
2.141552
'''taobao.logistics.address.search 查询卖家地址库 通过此接口查询卖家地址库,''' request = TOPRequest('taobao.logistics.address.search') if rdef!=None: request['rdef'] = rdef self.create(self.execute(request, session), fields=['addresses', ], models={'addresses':AddressResult}) retur...
def search(self, session, rdef=None)
taobao.logistics.address.search 查询卖家地址库 通过此接口查询卖家地址库,
9.937014
5.540528
1.793514
'''taobao.logistics.dummy.send 无需物流(虚拟)发货处理 用户调用该接口可实现无需物流(虚拟)发货,使用该接口发货,交易订单状态会直接变成卖家已发货''' request = TOPRequest('taobao.logistics.dummy.send') request['tid'] = tid if feature!=None: request['feature'] = feature self.create(self.execute(request, session)) ...
def send(self, tid, session, feature=None)
taobao.logistics.dummy.send 无需物流(虚拟)发货处理 用户调用该接口可实现无需物流(虚拟)发货,使用该接口发货,交易订单状态会直接变成卖家已发货
10.789691
2.810925
3.838484
'''taobao.logistics.offline.send 自己联系物流(线下物流)发货 用户调用该接口可实现自己联系发货(线下物流),使用该接口发货,交易订单状态会直接变成卖家已发货。不支持货到付款、在线下单类型的订单。''' request = TOPRequest('taobao.logistics.offline.send') request['tid'] = tid request['out_sid'] = out_sid request['company_code'] = company_code ...
def send(self, tid, out_sid, company_code, session, sender_id=None, cancel_id=None, feature=None)
taobao.logistics.offline.send 自己联系物流(线下物流)发货 用户调用该接口可实现自己联系发货(线下物流),使用该接口发货,交易订单状态会直接变成卖家已发货。不支持货到付款、在线下单类型的订单。
5.040151
2.022815
2.491652
'''taobao.logistics.online.cancel 取消物流订单接口 调此接口取消发货的订单,重新选择物流公司发货。前提是物流公司未揽收货物。对未发货和已经被物流公司揽收的物流订单,是不能取消的。''' request = TOPRequest('taobao.logistics.online.cancel') request['tid'] = tid self.create(self.execute(request, session), fields = ['is_success','modify_time','rec...
def cancel(self, tid, session)
taobao.logistics.online.cancel 取消物流订单接口 调此接口取消发货的订单,重新选择物流公司发货。前提是物流公司未揽收货物。对未发货和已经被物流公司揽收的物流订单,是不能取消的。
10.113916
3.347298
3.021517
'''taobao.logistics.online.confirm 确认发货通知接口 确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外''' request = TOPRequest('taobao.logistics.online.confirm') request['tid'] = tid request['out_sid'] = out_sid self.create(self.execute(request...
def confirm(self, tid, out_sid, session)
taobao.logistics.online.confirm 确认发货通知接口 确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外
10.941366
2.559503
4.274802
'''taobao.logistics.online.send 在线订单发货处理(支持货到付款) - 用户调用该接口可实现在线订单发货(支持货到付款) - 调用该接口实现在线下单发货,有两种情况: - 如果不输入运单号的情况:交易状态不会改变,需要调用taobao.logistics.online.confirm确认发货后交易状态才会变成卖家已发货。 - 如果输入运单号的情况发货:交易订单状态会直接变成卖家已发货 。''' request = TOPRequest('taobao.logistics.online.se...
def send(self, tid, company_code, session, **kwargs)
taobao.logistics.online.send 在线订单发货处理(支持货到付款) - 用户调用该接口可实现在线订单发货(支持货到付款) - 调用该接口实现在线下单发货,有两种情况: - 如果不输入运单号的情况:交易状态不会改变,需要调用taobao.logistics.online.confirm确认发货后交易状态才会变成卖家已发货。 - 如果输入运单号的情况发货:交易订单状态会直接变成卖家已发货 。
7.436626
2.563084
2.901437
'''taobao.logistics.orders.detail.get 批量查询物流订单,返回详细信息 查询物流订单的详细信息,涉及用户隐私字段。(注:该API主要是提供给卖家查询物流订单使用,买家查询物流订单,建议使用taobao.logistics.trace.search)''' request = TOPRequest('taobao.logistics.orders.detail.get') if not fields: shipping = Shipping() fields = ship...
def detail_get(self, session, fields=[], **kwargs)
taobao.logistics.orders.detail.get 批量查询物流订单,返回详细信息 查询物流订单的详细信息,涉及用户隐私字段。(注:该API主要是提供给卖家查询物流订单使用,买家查询物流订单,建议使用taobao.logistics.trace.search)
6.613914
3.379429
1.95711
'''taobao.logistics.trace.search 物流流转信息查询 用户根据淘宝交易号查询物流流转信息,如2010-8-10 15:23:00到达杭州集散地''' request = TOPRequest('taobao.logistics.address.add') request['tid'] = tid request['seller_nick'] = seller_nick self.create(self.execute(request)) return self
def search(self, tid, seller_nick)
taobao.logistics.trace.search 物流流转信息查询 用户根据淘宝交易号查询物流流转信息,如2010-8-10 15:23:00到达杭州集散地
9.148211
2.634737
3.472153
'''taobao.topats.delivery.send 异步批量物流发货api 使用指南:http://open.taobao.com/dev/index.php/ATS%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97 - 1.提供异步批量物流发货功能 - 2.一次最多发货40个订单 - 3.提交任务会进行初步任务校验,如果成功会返回任务号和创建时间,如果失败就报错 - 4.可以接收淘宝发出的任务完成消息,也可以过一段时间来取结果。获取结果接口为taobao.top...
def send(self, tids, session, **kwargs)
taobao.topats.delivery.send 异步批量物流发货api 使用指南:http://open.taobao.com/dev/index.php/ATS%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97 - 1.提供异步批量物流发货功能 - 2.一次最多发货40个订单 - 3.提交任务会进行初步任务校验,如果成功会返回任务号和创建时间,如果失败就报错 - 4.可以接收淘宝发出的任务完成消息,也可以过一段时间来取结果。获取结果接口为taobao.topats.result....
9.015419
2.084675
4.324616
registry_records = api.get_registry_records_by_keyword(key) # Prepare batch size = req.get_batch_size() start = req.get_batch_start() batch = api.make_batch(registry_records, size, start) return { "pagesize": batch.get_pagesize(), "next": batch.make_next_url(), "pr...
def get(context, request, key=None)
Return all registry items if key is None, otherwise try to fetch the registry key
5.261096
5.151904
1.021195
if default_kwarg is None: return local_kwarg if isinstance(local_kwarg, basestring): return local_kwarg if local_kwarg is None: return default_kwarg # Bypass if not a dictionary (e.g. timeout) if not hasattr(default_kwarg, 'items'): return local_kwarg # ...
def merge_kwargs(local_kwarg, default_kwarg)
Merges kwarg dictionaries. If a local key in the dictionary is set to None, it will be removed.
2.622823
2.546376
1.030022
method = str(method).upper() # Default empty dicts for dict params. cookies = {} if cookies is None else cookies data = {} if data is None else data files = {} if files is None else files headers = {} if headers is None else headers params = {} if para...
def request(self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=False, proxies=None, hooks=None, return_response=True, config=None, prefetch=Fal...
Constructs and sends a :class:`Request <Request>`. Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string fo...
3.23212
3.449533
0.936973
kwargs.setdefault('allow_redirects', True) return self.request('head', url, **kwargs)
def head(self, url, **kwargs)
Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param **kwargs: Optional arguments that ``request`` takes.
4.305357
4.247368
1.013653