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

Fix mypy and line-too-long errors #3313

Merged
merged 1 commit into from
Jan 21, 2024
Merged

Fix mypy and line-too-long errors #3313

merged 1 commit into from
Jan 21, 2024

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Jan 19, 2024

This fixes two errors I was seeing on Python 3.8.11 and Python 3.11.4:

1. A mypy error

    @functools.wraps(fn)
    def _fn(
        *args: _P.args,
        name: Optional[str] = None,
        infer: Optional[InferDict] = None,
        obs: Optional[_T] = None,
        **kwargs: _P.kwargs,
    ) -> Optional[_T]:
        is_observed = obs is not None

        if not am_i_wrapped():
            return fn(*args, **kwargs)
        else:
>           msg = Message[_P, _T](
                type=type,
                name=name,
                fn=fn,
                is_observed=is_observed,
                args=args,
                kwargs=kwargs,
                value=obs,
                scale=1.0,
                mask=None,
                cond_indep_stack=(),
                done=False,
                stop=False,
                continuation=None,
                infer=infer if infer is not None else {},
            )
E           TypeError: '_TypedDictMeta' object is not subscriptable

../../pyro-ppl/pyro/pyro/poutine/runtime.py:354: TypeError

2. A ruff line too long error

ruff check .
pyro/poutine/indep_messenger.py:29:121: E501 Line too long (129 > 120 characters)

@fritzo fritzo merged commit 1a11185 into dev Jan 21, 2024
9 checks passed
@ordabayevy ordabayevy deleted the fix-message-subscript branch February 10, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants