On a scale from "submissions to <reddit.com/r/eyeb...
# development
b
On a scale from "submissions to reddit.com/r/eyebleach" to "literally everything mentioned in 'You're a Mean One, Mr. Grinch'", how gross is the following code? Problem: Given some Python sources, determine if they are part of an in-repo Pants plugin:
Copy code
in_repo_plugin_sources: Set[str] = set()
    for filename in source_files.files:
        path = pathlib.PurePath(filename)
        for source_root in source_roots:
            try:
                relpath = path.relative_to(source_root.path)
            except ValueError:
                continue
            modname = str(relpath.with_suffix("")).replace("/", ".")
            if modname in sys.modules:
                in_repo_plugin_sources.add(filename)