Skip to content

Commit 6498440

Browse files
committed
add stubs to ruff config
1 parent eb32ac4 commit 6498440

File tree

12 files changed

+14
-40
lines changed

12 files changed

+14
-40
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ include = [
142142
"clai/**/*.py",
143143
"tests/**/*.py",
144144
"docs/**/*.py",
145+
"stubs/**/*.pyi",
145146
]
146147

147148
[tool.ruff.lint]
@@ -186,6 +187,7 @@ quote-style = "single"
186187
"examples/**/*.py" = ["D101", "D103"]
187188
"tests/**/*.py" = ["D"]
188189
"docs/**/*.py" = ["D"]
190+
"stubs/**/*.pyi" = ["F401"]
189191

190192
[tool.pyright]
191193
stubPath = "stubs"

stubs/mlx/nn.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
from typing import Any
22

3-
4-
class Module:
5-
...
3+
class Module: ...

stubs/outlines/models/base.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
from typing import Any, AsyncIterable, Iterable
2-
1+
from collections.abc import AsyncIterable, Iterable
2+
from typing import Any
33

44
class Model:
55
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
66
def stream(self, *args: Any, **kwargs: Any) -> Iterable[Any]: ...
77

8-
98
class AsyncModel(Model):
109
async def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
1110
def stream(self, *args: Any, **kwargs: Any) -> AsyncIterable[Any]: ...

stubs/outlines/models/mlxlm.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from typing import Any
2-
from outlines.models.base import Model
32

43
from mlx.nn import Module
4+
from outlines.models.base import Model
55
from transformers.tokenization_utils import PreTrainedTokenizer
66

7-
87
class MLXLM(Model):
98
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
109

11-
1210
def from_mlxlm(model: Module, tokenizer: PreTrainedTokenizer) -> MLXLM: ...
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
from typing import Any
2-
from outlines.models.base import Model
32

3+
from outlines.models.base import Model
44
from transformers.modeling_utils import PreTrainedModel
55
from transformers.processing_utils import ProcessorMixin
66
from transformers.tokenization_utils import PreTrainedTokenizer
77

8-
9-
class Transformers(Model):
10-
...
11-
12-
13-
class TransformersMultiModal(Model):
14-
...
15-
8+
class Transformers(Model): ...
9+
class TransformersMultiModal(Model): ...
1610

1711
def from_transformers(
1812
model: PreTrainedModel,
1913
tokenizer_or_processor: PreTrainedTokenizer | ProcessorMixin,
2014
*,
2115
device_dtype: Any = None,
2216
) -> Transformers | TransformersMultiModal: ...
23-
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from typing import Any
2-
from outlines.models.base import Model
3-
42

5-
class VLLMOffline(Model):
6-
...
3+
from outlines.models.base import Model
74

5+
class VLLMOffline(Model): ...
86

97
def from_vllm_offline(model: Any) -> VLLMOffline: ...

stubs/transformers/__init__.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,20 @@ from .modeling_utils import PreTrainedModel
55
from .processing_utils import ProcessorMixin
66
from .tokenization_utils import PreTrainedTokenizer
77

8-
98
class AutoModelForCausalLM(PreTrainedModel):
109
@classmethod
1110
def from_pretrained(cls, *args: Any, **kwargs: Any) -> PreTrainedModel: ...
1211

13-
1412
class AutoTokenizer(PreTrainedTokenizer):
1513
@classmethod
1614
def from_pretrained(cls, *args: Any, **kwargs: Any) -> PreTrainedTokenizer: ...
1715

18-
1916
class AutoProcessor(ProcessorMixin):
2017
@classmethod
2118
def from_pretrained(cls, *args: Any, **kwargs: Any) -> ProcessorMixin: ...
2219

23-
2420
class LlavaForConditionalGeneration(PreTrainedModel):
2521
@classmethod
2622
def from_pretrained(cls, *args: Any, **kwargs: Any) -> PreTrainedModel: ...
2723

28-
2924
def from_pretrained(*args: Any, **kwargs: Any) -> Any: ...
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
from typing import Any
22

3-
4-
class PreTrainedModel:
5-
...
3+
class PreTrainedModel: ...
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
from typing import Any
22

3-
4-
class ProcessorMixin:
5-
...
3+
class ProcessorMixin: ...
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
from typing import Any
22

3-
43
class PreTrainedTokenizer:
54
chat_template: str | None
65

76
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
87

9-
10-
class ProcessorMixin:
11-
...
8+
class ProcessorMixin: ...

0 commit comments

Comments
 (0)