(self, node: ast.ImportFrom, from_: str, to: str)
return self.wrapper.get_body(previous=node,  # type: ignore
                                     current=rewrote)[0]
Replaces import from with try/except with old and new import module.
Replaces import from with try/except with old and new import module.
Replaces import from with try / except with old and new import module .
def _replace_import_from_module(self, node: ast.ImportFrom, from_: str, to: str) -> ast.Try:
        """Replaces import from with try/except with old and new import module."""
        self._tree_changed = True

        rewrote_module = node.module.replace(from_, to, 1)
        rewrote = ast.ImportFrom(module=rewrote_module,
                                 names=node.names,
                                 level=node.level)

        return self.wrapper.get_body(previous=node,  # type: ignore
                                     current=rewrote)[0]
def _replace_import_from_module ( self , node : ast . ImportFrom , from_ : str , to : str ) -> ast . Try : self . _tree_changed = True rewrote_module = node . module . replace ( from_ , to , 1 ) rewrote = ast . ImportFrom ( module = rewrote_module , names = node . names , level = node . level ) return self . wrapper . get_body ( previous = node , # type: ignore current = rewrote ) [ 0 ]