Closed as not planned
Description
Bug Report
Seems like the same bug as:
pylint-dev/pylint#9585
But not sure if there's a common library function. Basically mypy throws an "invalid syntax" error when trying to process the init.pyi autogenerated file from the rti.connext module.
To Reproduce
Playground gives a 520 error when trying to process the ~42k line file.
pip install rti.connext==7.3.0 mypy==1.15.0
hello.py:
import rti.types as idl
@idl.struct
class HelloWorld:
message: str = ""
hello_publisher.py:
import time
import rti.connextdds as dds
from hello import HelloWorld
participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
writer = dds.DataWriter(participant.implicit_publisher, topic)
for i in range(10):
writer.write(HelloWorld(message=f'Hello World! #{i}'))
time.sleep(1)
hello_subscriber.py:
import rti.connextdds as dds
import rti.asyncio
from hello import HelloWorld
participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
reader = dds.DataReader(participant.implicit_subscriber, topic)
async def print_data():
async for data in reader.take_data_async():
print(f"Received: {data}")
rti.asyncio.run(print_data())
mypy --follow-untyped-imports --pretty .
/home/jz/.local/lib/python3.12/site-packages/rti/connextdds/__init__.pyi:35732:31: error: invalid syntax [syntax]
def type(self) -> detail::accessor<detail::accessor_policies::str_attr>:
^
Found 1 error in 1 file (errors prevented further checking)
The title of this issue is the output from the vscode extension which oddly matches this issue on pylint side:
pylint-dev/pylint#9585
Actual Behavior
/home/jz/.local/lib/python3.12/site-packages/rti/connextdds/__init__.pyi:35732:31: error: invalid syntax [syntax]
def type(self) -> detail::accessor<detail::accessor_policies::str_attr>:
^
Found 1 error in 1 file (errors prevented further checking)
Also the output from the vscode plugin:
2025-04-05 20:11:23.411 [info] [Trace - 8:11:23 PM] Received notification 'window/logMessage'.
2025-04-05 20:11:23.411 [info] file:///home/jz/scratch/hello.py :
/usr/local/lib/python3.10/dist-packages/rti/connextdds/__init__.pyi:18332:17:18332:17: error: invalid syntax [syntax]
Your Environment
- Mypy version used: 1.15.0
- Mypy command-line flags:
--follow-untyped-imports
- Mypy configuration options from
mypy.ini
(and other config files): N/A - Python version used: 3.12.3