コード例 #1
0
    def _check_from_import(self, node: ast.ImportFrom) -> None:
        if node.level != 0:
            self._error_callback(LocalFolderImportViolation(node))

        if node.module == '__future__':
            for alias in node.names:
                if alias.name not in FUTURE_IMPORTS_WHITELIST:
                    self._error_callback(
                        FutureImportViolation(node, text=alias.name), )
コード例 #2
0
 def check_local_import(self, node: ast.ImportFrom) -> None:
     if node.level != 0:
         self._error_callback(LocalFolderImportViolation(node))
コード例 #3
0
 def check_local_import(self, node: ast.ImportFrom) -> None:
     text = get_error_text(node)
     if node.level != 0:
         self.error_callback(LocalFolderImportViolation(node, text=text), )