Skip to content

Commit

Permalink
Replace Black and Isort with Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
henribru committed Mar 16, 2024
1 parent bed7238 commit 5edb8bb
Show file tree
Hide file tree
Showing 494 changed files with 7,308 additions and 8,560 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
black:
ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -33,12 +33,15 @@ jobs:
run: poetry install

- name: Register problem matcher
run: echo "::add-matcher::.github/workflows/matchers/black.json"
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"

- name: Run Black
run: poetry run black --check --diff googleapiclient-stubs apiclient-stubs
- name: Delete .gitignore (https://github.com/astral-sh/ruff/issues/8753)
run: rm .gitignore

isort:
- name: Run ruff format
run: poetry run ruff format --check googleapiclient-stubs apiclient-stubs

ruff-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -63,11 +66,11 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Register problem matcher
run: echo "::add-matcher::.github/workflows/matchers/isort.json"
- name: Delete .gitignore (https://github.com/astral-sh/ruff/issues/8753)
run: rm .gitignore

- name: Run isort
run: poetry run isort --check-only --diff googleapiclient-stubs apiclient-stubs
- name: Run ruff check
run: poetry run ruff check --output-format github googleapiclient-stubs apiclient-stubs

mypy:
runs-on: ubuntu-latest
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/matchers/isort.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"problemMatcher": [
{
"owner": "black",
"owner": "ruff",
"pattern": [
{
"regexp": "^(would reformat) (.+)$",
"regexp": "^(Would reformat): (.+)$",
"message": 1,
"file": 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ class AbusiveExperienceReportResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def sites(self) -> SitesResource: ...
def violatingSites(self) -> ViolatingSitesResource: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ class AcceleratedmobilepageurlResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def ampUrls(self) -> AmpUrlsResource: ...

Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/accessapproval/v1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,15 @@ class AccessApprovalResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def folders(self) -> FoldersResource: ...
def organizations(self) -> OrganizationsResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/accesscontextmanager/v1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,15 @@ class AccessContextManagerResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accessPolicies(self) -> AccessPoliciesResource: ...
def operations(self) -> OperationsResource: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,15 @@ class AccessContextManagerResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accessPolicies(self) -> AccessPoliciesResource: ...
def operations(self) -> OperationsResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/acmedns/v1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ class ACMEDNSResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def acmeChallengeSets(self) -> AcmeChallengeSetsResource: ...

Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/adexchangebuyer/v1_2/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ class AdExchangeBuyerResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accounts(self) -> AccountsResource: ...
def creatives(self) -> CreativesResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/adexchangebuyer/v1_3/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,15 @@ class AdExchangeBuyerResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accounts(self) -> AccountsResource: ...
def billingInfo(self) -> BillingInfoResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/adexchangebuyer/v1_4/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,15 @@ class AdExchangeBuyerResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accounts(self) -> AccountsResource: ...
def billingInfo(self) -> BillingInfoResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/adexchangebuyer2/v2beta1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1011,17 +1011,15 @@ class AdExchangeBuyerIIResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def accounts(self) -> AccountsResource: ...
def bidders(self) -> BiddersResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/adexperiencereport/v1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ class AdExperienceReportResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def sites(self) -> SitesResource: ...
def violatingSites(self) -> ViolatingSitesResource: ...
Expand Down
20 changes: 9 additions & 11 deletions googleapiclient-stubs/_apis/admin/datatransfer_v1/resources.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ class DataTransferResource(googleapiclient.discovery.Resource):

def new_batch_http_request(
self,
callback: (
collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None
) = None,
callback: collections.abc.Callable[
[
str,
googleapiclient.http.HttpRequest,
googleapiclient.errors.HttpError | None,
],
typing.Any,
]
| None = None,
) -> googleapiclient.http.BatchHttpRequest: ...
def applications(self) -> ApplicationsResource: ...
def transfers(self) -> TransfersResource: ...
Expand Down
Loading

0 comments on commit 5edb8bb

Please sign in to comment.