input stringlengths 11 7.65k | target stringlengths 22 8.26k |
|---|---|
def __init__(self,params,parent):
self.params=params
self.parent=parent | def linear_1d(module, grad_input, grad_output):
"""No change made to gradients."""
return None |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _draw_more_comments(self, win, data):
n_rows, n_cols = win.getmaxyx()
n_cols -= 1
self.term.add_line(win, '{body}'.format(**data), 0, 1)
self.term.add_line(
win, ' [{count}]'.format(**data), attr=curses.A_BOLD)
attr = Color.get_level(data['level'])
self... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def nonlinear_1d(module, grad_input, grad_output):
delta_out = module.y[: int(module.y.shape[0] / 2)] - module.y[int(module.y.shape[0] / 2):]
delta_in = module.x[: int(module.x.shape[0] / 2)] - module.x[int(module.x.shape[0] / 2):]
dup0 = [2] + [1 for i in delta_in.shape[1:]]
# handles numerical instab... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def wait_time_gen():
count = 0
while True:
rand = random.randrange(round(interval.total_seconds()))
tmp = round(start + interval.total_seconds() * count + rand - loop.time())
yield tmp
count += 1 |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def every_day(job, loop=None):
return every(job, timedelta=timedelta(days=1), loop=loop) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def every_week(job, loop=None):
return every(job, timedelta=timedelta(days=7), loop=loop) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _nearest_weekday(weekday):
return datetime.now() + timedelta(days=(weekday - datetime.now().weekday()) % 7) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _every_weekday(job, weekday, loop=None):
return every(job, timedelta=timedelta(days=7), start_at=_nearest_weekday(weekday), loop=loop) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_dummy_request():
from rasa.nlu.emulators.no_emulator import NoEmulator
em = NoEmulator()
norm = em.normalise_request_json({"text": ["arb text"]})
assert norm == {"text": "arb text", "time": None}
norm = em.normalise_request_json({"text": ["arb text"], "time": "1499279161658"})
assert ... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self):
ApiCli.__init__(self)
self.path = "v1/account/sources/"
self.method = "GET" |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_dummy_response():
from rasa.nlu.emulators.no_emulator import NoEmulator
em = NoEmulator()
data = {"intent": "greet", "text": "hi", "entities": {}, "confidence": 1.0}
assert em.normalise_response_json(data) == data |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, transforms=None):
super().__init__(root=root)
self.transforms = transforms
self._flow_list = []
self._image_list = [] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_img(self, file_name):
img = Image.open(file_name)
if img.mode != "RGB":
img = img.convert("RGB")
return img |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flow(self, file_name):
# Return the flow or a tuple with the flow and the valid_flow_mask if _has_builtin_flow_mask is True
pass |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __getitem__(self, index):
img1 = self._read_img(self._image_list[index][0])
img2 = self._read_img(self._image_list[index][1])
if self._flow_list: # it will be empty for some dataset when split="test"
flow = self._read_flow(self._flow_list[index])
if self._has_built... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __len__(self):
return len(self._image_list) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __rmul__(self, v):
return torch.utils.data.ConcatDataset([self] * v) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, split="train", pass_name="clean", transforms=None):
super().__init__(root=root, transforms=transforms)
verify_str_arg(split, "split", valid_values=("train", "test"))
verify_str_arg(pass_name, "pass_name", valid_values=("clean", "final", "both"))
passes = ["clean... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __getitem__(self, index):
"""Return example at given index.
Args:
index(int): The index of the example to retrieve
Returns:
tuple: A 3-tuple with ``(img1, img2, flow)``.
The flow is a numpy array of shape (2, H, W) and the images are PIL images.
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flow(self, file_name):
return _read_flo(file_name) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, split="train", transforms=None):
super().__init__(root=root, transforms=transforms)
verify_str_arg(split, "split", valid_values=("train", "test"))
root = Path(root) / "KittiFlow" / (split + "ing")
images1 = sorted(glob(str(root / "image_2" / "*_10.png")))
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __getitem__(self, index):
"""Return example at given index.
Args:
index(int): The index of the example to retrieve
Returns:
tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` where ``valid_flow_mask``
is a numpy boolean mask of shape (H, W)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flow(self, file_name):
return _read_16bits_png_with_flow_and_valid_mask(file_name) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, split="train", transforms=None):
super().__init__(root=root, transforms=transforms)
verify_str_arg(split, "split", valid_values=("train", "val"))
root = Path(root) / "FlyingChairs"
images = sorted(glob(str(root / "data" / "*.ppm")))
flows = sorted(glob(... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, split="train", pass_name="clean", camera="left", transforms=None):
super().__init__(root=root, transforms=transforms)
verify_str_arg(split, "split", valid_values=("train", "test"))
split = split.upper()
verify_str_arg(pass_name, "pass_name", valid_values=("clea... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flow(self, file_name):
return _read_pfm(file_name) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, root, split="train", transforms=None):
super().__init__(root=root, transforms=transforms)
verify_str_arg(split, "split", valid_values=("train", "test"))
root = Path(root) / "hd1k"
if split == "train":
# There are 36 "sequences" and we don't want seq i to ... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flow(self, file_name):
return _read_16bits_png_with_flow_and_valid_mask(file_name) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_flo(file_name):
"""Read .flo file in Middlebury format"""
# Code adapted from:
# http://stackoverflow.com/questions/28013200/reading-middlebury-flow-files-with-python-bytes-array-numpy
# Everything needs to be in little Endian according to
# https://vision.middlebury.edu/flow/code/flow-cod... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _read_16bits_png_with_flow_and_valid_mask(file_name):
flow_and_valid = _read_png_16(file_name).to(torch.float32)
flow, valid_flow_mask = flow_and_valid[:2, :, :], flow_and_valid[2, :, :]
flow = (flow - 2 ** 15) / 64 # This conversion is explained somewhere on the kitti archive
valid_flow_mask = va... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def LogPABotMessage(message):
_pabotlog.info(message) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_engine_module_name():
engine = salt.engines.Engine({}, "foobar.start", {}, {}, {}, {}, name="foobar")
assert engine.name == "foobar" |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def resource_setup(cls):
super(VolumesActionsTest, cls).resource_setup()
# Create a test shared volume for attach/detach tests
cls.volume = cls.create_volume() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_attach_detach_volume_to_instance(self):
"""Test attaching and detaching volume to instance"""
# Create a server
server = self.create_server()
# Volume is attached and detached successfully from an instance
self.volumes_client.attach_volume(self.volume['id'],
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_volume_bootable(self):
"""Test setting and retrieving bootable flag of a volume"""
for bool_bootable in [True, False]:
self.volumes_client.set_bootable_volume(self.volume['id'],
bootable=bool_bootable)
fetched_volume = ... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_get_volume_attachment(self):
"""Test getting volume attachments
Attach a volume to a server, and then retrieve volume's attachments
info.
"""
# Create a server
server = self.create_server()
# Verify that a volume's attachment information is retrieved
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_volume_upload(self):
"""Test uploading volume to create an image"""
# NOTE(gfidente): the volume uploaded in Glance comes from setUpClass,
# it is shared with the other tests. After it is uploaded in Glance,
# there is no way to delete it from Cinder, so we delete it from Glance... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_reserve_unreserve_volume(self):
"""Test reserving and unreserving volume"""
# Mark volume as reserved.
self.volumes_client.reserve_volume(self.volume['id'])
# To get the volume info
body = self.volumes_client.show_volume(self.volume['id'])['volume']
self.assertIn... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def setup_loader(request):
setup_loader_modules = {pdbedit: {}}
with pytest.helpers.loader_mock(request, setup_loader_modules) as loader_mock:
yield loader_mock |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_disk_usage_sensor_is_stateless():
sensor = disk_usage.DiskUsage()
ok_([] != sensor.measure()) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_when_no_users_returned_no_data_should_be_returned(verbose):
expected_users = {} if verbose else []
with patch.dict(
pdbedit.__salt__,
{
"cmd.run_all": MagicMock(
return_value={"stdout": "", "stderr": "", "retcode": 0}
)
},
):
a... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_when_verbose_and_retcode_is_nonzero_output_should_be_had():
expected_stderr = "this is something fnord"
with patch.dict(
pdbedit.__salt__,
{
"cmd.run_all": MagicMock(
return_value={"stdout": "", "stderr": expected_stderr, "retcode": 1}
)
}... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_when_verbose_and_single_good_output_expected_data_should_be_parsed():
expected_data = {
"roscivs": {
"unix username": "roscivs",
"nt username": "bottia",
"full name": "Roscivs Bottia",
"user sid": "42",
"primary group sid": "99",
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def parse_record(self, metadata, line):
factors = line.split('|')
if len(factors) < 7:
return
registry, cc, type_, start, value, dete, status = factors[:7]
if type_ not in ('ipv4', 'ipv6'):
return
return Record(metadata, start, type_, value, cc) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def setup_args(parser=None):
if parser is None:
parser = ParlaiParser(True, True, 'Check tasks for common errors')
# Get command line arguments
parser.add_argument('-ltim', '--log-every-n-secs', type=float, default=2)
parser.add_argument('-d', '--display-examples', type='bool', default=False)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_list(arg=None):
"""get list of messages"""
frappe.form_dict['limit_start'] = int(frappe.form_dict['limit_start'])
frappe.form_dict['limit_page_length'] = int(frappe.form_dict['limit_page_length'])
frappe.form_dict['user'] = frappe.session['user']
# set all messages as read
frappe.db.begin()
frappe.db.sq... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def report(world, counts, log_time):
report = world.report()
log = {
'missing_text': counts['missing_text'],
'missing_labels': counts['missing_labels'],
'missing_label_candidates': counts['missing_label_candidates'],
'empty_string_label_candidates': counts['empty_string_label_can... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_active_users():
data = frappe.db.sql("""select name,
(select count(*) from tabSessions where user=tabUser.name
and timediff(now(), lastupdate) < time("01:00:00")) as has_session
from tabUser
where enabled=1 and
ifnull(user_type, '')!='Website User' and
name not in ({})
order by first_name""".fo... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def warn(txt, act, opt):
if opt.get('display_examples'):
print(txt + ":\n" + str(act))
else:
warn_once(txt) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def post(txt, contact, parenttype=None, notify=False, subject=None):
"""post message"""
d = frappe.new_doc('Communication')
d.communication_type = 'Notification' if parenttype else 'Chat'
d.subject = subject
d.content = txt
d.reference_doctype = 'User'
d.reference_name = contact
d.sender = frappe.session.user
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def verify(opt):
if opt['datatype'] == 'train':
logging.warning("changing datatype from train to train:ordered")
opt['datatype'] = 'train:ordered'
opt.log()
# create repeat label agent and assign it to the specified task
agent = RepeatLabelAgent(opt)
world = create_task(opt, agent)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def delete(arg=None):
frappe.get_doc("Communication", frappe.form_dict['name']).delete() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def verify_data(opt):
counts = verify(opt)
print(counts)
return counts |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def setup_args(cls):
return setup_args() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def run(self):
return verify_data(self.opt) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def block_size_filter(entity):
return (
entity.size[0] * 2 >= entity.size[1] * 2
and entity.size[1] <= 16
and entity.size[3] <= 4
) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, auth_provider):
super(SnapshotsClientJSON, self).__init__(auth_provider)
self.service = CONF.volume.catalog_type
self.build_interval = CONF.volume.build_interval
self.build_timeout = CONF.volume.build_timeout |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def list_snapshots(self, params=None):
"""List all the snapshot."""
url = 'snapshots'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshots'] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def list_snapshots_with_detail(self, params=None):
"""List the details of all snapshots."""
url = 'snapshots/detail'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshots'] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
url = "snapshots/%s" % str(snapshot_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['snapshot'] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def create_snapshot(self, volume_id, **kwargs):
"""
Creates a new snapshot.
volume_id(Required): id of the volume.
force: Create a snapshot even if the volume attached (Default=False)
display_name: Optional snapshot Name.
display_description: User friendly snapshot descri... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
put_body = json.dumps({'snapshot': kwargs})
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
return resp, body['snapshot'] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _get_snapshot_status(self, snapshot_id):
resp, body = self.get_snapshot(snapshot_id)
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
if (status == 'error'):
raise exceptions.SnapshotBuildErrorException(
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def wait_for_snapshot_status(self, snapshot_id, status):
"""Waits for a Snapshot to reach a given status."""
start_time = time.time()
old_value = value = self._get_snapshot_status(snapshot_id)
while True:
dtime = time.time() - start_time
time.sleep(self.build_inte... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def delete_snapshot(self, snapshot_id):
"""Delete Snapshot."""
return self.delete("snapshots/%s" % str(snapshot_id)) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def is_resource_deleted(self, id):
try:
self.get_snapshot(id)
except exceptions.NotFound:
return True
return False |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def reset_snapshot_status(self, snapshot_id, status):
"""Reset the specified snapshot's status."""
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
return resp, body |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_snapshot_status(self, snapshot_id, status, progress):
"""Update the specified snapshot's status."""
post_body = {
'status': status,
'progress': progress
}
post_body = json.dumps({'os-update_snapshot_status': post_body})
url = 'snapshots/%s/actio... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def create_snapshot_metadata(self, snapshot_id, metadata):
"""Create metadata for the snapshot."""
put_body = json.dumps({'metadata': metadata})
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.post(url, put_body)
body = json.loads(body)
return resp, bod... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['metadata'] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
put_body = json.dumps({'metadata': metadata})
url = "snapshots/%s/metadata" % str(snapshot_id)
resp, body = self.put(url, put_body)
body = json.loads(body)
return resp, body... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
put_body = json.dumps({'meta': meta_item})
url = "snapshots/%s/metadata/%s" % (str(snapshot_id), str(id))
resp, body = self.put(url, put_body)
body = json.loads(body)... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
url = "snapshots/%s/metadata/%s" % (str(snapshot_id), str(id))
resp, body = self.delete(url)
return resp, body |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_stmt_simplify():
ib = tvm.tir.ir_builder.create()
A = ib.pointer("float32", name="A")
C = ib.pointer("float32", name="C")
n = te.size_var("n")
with ib.for_range(0, n, name="i") as i:
with ib.if_scope(i < 12):
A[i] = C[i]
body = tvm.tir.LetStmt(n, 10, ib.get())
m... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_thread_extent_simplify():
ib = tvm.tir.ir_builder.create()
A = ib.pointer("float32", name="A")
C = ib.pointer("float32", name="C")
n = te.size_var("n")
tx = te.thread_axis("threadIdx.x")
ty = te.thread_axis("threadIdx.y")
ib.scope_attr(tx, "thread_extent", n)
ib.scope_attr(tx, "... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_if_likely():
ib = tvm.tir.ir_builder.create()
A = ib.pointer("float32", name="A")
C = ib.pointer("float32", name="C")
n = te.size_var("n")
tx = te.thread_axis("threadIdx.x")
ty = te.thread_axis("threadIdx.y")
ib.scope_attr(tx, "thread_extent", 32)
ib.scope_attr(ty, "thread_exten... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def name(self):
if self._values['name'] is None:
return None
name = str(self._values['name']).strip()
if name == '':
raise F5ModuleError(
"You must specify a name for this module"
)
return name |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def f(i):
start = W[i]
extent = W[i + 1] - W[i]
rv = te.reduce_axis((0, extent))
return te.sum(X[rv + start], axis=rv) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, client):
self.client = client
self.have = None
self.want = Parameters(self.client.module.params)
self.changes = Parameters() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def cumsum(X):
"""
Y[i] = sum(X[:i])
"""
(m,) = X.shape
s_state = te.placeholder((m + 1,), dtype="int32", name="state")
s_init = te.compute((1,), lambda _: tvm.tir.const(0, "int32"))
s_update = te.compute((m + 1,), lambda l: s_state[l - 1] + X[l - 1])
retu... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _set_changed_options(self):
changed = {}
for key in Parameters.returnables:
if getattr(self.want, key) is not None:
changed[key] = getattr(self.want, key)
if changed:
self.changes = Parameters(changed) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def sls(n, d):
gg = te.reduce_axis((0, lengths[n]))
indices_idx = length_offsets[n] + gg
data_idx = indices[indices_idx]
data_val = data[data_idx, d]
return te.sum(data_val, axis=gg) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _update_changed_options(self):
changed = {}
for key in Parameters.updatables:
if getattr(self.want, key) is not None:
attr1 = getattr(self.want, key)
attr2 = getattr(self.have, key)
if attr1 != attr2:
changed[key] = attr... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _pool_is_licensed(self):
if self.have.state == 'LICENSED':
return True
return False |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _pool_is_unlicensed_eula_unaccepted(self, current):
if current.state != 'LICENSED' and not self.want.accept_eula:
return True
return False |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def exec_module(self):
changed = False
result = dict()
state = self.want.state
try:
if state == "present":
changed = self.present()
elif state == "absent":
changed = self.absent()
except iControlUnexpectedHTTPError as e:
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def exists(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
if len(collection) == 1:
return True
elif len(collection) == 0:
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def should_update(self):
if self._pool_is_licensed():
return False
if self._pool_is_unlicensed_eula_unaccepted():
return False
return True |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update(self):
self.have = self.read_current_from_device()
if not self.should_update():
return False
if self.module.check_mode:
return True
self.update_on_device()
return True |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_on_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
resource.modify(
state='REL... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def create(self):
self._set_changed_options()
if self.client.check_mode:
return True
if self.want.base_key is None:
raise F5ModuleError(
"You must specify a 'base_key' when creating a license pool"
)
self.create_on_device()
retu... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def read_current_from_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
result = resource.attrs
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def create_on_device(self):
resource = self.client.api.cm.shared.licensing.pools_s.pool.create(
name=self.want.name,
baseRegKey=self.want.base_key,
method="AUTOMATIC"
)
return self._wait_for_license_pool_state_to_activate(resource) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _wait_for_license_pool_state_to_activate(self, pool):
error_values = ['EXPIRED', 'FAILED']
# Wait no more than 5 minutes
for x in range(1, 30):
pool.refresh()
if pool.state == 'LICENSED':
return True
elif pool.state == 'WAITING_FOR_EULA_ACC... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def remove(self):
if self.client.check_mode:
return True
self.remove_from_device()
if self.exists():
raise F5ModuleError("Failed to delete the license pool")
return True |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def remove_from_device(self):
collection = self.client.api.cm.shared.licensing.pools_s.get_collection(
requests_params=dict(
params="$filter=name+eq+'{0}'".format(self.want.name)
)
)
resource = collection.pop()
if resource:
resource.del... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self):
self.supports_check_mode = True
self.argument_spec = dict(
accept_eula=dict(
type='bool',
default='no',
choices=BOOLEANS
),
base_key=dict(
required=False,
no_log=True
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def main():
if not HAS_F5SDK:
raise F5ModuleError("The python f5-sdk module is required")
spec = ArgumentSpec()
client = AnsibleF5Client(
argument_spec=spec.argument_spec,
supports_check_mode=spec.supports_check_mode,
f5_product_name=spec.f5_product_name
)
try:
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, protocol: ProtocolAnalyzerContainer, label_index: int, msg_index: int, proto_view: int,
parent=None):
super().__init__(parent)
self.ui = Ui_FuzzingDialog()
self.ui.setupUi(self)
self.setAttribute(Qt.WA_DeleteOnClose)
self.setWindowFlags(Qt.Wind... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.