From bf4eda7374c0cb592cdfd751b4d671d7715a6bb5 Mon Sep 17 00:00:00 2001 From: rht Date: Thu, 28 Sep 2017 03:00:26 +0200 Subject: [PATCH] tools: Remove absolute_import in most tools. Tweaked by tabbott to not remove it from lister.py, linter_lib, and friends, since those are intended to support both Python 2 and 3 (we're planning to extract them from the repository). --- tools/check-capitalization | 1 - tools/check-css | 1 - tools/check-frontend-i18n | 1 - tools/check-provision | 1 - tools/check-templates | 1 - tools/check-urls | 1 - tools/compile-handlebars-templates | 1 - tools/create-test-api-docs | 1 - tools/diagnose | 1 - tools/find-add-class | 1 - tools/get-handlebar-vars | 1 - tools/html-grep | 1 - tools/js-dep-visualizer.py | 1 - tools/lib/capitalization.py | 1 - tools/lib/css_parser.py | 1 - tools/lib/find_add_class.py | 1 - tools/lib/graph.py | 1 - tools/lib/html_branches.py | 1 - tools/lib/html_grep.py | 1 - tools/lib/pretty_print.py | 1 - tools/lib/template_parser.py | 1 - tools/lib/test_script.py | 1 - tools/minify-js | 1 - tools/pretty-print-html | 1 - tools/renumber-migrations | 1 - tools/replacer.py | 1 - tools/run-dev-queue-processors | 1 - tools/run-dev.py | 1 - tools/run-mypy | 1 - tools/setup/emoji/emoji_setup_utils.py | 1 - tools/test-api | 1 - tools/test-backend | 1 - tools/test-help-documentation.py | 1 - tools/test-queue-worker-reload | 1 - tools/test-run-dev | 1 - tools/test-tools | 1 - tools/tests/test_css_parser.py | 1 - tools/tests/test_html_branches.py | 1 - tools/tests/test_pretty_print.py | 1 - tools/tests/test_template_parser.py | 1 - tools/update-authors-json | 1 - tools/update-prod-static | 1 - tools/webpack | 1 - 43 files changed, 43 deletions(-) diff --git a/tools/check-capitalization b/tools/check-capitalization index ee26f03f64..d22e0870f7 100755 --- a/tools/check-capitalization +++ b/tools/check-capitalization @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function # check for the venv diff --git a/tools/check-css b/tools/check-css index 863c9626a2..b1126e25f1 100755 --- a/tools/check-css +++ b/tools/check-css @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from lib.css_parser import parse, CssParserException from typing import Iterable, Text diff --git a/tools/check-frontend-i18n b/tools/check-frontend-i18n index 8d750da85e..b5f548526d 100755 --- a/tools/check-frontend-i18n +++ b/tools/check-frontend-i18n @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from typing import List, Text diff --git a/tools/check-provision b/tools/check-provision index 0d4d4c8aca..cfce02eee3 100755 --- a/tools/check-provision +++ b/tools/check-provision @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function import os diff --git a/tools/check-templates b/tools/check-templates index f1dfcd1878..de285dd98f 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from lib.template_parser import validate from lib.html_branches import build_id_dict diff --git a/tools/check-urls b/tools/check-urls index 61d942700a..c796c63271 100755 --- a/tools/check-urls +++ b/tools/check-urls @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function import re diff --git a/tools/compile-handlebars-templates b/tools/compile-handlebars-templates index c1eccdff43..1039d29e39 100755 --- a/tools/compile-handlebars-templates +++ b/tools/compile-handlebars-templates @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function import os diff --git a/tools/create-test-api-docs b/tools/create-test-api-docs index 047866bd39..2e9c72dd4c 100755 --- a/tools/create-test-api-docs +++ b/tools/create-test-api-docs @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import # check for the venv from lib import sanity_check diff --git a/tools/diagnose b/tools/diagnose index 4cf16ba7a5..6b01e692df 100755 --- a/tools/diagnose +++ b/tools/diagnose @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import os import platform import sys diff --git a/tools/find-add-class b/tools/find-add-class index 92176c14ee..dda68c76e4 100755 --- a/tools/find-add-class +++ b/tools/find-add-class @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from lib.find_add_class import display, find diff --git a/tools/get-handlebar-vars b/tools/get-handlebar-vars index 721c3bec66..c233d4a042 100755 --- a/tools/get-handlebar-vars +++ b/tools/get-handlebar-vars @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import sys import re import json diff --git a/tools/html-grep b/tools/html-grep index 2b5b82a651..a71180626a 100755 --- a/tools/html-grep +++ b/tools/html-grep @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from lib.html_grep import grep import optparse diff --git a/tools/js-dep-visualizer.py b/tools/js-dep-visualizer.py index 376b6d69ef..223be091fd 100755 --- a/tools/js-dep-visualizer.py +++ b/tools/js-dep-visualizer.py @@ -4,7 +4,6 @@ $ ./tools/js-dep-visualizer.py $ dot -Tpng var/zulip-deps.dot -o var/zulip-deps.png """ -from __future__ import absolute_import from __future__ import print_function import os diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py index e6056650b4..cbbc3c3469 100644 --- a/tools/lib/capitalization.py +++ b/tools/lib/capitalization.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from typing import List, Tuple, Set, Pattern, Match import re diff --git a/tools/lib/css_parser.py b/tools/lib/css_parser.py index 7298d8f2c5..e227f48c44 100644 --- a/tools/lib/css_parser.py +++ b/tools/lib/css_parser.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from six.moves import range from typing import Callable, List, Tuple, Union diff --git a/tools/lib/find_add_class.py b/tools/lib/find_add_class.py index 011ea87a74..6160f9a591 100644 --- a/tools/lib/find_add_class.py +++ b/tools/lib/find_add_class.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import List, Set, Tuple diff --git a/tools/lib/graph.py b/tools/lib/graph.py index c2e772b0e5..4589ffcee5 100644 --- a/tools/lib/graph.py +++ b/tools/lib/graph.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from collections import defaultdict diff --git a/tools/lib/html_branches.py b/tools/lib/html_branches.py index b401548ad7..f2e5e27030 100644 --- a/tools/lib/html_branches.py +++ b/tools/lib/html_branches.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import Dict, List, Optional, Set diff --git a/tools/lib/html_grep.py b/tools/lib/html_grep.py index b3cdf35d7d..89b228cc49 100644 --- a/tools/lib/html_grep.py +++ b/tools/lib/html_grep.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from collections import defaultdict from six.moves import range diff --git a/tools/lib/pretty_print.py b/tools/lib/pretty_print.py index be35c53bcb..8754a414b5 100644 --- a/tools/lib/pretty_print.py +++ b/tools/lib/pretty_print.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import Any, Dict, List diff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.py index 24ef236735..f9bd6af83a 100644 --- a/tools/lib/template_parser.py +++ b/tools/lib/template_parser.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import Callable, List, Optional from six.moves import range diff --git a/tools/lib/test_script.py b/tools/lib/test_script.py index ebdd46cf78..2c10225946 100644 --- a/tools/lib/test_script.py +++ b/tools/lib/test_script.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import Optional, Tuple diff --git a/tools/minify-js b/tools/minify-js index 7d2f27e225..a7c1a30dbd 100755 --- a/tools/minify-js +++ b/tools/minify-js @@ -2,7 +2,6 @@ # Minifies JavaScripts, creating source maps -from __future__ import absolute_import from __future__ import print_function import os diff --git a/tools/pretty-print-html b/tools/pretty-print-html index 2e191c256a..d5e03dacc6 100755 --- a/tools/pretty-print-html +++ b/tools/pretty-print-html @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from typing import List from lib.pretty_print import pretty_print_html diff --git a/tools/renumber-migrations b/tools/renumber-migrations index b4fc7701bd..656e691091 100755 --- a/tools/renumber-migrations +++ b/tools/renumber-migrations @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function from six.moves import input, map, range import glob diff --git a/tools/replacer.py b/tools/replacer.py index 42a507c472..bdda85487c 100755 --- a/tools/replacer.py +++ b/tools/replacer.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import absolute_import import argparse import sys diff --git a/tools/run-dev-queue-processors b/tools/run-dev-queue-processors index 470f2e5cee..7c7208e1f5 100755 --- a/tools/run-dev-queue-processors +++ b/tools/run-dev-queue-processors @@ -5,7 +5,6 @@ # separate script so that the import from zerver.worker.queue_processors (which # is slow) can be done in parallel with the rest of the work in bringing up the # dev server. -from __future__ import absolute_import import sys import os import subprocess diff --git a/tools/run-dev.py b/tools/run-dev.py index f687a7ff8f..202c3119f1 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import optparse import os diff --git a/tools/run-mypy b/tools/run-mypy index 54f4fb1302..f0f69a3f26 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function import os diff --git a/tools/setup/emoji/emoji_setup_utils.py b/tools/setup/emoji/emoji_setup_utils.py index b4977b0080..aa8112242c 100644 --- a/tools/setup/emoji/emoji_setup_utils.py +++ b/tools/setup/emoji/emoji_setup_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import # This tool contains all of the rules that we use to decide which of # the various emoji names in emoji-map.json we should actually use in # autocomplete and emoji pickers. You can't do all of them, because diff --git a/tools/test-api b/tools/test-api index 86a9103245..d0a6f02d53 100755 --- a/tools/test-api +++ b/tools/test-api @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import os import sys diff --git a/tools/test-backend b/tools/test-backend index e620509946..d74ff73827 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import from typing import List, Any import glob import optparse diff --git a/tools/test-help-documentation.py b/tools/test-help-documentation.py index 70239601da..d0774c5e2a 100755 --- a/tools/test-help-documentation.py +++ b/tools/test-help-documentation.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import optparse import os import sys diff --git a/tools/test-queue-worker-reload b/tools/test-queue-worker-reload index 54ade835c2..c34f994240 100755 --- a/tools/test-queue-worker-reload +++ b/tools/test-queue-worker-reload @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import os import sys diff --git a/tools/test-run-dev b/tools/test-run-dev index b1f75f3ec3..9be9231901 100755 --- a/tools/test-run-dev +++ b/tools/test-run-dev @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from __future__ import print_function -from __future__ import absolute_import import os import sys diff --git a/tools/test-tools b/tools/test-tools index 542576c662..5fee5aad69 100755 --- a/tools/test-tools +++ b/tools/test-tools @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import absolute_import from __future__ import print_function import argparse diff --git a/tools/tests/test_css_parser.py b/tools/tests/test_css_parser.py index 852168393a..733940879a 100644 --- a/tools/tests/test_css_parser.py +++ b/tools/tests/test_css_parser.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import cast, Any diff --git a/tools/tests/test_html_branches.py b/tools/tests/test_html_branches.py index 961d2d0aef..8f4ec99139 100644 --- a/tools/tests/test_html_branches.py +++ b/tools/tests/test_html_branches.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function import unittest diff --git a/tools/tests/test_pretty_print.py b/tools/tests/test_pretty_print.py index a6efcf83ba..6217a55317 100644 --- a/tools/tests/test_pretty_print.py +++ b/tools/tests/test_pretty_print.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function import unittest diff --git a/tools/tests/test_template_parser.py b/tools/tests/test_template_parser.py index b67d566285..34faeebfc9 100644 --- a/tools/tests/test_template_parser.py +++ b/tools/tests/test_template_parser.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from __future__ import print_function from typing import Optional, Any diff --git a/tools/update-authors-json b/tools/update-authors-json index 7f050849ad..12c656b41e 100755 --- a/tools/update-authors-json +++ b/tools/update-authors-json @@ -4,7 +4,6 @@ Fetch contributors data from Github using their API, convert it to structured JSON data for the /about page authors section. """ -from __future__ import absolute_import, print_function # check for the venv from lib import sanity_check diff --git a/tools/update-prod-static b/tools/update-prod-static index 7dd348d83b..07d5cde149 100755 --- a/tools/update-prod-static +++ b/tools/update-prod-static @@ -2,7 +2,6 @@ # Updates static files for production. -from __future__ import absolute_import import os import subprocess diff --git a/tools/webpack b/tools/webpack index dbe144df99..884c81946b 100755 --- a/tools/webpack +++ b/tools/webpack @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -from __future__ import absolute_import import argparse import os