prospector 1.11.0__py3-none-any.whl → 1.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
prospector/blender.py CHANGED
@@ -4,9 +4,9 @@
4
4
  # the same line. For example, both pyflakes and pylint will generate an
5
5
  # "Unused Import" warning on the same line. This is obviously redundant, so we
6
6
  # remove duplicates.
7
+ import pkgutil
7
8
  from collections import defaultdict
8
9
 
9
- import pkg_resources
10
10
  import yaml
11
11
 
12
12
  __all__ = (
@@ -98,7 +98,7 @@ def blend(messages, blend_combos=None):
98
98
 
99
99
 
100
100
  def get_default_blend_combinations():
101
- combos = yaml.safe_load(pkg_resources.resource_string(__name__, "blender_combinations.yaml"))
101
+ combos = yaml.safe_load(pkgutil.get_data(__name__, "blender_combinations.yaml"))
102
102
  combos = combos.get("combinations", [])
103
103
 
104
104
  defaults = []
@@ -1,5 +1,6 @@
1
1
  # flake8: noqa
2
- import pkg_resources
2
+ import importlib.metadata
3
+
3
4
  import setoptconf as soc
4
5
 
5
6
  from prospector.config.datatype import OutputChoice
@@ -8,7 +9,7 @@ from prospector.tools import DEFAULT_TOOLS, TOOLS
8
9
 
9
10
  __all__ = ("build_manager",)
10
11
 
11
- _VERSION = pkg_resources.get_distribution("prospector").version
12
+ _VERSION = importlib.metadata.version("prospector")
12
13
 
13
14
 
14
15
  def build_manager():
@@ -121,7 +121,7 @@ def _load_content_package(name):
121
121
  file_names = (
122
122
  ["prospector.yaml", "prospector.yml"]
123
123
  if len(name_split) == 1
124
- else [f"{name_split[1]}.yaml", f"{name_split[1]}.yaml"]
124
+ else [f"{name_split[1]}.yaml", f"{name_split[1]}.yml"]
125
125
  )
126
126
 
127
127
  data = None
@@ -21,6 +21,7 @@ VALID_OPTIONS = LIST_OPTIONS + [
21
21
  "python-2-mode",
22
22
  "python-version",
23
23
  "namespace-packages",
24
+ "check-untyped-defs",
24
25
  ]
25
26
 
26
27
 
@@ -90,6 +91,7 @@ class MypyTool(ToolBase):
90
91
  python_version = options.get("python-version", None)
91
92
  strict_optional = options.get("strict-optional", False)
92
93
  namespace_packages = options.get("namespace-packages", False)
94
+ check_untyped_defs = options.get("check-untyped-defs", False)
93
95
 
94
96
  self.options.append(f"--follow-imports={follow_imports}")
95
97
 
@@ -117,6 +119,9 @@ class MypyTool(ToolBase):
117
119
  if namespace_packages:
118
120
  self.options.append("--namespace-packages")
119
121
 
122
+ if check_untyped_defs:
123
+ self.options.append("--check-untyped-defs")
124
+
120
125
  for list_option in LIST_OPTIONS:
121
126
  for entry in options.get(list_option, []):
122
127
  self.options.append(f"--{list_option}-{entry}")
@@ -64,7 +64,7 @@ class PylintTool(ToolBase):
64
64
  continue
65
65
  for option in checker.options:
66
66
  if option[0] in options:
67
- checker.set_option(option[0], options[option[0]])
67
+ checker._arguments_manager.set_option(option[0], options[option[0]])
68
68
 
69
69
  # The warnings about disabling warnings are useful for figuring out
70
70
  # with other tools to suppress messages from. For example, an unused
@@ -167,7 +167,7 @@ class PylintTool(ToolBase):
167
167
  def _get_pylint_configuration(
168
168
  self, check_paths: List[Path], linter: ProspectorLinter, prospector_config, pylint_options
169
169
  ):
170
- self._args = linter.load_command_line_configuration(str(path) for path in check_paths)
170
+ self._args = check_paths
171
171
  linter.load_default_plugins()
172
172
 
173
173
  config_messages = self._prospector_configure(prospector_config, linter)
@@ -2,8 +2,10 @@ from pathlib import Path
2
2
 
3
3
  from packaging import version as packaging_version
4
4
  from pylint import version as pylint_version
5
+ from pylint.config.config_file_parser import _ConfigurationFileParser
6
+ from pylint.config.config_initialization import _order_all_first
5
7
  from pylint.lint import PyLinter
6
- from pylint.utils import _splitstrip
8
+ from pylint.utils import _splitstrip, utils
7
9
 
8
10
 
9
11
  class ProspectorLinter(PyLinter):
@@ -12,13 +14,49 @@ class ProspectorLinter(PyLinter):
12
14
  # set up the standard PyLint linter
13
15
  PyLinter.__init__(self, *args, **kwargs)
14
16
 
17
+ # Largely inspired by https://github.com/pylint-dev/pylint/blob/main/pylint/config/config_initialization.py#L26
15
18
  def config_from_file(self, config_file=None):
16
19
  """Will return `True` if plugins have been loaded. For pylint>=1.5. Else `False`."""
17
- self.read_config_file(config_file)
18
- if self.cfgfile_parser.has_option("MASTER", "load-plugins"):
19
- plugins = _splitstrip(self.cfgfile_parser.get("MASTER", "load-plugins"))
20
+ config_file_parser = _ConfigurationFileParser(False, self)
21
+ config_data, config_args = config_file_parser.parse_config_file(file_path=config_file)
22
+ if config_data.get("MASTER", {}).get("load-plugins"):
23
+ plugins = _splitstrip(config_data["MASTER"]["load-plugins"])
20
24
  self.load_plugin_modules(plugins)
21
- self.load_config_file()
25
+
26
+ config_args = _order_all_first(config_args, joined=False)
27
+
28
+ if "init-hook" in config_data:
29
+ exec(utils._unquote(config_data["init-hook"])) # pylint: disable=exec-used
30
+
31
+ # Load plugins if specified in the config file
32
+ if "load-plugins" in config_data:
33
+ self.load_plugin_modules(utils._splitstrip(config_data["load-plugins"]))
34
+
35
+ self._parse_configuration_file(config_args)
36
+
37
+ # Set the current module to the command line
38
+ # to allow raising messages on it
39
+ self.set_current_module(config_file)
40
+
41
+ self._emit_stashed_messages()
42
+
43
+ # Set the current module to configuration as we don't know where
44
+ # the --load-plugins key is coming from
45
+ self.set_current_module("Command line or configuration file")
46
+
47
+ # We have loaded configuration from config file and command line. Now, we can
48
+ # load plugin specific configuration.
49
+ self.load_plugin_configuration()
50
+
51
+ # Now that plugins are loaded, get list of all fail_on messages, and
52
+ # enable them
53
+ self.enable_fail_on_messages()
54
+
55
+ self._parse_error_mode()
56
+
57
+ # Link the base Namespace object on the current directory
58
+ self._directory_namespaces[Path().resolve()] = (self.config, {})
59
+
22
60
  return True
23
61
 
24
62
  def _expand_files(self, modules):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prospector
3
- Version: 1.11.0
3
+ Version: 1.12.0
4
4
  Summary: Prospector is a tool to analyse Python code by aggregating the result of other tools.
5
5
  Home-page: http://prospector.readthedocs.io
6
6
  License: GPLv2+
@@ -44,7 +44,7 @@ Requires-Dist: pep8-naming (>=0.3.3,<=0.10.0)
44
44
  Requires-Dist: pycodestyle (>=2.9.0)
45
45
  Requires-Dist: pydocstyle (>=2.0.0)
46
46
  Requires-Dist: pyflakes (>=2.2.0,<4)
47
- Requires-Dist: pylint (>=2.8.3,<3.0)
47
+ Requires-Dist: pylint (>=3.0)
48
48
  Requires-Dist: pylint-celery (==0.3)
49
49
  Requires-Dist: pylint-django (>=2.5,<2.6)
50
50
  Requires-Dist: pylint-flask (==0.6)
@@ -1,11 +1,11 @@
1
1
  prospector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  prospector/__main__.py,sha256=-gdHYZxwq_P8er7HuZEBImY0pwaFq8uIa78dQdJsTTQ,71
3
3
  prospector/autodetect.py,sha256=ANuy7FBrxLxKP9pKELbCvBWHIHhm9g5B4kYbe5yyM5Q,2955
4
- prospector/blender.py,sha256=TXRme_bHKAi1eDREKGklSwUtcadQr-2E0EoX4AHxRL4,4444
4
+ prospector/blender.py,sha256=2-DktYCi5WRF-9vCXjN8ksb8NBGb15Mmf_MmnIhpujE,4425
5
5
  prospector/blender_combinations.yaml,sha256=yN7BOUCDomDZVRZzYxsRdxQPLpzxm9TDhv18B_GdLPU,6551
6
6
  prospector/compat.py,sha256=p_2BOebzUcKbUAd7mW8rn6tIc10R96gJuZS71QI0XY4,360
7
7
  prospector/config/__init__.py,sha256=yUO3j4DwpCTP6p3In8NzIUDf8dMMyYw8eX28yAvOl0c,13537
8
- prospector/config/configuration.py,sha256=0upMM9OvW93rW8TIrtP7yo_n6MWCh1gfCDjVwx_CW2M,13905
8
+ prospector/config/configuration.py,sha256=P1fIMqJrs1vAYyJ86JacbGdjJpsoAPOre7KTt0-fmx4,13899
9
9
  prospector/config/datatype.py,sha256=YuiwM-t89DGAmiBvkGA3y3roTTIKMCveIZnXVsZaWSQ,628
10
10
  prospector/encoding.py,sha256=3t4FjHgNlInyth7IYgBiJcD3a3iUYLdZQEBhNADx_44,1542
11
11
  prospector/exceptions.py,sha256=Vlu5FB0cDUO1BOgDTqk49-zq-GrcaC2RtXFuuS1347Y,1290
@@ -25,7 +25,7 @@ prospector/pathutils.py,sha256=81z36CjcbTb0JtvOdH0_FmT99PjAW4NbTF0TxJF884A,1306
25
25
  prospector/postfilter.py,sha256=yzQHhj_qnRZlQ1MGj5FXtBs7zWh4l68kaDa58ZIjGE0,2235
26
26
  prospector/profiles/__init__.py,sha256=q9zPLVEwo7qoouYFrmENsmByFrKKkr27Dd_Wo9btTJI,683
27
27
  prospector/profiles/exceptions.py,sha256=CpFTGZN55DW_CoUQdJH6DduM1fm8zfhNx5CHRCjv0kA,871
28
- prospector/profiles/profile.py,sha256=aJElTo_nTdI-3HGb0N0PAlWC_AcwmRYUXmE-6nl6LTo,16442
28
+ prospector/profiles/profile.py,sha256=Yz5UyKl0A8dXpbMoGQRp5tvW3fUX6K_na22-y-N_DIQ,16441
29
29
  prospector/profiles/profiles/default.yaml,sha256=tMy-G49ZdV7gkfBoN2ngtIWha3n7JVr_rEeNkLzpKsk,100
30
30
  prospector/profiles/profiles/doc_warnings.yaml,sha256=K_cBhUeKnSvOCwgwXE2tMZ-Fr5cJovC1XSholWglzN4,48
31
31
  prospector/profiles/profiles/flake8.yaml,sha256=wC-TJYuVobo9zPm4Yc_Ocd4Wwfemx0IufmAnfiuKkHk,156
@@ -50,20 +50,20 @@ prospector/tools/base.py,sha256=-Mj36ClqymzKl0WtigJd_3_8TZo2ZT4F3YIkj6tmv9Y,1575
50
50
  prospector/tools/dodgy/__init__.py,sha256=URSC-puhNw90Qj9CSHXZrLvVoj41hHBIgSKsGYgHTGM,1481
51
51
  prospector/tools/exceptions.py,sha256=Q-u4n6YzZuoMu17XkeKac1o1gBY36JK4MnvWaYrVYL0,170
52
52
  prospector/tools/mccabe/__init__.py,sha256=jFWsXzXMl1T_0IOQOYZ1CN0PGg1E4_dzOkrfnkKYISs,2919
53
- prospector/tools/mypy/__init__.py,sha256=6S3hL2OHmxQJznriPIAeXqp6Bu8AGgTi_K_FOfsPMU4,4367
53
+ prospector/tools/mypy/__init__.py,sha256=9iEDJCvII-3tSseWRZ2tKHVL18ZzwRkaM15RT74Jy5I,4551
54
54
  prospector/tools/profile_validator/__init__.py,sha256=oIGcqLqgOQXZ3DRyGIzEEWBlyH7PWmAPQ2i5WQ8Mx_U,7930
55
55
  prospector/tools/pycodestyle/__init__.py,sha256=3e8bQWiuUuHPX8jVlZOPj78nSHlyRI7tc-YB3lV9TK8,5452
56
56
  prospector/tools/pydocstyle/__init__.py,sha256=kwyvkT372J3rQrTK8MdhQMB8jHShoMu_Bcp0DXiA5Ts,2537
57
57
  prospector/tools/pyflakes/__init__.py,sha256=VgIBmp2orCq2qe374ea9XP0-rudHs09y-SniSuLYvMk,4997
58
- prospector/tools/pylint/__init__.py,sha256=BP0o0RtwihpbyfPcsWtXXJX38ie-88F411ESMYDbu3U,10032
58
+ prospector/tools/pylint/__init__.py,sha256=gMByTzq970QwHnom0aOq1hPJhA7c-g8T11YCn9H-fxY,9989
59
59
  prospector/tools/pylint/collector.py,sha256=TBvQpXWTcjIaIkZSEv7TWLz4VY9mgBM3xZaOmVz0N40,1334
60
- prospector/tools/pylint/linter.py,sha256=hNxHO8wkcNjjQf-rPmXCpX-Enkt0lmapcrxIWwJiFkE,1820
60
+ prospector/tools/pylint/linter.py,sha256=tINIH5h-dYFOwrHNn8tH9ZAr1ktLlFytTwLNU_WU-WA,3437
61
61
  prospector/tools/pyright/__init__.py,sha256=rpVe7XmEHCViQsyg6DN9sI5_b9tCO2fFeSuZfEqcaL8,2931
62
62
  prospector/tools/pyroma/__init__.py,sha256=yf5TiA0fB2bxjtqwfod3ahx5hnFyk9iy6u6C3H6VF-4,2947
63
63
  prospector/tools/utils.py,sha256=rOGn_FAiLHG9CS6KzE8FAJzXkEJMzdFYS29U19Ad7bA,1161
64
64
  prospector/tools/vulture/__init__.py,sha256=blzCrLQkGsvUuD6pp5ST3vgwvHvQ7jv-kqgY_Lukh1Q,3058
65
- prospector-1.11.0.dist-info/entry_points.txt,sha256=SxvCGt8MJTEZefHAvwnUc6jDetgCaaYY1Zpifuk8tqU,50
66
- prospector-1.11.0.dist-info/LICENSE,sha256=WoTRadDy8VbcIKoVzl5Q1QipuD_cexAf3ul4MaVLttc,18044
67
- prospector-1.11.0.dist-info/WHEEL,sha256=gSF7fibx4crkLz_A-IKR6kcuq0jJ64KNCkG8_bcaEao,88
68
- prospector-1.11.0.dist-info/METADATA,sha256=UthQhxdRGU81ajTG8DBnac9lYdGLb9L5DNNQh8cIPQo,10008
69
- prospector-1.11.0.dist-info/RECORD,,
65
+ prospector-1.12.0.dist-info/entry_points.txt,sha256=SxvCGt8MJTEZefHAvwnUc6jDetgCaaYY1Zpifuk8tqU,50
66
+ prospector-1.12.0.dist-info/LICENSE,sha256=WoTRadDy8VbcIKoVzl5Q1QipuD_cexAf3ul4MaVLttc,18044
67
+ prospector-1.12.0.dist-info/WHEEL,sha256=gSF7fibx4crkLz_A-IKR6kcuq0jJ64KNCkG8_bcaEao,88
68
+ prospector-1.12.0.dist-info/METADATA,sha256=ML95Cb9SxjqTaYhAZ2Gink_JNL6-ZNLhZ3MX00DulII,10001
69
+ prospector-1.12.0.dist-info/RECORD,,