class Overlay(abstract.Module): (source)
Known subclasses: pytype.overlays.abc_overlay.ABCOverlay
, pytype.overlays.asyncio_types_overlay.AsyncioOverlay
, pytype.overlays.asyncio_types_overlay.TypesOverlay
, pytype.overlays.chex_overlay.ChexOverlay
, pytype.overlays.collections_overlay.CollectionsOverlay
, pytype.overlays.dataclass_overlay.DataclassOverlay
, pytype.overlays.enum_overlay.EnumOverlay
, pytype.overlays.flax_overlay.DataclassOverlay
, pytype.overlays.flax_overlay.LinenModuleOverlay
, pytype.overlays.flax_overlay.LinenOverlay
, pytype.overlays.functools_overlay.FunctoolsOverlay
, pytype.overlays.future_overlay.FutureUtilsOverlay
, pytype.overlays.pytype_extensions_overlay.PytypeExtensionsOverlay
, pytype.overlays.six_overlay.SixOverlay
, pytype.overlays.subprocess_overlay.SubprocessOverlay
, pytype.overlays.sys_overlay.SysOverlay
, pytype.overlays.typing_overlay.Redirect
, pytype.overlays.typing_overlay.TypingOverlay
, pytype.overlays.attr_overlay._AttrOverlayBase
A layer between pytype and a module's pytd definition. An overlay pretends to be a module, but provides members that generate extra typing information that cannot be expressed in a pytd file. For example, collections.namedtuple is a factory method that generates class definitions at runtime. An overlay is needed for Pytype to generate these classes. An Overlay will typically import its underlying module in its __init__, e.g. by calling ctx.loader.import_name(). Due to this, Overlays should only be used when their underlying module is imported by the Python script being analyzed! A subclass of Overlay should have an __init__ with the signature: def __init__(self, ctx) Attributes: real_module: An abstract.Module wrapping the AST for the underlying module.
Method | __init__ |
Initialize the overlay. |
Method | get |
Returns the abstract.Module for the given name. |
Method | items |
Undocumented |
Instance Variable | real |
Undocumented |
Method | _convert |
Called to convert the items in _member_map to cfg.Variable. |
Inherited from Module
:
Method | get |
Hash the set of member names. |
Method | get |
Undocumented |
Method | has |
Does this module have a module-level __getattr__? |
Method | module |
Undocumented |
Instance Variable | ast |
Undocumented |
Instance Variable | name |
Undocumented |
Property | full |
Undocumented |
Property | module |
Undocumented |
Inherited from Instance
(via Module
):
Instance Variable | cls |
Undocumented |
Property | instance |
Undocumented |
Method | _load |
Undocumented |
Instance Variable | _container |
Undocumented |
Instance Variable | _instance |
Undocumented |
Instance Variable | _instance |
Undocumented |
Inherited from SimpleValue
(via Module
, Instance
):
Method | __repr__ |
Undocumented |
Method | argcount |
Returns the minimum number of arguments needed for a call. |
Method | call |
Call this abstract value with the given arguments. |
Method | cls |
Undocumented |
Method | get |
Get a cfg.Variable of the instance's values for the type parameter. |
Method | get |
Build a key from the information used to perform type matching. |
Method | has |
Check if the key is in `instance_type_parameters`. |
Method | instantiate |
Create an instance of self. |
Method | maybe |
Undocumented |
Method | merge |
Set the value of a type parameter. |
Method | set |
Set the __class__ of an instance, for code that does "x.__class__ = y. |
Method | update |
Undocumented |
Instance Variable | members |
Undocumented |
Property | maybe |
Undocumented |
Method | _call |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _unique |
Get unique parameter subtypes as variables. |
Instance Variable | _cached |
Undocumented |
Instance Variable | _cls |
Undocumented |
Instance Variable | _fullhash |
Undocumented |
Instance Variable | _maybe |
Undocumented |
Instance Variable | _type |
Undocumented |
Inherited from BaseValue
(via Module
, Instance
, SimpleValue
):
Method | compute |
Undocumented |
Method | default |
Undocumented |
Method | get |
Undocumented |
Method | get |
Gets a default type key. See get_type_key. |
Method | get |
Get the class's type for the type parameter. |
Method | get |
Get the type an instance of us would have. |
Method | get |
Get this value's __new__ method, if it isn't object.__new__. |
Method | get |
Fetch a special attribute (e.g., __get__, __iter__). |
Method | has |
Return True if this is a function and has a **kwargs parameter. |
Method | has |
Return True if this is a function and has a *args parameter. |
Method | init |
Allow metaprogramming via __init_subclass__. |
Method | is |
Undocumented |
Method | official |
Undocumented |
Method | property |
Bind this value to the given self or cls. |
Method | register |
Treating self as a class definition, register an instance of it. |
Method | should |
Undocumented |
Method | to |
Undocumented |
Method | to |
Undocumented |
Method | to |
Get a PyTD definition for this object. |
Method | to |
Get a PyTD type representing this object, as seen at a node. |
Method | to |
Build a variable out of this abstract value. |
Method | unique |
Get unique parameter subtypes as bindings. |
Method | update |
Update the official name. |
Class Variable | formal |
Undocumented |
Instance Variable | final |
Undocumented |
Instance Variable | from |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | mro |
Undocumented |
Instance Variable | slots |
Undocumented |
Property | all |
Undocumented |
Property | official |
Undocumented |
Property | template |
Undocumented |
Instance Variable | _all |
Undocumented |
Instance Variable | _instance |
Undocumented |
Instance Variable | _module |
Undocumented |
Instance Variable | _official |
Undocumented |
Instance Variable | _template |
Undocumented |
Inherited from ContextWeakrefMixin
(via Module
, Instance
, SimpleValue
, BaseValue
):
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
Inherited from LazyMembers
(via Module
, Instance
, SimpleValue
, BaseValue
, ContextWeakrefMixin
):
Method | init |
Undocumented |
Method | load |
Load the named attribute into self.members. |
Instance Variable | _member |
Undocumented |
pytype.overlays.abc_overlay.ABCOverlay
, pytype.overlays.asyncio_types_overlay.AsyncioOverlay
, pytype.overlays.asyncio_types_overlay.TypesOverlay
, pytype.overlays.chex_overlay.ChexOverlay
, pytype.overlays.collections_overlay.CollectionsOverlay
, pytype.overlays.dataclass_overlay.DataclassOverlay
, pytype.overlays.enum_overlay.EnumOverlay
, pytype.overlays.flax_overlay.DataclassOverlay
, pytype.overlays.flax_overlay.LinenModuleOverlay
, pytype.overlays.flax_overlay.LinenOverlay
, pytype.overlays.functools_overlay.FunctoolsOverlay
, pytype.overlays.future_overlay.FutureUtilsOverlay
, pytype.overlays.pytype_extensions_overlay.PytypeExtensionsOverlay
, pytype.overlays.six_overlay.SixOverlay
, pytype.overlays.subprocess_overlay.SubprocessOverlay
, pytype.overlays.sys_overlay.SysOverlay
, pytype.overlays.typing_overlay.Redirect
, pytype.overlays.typing_overlay.TypingOverlay
, pytype.overlays.attr_overlay._AttrOverlayBase
Initialize the overlay. Args: ctx: Instance of context.Context. name: A string containing the name of the underlying module. member_map: Dict of str to abstract.BaseValues that provide type information not available in the underlying module. ast: An pytd.TypeDeclUnit containing the AST for the underlying module. Used to access type information for members of the module that are not explicitly provided by the overlay.
str
, member: BuilderType
, subst: Optional[ Dict[ str, cfg.Variable]]
= None) -> cfg.Variable
:
(source)
¶
pytype.overlays.typing_extensions_overlay.TypingExtensionsOverlay
, pytype.overlays.typing_overlay.TypingOverlay
Called to convert the items in _member_map to cfg.Variable.