From 3c138a4d2b7a973c0315ea015d5a171b52ed62bb Mon Sep 17 00:00:00 2001 From: Anton Lozhkov Date: Thu, 1 Sep 2022 14:56:25 +0200 Subject: [PATCH] Fix flake8 F401 imported but unused (#317) * Fix flake8 F401 '...' imported but unused * One more F403 --- setup.cfg | 1 + src/diffusers/__init__.py | 7 ++----- src/diffusers/models/__init__.py | 4 ---- src/diffusers/pipelines/__init__.py | 4 ---- src/diffusers/schedulers/__init__.py | 6 +----- src/diffusers/utils/__init__.py | 4 ---- 6 files changed, 4 insertions(+), 22 deletions(-) diff --git a/setup.cfg b/setup.cfg index 37cf34791b..fe555d61c6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,3 +17,4 @@ use_parentheses = True [flake8] ignore = E203, E722, E501, E741, W503, W605 max-line-length = 119 +per-file-ignores = __init__.py:F401 diff --git a/src/diffusers/__init__.py b/src/diffusers/__init__.py index d7292e7426..97eef97330 100644 --- a/src/diffusers/__init__.py +++ b/src/diffusers/__init__.py @@ -1,6 +1,3 @@ -# flake8: noqa -# There's no way to ignore "F401 '...' imported but unused" warnings in this -# module, but to preserve other warnings. So, don't check this module at all. from .utils import is_inflect_available, is_scipy_available, is_transformers_available, is_unidecode_available @@ -32,7 +29,7 @@ from .schedulers import ( if is_scipy_available(): from .schedulers import LMSDiscreteScheduler else: - from .utils.dummy_scipy_objects import * + from .utils.dummy_scipy_objects import * # noqa F403 from .training_utils import EMAModel @@ -45,4 +42,4 @@ if is_transformers_available(): StableDiffusionPipeline, ) else: - from .utils.dummy_transformers_objects import * + from .utils.dummy_transformers_objects import * # noqa F403 diff --git a/src/diffusers/models/__init__.py b/src/diffusers/models/__init__.py index 0c19b49b14..e0ac5c8d54 100644 --- a/src/diffusers/models/__init__.py +++ b/src/diffusers/models/__init__.py @@ -1,7 +1,3 @@ -# flake8: noqa -# There's no way to ignore "F401 '...' imported but unused" warnings in this -# module, but to preserve other warnings. So, don't check this module at all. - # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/diffusers/pipelines/__init__.py b/src/diffusers/pipelines/__init__.py index 25f6c928b7..8aad0c6761 100644 --- a/src/diffusers/pipelines/__init__.py +++ b/src/diffusers/pipelines/__init__.py @@ -1,7 +1,3 @@ -# flake8: noqa -# There's no way to ignore "F401 '...' imported but unused" warnings in this -# module, but to preserve other warnings. So, don't check this module at all. - from ..utils import is_transformers_available from .ddim import DDIMPipeline from .ddpm import DDPMPipeline diff --git a/src/diffusers/schedulers/__init__.py b/src/diffusers/schedulers/__init__.py index 5b5f774a62..20c25f3518 100644 --- a/src/diffusers/schedulers/__init__.py +++ b/src/diffusers/schedulers/__init__.py @@ -1,7 +1,3 @@ -# flake8: noqa -# There's no way to ignore "F401 '...' imported but unused" warnings in this -# module, but to preserve other warnings. So, don't check this module at all. - # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,4 +25,4 @@ from .scheduling_utils import SchedulerMixin if is_scipy_available(): from .scheduling_lms_discrete import LMSDiscreteScheduler else: - from ..utils.dummy_scipy_objects import * + from ..utils.dummy_scipy_objects import * # noqa F403 diff --git a/src/diffusers/utils/__init__.py b/src/diffusers/utils/__init__.py index aef3827df1..d4e31b84f8 100644 --- a/src/diffusers/utils/__init__.py +++ b/src/diffusers/utils/__init__.py @@ -1,7 +1,3 @@ -# flake8: noqa -# There's no way to ignore "F401 '...' imported but unused" warnings in this -# module, but to preserve other warnings. So, don't check this module at all. - # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License");