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

Can't use List resource #6

Open
tukipe opened this issue Sep 23, 2024 · 1 comment
Open

Can't use List resource #6

tukipe opened this issue Sep 23, 2024 · 1 comment

Comments

@tukipe
Copy link

tukipe commented Sep 23, 2024

Quite likely the List import from Typing clashes with the actual List class definition.

File "/builder/tests/integration/../integration/workflow/test_data/list.py", line 7, in <module>
    from aidbox.resource.list import List
  File "/builder/.venv/lib/python3.11/site-packages/aidbox/resource/list.py", line 11, in <module>
    class List(DomainResource):
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 171, in __new__
    set_model_fields(cls, bases, config_wrapper, types_namespace)
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 361, in set_model_fields
    fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py", line 96, in collect_model_fields
    type_hints = get_cls_type_hints_lenient(cls, types_namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 212, in get_cls_type_hints_lenient
    hints[name] = eval_type_lenient(value, globalns, localns)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 224, in eval_type_lenient
    return typing._eval_type(value, globalns, localns)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/typing.py", line 395, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/typing.py", line 905, in _evaluate
    eval(self.__forward_code__, globalns, localns),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
  File "/builder/.venv/lib/python3.11/site-packages/pydantic/main.py", line 589, in __class_getitem__
    raise TypeError(f'{cls} cannot be parametrized because it does not inherit from typing.Generic')
TypeError: <class 'aidbox.resource.list.List'> cannot be parametrized because it does not inherit from typing.Generic

from pydantic import *
from typing import Optional, List
......

class List(DomainResource):
.....
@tukipe
Copy link
Author

tukipe commented Sep 23, 2024

This worked ok before this change 43d7fc0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant