(file: Path, module_name: str)
| 37 | public_internal_attributes = [] |
| 38 | |
| 39 | def _test_file(file: Path, module_name: str): |
| 40 | if file.name != '__init__.py' and not file.name.startswith('_'): |
| 41 | module = sys.modules.get(module_name) |
| 42 | if module is None: |
| 43 | spec = importlib.util.spec_from_file_location(module_name, str(file)) |
| 44 | module = importlib.util.module_from_spec(spec) |
| 45 | sys.modules[module_name] = module |
| 46 | try: |
| 47 | spec.loader.exec_module(module) |
| 48 | except ImportError: |
| 49 | return |
| 50 | |
| 51 | for name, attr in vars(module).items(): |
| 52 | if not name.startswith('_'): |
| 53 | attr_module = getattr(attr, '__module__', '') |
| 54 | if attr_module.startswith('pydantic._internal'): |
| 55 | public_internal_attributes.append(f'{module.__name__}:{name} from {attr_module}') |
| 56 | |
| 57 | pydantic_files = (Path(__file__).parent.parent / 'pydantic').glob('*.py') |
| 58 | experimental_files = (Path(__file__).parent.parent / 'pydantic' / 'experimental').glob('*.py') |
no test coverage detected