Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

__main__ behavior for importcompletion.py#943

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
thomasballinger wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromprint-import-completion
Draft
Changes fromall 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
33 changes: 33 additions & 0 deletionsbpython/importcompletion.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,7 @@ def __init__(
skiplist if skiplist is not None else tuple()
)
self.fully_loaded = False
self.print_packages_traversed = False

if paths is None:
self.modules.update(sys.builtin_module_names)
Expand DownExpand Up@@ -220,6 +221,8 @@ def find_modules(
continue
if (stat.st_dev, stat.st_ino) not in self.paths:
self.paths.add((stat.st_dev, stat.st_ino))
if (self.print_packages_traversed):
print(path_real)
for subname in self.find_modules(path_real):
if subname is None:
yield None # take a break to avoid unresponsiveness
Expand DownExpand Up@@ -250,3 +253,33 @@ def find_coroutine(self) -> Optional[bool]:
self.fully_loaded = True

return True


def discover(
skiplist: Optional[Sequence[str]] = None,
print_packages_traversed=True
):
module_gatherer = ModuleGatherer(skiplist=skiplist)
module_gatherer.print_packages_traversed = print_packages_traversed
while module_gatherer.find_coroutine():
pass


if __name__ == "__main__":
import argparse
from pathlib import Path

from bpython.config import Config, default_config_path

parser = argparse.ArgumentParser()
parser.add_argument(
"--config",
default=default_config_path(),
type=Path,
help="Use CONFIG instead of default config file.",
)
config = Config(default_config_path())
discover(
config.import_completion_skiplist,
print_packages_traversed=True
)

[8]ページ先頭

©2009-2025 Movatter.jp