Abstract classes inherit from ABC (#23246)

pull/23251/head
Willem Melching 3 years ago committed by GitHub
parent 55390d273f
commit 14bf834fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      selfdrive/car/interfaces.py
  2. 4
      selfdrive/hardware/base.py

@ -1,6 +1,6 @@
import os
import time
from abc import abstractmethod
from abc import abstractmethod, ABC
from typing import Dict, Tuple, List
from cereal import car
@ -23,7 +23,7 @@ ACCEL_MIN = -3.5
# generic car and radar interfaces
class CarInterfaceBase():
class CarInterfaceBase(ABC):
def __init__(self, CP, CarController, CarState):
self.CP = CP
self.VM = VehicleModel(CP)
@ -170,7 +170,7 @@ class CarInterfaceBase():
return events
class RadarInterfaceBase():
class RadarInterfaceBase(ABC):
def __init__(self, CP):
self.pts = {}
self.delay = 0
@ -184,7 +184,7 @@ class RadarInterfaceBase():
return ret
class CarStateBase:
class CarStateBase(ABC):
def __init__(self, CP):
self.CP = CP
self.car_fingerprint = CP.carFingerprint

@ -1,9 +1,9 @@
from abc import abstractmethod
from abc import abstractmethod, ABC
from collections import namedtuple
ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'bat', 'ambient', 'pmic'])
class HardwareBase:
class HardwareBase(ABC):
@staticmethod
def get_cmdline():
with open('/proc/cmdline') as f:

Loading…
Cancel
Save