flake8: Clean up complained-about unused imports

This also adds a "# noqa: F401" comment on an unused "import lzma",
which we are using it in a try/except block that is being used to
check if the lzma module is importable; of course it is unused.

v2: This turned out to be a little tricky.

    mesonbuild/modules/__init__.py had the "unused" import:

        from ..interpreterbase import permittedKwargs, noKwargs

    However, that meant that the various modules could do things like:

        from . import noKwargs # "." is "mesonbuild.modules"

    Which breaks when you remove __init__.py's "unused" import.  I
    could have tagged that import with "# noqa: F401", but instead I
    chose to have each of the module import directly from
    "..interpreterbase" instead of ".".
pull/2357/head
Luke Shumaker 7 years ago
parent bb25260f00
commit 4dbbb4884c
  1. 2
      mesonbuild/backend/ninjabackend.py
  2. 1
      mesonbuild/backend/vs2010backend.py
  3. 1
      mesonbuild/modules/__init__.py
  4. 3
      mesonbuild/modules/gnome.py
  5. 3
      mesonbuild/modules/i18n.py
  6. 2
      mesonbuild/modules/modtest.py
  7. 2
      mesonbuild/modules/pkgconfig.py
  8. 3
      mesonbuild/modules/python3.py
  9. 2
      mesonbuild/modules/qt4.py
  10. 2
      mesonbuild/modules/qt5.py
  11. 2
      mesonbuild/modules/rpm.py
  12. 2
      mesonbuild/modules/windows.py
  13. 2
      mesonbuild/wrap/wrap.py
  14. 2
      mesonrewriter.py

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os, pickle, re, shlex, shutil, subprocess, sys import os, pickle, re, shlex, subprocess, sys
from collections import OrderedDict from collections import OrderedDict
from . import backends from . import backends

@ -22,7 +22,6 @@ from .. import build
from .. import dependencies from .. import dependencies
from .. import mlog from .. import mlog
from .. import compilers from .. import compilers
from ..build import BuildTarget
from ..compilers import CompilerArgs from ..compilers import CompilerArgs
from ..mesonlib import MesonException, File from ..mesonlib import MesonException, File
from ..environment import Environment from ..environment import Environment

@ -4,7 +4,6 @@ from .. import build
from .. import dependencies from .. import dependencies
from .. import mlog from .. import mlog
from ..mesonlib import MesonException from ..mesonlib import MesonException
from ..interpreterbase import permittedKwargs, noKwargs
class permittedSnippetKwargs: class permittedSnippetKwargs:

@ -17,7 +17,6 @@ functionality such as gobject-introspection, gresources and gtk-doc'''
from .. import build from .. import build
import os import os
import sys
import copy import copy
import subprocess import subprocess
from . import ModuleReturnValue from . import ModuleReturnValue
@ -30,7 +29,7 @@ from .. import interpreter
from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget
from . import find_program, get_include_args from . import find_program, get_include_args
from . import ExtensionModule from . import ExtensionModule
from . import noKwargs, permittedKwargs from ..interpreterbase import noKwargs, permittedKwargs
# gresource compilation is broken due to the way # gresource compilation is broken due to the way
# the resource compiler and Ninja clash about it # the resource compiler and Ninja clash about it

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import shutil import shutil
from os import path from os import path
@ -20,7 +19,7 @@ from .. import coredata, mesonlib, build
from ..mesonlib import MesonException from ..mesonlib import MesonException
from . import ModuleReturnValue from . import ModuleReturnValue
from . import ExtensionModule from . import ExtensionModule
from . import permittedKwargs from ..interpreterbase import permittedKwargs
PRESET_ARGS = { PRESET_ARGS = {
'glib': [ 'glib': [

@ -14,7 +14,7 @@
from . import ModuleReturnValue from . import ModuleReturnValue
from . import ExtensionModule from . import ExtensionModule
from . import noKwargs from ..interpreterbase import noKwargs
class TestModule(ExtensionModule): class TestModule(ExtensionModule):

@ -19,7 +19,7 @@ from .. import mesonlib
from .. import mlog from .. import mlog
from . import ModuleReturnValue from . import ModuleReturnValue
from . import ExtensionModule from . import ExtensionModule
from . import permittedKwargs from ..interpreterbase import permittedKwargs
class PkgConfigModule(ExtensionModule): class PkgConfigModule(ExtensionModule):

@ -18,7 +18,8 @@ from .. import mesonlib, dependencies
from . import ExtensionModule from . import ExtensionModule
from mesonbuild.modules import ModuleReturnValue from mesonbuild.modules import ModuleReturnValue
from . import noKwargs, permittedSnippetKwargs from . import permittedSnippetKwargs
from ..interpreterbase import noKwargs
from ..interpreter import shlib_kwargs from ..interpreter import shlib_kwargs
mod_kwargs = set() mod_kwargs = set()

@ -20,7 +20,7 @@ from ..dependencies import Qt4Dependency
from . import ExtensionModule from . import ExtensionModule
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from . import ModuleReturnValue from . import ModuleReturnValue
from . import permittedKwargs from ..interpreterbase import permittedKwargs
class Qt4Module(ExtensionModule): class Qt4Module(ExtensionModule):
tools_detected = False tools_detected = False

@ -20,7 +20,7 @@ from ..dependencies import Qt5Dependency
from . import ExtensionModule from . import ExtensionModule
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from . import ModuleReturnValue from . import ModuleReturnValue
from . import permittedKwargs from ..interpreterbase import permittedKwargs
class Qt5Module(ExtensionModule): class Qt5Module(ExtensionModule):
tools_detected = False tools_detected = False

@ -22,7 +22,7 @@ from .. import mlog
from . import GirTarget, TypelibTarget from . import GirTarget, TypelibTarget
from . import ModuleReturnValue from . import ModuleReturnValue
from . import ExtensionModule from . import ExtensionModule
from . import noKwargs from ..interpreterbase import noKwargs
import os import os

@ -20,7 +20,7 @@ from ..mesonlib import MesonException, extract_as_list
from . import get_include_args from . import get_include_args
from . import ModuleReturnValue from . import ModuleReturnValue
from . import ExtensionModule from . import ExtensionModule
from . import permittedKwargs from ..interpreterbase import permittedKwargs
class WindowsModule(ExtensionModule): class WindowsModule(ExtensionModule):

@ -299,7 +299,7 @@ class Resolver:
def extract_package(self, package): def extract_package(self, package):
if sys.version_info < (3, 5): if sys.version_info < (3, 5):
try: try:
import lzma import lzma # noqa: F401
del lzma del lzma
except ImportError: except ImportError:
pass pass

@ -23,7 +23,7 @@
# - move targets # - move targets
# - reindent? # - reindent?
from mesonbuild import mesonmain, mlog from mesonbuild import mesonmain
import sys import sys
if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save