Skip to content

Commit fb9cef1

Browse files
committed
formatting
1 parent 4142cf1 commit fb9cef1

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

nodescraper/cli/cli.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,68 +58,69 @@
5858

5959
def discover_external_plugins():
6060
"""Discover ext_nodescraper_plugins from all installed packages.
61-
61+
6262
Returns:
6363
list: List of discovered plugin packages
6464
"""
6565
extra_pkgs = []
6666
seen_paths = set() # Track paths to avoid duplicates
67-
67+
6868
try:
6969
import ext_nodescraper_plugins as ext_pkg
70+
7071
extra_pkgs.append(ext_pkg)
71-
if hasattr(ext_pkg, '__file__') and ext_pkg.__file__:
72+
if hasattr(ext_pkg, "__file__") and ext_pkg.__file__:
7273
seen_paths.add(ext_pkg.__file__)
7374
except ImportError:
7475
pass
75-
76+
7677
# Discover ext_nodescraper_plugins from installed packages
7778
try:
7879
from importlib.metadata import distributions
79-
80+
8081
for dist in distributions():
81-
pkg_name = dist.metadata.get('Name', '')
82+
pkg_name = dist.metadata.get("Name", "")
8283
if not pkg_name:
8384
continue
84-
85+
8586
name_variants = [
86-
pkg_name.replace('-', '_'),
87-
pkg_name.replace('_', '-'),
87+
pkg_name.replace("-", "_"),
88+
pkg_name.replace("_", "-"),
8889
]
89-
90+
9091
try:
91-
top_level = dist.read_text('top_level.txt')
92+
top_level = dist.read_text("top_level.txt")
9293
if top_level:
93-
name_variants.extend(top_level.strip().split('\n'))
94+
name_variants.extend(top_level.strip().split("\n"))
9495
except Exception:
9596
pass
96-
97+
9798
for variant in name_variants:
9899
if not variant:
99100
continue
100-
101+
101102
try:
102103
module_path = f"{variant}.ext_nodescraper_plugins"
103104
ext_pkg = import_module(module_path)
104-
105+
105106
# Check if we already have this package (by file path)
106-
pkg_path = getattr(ext_pkg, '__file__', None)
107+
pkg_path = getattr(ext_pkg, "__file__", None)
107108
if pkg_path and pkg_path in seen_paths:
108109
continue
109-
110+
110111
# Add the package
111112
extra_pkgs.append(ext_pkg)
112113
if pkg_path:
113114
seen_paths.add(pkg_path)
114-
115+
115116
break
116-
117+
117118
except (ImportError, AttributeError, ModuleNotFoundError):
118119
continue
119-
120+
120121
except Exception:
121122
pass
122-
123+
123124
return extra_pkgs
124125

125126

0 commit comments

Comments
 (0)