experimaestro 1.3.3__py3-none-any.whl → 1.3.4__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.

Potentially problematic release.


This version of experimaestro might be problematic. Click here for more details.

@@ -6,7 +6,8 @@ from functools import lru_cache
6
6
  from importlib import import_module
7
7
  from pathlib import Path
8
8
  from types import ModuleType
9
- from typing import List, Optional, Set, Tuple, Union
9
+ from typing import List, Optional, Set, Tuple, Union, Dict, Type
10
+ from dataclasses import dataclass
10
11
 
11
12
  import docutils.nodes as nodes
12
13
  import sphobjinv
@@ -31,30 +32,40 @@ def documented_from_objects(objects_inv: Path) -> Set[str]:
31
32
  )
32
33
 
33
34
 
34
- def undocumented(
35
+ @dataclass
36
+ class DocumentationReport:
37
+ #: Errors while parsing
38
+ errors: List[str]
39
+
40
+ #: Undocumented
41
+ undocumented: List[Config]
42
+
43
+ #: Documented but non existing
44
+ falsy_documented: List[Config]
45
+
46
+
47
+ def analyze(
35
48
  packages: Union[str, List[str]], documented: Set[str], skip_packages: Set[str]
36
49
  ) -> Tuple[bool, List[Config]]:
37
50
  """Returns the list of undocumented configurations
38
51
 
39
- :param package: package to explore
52
+ :param package: package(s) to explore
40
53
  :param documented: documented symbols (fully qualified names)
41
54
  :param skip_packages: List of sub-packages that should be skipped
42
55
  :return: a tuple containing whether errors where detected when importing
43
56
  files and the list of undocumented configurations
44
57
  """
45
58
 
46
- def process(mod: ModuleType, configurations: Set):
59
+ def process(mod: ModuleType, configurations: Dict[str, Type[Config]]):
47
60
  errors = []
48
61
  for info in pkgutil.iter_modules(mod.__path__, prefix=f"{mod.__name__}."):
49
62
  try:
50
63
  logging.info("Processing %s...", info.name)
51
64
  mod = importlib.import_module(info.name)
52
- # mod = info.module_finder.find_module(info.name).load_module(info.name)
53
- configurations.update(
54
- x
55
- for x in mod.__dict__.values()
56
- if inspect.isclass(x) and issubclass(x, Config)
57
- )
65
+ for x in mod.__dict__.values():
66
+ if inspect.isclass(x) and issubclass(x, Config):
67
+ configurations[f"{x.__module__}.{x.__qualname__}"] = x
68
+
58
69
  except Exception:
59
70
  logging.exception(f"Module {info.name} could not be loaded")
60
71
  errors.append(f"Module {info.name} could not be loaded")
@@ -65,18 +76,21 @@ def undocumented(
65
76
 
66
77
  return errors
67
78
 
68
- configurations = set()
79
+ configurations = {}
69
80
  for package in list(packages):
70
81
  errors = process(import_module(package), configurations)
71
82
 
72
- configs = []
73
- for configuration in configurations:
74
- name = f"{configuration.__module__}.{configuration.__qualname__}"
83
+ # Search for undocumented
84
+ undocumented = []
85
+ for name, configuration in configurations.items():
75
86
  if name.startswith(f"{package}.") and name not in documented:
76
87
  if all(not name.startswith(f"{x}.") for x in skip_packages):
77
- configs.append(configuration)
88
+ undocumented.append(configuration)
89
+
90
+ # Search for falsy documented
91
+ falsy = [name for name in documented if name not in configurations]
78
92
 
79
- return errors, configs
93
+ return DocumentationReport(errors, undocumented, falsy)
80
94
 
81
95
 
82
96
  class autodoc(nodes.Node):
@@ -214,19 +228,20 @@ class DocumentationAnalyzer:
214
228
  self.documentation_errors = []
215
229
  self.parsing_errors = []
216
230
  self.undocumented = []
231
+ self.falsy_documented = [] #: Documented but not in code
217
232
 
218
233
  def analyze(self):
219
234
  visitor = DocumentVisitor()
220
235
  visitor.parse_rst(self.doc_path)
221
236
  self.documentation_errors = visitor.errors
222
237
 
223
- errors, configs = undocumented(
224
- self.modules, visitor.documented, set(["xpmir.test"])
225
- )
226
- self.parsing_errors = errors
238
+ report = analyze(self.modules, visitor.documented, self.excluded)
239
+ self.parsing_errors = report.errors
227
240
  self.undocumented = [
228
- f"{config.__module__}.{config.__qualname__}" for config in configs
241
+ f"{config.__module__}.{config.__qualname__}"
242
+ for config in report.undocumented
229
243
  ]
244
+ self.falsy_documented = report.falsy_documented
230
245
 
231
246
  def report(self):
232
247
  cprint(
@@ -237,10 +252,14 @@ class DocumentationAnalyzer:
237
252
  for error in self.documentation_errors:
238
253
  cprint(f" [documentation error] {error}", "red")
239
254
 
255
+ for error in self.falsy_documented:
256
+ cprint(f" [falsy documented] {error}", "red")
257
+
240
258
  cprint(
241
259
  f"{len(self.parsing_errors)} errors were encountered while parsing modules",
242
260
  "red" if self.parsing_errors else "green",
243
261
  )
262
+
244
263
  for error in self.parsing_errors:
245
264
  cprint(f" [import error] {error}", "red")
246
265
 
@@ -254,3 +273,10 @@ class DocumentationAnalyzer:
254
273
  and len(self.parsing_errors) == 0
255
274
  and len(self.undocumented) == 0
256
275
  )
276
+
277
+ def assert_valid_documentation(self):
278
+ """Asserts that there are no falsy documented"""
279
+ self.assert_no_undocumented()
280
+ assert (
281
+ len(self.falsy_documented) == 0
282
+ ), f"{self.falsy_documented} falsy documented members"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: experimaestro
3
- Version: 1.3.3
3
+ Version: 1.3.4
4
4
  Summary: "Experimaestro is a computer science experiment manager"
5
5
  Home-page: https://github.com/experimaestro/experimaestro-python
6
6
  License: GPL-3
@@ -126,7 +126,7 @@ experimaestro/tests/utils.py,sha256=41krZFgUaCxCYBQPmo5dNFDd9W6RU8ZzzyzY3FyutUI,
126
126
  experimaestro/tokens.py,sha256=aHT6lN4YLF0ujXl0nNu1sSSx-2ebrYiZFfrFvvmsQ1s,14681
127
127
  experimaestro/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  experimaestro/tools/diff.py,sha256=FBCwupPrSwkEOcqYu0NWe7LTkuOW6r-_btoCel2_k_I,3436
129
- experimaestro/tools/documentation.py,sha256=PizkQ1ptEmVFPtxx5kCreIDXoHk8F5qjQLOINlgzbRM,8402
129
+ experimaestro/tools/documentation.py,sha256=O2UzjzodPqGot3YSe6NYlK7S42XpplakUdqxFpvjqHQ,9184
130
130
  experimaestro/tools/jobs.py,sha256=63bXhJ7RGdczLU_nxu2skGn-9dwgr4r5pD23qH4WeBA,3516
131
131
  experimaestro/typingutils.py,sha256=gkEhJ9Fir05xh5v45pYKmrGYiLCykGtlU8sL-ydFXS8,1785
132
132
  experimaestro/utils/__init__.py,sha256=BdYguxAbR1jOQPV36OgGA31itaMvBJ6WVPV6b4Jn4xw,2434
@@ -137,8 +137,8 @@ experimaestro/utils/resources.py,sha256=gDjkrRjo7GULWyXmNXm_u1uqzEIAoAvJydICk56n
137
137
  experimaestro/utils/settings.py,sha256=jpFMqF0DLL4_P1xGal0zVR5cOrdD8O0Y2IOYvnRgN3k,793
138
138
  experimaestro/utils/yaml.py,sha256=jEjqXqUtJ333wNUdIc0o3LGvdsTQ9AKW9a9CCd-bmGU,6766
139
139
  experimaestro/xpmutils.py,sha256=S21eMbDYsHfvmZ1HmKpq5Pz5O-1HnCLYxKbyTBbASyQ,638
140
- experimaestro-1.3.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
141
- experimaestro-1.3.3.dist-info/METADATA,sha256=dGznA3MAAOdTCAglyY5JdkZUxg5On_dBAJC313BH0IU,5336
142
- experimaestro-1.3.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
143
- experimaestro-1.3.3.dist-info/entry_points.txt,sha256=PhaEili_fDgn5q7rBJGip_uhGkRBq5l3Yuhg91zkcbk,574
144
- experimaestro-1.3.3.dist-info/RECORD,,
140
+ experimaestro-1.3.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
141
+ experimaestro-1.3.4.dist-info/METADATA,sha256=94GzmKjEen5NKrWVBc28WbvW6gajxu4NH3LzDvPLhns,5336
142
+ experimaestro-1.3.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
143
+ experimaestro-1.3.4.dist-info/entry_points.txt,sha256=PhaEili_fDgn5q7rBJGip_uhGkRBq5l3Yuhg91zkcbk,574
144
+ experimaestro-1.3.4.dist-info/RECORD,,