Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #230 from pangeo-forge/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
cisaacstern authored Feb 6, 2023
2 parents 78890df + 85aee58 commit ff46c3f
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ repos:

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.237'
rev: 'v0.0.241'
hooks:
- id: ruff
args: ['--fix']

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

Expand Down
5 changes: 0 additions & 5 deletions pangeo_forge_orchestrator/routers/github_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,11 @@ async def handle_dataflow_event(
gh: GitHubAPI,
gh_kws: dict,
):

logger.info(f"Received dataflow webhook with {payload = }")

action = payload["action"]

if action == "completed":

if payload["conclusion"] not in ("success", "failure"):
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
Expand Down Expand Up @@ -400,7 +398,6 @@ async def handle_pr_comment_event(
pr = await gh.getitem(payload["issue"]["pull_request"]["url"], **gh_kws)

if action == "created":

comment_body = comment["body"]
if not comment_body.startswith("/"):
# Exit early if this isn't a slash command, so we don't end up spamming *every* issue
Expand Down Expand Up @@ -465,7 +462,6 @@ async def handle_pr_event(
pr = payload["pull_request"]

if action in ("synchronize", "opened"):

base_repo_name = pr["base"]["repo"]["full_name"]
if ignore_repo(base_repo_name):
return {"status": "ok", "message": f"Skipping synchronize for repo {base_repo_name}"}
Expand Down Expand Up @@ -552,7 +548,6 @@ async def parse_payload(request, payload_bytes, event):

async def verify_hash_signature(request: Request, payload_bytes: bytes) -> None:
if hash_signature := request.headers.get("X-Hub-Signature-256", None):

github_app = get_config().github_app
webhook_secret = bytes(github_app.webhook_secret, encoding="utf-8") # type: ignore
h = hmac.new(webhook_secret, payload_bytes, hashlib.sha256)
Expand Down
1 change: 0 additions & 1 deletion pangeo_forge_orchestrator/routers/model_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def get_feedstock_datasets(
"all", description="Filter by whether the dataset is a production or test dataset"
),
):

model = MODELS["recipe_run"]

statement = and_(
Expand Down
2 changes: 0 additions & 2 deletions pangeo_forge_orchestrator/routers/repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ def xarray(
example="https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/HadISST-feedstock/hadisst.zarr",
)
):

import xarray as xr
import zarr

error_message = f"An error occurred while fetching the data from URL: {url}"

try:

with xr.open_dataset(url, engine="zarr", chunks={}) as ds:
html = ds._repr_html_().strip().encode("utf-8", "replace").decode("utf-8")

Expand Down
2 changes: 0 additions & 2 deletions scripts.develop/new_github_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def get_app_name_and_desc(github_username, deployment, pr_number=None):


def main(github_username, deployment, pr_number=None):

app_name, description = get_app_name_and_desc(github_username, deployment, pr_number=pr_number)

# We're going to serve from the `CACHEDIR` as base,
Expand Down Expand Up @@ -109,7 +108,6 @@ def main(github_username, deployment, pr_number=None):


if __name__ == "__main__":

user_token = os.environ.get("GITHUB_PAT", None)
if not user_token:
raise ValueError("Env variable 'GITHUB_PAT' required, but unset.")
Expand Down
1 change: 0 additions & 1 deletion tests/github_app/test_POST_pr_merged_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ async def pr_merged_request_fixture(
api_key,
async_app_client,
):

headers = {"X-GitHub-Event": "pull_request"}
payload = {
"action": "closed",
Expand Down
1 change: 0 additions & 1 deletion tests/github_app/test_helpers_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async def run_fixture(
async_app_client,
request,
):

admin_headers = {"X-API-Key": api_key}
bakery_create_response = await async_app_client.post(
"/bakeries/",
Expand Down
1 change: 0 additions & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def compare_response(response_fixture, reponse_data):


def create_with_dependencies(create_opts, mf, client):

for dep in mf.dependencies:
dep_create_opts = dep.model_fixture.create_opts[0] # just use first create_opts
dep_create_response = client.create(dep.model_fixture.path, dep_create_opts)
Expand Down
3 changes: 2 additions & 1 deletion tests/model_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""
This is where we put all the data about creating / updating models
"""
from collections.abc import Sequence
from dataclasses import dataclass, field
from typing import Sequence, Union
from typing import Union

APIOpts = dict[str, Union[int, str]]

Expand Down
1 change: 0 additions & 1 deletion tests/routers/test_repr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
def test_xarray_repr(client):

url = "https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/HadISST-feedstock/hadisst.zarr"
response = client.read_range(f"/repr/xarray/?url={url}")
assert response["dataset"] == url
Expand Down
3 changes: 0 additions & 3 deletions tests/routers/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

@pytest.mark.parametrize("model_fixture", [recipe_run_fixture])
def test_bakery_stats(client, authorized_client, model_fixture):

_ = create_with_dependencies(model_fixture.create_opts[0], model_fixture, authorized_client)

response = client.read_range("/stats/bakeries")
Expand All @@ -15,7 +14,6 @@ def test_bakery_stats(client, authorized_client, model_fixture):

@pytest.mark.parametrize("model_fixture", [recipe_run_fixture])
def test_recipe_run_stats(client, authorized_client, model_fixture):

_ = create_with_dependencies(model_fixture.create_opts[0], model_fixture, authorized_client)

response = client.read_range("/stats/recipe_runs")
Expand All @@ -25,7 +23,6 @@ def test_recipe_run_stats(client, authorized_client, model_fixture):
@pytest.mark.parametrize("query", ["", "exclude_test_runs=true"])
@pytest.mark.parametrize("model_fixture", [recipe_run_fixture])
def test_dataset_stats(client, authorized_client, model_fixture, query):

create_response = create_with_dependencies(
model_fixture.create_opts[0], model_fixture, authorized_client
)
Expand Down
1 change: 0 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def test_read_single(model_fixture, client, authorized_client):
# first create some data
path = model_fixture.path
for create_opts in model_fixture.create_opts:

create_response = create_with_dependencies(create_opts, model_fixture, authorized_client)

for rel in model_fixture.optional_relations:
Expand Down

0 comments on commit ff46c3f

Please sign in to comment.