Skip to content

Commit

Permalink
Add imports of other modules to stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiaswold committed Sep 14, 2022
1 parent 53eb5e7 commit 2160249
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/stub_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from .code_generator import CodeGenerator

MODULE_NAMES = ["carla", "command"]


class CarlaStubGenerator:
module_name: str
Expand All @@ -27,6 +29,9 @@ def __init__(self, file):
self._generator.add_line("from typing import Any")
self._generator.add_line("import numpy as np")
self._generator.add_line()
for module_name in MODULE_NAMES:
if self.module_name != module_name:
self._generator.add_line(f"import {module_name}")
self._generator.add_line()

def save_to_file(self, directory: Path):
Expand Down Expand Up @@ -121,7 +126,9 @@ def _generate_methods(self, _class):
warning = method.get("warning", None)
if warning:
self._generator.add_line()
self._generator.add_line(f"**warning**: {self._parse_docs(warning)}")
self._generator.add_line(
f"**warning**: {self._parse_docs(warning)}"
)

for param in param_list:
param_name = param.get("param_name", "")
Expand Down
13 changes: 13 additions & 0 deletions stubs/0.9.13/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Actor:
"""
Expand Down Expand Up @@ -807,6 +808,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class ActorAttributeType:
"""
Expand Down Expand Up @@ -1227,6 +1229,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Client:
"""
Expand Down Expand Up @@ -1731,6 +1734,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class VehicleControl:
"""
Expand Down Expand Up @@ -2154,6 +2158,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Vector2D:
"""
Expand Down Expand Up @@ -2846,6 +2851,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class LightGroup:
"""
Expand Down Expand Up @@ -3177,6 +3183,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class LaneType:
"""
Expand Down Expand Up @@ -3896,6 +3903,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Osm2Odr:
"""
Expand Down Expand Up @@ -3971,6 +3979,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Sensor(Actor):
"""
Expand Down Expand Up @@ -4169,6 +4178,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class SensorData:
"""
Expand Down Expand Up @@ -5056,6 +5066,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class WorldSnapshot:
"""
Expand Down Expand Up @@ -5174,6 +5185,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class WeatherParameters:
"""
Expand Down Expand Up @@ -5287,6 +5299,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import command

class Timestamp:
"""
Expand Down
1 change: 1 addition & 0 deletions stubs/0.9.13/command.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Any
import numpy as np

import carla

class Response:
"""
Expand Down

0 comments on commit 2160249

Please sign in to comment.