_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245200 | get_matching_rules | train | def get_matching_rules(tweet):
"""
Retrieves the matching rules for a tweet with a gnip field enrichment.
Args:
tweet (Tweet): the tweet
Returns:
list: potential ``[{"tag": "user_tag", "value": "rule_value"}]``
pairs from standard rulesets or None if no rules or no
mat... | python | {
"resource": ""
} |
q245201 | get_profile_location | train | def get_profile_location(tweet):
"""
Get user's derived location data from the profile location enrichment
If unavailable, returns None.
Args:
tweet (Tweet or dict): Tweet object or dictionary
Returns:
dict: more information on the profile locations enrichment here:
http://... | python | {
"resource": ""
} |
q245202 | get_generator | train | def get_generator(tweet):
"""
Get information about the application that generated the Tweet
Args:
tweet (Tweet): A Tweet object (or a dictionary)
Returns:
dict: keys are 'link' and 'name', the web link and the name
of the application
Example:
>>> from tweet_parser... | python | {
"resource": ""
} |
q245203 | lazy_property | train | def lazy_property(fn):
"""
Decorator that makes a property lazy-evaluated whilst preserving
docstrings.
Args:
fn (function): the property in question
Returns:
evaluated version of the property.
"""
attr_name = '_lazy_' + fn.__name__
@property
@wraps(fn)
def _la... | python | {
"resource": ""
} |
q245204 | Tweet.quoted_tweet | train | def quoted_tweet(self):
"""
The quoted Tweet as a Tweet object
If the Tweet is not a quote Tweet, return None
If the quoted Tweet payload cannot be loaded as a Tweet, this will
raise a "NotATweetError"
Returns:
Tweet: A Tweet representing the quoted status (o... | python | {
"resource": ""
} |
q245205 | Tweet.retweeted_tweet | train | def retweeted_tweet(self):
"""
The retweeted Tweet as a Tweet object
If the Tweet is not a Retweet, return None
If the Retweet payload cannot be loaded as a Tweet, this will
raise a `NotATweetError`
Returns:
Tweet: A Tweet representing the retweeted status (o... | python | {
"resource": ""
} |
q245206 | Tweet.embedded_tweet | train | def embedded_tweet(self):
"""
Get the retweeted Tweet OR the quoted Tweet and return it as a Tweet object
Returns:
Tweet (or None, if the Tweet is neither a quote tweet or a Retweet):
a Tweet representing the quote Tweet or the Retweet
(see tweet_embeds.get_e... | python | {
"resource": ""
} |
q245207 | RequestsPromoter.is_applicable | train | def is_applicable(cls, conf):
"""Return whether this promoter is applicable for given conf"""
return all((
| python | {
"resource": ""
} |
q245208 | xpath_selector | train | def xpath_selector(selector, html, select_all):
"""
Returns Xpath match for `selector` within `html`.
:param selector: XPath string
:param html: Unicode content
:param select_all: True to get all matches
"""
from defusedxml import lxml as dlxml
from lxml import etree
import re
... | python | {
"resource": ""
} |
q245209 | register | train | def register():
"""
Return dictionary of tranform factories
"""
registry = {
key: bake_html(key)
for key in ('css', 'css-all', | python | {
"resource": ""
} |
q245210 | ReloadableSettings.reread | train | def reread(self):
"""
Read configuration file and substitute references into checks conf
"""
logger.debug("Loading settings from %s",
os.path.abspath(self.filename))
| python | {
"resource": ""
} |
q245211 | PlainYamlCreds.reread | train | def reread(self):
"""
Read and parse credentials file.
If something goes wrong, log exception and continue.
"""
logger.debug("Loading credentials from %s",
os.path.abspath(self.creds_filename))
creds = {}
try:
with self.open_creds(... | python | {
"resource": ""
} |
q245212 | SettingsParser.parse_checks | train | def parse_checks(self, conf):
"""
Unpack configuration from human-friendly form
to strict check definitions.
"""
checks = conf.get('checks', conf.get('pages', []))
checks = list(self.unpack_batches(checks))
checks = list(self.unpack_templates(checks, conf.get('tem... | python | {
"resource": ""
} |
q245213 | create_boilerplate | train | def create_boilerplate():
"""
Create kibitzr.yml and kibitzr-creds.yml in current directory
if they do not exist.
"""
if not os.path.exists('kibitzr.yml'):
with open('kibitzr.yml', 'wt') as fp:
logger.info("Saving sample check in kibitzr.yml")
fp.write(KIBITZR_YML)
... | python | {
"resource": ""
} |
q245214 | cleanup | train | def cleanup():
"""Must be called before exit"""
temp_dirs = []
for key in ('headless', 'headed'):
if FIREFOX_INSTANCE[key] is not None:
if FIREFOX_INSTANCE[key].profile:
temp_dirs.append(FIREFOX_INSTANCE[key].profile.profile_dir)
try:
FIREFOX_I... | python | {
"resource": ""
} |
q245215 | firefox | train | def firefox(headless=True):
"""
Context manager returning Selenium webdriver.
Instance is reused and must be cleaned up on exit.
"""
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
if headless:
driver_key = 'headless'
firefox_options = Op... | python | {
"resource": ""
} |
q245216 | fetcher_factory | train | def fetcher_factory(conf):
"""Return initialized fetcher capable of processing given conf."""
global PROMOTERS
applicable = []
if not PROMOTERS:
PROMOTERS = load_promoters()
for promoter in PROMOTERS:
if promoter.is_applicable(conf):
applicable.append((promoter.PRIORITY, ... | python | {
"resource": ""
} |
q245217 | FirefoxFetcher.fetch | train | def fetch(self, conf):
"""
1. Fetch URL
2. Run automation.
3. Return HTML.
4. Close the tab.
"""
url = conf['url']
# If Firefox is broken, it will raise here, causing kibitzr restart:
self.driver.set_window_size(1366, 800)
self.driver.impli... | python | {
"resource": ""
} |
q245218 | FirefoxFetcher._run_automation | train | def _run_automation(self, conf):
"""
1. Fill form.
2. Run scenario.
3. Delay.
| python | {
"resource": ""
} |
q245219 | FirefoxFetcher._fill_form | train | def _fill_form(form):
"""
Fill all inputs with provided Jinja2 templates.
If no field had click key, submit last element.
"""
clicked = False
last_element = None
for field in form:
if field['text']:
field['element'].clear()
... | python | {
"resource": ""
} |
q245220 | FirefoxFetcher._find_element | train | def _find_element(self, selector, selector_type, check_displayed=False):
"""
Return first matching displayed element of non-zero size
or None if nothing found
"""
if selector_type == 'css':
elements = self.driver.find_elements_by_css_selector(selector)
elif se... | python | {
"resource": ""
} |
q245221 | FirefoxFetcher._close_tab | train | def _close_tab(self):
"""
Create a new tab and close the old one
to avoid idle page resource usage
"""
old_tab = self.driver.current_window_handle
self.driver.execute_script('''window.open("about:blank", "_blank");''')
| python | {
"resource": ""
} |
q245222 | PageHistory.write | train | def write(self, content):
"""Save content on disk"""
with io.open(self.target, 'w', encoding='utf-8') as fp:
fp.write(content)
| python | {
"resource": ""
} |
q245223 | PageHistory.commit | train | def commit(self):
"""git commit and return whether there were changes"""
self.git.add('-A', '.')
| python | {
"resource": ""
} |
q245224 | PageHistory.ensure_repo_exists | train | def ensure_repo_exists(self):
"""Create git repo if one does not exist yet"""
if not os.path.isdir(self.cwd):
os.makedirs(self.cwd)
if not os.path.isdir(os.path.join(self.cwd, ".git")):
| python | {
"resource": ""
} |
q245225 | ChangesReporter.word | train | def word(self):
"""Return last changes with word diff"""
try:
output = ensure_unicode(self.git.diff(
'--no-color',
'--word-diff=plain',
'HEAD~1:content',
'HEAD:content',
).stdout)
except sh.ErrorReturnCode_12... | python | {
"resource": ""
} |
q245226 | ChangesReporter.default | train | def default(self):
"""Return last changes in truncated unified diff format"""
output = ensure_unicode(self.git.log(
'-1',
'-p',
'--no-color',
'--format=%s',
).stdout)
lines = output.splitlines()
return u'\n'.join(
iterto... | python | {
"resource": ""
} |
q245227 | BashExecutor.temp_file | train | def temp_file(self):
"""
Create temporary file with code and yield its path.
Works both on Windows and Linux
"""
with tempfile.NamedTemporaryFile(suffix='.bat', delete=False) as fp:
try:
logger.debug("Saving code to %r", | python | {
"resource": ""
} |
q245228 | once | train | def once(ctx, name):
"""Run kibitzr checks once and exit"""
from kibitzr.app import Application
app = Application() | python | {
"resource": ""
} |
q245229 | VennCircleRegion.subtract_and_intersect_circle | train | def subtract_and_intersect_circle(self, center, radius):
'''Will throw a VennRegionException if the circle to be subtracted is completely inside and not touching the given region.'''
# Check whether the target circle intersects us
center = np.asarray(center, float)
d = np.linalg... | python | {
"resource": ""
} |
q245230 | VennArcgonRegion.size | train | def size(self):
'''Return the area of the patch.
The area can be computed using the standard polygon area formula + signed segment areas of each arc.
'''
polygon_area = 0
for a in self.arcs:
| python | {
"resource": ""
} |
q245231 | VennArcgonRegion.make_patch | train | def make_patch(self):
'''
Retuns a matplotlib PathPatch representing the current region.
'''
path = [self.arcs[0].start_point()]
for a in self.arcs:
if a.direction:
vertices = Path.arc(a.from_angle, a.to_angle).vertices
else:
... | python | {
"resource": ""
} |
q245232 | VennMultipieceRegion.label_position | train | def label_position(self):
'''
Find the largest region and position the label in that.
'''
reg_sizes | python | {
"resource": ""
} |
q245233 | VennMultipieceRegion.make_patch | train | def make_patch(self):
'''Currently only works if all the pieces are Arcgons.
In this case returns a multiple-piece path. Otherwise throws an exception.'''
paths = [p.make_patch().get_path() for p in self.pieces]
| python | {
"resource": ""
} |
q245234 | Arc.mid_point | train | def mid_point(self):
'''
Returns the midpoint of the arc as a 1x2 numpy array.
'''
midpoint_angle | python | {
"resource": ""
} |
q245235 | VennDiagram.hide_zeroes | train | def hide_zeroes(self):
'''
Sometimes it makes sense to hide the labels for subsets whose size is zero.
| python | {
"resource": ""
} |
q245236 | calculate_dict_diff | train | def calculate_dict_diff(old_params: dict, new_params: dict):
"""Return the parameters based on the difference.
If a parameter exists in `old_params` but not in `new_params` then
parameter will be set to an empty string.
"""
# Ignore all None values as those cannot be saved.
old_params = remove_... | python | {
"resource": ""
} |
q245237 | validate_file | train | def validate_file(parser, arg):
"""Validates that `arg` is a valid file.""" | python | {
"resource": ""
} |
q245238 | register | train | def register(parser):
"""Register commands with the given parser."""
cmd_machines.register(parser)
cmd_machine.register(parser)
cmd_allocate.register(parser)
cmd_deploy.register(parser)
cmd_commission.register(parser)
cmd_release.register(parser)
cmd_abort.register(parser)
| python | {
"resource": ""
} |
q245239 | MachineWorkMixin.perform_action | train | def perform_action(
self, action, machines, params, progress_title, success_title):
"""Perform the action on the set of machines."""
if len(machines) == 0:
return 0
with utils.Spinner() as context:
| python | {
"resource": ""
} |
q245240 | MachineWorkMixin.get_machines | train | def get_machines(self, origin, hostnames):
"""Return a set of machines based on `hostnames`.
Any hostname that is not found will result in an error.
"""
hostnames = {
hostname: True
for hostname in hostnames
}
machines = origin.Machines.read(hostn... | python | {
"resource": ""
} |
q245241 | MachineSSHMixin.add_ssh_options | train | def add_ssh_options(self, parser):
"""Add the SSH arguments to the `parser`."""
parser.add_argument(
"--username", metavar='USER', help=(
"Username for the SSH connection."))
parser.add_argument(
| python | {
"resource": ""
} |
q245242 | MachineSSHMixin.get_ip_addresses | train | def get_ip_addresses(self, machine, *, boot_only=False, discovered=False):
"""Return all IP address for `machine`.
IP address from `boot_interface` come first.
"""
boot_ips = [
link.ip_address
for link in machine.boot_interface.links
if link.ip_addres... | python | {
"resource": ""
} |
q245243 | MachineSSHMixin._async_get_sshable_ips | train | async def _async_get_sshable_ips(self, ip_addresses):
"""Return list of all IP address that could be pinged."""
async def _async_ping(ip_address):
try:
reader, writer = await asyncio.wait_for(
asyncio.open_connection(ip_address, 22), timeout=5)
... | python | {
"resource": ""
} |
q245244 | MachineSSHMixin._check_ssh | train | def _check_ssh(self, *args):
"""Check if SSH connection can be made to IP with username."""
ssh = subprocess.Popen(
args,
stdin=subprocess.DEVNULL,
| python | {
"resource": ""
} |
q245245 | MachineSSHMixin._determine_username | train | def _determine_username(self, ip):
"""SSH in as root and determine the username."""
ssh = subprocess.Popen([
"ssh",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
"root@%s" % ip],
stdin=subprocess.DEVNULL,
s... | python | {
"resource": ""
} |
q245246 | MachineSSHMixin.ssh | train | def ssh(
self, machine, *,
username=None, command=None, boot_only=False, discovered=False,
wait=300):
"""SSH into `machine`."""
start_time = time.monotonic()
with utils.Spinner() as context:
context.msg = colorized(
"{autoblue}Deter... | python | {
"resource": ""
} |
q245247 | cmd_deploy._get_deploy_options | train | def _get_deploy_options(self, options):
"""Return the deployment options based on command line."""
user_data = None
if options.user_data and options.b64_user_data:
raise CommandError(
"Cannot provide both --user-data and --b64-user-data.")
if options.b64_user_... | python | {
"resource": ""
} |
q245248 | cmd_deploy._handle_abort | train | def _handle_abort(self, machine, allocated):
"""Handle the user aborting mid deployment."""
abort = yes_or_no("Abort deployment?")
if abort:
with utils.Spinner() as context:
if allocated:
context.msg = colorized(
"{autoblue}... | python | {
"resource": ""
} |
q245249 | register | train | def register(parser):
"""Register profile commands with the given parser."""
cmd_login.register(parser)
cmd_logout.register(parser)
| python | {
"resource": ""
} |
q245250 | cmd_login.print_whats_next | train | def print_whats_next(profile):
"""Explain what to do next."""
what_next = [
"{{autogreen}}Congratulations!{{/autogreen}} You are logged in "
"to the MAAS server at {{autoblue}}{profile.url}{{/autoblue}} "
"with the profile name {{autoblue}}{profile.name}{{/autoblue}}.... | python | {
"resource": ""
} |
q245251 | obtain_credentials | train | def obtain_credentials(credentials):
"""Prompt for credentials if possible.
If the credentials are "-" then read from stdin without interactive
prompting.
"""
if credentials == "-":
credentials = sys.stdin.readline().strip()
elif credentials is None:
credentials = try_getpass(
... | python | {
"resource": ""
} |
q245252 | SessionAPI.fromURL | train | async def fromURL(
cls, url, *, credentials=None, insecure=False):
"""Return a `SessionAPI` for a given MAAS instance."""
try:
description = await helpers.fetch_api_description(
url, insecure=insecure)
except helpers.RemoteError as error:
| python | {
"resource": ""
} |
q245253 | SessionAPI.fromProfileName | train | def fromProfileName(cls, name):
"""Return a `SessionAPI` from a given configuration profile name.
:see: `ProfileStore`.
| python | {
"resource": ""
} |
q245254 | SessionAPI.login | train | async def login(
cls, url, *, username=None, password=None, insecure=False):
"""Make a `SessionAPI` by logging-in with a username and password.
:return: A tuple of ``profile`` and ``session``, where the former is
| python | {
"resource": ""
} |
q245255 | SessionAPI.connect | train | async def connect(
cls, url, *, apikey=None, insecure=False):
"""Make a `SessionAPI` by connecting with an apikey.
:return: A tuple of ``profile`` and ``session``, where the former is
an unsaved `Profile` instance, and the latter is a `SessionAPI`
instance made using... | python | {
"resource": ""
} |
q245256 | CallAPI.rebind | train | def rebind(self, **params):
"""Rebind the parameters into the URI.
:return: A new `CallAPI` instance with the new parameters.
"""
| python | {
"resource": ""
} |
q245257 | CallAPI.call | train | def call(self, **data):
"""Issue the call.
:param data: Data to pass in the *body* of the request.
"""
| python | {
"resource": ""
} |
q245258 | CallAPI.prepare | train | def prepare(self, data):
"""Prepare the call payload.
This is used by `call` and can be overridden to marshal the request in
a different way.
:param data: Data to pass in the *body* of the request.
:type data: dict
"""
def expand(data):
for name, val... | python | {
"resource": ""
} |
q245259 | CallAPI.dispatch | train | async def dispatch(self, uri, body, headers):
"""Dispatch the call via HTTP.
This is used by `call` and can be overridden to use a different HTTP
library.
"""
insecure = self.action.handler.session.insecure
connector = aiohttp.TCPConnector(verify_ssl=(not insecure))
... | python | {
"resource": ""
} |
q245260 | connect | train | async def connect(url, *, apikey=None, insecure=False):
"""Connect to MAAS at `url` using a previously obtained API key.
:param url: The URL of MAAS, e.g. http://maas.example.com:5240/MAAS/
:param apikey: The API key to use, e.g.
SkTvsyHhzkREvvdtNk:Ywn5FvXVupVPvNUhrN:cm3Q2f5naXYPYsrPDPfQy9Q9cUFaEgb... | python | {
"resource": ""
} |
q245261 | login | train | async def login(url, *, username=None, password=None, insecure=False):
"""Connect to MAAS at `url` with a user name and password.
:param url: The URL of MAAS, e.g. http://maas.example.com:5240/MAAS/
:param username: The user name to use, e.g. fred.
:param password: The user's password.
:param insec... | python | {
"resource": ""
} |
q245262 | NodesType.read | train | async def read(cls, *, hostnames: typing.Sequence[str] = None):
"""List nodes.
:param hostnames: Sequence of hostnames to only return.
:type hostnames: sequence of `str`
| python | {
"resource": ""
} |
q245263 | Node.as_machine | train | def as_machine(self):
"""Convert to a `Machine` object.
`node_type` must be `NodeType.MACHINE`.
"""
if self.node_type != NodeType.MACHINE:
raise ValueError(
| python | {
"resource": ""
} |
q245264 | Node.as_device | train | def as_device(self):
"""Convert to a `Device` object.
`node_type` must be `NodeType.DEVICE`.
"""
if self.node_type != NodeType.DEVICE:
raise ValueError(
| python | {
"resource": ""
} |
q245265 | Node.as_rack_controller | train | def as_rack_controller(self):
"""Convert to a `RackController` object.
`node_type` must be `NodeType.RACK_CONTROLLER` or
`NodeType.REGION_AND_RACK_CONTROLLER`.
"""
if self.node_type not in [
NodeType.RACK_CONTROLLER, NodeType.REGION_AND_RACK_CONTROLLER]:
... | python | {
"resource": ""
} |
q245266 | Node.as_region_controller | train | def as_region_controller(self):
"""Convert to a `RegionController` object.
`node_type` must be `NodeType.REGION_CONTROLLER` or
`NodeType.REGION_AND_RACK_CONTROLLER`.
"""
if self.node_type not in [
NodeType.REGION_CONTROLLER,
| python | {
"resource": ""
} |
q245267 | Node.get_power_parameters | train | async def get_power_parameters(self):
"""Get the power paramters for this node."""
| python | {
"resource": ""
} |
q245268 | Node.set_power | train | async def set_power(
self, power_type: str,
power_parameters: typing.Mapping[str, typing.Any] = {}):
"""Set the power type and power parameters for this node."""
data = await self._handler.update(
| python | {
"resource": ""
} |
q245269 | BootSourceSelectionsType.create | train | async def create(
cls, boot_source, os, release, *,
arches=None, subarches=None, labels=None):
"""Create a new `BootSourceSelection`."""
if not isinstance(boot_source, BootSource):
raise TypeError(
"boot_source must be a BootSource, not %s"
... | python | {
"resource": ""
} |
q245270 | BootSourceSelectionType.read | train | async def read(cls, boot_source, id):
"""Get `BootSourceSelection` by `id`."""
if isinstance(boot_source, int):
boot_source_id = boot_source
elif isinstance(boot_source, BootSource):
boot_source_id = boot_source.id
else:
raise TypeError(
... | python | {
"resource": ""
} |
q245271 | BootSourceSelection.delete | train | async def delete(self):
"""Delete boot source selection."""
await self._handler.delete(
| python | {
"resource": ""
} |
q245272 | calc_size_and_sha265 | train | def calc_size_and_sha265(content: io.IOBase, chunk_size: int):
"""Calculates the size and the sha2566 value of the content."""
size = 0
sha256 = hashlib.sha256()
content.seek(0, io.SEEK_SET)
while True:
buf = content.read(chunk_size)
length = len(buf)
| python | {
"resource": ""
} |
q245273 | BootResourcesType.create | train | async def create(
cls, name: str, architecture: str, content: io.IOBase, *,
title: str = "",
filetype: BootResourceFileType = BootResourceFileType.TGZ,
chunk_size=(1 << 22), progress_callback=None):
"""Create a `BootResource`.
Creates an uploaded boot res... | python | {
"resource": ""
} |
q245274 | BootResourcesType._upload_chunks | train | async def _upload_chunks(
cls, rfile: BootResourceFile, content: io.IOBase, chunk_size: int,
progress_callback=None):
"""Upload the `content` to `rfile` in chunks using `chunk_size`."""
content.seek(0, io.SEEK_SET)
upload_uri = urlparse(
cls._handler.uri)._rep... | python | {
"resource": ""
} |
q245275 | BootResourcesType._put_chunk | train | async def _put_chunk(
cls, session: aiohttp.ClientSession,
upload_uri: str, buf: bytes):
"""Upload one chunk to `upload_uri`."""
# Build the correct headers.
headers = {
'Content-Type': 'application/octet-stream',
'Content-Length': '%s' % len(buf),... | python | {
"resource": ""
} |
q245276 | BootResourceType.read | train | async def read(cls, id: int):
"""Get `BootResource` by `id`."""
| python | {
"resource": ""
} |
q245277 | BcacheType.read | train | async def read(cls, node, id):
"""Get `Bcache` by `id`."""
if isinstance(node, str):
system_id = node
elif isinstance(node, Node):
system_id = node.system_id
else:
| python | {
"resource": ""
} |
q245278 | Bcache.delete | train | async def delete(self):
"""Delete this Bcache."""
await self._handler.delete(
| python | {
"resource": ""
} |
q245279 | BcachesType.read | train | async def read(cls, node):
"""Get list of `Bcache`'s for `node`."""
if isinstance(node, str):
system_id = node
elif isinstance(node, Node):
system_id = node.system_id
else: | python | {
"resource": ""
} |
q245280 | BcachesType.create | train | async def create(
cls, node: Union[Node, str],
name: str,
backing_device: Union[BlockDevice, Partition],
cache_set: Union[BcacheCacheSet, int],
cache_mode: CacheMode, *,
uuid: str = None):
"""
Create a Bcache on a Node.
:pa... | python | {
"resource": ""
} |
q245281 | get_param_arg | train | def get_param_arg(param, idx, klass, arg, attr='id'):
"""Return the correct value for a fabric from `arg`."""
if isinstance(arg, klass):
return getattr(arg, attr)
elif isinstance(arg, (int, str)):
return arg
else:
raise TypeError(
| python | {
"resource": ""
} |
q245282 | MachinesType.create | train | async def create(
cls, architecture: str, mac_addresses: typing.Sequence[str],
power_type: str,
power_parameters: typing.Mapping[str, typing.Any] = None, *,
subarchitecture: str = None, min_hwe_kernel: str = None,
hostname: str = None, domain: typing.Union[int... | python | {
"resource": ""
} |
q245283 | Machine.save | train | async def save(self):
"""Save the machine in MAAS."""
orig_owner_data = self._orig_data['owner_data']
new_owner_data = dict(self._data['owner_data'])
self._changed_data.pop('owner_data', None)
await super(Machine, self).save()
params_diff = calculate_dict_diff(orig_owner_... | python | {
"resource": ""
} |
q245284 | Machine.abort | train | async def abort(self, *, comment: str = None):
"""Abort the current action.
:param comment: Reason for aborting the action.
:param type: `str`
"""
params = {
"system_id": self.system_id | python | {
"resource": ""
} |
q245285 | Machine.clear_default_gateways | train | async def clear_default_gateways(self):
"""Clear default gateways."""
| python | {
"resource": ""
} |
q245286 | Machine.commission | train | async def commission(
self, *, enable_ssh: bool = None, skip_networking: bool = None,
skip_storage: bool = None,
commissioning_scripts: typing.Sequence[str] = None,
testing_scripts: typing.Sequence[str] = None,
wait: bool = False, wait_interval: int = 5):
... | python | {
"resource": ""
} |
q245287 | Machine.deploy | train | async def deploy(
self, *, user_data: typing.Union[bytes, str] = None,
distro_series: str = None, hwe_kernel: str = None,
comment: str = None, wait: bool = False, wait_interval: int = 5):
"""Deploy this machine.
:param user_data: User-data to provide to the machine w... | python | {
"resource": ""
} |
q245288 | Machine.enter_rescue_mode | train | async def enter_rescue_mode(
self, wait: bool = False, wait_interval: int = 5):
"""
Send this machine into 'rescue mode'.
:param wait: If specified, wait until the deploy is complete.
:param wait_interval: How often to poll, defaults to 5 seconds
"""
try:
... | python | {
"resource": ""
} |
q245289 | Machine.exit_rescue_mode | train | async def exit_rescue_mode(
self, wait: bool = False, wait_interval: int = 5):
"""
Exit rescue mode.
:param wait: If specified, wait until the deploy is complete.
:param wait_interval: How often to poll, defaults to 5 seconds
"""
try:
self._data =... | python | {
"resource": ""
} |
q245290 | Machine.get_details | train | async def get_details(self):
"""Get machine details information.
:returns: Mapping of hardware details.
"""
| python | {
"resource": ""
} |
q245291 | Machine.mark_broken | train | async def mark_broken(self, *, comment: str = None):
"""Mark broken.
:param comment: Reason machine is broken.
:type comment: `str`
"""
params = {
"system_id": self.system_id
| python | {
"resource": ""
} |
q245292 | Machine.mark_fixed | train | async def mark_fixed(self, *, comment: str = None):
"""Mark fixes.
:param comment: Reason machine is fixed.
:type comment: `str`
"""
params = {
"system_id": self.system_id
| python | {
"resource": ""
} |
q245293 | Machine.release | train | async def release(
self, *, comment: str = None, erase: bool = None,
secure_erase: bool = None, quick_erase: bool = None,
wait: bool = False, wait_interval: int = 5):
"""
Release the machine.
:param comment: Reason machine was released.
:type comment:... | python | {
"resource": ""
} |
q245294 | Machine.power_on | train | async def power_on(
self, comment: str = None,
wait: bool = False, wait_interval: int = 5):
"""
Power on.
:param comment: Reason machine was powered on.
:type comment: `str`
:param wait: If specified, wait until the machine is powered on.
:type wa... | python | {
"resource": ""
} |
q245295 | Machine.power_off | train | async def power_off(
self, stop_mode: PowerStopMode = PowerStopMode.HARD,
comment: str = None, wait: bool = False, wait_interval: int = 5):
"""
Power off.
:param stop_mode: How to perform the power off.
:type stop_mode: `PowerStopMode`
:param comment: Rea... | python | {
"resource": ""
} |
q245296 | Machine.query_power_state | train | async def query_power_state(self):
"""
Query the machine's BMC for the current power state.
:returns: Current power state.
:rtype: `PowerState`
"""
power_data = await self._handler.query_power_state(
system_id=self.system_id)
# Update the internal sta... | python | {
"resource": ""
} |
q245297 | Machine.restore_default_configuration | train | async def restore_default_configuration(self):
"""
Restore machine's configuration to its initial state.
"""
| python | {
"resource": ""
} |
q245298 | Machine.restore_networking_configuration | train | async def restore_networking_configuration(self):
"""
Restore machine's networking configuration to its initial state.
"""
| python | {
"resource": ""
} |
q245299 | Machine.restore_storage_configuration | train | async def restore_storage_configuration(self):
"""
Restore machine's storage configuration to its initial state.
"""
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.