validatedata 0.6.5
Bundled Python dependency library pathimports importlib
SHA-256ce05d329e9b15a5e6dc25b6e7cdc0fcd95c14e6a264d2534110553eb2ab8aedd
MaleculeO₂(CEr)H(Po₂)
Evidence
1051 code = compile("\n".join(lines), f"<dict_validator_n={n}_{strategy}>", "exec")
1052 exec(code, ns) # noqa: S102 # NOSONAR: S5334 — interpolated values are integer loop indices only; field names and callables enter via ns, never as source text
1053 return ns["_fn"] # type: ignore[return-value]
1:8… atedata/autovalidate_package.py
2from __future__ import annotations
3
4import importlib
5import inspect
6import pkgutil
7import re
8import sys
9from fnmatch import fnmatch
10from types import ModuleType
11from typing import Any, Callable, Dict, Iterable, List, Optional, Pattern, Tuple, Union
12
13from validatedata import types as types_registry # validatedata/types.py
14from validatedata import validate_types
15
16PatternOrGlob = Union[str, Pattern]
17
18
19def _compile_patterns(patterns: Optional[Iterable[Patter …
20:24… = []
21 if not patterns:
22 return out
23 for p in patterns:
24 if isinstance(p, Pattern):
25 out.append(p)
26 else:
27 rx = __import__("fnmatch").translate(p)
28 out.append(re.compile(rx))
29 return out
⋯10 lines
91:13… e package module
92 if isinstance(package, str):
93 pkg = sys.modules.get(package) or importlib.import_module(package)
94 else:
95 pkg = package
96
97 if not hasattr(pkg, "__path__"):
98 raise TypeError("autovalidate_package ex …
120:27… ):
121 try:
122 setattr(fn, "_autovalidated", True)
123 except Exception:
124 pass
125
126 def _is_already_decorated(fn):
127 return getattr(fn, "_autovalidated", False)
128
129 def _build_decorated_fn(raw: Callable) -> Callable:
130 """Apply decorator or validate_ty …
Showing the top 5 files — 1 more file (8 regions) not shown.
No evidence locations were recorded for this file. Raw result