Best Python code snippet using prospector_python
__init__.py
Source:__init__.py
...15 # Also the 'too many instance attributes' warning is ignored, as this16 # is a config object and its sole purpose is to hold many properties!17 # pylint:disable=no-self-use,too-many-instance-attributes18 def __init__(self):19 self.config, self.arguments = self._configure_prospector()20 self.paths = self._get_work_path(self.config, self.arguments)21 self.explicit_file_mode = all(map(os.path.isfile, self.paths))22 self.workdir = os.getcwd()23 self.profile, self.strictness = self._get_profile(self.workdir, self.config)24 self.libraries = self._find_used_libraries(self.config, self.profile)25 self.tools_to_run = self._determine_tool_runners(self.config, self.profile)26 self.ignores = self._determine_ignores(self.config, self.profile, self.libraries)27 self.configured_by = {}28 self.messages = []29 def get_tools(self, found_files):30 self.configured_by = {}31 runners = []32 for tool_name in self.tools_to_run:33 tool = tools.TOOLS[tool_name]()34 config_result = tool.configure(self, found_files)35 if config_result is None:36 configured_by = None37 messages = []38 else:39 configured_by, messages = config_result40 if messages is None:41 messages = []42 self.configured_by[tool_name] = configured_by43 self.messages += messages44 runners.append(tool)45 return runners46 def get_output_report(self):47 # Get the output formatter48 if self.config.output_format is not None:49 output_report = self.config.output_format50 else:51 output_report = [(self.profile.output_format, self.profile.output_target)]52 for index, report in enumerate(output_report):53 if not all(report):54 output_report[index] = (report[0] or "grouped", report[1] or [])55 return output_report56 def _configure_prospector(self):57 # first we will configure prospector as a whole58 mgr = cfg.build_manager()59 config = mgr.retrieve(*cfg.build_default_sources())60 return config, mgr.arguments61 def _get_work_path(self, config, arguments):62 # Figure out what paths we're prospecting63 if config["path"]:64 paths = [self.config["path"]]65 elif arguments["checkpath"]:66 paths = arguments["checkpath"]67 else:68 paths = [os.getcwd()]69 return paths70 def _get_profile(self, path, config):...
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!!