Skip to content

Commit 631532c

Browse files
authored
chore: sort imports (#770)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-pandas/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) 🦕
1 parent 7cd4287 commit 631532c

30 files changed

+33
-50
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
# All configuration values have a default; values that are commented out
2525
# serve to show the default.
2626

27-
import sys
2827
import os
2928
import shlex
29+
import sys
3030

3131
# If extensions (or modules to document with autodoc) are in another directory,
3232
# add these directories to sys.path here. If the directory is relative to the

docs/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Reading data from BigQuery
2727
Use the :func:`pandas_gbq.read_gbq` function to run a BigQuery query and
2828
download the results as a :class:`pandas.DataFrame` object.
2929

30-
.. literalinclude:: samples/snippets/read_gbq_simple.py
30+
.. literalinclude:: ../samples/snippets/read_gbq_simple.py
3131
:language: python
3232
:dedent: 4
3333
:start-after: [START bigquery_pandas_gbq_read_gbq_simple]
@@ -57,7 +57,7 @@ Writing data to BigQuery
5757
Use the :func:`pandas_gbq.to_gbq` function to write a
5858
:class:`pandas.DataFrame` object to a BigQuery table.
5959

60-
.. literalinclude:: samples/snippets/to_gbq_simple.py
60+
.. literalinclude:: ../samples/snippets/to_gbq_simple.py
6161
:language: python
6262
:dedent: 4
6363
:start-after: [START bigquery_pandas_gbq_to_gbq_simple]

docs/reading.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Reading Tables
66
Use the :func:`pandas_gbq.read_gbq` function to run a BigQuery query and
77
download the results as a :class:`pandas.DataFrame` object.
88

9-
.. literalinclude:: samples/snippets/read_gbq_simple.py
9+
.. literalinclude:: ../samples/snippets/read_gbq_simple.py
1010
:language: python
1111
:dedent: 4
1212
:start-after: [START bigquery_pandas_gbq_read_gbq_simple]
@@ -37,7 +37,7 @@ The ``dialect`` argument can be used to indicate whether to use
3737
BigQuery's ``'legacy'`` SQL or BigQuery's ``'standard'`` SQL. The
3838
default value is ``'standard'``.
3939

40-
.. literalinclude:: samples/snippets/read_gbq_legacy.py
40+
.. literalinclude:: ../samples/snippets/read_gbq_legacy.py
4141
:language: python
4242
:dedent: 4
4343
:start-after: [START bigquery_pandas_gbq_read_gbq_legacy]

docs/samples

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/writing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Writing Tables
66
Use the :func:`pandas_gbq.to_gbq` function to write a
77
:class:`pandas.DataFrame` object to a BigQuery table.
88

9-
.. literalinclude:: samples/snippets/to_gbq_simple.py
9+
.. literalinclude:: ../samples/snippets/to_gbq_simple.py
1010
:language: python
1111
:dedent: 4
1212
:start-after: [START bigquery_pandas_gbq_to_gbq_simple]

noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# Generated by synthtool. DO NOT EDIT!
1818

1919
from __future__ import absolute_import
20+
2021
import os
2122
import pathlib
2223
import re

owlbot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# creating clients, not the end user.
5656
"docs/multiprocessing.rst",
5757
"noxfile.py",
58-
"README.rst",
58+
"README.rst",
5959
# exclude .kokoro/build.sh which is customized due to support for conda
6060
".kokoro/build.sh",
6161
],
@@ -66,7 +66,9 @@
6666
# ----------------------------------------------------------------------------
6767

6868
s.replace(
69-
[".github/header-checker-lint.yml"], '"Google LLC"', '"pandas-gbq Authors"',
69+
[".github/header-checker-lint.yml"],
70+
'"Google LLC"',
71+
'"pandas-gbq Authors"',
7072
)
7173

7274
# ----------------------------------------------------------------------------
@@ -79,6 +81,6 @@
7981
# Final cleanup
8082
# ----------------------------------------------------------------------------
8183

82-
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
84+
s.shell.run(["nox", "-s", "format"], hide_output=False)
8385
for noxfile in REPO_ROOT.glob("samples/**/noxfile.py"):
84-
s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False)
86+
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)

pandas_gbq/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5-
from .gbq import to_gbq, read_gbq, Context, context # noqa
6-
75
from pandas_gbq import version as pandas_gbq_version
86

7+
from .gbq import Context, context, read_gbq, to_gbq # noqa
8+
99
__version__ = pandas_gbq_version.__version__
1010

1111
__all__ = [

pandas_gbq/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def bigquery_has_query_and_wait(self):
5454

5555
@property
5656
def pandas_installed_version(self):
57-
import pandas
5857
import packaging.version
58+
import pandas
5959

6060
if self._pandas_installed_version is not None:
6161
return self._pandas_installed_version

pandas_gbq/gbq.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def __init__(
268268
client_secret=None,
269269
):
270270
global context
271-
from google.api_core.exceptions import GoogleAPIError
272-
from google.api_core.exceptions import ClientError
271+
from google.api_core.exceptions import ClientError, GoogleAPIError
272+
273273
from pandas_gbq import auth
274274

275275
self.http_error = (ClientError, GoogleAPIError)
@@ -1244,8 +1244,7 @@ def __init__(
12441244

12451245
def _table_ref(self, table_id):
12461246
"""Return a BigQuery client library table reference"""
1247-
from google.cloud.bigquery import DatasetReference
1248-
from google.cloud.bigquery import TableReference
1247+
from google.cloud.bigquery import DatasetReference, TableReference
12491248

12501249
return TableReference(
12511250
DatasetReference(self.project_id, self.dataset_id), table_id
@@ -1286,9 +1285,7 @@ def create(self, table_id, schema):
12861285
Use the generate_bq_schema to generate your table schema from a
12871286
dataframe.
12881287
"""
1289-
from google.cloud.bigquery import DatasetReference
1290-
from google.cloud.bigquery import Table
1291-
from google.cloud.bigquery import TableReference
1288+
from google.cloud.bigquery import DatasetReference, Table, TableReference
12921289

12931290
if self.exists(table_id):
12941291
raise TableCreationError("Table {0} already exists".format(table_id))

0 commit comments

Comments
 (0)