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

Pre-commit autoupdate #133

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ jobs:
run: |
pip install .
pip install pandoc
pre-commit install
python tools/generate_opset.py
git diff --exit-code
17 changes: 6 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-ruff
rev: 0.2.1
hooks:
- id: ruff-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black-conda
args:
- --safe
- --target-version=py38
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8
rev: 6.1.0
hooks:
- id: flake8-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-isort
rev: 5.13.2
hooks:
- id: isort-conda
additional_dependencies: [-c, conda-forge, toml=0.10.2]
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy
rev: "1.8.0"
hooks:
Expand All @@ -27,7 +22,7 @@ repos:
args:
- --py38
- repo: https://github.com/Quantco/pre-commit-mirrors-prettier
rev: 3.1.1
rev: 3.2.4
hooks:
- id: prettier-conda
files: "\\.md$"
7 changes: 3 additions & 4 deletions src/spox/_schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exposes information related to reference ONNX operator schemas, used by StandardOpNode."""

import itertools
from typing import (
Callable,
Expand All @@ -16,11 +17,9 @@


class _Comparable(Protocol):
def __lt__(self, other):
...
def __lt__(self, other): ...

def __gt__(self, other):
...
def __gt__(self, other): ...


S = TypeVar("S")
Expand Down
12 changes: 4 additions & 8 deletions src/spox/_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ def __contains__(self, item: Union[str, H]) -> bool:
)

@overload
def __getitem__(self, item: H) -> str:
...
def __getitem__(self, item: H) -> str: ...

@overload
def __getitem__(self, item: str) -> H:
...
def __getitem__(self, item: str) -> H: ...

def __getitem__(self, item: Union[str, H]):
"""Access the name of an object or an object with a given name in this (or outer) namespace."""
Expand All @@ -76,12 +74,10 @@ def __getitem__(self, item: Union[str, H]):
return self.name_of[item]

@overload
def __setitem__(self, key: str, value: H):
...
def __setitem__(self, key: str, value: H): ...

@overload
def __setitem__(self, key: H, value: str):
...
def __setitem__(self, key: H, value: str): ...

def __setitem__(self, _key, _value):
"""Set the name of an object in exactly this namespace. Both ``[name] = obj`` and ``[obj] = name`` work."""
Expand Down
1 change: 1 addition & 0 deletions src/spox/_standard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module implementing a base for standard ONNX operators, which use the functionality of ONNX node-level inference."""

from typing import TYPE_CHECKING, Callable, Dict, Tuple

import numpy
Expand Down
8 changes: 5 additions & 3 deletions src/spox/_type_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def _from_onnx(cls, proto: onnx.TypeProto) -> "Type":
if proto.HasField("tensor_type"):
return Tensor(
tensor_type_to_dtype(proto.tensor_type.elem_type),
Shape.from_onnx(proto.tensor_type.shape).to_simple()
if proto.tensor_type.HasField("shape")
else None,
(
Shape.from_onnx(proto.tensor_type.shape).to_simple()
if proto.tensor_type.HasField("shape")
else None
),
)
elif proto.HasField("sequence_type"):
return Sequence(Type._from_onnx(proto.sequence_type.elem_type))
Expand Down
1 change: 1 addition & 0 deletions tests/test_custom_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
for the respective fields ``attrs/inputs/outputs`` and ``infer_output_types`` will be useful as well.
Of these, ``propagate_values`` is probably least common.
"""

from dataclasses import dataclass
from typing import Dict

Expand Down
Loading