Best Python code snippet using autotest_python
_config.py
Source:_config.py
...8def read_config(*paths) -> Dict[str, Any]:9 config = dict() # type: Dict[str, Any]10 for path in paths:11 if isinstance(path, Path):12 new_config = _read_local(path)13 elif path.startswith(('https://', 'http://')):14 new_config = _read_remote(path)15 elif Path(path).exists():16 new_config = _read_local(Path(path))17 else:18 new_config = _read_remote(path)19 config = _merge_configs(config, new_config)20 return config21def _read_local(path: Path) -> Dict[str, Any]:22 with path.open('r') as stream:23 return _parse_config(stream.read())24def _read_remote(url: str) -> Dict[str, Any]:25 http = urllib3.PoolManager()26 response = http.request('GET', url)27 return _parse_config(response.data.decode())28def _merge_configs(*configs) -> Dict[str, Any]:29 config = dict()30 for subconfig in configs:31 config.update(subconfig)32 for section in ('plugins', 'exceptions'):33 config[section] = dict()34 for subconfig in configs:35 config[section].update(subconfig.get(section, {}))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!