Skip to content

SyntaxError in examples #540

Open
Open
@hterik

Description

@hterik

Specifications

  • Client Version: 1.35
  • python version 3.10.8
  • mypy version 0.991

Code sample to reproduce problem

Code example from README.rst

class BatchingCallback(object):

    def success(self, conf: (str, str, str), data: str):
        print(f"Written batch: {conf}, data: {data}")

Expected behavior

Code from Readme can be copy-pasted into source file and not generate syntax errors from either python nor mypy.

Actual behavior

Running mypy gives error:

example.py: note: In member "success" of class "BatchingCallback":
example.py:75:27: error: Syntax error in type annotation  [syntax]
example.py:75:27: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn)

Additional info

Using the suggestion from mypy error message should be sufficent.

(Would be great if tuple alias could be used instead of typing.Tuple to save on import verbosity, but that requires 3.9+, this library is currently targeting 3.7+.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions