summaryrefslogtreecommitdiff
path: root/astroid/bases.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2022-11-21 17:08:52 -0600
committerGitHub <noreply@github.com>2022-11-22 00:08:52 +0100
commit595c8bb416153ef3470b6d2ec41de0316fd5a769 (patch)
tree00f7fd2b3135b283cadb65eb583018d2fce75760 /astroid/bases.py
parent6b9f3b587acaa8db703d1038c9f2b19a23f2d21a (diff)
downloadastroid-git-595c8bb416153ef3470b6d2ec41de0316fd5a769.tar.gz
Add some bool annotations (#1877)
Diffstat (limited to 'astroid/bases.py')
-rw-r--r--astroid/bases.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/astroid/bases.py b/astroid/bases.py
index 68fe54af..6dcc1802 100644
--- a/astroid/bases.py
+++ b/astroid/bases.py
@@ -71,7 +71,7 @@ POSSIBLE_PROPERTIES = {
}
-def _is_property(meth, context=None):
+def _is_property(meth, context=None) -> bool:
decoratornames = meth.decoratornames(context=context)
if PROPERTIES.intersection(decoratornames):
return True
@@ -325,7 +325,7 @@ class Instance(BaseInstance):
def __str__(self) -> str:
return f"Instance of {self._proxied.root().name}.{self._proxied.name}"
- def callable(self):
+ def callable(self) -> bool:
try:
self._proxied.getattr("__call__", class_context=False)
return True
@@ -399,7 +399,7 @@ class UnboundMethod(Proxy):
def implicit_parameters(self) -> Literal[0]:
return 0
- def is_bound(self):
+ def is_bound(self) -> Literal[False]:
return False
def getattr(self, name, context=None):
@@ -462,7 +462,7 @@ class UnboundMethod(Proxy):
yield Instance(inferred)
raise InferenceError
- def bool_value(self, context=None):
+ def bool_value(self, context=None) -> Literal[True]:
return True
@@ -482,7 +482,7 @@ class BoundMethod(UnboundMethod):
return 0
return 1
- def is_bound(self):
+ def is_bound(self) -> Literal[True]:
return True
def _infer_type_new_call(self, caller, context): # noqa: C901
@@ -591,7 +591,7 @@ class BoundMethod(UnboundMethod):
return super().infer_call_result(caller, context)
- def bool_value(self, context=None):
+ def bool_value(self, context=None) -> Literal[True]:
return True
@@ -614,7 +614,7 @@ class Generator(BaseInstance):
def infer_yield_types(self):
yield from self.parent.infer_yield_result(self._call_context)
- def callable(self):
+ def callable(self) -> Literal[False]:
return False
def pytype(self) -> Literal["builtins.generator"]:
@@ -623,7 +623,7 @@ class Generator(BaseInstance):
def display_type(self) -> str:
return "Generator"
- def bool_value(self, context=None):
+ def bool_value(self, context=None) -> Literal[True]:
return True
def __repr__(self) -> str: