Skip to content

Commit

Permalink
chore(python): add nox session to sort python imports (#85)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@1b71c10
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Apr 21, 2022
1 parent 7c595d2 commit a0daa1d
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163
# created: 2022-04-06T10:30:21.687684602Z
digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416
# created: 2022-04-20T23:42:53.970438194Z
2 changes: 1 addition & 1 deletion packages/google-cloud-bigquery-logging/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,43 @@
#


from google.cloud.bigquery_logging_v1.types.audit_data import AuditData
from google.cloud.bigquery_logging_v1.types.audit_data import BigQueryAcl
from google.cloud.bigquery_logging_v1.types.audit_data import Dataset
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInfo
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInsertRequest
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInsertResponse
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetListRequest
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetName
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetUpdateRequest
from google.cloud.bigquery_logging_v1.types.audit_data import DatasetUpdateResponse
from google.cloud.bigquery_logging_v1.types.audit_data import EncryptionInfo
from google.cloud.bigquery_logging_v1.types.audit_data import Job
from google.cloud.bigquery_logging_v1.types.audit_data import JobCompletedEvent
from google.cloud.bigquery_logging_v1.types.audit_data import JobConfiguration
from google.cloud.bigquery_logging_v1.types.audit_data import JobGetQueryResultsRequest
from google.cloud.bigquery_logging_v1.types.audit_data import JobGetQueryResultsResponse
from google.cloud.bigquery_logging_v1.types.audit_data import JobInsertRequest
from google.cloud.bigquery_logging_v1.types.audit_data import JobInsertResponse
from google.cloud.bigquery_logging_v1.types.audit_data import JobName
from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryDoneResponse
from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryRequest
from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryResponse
from google.cloud.bigquery_logging_v1.types.audit_data import JobStatistics
from google.cloud.bigquery_logging_v1.types.audit_data import JobStatus
from google.cloud.bigquery_logging_v1.types.audit_data import Table
from google.cloud.bigquery_logging_v1.types.audit_data import TableDataListRequest
from google.cloud.bigquery_logging_v1.types.audit_data import TableDataReadEvent
from google.cloud.bigquery_logging_v1.types.audit_data import TableDefinition
from google.cloud.bigquery_logging_v1.types.audit_data import TableInfo
from google.cloud.bigquery_logging_v1.types.audit_data import TableInsertRequest
from google.cloud.bigquery_logging_v1.types.audit_data import TableInsertResponse
from google.cloud.bigquery_logging_v1.types.audit_data import TableName
from google.cloud.bigquery_logging_v1.types.audit_data import TableUpdateRequest
from google.cloud.bigquery_logging_v1.types.audit_data import TableUpdateResponse
from google.cloud.bigquery_logging_v1.types.audit_data import TableViewDefinition
from google.cloud.bigquery_logging_v1.types.audit_data import (
AuditData,
BigQueryAcl,
Dataset,
DatasetInfo,
DatasetInsertRequest,
DatasetInsertResponse,
DatasetListRequest,
DatasetName,
DatasetUpdateRequest,
DatasetUpdateResponse,
EncryptionInfo,
Job,
JobCompletedEvent,
JobConfiguration,
JobGetQueryResultsRequest,
JobGetQueryResultsResponse,
JobInsertRequest,
JobInsertResponse,
JobName,
JobQueryDoneResponse,
JobQueryRequest,
JobQueryResponse,
JobStatistics,
JobStatus,
Table,
TableDataListRequest,
TableDataReadEvent,
TableDefinition,
TableInfo,
TableInsertRequest,
TableInsertResponse,
TableName,
TableUpdateRequest,
TableUpdateResponse,
TableViewDefinition,
)

__all__ = (
"AuditData",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,43 @@
#


from .types.audit_data import AuditData
from .types.audit_data import BigQueryAcl
from .types.audit_data import Dataset
from .types.audit_data import DatasetInfo
from .types.audit_data import DatasetInsertRequest
from .types.audit_data import DatasetInsertResponse
from .types.audit_data import DatasetListRequest
from .types.audit_data import DatasetName
from .types.audit_data import DatasetUpdateRequest
from .types.audit_data import DatasetUpdateResponse
from .types.audit_data import EncryptionInfo
from .types.audit_data import Job
from .types.audit_data import JobCompletedEvent
from .types.audit_data import JobConfiguration
from .types.audit_data import JobGetQueryResultsRequest
from .types.audit_data import JobGetQueryResultsResponse
from .types.audit_data import JobInsertRequest
from .types.audit_data import JobInsertResponse
from .types.audit_data import JobName
from .types.audit_data import JobQueryDoneResponse
from .types.audit_data import JobQueryRequest
from .types.audit_data import JobQueryResponse
from .types.audit_data import JobStatistics
from .types.audit_data import JobStatus
from .types.audit_data import Table
from .types.audit_data import TableDataListRequest
from .types.audit_data import TableDataReadEvent
from .types.audit_data import TableDefinition
from .types.audit_data import TableInfo
from .types.audit_data import TableInsertRequest
from .types.audit_data import TableInsertResponse
from .types.audit_data import TableName
from .types.audit_data import TableUpdateRequest
from .types.audit_data import TableUpdateResponse
from .types.audit_data import TableViewDefinition
from .types.audit_data import (
AuditData,
BigQueryAcl,
Dataset,
DatasetInfo,
DatasetInsertRequest,
DatasetInsertResponse,
DatasetListRequest,
DatasetName,
DatasetUpdateRequest,
DatasetUpdateResponse,
EncryptionInfo,
Job,
JobCompletedEvent,
JobConfiguration,
JobGetQueryResultsRequest,
JobGetQueryResultsResponse,
JobInsertRequest,
JobInsertResponse,
JobName,
JobQueryDoneResponse,
JobQueryRequest,
JobQueryResponse,
JobStatistics,
JobStatus,
Table,
TableDataListRequest,
TableDataReadEvent,
TableDefinition,
TableInfo,
TableInsertRequest,
TableInsertResponse,
TableName,
TableUpdateRequest,
TableUpdateResponse,
TableViewDefinition,
)

__all__ = (
"AuditData",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore

import proto # type: ignore

__protobuf__ = proto.module(
package="google.cloud.bigquery.logging.v1",
Expand Down
28 changes: 25 additions & 3 deletions packages/google-cloud-bigquery-logging/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# Generated by synthtool. DO NOT EDIT!

from __future__ import absolute_import

import os
import pathlib
import shutil
Expand All @@ -25,7 +26,8 @@
import nox

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
ISORT_VERSION = "isort==5.10.1"
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

DEFAULT_PYTHON_VERSION = "3.8"

Expand Down Expand Up @@ -83,7 +85,7 @@ def lint(session):
session.run(
"black",
"--check",
*BLACK_PATHS,
*LINT_PATHS,
)
session.run("flake8", "google", "tests")

Expand All @@ -94,7 +96,27 @@ def blacken(session):
session.install(BLACK_VERSION)
session.run(
"black",
*BLACK_PATHS,
*LINT_PATHS,
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def format(session):
"""
Run isort to sort imports. Then run black
to format code to uniform standard.
"""
session.install(BLACK_VERSION, ISORT_VERSION)
# Use the --fss option to sort imports using strict alphabetical order.
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
session.run(
"isort",
"--fss",
*LINT_PATHS,
)
session.run(
"black",
*LINT_PATHS,
)


Expand Down
1 change: 1 addition & 0 deletions packages/google-cloud-bigquery-logging/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#
import io
import os

import setuptools # type: ignore

version = "1.0.2"
Expand Down

0 comments on commit a0daa1d

Please sign in to comment.