text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def generate_visualizations(methods, data, true_labels, base_dir = 'visualizations',
figsize=(18,10), **scatter_options):
"""
Generates visualization scatters for all the methods.
Args:
methods: follows same format as run_experiments. List of tuples.
data: genes x cells
true... | 0.004995 |
def get_redirect_url(self, request, callback, parameters=None):
"""Build authentication redirect url."""
args = self.get_redirect_args(request, callback=callback)
additional = parameters or {}
args.update(additional)
params = urlencode(args)
return '{0}?{1}'.format(self.a... | 0.005797 |
def storage(self, provider='osfstorage'):
"""Return storage `provider`."""
stores = self._json(self._get(self._storages_url), 200)
stores = stores['data']
for store in stores:
provides = self._get_attribute(store, 'attributes', 'provider')
if provides == provider:... | 0.004107 |
def correct_pairs(p, pf, tag):
"""
Take one pair of reads and correct to generate *.corr.fastq.
"""
from jcvi.assembly.preprocess import correct as cr
logging.debug("Work on {0} ({1})".format(pf, ','.join(p)))
itag = tag[0]
cm = ".".join((pf, itag))
targets = (cm + ".1.corr.fastq", cm +... | 0.003272 |
def folderitem(self, obj, item, index):
"""Service triggered each time an item is iterated in folderitems.
The use of this service prevents the extra-loops in child objects.
:obj: the instance of the class to be foldered
:item: dict containing the properties of the object to be used by... | 0.00075 |
def write(self, msg, level=logging.INFO):
""" method implements stream write interface, allowing to redirect stdout to logger """
if msg is not None and len(msg.strip()) > 0:
self.logger.log(level, msg) | 0.013043 |
def last_modified(self, name: str = None) -> str:
"""
Return a compact ISO8601 timestamp (UTC timezone) indicating when an attribute was last modified
Note: if no attribute name is given (the default), the modification time of the most recently modified attribute will be returned
Note: if the attributes do not... | 0.023589 |
def p_select_from_where_statement_1(self, p):
'''
statement : SELECT ANY variable_name FROM INSTANCES OF identifier WHERE expression
| SELECT MANY variable_name FROM INSTANCES OF identifier WHERE expression
'''
p[0] = SelectFromWhereNode(cardinality=p[2],
... | 0.008584 |
def dataReceived(self, data):
"""Received some data from the local side.
If we have set up the multiplexed connection, sends the data
over the multiplexed connection. Otherwise, buffers.
"""
log.msg("{} bytes of data received locally".format(len(data)))
if self.connecti... | 0.003546 |
def add_edge_configuration(self, param_name, edge, param_value):
"""
Set a parameter for a given edge
:param param_name: parameter identifier (as specified by the chosen model)
:param edge: edge identifier
:param param_value: parameter value
"""
if param_name not... | 0.00611 |
def update(self, other):
"""
Update internal dictionary object. This is meant to be an
analog for dict.update().
"""
if self.meta_type == 'list':
raise AssertionError('Cannot update object of `list` base type!')
elif self.meta_type == 'dict':
self.... | 0.005319 |
def display(self):
"""Displays the symbol table content"""
#Finding the maximum length for each column
sym_name = "Symbol name"
sym_len = max(max(len(i.name) for i in self.table),len(sym_name))
kind_name = "Kind"
kind_len = max(max(len(SharedData.KINDS[i.kind]) for ... | 0.010753 |
def streaming(self, remotefile, localpipe, fmt = 'M3U8_480_360', chunk = 4 * const.OneM):
''' Usage: stream <remotefile> <localpipe> [format] [chunk] - \
stream a video / audio file converted to M3U format at cloud side, to a pipe.
remotefile - remote file at Baidu Yun (after app root directory at Baidu Yun)
loca... | 0.025478 |
def _list_tenants(self, admin):
"""
Returns either a list of all tenants (admin=True), or the tenant for
the currently-authenticated user (admin=False).
"""
resp, resp_body = self.method_get("tenants", admin=admin)
if 200 <= resp.status_code < 300:
tenants = r... | 0.004601 |
def get_url_and_revision_from_pip_url(cls, pip_url):
"""
Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
That's required because although they use SSH they sometimes doesn't
work with a ssh:// scheme (e.g. Github). But we need a scheme for
parsing. Hence we r... | 0.003497 |
def _unichr(i):
"""
Helper function for taking a Unicode scalar value and returning a Unicode character.
:param s: Unicode scalar value to convert.
:return: Unicode character
"""
if not isinstance(i, int):
raise TypeError
try:
return six.unichr(i)
except ValueError:
... | 0.006397 |
def add_patches(self, patches, after=None):
""" Add a list of patches to the patches list """
if after is None:
self.insert_patches(patches)
else:
self._check_patch(after)
patchlines = self._patchlines_before(after)
patchlines.append(self.patch2lin... | 0.003215 |
def __postCallAction_hwbp(self, event):
"""
Handles hardware breakpoint events on return from the function.
@type event: L{ExceptionEvent}
@param event: Single step event.
"""
# Remove the one shot hardware breakpoint
# at the return address location in the sta... | 0.004666 |
def connect_resource(self):
"""
Connect to an AWS API via boto3 high-level resource connection and set
``self.resource_conn`` to the `boto3.resource <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.resource>`_ object
(a ``boto3.resources.factory.*.Service... | 0.002389 |
def rws_call(ctx, method, default_attr=None):
"""Make request to RWS"""
try:
response = ctx.obj['RWS'].send_request(method)
if ctx.obj['RAW']: # use response from RWS
result = ctx.obj['RWS'].last_result.text
elif default_attr is not None: # human-readable summary
... | 0.001337 |
def _eval_num(self, node):
"""
Evaluate a numerical node
:param node: Node to eval
:return: Result of node
"""
if self.floats:
return node.n
else:
return int(node.n) | 0.00813 |
def get_juttle_data_url(deployment_name,
token_manager=None,
app_url=defaults.APP_URL):
"""
return the juttle data url
"""
return get_data_url(deployment_name,
endpoint_type='juttle',
app_url=app_url,
... | 0.002732 |
def warn_or_error(removal_version, deprecated_entity_description, hint=None,
deprecation_start_version=None,
stacklevel=3, frame_info=None, context=1, ensure_stderr=False):
"""Check the removal_version against the current pants version.
Issues a warning if the removal version is... | 0.011951 |
def _process_api_events(self, function, api_events, template, condition=None):
"""
Actually process given API events. Iteratively adds the APIs to Swagger JSON in the respective Serverless::Api
resource from the template
:param SamResource function: SAM Function containing the API event... | 0.005319 |
def translate_to_american_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phonem... | 0.007481 |
def limit(self, count):
"""Limit a query to return a fixed number of results.
If the current query already has a limit set, this will overwrite it.
Args:
count (int): Maximum number of documents to return that match
the query.
Returns:
~.firesto... | 0.002516 |
def find(self, sought, view='lemma'):
'''
Returns a word instance for the hit if the "sought" word is found in the sentence.
Per default the "lemma" view of the words is compared.
You can specify the desired view with the optional "view" option.
'''
for word in self.wordl... | 0.007614 |
def validate_url(url):
"""Validate URL is valid
NOTE: only support http & https
"""
schemes = ['http', 'https']
netloc_re = re.compile(
r'^'
r'(?:\S+(?::\S*)?@)?' # user:pass auth
r'(?:[a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])'
r'(?:\.(?:[a-z0-9]|[a-z0-9][a-z0-9\-]... | 0.001401 |
def imshow(image, backend=IMSHOW_BACKEND_DEFAULT):
"""
Shows an image in a window.
dtype support::
* ``uint8``: yes; not tested
* ``uint16``: ?
* ``uint32``: ?
* ``uint64``: ?
* ``int8``: ?
* ``int16``: ?
* ``int32``: ?
* ``int64``: ?
... | 0.003356 |
def from_dict(cls, data, key_extractors=None, content_type=None):
"""Parse a dict using given key extractor return a model.
By default consider key
extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor
and last_rest_key_case_insensitive_extractor)
... | 0.003125 |
def update_headers(self, header_args):
'''
Given a set of headers, update both the user-agent
and additional headers for the remote browser.
header_args must be a dict. Keys are the names of
the corresponding HTTP header.
return value is a 2-tuple of the results of the user-agent
update, as well as the ... | 0.030573 |
def _divf16(ins):
""" Divides 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack.
Optimizations:
* If 2nd operand is 1, do nothing
* If 2nd operand is -1, do NEG32
"""
op1, op2 = tuple(ins.quad[2:])
if is_float(op2):
if float(op2) == 1:
... | 0.002625 |
def cmd(send, msg, args):
"""Insults a user.
Syntax: {command} [nick]
"""
if not msg:
user = choice(get_users(args))
else:
user = msg
send(gen_insult(user)) | 0.005025 |
def blocks_from_ops(ops):
"""
Group a list of :class:`Op` and :class:`Label` instances by label.
Everytime a label is found, a new :class:`Block` is created. The resulting
blocks are returned as a dictionary to easily access the target block of a
jump operation. The keys of this dictionary will be ... | 0.000982 |
def get_subscription(self, topic_name, subscription_name):
'''
Gets an existing subscription.
topic_name:
Name of the topic.
subscription_name:
Name of the subscription.
'''
_validate_not_none('topic_name', topic_name)
_validate_not_none('... | 0.003429 |
def get_accessibles(request, roles=None):
"""
Returns the list of *dictionnaries* for which the accounts are
accessibles by ``request.user`` filtered by ``roles`` if present.
"""
results = []
for role_name, organizations in six.iteritems(request.session.get(
... | 0.004415 |
def get_data_dirs(__pkg: str) -> List[str]:
"""Return all data directories for given package.
Args:
__pkg: Package name
"""
dirs = [user_data(__pkg), ]
dirs.extend(path.expanduser(path.sep.join([d, __pkg]))
for d in getenv('XDG_DATA_DIRS',
'/u... | 0.002457 |
def get_body_size(params, boundary):
"""Returns the number of bytes that the multipart/form-data encoding
of ``params`` will be."""
size = sum(p.get_size(boundary) for p in MultipartParam.from_params(params))
return size + len(boundary) + 6 | 0.007813 |
def vstack_tables(filelist, hdus):
"""vstack a set of HDUs from a set of files
Parameters
----------
filelist : list
List of the files to get data from.
hdus : list
Names of the HDU containing the table with the input data.
Returns
-------
out_tables : list
A... | 0.000898 |
def env_maker(environment_id):
""" Create a relatively raw atari environment """
env = gym.make(environment_id)
assert 'NoFrameskip' in env.spec.id
# Wait for between 1 and 30 rounds doing nothing on start
env = NoopResetEnv(env, noop_max=30)
# Do the same action for k steps. Return max of las... | 0.004926 |
def update_range(self, share_name, directory_name, file_name, data,
start_range, end_range, validate_content=False, timeout=None):
'''
Writes the bytes specified by the request body into the specified range.
:param str share_name:
Name of existing share... | 0.005892 |
def increase_crypto_config(self, crypto_adapters,
crypto_domain_configurations):
"""
Add crypto adapters and/or crypto domains to the crypto configuration
of this partition.
The general principle for maintaining crypto configurations of
partitions ... | 0.000935 |
def _get_stream_id(self, text):
"""Try to find a stream_id"""
m = self._image_re.search(text)
if m:
return m.group("stream_id") | 0.01227 |
def prt_txt_desc2nts(self, prt, desc2nts, prtfmt):
"""Print grouped and sorted GO IDs."""
# 1-D: data to print is a flat list of namedtuples
if 'flat' in desc2nts:
nts = desc2nts.get('flat')
# sys.stdout.write("FLAT NTS: {FLDS}\n".format(FLDS=" ".join(next(iter(nts))._fie... | 0.009128 |
def create_endpoint(port=None, service_name=None, host=None, use_defaults=True):
"""Creates a new Endpoint object.
:param port: TCP/UDP port. Defaults to 0.
:type port: int
:param service_name: service name as a str. Defaults to 'unknown'.
:type service_name: str
:param host: ipv4 or ipv6 addre... | 0.001389 |
def load_single_dict(pinyin_dict, style='default'):
"""载入用户自定义的单字拼音库
:param pinyin_dict: 单字拼音库。比如: ``{0x963F: u"ā,ē"}``
:param style: pinyin_dict 参数值的拼音库风格. 支持 'default', 'tone2'
:type pinyin_dict: dict
"""
if style == 'tone2':
for k, v in pinyin_dict.items():
v = _replace_t... | 0.002174 |
def get_object_by_uid(uid, default=_marker):
"""Find an object by a given UID
:param uid: The UID of the object to find
:type uid: string
:returns: Found Object or None
"""
# nothing to do here
if not uid:
if default is not _marker:
return default
fail("get_obje... | 0.001412 |
def log(self, *message):
"""
Logs a messate to a defined io stream if available.
"""
if self._logger is None:
return
s = " ".join([str(m) for m in message])
self._logger.write(s+'\n')
self._logger.flush() | 0.007353 |
def checksum_identity_card_number(characters):
"""
Calculates and returns a control digit for given list of characters basing on Identity Card Number standards.
"""
weights_for_check_digit = [7, 3, 1, 0, 7, 3, 1, 7, 3]
check_digit = 0
for i in range(3):
check_digit += weights_for_check_... | 0.004032 |
def writeTnetFile(grph, name, modeNameString, weighted = False, sourceMode = None, timeString = None, nodeIndexString = 'tnet-ID', weightString = 'weight'):
"""Writes an edge list designed for reading by the _R_ package [tnet](https://toreopsahl.com/tnet/).
The _networkx_ graph provided must be a pure two-mode... | 0.008242 |
def Start(self, seed_list: List[str] = None, skip_seeds: bool = False) -> None:
"""
Start connecting to the seed list.
Args:
seed_list: a list of host:port strings if not supplied use list from `protocol.xxx.json`
skip_seeds: skip connecting to seed list
"""
... | 0.003571 |
def play_auth(f):
"""
Injects cookies, into requests call over route
:return: route
"""
def wrapper(*args, **kwargs):
self = args[0]
if 'cookies' in kwargs:
raise AttributeError("don't set cookies explicitly")
if 'auth' in kwargs:
raise AttributeError... | 0.002494 |
def get_ast(token):
"""
Recursively unrolls token attributes into dictionaries (token.children
into lists).
Returns:
a dictionary of token's attributes.
"""
node = {}
# Python 3.6 uses [ordered dicts] [1].
# Put in 'type' entry first to make the final tree format somewhat
# ... | 0.001314 |
def GetEntries(self, parser_mediator, data=None, **unused_kwargs):
"""Extracts uTorrent active torrents.
This is the main parsing engine for the plugin. It determines if
the selected file is the proper file to parse and extracts current
running torrents.
interface.Process() checks for the given BE... | 0.008221 |
def get(self, resource):
"""
Get a resource into the cache,
:param resource: A :class:`Resource` instance.
:return: The pathname of the resource in the cache.
"""
prefix, path = resource.finder.get_cache_info(resource)
if prefix is None:
result = path... | 0.00225 |
def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(resu... | 0.00859 |
def next_frame_ae_range(rhp):
"""Autoencoder world model tuning grid."""
rhp.set_float("dropout", 0.3, 0.5)
rhp.set_int("num_compress_steps", 1, 3)
rhp.set_int("num_hidden_layers", 2, 6)
rhp.set_float("learning_rate_constant", 1., 2.)
rhp.set_float("initializer_gain", 0.8, 1.5)
rhp.set_int("filter_double_... | 0.024024 |
async def authorize(self, code: str=None) -> None:
"""Getting a new token from server"""
code = await self.get_code(code)
params = {
'client_id': self.app_id,
'client_secret': self.app_secret,
'redirect_uri': self.redirect_uri,
'code': code
... | 0.008489 |
def relatedness_wid(wid_pairs, gcube_token=None, lang=DEFAULT_LANG, api=DEFAULT_REL_API):
'''
Get the semantic relatedness among pairs of entities. Entities are indicated by their
Wikipedia ID (an integer).
:param wid_pairs: either one pair or a list of pairs of Wikipedia IDs.
:param gcube_token: th... | 0.007519 |
def get_src_or_dst_path(prompt, count):
"""
Let the user choose a path, and store the value.
:return str _path: Target directory
:return str count: Counter for attempted prompts
"""
_path = ""
print(prompt)
option = input("Option: ")
print("\n")
if option == '1':
# Set th... | 0.002166 |
def strip_accents(string):
"""
Strip all the accents from the string
"""
return u''.join(
(character for character in unicodedata.normalize('NFD', string)
if unicodedata.category(character) != 'Mn')) | 0.00431 |
def _paged_search_ext_s(self, base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0,
serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0, page_size=10):
"""
Behaves similarly to LDAPObject.search_ext_s() but internally uses the
simple paged resu... | 0.00718 |
def read_full(stream):
"""Read the full contents of the given stream into memory.
:return:
A future containing the complete stream contents.
"""
assert stream, "stream is required"
chunks = []
chunk = yield stream.read()
while chunk:
chunks.append(chunk)
chunk = yi... | 0.002597 |
def parse_content_type_header(value):
""" maintype "/" subtype *( ";" parameter )
The maintype and substype are tokens. Theoretically they could
be checked against the official IANA list + x-token, but we
don't do that.
"""
ctype = ContentType()
recover = False
if not value:
ct... | 0.000436 |
def _set_temp(self, v, load=False):
"""
Setter method for temp, mapped from YANG variable /system_monitor/temp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_temp is considered as a private
method. Backends looking to populate this variable should
do... | 0.005981 |
def build_highlight_objects(html, highlights, uniformize_html=True):
'''converts a dict of pretty_name --> [tuple(string, score), ...] to
`Highlight` objects as specified above.
'''
if uniformize_html:
try:
html = uniform_html(html.encode('utf-8')).decode('utf-8')
except Exc... | 0.000873 |
def get_label(self):
"""Get the label of the Dataset.
Returns
-------
label : numpy array or None
The label information from the Dataset.
"""
if self.label is None:
self.label = self.get_field('label')
return self.label | 0.006667 |
def stats(self, request):
'''Get stats for the provided request.
:param request dict: A search request that also contains the 'interval'
property.
:returns: :py:class:`planet.api.models.JSON`
:raises planet.api.exceptions.APIException: On API error.
... | 0.003226 |
def ConvCnstrMODOptionsDefaults(method='fista'):
"""Get defaults dict for the ConvCnstrMOD class specified by the
``method`` parameter.
"""
dflt = copy.deepcopy(ccmod_class_label_lookup(method).Options.defaults)
if method == 'fista':
dflt.update({'MaxMainIter': 1, 'BackTrack':
... | 0.001681 |
def calc_allowedremoterelieve_v1(self):
"""Get the allowed remote relieve of the last simulation step.
Required log sequence:
|LoggedAllowedRemoteRelieve|
Calculated flux sequence:
|AllowedRemoteRelieve|
Basic equation:
:math:`AllowedRemoteRelieve = LoggedAllowedRemoteRelieve`
... | 0.00137 |
def undefine(self):
"""Undefine the Global.
Python equivalent of the CLIPS undefglobal command.
The object becomes unusable after this method has been called.
"""
if lib.EnvUndefglobal(self._env, self._glb) != 1:
raise CLIPSError(self._env)
self._env = Non... | 0.006231 |
def _algo_check_for_section_problems(self, ro_rw_zi):
"""! @brief Return a string describing any errors with the layout or None if good"""
s_ro, s_rw, s_zi = ro_rw_zi
if s_ro is None:
return "RO section is missing"
if s_rw is None:
return "RW section is missing"
... | 0.004202 |
def GET(self, mid=None):
'''
A convenience URL for getting lists of minions or getting minion
details
.. http:get:: /minions/(mid)
:reqheader X-Auth-Token: |req_token|
:reqheader Accept: |req_accept|
:status 200: |200|
:status 401: |401|... | 0.001768 |
def load_stream(self, key, binary=False):
"""
:param str key: name of stream to load
:param bool binary: Whether we should treat it as binary
:return:
"""
with open(os.path.join(self.uri, key), 'rb' if binary else 'r') as f:
yield f | 0.006849 |
def get_translation_functions(package_name: str, names: Tuple[str, ...] = ('gettext',)):
"""finds and installs translation functions for package"""
translation = get_translation_for(package_name)
return [getattr(translation, x) for x in names] | 0.007843 |
def get(self, session, words, time='DAY|WEEK|MONTH|3MONTH', aFilter='PV|CLICK|AVGCPC|COMPETITION', nick=None):
'''taobao.simba.insight.wordsbase.get
===================================
词基础数据查询'''
request = TOPRequest('taobao.simba.insight.wordsbase.get')
request['words'] = words
... | 0.011742 |
def handle(self,
t_input: inference.TranslatorInput,
t_output: inference.TranslatorOutput,
t_walltime: float = 0.):
"""
:param t_input: Translator input.
:param t_output: Translator output.
:param t_walltime: Total wall-clock time for translat... | 0.005843 |
def _from_dict(cls, _dict):
"""Initialize a SyntaxResult object from a json dictionary."""
args = {}
if 'tokens' in _dict:
args['tokens'] = [
TokenResult._from_dict(x) for x in (_dict.get('tokens'))
]
if 'sentences' in _dict:
args['sent... | 0.004435 |
def netlsd(inp, timescales=np.logspace(-2, 2, 250), kernel='heat', eigenvalues='auto', normalization='empty', normalized_laplacian=True):
"""
Computes NetLSD signature from some given input, timescales, and normalization.
Accepts matrices, common Python graph libraries' graphs, or vectors of eigenvalues.
... | 0.005272 |
def _space_examples(self, list_examples, rows, section_value):
""" makes the example text """
examples_with_index = []
for i, _ in list(enumerate(list_examples)):
if len(list_examples[i]) > 1:
examples_with_index.append("[" + str(i + 1) + "] " + list_examples[i][0] +... | 0.00372 |
def inplace_reload(method):
"""
Executes the wrapped function and reloads the object
with data returned from the server.
"""
# noinspection PyProtectedMember
def wrapped(obj, *args, **kwargs):
in_place = True if kwargs.get('inplace') in (True, None) else False
api_object = metho... | 0.001572 |
def enable_one_shot_hardware_breakpoint(self, dwThreadId, address):
"""
Enables the hardware breakpoint at the given address for only one shot.
@see:
L{define_hardware_breakpoint},
L{has_hardware_breakpoint},
L{get_hardware_breakpoint},
L{enable_h... | 0.003659 |
def convertforoutput(self,outputfile):
"""Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Outputfile is a CLAMOutputFile instance."""
super(CharEncodingConverter,self).convertforoutput(outputfile)
return withheaders( flask.make_resp... | 0.028504 |
def call(self, transaction=None, block_identifier='latest'):
"""
Execute a contract function call using the `eth_call` interface.
This method prepares a ``Caller`` object that exposes the contract
functions and public variables as callable Python functions.
Reading a public ``o... | 0.001315 |
def _build_color_variants(cls):
""" Build colorized variants of all frames and return a list of
all frame object names.
"""
# Get the basic frame types first.
frametypes = cls.sets(registered=False)
_colornames = [
# 'black', disabled for now, it won't show on my terminal.
'... | 0.001312 |
def assign(self, variables=None, **variables_kwargs):
"""Assign new data variables to a Dataset, returning a new object
with all the original variables in addition to the new ones.
Parameters
----------
variables : mapping, value pairs
Mapping from variables names to... | 0.001239 |
def _add_page(self, text):
""" Helper function for PDFText, to have the document
add a page, and retry adding a large block of
text that would otherwise have been to long for the
page.
"""
save_cursor = self.parent.document.page.cursor.copy()
... | 0.003906 |
async def async_fetch(url: str, **kwargs) -> Selector:
"""
Do the fetch in an async style.
Args:
url (str): The url of the site.
Returns:
Selector: allows you to select parts of HTML text using CSS or XPath expressions.
"""
kwargs.setdefault('headers', DEFAULT_HEADERS)
asyn... | 0.003883 |
def _get_facvar(self, polynomial):
"""Return dense vector representation of a polynomial. This function is
nearly identical to __push_facvar_sparse, but instead of pushing
sparse entries to the constraint matrices, it returns a dense
vector.
"""
facvar = [0] * (self.n_var... | 0.002296 |
def has_option(self, target):
"""
Return ``True`` if the actual arguments include
the specified ``target`` option or,
if ``target`` is a list of options,
at least one of them.
:param target: the option or a list of options
:type target: Unicode string or list of... | 0.003571 |
def run_all(logdir, verbose=False):
"""Perform random search over the hyperparameter space.
Arguments:
logdir: The top-level directory into which to write data. This
directory should be empty or nonexistent.
verbose: If true, print out each run's name as it begins.
"""
data = prepare_data()
rng... | 0.00969 |
def item_show(item, item_id=None, item_type=None, show='show', extra_args=None, cibfile=None):
'''
Show an item via pcs command
(mainly for use with the pcs state module)
item
config, property, resource, constraint etc.
item_id
id of the item
item_type
item type
show... | 0.002843 |
def _pick_statement(self, block_address, stmt_idx):
"""
Include a statement in the final slice.
:param int block_address: Address of the basic block.
:param int stmt_idx: Statement ID.
"""
# TODO: Support context-sensitivity
# Sanity check
if n... | 0.00638 |
def capfirst(x):
'''Capitalise the first letter of ``x``.
'''
x = to_string(x).strip()
if x:
return x[0].upper() + x[1:].lower()
else:
return x | 0.005587 |
def _update_external_tool(self, context, context_id, external_tool_id,
json_data):
"""
Update the external tool identified by external_tool_id with the passed
json data.
context is either COURSES_API or ACCOUNTS_API.
context_id is the course_id or a... | 0.004862 |
def main(self, signature=''):
"""
A decorator that is used to register the main function with the given
`signature`::
@app.main()
def main(context):
# do something
pass
The main function is called, after any options and if no comm... | 0.002141 |
def setup_injection_workflow(workflow, output_dir=None,
inj_section_name='injections', exttrig_file=None,
tags =None):
"""
This function is the gateway for setting up injection-generation jobs in a
workflow. It should be possible for this function to... | 0.001509 |
def _str_desc(self, reader):
"""String containing information about the current GO DAG."""
data_version = reader.data_version
if data_version is not None:
data_version = data_version.replace("releases/", "")
desc = "{OBO}: fmt({FMT}) rel({REL}) {N:,} GO Terms".format(
... | 0.005245 |
def instant_articles(self, **kwargs):
"""
QuerySet including all published content approved for instant articles.
Instant articles are configured via FeatureType. FeatureType.instant_article = True.
"""
eqs = self.search(**kwargs).sort('-last_modified', '-published')
ret... | 0.008523 |
def theme_color(self):
"""
A member of :ref:`MsoThemeColorIndex` or |None| if no theme color is
specified. When :attr:`type` is `MSO_COLOR_TYPE.THEME`, the value of
this property will always be a member of :ref:`MsoThemeColorIndex`.
When :attr:`type` has any other value, the valu... | 0.002389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.