Skip to content

Commit

Permalink
Use module and method descriptor types declared in the types module (
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Jun 2, 2023
2 parents b518e6a + 600d3cd commit 3a567f0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions IPython/core/guarded_eval.py
Expand Up @@ -18,6 +18,7 @@
import sys
from functools import cached_property
from dataclasses import dataclass, field
from types import MethodDescriptorType, ModuleType

from IPython.utils.docs import GENERATING_DOCUMENTATION
from IPython.utils.decorators import undoc
Expand Down Expand Up @@ -630,8 +631,6 @@ def _list_methods(cls, source=None):


dict_keys: Type[collections.abc.KeysView] = type({}.keys())
method_descriptor: Any = type(list.copy)
module = type(builtins)

NUMERICS = {int, float, complex}

Expand Down Expand Up @@ -680,8 +679,8 @@ def _list_methods(cls, source=None):
type, # `type` handles a lot of generic cases, e.g. numbers as in `int.real`.
*NUMERICS,
dict_keys,
method_descriptor,
module,
MethodDescriptorType,
ModuleType,
}


Expand Down

0 comments on commit 3a567f0

Please sign in to comment.