Skip to content

Commit

Permalink
blacken/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jimfulton committed Jul 22, 2021
1 parent bbe4d79 commit bf6011c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
18 changes: 16 additions & 2 deletions docs/conf.py
Expand Up @@ -278,7 +278,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "sqlalchemy-bigquery.tex", "sqlalchemy-bigquery Documentation", author, "manual",)
(
master_doc,
"sqlalchemy-bigquery.tex",
"sqlalchemy-bigquery Documentation",
author,
"manual",
)
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -306,7 +312,15 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "sqlalchemy-bigquery", "sqlalchemy-bigquery Documentation", [author], 1,)]
man_pages = [
(
master_doc,
"sqlalchemy-bigquery",
"sqlalchemy-bigquery Documentation",
[author],
1,
)
]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Expand Up @@ -36,7 +36,7 @@

package_root = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(package_root, "sqlalchemy_bigquery", "version.py")) as f:
version = re.search('__version__ = "([^\"]+)"', f.read()).group(1)
version = re.search('__version__ = "([^"]+)"', f.read()).group(1)


def readme():
Expand Down Expand Up @@ -79,11 +79,8 @@ def readme():
python_requires=">=3.6, <3.10",
tests_require=["pytz"],
entry_points={
"sqlalchemy.dialects": [
"bigquery = sqlalchemy_bigquery:BigQueryDialect"
]
"sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]
},

# Document that this replaces pybigquery, however, this isn't
# enforced by pip, because doing so would allow rogue packages to
# obsolete legitimate ones.
Expand Down
28 changes: 25 additions & 3 deletions sqlalchemy_bigquery/__init__.py
Expand Up @@ -35,17 +35,39 @@
RECORD,
NUMERIC,
BIGNUMERIC,
)
)

__all__ = [
"__version__",
"BigQueryDialect",
"STRING",
"BOOL",
"BOOLEAN",
"INT64",
"INTEGER",
"FLOAT64",
"FLOAT",
"TIMESTAMP",
"DATETIME",
"DATE",
"BYTES",
"TIME",
"RECORD",
"NUMERIC",
"BIGNUMERIC",
]

try:
import pybigquery
except ImportError:
pass
else: # pragma: NO COVER
if not hasattr(pybigquery, '__version__'):
if not hasattr(pybigquery, "__version__"):
import warnings

warnings.warn(
"Obsolete pybigquery is installed, which is likely to\n"
"interfere with sqlalchemy_bigquery.\n"
"pybigquery should be uninstalled.",
stacklevel=2)
stacklevel=2,
)
4 changes: 1 addition & 3 deletions tests/conftest.py
Expand Up @@ -25,6 +25,4 @@
# This seems to be based around dialects maybe having multiple drivers
# and wanting to test drover-specific URLs, but doesn't seem to make
# much sense for dialects with only one driver. ¯\_(ツ)_/¯
registry.register(
"bigquery.bigquery", "sqlalchemy_bigquery", "BigQueryDialect"
)
registry.register("bigquery.bigquery", "sqlalchemy_bigquery", "BigQueryDialect")
5 changes: 4 additions & 1 deletion tests/unit/fauxdbi.py
Expand Up @@ -30,7 +30,10 @@
import google.cloud.bigquery.table
import google.cloud.bigquery.dbapi.cursor

from sqlalchemy_bigquery._helpers import substitute_re_method, substitute_string_re_method
from sqlalchemy_bigquery._helpers import (
substitute_re_method,
substitute_string_re_method,
)


class Connection:
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_api.py
Expand Up @@ -22,7 +22,9 @@

def test_dry_run():

with mock.patch("sqlalchemy_bigquery._helpers.create_bigquery_client") as create_client:
with mock.patch(
"sqlalchemy_bigquery._helpers.create_bigquery_client"
) as create_client:
import sqlalchemy_bigquery.api

client = sqlalchemy_bigquery.api.ApiClient("/my/creds", "mars")
Expand Down

0 comments on commit bf6011c

Please sign in to comment.