Skip to content

Commit 1842fe7

Browse files
authored
Add a few dotfiles to improve newcomers' experience (#1368)
1 parent 437ffe4 commit 1842fe7

File tree

8 files changed

+43
-27
lines changed

8 files changed

+43
-27
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.yaml]
15+
indent_size = 2

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ benchmarks/results
1515
build
1616
docs/build
1717
logs
18-
logs/
19-
__pycache__/

.pre-commit-config.yaml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-merge-conflict
66
- id: debug-statements
77
- id: end-of-file-fixer
88
- id: trailing-whitespace
9-
- repo: https://github.com/pycqa/isort
10-
rev: 5.12.0
11-
hooks:
12-
- id: isort
13-
args: [--profile, black]
14-
- repo: https://github.com/asottile/pyupgrade
15-
rev: v3.3.1
16-
hooks:
17-
- id: pyupgrade
18-
args: [--py37-plus]
19-
- repo: https://github.com/pycqa/flake8
20-
rev: 6.0.0
21-
hooks:
22-
- id: flake8
23-
- repo: https://github.com/psf/black
24-
rev: 23.3.0
25-
hooks:
26-
- id: black
279
- repo: https://github.com/pre-commit/mirrors-mypy
28-
rev: v1.2.0
10+
rev: v1.14.1
2911
hooks:
3012
- id: mypy
3113
args: [--allow-redefinition]
3214
exclude: ^examples/
3315
additional_dependencies: [types-tqdm, types-Pillow]
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.9.1
18+
hooks:
19+
- id: ruff
20+
args: ["--config=pyproject.toml"]

.pydocstyle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pydocstyle]
2+
convention = numpy

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"tests"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

outlines/fsm/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ def enum_format_fn(sequence: str) -> str:
3939

4040
return enum_regex_str, enum_format_fn
4141

42-
if python_type == float:
42+
if python_type is float:
4343

4444
def float_format_fn(sequence: str) -> float:
4545
return float(sequence)
4646

4747
return FLOAT, float_format_fn
48-
elif python_type == int:
48+
elif python_type is int:
4949

5050
def int_format_fn(sequence: str) -> int:
5151
return int(sequence)
5252

5353
return INTEGER, int_format_fn
54-
elif python_type == bool:
54+
elif python_type is bool:
5555

5656
def bool_format_fn(sequence: str) -> bool:
5757
return bool(sequence)

outlines/processors/base_logits_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ def _from_torch(tensor: torch.Tensor, target_type: Type) -> Array:
136136
elif target_type == np.ndarray:
137137
return tensor.detach().numpy()
138138

139-
elif target_type == list:
139+
elif target_type is list:
140140
return tensor.detach().tolist()
141141

142-
elif target_type == tuple:
142+
elif target_type is tuple:
143143
return tuple(tensor.detach().tolist())
144144

145145
elif is_mlx_array_type(target_type):

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,10 @@ show_missing = true
174174
[tool.diff_cover]
175175
compare_branch = "origin/main"
176176
diff_range_notation = ".."
177+
178+
[tool.docformatter]
179+
style = "numpy"
180+
in-place = true
181+
182+
[tool.ruff.lint]
183+
ignore = [ "E731", "F401" ]

0 commit comments

Comments
 (0)