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

stop allowing str as basic input to validators #256

Merged
merged 3 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
make black build dep optional
  • Loading branch information
samuelcolvin committed Sep 28, 2022
commit 5c1dc3cfa88c6a971cbeb4c3ef66bb3f079db81b
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
with:
python-version: '3.10'

- run: pip install 'black>=22.3.0,<23' typing_extensions
- run: pip install typing_extensions
- run: make rust-benchmark

build-wasm-emscripten:
Expand Down
24 changes: 15 additions & 9 deletions generate_self_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from collections.abc import Callable
from datetime import date, datetime, time, timedelta
from pathlib import Path
from pprint import pformat
from typing import TYPE_CHECKING, Any, Dict, ForwardRef, List, Type, Union

from black import Mode, TargetVersion, format_file_contents
from typing_extensions import get_args, is_typeddict

try:
Expand Down Expand Up @@ -169,15 +169,21 @@ def main() -> None:
'choices': choices,
}
python_code = (
f'# this file is auto-generated by generate_self_schema.py, DO NOT edit manually\nself_schema = {schema}\n'
f'# this file is auto-generated by generate_self_schema.py, DO NOT edit manually\n'
f'self_schema = {pformat(schema)}\n'
)
mode = Mode(
line_length=120,
string_normalization=False,
magic_trailing_comma=False,
target_versions={TargetVersion.PY37, TargetVersion.PY38, TargetVersion.PY39, TargetVersion.PY310},
)
python_code = format_file_contents(python_code, fast=False, mode=mode)
try:
from black import Mode, TargetVersion, format_file_contents
except ImportError:
pass
else:
mode = Mode(
line_length=120,
string_normalization=False,
magic_trailing_comma=False,
target_versions={TargetVersion.PY37, TargetVersion.PY38, TargetVersion.PY39, TargetVersion.PY310},
)
python_code = format_file_contents(python_code, fast=False, mode=mode)
SAVE_PATH.write_text(python_code)
print(f'Self schema definition written to {SAVE_PATH}')

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ['maturin>=0.13,<0.14', 'black>=22.3.0,<23', 'typing_extensions']
requires = ['maturin>=0.13,<0.14', 'typing_extensions']
build-backend = 'maturin'

[project]
Expand Down