query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get sure authentication information is in place.
def _consolidate_auth(ssh_password=None, ssh_pkey=None, ssh_pkey_password=None, allow_agent=True, host_pkey_directories=None, logger=None): ssh_loaded_pkeys = SSHTunnelForwarder.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth(self):\n return auth.get_auth()", "def get_auth(self, username, password):\n raise NotImplementedError()", "def auth(self):\n return auth.get_auth()", "def auth(self):\r\n basic = parse_auth(self.environ.get('HTTP_AUTHORIZATION',''))\r\n if basic: return basic\r\n ...
[ "0.74612933", "0.72850025", "0.72716", "0.72411764", "0.7184951", "0.71784294", "0.7149381", "0.7101719", "0.705079", "0.70040876", "0.70040876", "0.70040876", "0.69751406", "0.68686587", "0.68462", "0.6831169", "0.6754727", "0.67471904", "0.67454696", "0.67423177", "0.673840...
0.0
-1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n paramiko.util.log_to_file(LOG)\n trans = paramiko.Transport((HOST, 22))\n rsa_key = paramiko.RSAKey.from_private_key_file(KEY)\n trans.connect(username=USER, pkey=rsa_key)\n sftp = paramiko.SFTPClient.from_transport(trans)\n \n return trans, sftp", "def ssh_tunnel(self):\n ...
[ "0.67360616", "0.6717303", "0.66640174", "0.65196717", "0.65074384", "0.6271527", "0.6258517", "0.6214405", "0.61691695", "0.60874236", "0.6065305", "0.6048453", "0.60281336", "0.6024088", "0.5985701", "0.59793967", "0.5929255", "0.5899957", "0.5889407", "0.5888757", "0.58854...
0.7293791
0
Create SSH tunnels on top of a transport to the remote gateway
def _create_tunnels(self): if not self.is_active: try: self._connect_to_gateway() except socket.gaierror: # raised by paramiko.Transport msg = 'Could not resolve IP address for {0}, aborting!' \ .format(self.ssh_host) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ssh_tunnel(self):\n\n host = self.sshTunnelDict[\"ssh_ip\"]\n user = self.sshTunnelDict[\"ssh_user\"]\n password = self.sshTunnelDict[\"ssh_password\"]\n sfcs = self.sshTunnelDict[\"target_ip\"]\n\n tunnel_command = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec...
[ "0.7722363", "0.7460762", "0.7208855", "0.6948237", "0.69274014", "0.68486375", "0.6775776", "0.67591363", "0.665079", "0.66469735", "0.6529589", "0.6475422", "0.6457118", "0.63768345", "0.62646735", "0.6221482", "0.6195248", "0.6111581", "0.61109716", "0.6106094", "0.6094818...
0.73525786
2
Processes optional deprecate arguments
def _process_deprecated(attrib, deprecated_attrib, kwargs): if deprecated_attrib not in _DEPRECATIONS: raise ValueError('{0} not included in deprecations list' .format(deprecated_attrib)) if deprecated_attrib in kwargs: warnings.warn("'{0}' is DEPRECA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deprecate_args(self):\n @deprecate(arguments={\"bar\": \"use foo instead\"})\n def foo(a, foo=None, bar=None):\n return 2*a\n\n with warnings.catch_warnings(record=True) as w:\n self.assertEqual(foo(1, bar=True), 2,\n \"Decorated funct...
[ "0.73999906", "0.6976863", "0.63142896", "0.6207285", "0.59226304", "0.5894407", "0.58403707", "0.5708147", "0.5694695", "0.5657458", "0.5592077", "0.5549409", "0.5502855", "0.5482941", "0.5472101", "0.5454593", "0.5416712", "0.54065835", "0.53642625", "0.5352613", "0.5322042...
0.6877066
2
Get SSH Public key from a private key file, given an optional password
def read_private_key_file(pkey_file, pkey_password=None, key_type=None, logger=None): ssh_pkey = None key_types = (paramiko.RSAKey, paramiko.DSSKey, paramiko.ECDSAKey) if hasattr(paramiko, 'Ed25519Key'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_key(fn, psw=None):\n if not fn:\n die(\"Need private key\")\n if psw:\n psw = as_bytes(psw)\n data = load_gpg_file(fn)\n key = load_pem_private_key(data, password=psw, backend=get_backend())\n return key", "def read_public_key(f: IO[str]) -> Tuple[str, str, str, str]:\n d...
[ "0.69817156", "0.673474", "0.6533365", "0.65328616", "0.64097625", "0.6392237", "0.63854355", "0.6375244", "0.636917", "0.6322919", "0.6300791", "0.62696934", "0.6261449", "0.62329763", "0.62003213", "0.6167222", "0.61617774", "0.6142141", "0.60908985", "0.6060834", "0.603078...
0.6498655
4
Start the SSH tunnels
def start(self): if self.is_alive: self.logger.warning('Already started!') return self._create_tunnels() if not self.is_active: self._raise(BaseSSHTunnelForwarderError, reason='Could not establish session to SSH gateway') for _s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ssh_tunnel(self):\n\n host = self.sshTunnelDict[\"ssh_ip\"]\n user = self.sshTunnelDict[\"ssh_user\"]\n password = self.sshTunnelDict[\"ssh_password\"]\n sfcs = self.sshTunnelDict[\"target_ip\"]\n\n tunnel_command = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChec...
[ "0.76167727", "0.7459734", "0.7330725", "0.69758075", "0.68948084", "0.6830999", "0.68144363", "0.6813775", "0.6757966", "0.6692203", "0.66676366", "0.65749454", "0.64996797", "0.64498323", "0.64260966", "0.64034295", "0.6401121", "0.6363639", "0.6285617", "0.6274053", "0.626...
0.741053
2
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stop_transport(self, force=False):\n try:\n self._check_is_started()\n except (BaseSSHTunnelForwarderError,\n HandlerSSHTunnelForwarderError) as e:\n self.logger.warning(e)\n if force and self.is_active:\n # don't wait connections\n ...
[ "0.77367306", "0.6694203", "0.65290046", "0.64633465", "0.6440187", "0.64118755", "0.63934726", "0.6372723", "0.63686204", "0.6336779", "0.6279869", "0.62692505", "0.62551904", "0.6253709", "0.622172", "0.62026864", "0.6190491", "0.6169963", "0.61657774", "0.6155323", "0.6127...
0.77172184
1
Restart connection to the gateway and tunnels
def restart(self): self.stop() self.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconnect(self):\n # set up the reconnection\n if self.resume_url:\n self.url = self.resume_url\n elif self.gateway:\n self.url = self.gateway\n else:\n # we don't know where to reconnect to! we'll start from the beginning\n self.url = Non...
[ "0.67852813", "0.671436", "0.6603923", "0.6468004", "0.64539474", "0.644653", "0.6435847", "0.6420449", "0.6393116", "0.63901263", "0.6321637", "0.6303978", "0.62923455", "0.62328756", "0.62238485", "0.6218733", "0.6194535", "0.6163187", "0.61534184", "0.6136315", "0.6131796"...
0.61432856
20
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_open(self):\n logger.debug(\"entering session_open()\")\n kwargs = {\"hostname\": self.host, \"username\": self.user}\n ssh_client = paramiko.SSHClient()\n ssh_client.load_system_host_keys()\n ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n s...
[ "0.75185007", "0.69287705", "0.67997575", "0.6714912", "0.6696348", "0.66660726", "0.66601133", "0.65854514", "0.65743357", "0.65551376", "0.65543604", "0.65050286", "0.6448243", "0.6445054", "0.6422562", "0.6422422", "0.6381381", "0.63182485", "0.628655", "0.62543863", "0.62...
0.73891294
1
Wrapper for the server created for a SSH forward
def _serve_forever_wrapper(self, _srv, poll_interval=0.1): self.logger.info('Opening tunnel: {0} <> {1}'.format( address_to_str(_srv.local_address), address_to_str(_srv.remote_address)) ) _srv.serve_forever(poll_interval) # blocks until finished self.logger.info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_ssh_forward_server(self, remote_address, local_bind_address):\n _Handler = self._make_ssh_forward_handler_class(remote_address)\n try:\n forward_maker_class = self._make_stream_ssh_forward_server_class \\\n if isinstance(local_bind_address, string_types) \\\n ...
[ "0.752678", "0.69026464", "0.67292887", "0.66973126", "0.6514152", "0.6424588", "0.6388258", "0.63314724", "0.62933445", "0.61964303", "0.60787207", "0.6000514", "0.59499925", "0.59399146", "0.59399146", "0.5909443", "0.5890284", "0.58744335", "0.5854002", "0.58441603", "0.58...
0.5086837
100
Close the underlying transport when nothing more is needed
def _stop_transport(self, force=False): try: self._check_is_started() except (BaseSSHTunnelForwarderError, HandlerSSHTunnelForwarderError) as e: self.logger.warning(e) if force and self.is_active: # don't wait connections self.logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self) -> None:\n self.transport.close()", "def close(self):\n if self.transport.isOpen():\n self.transport.close()", "def close(self):\n if self._closing or self._handle.closed:\n return\n elif self._protocol is None:\n raise TransportError...
[ "0.8397016", "0.8330526", "0.7809539", "0.76331574", "0.7572369", "0.754654", "0.74229544", "0.7370382", "0.7349306", "0.73377025", "0.72321033", "0.7181328", "0.709992", "0.7069885", "0.70636714", "0.70626295", "0.7044853", "0.70388544", "0.7024966", "0.7024966", "0.7024966"...
0.0
-1
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]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ports(self):\n return self._ports", "def ports(self) -> List[int]:\n if self.head_port:\n return [self.head_port]\n else:\n ports = []\n for replica in self.pod_args['pods'][0]:\n if isinstance(replica.port, list):\n ...
[ "0.71080494", "0.70984805", "0.70850456", "0.706947", "0.69653106", "0.6954283", "0.68551344", "0.68414927", "0.6839134", "0.6836259", "0.67883843", "0.67638737", "0.6759709", "0.6700629", "0.66362476", "0.6629589", "0.66145587", "0.659666", "0.65552", "0.6541116", "0.6525449...
0.7267724
0
Return a list containing the IP addresses listening for the tunnels
def local_bind_hosts(self): self._check_is_started() return [_server.local_host for _server in self._server_list if _server.local_host is not None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address(self):\n addrlist = []\n for s in self.srv_socks:\n addrlist.append(s.getsockname())\n return addrlist", "def local_bind_addresses(self):\n self._check_is_started()\n return [_server.local_address for _server in self._server_list]", "def get_addrs(self)...
[ "0.7251004", "0.6936114", "0.68971246", "0.6813181", "0.6800141", "0.674338", "0.6739849", "0.6698151", "0.64847016", "0.64798045", "0.6459496", "0.64495444", "0.6449533", "0.6418056", "0.64012223", "0.6391095", "0.6345516", "0.62977296", "0.62613714", "0.6240623", "0.6239488...
0.62892675
18
Return a list of (IP, port) pairs for the local side of the tunnels
def local_bind_addresses(self): self._check_is_started() return [_server.local_address for _server in self._server_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 tunnel_bindings(self):\n return dict((_server.remote_address, _server.local_address) for\n _serve...
[ "0.6985413", "0.67960286", "0.6575408", "0.6561721", "0.64561266", "0.6382456", "0.6365156", "0.6276254", "0.6269147", "0.6266861", "0.62633765", "0.62541103", "0.6244484", "0.6186982", "0.614011", "0.61371094", "0.6132027", "0.61198467", "0.61084265", "0.6073711", "0.6056261...
0.6428461
5
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])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_connections(self):\r\n\r\n self.remote = self.newest_connections[~((self.newest_connections['remote_address'] == '0.0.0.0') | (self.newest_connections['remote_address'] == '127.0.0.1'))]\r\n return self.remote", "def bindings(self):\n return self.__bindings", "def tunnel(self):\n ...
[ "0.62615836", "0.6211017", "0.61059785", "0.60165507", "0.59712064", "0.5943763", "0.5931612", "0.5906434", "0.5779625", "0.57694745", "0.5747807", "0.56731176", "0.5661168", "0.5645949", "0.5590057", "0.5546492", "0.55099237", "0.5508082", "0.5494753", "0.5438664", "0.542293...
0.84435135
0
Return True if the underlying SSH transport is up
def is_active(self): if ( '_transport' in self.__dict__ and self._transport.is_active() ): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def ping_ssh(self) -> bool:\n # pause logic\n if not self.running.is_set():\n self.add_to_output(\"Paused...\")\n await self.running.wait()\n\n # ping port 22 (SSH)\n if await self.ping(22):\n # ping returned true, SSH is up\n return True\n ...
[ "0.79044145", "0.7884857", "0.7526754", "0.74974775", "0.7468619", "0.74337703", "0.73547006", "0.73482627", "0.68501896", "0.6816518", "0.6807784", "0.6785434", "0.67848927", "0.67689097", "0.66942257", "0.66915476", "0.667076", "0.66581416", "0.66488606", "0.6633662", "0.65...
0.6350466
35
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_tuple(self):\n\n return (self.address, int(self.port))", "def localhost_address_tuple(self):\n\n return (\"127.0.0.1\", int(self.port))", "def address(self) -> tuple[str, int]:", "def get_ip_port_tshark(str_data):\n separator = str_data.rindex(\":\")\n ip = str_data[:separator...
[ "0.65942574", "0.6388307", "0.62693864", "0.6202907", "0.61671025", "0.61671025", "0.6098779", "0.60970616", "0.60473275", "0.6044083", "0.5978591", "0.59327024", "0.59112835", "0.5846814", "0.5834561", "0.5809299", "0.57478064", "0.56925285", "0.56547385", "0.5647703", "0.56...
0.7255948
0
Parse arguments directly passed from CLI
def _parse_arguments(args=None): parser = argparse.ArgumentParser( description='Pure python ssh tunnel utils\n' 'Version {0}'.format(__version__), formatter_class=argparse.RawTextHelpFormatter ) parser.add_argument( 'ssh_address', type=str, help='...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_cli():\n parser = OptionParser()\n return parser.parse_args()", "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.par...
[ "0.8305208", "0.8062119", "0.7918989", "0.7918218", "0.7830402", "0.7823084", "0.7759304", "0.7728373", "0.7688399", "0.76670164", "0.7635195", "0.76263005", "0.76129746", "0.76089156", "0.7604629", "0.76003647", "0.759861", "0.7578532", "0.75707656", "0.7566354", "0.7566261"...
0.0
-1
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, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testExtraArgsSSHTunnel(self):\n fake_ip_addr = \"1.1.1.1\"\n fake_rsa_key_file = \"/tmp/rsa_file\"\n fake_target_vnc_port = 8888\n target_adb_port = 9999\n ssh_user = \"fake_user\"\n fake_port = 12345\n self.Patch(utils, \"PickFreePort\", return_value=fake_port)...
[ "0.6474638", "0.5975455", "0.5935769", "0.59085613", "0.5812909", "0.57935566", "0.57738376", "0.5760542", "0.5744616", "0.57356274", "0.5582266", "0.5520039", "0.55166715", "0.55127615", "0.54224026", "0.5387747", "0.53810596", "0.533782", "0.532005", "0.53157586", "0.531449...
0.6211992
1
Enumerate the modules in parent_package
def get_implementations(parent_package, fullname=True): _, path, _ = imp.find_module(parent_package) implementations = list() for _, name, _ in pkg_iter([path]): if fullname: implementations.append("{0}.{1}".format(parent_package, name)) else: implementations.append("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]:\n return RootModule(self).traverse(*args, **kwargs)", "def modules():", "def _list_all(root_pkg, prog):\n res = \"\\n\".join(\n sorted(\n pkinspect.package_module_names(_import(root_pkg)),\n key=...
[ "0.6468002", "0.6311832", "0.61678976", "0.6164842", "0.61409783", "0.61389405", "0.61365527", "0.61350995", "0.6096555", "0.6049148", "0.6009945", "0.5958909", "0.5953787", "0.59460855", "0.5930283", "0.5917175", "0.58984864", "0.5884332", "0.5833769", "0.5826741", "0.581614...
0.5231772
75
Gets the name of var. Does it from the out most frame innerwards.
def retrieve_name(var): for fi in reversed(inspect.stack()): names = [var_name for var_name, var_val in fi.frame.f_locals.items() if var_val is var] if len(names) > 0: return names[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_name(self, var):\r\n\t\tfor fi in reversed(inspect.stack()):\r\n\t\t\tnames = [var_name for var_name, var_val in fi.frame.f_locals.items() if var_val is var]\r\n\t\t\tif len(names) > 0:\r\n\t\t\t\treturn names[0]\r\n\t\treturn \"<unknown>\"", "def varname(p):\n for line in inspect.getframeinfo(in...
[ "0.81455225", "0.7930359", "0.7819156", "0.7009084", "0.6957741", "0.6743349", "0.6688202", "0.66316736", "0.6627436", "0.6625631", "0.66163677", "0.64834434", "0.6448197", "0.6423761", "0.6421866", "0.6421866", "0.6421866", "0.6404548", "0.637853", "0.63691765", "0.63055044"...
0.78162587
3
Returns the most recently recorded reading object associated with the line
def current(self): return self.reading_set.latest(field_name='time')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(self):\r\n return self._get_instantiation()[1]", "def __read_last_line(self) -> str:\n with open(LOGFILE_OPENINGS, \"r\", encoding=\"utf-8\") as f:\n last_line = f.readlines()[-1]\n return repr(LogLine.from_line(last_line))", "def line(self):\n return self[\"line...
[ "0.6571381", "0.6288097", "0.61782867", "0.61782867", "0.61782867", "0.61782867", "0.610076", "0.60953546", "0.60844404", "0.6082587", "0.60760415", "0.5929439", "0.5909619", "0.58967084", "0.58614737", "0.58490646", "0.58473146", "0.58473146", "0.58350605", "0.5799959", "0.5...
0.6181899
2
Returns the date and time at which the most recent Reding object asscoiated with line was loggeed
def last_checked(self): return self.current().time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current(self):\n\t\treturn self.reading_set.latest(field_name='time')", "def __read_last_line(self) -> str:\n with open(LOGFILE_OPENINGS, \"r\", encoding=\"utf-8\") as f:\n last_line = f.readlines()[-1]\n return repr(LogLine.from_line(last_line))", "def last_time(self) -> datetime:...
[ "0.6097794", "0.6096128", "0.6084223", "0.60819787", "0.6080026", "0.60337305", "0.5909555", "0.5885572", "0.58626854", "0.58602464", "0.5817537", "0.5776486", "0.57711446", "0.57711446", "0.57480025", "0.5747329", "0.5741298", "0.5731036", "0.56945103", "0.5683155", "0.56716...
0.0
-1
Boolean flag for whether the reading is probalby valid, or if someone needs to go out and take a new one
def has_recent_reading(self): latest_reading = self.current().time return timezone.now() - latest_reading < datetime.timedelta(days=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\n return not self.err", "def valid(self) -> bool:\n pass", "def __bool__(self):\r\n return self.valid", "def valid(self) -> bool:\n return True", "def __call__(self, read, info: ModificationInfo):\n return expected_errors(read.qualities) > self.max_err...
[ "0.6500023", "0.6414164", "0.6385272", "0.63608426", "0.63567954", "0.62563515", "0.6218345", "0.6218055", "0.61696386", "0.6169443", "0.6168232", "0.6124805", "0.610261", "0.6093847", "0.60772353", "0.6073999", "0.606319", "0.60532886", "0.60486037", "0.6044673", "0.6022266"...
0.0
-1
THe reference number of the bottle listed in the reading
def ref(self): return self.bottle.ref
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ref_index(self):\n total_pol = self.get_compound_pol()\n molar_volume = self.get_molar_volume()\n if not total_pol:\n return None\n ref_index = np.sqrt((4 * np.pi * total_pol) / ((2.26 - 4 * np.pi / 3) * total_pol + molar_volume) + 1)\n return ref_index", "de...
[ "0.6187323", "0.61432976", "0.6112604", "0.60540026", "0.59829843", "0.5976102", "0.5951885", "0.5948475", "0.59262407", "0.5922211", "0.59036016", "0.5899132", "0.5871037", "0.58575326", "0.5835584", "0.583141", "0.5823899", "0.58146167", "0.58122456", "0.5795709", "0.579217...
0.6673594
0
The PPM concentration of the bottle listed in the reading
def ppm(self): returns self.bottle.ppm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concentration(self):\n return self._gev_bijector.concentration", "def get_chamber_pressure(self):\n raise NotImplementedError", "def get_pressure(self):\n value = self.synth.cbox.get_adcs()[self.id_]\n value = value / self.conf['PSICONV']\n log.debug(\"Current pressure on reg...
[ "0.66019285", "0.6497402", "0.64713126", "0.6396346", "0.6396346", "0.6368716", "0.6292004", "0.62702703", "0.6259624", "0.62568134", "0.62335217", "0.6154439", "0.613111", "0.6127008", "0.6123264", "0.6115031", "0.6099613", "0.6028948", "0.6027236", "0.6018869", "0.59632695"...
0.57675505
33
The % concentration of the bottle listed in the reading
def pct(self): return self.bottle.pct()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concentrations(self):\n return self.quantities/self.volume", "def concentration(self):\n return self._gev_bijector.concentration", "def cone_volume(radius: number, height: number) -> number:\n return 1/3*(pi*radius*radius*height)", "def get_percent_oxygen(self) -> float:\n try:\n ...
[ "0.68100315", "0.67134005", "0.64255685", "0.63955766", "0.6376245", "0.6344226", "0.6183887", "0.6146925", "0.61441064", "0.61116594", "0.60945725", "0.6053003", "0.6053003", "0.6039405", "0.60145545", "0.6013911", "0.5991852", "0.5987661", "0.5981987", "0.59819454", "0.5956...
0.6696517
2
THe gas mix of the associated bottle
def mix(self): return self.bottle.mix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.61490744", "0.5648351", "0.5496578", "0.5425663", "0.5341396", "0.531968", "0.53028226", "0.5288497", "0.5263487", "0.52349967", "0.5207807", "0.52044094", "0.5183879", "0.51709795", "0.51653236", "0.5154777", "0.5135477", "0.5124198", "0.51158786", "0.5088113", "0.5088013...
0.5975279
1
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}") ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __load_cogs(self):\n for cog in self.__cogs.get():\n logging.info('loading %s', cog)\n self.load_extension(cog)", "def reload_cogs(self):\n\n for extension in list(self.extensions):\n try:\n self.reload_extension(extension)\n except err...
[ "0.81047094", "0.6737576", "0.6547387", "0.64138633", "0.627226", "0.61398363", "0.6122156", "0.6012189", "0.58965945", "0.5682925", "0.56692845", "0.5621133", "0.55831224", "0.55609417", "0.5515546", "0.5498867", "0.54932314", "0.5485387", "0.5458083", "0.5417369", "0.541326...
0.85657376
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def reload(self, ctx:utils.Context, *cog_name:str):\n\n cog_name = 'cogs.' + '_'.join([i for i in cog_name])\n\n try:\n self.bot.load_extension(cog_name)\n except commands.ExtensionAlreadyLoaded:\n try:\n self.bot.unload_extension(cog_name)\n ...
[ "0.7033478", "0.69451255", "0.6755757", "0.6755757", "0.67295516", "0.6648899", "0.664729", "0.6645348", "0.65898687", "0.64225334", "0.6355888", "0.6350144", "0.62714565", "0.6174131", "0.6154524", "0.6139652", "0.61350954", "0.60747707", "0.60646397", "0.6044675", "0.604196...
0.773994
0
Set up test class.
def setUp(self): self.factory = RequestFactory() StaffProfile.objects.rebuild() self.manager = mommy.make( "auth.User", first_name="Jane", last_name="Ndoe", email="jane@example.com" ) self.user = mommy.make( "auth.User", first_name="Bob", last_name="Ndoe",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpClass(cls):\r\n print(\"Setting up class for tests!\")\r\n print(\"==========================\")", "def setup_class(cls):\n cls.client = APP.test_client()", "def setUpClass(self):\n super(TestExpedition, self).setUpClass()", "def setUpClass(cls):\n cls.setup_log()\...
[ "0.82913643", "0.80353147", "0.79858536", "0.79453653", "0.7926817", "0.7926817", "0.7926817", "0.7926817", "0.7906681", "0.78691214", "0.7853004", "0.78291124", "0.7777645", "0.7761824", "0.77442104", "0.7739767", "0.7739767", "0.7716223", "0.770661", "0.76721746", "0.765431...
0.0
-1
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 = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7281258", "0.68907803", "0.6889661", "0.6779469", "0.6674891", "0.64672923", "0.6454044", "0.64290416", "0.63169855", "0.627206", "0.6265622", "0.62043196", "0.5948398", "0.5836956", "0.57466686", "0.5738188", "0.57262295", "0.5616313", "0.5578795", "0.5547616", "0.5536841...
0.7893113
0
Test no overlaps on OverTime.
def test_overtime_form_apply_no_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() # 6 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overtime(self):\n if self._overtime != '':\n return True\n return False", "def strong_overlapping(time_1, time_2):\n\n if (time_1[0] <= time_2[0] < time_1[1]) or (time_2[0] <= time_1[0] < time_2[1]):\n return True\n\n return False", "def doesNotOverlap( sel...
[ "0.7011733", "0.68971664", "0.68250376", "0.6657521", "0.6625623", "0.650071", "0.64609796", "0.6365668", "0.6313837", "0.63102996", "0.6303044", "0.61596906", "0.6121786", "0.6109216", "0.6108863", "0.6079076", "0.6043743", "0.6036144", "0.6033408", "0.60260224", "0.6025103"...
0.6123027
12
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() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overtime_form_apply_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\n request = self.factory.get(\"/\")\n request.session = {}\n request.user = Anonymou...
[ "0.76187646", "0.6542121", "0.6452166", "0.62871176", "0.62107134", "0.6148731", "0.6093373", "0.6084772", "0.60275173", "0.59073406", "0.59055", "0.58857536", "0.5885605", "0.58551836", "0.58335024", "0.58335024", "0.5771665", "0.5764608", "0.57556933", "0.57429683", "0.5738...
0.75105304
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_field_start_time_not_bigger_than_end_time(self):\n form = self.make_FieldForm_validated(start_time=\"10:40\", end_time=\"9:00\")\n self.assertListEqual([\"__all__\"], list(form.errors))", "def test_overtime_form_process_with_overlap(self):\n user = mommy.make(\"auth.User\", first_na...
[ "0.69037473", "0.65858287", "0.6472992", "0.6455287", "0.6415512", "0.61734456", "0.6171806", "0.61608535", "0.6140685", "0.61234224", "0.5972017", "0.5946175", "0.59197986", "0.59122825", "0.59088945", "0.58745897", "0.58695656", "0.5765348", "0.5743106", "0.5724506", "0.567...
0.80720454
0
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(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.71491563", "0.7073332", "0.68779004", "0.6833441", "0.6643837", "0.65629363", "0.6559908", "0.63612664", "0.6309911", "0.6163169", "0.6080903", "0.59029245", "0.58312833", "0.56878823", "0.5650338", "0.56020325", "0.5566159", "0.55186003", "0.54910886", "0.54739606", "0.54...
0.75476915
0
Test leave oversubscribe works as expected.
def test_leave_oversubscribe(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....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsubscribe_one_listener(self):\n def listener():\n pass\n\n EVENT_MANAGER.subscribe('test_listener', listener)\n EVENT_MANAGER.unsubscribe(listener)\n self.assertNotIn(listener, EVENT_MANAGER._listeners['test_listener'])", "def test_unsubscribe_any_listener(self):...
[ "0.6582777", "0.63852125", "0.6226362", "0.6208915", "0.62003165", "0.6194426", "0.6193546", "0.6191712", "0.6171387", "0.61459565", "0.61383325", "0.6106073", "0.60780084", "0.60780084", "0.6009808", "0.6006954", "0.6006954", "0.6006954", "0.6006954", "0.6006954", "0.6006307...
0.56653947
37
Test leave oversubscribe when SSHR_ALLOW_OVERSUBSCRIBE is False.
def test_leave_oversubscribe_off(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.fact...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subscriber_access_if_vsg2_goes_down(self):", "def test_subscriber_access_if_vsg1_goes_down(self):", "def onUnsubscribed(self, connection:MQTTConnection, topic:str) -> bool:\n\t\tconnection.subscribedCount -= 1\n\t\treturn True", "def test_nonsubscriber(self) -> None:\n # Create a stream for w...
[ "0.6371895", "0.62998873", "0.5960669", "0.56374156", "0.5566072", "0.5397042", "0.5389959", "0.53855497", "0.53734434", "0.53692496", "0.53615355", "0.5330981", "0.528561", "0.528561", "0.5273113", "0.52712303", "0.5234868", "0.5223918", "0.5223918", "0.5223918", "0.5223918"...
0.0
-1
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("/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_leave_oversubscribe_off(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 ...
[ "0.644819", "0.6436864", "0.63061", "0.61098903", "0.60137403", "0.5964021", "0.59452546", "0.5901124", "0.58988696", "0.5884434", "0.5868431", "0.5864215", "0.5861571", "0.5769738", "0.5756127", "0.5754291", "0.573856", "0.5724665", "0.5720167", "0.57131606", "0.5687971", ...
0.671469
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.67735326", "0.63922834", "0.59517926", "0.5882709", "0.5882709", "0.58206546", "0.5817428", "0.5760936", "0.57062036", "0.56520534", "0.5598502", "0.554994", "0.5541704", "0.5528245", "0.552553", "0.5517636", "0.55156803", "0.5504129", "0.54915005", "0.54858375", "0.547803...
0.7283469
0
Test LeaveForm apply for leave.
def test_leaveform_admin(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(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.75476915", "0.71491563", "0.7073332", "0.6833441", "0.6643837", "0.65629363", "0.6559908", "0.63612664", "0.6309911", "0.6163169", "0.6080903", "0.59029245", "0.58312833", "0.56878823", "0.5650338", "0.56020325", "0.5566159", "0.55186003", "0.54910886", "0.54739606", "0.54...
0.68779004
3
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_leaveform_admin(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...
[ "0.7076453", "0.7010631", "0.6957248", "0.6599136", "0.6582377", "0.6566351", "0.65413404", "0.6510575", "0.62859243", "0.6242199", "0.61983263", "0.59142435", "0.5827286", "0.57848144", "0.5703488", "0.5654972", "0.5579377", "0.5565576", "0.5562733", "0.5536838", "0.5487293"...
0.7320913
0
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(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.71577907", "0.6866498", "0.68400884", "0.6765718", "0.660228", "0.65838856", "0.65016943", "0.6318992", "0.62988096", "0.6177277", "0.60716784", "0.57531554", "0.56196386", "0.5402689", "0.5401456", "0.5372556", "0.53161985", "0.5214679", "0.51996654", "0.51943445", "0.514...
0.7177349
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave(self):\n self.pleaseQuit=1", "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 staffprofil...
[ "0.67501426", "0.6595614", "0.653262", "0.65064394", "0.64996254", "0.64383876", "0.640696", "0.6336153", "0.6308009", "0.6307785", "0.62981766", "0.6237008", "0.62151253", "0.61743563", "0.60905206", "0.60466564", "0.6023712", "0.5977555", "0.5957751", "0.59405535", "0.58503...
0.666937
1
Test start and end.
def test_leaveform_start_end(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....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_to_end(self):\n self.assertTrue(return_true())", "def analyze(self, start, end):\n return", "def test_sequence_start_stop(self):\n self.t(\"1,2 start\")\n code, out, err = self.t(\"_get 1.start 2.start\")\n self.assertRegex(out, \"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{...
[ "0.6762504", "0.67231977", "0.6665791", "0.66374826", "0.6470689", "0.6470181", "0.64129144", "0.6372572", "0.6339321", "0.6333641", "0.6276826", "0.6173073", "0.6129352", "0.6125767", "0.60839885", "0.60775775", "0.60614115", "0.6061186", "0.60559875", "0.604173", "0.6039995...
0.0
-1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Daysleftverification():\n pass", "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 leave_type == 3 :\n return days*2<=self.hp_balance \n ...
[ "0.7283778", "0.69937253", "0.69766676", "0.6856982", "0.6750773", "0.66546655", "0.6651582", "0.6467872", "0.6376243", "0.6373224", "0.6355564", "0.635506", "0.6275747", "0.6274649", "0.62272155", "0.6193317", "0.6190739", "0.6174433", "0.6147189", "0.6145103", "0.6110374", ...
0.7107806
1
Test sick days sufficient.
def test_leaveform_max_sick_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.fact...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sickdays_measures_days(self):\n profile = Profile.objects.first()\n profile.start_sickness = []\n profile.end_sickness = []\n profile.start_sickness.append(\n datetime(2011, 1, 1, 0, 0, 0, tzinfo=pytz.UTC)\n )\n profile.end_sickness.append(\n ...
[ "0.6928755", "0.6744446", "0.6293659", "0.6231591", "0.6156823", "0.6139894", "0.6129999", "0.61228377", "0.6090518", "0.60311055", "0.5975906", "0.59177434", "0.5902503", "0.5895364", "0.58757764", "0.586516", "0.5857773", "0.582823", "0.5810924", "0.5801151", "0.57810354", ...
0.5517918
44
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", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7652241", "0.6728502", "0.66071117", "0.6606162", "0.6591402", "0.6577869", "0.6530034", "0.64637095", "0.640589", "0.6283228", "0.61998254", "0.61802197", "0.6131706", "0.6127896", "0.612147", "0.6116664", "0.6115772", "0.6107535", "0.60589457", "0.60509855", "0.6047661",...
0.78006655
0
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",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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(...
[ "0.7230931", "0.65301496", "0.60166913", "0.6003747", "0.5991661", "0.59901386", "0.5923907", "0.5909916", "0.58569574", "0.58297867", "0.57913953", "0.5783393", "0.5762155", "0.57606184", "0.5758113", "0.569092", "0.5689196", "0.56693393", "0.56252676", "0.5616211", "0.55839...
0.7694595
0
Rearrange Array Elements so as to form two number such that their sum is maximum.
def rearrange_digits(input_list): # We are going to use mergeSort to sort the input_list # in decending order sorted_arr= mergeSort(input_list) ##Once we got the sorted arr then just traverse the arr # and put number in the result[0] and result[1] alternatively result = [0,0] is_ri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pairwise_product_sort(array):\n if len(array) <= 1:\n return 0\n\n array.sort()\n\n return array[-1] * array[-2]", "def max_pairwise_product_linear(array):\n\n if len(array) <= 1:\n return 0\n\n two_biggest_values = [0, 0]\n\n for element in array:\n if element > tw...
[ "0.715025", "0.6826107", "0.6585915", "0.65533787", "0.6124909", "0.6119666", "0.61147255", "0.6050894", "0.6019972", "0.6002009", "0.59506196", "0.5940342", "0.58634776", "0.5849302", "0.5822016", "0.58049995", "0.5801025", "0.5762484", "0.5747661", "0.57456356", "0.5743892"...
0.0
-1
create index by batches.
def create_batches(data_size, batch_size, shuffle=True): batches = [] ids = list(range(data_size)) if shuffle: random.shuffle(ids) for i in range(int(data_size / batch_size)): start = i * batch_size end = (i + 1) * batch_size batches.append(ids[start:end]) rest = data_size % batch_siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_batch(self,batch):\n pass", "def create_index():", "def create_indices():\n destroy_indices()\n\n ActionDocument._index.create(ignore=[400, 404])\n ClassificationDocument._index.create(ignore=[400, 404])\n FunctionDocument._index.create(ignore=[400, 404])\n PhaseDocument._index....
[ "0.7153865", "0.7047159", "0.6538563", "0.64601755", "0.63458204", "0.6279237", "0.6213663", "0.6161867", "0.61057407", "0.6076524", "0.6069283", "0.6044203", "0.6022463", "0.5943686", "0.59244126", "0.5922595", "0.59220165", "0.58969414", "0.58626384", "0.58568513", "0.58550...
0.0
-1
fetch input data by batch.
def fetch_data(data, count, idx_batch, vocab_size): batch_size = len(idx_batch) data_batch = np.zeros((batch_size, vocab_size)) count_batch = [] mask = np.zeros(batch_size) for i, doc_id in enumerate(idx_batch): if doc_id != -1: for word_id, freq in data[doc_id].items(): data_batch[i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_batch_data(batch, ctx):\n data, label = batch\n return (mx.gluon.utils.split_and_load(data, ctx),\n mx.gluon.utils.split_and_load(label, ctx),\n data.shape[0])", "def fetch_batch(self, phase):\n pass", "def fetch(self, batch_size):\n #handling case of arriving...
[ "0.7165248", "0.7155508", "0.6856668", "0.6737644", "0.66595733", "0.6590253", "0.6572885", "0.64899045", "0.6443139", "0.64411473", "0.63972", "0.6371398", "0.63207775", "0.62833846", "0.62427676", "0.62417006", "0.62376314", "0.62264174", "0.61862534", "0.61538064", "0.6147...
0.5790091
68
return a subset of the all_variables by prefix.
def variable_parser(var_list, prefix): ret_list = [] for var in var_list: varname = var.name varprefix = varname.split('/')[0] if varprefix == prefix: ret_list.append(var) return ret_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vars_by_prefix(self, prefix):\n\n t_vars = tf.global_variables()\n return [var for var in t_vars if prefix in var.name]", "def variable_parser(var_list, prefix):\r\n ret_list = []\r\n for var in var_list:\r\n varname = var.name\r\n varprefix = varname.split('/')[0]\r\n if varpref...
[ "0.8116482", "0.6835347", "0.63726485", "0.6177495", "0.60232663", "0.59492016", "0.5925924", "0.59243375", "0.5875041", "0.58261853", "0.5819193", "0.5804013", "0.57915413", "0.57557017", "0.5747941", "0.5744697", "0.57416284", "0.56466186", "0.5612707", "0.55958796", "0.559...
0.67632866
2
Define a linear connection.
def linear(inputs, output_size, no_bias=False, bias_start_zero=False, matrix_start_zero=False, scope=None): with tf.variable_scope(scope or 'Linear'): if matrix_start_zero: matrix_initializer = tf.constant_initializer(0) else: matrix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, source, target):\r\n connection = (self.coalesce_node(source), self.coalesce_node(target))\r\n self.connections.add(connection)", "def add_connection(intersection, angle, distance, in_ln, out_ln, speed_limit, name):\n intersection.add_connection(angle, distance, in_ln, out_ln, ...
[ "0.62165564", "0.6215841", "0.5957279", "0.5951857", "0.59087896", "0.58598775", "0.58492786", "0.5835462", "0.5760685", "0.5749784", "0.57302576", "0.570756", "0.5690498", "0.5617027", "0.5578076", "0.55777466", "0.555002", "0.5545817", "0.5544365", "0.55358344", "0.5535315"...
0.0
-1
Define a linear connection.
def small_linear(inputs, output_size, no_bias=False, bias_start_zero=False, matrix_start_zero=False, scope=None): with tf.variable_scope(scope or 'Linear'): if matrix_start_zero: matrix_initializer = tf.constant_initializer(0) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, source, target):\r\n connection = (self.coalesce_node(source), self.coalesce_node(target))\r\n self.connections.add(connection)", "def add_connection(intersection, angle, distance, in_ln, out_ln, speed_limit, name):\n intersection.add_connection(angle, distance, in_ln, out_ln, ...
[ "0.62165564", "0.6215841", "0.5957279", "0.5951857", "0.59087896", "0.58598775", "0.58492786", "0.5835462", "0.5760685", "0.5749784", "0.57302576", "0.570756", "0.5690498", "0.5617027", "0.5578076", "0.55777466", "0.555002", "0.5545817", "0.5544365", "0.55358344", "0.5535315"...
0.0
-1
Define a linear connection.
def conv(inputs, output_size, mask, matrix_start_zero=False, scope=None): with tf.variable_scope(scope or 'Linear'): if matrix_start_zero: matrix_initializer = tf.constant_initializer(0) else: matrix_initializer = None input_size = inputs.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, source, target):\r\n connection = (self.coalesce_node(source), self.coalesce_node(target))\r\n self.connections.add(connection)", "def add_connection(intersection, angle, distance, in_ln, out_ln, speed_limit, name):\n intersection.add_connection(angle, distance, in_ln, out_ln, ...
[ "0.62165564", "0.6215841", "0.5957279", "0.5951857", "0.59087896", "0.58598775", "0.58492786", "0.5835462", "0.5760685", "0.5749784", "0.57302576", "0.570756", "0.5690498", "0.5617027", "0.5578076", "0.55777466", "0.555002", "0.5545817", "0.5544365", "0.55358344", "0.5535315"...
0.0
-1
convert a TSV row to a dict
def tsvRowToDict(row): return {col: getattr(row, col) for col in row._columns_}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sv_to_dict(sv_data, cell_delimiter=\"\\t\"):\n result = {}\n rows = [row.split(cell_delimiter) for row in sv_data.splitlines()]\n\n if rows:\n header = rows.pop(0)\n header_len = len(header)\n\n for idx, header_col in enumerate(header):\n result[header_col] = []\n\n ...
[ "0.6821006", "0.6447306", "0.63589346", "0.6260246", "0.60955495", "0.6078354", "0.5975733", "0.58779573", "0.58404744", "0.5821709", "0.58196867", "0.58150125", "0.58036083", "0.5798473", "0.5777305", "0.57152206", "0.57152206", "0.5710342", "0.5708072", "0.57009596", "0.568...
0.83762723
0
get a subset of the columns in the row as a list
def getColumns(self, colNames): subRow = [] for col in colNames: subRow.append(self[col]) return subRow
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def columns(self) -> List[List]:\n return list(map(list, zip(*self.rows)))", "def get_cols(self) :\n\n return list(self.cols)[1:]", "def filter(self, row):\r\n return list(itertools.compress(row, self.selectors))", "def get_col(A,r=0):\n\treturn list(A[r])", "def cols(self):\n\n ...
[ "0.7104543", "0.6555359", "0.653874", "0.6474022", "0.6437849", "0.6404892", "0.63521814", "0.6347388", "0.63229614", "0.6284279", "0.6282418", "0.62777144", "0.6263206", "0.62626517", "0.6245331", "0.62453187", "0.6238164", "0.62272185", "0.6223203", "0.62180644", "0.6215995...
0.64405274
4
List all available api routes.
def welcome(): return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs<br/>" f"/api/v1.0/start_date<br/>" f"/api/v1.0/start_date/end_date" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_apis():\n app.logger.info('Request for api list')\n func_list = []\n for rule in app.url_map.iter_rules():\n if rule.endpoint != 'static':\n methods = ','.join(rule.methods)\n func_list.append(\n (rule.rule, methods, app.view_functions[rule.endpoint...
[ "0.73819554", "0.7146926", "0.7132109", "0.71301955", "0.7122039", "0.71148723", "0.6958982", "0.6818669", "0.67843413", "0.6764332", "0.6714502", "0.66951716", "0.6653704", "0.66353875", "0.6628734", "0.66054016", "0.65956676", "0.65717375", "0.6567825", "0.65256774", "0.651...
0.58018243
68
Start date until 20170823 or a 404 if not.
def from_start_date_to_august_2017(start): canonicalized = start.replace(" ", "").lower() for start_date in temperature_parameters_list: search_date = start_date["date"].replace(" ", "").lower() all_dates_after_start_date = [multiple_dates for multiple_dates in temperature_parameters_list if m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting_date(self):\n return datetime.date(2016, 1, 4)", "def get_start_date():\n\n\tprint()\n\tprint('Getting the first start date to query for.')\n\tprint()\n\tprint('The date must be greater than Jan 1st, 2018')\n\tyear = int(input('Enter a value for the year: '))\n\tmonth = int(input('Enter a val...
[ "0.62898207", "0.6102839", "0.60328037", "0.6010952", "0.6002709", "0.59757394", "0.59757394", "0.5923541", "0.5909359", "0.5903214", "0.57976615", "0.579471", "0.57743955", "0.5741619", "0.57394296", "0.57363695", "0.5697981", "0.56959206", "0.5692512", "0.56789994", "0.5667...
0.0
-1
Start date until end date or a 404 if not.
def from_start_date_to_end_date(start, end): first_canonicalized = start.replace(" ", "").lower() second_canonicalized = end.replace(" ", "").lower() first_search_date = start.replace(" ", "").lower() second_search_date = end.replace(" ", "").lower() all_dates_between_start_date_and_end_date = [mu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_range__no_end_date(self):\n data = self._data()\n data.pop('end_date')\n response = self._get(get_kwargs=data)\n self._check_response(response, 104)", "def test_range__bad_end_date(self):\n self.end_date = 'bad'\n response = self._get(get_kwargs=self._data())\n ...
[ "0.639297", "0.6234267", "0.6176994", "0.6002456", "0.59827435", "0.59495", "0.59472024", "0.58938235", "0.58732694", "0.5839518", "0.5834591", "0.581345", "0.5795825", "0.57746583", "0.57725465", "0.5730436", "0.5725032", "0.5720315", "0.57180136", "0.5711879", "0.568662", ...
0.5959367
5
Verifies that the data which was read in matches an expected pattern
def verify(self): if len(self.headers) not in [1, 5]: raise IncorrectNumberOfExtensions("header", "5", self) if len(self.pixeldata) not in [1, 2, 3]: raise IncorrectNumberOfExtensions("pixel", "1, 2, or 3", self) if len(self.tabledata) not in [0,4]: raise Inco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __input_data_ok(self, line=None):\n # valid pattern: 1407478022|www.facebook.com\n valid_pattern = re.compile(\"\\w{10}\\|\\w+\")\n if (line) and (re.match(valid_pattern, line)):\n return True\n else:\n return False", "def matchDATA(self, dataPat):\n d...
[ "0.6954504", "0.68006516", "0.6647748", "0.6498724", "0.64495766", "0.6386127", "0.6274058", "0.6220588", "0.62038684", "0.6174843", "0.6131677", "0.60954857", "0.60656166", "0.60533124", "0.60227984", "0.6016887", "0.6011278", "0.60000736", "0.59954876", "0.59894377", "0.598...
0.0
-1
Return the exposure time in seconds.
def exptime(self): exptime = float(self.get('TRUITIME')) * int(self.get('COADDONE')) return exptime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_exposure(self):\n exposure = float(self._driver.ExposureTime)\n\n return exposure", "def exposuretime(self):\n _, = self.exposuretimes\n return _", "def exposuretime(self) -> ErrorValue:\n return ErrorValue(self._data['ExpTime'], self._data.setdefault('ExpTimeError',0.0))", ...
[ "0.7363663", "0.7276466", "0.71463877", "0.6887475", "0.68450737", "0.6844163", "0.6723883", "0.6701503", "0.67011184", "0.66474575", "0.66254306", "0.6620939", "0.6619225", "0.6606661", "0.65857524", "0.6573928", "0.65723", "0.65713686", "0.65686315", "0.65556556", "0.654065...
0.62541884
65
For mocking the _extract_embeddings function
def create_embeddings(docs): if len(docs) > 1: blobs, _ = make_blobs(n_samples=len(docs), centers=5, n_features=768, random_state=42) else: blobs, _ = make_blobs(n_samples=len(docs), centers=1, n_features=768, random_state=42) return blobs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_embeddings():\n docs = [\"some document\"]\n model = BERTopic(embedding_model=\"distilbert-base-nli-stsb-mean-tokens\")\n bertopic_embeddings = model._extract_embeddings(docs)\n\n assert isinstance(bertopic_embeddings, np.ndarray)\n assert bertopic_embeddings.shape == (1, 768)\n\n ...
[ "0.752813", "0.750403", "0.67609483", "0.6551144", "0.65234476", "0.6416803", "0.61826134", "0.6169991", "0.6054672", "0.6045248", "0.6039399", "0.60201263", "0.5992018", "0.5968368", "0.5939366", "0.5934201", "0.5920714", "0.5915785", "0.5895983", "0.58874995", "0.5876973", ...
0.0
-1
Test if only correct models are loaded
def test_extract_embeddings(): with pytest.raises(OSError): model = BERTopic(bert_model='not_a_model') model._extract_embeddings(["Some document"]) # model = BERTopic(bert_model='distilbert-base-nli-mean-tokens') # embeddings = model._extract_embeddings(["Some document"]) # # assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_models_ready(self):\n if not self.models_ready:\n raise RuntimeError(\"Models aren't loaded yet.\")", "def requires_model_loading(self):\n return self.requires_loaded_models", "def try_models(self):\n result = os.system(\"python try_models.py\")\n return result ...
[ "0.75690764", "0.7501604", "0.74033904", "0.72214055", "0.70694155", "0.7022962", "0.69805473", "0.69789505", "0.69671214", "0.6896315", "0.68944114", "0.68828535", "0.6871533", "0.6853514", "0.68374175", "0.6759268", "0.6753136", "0.67267454", "0.6717915", "0.67150414", "0.6...
0.0
-1
Testing whether the dimensionality is reduced to the correct shape
def test_reduce_dimensionality(base_bertopic, embeddings, shape): umap_embeddings = base_bertopic._reduce_dimensionality(embeddings) assert umap_embeddings.shape == (shape, 5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reduce_dimensionality(embeddings, shape):\n model = BERTopic()\n umap_embeddings = model._reduce_dimensionality(embeddings)\n assert umap_embeddings.shape == (shape, 5)", "def dimension_check():\n print(\"### DIMENSION CHECK ###\")\n print(X.shape,\n y.shape,\n X_train.s...
[ "0.7596172", "0.7533677", "0.6976749", "0.69620556", "0.6956389", "0.69216585", "0.67888594", "0.66920555", "0.6679619", "0.6638755", "0.66134256", "0.6577837", "0.6563279", "0.65421206", "0.6451753", "0.6424132", "0.6405057", "0.6404975", "0.6391704", "0.6330205", "0.6312588...
0.7494679
2
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, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_assign_clusters_nonsparse(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 if self.split_type == 'random':\n averages_seg = pd.read_sql('SELECT * FROM clust_nonsparse_ave...
[ "0.6708922", "0.63803506", "0.619212", "0.6143325", "0.6065571", "0.6004695", "0.595611", "0.5744816", "0.57216233", "0.567206", "0.5561389", "0.55570865", "0.55501693", "0.5544099", "0.55346334", "0.55069065", "0.54677224", "0.5462687", "0.5441739", "0.5440946", "0.5409589",...
0.6381417
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7501682", "0.71820104", "0.7172594", "0.65129846", "0.6319828", "0.6298175", "0.6200613", "0.61970544", "0.6028055", "0.6013558", "0.5967163", "0.59517914", "0.5941613", "0.5909699", "0.5895177", "0.5893227", "0.58905315", "0.58895624", "0.5875359", "0.58233863", "0.577737...
0.72383255
1
Test whether the topics are correctly extracted using cTFIDF with custom CountVectorizer
def test_extract_topics_custom_cv(base_bertopic_custom_cv): 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_custo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_topics_custom_cv():\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\n cv = CountVectorizer(ngr...
[ "0.76366615", "0.695128", "0.66767305", "0.64983094", "0.6455894", "0.64516467", "0.6380971", "0.6371304", "0.63225263", "0.6318369", "0.6233088", "0.6227844", "0.6161531", "0.6151446", "0.6140702", "0.6139272", "0.61252075", "0.61123204", "0.6102667", "0.6102659", "0.6097327...
0.67100644
2
Test whether the topics are correctly reduced
def test_topic_reduction(reduced_topics): base_bertopic = BERTopic(bert_model='distilbert-base-nli-mean-tokens', verbose=False) nr_topics = reduced_topics + 2 base_bertopic.nr_topics = reduced_topics old_documents = pd.DataFrame({"Document": newsgroup_docs, "ID": range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_topic_reduction(reduced_topics):\n model = BERTopic()\n nr_topics = reduced_topics + 2\n model.nr_topics = reduced_topics\n old_documents = pd.DataFrame({\"Document\": newsgroup_docs,\n \"ID\": range(len(newsgroup_docs)),\n \"To...
[ "0.7486433", "0.7393307", "0.68683904", "0.6413621", "0.64099205", "0.614473", "0.60914385", "0.600705", "0.5982677", "0.59821975", "0.5977468", "0.5972066", "0.5939323", "0.59315646", "0.5905489", "0.5884794", "0.5868499", "0.5839194", "0.58244395", "0.5803697", "0.57853776"...
0.71692944
2
Test whether the topics are not reduced if the reduced number of topics exceeds the actual number of topics found
def test_topic_reduction_edge_cases(base_bertopic): nr_topics = 5 base_bertopic.nr_topics = 100 old_documents = pd.DataFrame({"Document": newsgroup_docs, "ID": range(len(newsgroup_docs)), "Topic": np.random.randint(-1, nr_topics-1, len(new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_topic_reduction(reduced_topics):\n model = BERTopic()\n nr_topics = reduced_topics + 2\n model.nr_topics = reduced_topics\n old_documents = pd.DataFrame({\"Document\": newsgroup_docs,\n \"ID\": range(len(newsgroup_docs)),\n \"To...
[ "0.7001218", "0.6829283", "0.68135095", "0.6599753", "0.6259596", "0.61532044", "0.6088023", "0.5985612", "0.59787536", "0.5975046", "0.5961618", "0.59499335", "0.58917236", "0.5870149", "0.58600295", "0.58323216", "0.58293235", "0.5818334", "0.580859", "0.5801641", "0.576379...
0.6481584
4
Test whether the fit method works as intended
def test_fit(base_bertopic): with mock.patch("bertopic.model.BERTopic._extract_embeddings", wraps=create_embeddings) as mock_bar: base_bertopic.fit(newsgroup_docs) all_topics = base_bertopic.get_topics() topic_zero = base_bertopic.get_topic(0) prediction, probabilities = base_berto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_test(self):", "def fit():\n pass", "def _check_is_fitted(self):\n check_is_fitted(self, ['w', 'b'])", "def fit(self):\n raise NotImplementedError # pragma: no cover", "def fit(self):\n raise NotImplementedError", "def fit(self):\n raise NotImplementedError('')"...
[ "0.87728", "0.8320243", "0.7918425", "0.78460354", "0.7788174", "0.772056", "0.7577355", "0.75416243", "0.75316906", "0.74857175", "0.74857175", "0.7477327", "0.74525297", "0.73649704", "0.73366725", "0.73245645", "0.72870636", "0.72829854", "0.72829854", "0.72829854", "0.728...
0.0
-1
Test whether predictions are correctly made
def test_fit_transform(embeddings, base_bertopic): blobs, _ = make_blobs(n_samples=len(newsgroup_docs), centers=5, n_features=768, random_state=42) embeddings.return_value = blobs predictions, probabilities = base_bertopic.fit_transform(newsgroup_docs) assert isinstance(predictions, list) assert le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_predict(self):\n self.regression_single.predict(self.X_test)\n self.assertTrue(len(self.regression_single.y_pred))\n self.regression_boston.predict(self.boston_x_test)\n self.assertTrue(len(self.regression_boston.y_pred))", "def get_predictions():\n\n print(\"OK1\");\n ...
[ "0.76223505", "0.7420989", "0.7404859", "0.7311982", "0.7304648", "0.72258365", "0.7151476", "0.7149529", "0.71283644", "0.7092055", "0.7042355", "0.7018697", "0.6950376", "0.69312286", "0.69220805", "0.69040775", "0.6858207", "0.68444973", "0.6836569", "0.68030727", "0.67848...
0.0
-1
Check if the model is correctly saved
def test_load_model(base_bertopic): base_bertopic.save("test") loaded_bertopic = BERTopic.load("test") assert type(base_bertopic) == type(loaded_bertopic)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_is_saved(self):\n raise NotImplementedError()", "def isModelDirty(self):\n \n pass", "def checkModel(self, model):\n # TODO", "def save_model(self):\n pass", "def should_save(self):\n return self.modified", "def is_valid(self, data_model: DataModel) -> bool...
[ "0.7737832", "0.7602839", "0.745381", "0.7306805", "0.7287551", "0.704482", "0.6988935", "0.69742936", "0.6952236", "0.6825179", "0.6816664", "0.68138963", "0.6729673", "0.6729673", "0.6729673", "0.6729673", "0.6729673", "0.67127925", "0.6693345", "0.66786295", "0.66689616", ...
0.0
-1
Update meean and var.
def update(self, batch_mean, batch_var, batch_count): delta = batch_mean - self.mean new_count = (self.count + batch_count) new_mean = self.mean + delta * (batch_count / new_count) new_var = self.count * self.var + batch_count * batch_var new_var += (delta**2) * self.count * batc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateVariables(self) -> None:\n ...", "def updateValue(self):\n self.value = self.var.get()", "def update_data():\n pass", "def update():", "def update():", "def update_values(self,t1,t2,phi,m,t31,t32):\n try:\n self.t1=t1\n self.t2=t2\n s...
[ "0.6419836", "0.6105371", "0.609706", "0.6084274", "0.6084274", "0.6035791", "0.5998234", "0.59646124", "0.5841635", "0.5822664", "0.57582676", "0.57506317", "0.5721923", "0.56419075", "0.5636167", "0.5559008", "0.5554882", "0.5554882", "0.55233264", "0.5502905", "0.5502905",...
0.0
-1
Replace terminator with given operator.
def replaceTerminator(self, op): self._children[0].replaceTerminator(op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replaceTerminator(self, op):\n if not (op in (',', ';')):\n raise RuntimeError(\"invalid replacement terminator for GlslBlockStatement: '%s'\" % (op))\n self.__terminator = op", "def set_terminator (self, term):\r\n self.terminator = term", "def _remove_operator(self, operat...
[ "0.6887956", "0.64663404", "0.6182046", "0.6009709", "0.5759515", "0.5676872", "0.5563232", "0.55417585", "0.5515796", "0.5486866", "0.54747343", "0.5472199", "0.5358069", "0.5353344", "0.530891", "0.5292029", "0.52111715", "0.5193843", "0.51775455", "0.5096455", "0.5080006",...
0.79558337
0
Tell if given object is GlslBlockUnary.
def is_glsl_block_unary(op): return isinstance(op, GlslBlockUnary)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_glsl_block_function(op):\n return isinstance(op, GlslBlockFunction)", "def is_unary(*args):\n return _ida_hexrays.is_unary(*args)", "def isLux(self):\n return _libsbml.Unit_isLux(self)", "def is_block(modules):\n if isinstance(modules, (BasicBlock, Bottleneck)):\n return T...
[ "0.6930309", "0.575511", "0.57203484", "0.55796754", "0.55182594", "0.540804", "0.53220403", "0.52651286", "0.52540934", "0.5241585", "0.5217723", "0.51737624", "0.51331514", "0.5100314", "0.5092402", "0.50843877", "0.50426793", "0.5042636", "0.49764892", "0.4973854", "0.4966...
0.8295164
0
Logging function for this strategy
def log(self, txt, dt=None): try: dt = dt or self.datas[0].datetime.datetime(0) print('%s, %s' % (dt.isoformat(), txt)) except IndexError: print('%s' % txt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, message):", "def _log(self, message):\n pass", "def logging(self):\r\n return None", "def log(self, message: str):", "def _log_some_info(self):\n logging.info('info')", "def _log(fn):\n @wraps(fn)\n def wrapper(self, *args, **kwargs):\n self.log.app...
[ "0.74954736", "0.741296", "0.72418547", "0.7230818", "0.71620834", "0.712121", "0.707971", "0.7042935", "0.7042778", "0.70394045", "0.6924644", "0.6921395", "0.68631625", "0.6855124", "0.68494976", "0.6838387", "0.6794195", "0.6776186", "0.6773006", "0.6740606", "0.67145205",...
0.0
-1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7898083", "0.72674114", "0.7254808", "0.7245049", "0.6908353", "0.6609588", "0.6604705", "0.6420626", "0.62551856", "0.6188927", "0.6140078", "0.6094711", "0.6078365", "0.6064797", "0.6021782", "0.60032964", "0.60025203", "0.59636873", "0.5854956", "0.58364797", "0.5795710...
0.80059516
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.80059516", "0.72674114", "0.7254808", "0.7245049", "0.6908353", "0.6609588", "0.6604705", "0.6420626", "0.62551856", "0.6188927", "0.6140078", "0.6094711", "0.6078365", "0.6064797", "0.6021782", "0.60032964", "0.60025203", "0.59636873", "0.5854956", "0.58364797", "0.579571...
0.7898083
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7695932", "0.70614326", "0.69029784", "0.6857792", "0.67886686", "0.6783617", "0.6705377", "0.6401076", "0.6337609", "0.63262594", "0.60780257", "0.60508883", "0.6026724", "0.60263366", "0.6008929", "0.59786737", "0.58621305", "0.58621305", "0.58621305", "0.5858343", "0.58...
0.7901165
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.7901165", "0.70614326", "0.69029784", "0.6857792", "0.67886686", "0.6783617", "0.6705377", "0.6401076", "0.6337609", "0.63262594", "0.60780257", "0.60508883", "0.6026724", "0.60263366", "0.6008929", "0.59786737", "0.58621305", "0.58621305", "0.58621305", "0.5858343", "0.58...
0.7695932
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.77317256", "0.70222354", "0.69721305", "0.68975395", "0.6837586", "0.6703791", "0.6695783", "0.65806043", "0.65806043", "0.6563135", "0.65359503", "0.64795494", "0.64795494", "0.64432955", "0.6440339", "0.6369642", "0.6265606", "0.6232593", "0.61661345", "0.6165809", "0.61...
0.7842726
0
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.7842726", "0.70222354", "0.69721305", "0.68975395", "0.6837586", "0.6703791", "0.6695783", "0.65806043", "0.65806043", "0.6563135", "0.65359503", "0.64795494", "0.64795494", "0.64432955", "0.6440339", "0.6369642", "0.6265606", "0.6232593", "0.61661345", "0.6165809", "0.613...
0.77317256
1
Delete all user channel (DeleteAllUserChannel)
def delete_all_user_channel( 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 = DeleteAllUserChannel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.76666856", "0.76509184", "0.75454867", "0.7266684", "0.71971923", "0.6933088", "0.6642002", "0.649026", "0.64761335", "0.6466964", "0.643114", "0.6416063", "0.638514", "0.6295212", "0.6279387", "0.6277443", "0.6234922", "0.62174064", "0.61712843", "0.61623836", "0.61075664...
0.74887
3
Delete all user channel (DeleteAllUserChannel)
async def delete_all_user_channel_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 = DeleteAl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.76666856", "0.76509184", "0.74887", "0.7266684", "0.71971923", "0.6933088", "0.6642002", "0.649026", "0.64761335", "0.6466964", "0.643114", "0.6416063", "0.638514", "0.6295212", "0.6279387", "0.6277443", "0.6234922", "0.62174064", "0.61712843", "0.61623836", "0.61075664", ...
0.75454867
2
Delete all user content (DeleteAllUserContents)
def 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 = DeleteAllUserConten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.7810327", "0.7685694", "0.72898656", "0.7144473", "0.7027081", "0.702492", "0.68982697", "0.6607414", "0.63795805", "0.63104665", "0.6308196", "0.6209489", "0.61526036", "0.61456364", "0.61167777", "0.6100384", "0.60718566", "0.6056633", "0.6030548", "0.5998603", "0.598387...
0.739601
2
Delete all user content (DeleteAllUserContents)
async def 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 = DeleteA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 ...
[ "0.7810327", "0.7685694", "0.739601", "0.7144473", "0.7027081", "0.702492", "0.68982697", "0.6607414", "0.63795805", "0.63104665", "0.6308196", "0.6209489", "0.61526036", "0.61456364", "0.61167777", "0.6100384", "0.60718566", "0.6056633", "0.6030548", "0.5998603", "0.5983871"...
0.72898656
3
Delete all user group (DeleteAllUserGroup)
def 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 = DeleteAllUserGroup.cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.77543926", "0.7732471", "0.7254077", "0.7127464", "0.70614594", "0.68316466", "0.6781641", "0.6616168", "0.65894556", "0.65894556", "0.65799856", "0.6527845", "0.64719284", "0.64719284", "0.6450825", "0.636403", "0.6361791", "0.63008434", "0.62666845", "0.6253923", "0.6167...
0.71267235
4
Delete all user group (DeleteAllUserGroup)
async def 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 = DeleteAllU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.77543926", "0.7732471", "0.7127464", "0.71267235", "0.70614594", "0.68316466", "0.6781641", "0.6616168", "0.65894556", "0.65894556", "0.65799856", "0.6527845", "0.64719284", "0.64719284", "0.6450825", "0.636403", "0.6361791", "0.63008434", "0.62666845", "0.6253923", "0.616...
0.7254077
2
Test for Issue 82. Flaky was breaking tests using the pytester plugin.
def test_output_without_capture(testdir): script = testdir.makepyfile(TESTSUITE) result = testdir.runpytest(script, '--verbose', '--capture', 'fd') assert result.ret == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_issue():\n pass", "def test_4_4_1_1(self):\n pass", "def test_fix_code_typical_code():\r\n\r\n pass", "def test_patch_none():", "def test_issue_search_issues(self):\n pass", "def test_T01():", "def test_method(self, test, another_test, _): # noqa: D213, D407", "de...
[ "0.77230906", "0.714016", "0.7096738", "0.6739986", "0.6690841", "0.66210485", "0.6583973", "0.6568095", "0.6565453", "0.65228754", "0.6496147", "0.64910656", "0.64910656", "0.64910656", "0.64910656", "0.64910656", "0.64795053", "0.64386487", "0.6420828", "0.6420828", "0.6420...
0.0
-1
Visualizes the set of assignments created by the Sudoku AI
def visualize_assignments(assignments): last_assignment = None filtered_assignments = [] for i in range(len(assignments)): if last_assignment: last_assignment_items = [item for item in last_assignment.items() if len(item[1]) == 1] current_assignment_items = [item for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showAssembled(self):\n im = np.zeros(self.puzzleImage.shape);\n r,c,d = self.puzzleImage.shape;\n r = r/len(self.puzzlePieces); # assume square matrix\n c = c/len(self.puzzlePieces);\n \n for i in range (len(self.puzzlePieces)):\n for j in range (len(self.puzzle...
[ "0.6613204", "0.6334478", "0.6218647", "0.6198979", "0.61764765", "0.61349505", "0.6128603", "0.61086804", "0.6026072", "0.599368", "0.5992971", "0.593964", "0.59163606", "0.5904437", "0.5900146", "0.5784228", "0.5756861", "0.57388943", "0.5736466", "0.5730346", "0.5724483", ...
0.5883322
15
Solves for the optimal infinitehorizon, discretetime LQR controller given linear system (A,B) and cost function parameterized by (Q,R)
def dlqr(A, B, Q, R, gamma=1): P = scipy.linalg.solve_discrete_are(np.sqrt(gamma) * A, B, Q, R / gamma) F = gamma * np.matmul(scipy.linalg.inv(np.matmul(np.matmul(B.T, gamma * P), B) + R), (np.matmul(np.matmul(B.T, P), A))) return -F, P
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LQR_cost(A, B, K, Q, R, sigma_w):\n\n L = A + B.dot(K)\n if spectral_radius(L) >= 1:\n return 1e6\n\n M = Q + K.T.dot(R).dot(K)\n\n P = solve_discrete_lyapunov(L, M)\n\n return (sigma_w ** 2) * np.trace(P)", "def optimize_linearized_model(self, A, B, initial_state, Q, R, target, time_ho...
[ "0.7210189", "0.70444864", "0.6829381", "0.6598445", "0.65899444", "0.6585802", "0.6435983", "0.6397086", "0.63228434", "0.62537324", "0.62294877", "0.61996454", "0.6106124", "0.6075283", "0.6054709", "0.6047364", "0.6037283", "0.60163915", "0.59871733", "0.5955931", "0.59231...
0.62318426
10
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 ---------------------------------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate(ctx):\n connecter = ScalingoInterface(ctx.obj)\n connecter.manage_py(\"migrate\")", "def migrateTables(self):\n tables = self.client_from.tables.list(['columns'])\n if len(tables) > 0:\n for table in tables:\n self.client_to.tables.update(table['tableId']...
[ "0.66270685", "0.65551245", "0.63657236", "0.6327135", "0.62920964", "0.6264679", "0.6139678", "0.59504956", "0.5932942", "0.5913813", "0.58875227", "0.58672184", "0.5828043", "0.57921326", "0.57921326", "0.5790024", "0.57847106", "0.57833004", "0.577031", "0.57422334", "0.57...
0.6691668
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.68267083", "0.627477", "0.48852605", "0.46058208", "0.452317", "0.45115888", "0.4469593", "0.4469593", "0.44516543", "0.4372103", "0.4372103", "0.43642756", "0.43634617", "0.43230346", "0.4271133", "0.42687374", "0.42391634", "0.42179748", "0.42127243", "0.42127243", "0.42...
0.6507531
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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=\"...
[ "0.6690221", "0.5993064", "0.4821764", "0.4768249", "0.4768249", "0.4768249", "0.47625202", "0.47625202", "0.47625202", "0.4690694", "0.4690694", "0.4690694", "0.4690694", "0.4690694", "0.4690694", "0.46848753", "0.46848753", "0.46848753", "0.46848753", "0.46848753", "0.46848...
0.7772029
0
Getter method for address, mapped from YANG variable /input/LocatorRecord/rloc/explicit_locator_path/hop/address (simpleaddress)
def _get_address(self): return self.__address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def street_address1(self) -> str:\n return pulumi.get(self, \"street_address1\")", "def street_address(self):\n if \"streetAddress\" in self._prop_dict:\n return self._prop_dict[\"streetAddress\"]\n else:\n return None", "def get_address(self):\n if self.addres...
[ "0.6001834", "0.5872206", "0.58006203", "0.5772732", "0.57653934", "0.5719896", "0.5719896", "0.5658946", "0.5637213", "0.5636587", "0.56246805", "0.5623372", "0.55890805", "0.55765885", "0.5517977", "0.5500635", "0.54958814", "0.54743445", "0.5462277", "0.5453649", "0.544024...
0.5281341
29
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_address(self, address):\n if address == \"\":\n self.address = Address(\"\", \"\", \"\")\n else:\n self.address = address", "def address(self, address: str):\n if address is None:\n raise ValueError(\"Invalid value for `address`, must not be `None`\")...
[ "0.62030184", "0.6122669", "0.60337484", "0.5985457", "0.59457284", "0.59440863", "0.58759737", "0.58455026", "0.58099014", "0.5727717", "0.5699049", "0.56339836", "0.5617944", "0.55898726", "0.55279684", "0.5515963", "0.5509817", "0.5505075", "0.5505075", "0.55014354", "0.54...
0.6426262
0
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
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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...
[ "0.76941806", "0.51797223", "0.5079757", "0.50214094", "0.49667132", "0.49497706", "0.47777623", "0.47258523", "0.46695194", "0.46509945", "0.45755452", "0.4493895", "0.44842264", "0.44806886", "0.44159406", "0.4404732", "0.4398201", "0.4387897", "0.43735254", "0.4366293", "0...
0.7207082
1
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...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_lrs_bits(self):\n return self.__lrs_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 = 1\n _, _, result = self.as_connection.operate(self.test_key, ops)\n assert...
[ "0.70125633", "0.5115934", "0.49813104", "0.49572697", "0.49218857", "0.49136877", "0.48856583", "0.48110783", "0.47007787", "0.46906585", "0.4647708", "0.45777962", "0.45075318", "0.4459902", "0.44569954", "0.4419056", "0.4411302", "0.44077265", "0.44067883", "0.44016144", "...
0.83665675
0