Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python package ruff to ^0.0.285 #2928

Merged
merged 9 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/hash-ai-worker-py/app/_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations
TimDiekmann marked this conversation as resolved.
Show resolved Hide resolved

from enum import Enum
from typing import Generic, TypeVar

Expand Down
2 changes: 2 additions & 0 deletions apps/hash-ai-worker-py/app/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

# Inspired by https://github.com/temporalio/samples-python/blob/main/pydantic_converter/converter.py

from __future__ import annotations

import json
from typing import Any

Expand Down
8 changes: 6 additions & 2 deletions apps/hash-ai-worker-py/app/workflows.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Temporal workflow definitions."""

from __future__ import annotations

import json
from typing import Any
from uuid import UUID
from typing import TYPE_CHECKING, Any

from pydantic import (
BaseModel,
Expand All @@ -14,6 +15,9 @@

from ._status import Status, StatusCode

if TYPE_CHECKING:
from uuid import UUID

with workflow.unsafe.imports_passed_through():
from graph_types import (
DataTypeReference,
Expand Down
38 changes: 19 additions & 19 deletions apps/hash-ai-worker-py/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/hash-ai-worker-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ setuptools = "^68.0.0"

[tool.poetry.group.lint-tools.dependencies]
black = "^23.7.0"
ruff = "^0.0.275"
ruff = "^0.0.285"
mypy = "^1.4"


Expand Down
8 changes: 6 additions & 2 deletions libs/@local/hash-graph-client/python/graph_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Client for the HASH API."""
from typing import Literal, TypeAlias, TypeVar
from __future__ import annotations

from typing import TYPE_CHECKING, Literal, TypeAlias, TypeVar

import httpx
from pydantic import BaseModel
from yarl import URL

from graph_client.models import (
CreateDataTypeRequest,
Expand Down Expand Up @@ -32,6 +33,9 @@
UpdatePropertyTypeRequest,
)

if TYPE_CHECKING:
from yarl import URL

T = TypeVar("T", bound=BaseModel)

QueryToken: TypeAlias = (
Expand Down
38 changes: 19 additions & 19 deletions libs/@local/hash-graph-client/python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/@local/hash-graph-client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ datamodel-code-generator = "^0.21.3"

[tool.poetry.group.lint-tools.dependencies]
black = "^23.7.0"
ruff = "^0.0.275"
ruff = "^0.0.285"
mypy = "^1.4"


Expand Down
2 changes: 2 additions & 0 deletions libs/@local/hash-graph-sdk/python/graph_sdk/client/_compat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import TypeVar

from pydantic import BaseModel
Expand Down
27 changes: 16 additions & 11 deletions libs/@local/hash-graph-sdk/python/graph_sdk/client/blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
the problem with that approach however is that users loose the ability to look
at the source code)
"""
from typing import Self, TypeVar
from uuid import UUID
from __future__ import annotations

from graph_client.models import (
MaybeListOfOntologyElementMetadata,
OntologyElementMetadata,
Subgraph,
)
from graph_types import DataTypeSchema, EntityTypeSchema, PropertyTypeSchema
from yarl import URL
from typing import TYPE_CHECKING, Self, TypeVar

from graph_sdk.client.concurrent import HASHClient as ConcurrentHASHClient
from graph_sdk.options import Options
from graph_sdk.query import BaseFilter
from graph_sdk.utils import async_to_sync

if TYPE_CHECKING:
from uuid import UUID

from graph_client.models import (
MaybeListOfOntologyElementMetadata,
OntologyElementMetadata,
Subgraph,
)
from graph_types import DataTypeSchema, EntityTypeSchema, PropertyTypeSchema
from yarl import URL

from graph_sdk.options import Options
from graph_sdk.query import BaseFilter

T = TypeVar("T")


Expand Down
22 changes: 14 additions & 8 deletions libs/@local/hash-graph-sdk/python/graph_sdk/client/concurrent.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Concurrent (async) client for the HASH API."""
from collections.abc import Generator
from __future__ import annotations

from contextlib import contextmanager
from typing import Self, TypeVar
from uuid import UUID
from typing import TYPE_CHECKING, Self, TypeVar

from graph_client import GraphClient as LowLevelClient
from graph_client.models import (
Expand Down Expand Up @@ -32,13 +32,19 @@
UpdatePropertyTypeRequest,
VersionedURL,
)
from graph_types import DataTypeSchema, EntityTypeSchema, PropertyTypeSchema
from pydantic_core._pydantic_core import Url
from yarl import URL

from graph_sdk.client._compat import recast
from graph_sdk.options import Options
from graph_sdk.query import BaseFilter

if TYPE_CHECKING:
from collections.abc import Generator
from uuid import UUID

from graph_types import DataTypeSchema, EntityTypeSchema, PropertyTypeSchema
from yarl import URL

from graph_sdk.options import Options
from graph_sdk.query import BaseFilter

T = TypeVar("T")

Expand All @@ -53,7 +59,7 @@ def assert_not_none(value: T | None) -> T:


@contextmanager
def with_actor(client: "HASHClient", actor: UUID) -> Generator[None, None, None]:
def with_actor(client: HASHClient, actor: UUID) -> Generator[None, None, None]:
"""Context manager for setting the actor on the client."""
old_actor = client.actor
client.actor = actor
Expand Down
8 changes: 6 additions & 2 deletions libs/@local/hash-graph-sdk/python/graph_sdk/filter/base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
"""Base and generic classes for query paths."""
from __future__ import annotations

from abc import ABC
from typing import Generic, Self, TypeVar
from typing import TYPE_CHECKING, Generic, Self, TypeVar

from graph_client import QueryToken
from graph_client.models import Selector

from graph_sdk.query import Path

if TYPE_CHECKING:
from graph_client import QueryToken


class AbstractQueryPath(ABC):
"""Path definition shared across different query paths."""
Expand Down
14 changes: 9 additions & 5 deletions libs/@local/hash-graph-sdk/python/graph_sdk/options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Ergonomic API to configure options for structural queries."""
from datetime import datetime
from typing import Protocol
from __future__ import annotations

from typing import TYPE_CHECKING, Protocol

from graph_client.models import (
DecisionTime,
Expand Down Expand Up @@ -28,6 +29,9 @@
TemporalBound as FFITemporalBound,
)

if TYPE_CHECKING:
from datetime import datetime


class ToLimitedTemporalBound(Protocol):
"""Convert to a limited temporal bound.
Expand Down Expand Up @@ -71,17 +75,17 @@ class TemporalBound:
"""

@classmethod
def unbounded(cls) -> "UnboundedTemporalBound":
def unbounded(cls) -> UnboundedTemporalBound:
"""Return an unbounded interval."""
return UnboundedTemporalBound()

@classmethod
def inclusive(cls, time: datetime) -> "InclusiveTemporalBound":
def inclusive(cls, time: datetime) -> InclusiveTemporalBound:
"""Return an inclusive interval."""
return InclusiveTemporalBound(time)

@classmethod
def exclusive(cls, time: datetime) -> "ExclusiveTemporalBound":
def exclusive(cls, time: datetime) -> ExclusiveTemporalBound:
"""Return an exclusive interval."""
return ExclusiveTemporalBound(time)

Expand Down
Loading