_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q50600 | existing_config_files | train | def existing_config_files():
"""
Method that calculates all the configuration files that are valid, according to the
'set_paths' and other methods for this module.
"""
global _ETC_PATHS
global _MAIN_CONFIG_FILE
global _CONFIG_VAR_INCLUDE
global _CONFIG_FILTER
config_files = ... | python | {
"resource": ""
} |
q50601 | deploy_templates | train | def deploy_templates():
"""
Deploy any templates from your shortest TEMPLATE_DIRS setting
"""
deployed = None
if not hasattr(env, 'project_template_dir'):
#the normal pattern would mean the shortest path is the main one.
#its probably the last listed
length = 1000
... | python | {
"resource": ""
} |
q50602 | deploy_media | train | def deploy_media():
"""
Deploy MEDIA_ROOT unversioned on host
"""
if not env.MEDIA_URL or not env.MEDIA_ROOT or 'http://' in env.MEDIA_URL: return
local_dir = env.MEDIA_ROOT
remote_dir = '/'.join([deployment_root(),'public'])
media_url = env.MEDIA_URL[1:]
if media_url:
remo... | python | {
"resource": ""
} |
q50603 | deploy_db | train | def deploy_db(rollback=False):
"""
Deploy a sqlite database from development
"""
if not rollback:
if env.DEFAULT_DATABASE_ENGINE=='django.db.backends.sqlite3':
db_dir = '/'.join([deployment_root(),'database'])
db_name = ''.join([env.project_name,'_','site_1','.db'])
... | python | {
"resource": ""
} |
q50604 | AccessTokenAuthenticator.validate | train | def validate(self, request):
""" Checks a request for proper authentication details.
Returns a tuple of ``(access_token, error_response_arguments)``, which are
designed to be passed to the :py:meth:`make_error_response` method.
For example, to restrict access to a given endpoint:
.. code-block:: ... | python | {
"resource": ""
} |
q50605 | AccessTokenAuthenticator.make_error_response | train | def make_error_response(self, validation_error, expose_errors):
""" Return an appropriate ``HttpResponse`` on authentication failure.
In case of an error, the specification only details the inclusion of the
``WWW-Authenticate`` header. Additionally, when allowed by the
specification, we respond with er... | python | {
"resource": ""
} |
q50606 | rts_smooth | train | def rts_smooth(kalman_filter, state_count=None):
"""
Compute the Rauch-Tung-Striebel smoothed state estimates and estimate
covariances for a Kalman filter.
Args:
kalman_filter (KalmanFilter): Filter whose smoothed states should be
returned
state_count (int or None): Number o... | python | {
"resource": ""
} |
q50607 | get_environment | train | def get_environment(default=DEVELOPMENT, detectors=None, detectors_opts=None, use_envfiles=True):
"""Returns current environment type object.
:param str|Environment|None default: Default environment type or alias.
:param list[Detector] detectors: List of environment detectors to be used in chain.
... | python | {
"resource": ""
} |
q50608 | import_name | train | def import_name(modulename, name=None):
""" Import identifier ``name`` from module ``modulename``.
If ``name`` is omitted, ``modulename`` must contain the name after the
module path, delimited by a colon.
Parameters:
modulename (str): Fully qualified module name, e.g. ``x.y.z``... | python | {
"resource": ""
} |
q50609 | load_module | train | def load_module(modulename, modulepath):
""" Load a Python module from a path under a specified name.
Parameters:
modulename (str): Fully qualified module name, e.g. ``x.y.z``.
modulepath (str): Filename of the module.
Returns:
Loaded module.
"""
if '.' ... | python | {
"resource": ""
} |
q50610 | init | train | def init():
""" Initialize the lib
Function-design use is to be able to test language settings changes
"""
if settings.USE_L10N:
locale = settings.LANGUAGE_CODE.replace('-', '_')
try:
humanize.i18n.activate(locale)
except FileNotFoundError:
pass # Just ... | python | {
"resource": ""
} |
q50611 | BaseRunner.kill_pid | train | def kill_pid(self, pid):
"""Kill process by pid
Args:
pid (int)
"""
try:
p = psutil.Process(pid)
p.terminate()
self.info_log('Killed [pid:%s][name:%s]' % (p.pid, p.name()))
except psutil.NoSuchProcess:
self.error_log... | python | {
"resource": ""
} |
q50612 | BaseRunner.kill | train | def kill(self, procname):
"""Kill by process name
Args:
procname (str)
"""
for proc in psutil.process_iter():
if proc.name() == procname:
self.info_log(
'[pid:%s][name:%s] killed' %
(proc.pid, proc.name())
... | python | {
"resource": ""
} |
q50613 | BaseRunner.configure_logger | train | def configure_logger(self):
"""Configure the test batch runner logger
"""
logger_name = 'brome_runner'
self.logger = logging.getLogger(logger_name)
format_ = BROME_CONFIG['logger_runner']['format']
# Stream logger
if BROME_CONFIG['logger_runner']['streamlogger... | python | {
"resource": ""
} |
q50614 | smartAppend | train | def smartAppend(table,name,value):
"""
helper function for apppending in a dictionary
"""
if name not in list(table.keys()):
table[name] = []
table[name].append(value) | python | {
"resource": ""
} |
q50615 | dumpDictHdf5 | train | def dumpDictHdf5(RV,o):
""" Dump a dictionary where each page is a list or an array """
for key in list(RV.keys()):
o.create_dataset(name=key,data=SP.array(RV[key]),chunks=True,compression='gzip') | python | {
"resource": ""
} |
q50616 | load | train | def load(filename: str, format: str = None):
"""Load a task file and get a ``Project`` back."""
path = Path(filename).resolve()
with path.open() as file:
data = file.read()
if format is None:
loader, error_class = _load_autodetect, InvalidMofileFormat
else:
try:
... | python | {
"resource": ""
} |
q50617 | year_origin_filter | train | def year_origin_filter(year_predicate=None, origin_predicate=None):
"""\
Returns a predicate for cable identifiers where `year_predicate` and
`origin_predicate` must hold true.
If `year_predicate` and `origin_predicate` is ``None`` the returned
predicate holds always true.
`year_predicate`
... | python | {
"resource": ""
} |
q50618 | origin_europe | train | def origin_europe(origin):
"""\
Returns if the origin is located in Europe.
This holds true for the following countries:
* Albania
* Armenia
* Austria
* Azerbaijan
* Belarus
* Belgium
* Bulgaria
* Bosnia and Herzegovina
* Bulgaria
... | python | {
"resource": ""
} |
q50619 | origin_north_africa | train | def origin_north_africa(origin):
"""\
Returns if the origin is located in North Africa.
Holds true for the following countries:
* Algeria
* Egypt
* Libya
* Morocco
* Sudan
* Tunisia
`origin`
The origin to check.
"""
return origin_egypt(or... | python | {
"resource": ""
} |
q50620 | origin_west_africa | train | def origin_west_africa(origin):
"""\
Returns if the origin is located in West Africa.
Holds true for the following countries:
* Benin
* Burkin Faso
* Cape Verde
* Côte d'Ivoire
* Gambia
* Ghana
* Guinea
* Liberia
* Mali
* Mauri... | python | {
"resource": ""
} |
q50621 | origin_central_asia | train | def origin_central_asia(origin):
"""\
Returns if the origin is located in Central Asia.
Holds true for the following countries:
* Afghanistan
* Kazakhstan
* Kyrgyzstan
* Tajikistan
* Turkmenistan
* Uzbekistan
`origin`
The origin to check.
"""... | python | {
"resource": ""
} |
q50622 | origin_east_asia | train | def origin_east_asia(origin):
"""\
Returns if the origin is located in East Asia
Holds true for the following countries:
* China
* Japan
* Mongolia
* South Korea
* Taiwan
`origin`
The origin to check.
"""
return origin_china(origin) or origin_jap... | python | {
"resource": ""
} |
q50623 | origin_west_asia | train | def origin_west_asia(origin):
"""\
Returns if the origin is located in Western Asia.
Holds true for the following countries:
* Armenia
* Azerbaijan
* Bahrain
* Cyprus
* Georgia
* Iraq
* Israel
* Jordan
* Kuwait
* Lebanon
... | python | {
"resource": ""
} |
q50624 | origin_canada | train | def origin_canada(origin):
"""\
Returns if the origin is Canada.
`origin`
The origin to check.
"""
return origin in (
u'CALGARY', u'HALIFAX', u'MONTREAL', u'QUEBEC', u'OTTAWA', u'TORONTO',
u'VANCOUVER') | python | {
"resource": ""
} |
q50625 | origin_germany | train | def origin_germany(origin):
"""\
Returns if the origin is Germany.
`origin`
The origin to check.
"""
return origin in (u'BONN', u'BERLIN', u'DUSSELDORF', u'FRANKFURT',
u'HAMBURG', u'LEIPZIG', u'MUNICH') | python | {
"resource": ""
} |
q50626 | origin_iraq | train | def origin_iraq(origin):
"""\
Returns if the origin is Iraq.
`origin`
The origin to check.
"""
return origin == u'BAGHDAD' \
or u'BASRAH' in origin \
or u'HILLAH' in origin \
or u'KIRKUK' in origin \
or u'MOSUL' in origin | python | {
"resource": ""
} |
q50627 | origin_mexico | train | def origin_mexico(origin):
"""\
Returns if the origin is Mexico.
`origin`
The origin to check.
"""
return origin in (u'CIUDADJUAREZ', u'GUADALAJARA', u'HERMOSILLO',
u'MATAMOROS', u'MERIDA', u'MEXICO', u'MONTERREY',
u'NOGALES',
... | python | {
"resource": ""
} |
q50628 | Runner.resolve_variables | train | def resolve_variables(self, task):
"""
Resolve task variables based on input variables and the default
values.
Raises
------
LookupError
If a variable is missing.
"""
variables = {**task.variables, **self.project.variables}
values = ... | python | {
"resource": ""
} |
q50629 | Runner.run_task | train | def run_task(self, name):
"""Run a task."""
if name in self.tasks_run:
yield events.skipping_task(name)
else:
yield events.finding_task(name)
try:
task = self.find_task(name)
except NoSuchTaskError as e:
yield even... | python | {
"resource": ""
} |
q50630 | _qqplot_bar | train | def _qqplot_bar(M=1000000, alphaLevel = 0.05, distr = 'log10'):
"""calculate theoretical expectations for qqplot"""
mRange=10**(sp.arange(sp.log10(0.5),sp.log10(M-0.5)+0.1,0.1));#should be exp or 10**?
numPts=len(mRange);
betaalphaLevel=sp.zeros(numPts);#down in the plot
betaOneMinusalphaLevel=sp.zeros(numPts);#up... | python | {
"resource": ""
} |
q50631 | qqplot | train | def qqplot(pv, distr = 'log10', alphaLevel = 0.05):
"""
This script makes a Quantile-Quantile plot of the observed
negative log P-value distribution against the theoretical one under the null.
Input:
pv pvalues (numpy array)
distr scale of the distribution (log10 or chi2)
alphaLevel signifi... | python | {
"resource": ""
} |
q50632 | ProxyDriver.is_present | train | def is_present(self, selector):
"""Check if an element is present in the dom or not
This method won't check if the element is displayed or not
This method won't wait until the element is visible or present
This method won't raise any exception if the element is not present
Retu... | python | {
"resource": ""
} |
q50633 | ProxyDriver.is_visible | train | def is_visible(self, selector):
"""Check if an element is visible in the dom or not
This method will check if the element is displayed or not
This method might (according
to the config highlight:element_is_visible)
highlight the element if it is visible
This method won... | python | {
"resource": ""
} |
q50634 | ProxyDriver.find | train | def find(self, selector, **kwargs):
"""Find an element with a selector
Args:
selector (str): the selector used to find the element
Kwargs:
wait_until_present (bool)
wait_until_visible (bool)
raise_exception (bool)
Returns:
No... | python | {
"resource": ""
} |
q50635 | ProxyDriver.find_last | train | def find_last(self, selector, **kwargs):
"""Return the last element found with a selector
Args:
selector (str): the selector used to find the element
Kwargs:
wait_until_present (bool)
wait_until_visible (bool)
raise_exception (bool)
Retu... | python | {
"resource": ""
} |
q50636 | ProxyDriver.find_all | train | def find_all(self, selector, **kwargs):
"""Return all the elements found with a selector
Args:
selector (str): the selector used to find the element
Kwargs:
wait_until_present (bool) default configurable via
proxy_driver:wait_until_present_before_find
... | python | {
"resource": ""
} |
q50637 | ProxyDriver.wait_until_clickable | train | def wait_until_clickable(self, selector, **kwargs):
"""Wait until an element is clickable
Args:
selector (str): the selector used to find the element
Kwargs:
timeout (int) second before a timeout exception is raise
raise_exception (bool) raise an exception o... | python | {
"resource": ""
} |
q50638 | ProxyDriver.get | train | def get(self, url):
"""Navigate to a specific url
This specific implementation inject a javascript
script to intercept the javascript error
Configurable with the "proxy_driver:intercept_javascript_error" config
Args:
url (str): the url to navigate to
R... | python | {
"resource": ""
} |
q50639 | ProxyDriver.print_javascript_error | train | def print_javascript_error(self):
"""Print to the info log the gathered javascript error
If no error is found then nothing is printed
"""
errors = self.get_javascript_error(return_type='list')
if errors:
self.info_log("Javascript error:")
for error in er... | python | {
"resource": ""
} |
q50640 | ProxyDriver.get_javascript_error | train | def get_javascript_error(self, return_type='string'):
"""Return the gathered javascript error
Args:
return_type: 'string' | 'list'; default: 'string'
"""
if BROME_CONFIG['proxy_driver']['intercept_javascript_error']:
js_errors = self._driver.execute_script(
... | python | {
"resource": ""
} |
q50641 | ProxyDriver.pdb | train | def pdb(self):
"""Start the python debugger
Calling pdb won't do anything in a multithread context
"""
if self.embed_disabled:
self.warning_log("Pdb is disabled when runned from the grid runner because of the multithreading") # noqa
return False
if BROM... | python | {
"resource": ""
} |
q50642 | ProxyDriver.drag_and_drop | train | def drag_and_drop(self, source_selector, destination_selector, **kwargs):
"""Drag and drop
Args:
source_selector: (str)
destination_selector: (str)
Kwargs:
use_javascript_dnd: bool; default:
config proxy_driver:use_javascript_dnd
"""
... | python | {
"resource": ""
} |
q50643 | ProxyDriver.embed | train | def embed(self, title=''):
"""Start an IPython embed
Calling embed won't do anything in a multithread context
The stack_depth will be found automatically
"""
if self.embed_disabled:
self.warning_log("Embed is disabled when runned from the grid runner because of the ... | python | {
"resource": ""
} |
q50644 | ProxyDriver.take_node_screenshot | train | def take_node_screenshot(self, element, screenshot_path):
from PIL import Image
"""Take a screenshot of a node
Args:
element (object): the proxy_element
screenshot_path (str): the path where the screenshot will be saved
"""
temp_path = os.path.join(tempd... | python | {
"resource": ""
} |
q50645 | ProxyDriver.take_quality_screenshot | train | def take_quality_screenshot(self, screenshot_name):
"""Take a quality screenshot
Use the screenshot_name args when you want to take a
screenshot for reference
Args:
screenshot_name (str) the name of the screenshot
"""
self.info_log("Taking a quality scre... | python | {
"resource": ""
} |
q50646 | ProxyDriver.assert_present | train | def assert_present(self, selector, testid=None, **kwargs):
"""Assert that the element is present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_present (bool)
Returns:
... | python | {
"resource": ""
} |
q50647 | ProxyDriver.assert_not_present | train | def assert_not_present(self, selector, testid=None, **kwargs):
"""Assert that the element is not present in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_present (bool)
... | python | {
"resource": ""
} |
q50648 | ProxyDriver.assert_visible | train | def assert_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is visible in the dom
Args:
selector (str): the selector used to find the element
testid (str): the test_id or a str
Kwargs:
wait_until_visible (bool)
highlight... | python | {
"resource": ""
} |
q50649 | ProxyDriver.assert_not_visible | train | def assert_not_visible(self, selector, testid=None, **kwargs):
"""Assert that the element is not visible in the dom
Args:
selector (str): the selector used to find the element
test_id (str): the test_id or a str
Kwargs:
wait_until_not_visible (bool)
... | python | {
"resource": ""
} |
q50650 | ProxyDriver.assert_text_equal | train | def assert_text_equal(self, selector, value, testid=None, **kwargs):
"""Assert that the element's text is equal to the provided value
Args:
selector (str): the selector used to find the element
value (str): the value that will be compare
with the element.text val... | python | {
"resource": ""
} |
q50651 | BaseCorpus.add_texts | train | def add_texts(self, reference_id, texts):
"""\
Adds the words from the provided iterable `texts` to the corpus.
The strings will be tokenized.
`reference_id`
The reference identifier of the cable.
`texts`
An iterable of strings.
"""
self.... | python | {
"resource": ""
} |
q50652 | BaseCorpus.add_text | train | def add_text(self, reference_id, text):
"""\
Adds the words from the provided text to the corpus.
The string will be tokenized.
`reference_id`
The reference identifier of the cable.
`text`
An string.
"""
self.add_words(reference_id, self.... | python | {
"resource": ""
} |
q50653 | lookup_handles | train | def lookup_handles(ids):
""" Fetch the twitter screen_names of each id. """
names = set()
for id_list in [ids[100 * i:100 * i + 100] for i in range(len(ids))]:
if len(id_list) > 0:
while True:
r = twapi.request('users/lookup', {'user_id': ','.join([str(i) for i in id_list... | python | {
"resource": ""
} |
q50654 | lookup_ids | train | def lookup_ids(handles):
""" Fetch the twitter ids of each screen_name. """
ids = set()
for handle_list in [handles[100 * i:100 * i + 100] for i in range(len(handles))]:
if len(handle_list) > 0:
while True:
r = twapi.request('users/lookup', {'screen_name': ','.join(handle... | python | {
"resource": ""
} |
q50655 | tweets_for_id | train | def tweets_for_id(user_id, limit=1e10):
""" Collect the most recent 3200 tweets for this user_id, sleeping to deal with rate limits."""
# Map id to screen_name
r = twapi.request('users/lookup', {'user_id': user_id})
if r.status_code == 200:
sname = [t for t in r][0]['screen_name']
return... | python | {
"resource": ""
} |
q50656 | tweets_for_user | train | def tweets_for_user(screen_name, limit=1e10):
""" Collect the most recent 3200 tweets for this user, sleeping to deal with rate limits."""
qu = Queue()
p = Thread(target=_tweets_for_user, args=(qu, screen_name, limit))
p.start()
p.join(910)
if p.is_alive():
sys.stderr.write('no results a... | python | {
"resource": ""
} |
q50657 | get_followers | train | def get_followers(id_=None, screen_name=None, limit=1e10):
""" Either id_ or screen_name must not be None. """
# FIXME: DRY from _tweets_for_user
if not (id_ or screen_name):
raise Exception("either id_ or screen_name must not be None")
if id_:
key = 'user_id'
val = id_
else:... | python | {
"resource": ""
} |
q50658 | configure | train | def configure(root_url, **kwargs):
""""
Notice that `configure` can either apply to the default configuration or
`Client.config`, which is the configuration used by the current thread
since `Client` inherits form `threading.local`.
"""
default = kwargs.pop('default', True)
kwargs['client_ag... | python | {
"resource": ""
} |
q50659 | classify_comment | train | def classify_comment(comment, cls=None):
"""
If 'reported' class is provided no training occures, the comment's class
is simply set as such and removed.
If no class is provided a lookup is done to see if the comment has been
reported by users as abusive. If indicated as abusive class is set
as ... | python | {
"resource": ""
} |
q50660 | cap_list | train | def cap_list(caps):
"""Given a cap string, return a list of cap, value."""
out = []
caps = caps.split()
for cap in caps:
# turn modifier chars into named modifiers
mods = []
while len(cap) > 0 and cap[0] in cap_modifiers:
attr = cap[0]
cap = cap[1:]
... | python | {
"resource": ""
} |
q50661 | diff | train | def diff(new, old):
"""
Compute the difference in items of two revisioned collections. If only
`new' is specified, it is assumed it is not an update. If both are set,
the removed items are returned first. Otherwise, the updated and edited
ones are returned.
:param set new: Set of new objects
... | python | {
"resource": ""
} |
q50662 | to_tree | train | def to_tree(instance, *children):
"""
Generate tree structure of an instance, and its children. This method
yields its results, instead of returning them.
"""
# Yield representation of self
yield unicode(instance)
# Iterate trough each instance child collection
for i, child in enumerat... | python | {
"resource": ""
} |
q50663 | invoke_hooks | train | def invoke_hooks(hooks, name, *args, **kwargs):
"""
Invoke one or more hooks that have been registered under `name'. Additional
arguments and keyword arguments can be provided.
There is no exception catching, so if a hook fails, it will disrupt the
chain and/or rest of program.
"""
callbac... | python | {
"resource": ""
} |
q50664 | Logger.findCaller | train | def findCaller(self, stack_info=False, callers=0):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name. Not only ignore this class's
and logger's source, but also as many callers as requested.
"""
f = logging.curr... | python | {
"resource": ""
} |
q50665 | get_file_extension | train | def get_file_extension(filepath):
"""
Copy if anyconfig.utils.get_file_extension is not available.
>>> get_file_extension("/a/b/c")
''
>>> get_file_extension("/a/b.txt")
'txt'
>>> get_file_extension("/a/b/c.tar.xz")
'xz'
"""
_ext = os.path.splitext(filepath)[-1]
if _ext:
... | python | {
"resource": ""
} |
q50666 | SqliteList.extend | train | def extend(self, iterable):
"""
Add each item from iterable to the end of the list
"""
with self.lock:
for item in iterable:
self.append(item) | python | {
"resource": ""
} |
q50667 | fetch_pcr | train | def fetch_pcr(*args, **kwargs):
"""Wrapper for fetch to automatically parse results from the PCR API."""
# Load user's token from `PCR_AUTH_TOKEN`, use public token as default if missing
kwargs['token'] = os.getenv("PCR_AUTH_TOKEN", "public")
return fetch(DOMAIN, *args, **kwargs)['result'] | python | {
"resource": ""
} |
q50668 | reference_id_from_filename | train | def reference_id_from_filename(filename):
"""\
Extracts the reference identifier from the provided filename.
"""
reference_id = os.path.basename(filename)
if reference_id.rfind('.htm') > 0:
reference_id = reference_id[:reference_id.rfind('.')]
#TODO: else: raise ValueError('bla bla')?
... | python | {
"resource": ""
} |
q50669 | reference_id_from_html | train | def reference_id_from_html(html):
"""\
Extracts the cable's reference identifier from the provided HTML string.
`html`
The HTML page of the cable.
"""
m = _REFERENCE_ID_FROM_HTML_PATTERN.search(html)
if m:
return m.group(1)
raise ValueError("Cannot extract the cable's refere... | python | {
"resource": ""
} |
q50670 | get_header_as_text | train | def get_header_as_text(file_content, reference_id):
"""\
Returns the cable's header as text.
`file_content`
The HTML file content, c.f. `get_file_content`.
"""
res = _CONTENT_PATTERN.findall(file_content)
if len(res) == 2:
content = res[0]
elif len(res) == 1:
ret... | python | {
"resource": ""
} |
q50671 | header_body_from_content | train | def header_body_from_content(content):
"""\
Tries to extract the header and the message from the cable content.
The header is something like
UNCLASSIFIED ...
SUBJECT ...
REF ...
while the message begins usually with a summary
1. SUMMARY ...
...
10. ...... | python | {
"resource": ""
} |
q50672 | parse_transmission_id | train | def parse_transmission_id(header, reference_id=None):
"""\
Returns the transmission ID of the cable. If no transmission identifier was
found, ``None`` is returned.
`header`
The cable's header
`reference_id`
The cable's reference ID.
"""
m = _TID_PATTERN.search(header)
if... | python | {
"resource": ""
} |
q50673 | parse_classified_by | train | def parse_classified_by(content, normalize=True):
"""\
Returns the classificationist or ``None`` if the classificationist
cannot be extracted.
`content`
The cable's content.
"""
names = []
m = _CLIST_CONTENT_PATTERN.search(content)
if not m:
return ()
m = _CLSIST_PAT... | python | {
"resource": ""
} |
q50674 | parse_signed_by | train | def parse_signed_by(content, canonicalize=True):
"""\
Returns a maybe empty iterable of signers of the cable.
`content`
The cable's content.
`canonicalize`
Indicates if the signers should be canonicalized (upper-case the
string and remove typos) (enabled by default).
"""
... | python | {
"resource": ""
} |
q50675 | parse_tags | train | def parse_tags(content, reference_id=None, canonicalize=True):
"""\
Returns the TAGS of a cable.
Acc. to the U.S. SD every cable needs at least one tag.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
`canonicalize`
Indicate... | python | {
"resource": ""
} |
q50676 | parse_summary | train | def parse_summary(content, reference_id=None):
"""\
Extracts the summary from the `content` of the cable.
If no summary can be found, ``None`` is returned.
`content`
The content of the cable.
`reference_id`
The reference identifier of the cable.
"""
summary = None
... | python | {
"resource": ""
} |
q50677 | BaruwaAPIClient.api_call | train | def api_call(self, opts, args=None, body=None, **kwargs):
"""Setup the request"""
if args:
path = opts['name'] % args
else:
path = opts['name']
path = '/api/v1%s' % path
return self._request(
opts['method'], path=path, payload=body, **kwargs) | python | {
"resource": ""
} |
q50678 | BaruwaAPIClient.set_user_passwd | train | def set_user_passwd(self, userid, data):
"""Set user password"""
return self.api_call(
ENDPOINTS['users']['password'],
dict(userid=userid),
body=data) | python | {
"resource": ""
} |
q50679 | BaruwaAPIClient.create_alias | train | def create_alias(self, userid, data):
"""Create alias address"""
return self.api_call(
ENDPOINTS['aliases']['new'],
dict(userid=userid),
body=data) | python | {
"resource": ""
} |
q50680 | BaruwaAPIClient.update_alias | train | def update_alias(self, addressid, data):
"""Update alias address"""
return self.api_call(
ENDPOINTS['aliases']['update'],
dict(addressid=addressid),
body=data) | python | {
"resource": ""
} |
q50681 | BaruwaAPIClient.delete_alias | train | def delete_alias(self, addressid, data):
"""Delete alias address"""
return self.api_call(
ENDPOINTS['aliases']['delete'],
dict(addressid=addressid),
body=data) | python | {
"resource": ""
} |
q50682 | BaruwaAPIClient.get_domainaliases | train | def get_domainaliases(self, domainid, page=None):
"""Get Domain aliases"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['domainaliases']['list'],
dict(domainid=domainid), **opts) | python | {
"resource": ""
} |
q50683 | BaruwaAPIClient.get_domainalias | train | def get_domainalias(self, domainid, aliasid):
"""Get a Domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['get'],
dict(domainid=domainid, aliasid=aliasid)) | python | {
"resource": ""
} |
q50684 | BaruwaAPIClient.create_domainalias | train | def create_domainalias(self, domainid, data):
"""Create a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['new'],
dict(domainid=domainid),
body=data) | python | {
"resource": ""
} |
q50685 | BaruwaAPIClient.update_domainalias | train | def update_domainalias(self, domainid, aliasid, data):
"""Update a domain alias"""
return self.api_call(
ENDPOINTS['domainaliases']['update'],
dict(domainid=domainid, aliasid=aliasid),
body=data) | python | {
"resource": ""
} |
q50686 | BaruwaAPIClient.get_deliveryservers | train | def get_deliveryservers(self, domainid, page=None):
"""Get a domains delivery servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['deliveryservers']['list'],
dict(domainid=domainid), **opts) | python | {
"resource": ""
} |
q50687 | BaruwaAPIClient.get_deliveryserver | train | def get_deliveryserver(self, domainid, serverid):
"""Get a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | {
"resource": ""
} |
q50688 | BaruwaAPIClient.create_deliveryserver | train | def create_deliveryserver(self, domainid, data):
"""Create a delivery server"""
return self.api_call(
ENDPOINTS['deliveryservers']['new'],
dict(domainid=domainid),
body=data) | python | {
"resource": ""
} |
q50689 | BaruwaAPIClient.get_user_deliveryserver | train | def get_user_deliveryserver(self, domainid, serverid):
"""Get a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | {
"resource": ""
} |
q50690 | BaruwaAPIClient.create_user_deliveryserver | train | def create_user_deliveryserver(self, domainid, data):
"""Create a user delivery server"""
return self.api_call(
ENDPOINTS['userdeliveryservers']['new'],
dict(domainid=domainid),
body=data) | python | {
"resource": ""
} |
q50691 | BaruwaAPIClient.get_domain_smarthost | train | def get_domain_smarthost(self, domainid, serverid):
"""Get a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['get'],
dict(domainid=domainid, serverid=serverid)) | python | {
"resource": ""
} |
q50692 | BaruwaAPIClient.create_domain_smarthost | train | def create_domain_smarthost(self, domainid, data):
"""Create a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['new'],
dict(domainid=domainid),
body=data) | python | {
"resource": ""
} |
q50693 | BaruwaAPIClient.update_domain_smarthost | train | def update_domain_smarthost(self, domainid, serverid, data):
"""Update a domain smarthost"""
return self.api_call(
ENDPOINTS['domainsmarthosts']['update'],
dict(domainid=domainid, serverid=serverid),
body=data) | python | {
"resource": ""
} |
q50694 | BaruwaAPIClient.get_authservers | train | def get_authservers(self, domainid, page=None):
"""Get Authentication servers"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['authservers']['list'],
dict(domainid=domainid), **opts) | python | {
"resource": ""
} |
q50695 | BaruwaAPIClient.get_authserver | train | def get_authserver(self, domainid, serverid):
"""Get an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['get'],
dict(domainid=domainid, serverid=serverid)) | python | {
"resource": ""
} |
q50696 | BaruwaAPIClient.create_authserver | train | def create_authserver(self, domainid, data):
"""Create an Authentication server"""
return self.api_call(
ENDPOINTS['authservers']['new'],
dict(domainid=domainid),
body=data) | python | {
"resource": ""
} |
q50697 | BaruwaAPIClient.get_ldapsettings | train | def get_ldapsettings(self, domainid, serverid, settingsid):
"""Get LDAP settings"""
return self.api_call(
ENDPOINTS['ldapsettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | python | {
"resource": ""
} |
q50698 | BaruwaAPIClient.get_radiussettings | train | def get_radiussettings(self, domainid, serverid, settingsid):
"""Get RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['get'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid)) | python | {
"resource": ""
} |
q50699 | BaruwaAPIClient.delete_radiussettings | train | def delete_radiussettings(self, domainid, serverid, settingsid, data):
"""Delete RADIUS settings"""
return self.api_call(
ENDPOINTS['radiussettings']['delete'],
dict(domainid=domainid, serverid=serverid, settingsid=settingsid),
body=data) | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.