text stringlengths 81 112k |
|---|
Send a message to third party applications
def message(self, msg):
"""Send a message to third party applications
"""
for broker in self.message_brokers:
try:
broker(msg)
except Exception as exc:
utils.error(exc) |
Return all the kinto records for this bucket/collection.
def get_kinto_records(kinto_client, bucket, collection, permissions,
config=None):
"""Return all the kinto records for this bucket/collection."""
# Create bucket if needed
try:
kinto_client.create_bucket(id=bucket, if_no... |
:param ip: chassis object
def add_chassis(self, chassis):
"""
:param ip: chassis object
"""
self.chassis_list[chassis] = XenaSocket(self.logger, chassis.ip, chassis.port)
self.chassis_list[chassis].connect()
KeepAliveThread(self.chassis_list[chassis]).start()
se... |
Send command and do not parse output (except for communication errors).
:param obj: requested object.
:param command: command to send.
:param arguments: list of command arguments.
def send_command(self, obj, command, *arguments):
""" Send command and do not parse output (except for com... |
Send command and wait for single line output.
def send_command_return(self, obj, command, *arguments):
""" Send command and wait for single line output. """
index_command = obj._build_index_command(command, *arguments)
return obj._extract_return(command, self.chassis_list[obj.chassis].sendQuery... |
Send command and wait for multiple lines output.
def send_command_return_multilines(self, obj, command, *arguments):
""" Send command and wait for multiple lines output. """
index_command = obj._build_index_command(command, *arguments)
return self.chassis_list[obj.chassis].sendQuery(index_comma... |
Returns single object attribute.
:param obj: requested object.
:param attribute: requested attribute to query.
:returns: returned value.
:rtype: str
def get_attribute(self, obj, attribute):
""" Returns single object attribute.
:param obj: requested object.
:par... |
Get all object's attributes.
Sends multi-parameter info/config queries and returns the result as dictionary.
:param obj: requested object.
:returns: dictionary of <name, value> of all attributes returned by the query.
:rtype: dict of (str, str)
def get_attributes(self, obj):
"... |
Set attributes.
:param obj: requested object.
:param attributes: dictionary of {attribute: value} to set
def set_attributes(self, obj, **attributes):
""" Set attributes.
:param obj: requested object.
:param attributes: dictionary of {attribute: value} to set
"""
... |
Send CLI command that returns list of integer counters.
:param obj: requested object.
:param stat_name: statistics command name.
:return: list of counters.
:rtype: list(int)
def get_stats(self, obj, stat_name):
""" Send CLI command that returns list of integer counters.
... |
Iterate depth-first.
::
>>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode
>>> root_container = UniqueTreeContainer(name="root")
>>> outer_container = UniqueTreeContainer(name="outer")
>>> inner_container = UniqueTreeContainer(name="inner")
... |
Reserve port.
XenaManager-2G -> Reserve/Relinquish Port.
:param force: True - take forcefully, False - fail if port is reserved by other user
def reserve(self, force=False):
""" Reserve port.
XenaManager-2G -> Reserve/Relinquish Port.
:param force: True - take forcefully, Fa... |
Load configuration file from xpc file.
:param config_file_name: full path to the configuration file.
def load_config(self, config_file_name):
""" Load configuration file from xpc file.
:param config_file_name: full path to the configuration file.
"""
with open(config_file_nam... |
Save configuration file to xpc file.
:param config_file_name: full path to the configuration file.
def save_config(self, config_file_name):
""" Save configuration file to xpc file.
:param config_file_name: full path to the configuration file.
"""
with open(config_file_name, '... |
Add stream.
:param name: stream description.
:param tpld_id: TPLD ID. If None the a unique value will be set.
:param state: new stream state.
:type state: xenamanager.xena_stream.XenaStreamState
:return: newly created stream.
:rtype: xenamanager.xena_stream.XenaStream
d... |
:return: dictionary {group name {stat name: value}}.
Sea XenaPort.stats_captions.
def read_port_stats(self):
"""
:return: dictionary {group name {stat name: value}}.
Sea XenaPort.stats_captions.
"""
stats_with_captions = OrderedDict()
for stat_name in se... |
:return: dictionary {stream index {stat name: value}}.
Sea XenaStream.stats_captions.
def read_stream_stats(self):
"""
:return: dictionary {stream index {stat name: value}}.
Sea XenaStream.stats_captions.
"""
stream_stats = OrderedDict()
for stream in sel... |
:return: dictionary {tpld index {group name {stat name: value}}}.
Sea XenaTpld.stats_captions.
def read_tpld_stats(self):
"""
:return: dictionary {tpld index {group name {stat name: value}}}.
Sea XenaTpld.stats_captions.
"""
payloads_stats = OrderedDict()
... |
:return: dictionary {id: object} of all streams.
:rtype: dict of (int, xenamanager.xena_stream.XenaStream)
def streams(self):
"""
:return: dictionary {id: object} of all streams.
:rtype: dict of (int, xenamanager.xena_stream.XenaStream)
"""
if not self.get_objects_by_ty... |
:return: dictionary {id: object} of all current tplds.
:rtype: dict of (int, xenamanager.xena_port.XenaTpld)
def tplds(self):
"""
:return: dictionary {id: object} of all current tplds.
:rtype: dict of (int, xenamanager.xena_port.XenaTpld)
"""
# As TPLDs are dynamic we m... |
:return: dictionary {group name {stat name: value}}.
Sea XenaTpld.stats_captions.
def read_stats(self):
"""
:return: dictionary {group name {stat name: value}}.
Sea XenaTpld.stats_captions.
"""
stats_with_captions = OrderedDict()
for stat_name in self.st... |
Get captured packets from chassis.
:param from_index: index of first packet to read.
:param to_index: index of last packet to read. If None - read all packets.
:param cap_type: returned capture format. If pcap then file name and tshark must be provided.
:param file_name: if specified, c... |
:return: dictionary {id: object} of all packets.
:rtype: dict of (int, xenamanager.xena_port.XenaCapturePacket)
def packets(self):
"""
:return: dictionary {id: object} of all packets.
:rtype: dict of (int, xenamanager.xena_port.XenaCapturePacket)
"""
if not self.get_obj... |
Register a new rule above a given ``supply`` threshold
Registration supports a single-argument form for use as a decorator,
as well as a two-argument form for direct application.
Use the former for ``def`` or ``class`` definitions,
and the later for ``lambda`` functions and existing cal... |
Create an unbound prototype of this class, partially applying arguments
.. code:: python
@stepwise
def control(pool: Pool, interval):
return 10
pipeline = control.s(interval=20) >> pool
:note: The partial rules are sealed, and :py:meth:`~.UnboundSt... |
revisionId differs from id, it is details of implementation use self.id
:return: RevisionId
def revisionId(self):
"""
revisionId differs from id, it is details of implementation use self.id
:return: RevisionId
"""
log.warning("'RevisionId' requested, ensure that you are ... |
Generate changes object for ldap object.
def changeset(python_data: LdapObject, d: dict) -> Changeset:
""" Generate changes object for ldap object. """
table: LdapObjectClass = type(python_data)
fields = table.get_fields()
changes = Changeset(fields, src=python_data, d=d)
return changes |
Convert a DbDate object to a LdapObject.
def _db_to_python(db_data: dict, table: LdapObjectClass, dn: str) -> LdapObject:
""" Convert a DbDate object to a LdapObject. """
fields = table.get_fields()
python_data = table({
name: field.to_python(db_data[name])
for name, field in fields.items(... |
Convert a LdapChanges object to a modlist for add operation.
def _python_to_mod_new(changes: Changeset) -> Dict[str, List[List[bytes]]]:
""" Convert a LdapChanges object to a modlist for add operation. """
table: LdapObjectClass = type(changes.src)
fields = table.get_fields()
result: Dict[str, List[Li... |
Convert a LdapChanges object to a modlist for a modify operation.
def _python_to_mod_modify(changes: Changeset) -> Dict[str, List[Tuple[Operation, List[bytes]]]]:
""" Convert a LdapChanges object to a modlist for a modify operation. """
table: LdapObjectClass = type(changes.src)
changes = changes.changes
... |
Search for a object of given type in the database.
def search(table: LdapObjectClass, query: Optional[Q] = None,
database: Optional[Database] = None, base_dn: Optional[str] = None) -> Iterator[LdapObject]:
""" Search for a object of given type in the database. """
fields = table.get_fields()
db_... |
Get exactly one result from the database or fail.
def get_one(table: LdapObjectClass, query: Optional[Q] = None,
database: Optional[Database] = None, base_dn: Optional[str] = None) -> LdapObject:
""" Get exactly one result from the database or fail. """
results = search(table, query, database, base... |
Preload all NotLoaded fields in LdapObject.
def preload(python_data: LdapObject, database: Optional[Database] = None) -> LdapObject:
""" Preload all NotLoaded fields in LdapObject. """
changes = {}
# Load objects within lists.
def preload_item(value: Any) -> Any:
if isinstance(value, NotLoade... |
Insert a new python_data object in the database.
def insert(python_data: LdapObject, database: Optional[Database] = None) -> LdapObject:
""" Insert a new python_data object in the database. """
assert isinstance(python_data, LdapObject)
table: LdapObjectClass = type(python_data)
# ADD NEW ENTRY
e... |
Save all changes in a LdapChanges.
def save(changes: Changeset, database: Optional[Database] = None) -> LdapObject:
""" Save all changes in a LdapChanges. """
assert isinstance(changes, Changeset)
if not changes.is_valid:
raise RuntimeError(f"Changeset has errors {changes.errors}.")
database ... |
Delete a LdapObject from the database.
def delete(python_data: LdapObject, database: Optional[Database] = None) -> None:
""" Delete a LdapObject from the database. """
dn = python_data.get_as_single('dn')
assert dn is not None
database = get_database(database)
connection = database.connection
... |
Lookup a field by its name.
def _get_field_by_name(table: LdapObjectClass, name: str) -> tldap.fields.Field:
""" Lookup a field by its name. """
fields = table.get_fields()
return fields[name] |
Move/rename a LdapObject in the database.
def rename(python_data: LdapObject, new_base_dn: str = None,
database: Optional[Database] = None, **kwargs) -> LdapObject:
""" Move/rename a LdapObject in the database. """
table = type(python_data)
dn = python_data.get_as_single('dn')
assert dn is n... |
Provides play2 likes routes, with python formatter
All string fileds should be named parameters
:param route_str: a route "GET /parent/{parentID}/child/{childId}{ctype}"
:return: the response of requests.request
def route(route_str): # decorator param
"""
Provides play2 likes routes, with python f... |
Injects cookies, into requests call over route
:return: route
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 explici... |
Injects auth, into requests call over route
:return: route
def basic_auth(f):
"""
Injects auth, into requests call over route
:return: route
"""
def wrapper(*args, **kwargs):
self = args[0]
if 'auth' in kwargs:
raise AttributeError("don't set auth token explicitly")... |
return a dictionary with all items of l being the keys of the dictionary
If argument case_insensitive is non-zero ldap.cidict.cidict will be
used for case-insensitive string keys
def _list_dict(l: Iterator[str], case_insensitive: bool = False):
"""
return a dictionary with all items of l being the key... |
Build modify list for call of method LDAPObject.add()
def addModlist(entry: dict, ignore_attr_types: Optional[List[str]] = None) -> Dict[str, List[bytes]]:
"""Build modify list for call of method LDAPObject.add()"""
ignore_attr_types = _list_dict(map(str.lower, (ignore_attr_types or [])))
modlist: Dict[str... |
Build differential modify list for calling LDAPObject.modify()/modify_s()
:param old_entry:
Dictionary holding the old entry
:param new_entry:
Dictionary holding what the new entry should be
:param ignore_attr_types:
List of attribute type names to be ignored completely
:param i... |
Authenticates user and returns new platform to user.
This is an entry point to start working with Qubell Api.
:rtype: QubellPlatform
:param str tenant: url to tenant, default taken from 'QUBELL_TENANT'
:param str user: user email, default taken from 'QUBELL_USER'
:param str passw... |
Authenticates user with the same tenant as current platform using and returns new platform to user.
:rtype: QubellPlatform
:param str user: user email
:param str password: user password
:param str token: session token
:param bool is_public: either to use public or private api (pu... |
Creates new organization
:rtype: Organization
def create_organization(self, name):
"""
Creates new organization
:rtype: Organization
"""
org = Organization.new(name, self._router)
assert org.ready(), "Organization {} hasn't got ready after creation".format(name)
... |
Gets existing and accessible organization
:rtype: Organization
def get_organization(self, id=None, name=None):
"""
Gets existing and accessible organization
:rtype: Organization
"""
log.info("Picking organization: %s (%s)" % (name, id))
return self.organizations[... |
Gets existing or creates new organization
:rtype: Organization
def get_or_create_organization(self, id=None, name=None):
"""
Gets existing or creates new organization
:rtype: Organization
"""
if id:
return self.get_organization(id)
else:
a... |
Get backends versions
:return: dict containing name of backend and version.
def get_backends_versions(self):
"""
Get backends versions
:return: dict containing name of backend and version.
"""
# We are not always have permission, so find open.
for i in range(0, l... |
Returns a stop driver.
The optional loop argument can be provided to use the driver in another
loop than the default one.
Parameters
-----------
loop: BaseEventLoop
The event loop to use instead of the default one.
def make_driver(loop=None):
''' Returns a stop driver.
... |
Convert the rdn to a fully qualified DN for the specified LDAP
connection.
:param changes: The changes object to lookup.
:param name: rdn to convert.
:param base_dn: The base_dn to lookup.
:return: fully qualified DN.
def rdn_to_dn(changes: Changeset, name: str, base_dn: str) -> Changeset:
"""... |
Takes input from user. Works for Python 2 and 3.
def _stdin_(p):
"""Takes input from user. Works for Python 2 and 3."""
_v = sys.version[0]
return input(p) if _v is '3' else raw_input(p) |
Loads up the given survey in the given dir.
def survey_loader(sur_dir=SUR_DIR, sur_file=SUR_FILE):
"""Loads up the given survey in the given dir."""
survey_path = os.path.join(sur_dir, sur_file)
survey = None
with open(survey_path) as survey_file:
survey = Survey(survey_file.read())
return ... |
Return the choices in string form.
def format_choices(self):
"""Return the choices in string form."""
ce = enumerate(self.choices)
f = lambda i, c: '%s (%d)' % (c, i+1)
# apply formatter and append help token
toks = [f(i,c) for i, c in ce] + ['Help (?)']
return ' '.join(... |
Validate user's answer against available choices.
def is_answer_valid(self, ans):
"""Validate user's answer against available choices."""
return ans in [str(i+1) for i in range(len(self.choices))] |
Run the given question.
def run_question(self, question, input_func=_stdin_):
"""Run the given question."""
qi = '[%d/%d] ' % (self.qcount, self.qtotal)
print('%s %s:' % (qi, question['label']))
while True:
# ask for user input until we get a valid one
ans = inpu... |
Run the given section.
def run_section(self, name, input_func=_stdin_):
"""Run the given section."""
print('\nStuff %s by the license:\n' % name)
section = self.survey[name]
for question in section:
self.run_question(question, input_func) |
Run the sections.
def run(self, input_func=_stdin_):
"""Run the sections."""
# reset question count
self.qcount = 1
for section_name in self.survey:
self.run_section(section_name, input_func) |
Return the vector for this survey.
def get_vector(self):
"""Return the vector for this survey."""
vec = {}
for dim in ['forbidden', 'required', 'permitted']:
if self.survey[dim] is None:
continue
dim_vec = map(lambda x: (x['tag'], x['answer']),
... |
Updates line types for a block's span.
Args:
span: First and last relative line number of a Block.
line_type: The type of line to update to.
Raises:
ValidationError: A special error on collision. This prevents Flake8
from crashing because it is conve... |
* When no spaces found, point error at line above act block
* When too many spaces found, point error at 2nd blank line
def check_arrange_act_spacing(self) -> typing.Generator[AAAError, None, None]:
"""
* When no spaces found, point error at line above act block
* When too many spaces f... |
* When no spaces found, point error at line above assert block
* When too many spaces found, point error at 2nd blank line
def check_act_assert_spacing(self) -> typing.Generator[AAAError, None, None]:
"""
* When no spaces found, point error at line above assert block
* When too many spa... |
Checks there is a clear single line between ``first_block_type`` and
``second_block_type``.
Note:
Is tested via ``check_arrange_act_spacing()`` and
``check_act_assert_spacing()``.
def check_block_spacing(
self,
first_block_type: LineType,
second_block_ty... |
Given 2 vectors of multiple dimensions, calculate the euclidean
distance measure between them.
def vector_distance(v1, v2):
"""Given 2 vectors of multiple dimensions, calculate the euclidean
distance measure between them."""
dist = 0
for dim in v1:
for x in v1[dim]:
dd = int(v... |
Send command with no output.
:param command: command to send.
:param arguments: list of command arguments.
def send_command(self, command, *arguments):
""" Send command with no output.
:param command: command to send.
:param arguments: list of command arguments.
"""
... |
Send command and wait for single line output.
def send_command_return(self, command, *arguments):
""" Send command and wait for single line output. """
return self.api.send_command_return(self, command, *arguments) |
Send command and wait for multiple lines output.
def send_command_return_multilines(self, command, *arguments):
""" Send command and wait for multiple lines output. """
return self.api.send_command_return_multilines(self, command, *arguments) |
Function list
Get the list of all interfaces
@param key: The targeted object
@param limit: The limit of items to return
@return RETURN: A ForemanItem list
def load(self, limit=9999):
""" Function list
Get the list of all interfaces
@param key: The targeted obje... |
Function __iadd__
@param payload: The payload corresponding to the object to add
@return RETURN: A ForemanItem
def append(self, payload):
""" Function __iadd__
@param payload: The payload corresponding to the object to add
@return RETURN: A ForemanItem
"""
if s... |
Function getPayloadStruct
@param payload: The payload structure to the object to add
@return RETURN: A dict
def getPayloadStruct(self, payload):
""" Function getPayloadStruct
@param payload: The payload structure to the object to add
@return RETURN: A dict
"""
... |
Build a repr string for ``expr`` from its vars and signature.
::
>>> class MyObject:
... def __init__(self, arg1, arg2, *var_args, foo=None, bar=None, **kwargs):
... self.arg1 = arg1
... self.arg2 = arg2
... self.var_args = var_args
... ... |
Get ``args``, ``var args`` and ``kwargs`` for an object ``expr``.
::
>>> class MyObject:
... def __init__(self, arg1, arg2, *var_args, foo=None, bar=None, **kwargs):
... self.arg1 = arg1
... self.arg2 = arg2
... self.var_args = var_args
.... |
Template an object.
::
>>> class MyObject:
... def __init__(self, arg1, arg2, *var_args, foo=None, bar=None, **kwargs):
... self.arg1 = arg1
... self.arg2 = arg2
... self.var_args = var_args
... self.foo = foo
... ... |
Hooks into Sphinx's ``builder-inited`` event.
Builds out the ReST API source.
def on_builder_inited(app):
"""
Hooks into Sphinx's ``builder-inited`` event.
Builds out the ReST API source.
"""
config = app.builder.config
target_directory = (
pathlib.Path(app.builder.env.srcdir) / ... |
Sets up Sphinx extension.
def setup(app) -> Dict[str, Any]:
"""
Sets up Sphinx extension.
"""
app.add_config_value("uqbar_api_directory_name", "api", "env")
app.add_config_value("uqbar_api_document_empty_modules", False, "env")
app.add_config_value("uqbar_api_document_private_members", False, "... |
Retrieve the Glitter App config for a specific Glitter App.
def get_glitter_app(self, glitter_app_name):
"""
Retrieve the Glitter App config for a specific Glitter App.
"""
if not self.discovered:
self.discover_glitter_apps()
try:
glitter_app = self.glit... |
Find all the Glitter App configurations in the current project.
def discover_glitter_apps(self):
"""
Find all the Glitter App configurations in the current project.
"""
for app_name in settings.INSTALLED_APPS:
module_name = '{app_name}.glitter_apps'.format(app_name=app_name)... |
Function enhance
Enhance the object with new item or enhanced items
def enhance(self):
""" Function enhance
Enhance the object with new item or enhanced items
"""
self.update({'parameters':
SubDict(self.api, self.objName,
self.pa... |
Update the kong configuration
def kong(ctx, namespace, yes):
"""Update the kong configuration
"""
m = KongManager(ctx.obj['agile'], namespace=namespace)
click.echo(utils.niceJson(m.create_kong(yes))) |
Schedules this publish action as a Celery task.
def schedule_task(self):
"""
Schedules this publish action as a Celery task.
"""
from .tasks import publish_task
publish_task.apply_async(kwargs={'pk': self.pk}, eta=self.scheduled_time) |
Get the version object for the related object.
def get_version(self):
"""
Get the version object for the related object.
"""
return Version.objects.get(
content_type=self.content_type,
object_id=self.object_id,
version_number=self.publish_version,
... |
Process a publish action on the related object, returns a boolean if a change is made.
Only objects where a version change is needed will be updated.
def _publish(self):
"""
Process a publish action on the related object, returns a boolean if a change is made.
Only objects where a ver... |
Process an unpublish action on the related object, returns a boolean if a change is made.
Only objects with a current active version will be updated.
def _unpublish(self):
"""
Process an unpublish action on the related object, returns a boolean if a change is made.
Only objects with a... |
Adds a log entry for this action to the object history in the Django admin.
def _log_action(self):
"""
Adds a log entry for this action to the object history in the Django admin.
"""
if self.publish_version == self.UNPUBLISH_CHOICE:
message = 'Unpublished page (scheduled)'
... |
Process the action and update the related object, returns a boolean if a change is made.
def process_action(self):
"""
Process the action and update the related object, returns a boolean if a change is made.
"""
if self.publish_version == self.UNPUBLISH_CHOICE:
actioned = se... |
Function checkAndCreate
check And Create procedure for an hostgroup
- check the hostgroup is not existing
- create the hostgroup
- Add puppet classes from puppetClassesId
- Add params from hostgroupConf
@param key: The hostgroup name or ID
@param payload: The des... |
a decorator decorator, allowing the decorator to be used as:
@decorator(with, arguments, and=kwargs)
or
@decorator
Ref: http://stackoverflow.com/questions/653368/how-to-create-a-python-decorator-that-can-be-used-either-with-or-without-paramet
def doublewrap(f):
'''
a decorator decorator, allowi... |
A decorator which can be used to mark functions
as deprecated.It will result in a deprecation warning being shown
when the function is used.
def deprecated(func, msg=None):
"""
A decorator which can be used to mark functions
as deprecated.It will result in a deprecation warning being shown
when... |
Create a handler for logging to ``target``
def create_handler(target: str):
"""Create a handler for logging to ``target``"""
if target == 'stderr':
return logging.StreamHandler(sys.stderr)
elif target == 'stdout':
return logging.StreamHandler(sys.stdout)
else:
return logging.han... |
Initialise basic logging facilities
def initialise_logging(level: str, target: str, short_format: bool):
"""Initialise basic logging facilities"""
try:
log_level = getattr(logging, level)
except AttributeError:
raise SystemExit(
"invalid log level %r, expected any of 'DEBUG', 'I... |
Escape all DN special characters found in s
with a back-slash (see RFC 4514, section 2.4)
def escape_dn_chars(s):
"""
Escape all DN special characters found in s
with a back-slash (see RFC 4514, section 2.4)
"""
if s:
assert isinstance(s, six.string_types)
s = s.replace('\\', '\... |
This function takes a DN as string as parameter and returns
a decomposed DN. It's the inverse to dn2str().
flags describes the format of the dn
See also the OpenLDAP man-page ldap_str2dn(3)
def str2dn(dn, flags=0):
"""
This function takes a DN as string as parameter and returns
a decomposed D... |
This function takes a decomposed DN as parameter and returns
a single string. It's the inverse to str2dn() but will always
return a DN in LDAPv3 format compliant to RFC 4514.
def dn2str(dn):
"""
This function takes a decomposed DN as parameter and returns
a single string. It's the inverse to str2dn... |
explode_dn(dn [, notypes=0]) -> list
This function takes a DN and breaks it up into its component parts.
The notypes parameter is used to specify that only the component's
attribute values be returned and not the attribute types.
def explode_dn(dn, notypes=0, flags=0):
"""
explode_dn(dn [, notypes... |
explode_rdn(rdn [, notypes=0]) -> list
This function takes a RDN and breaks it up into its component parts
if it is a multi-valued RDN.
The notypes parameter is used to specify that only the component's
attribute values be returned and not the attribute types.
def explode_rdn(rdn, notypes=0, flags=0):... |
Crate or update labels in github
def labels(ctx):
"""Crate or update labels in github
"""
config = ctx.obj['agile']
repos = config.get('repositories')
labels = config.get('labels')
if not isinstance(repos, list):
raise CommandError(
'You need to specify the "repos" list in t... |
Get new access token.
def get_access_token(self, code):
"""Get new access token."""
try:
self._token = super().fetch_token(
MINUT_TOKEN_URL,
client_id=self._client_id,
client_secret=self._client_secret,
code=code,
)... |
Send a request to the Minut Point API.
def _request(self, url, request_type='GET', **params):
"""Send a request to the Minut Point API."""
try:
_LOGGER.debug('Request %s %s', url, params)
response = self.request(
request_type, url, timeout=TIMEOUT.seconds, **para... |
Request list of devices.
def _request_devices(self, url, _type):
"""Request list of devices."""
res = self._request(url)
return res.get(_type) if res else {} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.