Ejemplo n.º 1
0
 def _set_module_environment(self, node: astroid.Module) -> None:
     """Method to set environment of a Module node."""
     node.type_environment = Environment()
     for name in node.globals:
         if not any(isinstance(elt, (astroid.ImportFrom, astroid.Import)) for elt in node.globals[name]):
             node.type_environment.globals[name] = self.type_constraints.fresh_tvar(node.globals[name][0])
     self._populate_local_env(node)
Ejemplo n.º 2
0
 def _set_module_environment(self, node: astroid.Module) -> None:
     """Method to set environment of a Module node."""
     node.type_environment = Environment(
         globals_={
             name: self.type_constraints.fresh_tvar(node.globals[name][0])
             for name in node.globals
         })
     self._populate_local_env(node)
Ejemplo n.º 3
0
 def _set_module_environment(self, node: astroid.Module) -> None:
     """Method to set environment of a Module node."""
     node.type_environment = Environment()
     for name in node.globals:
         if not any(isinstance(elt, (astroid.ImportFrom, astroid.Import)) for elt in node.globals[name]):
             new_tvar = self.type_constraints.fresh_tvar(node.globals[name][0])
             if any(isinstance(elt, astroid.ClassDef) for elt in node.globals[name]):
                 self.type_constraints.unify(new_tvar, Type[ForwardRef(name)], node)
             node.type_environment.globals[name] = new_tvar
     self._populate_local_env(node)
 def _set_module_environment(self, node: astroid.Module) -> None:
     """Method to set environment of a Module node."""
     node.type_environment = Environment()
     for name in node.globals:
         if not any(
                 isinstance(elt, (astroid.ImportFrom, astroid.Import))
                 for elt in node.globals[name]):
             new_tvar = self.type_constraints.fresh_tvar(
                 node.globals[name][0])
             if any(
                     isinstance(elt, astroid.ClassDef)
                     for elt in node.globals[name]):
                 self.type_constraints.unify(new_tvar,
                                             Type[ForwardRef(name)], node)
             node.type_environment.globals[name] = new_tvar
     self._populate_local_env(node)