diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 01:19:47 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 18:23:11 -0500 |
commit | 1e278de4cc9a4181e0747640a960e80efcea1ca9 (patch) | |
tree | 13d0c035807613bfa07e734acad79b9c843cb8b0 /examples/postgis/postgis.py | |
parent | 1e1a38e7801f410f244e4bbb44ec795ae152e04e (diff) | |
download | sqlalchemy-1e278de4cc9a4181e0747640a960e80efcea1ca9.tar.gz |
Post black reformatting
Applied on top of a pure run of black -l 79 in
I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes
resolves all remaining flake8 conditions for those codes
we have enabled in setup.cfg.
Included are resolutions for all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.
Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
Diffstat (limited to 'examples/postgis/postgis.py')
-rw-r--r-- | examples/postgis/postgis.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/examples/postgis/postgis.py b/examples/postgis/postgis.py index 508d63398..868d3d055 100644 --- a/examples/postgis/postgis.py +++ b/examples/postgis/postgis.py @@ -1,8 +1,12 @@ -from sqlalchemy.types import UserDefinedType, _Binary, TypeDecorator -from sqlalchemy.sql import expression, type_coerce -from sqlalchemy import event, Table import binascii +from sqlalchemy import event +from sqlalchemy import Table +from sqlalchemy.sql import expression +from sqlalchemy.sql import type_coerce +from sqlalchemy.types import UserDefinedType + + # Python datatypes @@ -278,7 +282,8 @@ if __name__ == "__main__": ] ) - # or use an explicit TextualGisElement (similar to saying func.GeomFromText()) + # or use an explicit TextualGisElement + # (similar to saying func.GeomFromText()) r = Road( road_name="Dave Cres", road_geom=TextualGisElement( @@ -292,7 +297,8 @@ if __name__ == "__main__": session.commit() - # after flush and/or commit, all the TextualGisElements become PersistentGisElements. + # after flush and/or commit, all the TextualGisElements + # become PersistentGisElements. assert str(r.road_geom) == "LINESTRING(198231 263418,198213 268322)" r1 = session.query(Road).filter(Road.road_name == "Graeme Ave").one() @@ -318,16 +324,16 @@ if __name__ == "__main__": ) print(session.execute(stmt).fetchall()) - # TODO: for some reason the auto-generated labels have the internal replacement - # strings exposed, even though PG doesn't complain + # TODO: for some reason the auto-generated labels have the internal + # replacement strings exposed, even though PG doesn't complain # look up the hex binary version, using SQLAlchemy casts as_binary = session.scalar( select([type_coerce(r.road_geom, Geometry(coerce_="binary"))]) ) - assert ( - as_binary.as_hex - == "01020000000200000000000000b832084100000000e813104100000000283208410000000088601041" + assert as_binary.as_hex == ( + "01020000000200000000000000b832084100000000" + "e813104100000000283208410000000088601041" ) # back again, same method ! |