]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Enable F821
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 1 Jan 2020 23:24:03 +0000 (18:24 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Jan 2020 17:56:26 +0000 (12:56 -0500)
commit217948f5c79e03956de998af86fef77ebc3edb76
tree761aaf7ae0a379863e6f149c6812d0d3794ba10a
parent5881fd274015af3de37f2ff0f91ff6a7c61c1540
Enable F821

In Ia63a510f9c1d08b055eef62cf047f1f427f0450c we introduced
"lambda combinations" which use a bit of function closure inspection
in order to allow for testing combinations that make use of symbols that
come from test fixtures, or from the test itself.

Two problems.  One is that we can't use F821 flake8 rule without either
adding lots of noqas, skipping the file, or adding arguments to the
lambdas themselves that are then populated, which makes for a very
verbose system.  The other is that the system is already verbose
with all those lambdas and the magic in use is a non-explicit kind,
hence F821 reminds us that if we can improve upon this, we should.

So let's improve upon it by making it so that the "lambda" is just
once and up front for the whole thing, and let it accept the arguments
directly.   This still requires magic, because these test cases need
to resolve at test collection time, not test runtime.  But we will
instead substitute a namespace up front that can be coerced into
its desired form within the tests.

Additionally, there's a little bit of py2k compatible type annotations
present; f821 is checking these, so we have to add those imports
also using the TYPE_CHECKING boolean so they don't take place in
py2k.

Change-Id: Idb7e7a0c8af86d9ab133f548511306ef68cdba14
17 files changed:
lib/sqlalchemy/dialects/mysql/pyodbc.py
lib/sqlalchemy/engine/mock.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/__init__.py
lib/sqlalchemy/testing/exclusions.py
lib/sqlalchemy/testing/util.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/compat.py
setup.cfg
test/dialect/mssql/test_compiler.py
test/orm/test_query.py