Skip to content

Commit

Permalink
Use TYPE_CHECKING guard to remove a circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Aug 30, 2021
1 parent 8267d09 commit 8a490bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions astroid/interpreter/objectmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import pprint
import types
from functools import lru_cache
from typing import Optional
from typing import TYPE_CHECKING, Optional

import astroid
from astroid import util
Expand All @@ -45,6 +45,8 @@

objects = util.lazy_import("objects")

if TYPE_CHECKING:
from astroid.objects import Property

IMPL_PREFIX = "attr_"

Expand Down Expand Up @@ -799,7 +801,7 @@ def attr_fset(self):

func = self._instance

def find_setter(func: objects.Property) -> Optional[astroid.FunctionDef]:
def find_setter(func: "Property") -> Optional[astroid.FunctionDef]:
"""
Given a property, find the corresponding setter function and returns it.
Expand Down

0 comments on commit 8a490bb

Please sign in to comment.