query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
mnasneta1 w.t. 5x5MBconv3SE block only
def mnasneta1_5x5mbconv3se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mnasneta1 w.t. 3x3MBconv6 block only
def mnasneta1_3x3mbconv6(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
[ "def mnasneta1_3x3mbconv6se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6],\n kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mnasneta1 w.t. 3x3MBconv6SE block only
def mnasneta1_3x3mbconv6se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mnasneta1 w.t. 5x5MBconv6 block only
def mnasneta1_5x5mbconv6(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
[ "def mnasneta1_5x5mbconv6se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6],\n kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mnasneta1 w.t. 5x5MBconv6SE block only
def mnasneta1_5x5mbconv6se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load ImageNet pretrained model into MobileNetv2 backbone, only happen when no checkpoint is loaded
def load_model(self): if self.ckpt_flag: LOG('Skip Loading Pre-trained Model......') else: if self.params.pre_trained_from is not None and os.path.exists(self.params.pre_trained_from): try: LOG('Loading Pre-trained Model at %s' % self.params.pr...
[ "def load_model():\r\n model = MobileNetV2(weights=\"imagenet\")\r\n print(\"Model loaded\")\r\n return model", "def load_model(self):\n self.pred_net.load((self.save_path / \"iqn_pred_net\").absolute().as_posix())\n self.target_net.load((self.save_path / \"iqn_target_net\").absolute().as_posix())"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plot train/val loss curve
def plot_curve(self): x1 = np.arange(self.init_epoch, self.params.num_epoch+1, dtype=np.int).tolist() x2 = np.linspace(self.init_epoch, self.epoch, num=(self.epoch-self.init_epoch)//self.params.val_every+1, dtype=np.int64) plt.plot(x1, self.train_loss, label='train_loss'...
[ "def plot_loss_curve(self):\n sns.set_style(\"darkgrid\")\n plt.plot(self.train_losses, label='Train')\n plt.plot(self.val_losses, label='Validation')\n plt.title(\"Loss curve\")\n plt.xlabel('Epochs')\n plt.ylabel('Losses')\n plt.legend()\n plt.show()", "de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate Correlation Coefficient between two variables
def correlation(x, y): return covariance(x, y) / (sd(x) * sd(y))
[ "def correlation(self, array1, array2):\n \n correlation = covar_result / (std_dev_x * std_dev_y)\n return correlation", "def correlation(x, y):\n mx = np.mean(x)\n my = np.mean(y)\n return np.dot(x-mx, y-my) / np.sqrt(np.sum((x-mx)**2)) / np.sqrt(np.sum((y-my)**2))", "def ccorr(a, b):...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start a stopped node.
def ex_start_node(self, node): # NOTE: This method is here for backward compatibility reasons after # this method was promoted to be part of the standard compute API in # Libcloud v2.7.0 return self.start_node(node=node)
[ "def ex_start_node(self, node):\n params = {'Action': 'StartInstances'}\n params.update(self._pathlist('InstanceId', [node.id]))\n res = self.connection.request(self.path, params=params).object\n return self._get_state_boolean(res)", "def start_node(self, **kwargs):\n # project_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Suspend a running node.
def ex_suspend_node(self, node): domain = self._get_domain_for_node(node=node) return domain.suspend() == 0
[ "def suspendVirtualMachine(self,node,vmid):\n post_data = None\n data = self.connect('post',\"nodes/%s/qemu/%s/status/suspend\" % (node,vmid), post_data)\n return data", "def _suspend(self):\n # Switch back to the worker that we're currently running in.\n self.greenlet.parent.sw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve Node object for a domain with a provided uuid.
def ex_get_node_by_uuid(self, uuid): domain = self._get_domain_for_uuid(uuid=uuid) node = self._to_node(domain=domain) return node
[ "def _get_domain_for_uuid(self, uuid):\n domain = self.connection.lookupByUUIDString(uuid)\n return domain", "def get_node(self, uuid, clean=True):\n if clean:\n uuid = ProcessNode.strip_uuid(uuid)\n return self._get_tree_queryset().get(uuid_full__startswith=uuid)", "def _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve Node object for a domain with a provided name.
def ex_get_node_by_name(self, name): domain = self._get_domain_for_name(name=name) node = self._to_node(domain=domain) return node
[ "def _get_domain_for_name(self, name):\n domain = self.connection.lookupByName(name)\n return domain", "def get_node(self, name: str) -> Node:\n if name in self._nodes:\n return self._nodes[name]\n else:\n raise ValueError", "def get_node(self, name):\n g = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a system hostname on which the hypervisor is running.
def ex_get_hypervisor_hostname(self): hostname = self.connection.getHostname() return hostname
[ "def get_hostname():\n return socket.gethostname()", "def hostname_calculator(self):\r\n\r\n host_name = self.vm_obj.summary.runtime.host.name\r\n\r\n return host_name.split('.')[0]", "def get_hostname(self):\n command = \"show system\"\n template = \"show_system.textfsm\"\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve hypervisor system information.
def ex_get_hypervisor_sysinfo(self): xml = self.connection.getSysinfo() etree = ET.XML(xml) attributes = ["bios", "system", "processor", "memory_device"] sysinfo = {} for attribute in attributes: element = etree.find(attribute) entries = self._get_entrie...
[ "async def get_system_info(self) -> Dict[str, Any]:\n assert self._client is not None\n return await self._client.invoke_method(\"system.info\")", "def sys_info(self) -> Dict[str, Any]:\n\n return self.get_sysinfo()", "def system_info():\n\n request = current.request\n settings = curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve IP addresses for the provided domain.
def _get_ip_addresses_for_domain(self, domain): result = [] if platform.system() != "Linux": # Only Linux is supported atm return result if "///" not in self._uri: # Only local libvirtd is supported atm return result mac_addresses = self...
[ "def getIPs(self, domain = \"localhost\"):\n # convert 'domain' to string, in case of erroneous type being passed\n domain = str(domain)\n\n # Kind warning for those who entered an IP address instead of a domain\n try: \n inet_aton(domain)\n print(\"Warning: an IP a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses network interface MAC addresses from the provided domain.
def _get_mac_addresses_for_domain(self, domain): xml = domain.XMLDesc() etree = ET.XML(xml) elems = etree.findall("devices/interface[@type='network']/mac") result = [] for elem in elems: mac_address = elem.get("address") result.append(mac_address) ...
[ "def get_macs(domain):\n macs = []\n ret = __salt__[\"vmadm.lookup\"](\n search=\"uuid={uuid}\".format(uuid=domain), order=\"nics\"\n )\n if not ret:\n raise CommandExecutionError(\"We can't find the MAC address of this VM\")\n else:\n for nic in ret[0][\"nics\"]:\n ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return libvirt domain object for the provided node.
def _get_domain_for_node(self, node): domain = self.connection.lookupByUUIDString(node.uuid) return domain
[ "def _libvirt_domain(self):\n if self.libvirt_domain_obj is None:\n conn = self._libvirt()\n try:\n self.libvirt_domain_obj = conn.lookupByName(self._domain)\n except libvirt.libvirtError as e:\n return None\n\n return self.libvirt_domain_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return libvirt domain object for the provided uuid.
def _get_domain_for_uuid(self, uuid): domain = self.connection.lookupByUUIDString(uuid) return domain
[ "def _libvirt_domain(self):\n if self.libvirt_domain_obj is None:\n conn = self._libvirt()\n try:\n self.libvirt_domain_obj = conn.lookupByName(self._domain)\n except libvirt.libvirtError as e:\n return None\n\n return self.libvirt_domain_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return libvirt domain object for the provided name.
def _get_domain_for_name(self, name): domain = self.connection.lookupByName(name) return domain
[ "def domain_by_name(name):\n from xen.xend import XendDomain\n return XendDomain.instance().domain_lookup_by_name_nr(name)", "def _get_domain(self, name=None, domain_id=None):\n try:\n if name != None:\n domain = self.conn.lookupByName(name)\n elif domain_id != No...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up the regexp for parsing out IP addresses from the 'arp an' command and pass it along to the parser function.
def _parse_ip_table_arp(self, arp_output): arp_regex = re.compile(r".*?\((.*?)\) at (.*?)\s+") return self._parse_mac_addr_table(arp_output, arp_regex)
[ "def test_arp_a_ubuntu_18_4(self):\n self.assertEqual(jc.parsers.arp.parse(self.ubuntu_18_4_arp_a, quiet=True), self.ubuntu_18_4_arp_a_json)", "def test_arp_ubuntu_18_4(self):\n self.assertEqual(jc.parsers.arp.parse(self.ubuntu_18_4_arp, quiet=True), self.ubuntu_18_4_arp_json)", "def test_arp_a_os...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up the regexp for parsing out IP addresses from the 'ip neighbor' command and pass it along to the parser function.
def _parse_ip_table_neigh(self, ip_output): ip_regex = re.compile(r"(.*?)\s+.*lladdr\s+(.*?)\s+") return self._parse_mac_addr_table(ip_output, ip_regex)
[ "def ipfeed(url, description, data):\n repdb = RepDB()\n for line in data:\n ipmatch = re.match(re_ipcidr, line)\n if ipmatch:\n ip = ipmatch.group(0)\n repdb.add(ip)\n return repdb", "def Parse(self, nRegistry, cToken, instance) :\n # The neighbor registry object i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the command output and return a dictionary which maps mac address to an IP address.
def _parse_mac_addr_table(self, cmd_output, mac_regex): lines = ensure_string(cmd_output).split("\n") arp_table = defaultdict(list) for line in lines: match = mac_regex.match(line) if not match: continue groups = match.groups() i...
[ "def GetIpMac(self):\n n = list()\n conf = (os.popen(\"ifconfig \"+self.interface)).readlines()\n #conf = conf.readlines()\n myconf = {'ip':((conf[1].split(\":\"))[1].split(\" \"))[0], 'mac': ((conf[0].split(\"HWaddr\"))[1].split(\" \"))[1]}\n cmd = (os.popen(\"nmap -sP \"+self.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use BFS to find the shortest path use level ={} to keep track of distance of each node use parent = {} to back track and trace it out
def find_shortest_path(self, start, end): if start==None: return visited = {} distance = {start:0} parent = {start:None} queue = deque() queue.append(start) while queue: cn = queue.popleft() for n in self.adjacencylist[cn...
[ "def bfs_level(level):\n queue.append(seed_url)\n visited.add(seed_url)\n bfs(level)", "def bfs(graph, root, max_depth):\n node2distances = defaultdict(int)\n node2num_paths = defaultdict(int)\n node2parents = defaultdict(list)\n q = deque()\n q.append(root)\n seen = set()\n depth = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read the next expression from src, a Buffer of tokens. >>> lines = ['(+ 1', '(+ 23 4)) ('] >>> src = Buffer(tokenize_lines(lines)) >>> print(scheme_read(src)) (+ 1 (+ 23 4))
def scheme_read(src): if src.current() is None: raise EOFError if val == 'nil': return nil elif val not in DELIMITERS: # ( ) ' . return val elif val == '(': return read_tail(src) else: raise SyntaxError('unexpected token: {0}'.format(val))
[ "def read(in_port):\n\n def atom(token):\n \"\"\" Numbers become numbers; #t and #f are booleans; \"...\" string; otherwise Symbol. \"\"\"\n if token == '#t':\n return True\n elif token == '#f':\n return False\n elif token[0] == '\"':\n return token[1:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the remainder of a list in src, starting before an element or ). >>> read_tail(Buffer(tokenize_lines([')']))) nil >>> read_tail(Buffer(tokenize_lines(['2 3)']))) Pair(2, Pair(3, nil)) >>> read_tail(Buffer(tokenize_lines(['2 (3 4))']))) Pair(2, Pair(Pair(3, Pair(4, nil)), nil))
def read_tail(src): if src.current() is None: raise SyntaxError('unexpected end of file') if src.current() == ')': src.pop() return nil first = scheme_read(src) rest = read_tail(src) return Pair(first, rest)
[ "def read_tail(src_buf):\n try:\n if src_buf.current() is None:\n raise SyntaxError('不完整的表达式')\n elif src_buf.current() == ')':\n src_buf.remove_front()\n return nil\n elif src_buf.current() == '.':\n src_buf.remove_front()\n second = sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query FS_IMMUTABLE_FL This queries the `FS_IMMUTABLE_FL` flag on a specified file. Arguments fd Filedescriptor to operate on. Returns bool Whether the `FS_IMMUTABLE_FL` flag is set or not. Raises OSError If the underlying ioctl fails, a matching `OSError` will be raised.
def ioctl_get_immutable(fd: int): if not isinstance(fd, int) or fd < 0: raise ValueError() flags = array.array('L', [0]) fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True) return bool(flags[0] & FS_IMMUTABLE_FL)
[ "def ioctl_toggle_immutable(fd: int, set_to: bool):\n\n if not isinstance(fd, int) or fd < 0:\n raise ValueError()\n\n flags = array.array('L', [0])\n fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True)\n if set_to:\n flags[0] |= FS_IMMUTABLE_FL\n else:\n flags[0] &= ~FS_IMMUTABLE_FL\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle FS_IMMUTABLE_FL This toggles the `FS_IMMUTABLE_FL` flag on a specified file. It can both set and clear the flag. Arguments fd Filedescriptor to operate on. set_to Whether to set the `FS_IMMUTABLE_FL` flag or not. Raises OSError If the underlying ioctl fails, a matching `OSError` will be raised.
def ioctl_toggle_immutable(fd: int, set_to: bool): if not isinstance(fd, int) or fd < 0: raise ValueError() flags = array.array('L', [0]) fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True) if set_to: flags[0] |= FS_IMMUTABLE_FL else: flags[0] &= ~FS_IMMUTABLE_FL fcntl.ioctl(...
[ "def ioctl_get_immutable(fd: int):\n\n if not isinstance(fd, int) or fd < 0:\n raise ValueError()\n\n flags = array.array('L', [0])\n fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True)\n return bool(flags[0] & FS_IMMUTABLE_FL)", "def set_nonblocking(fd, onoff=True):\r\n\r\n flags = fcntl.fcntl(fd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a handler to an existing logging.Logger object
def _add_handler(logger, handler=None, loglevel=None): handler.setLevel(loglevel or DEFAULT_LOGLEVEL) if handler.level <= logging.DEBUG: _fmt = '%(asctime)s| %(levelname)-4.3s|%(threadName)10.9s/' \ '%(lineno)04d@%(module)-10.9s| %(message)s' handler.setFormatter(logging.Formatter...
[ "def addHandler(self, handler, **kwargs):\n\n\t\tif (not isinstance(handler, logging.Handler)):\n\t\t\tself._addHandler_functionCatalogue[handler](self, **kwargs)\n\t\telse:\n\t\t\tself.thing.addHandler(handler)", "def add_file_handler_to_logger(logger):\n # This makes \n if AppState().log_file is None:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a console handler for paramiko.transport's logger if not present
def _check_paramiko_handlers(logger=None): paramiko_logger = logging.getLogger('paramiko.transport') if not paramiko_logger.handlers: if logger: paramiko_logger.handlers = logger.handlers else: console_handler = logging.StreamHandler() console_handler.setForma...
[ "def _check_paramiko_handlers(logger=None):\n\n paramiko_logger = logging.getLogger('paramiko.transport')\n\n if not paramiko_logger.handlers:\n if logger:\n paramiko_logger.handlers = logger.handlers\n else:\n console_handler = logging.StreamHandler()\n console_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that if all tunnels are established and populates
def check_tunnels(self): skip_tunnel_checkup = self.skip_tunnel_checkup try: # force tunnel check at this point self.skip_tunnel_checkup = False for _srv in self._server_list: self._check_tunnel(_srv) finally: self.skip_tunnel_check...
[ "def check_for_tunnels():\n # Get a list of current sockets\n try:\n p = invoke(\"netstat -vat\")\n except Exception as details:\n self.logger.warning(\"check_for_tunnels: failed because %s\", details)\n try:\n err = p.stderr.read()\n except IOError:\n module_logger.debug(\"ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if tunnel is already established
def _check_tunnel(self, _srv): if self.skip_tunnel_checkup: self.tunnel_is_up[_srv.local_address] = True return self.logger.info('Checking tunnel to: {0}'.format(_srv.remote_address)) if isinstance(_srv.local_address, string_types): # UNIX stream s = socket.s...
[ "def tunnel_up(self):\n return self._ssh_host != None and self._ssh_port != None", "def is_tunnel_active(self) -> bool:\n pass", "def check_tunnels(self):\n skip_tunnel_checkup = self.skip_tunnel_checkup\n try:\n # force tunnel check at this point\n self.skip_tu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make SSH Handler class
def _make_ssh_forward_handler_class(self, remote_address_): class Handler(_ForwardHandler): remote_address = remote_address_ ssh_transport = self._transport logger = self.logger return Handler
[ "def __init__(self, settings, server=None):\n print(\"SSH Action Handler Started\")\n self.server = server\n self.active_ssh_tasks = {}\n self.key_location = settings[\"ssh_key_location\"]\n self.server_addr = settings[\"ssh_server_addr\"]\n self.server_username = settings[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read ssh_config_file and tries to look for user (ssh_username), identityfile (ssh_pkey), port (ssh_port) and proxycommand (ssh_proxy) entries for ssh_host
def _read_ssh_config(ssh_host, ssh_config_file, ssh_username=None, ssh_pkey=None, ssh_port=None, ssh_proxy=None, compression=None, logger=None): ...
[ "def _process_ssh_config(host: str, ssh_config_file: str) -> Tuple[Optional[int], str, str]:\n ssh = SSHConfig(ssh_config_file)\n host_config = ssh.lookup(host)\n return host_config.port, host_config.user or \"\", host_config.identity_file or \"\"", "def analysis_ssh_config(host: str) -> str:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill local_binds with defaults when no value/s were specified, leaving paramiko to decide in which local port the tunnel will be open
def _consolidate_binds(local_binds, remote_binds): count = len(remote_binds) - len(local_binds) if count < 0: raise ValueError('Too many local bind addresses ' '(local_bind_addresses > remote_bind_addresses)') local_binds.extend([('0.0.0.0', 0) for x in r...
[ "def local_bind_ports(self):\n self._check_is_started()\n return [_server.local_port for _server in self._server_list if\n _server.local_port is not None]", "def _allBindAddresses(self):\n if not config.BindAddresses:\n if getattr(socket, \"has_ipv6\", False):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the SSH transport to the remote gateway
def _get_transport(self): if self.ssh_proxy: if isinstance(self.ssh_proxy, paramiko.proxy.ProxyCommand): proxy_repr = repr(self.ssh_proxy.cmd[1]) else: proxy_repr = repr(self.ssh_proxy) self.logger.debug('Connecting via proxy: {0}'.format(proxy...
[ "def get_transport(self, host_ip=None):\n if host_ip is not None:\n for retry in six.moves.range(0, MAX_RETRY):\n try:\n LOG.info(\"Trying to open the SSH session...\")\n channel = self._ssh_client.get_transport().open_channel(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shut the tunnel down. By default we are always waiting until closing all connections. You can use `force=True` to force close connections
def stop(self, force=False): self.logger.info('Closing all open connections...') opened_address_text = ', '.join( (address_to_str(k.local_address) for k in self._server_list) ) or 'None' self.logger.debug('Listening tunnels: ' + opened_address_text) self._stop_transpo...
[ "def _safe_tunnel_close(self):\n # if error_mode:\n # print(\"WARNING: Safe shutdown of DB connection and SSH tunnel initiated.\")\n # try:\n # if csr:\n # csr.close()\n # del csr\n # if error_mode:\n # conn.rollback()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open connection to SSH gateway First try with all keys loaded from an SSH agent (if allowed) Then with those passed directly or read from ~/.ssh/config As last resort, try with a provided password
def _connect_to_gateway(self): for key in self.ssh_pkeys: self.logger.debug('Trying to log in with key: {0}' .format(hexlify(key.get_fingerprint()))) try: self._transport = self._get_transport() self._transport.connect(hostkey...
[ "def agent_auth(self):\n \n agent = paramiko.Agent()\n agent_keys = agent.get_keys()\n if len(agent_keys) == 0:\n return\n \n for key in agent_keys:\n self.logger.info('Trying ssh-agent key %s' % hexlify(key.get_fingerprint()))\n try:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list containing the ports of local side of the TCP tunnels
def local_bind_ports(self): self._check_is_started() return [_server.local_port for _server in self._server_list if _server.local_port is not None]
[ "def trafficInboundPorts(self):\n return []", "def ports(self):\n return self._ports", "def port_list(self):\n return ['1']", "def ports(self) -> Sequence[str]:\n return pulumi.get(self, \"ports\")", "def list_forward(self):\n resp = self._message(b\"host:list-forward\")\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a dictionary containing the active localremote tunnel_bindings
def tunnel_bindings(self): return dict((_server.remote_address, _server.local_address) for _server in self._server_list if self.tunnel_is_up[_server.local_address])
[ "def check_for_tunnels():\n # Get a list of current sockets\n try:\n p = invoke(\"netstat -vat\")\n except Exception as details:\n self.logger.warning(\"check_for_tunnels: failed because %s\", details)\n try:\n err = p.stderr.read()\n except IOError:\n module_logger.debug(\"ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define type of data expected for remote and local bind address lists Returns a tuple (ip_address, port) whose elements are (str, int)
def _bindlist(input_str): try: ip_port = input_str.split(':') if len(ip_port) == 1: _ip = ip_port[0] _port = None else: (_ip, _port) = ip_port if not _ip and not _port: raise AssertionError elif not _port: _port = '2...
[ "def discovery_address_tuple(self):\n\n return (self.discovery_address, int(self.port))", "def get_endpoints(self) -> Tuple[Optional[str], Optional[str]]:\n if not self.name:\n return (None, None)\n\n if self.type not in [\"IPv4\", \"IPv6\"]:\n return (None, None)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pass input arguments to open_tunnel
def _cli_main(args=None, **extras): arguments = _parse_arguments(args) # Remove all "None" input values _remove_none_values(arguments) verbosity = min(arguments.pop('verbose'), 4) levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG, ...
[ "def ssh_args(self):", "def handle_ssh_tunnel():\n sh.ssh(\"-4\", \"-t\", \"-Y\",\n f\"{Settings.USER}@hpcc.msu.edu\", \"-L\", f\"{Settings.PORT}:localhost:{Settings.PORT}\", \"ssh\", \"-t\", \"-Y\", Settings.NODE, \"-L\", f\"{Settings.PORT}:localhost:{Settings.PORT}\", _out=ssh_interact_tunnel, _tty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
THe reference number of the bottle listed in the reading
def ref(self): return self.bottle.ref
[ "def nr(self):\n return self._nr", "def _nextrefno(self):\n pf, pl = \"J\", 7\n with self._cnsvc.sessionctx() as cur:\n name = cur.query(func.max(MMMa.name)).filter(MMMa.tag == 0).first()\n if not name[0]:\n mtag = cur.query(func.max(MMMa.tag)).first()[0]\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
THe gas mix of the associated bottle
def mix(self): return self.bottle.mix
[ "def compute_mixing_coefficients_bot(self):\n [Ly,N] = self.b.shape\n z_u_w = self.grid_dict['z_u_w']\n\n v_upts = TTTW_func.v2u(self.v)\n\n self.sigma_bot = []\n self.Kv0 = np.zeros([Ly,N+1])\n self.Kt0 = np.zeros([Ly,N+1])\n for j in range(Ly):\n # turb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load all cogs from the 'cogs' directory
def load_cogs(self): path = "cogs/" # Should always have a trailing slash import_path = path.replace("/", ".") extensions: list[str] = [ import_path + file.replace(".py", "") for file in os.listdir(path) if os.path.isfile(f"{path}{file}") ] ...
[ "def __load_cogs(self):\n for cog in self.__cogs.get():\n logging.info('loading %s', cog)\n self.load_extension(cog)", "def load_cogs(self, cog_folder: str = None, exclude: list = []):\n \n _cog_folder = getattr(self, \"cogs_dirname\", cog_folder)\n \n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reload all loaded cogs
def reload_cogs(self): for extension in list(self.extensions): try: self.reload_extension(extension) except errors.NoEntryPointError: log.info("The extension {extension} has no setup function") pass except errors.ExtensionAlrea...
[ "async def reload_all(self, ctx):\r\n\r\n\t\tmessage = await ctx.send('Reloading...')\r\n\t\tawait ctx.message.delete()\r\n\t\ttry:\r\n\t\t\tfor cog in listdir('./cogs'):\r\n\t\t\t\tif cog.endswith('.py') == True:\r\n\t\t\t\t\tself.bot.reload_extension(f'cogs.{cog[:-3]}')\r\n\t\texcept Exception as exc:\r\n\t\t\taw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test AnnualLeaveForm with decimal days.
def test_annual_leave_form_decimals(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) request = self.factory.get("/") request.session = {} request.user = AnonymousUser() data = {...
[ "def test_leaveform_max_days(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days = 10\n staffprofile.save()\n\n requ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test OverTimeForm with overlap for existing objects.
def test_overtime_form_process_with_overlap(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) request = self.factory.get("/") request.session = {} request.user = AnonymousUser() ...
[ "def test_create_overlapping(self):\n self.client.force_authenticate(user=self.admin)\n\n data = {\n 'period': reverse('period-detail', args=[self.period.id]),\n 'price': '10.00', # Will use Period's price if not provided\n 'start_time': LOCAL_TIMEZONE.localize(dateti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test OverTimeForm start end fields.
def test_overtime_form_start_end(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) request = self.factory.get("/") request.session = {} request.user = AnonymousUser() start = dat...
[ "def test_overtime_form_process_with_overlap(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n\n request = self.factory.get(\"/\")\n request.session = {}\n request.user = Anon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test LeaveForm apply for leave.
def test_leaveform_apply(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory.get(...
[ "def test_leaveform_no_overlap(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days = 10\n staffprofile.save()\n\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test application for one day leave.
def test_one_day_leave(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory.get("/...
[ "def Daysleftverification():\n pass", "def test_interview_applications_expired():\n test_username = \"test_user\"\n\n user = UserFactory.create(username=test_username, is_active=True)\n UserSocialAuthFactory.create(user=user, provider=\"edX\")\n\n assert user.is_active is True\n assert \"retired...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test LeaveForm no overlap.
def test_leaveform_no_overlap(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory...
[ "def test_leaveform_process_with_overlap(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days = 10\n staffprofile.save()\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test LeaveForm process works even if leave object exists.
def test_leaveform_process_with_overlap(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = se...
[ "def test_leaveform_no_overlap(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days = 10\n staffprofile.save()\n\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test LeaveForm apply for sick leave.
def test_sickleave_apply(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory.get(...
[ "def test_leaveform_apply(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days = 10\n staffprofile.save()\n\n request...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test LeaveForm process sick leave.
def test_sickleave_process(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory.ge...
[ "def leave(self):\n pass", "def test_leaveform_process_with_overlap(self):\n user = mommy.make(\"auth.User\", first_name=\"Bob\", last_name=\"Ndoe\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n staffprofile.leave_days = 21\n staffprofile.sick_days =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test leave days sufficient.
def test_leaveform_max_days(self): user = mommy.make("auth.User", first_name="Bob", last_name="Ndoe") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) staffprofile.leave_days = 21 staffprofile.sick_days = 10 staffprofile.save() request = self.factory.g...
[ "def Daysleftverification():\n pass", "def leave_days(self) -> int:\n return self._leave_days", "def isLeaveLeft(self,leave_type,days):\n if leave_type == 1 :\n return days<=self.earned_balance\n elif leave_type == 2 :\n return days<=self.hp_balance\n elif l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test StaffProfileUserForm image not required on update.
def test_staffprofile_user_form_no_image(self): user = mommy.make("auth.User") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) request = self.factory.get("/") request.session = {} request.user = AnonymousUser() path = os.path.join(BASE_DIR, "tests", ...
[ "def test_staffprofile_admin_form_no_image(self):\n user = mommy.make(\"auth.User\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n\n request = self.factory.get(\"/\")\n request.session = {}\n request.user = AnonymousUser()\n\n path = os.path.join...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test StaffProfileAdminForm image not required when editting.
def test_staffprofile_admin_form_no_image(self): user = mommy.make("auth.User") staffprofile = mommy.make("small_small_hr.StaffProfile", user=user) request = self.factory.get("/") request.session = {} request.user = AnonymousUser() path = os.path.join(BASE_DIR, "tests",...
[ "def test_staffprofile_user_form_no_image(self):\n user = mommy.make(\"auth.User\")\n staffprofile = mommy.make(\"small_small_hr.StaffProfile\", user=user)\n\n request = self.factory.get(\"/\")\n request.session = {}\n request.user = AnonymousUser()\n\n path = os.path.join(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert a TSV row to a dict
def tsvRowToDict(row): return {col: getattr(row, col) for col in row._columns_}
[ "def tsv_pairs_to_dict(line: str, key_lower: bool = True) -> Dict[str, str]:\n items = line.split(\"\\t\")\n d = {} # type: Dict[str, str]\n for chunk in chunks(items, 2):\n if len(chunk) < 2:\n log.warning(\"Bad chunk, not of length 2: {!r}\", chunk)\n continue\n key =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Testing whether the clusters are correctly created and if the old and new dataframes are the exact same aside from the Topic column
def test_cluster_embeddings(base_bertopic, samples, features, centers): embeddings, _ = make_blobs(n_samples=samples, centers=centers, n_features=features, random_state=42) documents = [str(i + 1) for i in range(embeddings.shape[0])] old_df = pd.DataFrame({"Document": documents, "...
[ "def test_assign_clusters_sparse(self, new_data, filename):\n\n sqlalchemy_conn_str = open('../conf/sqlalchemy_conn_str.txt', 'r').read()\n engine = create_engine(sqlalchemy_conn_str)\n \n print('creating test sparse matrix...')\n if self.split_type == 'random':\n avera...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether the topics are correctly extracted using cTFIDF
def test_extract_topics(base_bertopic): nr_topics = 5 documents = pd.DataFrame({"Document": newsgroup_docs, "ID": range(len(newsgroup_docs)), "Topic": np.random.randint(-1, nr_topics-1, len(newsgroup_docs))}) base_bertopic._update_topic_size(docume...
[ "def test_extract_topics():\n nr_topics = 5\n documents = pd.DataFrame({\"Document\": newsgroup_docs,\n \"ID\": range(len(newsgroup_docs)),\n \"Topic\": np.random.randint(-1, nr_topics-1, len(newsgroup_docs))})\n model = BERTopic()\n model._updat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace terminator with given operator.
def replaceTerminator(self, op): self._children[0].replaceTerminator(op)
[ "def replaceTerminator(self, op):\n if not (op in (',', ';')):\n raise RuntimeError(\"invalid replacement terminator for GlslBlockStatement: '%s'\" % (op))\n self.__terminator = op", "def _remove_operator(self, operator):", "def change_operator(self, text):\n self.operator = text...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tell if given object is GlslBlockUnary.
def is_glsl_block_unary(op): return isinstance(op, GlslBlockUnary)
[ "def is_glsl_block_function(op):\n return isinstance(op, GlslBlockFunction)", "def isLux(self):\n return _libsbml.Unit_isLux(self)", "def IsByBlock(self) -> bool:", "def _is_unary_op(op):\n if op.type == TokenType.BitwiseNot:\n return True\n return False", "def is_unary(st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
创建appium启动命令,比如appium p 4723 bp 4724 U 00001234
def create_command_list(self,i): command_list = [] appium_port_list = self.create_port_list(4000) bootstrap_port_list = self.create_port_list(4900) device_list = self.device_list command = "appium -p "+str(appium_port_list[i])+" -bp "+str(bootstrap_port_list[i])+" -U "+device_lis...
[ "def getCmd(self):\n rootDirectory = appiumPath[:2]\n startCMD = \"node node_modules\\\\appium\\\\bin\\\\appium.js\"\n\n\n cmd =rootDirectory+\"&\"+\"cd \"+appiumPath+\"&\"+startCMD\n print cmd\n\n return cmd", "def adb(command):\n run_command(\"adb {}\".format(command))", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user channel (AdminDeleteAllUserChannels)
def admin_delete_all_user_channels( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = AdminDeleteAl...
[ "async def admin_delete_all_user_channels_async(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user channel (AdminDeleteAllUserChannels)
async def admin_delete_all_user_channels_async( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = A...
[ "def admin_delete_all_user_channels(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n request ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user content (AdminDeleteAllUserContents)
def admin_delete_all_user_contents( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = AdminDeleteAl...
[ "async def admin_delete_all_user_contents_async(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user content (AdminDeleteAllUserContents)
async def admin_delete_all_user_contents_async( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = A...
[ "def admin_delete_all_user_contents(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n request ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user group (AdminDeleteAllUserGroup)
def admin_delete_all_user_group( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = AdminDeleteAllUs...
[ "async def admin_delete_all_user_group_async(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all user group (AdminDeleteAllUserGroup)
async def admin_delete_all_user_group_async( user_id: str, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = Admi...
[ "def admin_delete_all_user_group(\n user_id: str,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n return None, error\n request = A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connects to the source and target databases, then migrates a list of defined schema.
def main(): msg = """ ----------------------------------------------------- \n Running this script will delete the target database! \n And it will close connections on the target database. \n Are you sure you wish to continue? (y/n) \n ---------------------------------------------...
[ "def _migrate_data(schema,source_config,target_config,migration_config):\n # create database connections\n source_engine = connect_to_source(source_config)\n target_engine = connect_to_target(target_config,target_config['database'])\n \n # load the schema metadata profile\n source_metadata = sqlal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for hop_id, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/hop_id (string)
def _get_hop_id(self): return self.__hop_id
[ "def _set_hop_id(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n try:\n t = YANGDynClass(v,base=unicode, is_l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for hop_id, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/hop_id (string)
def _set_hop_id(self, v, load=False): parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") try: t = YANGDynClass(v,base=unicode, is_leaf=True, yang_nam...
[ "def _set_hop(self, v, load=False):\n try:\n t = YANGDynClass(v,base=YANGListType(\"hop_id\",yc_hop_pyangbind_example__input_LocatorRecord_rloc_explicit_locator_path_hop, yang_name=\"hop\", parent=self, is_container='list', user_ordered=True, path_helper=self._path_helper), is_container='list', yang_name=\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for address, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/address (simpleaddress)
def _set_address(self, v, load=False): try: t = YANGDynClass(v,base=[unicode,unicode,unicode,unicode,unicode,], is_leaf=True, yang_name="address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""address...
[ "def set_address(self, a_address):\n self.set_parameter('address', a_address)\n return self", "def set_address(self, address):\n if address == \"\":\n self.address = Address(\"\", \"\", \"\")\n else:\n self.address = address", "def create_address(self, address:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for lrs_bits, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/lrs_bits (string)
def _get_lrs_bits(self): return self.__lrs_bits
[ "def _set_lrs_bits(self, v, load=False):\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"lrs-bits\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"lrs_bits must be of a type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for lrs_bits, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/lrs_bits (string)
def _set_lrs_bits(self, v, load=False): try: t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="lrs-bits", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""lrs_bits must be of a type compatible wi...
[ "def _get_lrs_bits(self):\n return self.__lrs_bits", "def set_bits(self, bits):\n if 5 < bits < 65:\n self.bits = bits", "def test_bit_lscan_across_bytes(self):\n value = False\n ops = [bitwise_operations.bit_lscan(self.test_bin_ones, 7, 8, value)]\n\n expected_value = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for hop, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop (list)
def _set_hop(self, v, load=False): try: t = YANGDynClass(v,base=YANGListType("hop_id",yc_hop_pyangbind_example__input_LocatorRecord_rloc_explicit_locator_path_hop, yang_name="hop", parent=self, is_container='list', user_ordered=True, path_helper=self._path_helper), is_container='list', yang_name="hop", parent...
[ "def _set_explicit_locator_path(self, v, load=False):\n try:\n t = YANGDynClass(v,base=yc_explicit_locator_path_pyangbind_example__input_LocatorRecord_rloc_explicit_locator_path, is_container='container', yang_name=\"explicit-locator-path\", parent=self, path_helper=self._path_helper, extmethods=self._extme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for address_type, mapped from YANG variable /input/LocatorRecord/rloc/address_type (string)
def _get_address_type(self): return self.__address_type
[ "def address_type(self):\n return self._address_type", "def _set_address_type(self, v, load=False):\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"address-type\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeErro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for address_type, mapped from YANG variable /input/LocatorRecord/rloc/address_type (string)
def _set_address_type(self, v, load=False): try: t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="address-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""address_type must be of a type c...
[ "def address_type(self, address_type):\n\n self._address_type = address_type", "def address_type(self, address_type):\n self._address_type = address_type", "def address_type(self):\n return self._address_type", "def _get_address_type(self):\n return self.__address_type", "def type_ad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for explicit_locator_path, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path (container)
def _get_explicit_locator_path(self): return self.__explicit_locator_path
[ "def _set_explicit_locator_path(self, v, load=False):\n try:\n t = YANGDynClass(v,base=yc_explicit_locator_path_pyangbind_example__input_LocatorRecord_rloc_explicit_locator_path, is_container='container', yang_name=\"explicit-locator-path\", parent=self, path_helper=self._path_helper, extmethods=self._extme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for explicit_locator_path, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path (container)
def _set_explicit_locator_path(self, v, load=False): try: t = YANGDynClass(v,base=yc_explicit_locator_path_pyangbind_example__input_LocatorRecord_rloc_explicit_locator_path, is_container='container', yang_name="explicit-locator-path", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, re...
[ "def _get_explicit_locator_path(self):\n return self.__explicit_locator_path", "def _set_explicit_path_name(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name=\"explicit-path-name\", parent=self, path_helper=sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for locator_id, mapped from YANG variable /input/LocatorRecord/locator_id (string)
def _get_locator_id(self): return self.__locator_id
[ "def _set_locator_id(self, v, load=False):\n parent = getattr(self, \"_parent\", None)\n if parent is not None and load is False:\n raise AttributeError(\"Cannot set keys directly when\" +\n \" within an instantiated list\")\n\n try:\n t = YANGDynClass(v,base=unicode, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for locator_id, mapped from YANG variable /input/LocatorRecord/locator_id (string)
def _set_locator_id(self, v, load=False): parent = getattr(self, "_parent", None) if parent is not None and load is False: raise AttributeError("Cannot set keys directly when" + " within an instantiated list") try: t = YANGDynClass(v,base=unicode, is_leaf=True, yang...
[ "def _set_LocatorRecord(self, v, load=False):\n try:\n t = YANGDynClass(v,base=YANGListType(\"locator_id\",yc_LocatorRecord_pyangbind_example__input_LocatorRecord, yang_name=\"LocatorRecord\", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper), is_container='list', yang_nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for priority, mapped from YANG variable /input/LocatorRecord/priority (uint8)
def _set_priority(self, v, load=False): try: t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name="priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""priority must be of a type compatible w...
[ "def _set_priority(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['1..254']}), default=RestrictedCl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for weight, mapped from YANG variable /input/LocatorRecord/weight (uint8)
def _set_weight(self, v, load=False): try: t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name="weight", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""weight must be of a type compatible with ba...
[ "def _set_weight(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name=\"weight\", rest_name=\"weight\", parent=self, pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for multicastPriority, mapped from YANG variable /input/LocatorRecord/multicastPriority (uint8)
def _get_multicastPriority(self): return self.__multicastPriority
[ "def _set_multicastPriority(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"multicastPriority\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"multica...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for multicastPriority, mapped from YANG variable /input/LocatorRecord/multicastPriority (uint8)
def _set_multicastPriority(self, v, load=False): try: t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name="multicastPriority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""multicastPriority mus...
[ "def _get_multicastPriority(self):\n return self.__multicastPriority", "def _set_multicastWeight(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"multicastWeight\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for multicastWeight, mapped from YANG variable /input/LocatorRecord/multicastWeight (uint8)
def _get_multicastWeight(self): return self.__multicastWeight
[ "def _set_multicastWeight(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"multicastWeight\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"multicastWe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for multicastWeight, mapped from YANG variable /input/LocatorRecord/multicastWeight (uint8)
def _set_multicastWeight(self, v, load=False): try: t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name="multicastWeight", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""multicastWeight must be o...
[ "def _get_multicastWeight(self):\n return self.__multicastWeight", "def _set_weight(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"weight\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for localLocator, mapped from YANG variable /input/LocatorRecord/localLocator (boolean)
def _get_localLocator(self): return self.__localLocator
[ "def _set_localLocator(self, v, load=False):\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"localLocator\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"localLocator must...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for localLocator, mapped from YANG variable /input/LocatorRecord/localLocator (boolean)
def _set_localLocator(self, v, load=False): try: t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="localLocator", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""localLocator must be of a type ...
[ "def _get_localLocator(self):\n return self.__localLocator", "def is_local(ip):\n t = ipaddress.ip_address(ip.split(\"/\")[0])\n return t.is_link_local", "def is_link_local_address(ip_addr):\n _logger.debug('%s', where_am_i())\n try:\n this_ipaddr = ipaddress.ip_address(ip_addr)\n excep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for rlocProbed, mapped from YANG variable /input/LocatorRecord/rlocProbed (boolean)
def _get_rlocProbed(self): return self.__rlocProbed
[ "def _set_rlocProbed(self, v, load=False):\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"rlocProbed\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"rlocProbed must be of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for rlocProbed, mapped from YANG variable /input/LocatorRecord/rlocProbed (boolean)
def _set_rlocProbed(self, v, load=False): try: t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="rlocProbed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""rlocProbed must be of a type compat...
[ "def _get_rlocProbed(self):\n return self.__rlocProbed", "def pr(self):\n if self.rapp or self.pointe:\n return True\n else:\n return False", "def _set_rloc(self, v, load=False):\n try:\n t = YANGDynClass(v,base=yc_rloc_pyangbind_example__input_LocatorRecord_rloc, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for routed, mapped from YANG variable /input/LocatorRecord/routed (boolean)
def _get_routed(self): return self.__routed
[ "def is_route_throu(self):\n\n # VPR stores route-through LUTs as \"open\" blocks with mode set to\n # \"wire\".\n return self.is_leaf and self.name == \"open\" and self.mode == \"wire\"", "def can_location_be_routed_to(location: CommonLocation) -> bool:\n return CommonLocationUtils.ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for routed, mapped from YANG variable /input/LocatorRecord/routed (boolean)
def _set_routed(self, v, load=False): try: t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="routed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""routed must be of a type compatible with ba...
[ "def routed_to(self, routed_to):\n\n self._routed_to = routed_to", "def can_location_be_routed_to(location: CommonLocation) -> bool:\n return CommonLocationUtils.can_position_be_routed_to(location.transform.translation, location.routing_surface)", "def use_routes(self) -> Optional[pulumi.Input[boo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for rloc, mapped from YANG variable /input/LocatorRecord/rloc (container)
def _get_rloc(self): return self.__rloc
[ "def _set_rloc(self, v, load=False):\n try:\n t = YANGDynClass(v,base=yc_rloc_pyangbind_example__input_LocatorRecord_rloc, is_container='container', yang_name=\"rloc\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for rloc, mapped from YANG variable /input/LocatorRecord/rloc (container)
def _set_rloc(self, v, load=False): try: t = YANGDynClass(v,base=yc_rloc_pyangbind_example__input_LocatorRecord_rloc, is_container='container', yang_name="rloc", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueE...
[ "def _get_rloc(self):\n return self.__rloc", "def roster_location(self, roster_location):\n\n self._roster_location = roster_location", "def _set_rlocProbed(self, v, load=False):\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"rlocProbed\", parent=self, path_helper=self._p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for recordTtl, mapped from YANG variable /input/mapping_record/recordTtl (int32)
def _get_recordTtl(self): return self.__recordTtl
[ "def _set_recordTtl(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.int32, is_leaf=True, yang_name=\"recordTtl\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"recordTtl must be of a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for recordTtl, mapped from YANG variable /input/mapping_record/recordTtl (int32)
def _set_recordTtl(self, v, load=False): try: t = YANGDynClass(v,base=np.int32, is_leaf=True, yang_name="recordTtl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""recordTtl must be of a type compatibl...
[ "def _get_recordTtl(self):\n return self.__recordTtl", "def ttl(self, value):\n self._ttl = value\n self.api_args['ttl'] = self._ttl\n self._update_record(self.api_args)", "def ttl_seconds(self, ttl_seconds: \"int\"):\n self._attrs[\"ttlSeconds\"] = ttl_seconds", "def record_dur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for maskLength, mapped from YANG variable /input/mapping_record/maskLength (uint8)
def _get_maskLength(self): return self.__maskLength
[ "def _set_maskLength(self, v, load=False):\n try:\n t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name=\"maskLength\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True)\n except (TypeError, ValueError):\n raise ValueError(\"\"\"maskLength must be of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter method for maskLength, mapped from YANG variable /input/mapping_record/maskLength (uint8)
def _set_maskLength(self, v, load=False): try: t = YANGDynClass(v,base=np.uint8, is_leaf=True, yang_name="maskLength", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True) except (TypeError, ValueError): raise ValueError("""maskLength must be of a type compat...
[ "def _get_maskLength(self):\n return self.__maskLength", "def mask_size(self):\n m = self.size * self.mask()\n return m.astype(np.int8)", "def get_mask_length(self, netmask):\n netmask = netmask.split('.')\n netmask_list = [format(int(x), '08b') for x in netmask]\n netmask = ''.j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }