diff --git a/src/textual/app.py b/src/textual/app.py index 216062db7f..255abc6cf9 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -658,12 +658,6 @@ def __init_subclass__(cls, *args, **kwargs) -> None: ("MODES", cls.MODES), ): for screen_name, screen_object in screen_collection.items(): - if not isinstance(screen_name, str): - # Sanity check - raise TypeError( - f"expected a string for the name in {variable_name}, got {screen_name!r}", - ) - if not (isinstance(screen_object, str) or callable(screen_object)): if isinstance(screen_object, Screen): raise ValueError( @@ -2865,13 +2859,6 @@ async def _close_all(self) -> None: await self._prune(stack_screen) stack.clear() - # Close pre-defined screens. - for screen in self.SCREENS.values(): - # This is now dead code, since instances cannot be in SCREENS. - assert not isinstance( - screen, Screen - ), "instances in SCREENS are no longer possible" - # Close any remaining nodes # Should be empty by now remaining_nodes = list(self._registry)