# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black
- rev: 21.12b0
+ rev: 22.3.0
hooks:
- id: black
e1.data = "e2"
session.commit()
-assert (
- session.query(
- Example.id,
- Example.version_id,
- Example.is_current_version,
- Example.calc_is_current_version,
- Example.data,
- )
- .order_by(Example.id, Example.version_id)
- .all()
- == ([(1, 1, False, False, "e1"), (1, 2, True, True, "e2")])
+assert session.query(
+ Example.id,
+ Example.version_id,
+ Example.is_current_version,
+ Example.calc_is_current_version,
+ Example.data,
+).order_by(Example.id, Example.version_id).all() == (
+ [(1, 1, False, False, "e1"), (1, 2, True, True, "e2")]
)
# example 2, versioning with a parent
assert p1.child_id == 1
assert p1.child.version_id == 2
-assert (
- session.query(
- Child.id,
- Child.version_id,
- Child.is_current_version,
- Child.calc_is_current_version,
- Child.data,
- )
- .order_by(Child.id, Child.version_id)
- .all()
- == ([(1, 1, False, False, "c1"), (1, 2, True, True, "c2")])
+assert session.query(
+ Child.id,
+ Child.version_id,
+ Child.is_current_version,
+ Child.calc_is_current_version,
+ Child.data,
+).order_by(Child.id, Child.version_id).all() == (
+ [(1, 1, False, False, "c1"), (1, 2, True, True, "c2")]
)
)
if self.retrieve_as_bitwise:
self._bitmap = dict(
- (value, 2 ** idx) for idx, value in enumerate(self.values)
+ (value, 2**idx) for idx, value in enumerate(self.values)
)
self._bitmap.update(
- (2 ** idx, value) for idx, value in enumerate(self.values)
+ (2**idx, value) for idx, value in enumerate(self.values)
)
length = max([len(v) for v in values] + [0])
kw.setdefault("length", length)
"""
- id_ = random.randint(0, 2 ** 128)
+ id_ = random.randint(0, 2**128)
return (0x1234, "%032x" % id_, "%032x" % 9)
def do_executemany(self, cursor, statement, parameters, context=None):
do_commit_twophase(). Its format is unspecified.
"""
- return "_sa_%032x" % random.randint(0, 2 ** 128)
+ return "_sa_%032x" % random.randint(0, 2**128)
def do_savepoint(self, connection, name):
connection.execute(expression.SavepointClause(name))
"""
- return (
- not isinstance(
- element,
- (Visitable, schema.SchemaEventTarget),
- )
- and not hasattr(element, "__clause_element__")
- )
+ return not isinstance(
+ element,
+ (Visitable, schema.SchemaEventTarget),
+ ) and not hasattr(element, "__clause_element__")
def _deep_is_literal(element):
if col.autoincrement is True:
_validate_autoinc(col, True)
return col
- elif (
- col.autoincrement
- in (
- "auto",
- "ignore_fk",
- )
- and _validate_autoinc(col, False)
- ):
+ elif col.autoincrement in (
+ "auto",
+ "ignore_fk",
+ ) and _validate_autoinc(col, False):
return col
else:
)
return bit_table
- i, j, k, l = 255, 2 ** 32 - 1, 2 ** 63 - 1, 2 ** 64 - 1
+ i, j, k, l = 255, 2**32 - 1, 2**63 - 1, 2**64 - 1
@testing.combinations(
(([0] * 8), None),
"start": 1,
"increment": 1,
"on_null": False,
- "maxvalue": 10 ** 28 - 1,
+ "maxvalue": 10**28 - 1,
"minvalue": 1,
"cycle": False,
"cache": 20,
elif col["name"] == "id2":
is_true("identity" in col)
exp = default.copy()
- exp.update(maxvalue=2 ** 31 - 1)
+ exp.update(maxvalue=2**31 - 1)
eq_(col["identity"], exp)
elif col["name"] == "id3":
is_true("identity" in col)
exp = default.copy()
- exp.update(maxvalue=2 ** 63 - 1)
+ exp.update(maxvalue=2**63 - 1)
eq_(col["identity"], exp)
elif col["name"] == "id4":
is_true("identity" in col)
exp = default.copy()
- exp.update(maxvalue=2 ** 15 - 1)
+ exp.update(maxvalue=2**15 - 1)
eq_(col["identity"], exp)
for idx, (typ, errmsg) in enumerate(output):
if is_re:
if re.match(
- fr".*{filename}\:{num}\: {typ}\: {prefix}{msg}", # noqa E501
+ rf".*{filename}\:{num}\: {typ}\: {prefix}{msg}", # noqa E501
errmsg,
):
break
# test passive_updates=True; update user
self.assert_sql_count(testing.db, go, 1)
sess.expunge_all()
- assert (
- User(
- username="jack",
- addresses=[Address(username="jack"), Address(username="jack")],
- )
- == sess.get(User, "jack")
- )
+ assert User(
+ username="jack",
+ addresses=[Address(username="jack"), Address(username="jack")],
+ ) == sess.get(User, "jack")
u1 = sess.get(User, "jack")
u1.addresses = []
# test passive_updates=True; update user
self.assert_sql_count(testing.db, go, 1)
sess.expunge_all()
- assert (
- User(
- username="jack",
- addresses=[Address(username="jack"), Address(username="jack")],
- )
- == sess.get(User, u1.id)
- )
+ assert User(
+ username="jack",
+ addresses=[Address(username="jack"), Address(username="jack")],
+ ) == sess.get(User, u1.id)
sess.expunge_all()
u1 = sess.get(User, u1.id)
# in case it requires a version pin
pydocstyle
pygments
- black==21.12b0
+ black==22.3.0
slotscheck>=0.12,<0.13
# this is to satisfy the mypy plugin dependency