Skip to content

Commit

Permalink
infer_types
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong committed Aug 22, 2024
1 parent cb0c9d4 commit 383422b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions weave/legacy/decorator_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import inspect
import typing

from weave import errors, infer_types
from weave import errors
from weave import weave_types as types
from weave.legacy import context_state, decorator_class, object_type_ref_util
from weave.legacy import context_state, decorator_class, object_type_ref_util, infer_types

_py_type = type

Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/ecosystem/torchvision/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from torchvision import datasets

import weave
from weave import infer_types
from weave.legacy import infer_types
from weave.legacy import panels

ExampleType = TypeVar("ExampleType")
Expand Down
3 changes: 2 additions & 1 deletion weave/legacy/ecosystem/wandb/weave_plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from plotly import graph_objs as go

import weave
from weave import infer_types, weave_internal
from weave import weave_internal
from weave.legacy import infer_types


class PlotlyType(weave.types.Type):
Expand Down
4 changes: 2 additions & 2 deletions weave/infer_types.py → weave/legacy/infer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from weave.legacy import graph

from . import errors, weave_types
from .. import errors, weave_types


class TypedDictLike:
Expand All @@ -19,7 +19,7 @@ def is_typed_dict_like(t: type) -> typing_extensions.TypeGuard[TypedDictLike]:
return hasattr(t, "__required_keys__")


def simple_python_type_to_type(py_type: type):
def simple_python_type_to_type(py_type: type): # type: ignore
if isinstance(py_type, str):
raise errors.WeaveTypeError(
"Cannot yet detect Weave type from forward type references"
Expand Down
4 changes: 2 additions & 2 deletions weave/legacy/op_def_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from _ast import AsyncFunctionDef, ExceptHandler
from typing import Any

from weave import environment, errors, infer_types, registry_mem, storage
from weave import environment, errors, registry_mem, storage
from weave import weave_types as types
from weave.legacy import artifact_fs, artifact_local, context_state
from weave.legacy import artifact_fs, artifact_local, context_state, infer_types

if typing.TYPE_CHECKING:
from .op_def import OpDef
Expand Down
4 changes: 2 additions & 2 deletions weave/pyfunc_type_util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import inspect
import typing

from weave.legacy import op_args
from weave.legacy import infer_types, op_args

from . import errors, infer_types
from . import errors
from . import weave_types as types

InputTypeItemType = typing.Union[types.Type, typing.Callable[..., types.Type]]
Expand Down
2 changes: 1 addition & 1 deletion weave/tests/legacy/test_typeddict_notrequired.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
TypedDict,
)

from weave import infer_types
from weave import weave_types as types
from weave.legacy import infer_types


class _TestNotRequiredTypedDict(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion weave/weave_pydantic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pydantic import BaseModel, create_model

from . import infer_types
from . import weave_types as types
from .legacy import infer_types


def weave_type_to_pydantic(
Expand Down

0 comments on commit 383422b

Please sign in to comment.