function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def _load_parameters(self): """ Load the .mlaunch_startup file that exists in each datadir. Handles different protocol versions. """ datapath = self.dir startup_file = os.path.join(datapath, '.mlaunch_startup') if not os.path.exists(startup_file): re...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _create_paths(self, basedir, name=None): """Create datadir and subdir paths.""" if name: datapath = os.path.join(basedir, name) else: datapath = basedir dbpath = os.path.join(datapath, 'db') if not os.path.exists(dbpath): os.makedirs(dbpat...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _filter_valid_arguments(self, arguments, binary="mongod", config=False): """ Return a list of accepted arguments. Check which arguments in list are accepted by the specified binary (mongod, mongos). If an argument does not start with '-' but its ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _get_ssl_pymongo_options(self, args): opts = {} if not self.ssl_server_args: return opts for parser in [self.ssl_server_args]: for action in parser._group_actions: name = action.dest value = args.get(name) if value: ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _get_tls_pymongo_options(self, args): opts = {} if not self.tls_server_args: return opts for parser in [self.tls_server_args]: for action in parser._group_actions: name = action.dest value = args.get(name) if value: ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _get_last_error_log(self, command_str): logpath = re.search(r'--logpath ([^\s]+)', command_str) loglines = '' try: with open(logpath.group(1), 'rb') as logfile: for line in logfile: if not line.startswith('----- BEGIN BACKTRACE -----'): ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _initiate_replset(self, port, name, maxwait=30): """Initiate replica set.""" if not self.args['replicaset'] and name != 'configRepl': if self.args['verbose']: print('Skipping replica set initialization for %s' % name) return con = self.client('localho...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _get_processes(self): all_ports = self.get_tagged(['running']) process_dict = {} for p in psutil.process_iter(): # deal with zombie process errors in OSX try: name = p.name() except psutil.NoSuchProcess: continue ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _construct_cmdlines(self): """ Top-level _construct_* method. From here, it will branch out to the different cases: _construct_sharded, _construct_replicaset, _construct_single. These can themselves call each other (for example sharded needs to create the shards with...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _construct_replset(self, basedir, portstart, name, num_nodes, arbiter, extra=''): """ Construct command line strings for a replicaset. Handles single set or sharded cluster. """ self.config_docs[name] = {'_id': name, 'members': []} # Const...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _construct_single(self, basedir, port, name=None, extra=''): """ Construct command line strings for a single node. Handles shards and stand-alones. """ datapath = self._create_paths(basedir, name) self._construct_mongod(os.path.join(datapath, 'db'), ...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def _construct_mongos(self, logpath, port, configdb): """Construct command line strings for a mongos process.""" extra = '' auth_param = '' if self.args['auth']: auth_param = '--auth' if '--keyFile' not in self.unknown_args: key_path = os.path.abs...
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def main(): tool = MLaunchTool() tool.run()
rueckstiess/mtools
[ 1782, 375, 1782, 74, 1347607696 ]
def getSinceVersion(self): return Version.OLD
rwl/muntjac
[ 43, 14, 43, 5, 1316308871 ]
def getDescription(self): return ('Most components can have a <i>description</i>,' ' which is usually shown as a <i>\"tooltip\"</i>.' ' In the Form component, the description is shown at the' ' top of the form.' ' Descriptions can have HTML formatted (\'rich\') co...
rwl/muntjac
[ 43, 14, 43, 5, 1316308871 ]
def getRelatedFeatures(self): # TODO Auto-generated method stub return None
rwl/muntjac
[ 43, 14, 43, 5, 1316308871 ]
def __init__(self, guid=None, name=None, value_name=None): """Initializes an UserAssist entry. Args: guid (Optional[str]): GUID. name (Optional[str]): name. value_name (Optional[str]): name of the Windows Registry value. """ super(UserAssistEntry, self).__init__() self.guid = guid...
libyal/winreg-kb
[ 122, 17, 122, 5, 1411881319 ]
def _DebugPrintEntry(self, format_version, user_assist_entry): """Prints UserAssist entry value debug information. Args: format_version (int): format version. user_assist_entry (user_assist_entry_v3|user_assist_entry_v5): UserAssist entry. """ value_string = '0x{0:08x}'.format(use...
libyal/winreg-kb
[ 122, 17, 122, 5, 1411881319 ]
def ParseEntry(self, format_version, entry_data): """Parses an UserAssist entry. Args: format_version (int): format version. entry_data (bytes): entry data. Returns: user_assist_entry_v3|user_assist_entry_v5: UserAssist entry. Raises: ParseError: if the value data could not be...
libyal/winreg-kb
[ 122, 17, 122, 5, 1411881319 ]
def __init__(self, debug=False, output_writer=None): """Initializes a Windows UserAssist information collector. Args: debug (Optional[bool]): True if debug information should be printed. output_writer (Optional[OutputWriter]): output writer. """ super(UserAssistCollector, self).__init__(deb...
libyal/winreg-kb
[ 122, 17, 122, 5, 1411881319 ]
def split_to_last_line_break(data): """This splits a byte buffer into (head, tail) where head contains the beginning of the buffer to the last line break (inclusive) and the tail contains all bytes after that.""" last_break_index = 1 + data.rfind(b'\n') return data[:last_break_index], data[last_brea...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def abspath(self, groups): """Group filter that turns source-relative paths into absolute paths.""" return (groups[0] if groups[0].startswith(os.sep) else os.path.join(self.source_path, groups[0]),) + groups[1:]
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def on_stdout_received(self, data): if not self.suppress_stdout: data_head, self.stdout_tail = split_to_last_line_break(self.stdout_tail + data) colored = self.color_lines(data_head) super(CMakeIOBufferProtocol, self).on_stdout_received(colored)
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def close(self): # Make sure tail buffers are flushed self.flush_tails() super(CMakeIOBufferProtocol, self).close()
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def color_lines(self, data): """Apply colorization rules to each line in data""" decoded_data = self._decode(data) # TODO: This will only work if all lines are received at once. Instead # of directly splitting lines, we should buffer the data lines until # the last character is a...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def factory_factory(cls, source_path, suppress_stdout=False): """Factory factory for constructing protocols that know the source path for this CMake package.""" def factory(label, job_id, stage_label, event_queue, log_path): # factory is called by catkin_tools executor def init_p...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def __init__(self, label, job_id, stage_label, event_queue, log_path, *args, **kwargs): super(CMakeMakeIOBufferProtocol, self).__init__( label, job_id, stage_label, event_queue, log_path, *args, **kwargs)
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def send_progress(self, data): """Parse CMake Make completion progress""" progress_matches = re.match(r'\[\s*([0-9]+)%\]', self._decode(data)) if progress_matches is not None: self.event_queue.put(ExecutionEvent( 'STAGE_PROGRESS', job_id=self.job_id, ...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def __init__(self, label, job_id, stage_label, event_queue, log_path, verbose, *args, **kwargs): super(CMakeMakeRunTestsIOBufferProtocol, self).__init__( label, job_id, stage_label, event_queue, log_path, *args, **kwargs) # Line formatting filters # Each is a 2-tuple: # - r...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def colorize_run_tests(self, line): cline = sanitize(line).rstrip() for p, r in self.filters: if p.match(cline): lines = [fmt(r).format(line) for line in cline.splitlines()] cline = '\n'.join(lines) return cline + '\n'
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def factory_factory(cls, verbose): """Factory factory for constructing protocols that know the verbosity.""" def factory(label, job_id, stage_label, event_queue, log_path): # factory is called by catkin_tools executor def init_proxy(*args, **kwargs): # init_proxy ...
catkin/catkin_tools
[ 149, 135, 149, 91, 1393292582 ]
def extra_requirements_dict(): return { # 1000 common ports used by nmap scanner "port_scan_stealth": ["False"], "udp_scan" : ["False"], "port_scan_ports": [1, 3, 4, 6, 7, 9, 13, 17, 19, 20, 21, 22, 23, 24, 25, 26, 30, 32, 33, 37, 42, 43, 49, 53, 67, 68, 69, 70, ...
viraintel/OWASP-Nettacker
[ 2217, 610, 2217, 25, 1492776875 ]
def check_closed(ip): for i in range(1, 10): s = sr1(IP(dst=ip) / TCP(dport=i), timeout=2, verbose=0) if s != 'SA' and s is not None: return i return 0
viraintel/OWASP-Nettacker
[ 2217, 610, 2217, 25, 1492776875 ]
def stealth(host, port, timeout_sec, log_in_file, language, time_sleep, thread_tmp_filename, socks_proxy, scan_id, scan_cmd, stealth_flag): try: if socks_proxy is not None: socks_version = socks.SOCKS5 if socks_proxy.startswith( 'socks5://') else socks.SOCKS4 ...
viraintel/OWASP-Nettacker
[ 2217, 610, 2217, 25, 1492776875 ]
def connect(host, port, timeout_sec, log_in_file, language, time_sleep, thread_tmp_filename, socks_proxy, scan_id, scan_cmd, stealth_flag): try: if socks_proxy is not None: socks_version = socks.SOCKS5 if socks_proxy.startswith( 'socks5://') else socks.SOCKS4 ...
viraintel/OWASP-Nettacker
[ 2217, 610, 2217, 25, 1492776875 ]
def __init__(self, camera_id, im_size, **kwargs): self._camera_id = camera_id self.im_size = im_size super().__init__(**kwargs)
google-research/google-research
[ 27788, 6881, 27788, 944, 1538678568 ]
def clean_partition(bigip, partition): sh = system_helper.SystemHelper() return sh.purge_folder_contents(bigip, folder=partition)
F5Networks/f5-openstack-agent
[ 14, 37, 14, 83, 1444753730 ]
def parse_config(config_file): config = ConfigParser.ConfigParser() config.readfp(open(config_file)) bigips = [] try: config_addrs = config.get("DEFAULT", 'icontrol_hostname') config_user = config.get("DEFAULT", 'icontrol_username') config_pass = config.get("DEFAULT", 'icontrol_...
F5Networks/f5-openstack-agent
[ 14, 37, 14, 83, 1444753730 ]
def __init__(self, conn): self.conn = conn
yunify/qingcloud-sdk-python
[ 55, 47, 55, 6, 1389255100 ]
def delete_instance_groups(self, instance_groups, **ignore): """ Delete the specific instance group. @param instance_groups: An id list contains the group(s) id which will be deleted. """ action = const.ACTION_DELETE_INSTANCE_GROUPS valid_keys = ['i...
yunify/qingcloud-sdk-python
[ 55, 47, 55, 6, 1389255100 ]
def leave_instance_group(self, instances, instance_group, **ignore): """ Delete the specific instance(s) from the group. @param instances: An id list contains the instance(s) who want to leave the instance group. @param instance_group: Th...
yunify/qingcloud-sdk-python
[ 55, 47, 55, 6, 1389255100 ]
def test_minion_load_grains_false(): """ Minion does not generate grains when load_grains is False """ opts = {"random_startup_delay": 0, "grains": {"foo": "bar"}} with patch("salt.loader.grains") as grainsfunc: minion = salt.minion.Minion(opts, load_grains=False) assert minion.opts[...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_minion_load_grains_default(): """ Minion load_grains defaults to True """ opts = {"random_startup_delay": 0, "grains": {}} with patch("salt.loader.grains") as grainsfunc: minion = salt.minion.Minion(opts) assert minion.opts["grains"] != {} grainsfunc.assert_called()
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_send_req_fires_completion_event(event): event_enter = MagicMock() event_enter.send.side_effect = event[1] event = MagicMock() event.__enter__.return_value = event_enter with patch("salt.utils.event.get_event", return_value=event): opts = salt.config.DEFAULT_MINION_OPTS.copy() ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_mine_send_tries(req_channel_factory): channel_enter = MagicMock() channel_enter.send.side_effect = lambda load, timeout, tries: tries channel = MagicMock() channel.__enter__.return_value = channel_enter req_channel_factory.return_value = channel opts = { "random_startup_delay":...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_source_int_name_local(): """ test when file_client local and source_interface_name is set """ interfaces = { "bond0.1234": { "hwaddr": "01:01:01:d0:d0:d0", "up": True, "inet": [ { "broadcast": "111.1.111.255", ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_source_int_name_remote(): """ test when file_client remote and source_interface_name is set and interface is down """ interfaces = { "bond0.1234": { "hwaddr": "01:01:01:d0:d0:d0", "up": False, "inet": [ { "b...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_source_address(): """ test when source_address is set """ interfaces = { "bond0.1234": { "hwaddr": "01:01:01:d0:d0:d0", "up": False, "inet": [ { "broadcast": "111.1.111.255", "netmask": "111.1.0....
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_handle_decoded_payload_jid_match_in_jid_queue(): """ Tests that the _handle_decoded_payload function returns when a jid is given that is already present in the jid_queue. Note: This test doesn't contain all of the patch decorators above the function like the other tests for _handle_decoded...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_handle_decoded_payload_jid_queue_addition(): """ Tests that the _handle_decoded_payload function adds a jid to the minion's jid_queue when the new jid isn't already present in the jid_queue. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.utils.pro...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_handle_decoded_payload_jid_queue_reduced_minion_jid_queue_hwm(): """ Tests that the _handle_decoded_payload function removes a jid from the minion's jid_queue when the minion's jid_queue high water mark (minion_jid_queue_hwm) is hit. """ with patch("salt.minion.Minion.ctx", MagicMock(return...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_process_count_max(): """ Tests that the _handle_decoded_payload function does not spawn more than the configured amount of processes, as per process_count_max. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.utils.process.SignalHandlingProcess.star...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_beacons_before_connect(): """ Tests that the 'beacons_before_connect' option causes the beacons to be initialized before connect. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.minion.Minion.sync_connect_master", MagicMock(side_effect=RuntimeE...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_scheduler_before_connect(): """ Tests that the 'scheduler_before_connect' option causes the scheduler to be initialized before connect. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.minion.Minion.sync_connect_master", MagicMock(side_effect=Ru...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_minion_module_refresh_beacons_refresh(tmp_path): """ Tests that 'module_refresh' calls beacons_refresh and that the minion object has a beacons attribute with beacons. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.utils.process.SignalHandlingProc...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_when_ping_interval_is_set_the_callback_should_be_added_to_periodic_callbacks(): with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.minion.Minion.sync_connect_master", MagicMock(side_effect=RuntimeError("stop execution")), ), patch( "salt.utils.process...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_when_passed_start_event_grains(): mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() # provide mock opts an os grain since we'll look for it later. mock_opts["grains"]["os"] = "linux" mock_opts["start_event_grains"] = ["os"] io_loop = salt.ext.tornado.ioloop.IOLoop() io_loop.make_curren...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_when_not_passed_start_event_grains(): mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() io_loop = salt.ext.tornado.ioloop.IOLoop() io_loop.make_current() minion = salt.minion.Minion(mock_opts, io_loop=io_loop) try: minion.tok = MagicMock() minion._send_req_sync = MagicMock(...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_when_other_events_fired_and_start_event_grains_are_set(): mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() mock_opts["start_event_grains"] = ["os"] io_loop = salt.ext.tornado.ioloop.IOLoop() io_loop.make_current() minion = salt.minion.Minion(mock_opts, io_loop=io_loop) try: mi...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_minion_retry_dns_count(): """ Tests that the resolve_dns will retry dns look ups for a maximum of 3 times before raising a SaltMasterUnresolvableError exception. """ opts = salt.config.DEFAULT_MINION_OPTS.copy() with patch.dict( opts, { "ipv6": False, ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_gen_modules_executors(): """ Ensure gen_modules is called with the correct arguments #54429 """ mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() io_loop = salt.ext.tornado.ioloop.IOLoop() io_loop.make_current() minion = salt.minion.Minion(mock_opts, io_loop=io_loop) class Moc...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_reinit_crypto_on_fork(def_mock): """ Ensure salt.utils.crypt.reinit_crypto() is executed when forking for new job """ mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() mock_opts["multiprocessing"] = True io_loop = salt.ext.tornado.ioloop.IOLoop() io_loop.make_current() minion ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_minion_manage_beacons(): """ Tests that the manage_beacons will call the add function, adding beacon data into opts. """ with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch( "salt.minion.Minion.sync_connect_master", MagicMock(side_effect=RuntimeError("sto...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_sock_path_len(): """ This tests whether or not a larger hash causes the sock path to exceed the system's max sock path length. See the below link for more information. https://github.com/saltstack/salt/issues/12172#issuecomment-43903643 """ opts = { "id": "salt-testing", ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_master_type_failover(): """ Tests master_type "failover" to not fall back to 127.0.0.1 address when master does not resolve in DNS """ mock_opts = salt.config.DEFAULT_MINION_OPTS.copy() mock_opts.update( { "master_type": "failover", "master": ["master1", "mas...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def mock_resolve_dns(opts, fallback=False): assert not fallback raise SaltClientError("Cannot resolve {}".format(opts["master"]))
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def test_config_cache_path_overrides(): cachedir = os.path.abspath("/path/to/master/cache") opts = {"cachedir": cachedir, "conf_file": None} mminion = salt.minion.MasterMinion(opts) assert mminion.opts["cachedir"] == cachedir
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def __init__(self): self.edges: Dict[str, Dict[str, bool]] = {} self.ids: Dict[str, int] = {} self.inv_ids: Dict[int, str] = {}
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def list_rllib_tests(n: int = -1, test: str = None) -> Tuple[str, List[str]]: """List RLlib tests. Args: n: return at most n tests. all tests if n = -1. test: only return information about a specific test. """ tests_res = _run_shell( ["bazel", "query", "tests(//python/ray/rllib:...
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _new_import(graph: DepGraph, src_module: str, dep_module: str): """Process a new import statement in src_module.""" # We don't care about system imports. if not dep_module.startswith("ray"): return _new_dep(graph, src_module, dep_module)
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _new_from_import( graph: DepGraph, src_module: str, dep_module: str, dep_name: str, _base_dir: str
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _process_file(graph: DepGraph, src_path: str, src_module: str, _base_dir=""): """Create dependencies from src_module to all the valid imports in src_path. Args: graph: the DepGraph to be added to. src_path: .py file to be processed. src_module: full module path of the source file. ...
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _full_module_path(module, f) -> str: if f == "__init__.py": # __init__ file for this module. # Full path is the same as the module name. return module fn = re.sub(r"\.py$", "", f) if not module: return fn return module + "." + fn
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _bazel_path_to_module_path(d: str) -> str: """Convert a Bazel file path to python module path. Example: //python/ray/rllib:xxx/yyy/dd -> ray.rllib.xxx.yyy.dd """ # Do this in 3 steps, so all of 'python:', 'python/', or '//python', etc # will get stripped. d = re.sub(r"^\/\/", "", d) d =...
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _depends( graph: DepGraph, visited: Dict[int, bool], tid: int, qid: int
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def test_depends_on_file( graph: DepGraph, test: Tuple[str, Tuple[str]], path: str
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def _find_circular_dep_impl(graph: DepGraph, id: str, branch: str) -> bool: if id not in graph.edges: return False for c in graph.edges[id]: if c in branch: # Found a circle. branch.append(c) return True branch.append(c) if _find_circular_dep_i...
ray-project/ray
[ 24488, 4264, 24488, 2914, 1477424310 ]
def __init__(self, *args, **kwargs): super(CloudDNSTest, self).__init__(*args, **kwargs)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def tearDown(self): super(CloudDNSTest, self).tearDown() self.client = None self.domain = None
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test(self, domain): return domain
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_assure_domain_id(self): @assure_domain def test(self, domain): return domain clt = self.client dom = self.domain clt._manager._get = Mock(return_value=dom) d2 = test(clt, dom.id) self.assertEqual(d2, dom) self.assertTrue(isinstance(d2,...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test(self, domain): return domain
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_set_timeout(self): clt = self.client mgr = clt._manager new_timeout = random.randint(0, 99) clt.set_timeout(new_timeout) self.assertEqual(mgr._timeout, new_timeout)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_reset_paging_all(self): clt = self.client mgr = clt._manager mgr._paging["domain"]["total_entries"] = 99 mgr._paging["record"]["next_uri"] = example_uri mgr._reset_paging("all") self.assertIsNone(mgr._paging["domain"]["total_entries"]) self.assertIsNone(m...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_get_pagination_qs(self): clt = self.client mgr = clt._manager test_limit = random.randint(1, 100) test_offset = random.randint(1, 100) qs = mgr._get_pagination_qs(test_limit, test_offset) self.assertEqual(qs, "?limit=%s&offset=%s" % (test_limit, test_offset))
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_manager_list_all(self): clt = self.client mgr = clt._manager fake_name = utils.random_unicode() ret_body = {"domains": [{"name": fake_name}]} uri_string_next = utils.random_unicode() next_uri = "%s/domains/%s" % (example_uri, uri_string_next) mgr.count = ...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_previous_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_previous_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_next_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_next_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_subdomains_previous_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_subdomains_previous_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_subdomains_next_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_subdomains_next_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_records_previous_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_records_previous_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_list_records_next_page_fail(self): clt = self.client mgr = clt._manager self.assertRaises(exc.NoMoreResults, clt.list_records_next_page)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_manager_create(self): clt = self.client mgr = clt._manager ret_body = {"callbackUrl": example_uri, "status": "RUNNING"} mgr.api.method_post = Mock(return_value=(None, ret_body)) stat_body = {"status": "complete", "response": {mgr.response_...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_manager_findall(self): clt = self.client mgr = clt._manager mgr._list = Mock() mgr.findall(name="fake") mgr._list.assert_called_once_with("/domains?name=fake", list_all=True)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_manager_empty_get_body_error(self): clt = self.client mgr = clt._manager mgr.api.method_get = Mock(return_value=(None, None)) self.assertRaises(exc.ServiceResponseFailure, mgr.list)
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_async_call_body(self): clt = self.client mgr = clt._manager body = {"fake": "fake"} uri = "http://example.com" callback_uri = "https://fake.example.com/status/fake" massaged_uri = "/status/fake?showDetails=true" put_resp = {"callbackUrl": callback_uri, ...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_async_call_no_response(self): clt = self.client mgr = clt._manager uri = "http://example.com" callback_uri = "https://fake.example.com/status/fake" massaged_uri = "/status/fake?showDetails=true" put_resp = {"callbackUrl": callback_uri, "status": "...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_async_call_error(self): clt = self.client mgr = clt._manager uri = "http://example.com" callback_uri = "https://fake.example.com/status/fake" massaged_uri = "/status/fake?showDetails=true" put_resp = {"callbackUrl": callback_uri, "status": "RUNNIN...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_process_async_error_nested(self): clt = self.client mgr = clt._manager err = {"error": { "failedItems": {"faults": [ {"message": "fake1", "details": "", "code": 400}, {"message": "fake2", "details": "", "code": 400}, ...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]
def test_export_domain(self): clt = self.client dom = self.domain export = utils.random_unicode() clt._manager._async_call = Mock(return_value=({}, {"contents": export})) ret = clt.export_domain(dom) uri = "/domains/%s/export" % dom.id clt._manager._async_call.ass...
rackspace/pyrax
[ 238, 218, 238, 75, 1348707957 ]