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

TypeError: object of type 'ellipsis' has no len() #266

Closed
pseudo-rnd-thoughts opened this issue Jul 12, 2022 · 0 comments
Closed

TypeError: object of type 'ellipsis' has no len() #266

pseudo-rnd-thoughts opened this issue Jul 12, 2022 · 0 comments
Labels
Milestone

Comments

@pseudo-rnd-thoughts
Copy link

Describe the bug
I am part of the development team on OpenAI/gym which we are slowly adding type hinting.
Recently I found this repo and thought it would be a great way of testing the type hinting is correct
However, in part of the code we get the following error with typeguard

To Reproduce

from typing import Callable

from typeguard import typechecked

@typechecked
def fn_generator(name: str) -> Callable[..., object]:
    # The actual code we want to run
    # >>> mod_name, attr_name = name.split(":")
    # >>> mod = importlib.import_module(mod_name)
    # >>> fn = getattr(mod, attr_name)
    # >>> return fn

    # Example code for testing
    def f(**kwargs):
        return 1
    return f

fn_generator("a")

Expected behavior
From my understanding, ... is the correct way of type hinting a callable with unknown args and kwargs
python/mypy#5876

Is this correct? Or is there alternative way that typeguard expects

@agronholm agronholm added the bug label Jan 9, 2023
@agronholm agronholm added this to the 3.0.0 milestone Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants