Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reexport detection #5

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release notes


## Version 0.0.6

### Fixed

- Re-exports were not detected correctly.

## Version 0.0.5

### Added
Expand Down
2 changes: 1 addition & 1 deletion monkay/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024-present alex <devkral@web.de>
#
# SPDX-License-Identifier: BSD-3-Clauses
__version__ = "0.0.5"
__version__ = "0.0.6"
15 changes: 10 additions & 5 deletions monkay/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ def find_missing(
value_pathes_set.add(absolutify_import(found_path, self.package))
try:
obj = self.getter(name, no_warn_deprecated=True, check_globals_dict="fail")
if not found_path:
value_pathes_set.add(_obj_to_full_name(obj))
# also add maybe rexported path
value_pathes_set.add(_obj_to_full_name(obj))
except InGlobalsDict:
missing.setdefault(name, set()).add("shadowed")
except ImportError:
Expand Down Expand Up @@ -487,12 +487,17 @@ def find_missing(
continue
for export_name in all_var_search:
export_path = absolutify_import(f"{search_path}.{export_name}", self.package)
if export_path not in value_pathes_set:
missing.setdefault(export_path, set()).add("search_path_extra")
try:
getattr(mod, export_name)
# for re-exports
obj = getattr(mod, export_name)
except AttributeError:
missing.setdefault(export_path, set()).add("missing_attr")
# still check check the export path
if export_path not in value_pathes_set:
missing.setdefault(export_path, set()).add("search_path_extra")
continue
if export_path not in value_pathes_set and _obj_to_full_name(obj) not in value_pathes_set:
missing.setdefault(export_path, set()).add("search_path_extra")

if all_var is not False:
for name in key_set.difference(cast(Collection[str], all_var)):
Expand Down