Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

chore(python): use black==22.3.0 #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae
digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
13 changes: 11 additions & 2 deletions 13 docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(root_doc, "sqlalchemy-bigquery", "sqlalchemy-bigquery Documentation", [author], 1,)
(
root_doc,
"sqlalchemy-bigquery",
"sqlalchemy-bigquery Documentation",
[author],
1,
)
]

# If true, show URL addresses after external links.
Expand Down Expand Up @@ -355,7 +361,10 @@
intersphinx_mapping = {
"python": ("https://python.readthedocs.org/en/latest/", None),
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"google.api_core": (
"https://googleapis.dev/python/google-api-core/latest/",
None,
),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
Expand Down
9 changes: 6 additions & 3 deletions 9 noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import nox


BLACK_VERSION = "black==19.10b0"
BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["docs", "sqlalchemy_bigquery", "tests", "noxfile.py", "setup.py"]

DEFAULT_PYTHON_VERSION = "3.8"
Expand Down Expand Up @@ -61,7 +61,9 @@ def lint(session):
"""
session.install("flake8", BLACK_VERSION)
session.run(
"black", "--check", *BLACK_PATHS,
"black",
"--check",
*BLACK_PATHS,
)
session.run("flake8", "sqlalchemy_bigquery", "tests")

Expand All @@ -71,7 +73,8 @@ def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
session.run(
"black", *BLACK_PATHS,
"black",
*BLACK_PATHS,
)


Expand Down
4 changes: 2 additions & 2 deletions 4 samples/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING

BLACK_VERSION = "black==19.10b0"
BLACK_VERSION = "black==22.3.0"

# Copy `noxfile_config.py` to your directory and modify it instead.

Expand Down Expand Up @@ -253,7 +253,7 @@ def py(session: nox.sessions.Session) -> None:


def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
"""Returns the root folder of the project."""
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
for i in range(10):
Expand Down
6 changes: 4 additions & 2 deletions 6 sqlalchemy_bigquery/_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ def _field_index(self, name, operator):
bindparam_type=sqlalchemy.types.String(),
)


else:

def _field_index(self, name, operator):
return sqlalchemy.sql.default_comparator._check_literal(
self.expr, operator, name, bindparam_type=sqlalchemy.types.String(),
self.expr,
operator,
name,
bindparam_type=sqlalchemy.types.String(),
)


Expand Down
13 changes: 6 additions & 7 deletions 13 sqlalchemy_bigquery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class BigQueryIdentifierPreparer(IdentifierPreparer):

def __init__(self, dialect):
super(BigQueryIdentifierPreparer, self).__init__(
dialect, initial_quote="`",
dialect,
initial_quote="`",
)

def quote_column(self, value):
Expand Down Expand Up @@ -349,7 +350,7 @@ def group_by_clause(self, select, **kw):
__expanding_conflict = "" if __sqlalchemy_version_info < (1, 4, 27) else "__"

__in_expanding_bind = _helpers.substitute_string_re_method(
fr"""
rf"""
\sIN\s\( # ' IN ('
(
{__expanding_conflict}\[ # Expanding placeholder
Expand Down Expand Up @@ -435,7 +436,7 @@ def visit_notendswith_op_binary(self, binary, operator, **kw):
__placeholder = re.compile(r"%\(([^\]:]+)(:[^\]:]+)?\)s$").match

__expanded_param = re.compile(
fr"\({__expanding_conflict}\[" fr"{__expanding_text}" fr"_[^\]]+\]\)$"
rf"\({__expanding_conflict}\[" rf"{__expanding_text}" rf"_[^\]]+\]\)$"
).match

__remove_type_parameter = _helpers.substitute_string_re_method(
Expand Down Expand Up @@ -681,8 +682,7 @@ def literal_processor(self, dialect):


class BQClassTaggedStr(sqlalchemy.sql.type_api.TypeEngine):
"""Type that can get literals via str
"""
"""Type that can get literals via str"""

@staticmethod
def process_literal_as_class_tagged_str(value):
Expand All @@ -693,8 +693,7 @@ def literal_processor(self, dialect):


class BQTimestamp(sqlalchemy.sql.type_api.TypeEngine):
"""Type that can get literals via str
"""
"""Type that can get literals via str"""

@staticmethod
def process_timestamp_literal(value):
Expand Down
89 changes: 71 additions & 18 deletions 89 sqlalchemy_bigquery/geography.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class Lake(Base):

def __init__(self):
super().__init__(
geometry_type=None, spatial_index=False, srid=SRID,
geometry_type=None,
spatial_index=False,
srid=SRID,
)
self.extended = True

Expand Down Expand Up @@ -198,43 +200,94 @@ def _fixup_st_arguments(element, compiler, **kw):
st_boundary=(GEOGRAPHY,),
st_centroid=(GEOGRAPHY,),
st_centroid_agg=(GEOGRAPHY,),
st_closestpoint=(GEOGRAPHY, GEOGRAPHY,),
st_closestpoint=(
GEOGRAPHY,
GEOGRAPHY,
),
st_clusterdbscan=(GEOGRAPHY,),
st_contains=(GEOGRAPHY, GEOGRAPHY,),
st_contains=(
GEOGRAPHY,
GEOGRAPHY,
),
st_convexhull=(GEOGRAPHY,),
st_coveredby=(GEOGRAPHY, GEOGRAPHY,),
st_covers=(GEOGRAPHY, GEOGRAPHY,),
st_difference=(GEOGRAPHY, GEOGRAPHY,),
st_coveredby=(
GEOGRAPHY,
GEOGRAPHY,
),
st_covers=(
GEOGRAPHY,
GEOGRAPHY,
),
st_difference=(
GEOGRAPHY,
GEOGRAPHY,
),
st_dimension=(GEOGRAPHY,),
st_disjoint=(GEOGRAPHY, GEOGRAPHY,),
st_distance=(GEOGRAPHY, GEOGRAPHY,),
st_disjoint=(
GEOGRAPHY,
GEOGRAPHY,
),
st_distance=(
GEOGRAPHY,
GEOGRAPHY,
),
st_dump=(GEOGRAPHY,),
st_dwithin=(GEOGRAPHY, GEOGRAPHY,),
st_dwithin=(
GEOGRAPHY,
GEOGRAPHY,
),
st_endpoint=(GEOGRAPHY,),
st_equals=(GEOGRAPHY, GEOGRAPHY,),
st_equals=(
GEOGRAPHY,
GEOGRAPHY,
),
st_exteriorring=(GEOGRAPHY,),
st_geohash=(GEOGRAPHY,),
st_intersection=(GEOGRAPHY, GEOGRAPHY,),
st_intersects=(GEOGRAPHY, GEOGRAPHY,),
st_intersection=(
GEOGRAPHY,
GEOGRAPHY,
),
st_intersects=(
GEOGRAPHY,
GEOGRAPHY,
),
st_intersectsbox=(GEOGRAPHY,),
st_iscollection=(GEOGRAPHY,),
st_isempty=(GEOGRAPHY,),
st_length=(GEOGRAPHY,),
st_makeline=(GEOGRAPHY, GEOGRAPHY,),
st_makepolygon=(GEOGRAPHY, GEOGRAPHY,),
st_makeline=(
GEOGRAPHY,
GEOGRAPHY,
),
st_makepolygon=(
GEOGRAPHY,
GEOGRAPHY,
),
st_makepolygonoriented=(GEOGRAPHY,),
st_maxdistance=(GEOGRAPHY, GEOGRAPHY,),
st_maxdistance=(
GEOGRAPHY,
GEOGRAPHY,
),
st_npoints=(GEOGRAPHY,),
st_numpoints=(GEOGRAPHY,),
st_perimeter=(GEOGRAPHY,),
st_pointn=(GEOGRAPHY,),
st_simplify=(GEOGRAPHY,),
st_snaptogrid=(GEOGRAPHY,),
st_startpoint=(GEOGRAPHY,),
st_touches=(GEOGRAPHY, GEOGRAPHY,),
st_union=(GEOGRAPHY, GEOGRAPHY,),
st_touches=(
GEOGRAPHY,
GEOGRAPHY,
),
st_union=(
GEOGRAPHY,
GEOGRAPHY,
),
st_union_agg=(GEOGRAPHY,),
st_within=(GEOGRAPHY, GEOGRAPHY,),
st_within=(
GEOGRAPHY,
GEOGRAPHY,
),
st_x=(GEOGRAPHY,),
st_y=(GEOGRAPHY,),
)
Expand Down
10 changes: 7 additions & 3 deletions 10 tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def literal(value):
with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal):
super(TimestampMicrosecondsTest, self).test_literal()


else:
from sqlalchemy.testing.suite import (
FetchLimitOffsetTest as _FetchLimitOffsetTest,
Expand All @@ -95,7 +94,9 @@ def test_limit_render_multiple_times(self, connection):
u = sqlalchemy.union(select(stmt), select(stmt)).subquery().select()

self._assert_result(
connection, u, [(1,)],
connection,
u,
[(1,)],
)

del DifficultParametersTest # exercises column names illegal in BQ
Expand Down Expand Up @@ -193,7 +194,10 @@ def test_select_exists(self, connection):
eq_(
connection.execute(
select([stuff.c.id]).where(
and_(stuff.c.id == 1, exists().where(stuff.c.data == "some data"),)
and_(
stuff.c.id == 1,
exists().where(stuff.c.data == "some data"),
)
)
).fetchall(),
[(1,)],
Expand Down
8 changes: 6 additions & 2 deletions 8 tests/system/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def load_sample_data(

with open(DATA_DIR / filename, "rb") as data_file:
return bigquery_client.load_table_from_file(
data_file, full_table_id, job_config=sample_config,
data_file,
full_table_id,
job_config=sample_config,
)


Expand Down Expand Up @@ -86,7 +88,9 @@ def bigquery_dataset(
filename="sample_one_row.json",
)
job2.result()
view = bigquery.Table(f"{project_id}.{dataset_id}.sample_view",)
view = bigquery.Table(
f"{project_id}.{dataset_id}.sample_view",
)
view.view_query = f"SELECT string FROM `{dataset_id}.sample`"
bigquery_client.create_table(view)
yield dataset_id
Expand Down
8 changes: 6 additions & 2 deletions 8 tests/system/test__struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def test_unnest_and_struct_access_233(engine, bigquery_dataset, metadata):
metadata.create_all(engine)

conn.execute(
mock_table.insert(), dict(mock_id="x"), dict(mock_id="y"), dict(mock_id="z"),
mock_table.insert(),
dict(mock_id="x"),
dict(mock_id="y"),
dict(mock_id="z"),
)
conn.execute(
another_mock_table.insert(),
Expand All @@ -160,7 +163,8 @@ def test_unnest_and_struct_access_233(engine, bigquery_dataset, metadata):
).subquery()

join = mock_table.join(
subquery, subquery.c.another_mock_objects["object_id"] == mock_table.c.mock_id,
subquery,
subquery.c.another_mock_objects["object_id"] == mock_table.c.mock_id,
)

query = select(mock_table).select_from(join)
Expand Down
6 changes: 4 additions & 2 deletions 6 tests/system/test_geography.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def test_geoalchemy2_core(bigquery_dataset):

conn.execute(
lake_table.insert().values(
name="Majeur", geog="POLYGON((0 0,1 0,1 1,0 1,0 0))",
name="Majeur",
geog="POLYGON((0 0,1 0,1 1,0 1,0 0))",
)
)

Expand Down Expand Up @@ -113,7 +114,8 @@ def test_geoalchemy2_core(bigquery_dataset):

conn.execute(
lake_table.insert().values(
name="test2", geog=WKT("POLYGON((1 0,3 0,3 2,1 2,1 0))"),
name="test2",
geog=WKT("POLYGON((1 0,3 0,3 2,1 2,1 0))"),
)
)
assert (
Expand Down
9 changes: 6 additions & 3 deletions 9 tests/system/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def test_create_bigquery_client_with_credentials_path_respects_project(
https://github.com/googleapis/python-bigquery-sqlalchemy/issues/48
"""
bqclient = module_under_test.create_bigquery_client(
credentials_path=credentials_path, project_id="connection-url-project",
credentials_path=credentials_path,
project_id="connection-url-project",
)
assert bqclient.project == "connection-url-project"

Expand All @@ -76,7 +77,8 @@ def test_create_bigquery_client_with_credentials_info_respects_project(
https://github.com/googleapis/python-bigquery-sqlalchemy/issues/48
"""
bqclient = module_under_test.create_bigquery_client(
credentials_info=credentials_info, project_id="connection-url-project",
credentials_info=credentials_info,
project_id="connection-url-project",
)
assert bqclient.project == "connection-url-project"

Expand All @@ -98,6 +100,7 @@ def test_create_bigquery_client_with_credentials_base64_respects_project(
https://github.com/googleapis/python-bigquery-sqlalchemy/issues/48
"""
bqclient = module_under_test.create_bigquery_client(
credentials_base64=credentials_base64, project_id="connection-url-project",
credentials_base64=credentials_base64,
project_id="connection-url-project",
)
assert bqclient.project == "connection-url-project"
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.