Skip to content

TypeError: Can't instantiate abstract class Segment with abstract methods compute_dx, compute_dy, compute_x, compute_y #19

@srichakradhar

Description

@srichakradhar

Environment

Python version: Python3
Operating System: MacOS

Issue

Traceback (most recent call last):
  File "/Users/srichakradhar/Documents/GitHub/trafficSimulator/src/lane_change.py", line 12, in <module>
    sim.create_segment((lane_space/2, length+intersection_size/2), (lane_space/2, intersection_size/2))
  File "/Users/srichakradhar/Documents/GitHub/trafficSimulator/src/trafficSimulator/core/simulation.py", line 36, in create_segment
    seg = Segment(args)
          ^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class Segment with abstract methods compute_dx, compute_dy, compute_x, compute_y

Since abstract classes cannot be instantiated, and require subclasses to provide implementations for the abstract methods, the Segment should stop extending from ABC and the abstract methods need to be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions