Skip to content

Commit

Permalink
remove | to be compatible with python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tscholak committed Jan 2, 2024
1 parent 42bed8d commit 9a684c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions outlines/fsm/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import itertools as it
import json
import re
from typing import Any, Callable, Type, Union
from typing import Any, Callable, Optional, Type, Union

from jsonschema.protocols import Validator
from jsonschema.validators import validator_for
Expand Down Expand Up @@ -103,7 +103,7 @@ def build_regex_from_object(
return to_regex(resolver, content)


def to_regex(resolver: None | Resolver, instance: Schema) -> str:
def to_regex(resolver: Optional[Resolver], instance: Schema) -> str:
"""Translate a JSON Schema instance into a regex that validates the schema.
Note
Expand Down Expand Up @@ -133,7 +133,7 @@ class Path(str):
class Regex(str):
pass

definitions: dict[str, Path | Regex] = {
definitions: dict[str, Union[Path, Regex]] = {
name: Regex(regex) for name, regex in DEFINITIONS.items()
}

Expand Down

0 comments on commit 9a684c3

Please sign in to comment.