Skip to content

Commit

Permalink
fix: getattr
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 28, 2024
1 parent 100ca98 commit dc16763
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
29 changes: 29 additions & 0 deletions ape_vyper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from ape import plugins


Expand All @@ -14,3 +16,30 @@ def register_compiler():
from .compiler import VyperCompiler

return tuple(e.value for e in FileType), VyperCompiler


def __getattr__(name: str) -> Any:
if name == "FileType":
from ._utils import FileType

return FileType

elif name == "VyperCompiler":
from .compiler import VyperCompiler

return VyperCompiler

elif name == "VyperConfig":
from .config import VyperConfig

return VyperConfig

else:
raise AttributeError(name)


__all__ = [
"FileType",
"VyperCompiler",
"VyperConfig",
]
3 changes: 1 addition & 2 deletions ape_vyper/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from ape.managers.project import Dependency
from ape.utils import ManagerAccessMixin, get_relative_path

from ape_vyper import FileType
from ape_vyper._utils import lookup_source_from_site_packages
from ape_vyper._utils import FileType, lookup_source_from_site_packages

BUILTIN_PREFIXES = ("vyper", "ethereum")

Expand Down

0 comments on commit dc16763

Please sign in to comment.