input
stringlengths
11
7.65k
target
stringlengths
22
8.26k
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def deeplift_grad(module, grad_input, grad_output): """The backward hook which computes the deeplift gradient for an nn.Module """ # first, get the module type module_type = module.__class__.__name__ # first, check the module is supported if module_type in op_handler: if op_handler[m...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def open_pager(self): "Open the selected item with the system's pager" data = self.get_selected_item() if data['type'] == 'Submission': text = '\n\n'.join((data['permalink'], data['text'])) self.term.open_pager(text) elif data['type'] == 'Comment': tex...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def add_interim_values(module, input, output): """The forward hook used to save interim tensors, detached from the graph. Used to calculate the multipliers """ try: del module.x except AttributeError: pass try: del module.y except AttributeError: pass modu...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def add_comment(self): """ Submit a reply to the selected item. Selected item: Submission - add a top level comment Comment - add a comment reply """ data = self.get_selected_item() if data['type'] == 'Submission': body = data['text']...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def get_target_input(module, input, output): """A forward hook which saves the tensor - attached to its graph. Used if we want to explain the interim outputs of a model """ try: del module.target_input except AttributeError: pass setattr(module, 'target_input', input)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def delete_comment(self): "Delete the selected comment" if self.get_selected_item()['type'] == 'Comment': self.delete_item() else: self.term.flash()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def deeplift_tensor_grad(grad): return_grad = complex_module_gradients[-1] del complex_module_gradients[-1] return return_grad
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def comment_urlview(self): data = self.get_selected_item() comment = data.get('body') or data.get('text') or data.get('url_full') if comment: self.term.open_urlview(comment) else: self.term.flash()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def passthrough(module, grad_input, grad_output): """No change made to gradients""" return None
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _draw_item(self, win, data, inverted): if data['type'] == 'MoreComments': return self._draw_more_comments(win, data) elif data['type'] == 'HiddenComment': return self._draw_more_comments(win, data) elif data['type'] == 'Comment': return self._draw_comment...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def maxpool(module, grad_input, grad_output): pool_to_unpool = { 'MaxPool1d': torch.nn.functional.max_unpool1d, 'MaxPool2d': torch.nn.functional.max_unpool2d, 'MaxPool3d': torch.nn.functional.max_unpool3d } pool_to_function = { 'MaxPool1d': torch.nn.functional.max_pool1d, ...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _draw_comment(self, win, data, inverted): n_rows, n_cols = win.getmaxyx() n_cols -= 1 # Handle the case where the window is not large enough to fit the text. valid_rows = range(0, n_rows) offset = 0 if not inverted else -(data['n_rows'] - n_rows) # If there isn't e...
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def linear_1d(module, grad_input, grad_output): """No change made to gradients.""" return None
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def every_day(job, loop=None): return every(job, timedelta=timedelta(days=1), loop=loop)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def every_week(job, loop=None): return every(job, timedelta=timedelta(days=7), loop=loop)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _nearest_weekday(weekday): return datetime.now() + timedelta(days=(weekday - datetime.now().weekday()) % 7)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _every_weekday(job, weekday, loop=None): return every(job, timedelta=timedelta(days=7), start_at=_nearest_weekday(weekday), loop=loop)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def __init__(self): ApiCli.__init__(self) self.path = "v1/account/sources/" self.method = "GET"
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def __init__(self, root, transforms=None): super().__init__(root=root) self.transforms = transforms self._flow_list = [] self._image_list = []
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _read_img(self, file_name): img = Image.open(file_name) if img.mode != "RGB": img = img.convert("RGB") return img
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def __len__(self): return len(self._image_list)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def __rmul__(self, v): return torch.utils.data.ConcatDataset([self] * v)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _read_flow(self, file_name): return _read_flo(file_name)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _read_flow(self, file_name): return _read_16bits_png_with_flow_and_valid_mask(file_name)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _read_flow(self, file_name): return _read_pfm(file_name)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _read_flow(self, file_name): return _read_16bits_png_with_flow_and_valid_mask(file_name)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def LogPABotMessage(message): _pabotlog.info(message)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def test_engine_module_name(): engine = salt.engines.Engine({}, "foobar.start", {}, {}, {}, {}, name="foobar") assert engine.name == "foobar"
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def resource_setup(cls): super(VolumesActionsTest, cls).resource_setup() # Create a test shared volume for attach/detach tests cls.volume = cls.create_volume()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def setup_loader(request): setup_loader_modules = {pdbedit: {}} with pytest.helpers.loader_mock(request, setup_loader_modules) as loader_mock: yield loader_mock
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def test_disk_usage_sensor_is_stateless(): sensor = disk_usage.DiskUsage() ok_([] != sensor.measure())
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def warn(txt, act, opt): if opt.get('display_examples'): print(txt + ":\n" + str(act)) else: warn_once(txt)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def delete(arg=None): frappe.get_doc("Communication", frappe.form_dict['name']).delete()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def verify_data(opt): counts = verify(opt) print(counts) return counts
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def setup_args(cls): return setup_args()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def run(self): return verify_data(self.opt)
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def delete_snapshot(self, snapshot_id): """Delete Snapshot.""" return self.delete("snapshots/%s" % str(snapshot_id))
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def is_resource_deleted(self, id): try: self.get_snapshot(id) except exceptions.NotFound: return True return False
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def __init__(self, client): self.client = client self.have = None self.want = Parameters(self.client.module.params) self.changes = Parameters()
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _pool_is_licensed(self): if self.have.state == 'LICENSED': return True return False
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def _pool_is_unlicensed_eula_unaccepted(self, current): if current.state != 'LICENSED' and not self.want.accept_eula: return True return False
def emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
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 emit(self, level, message): raise NotImplementedError('Please implement an emit method')
def should_update(self): if self._pool_is_licensed(): return False if self._pool_is_unlicensed_eula_unaccepted(): return False return True