Forced the type in setters

This commit is contained in:
Pilar 2021-09-13 15:14:54 -04:00
parent c12643d1dd
commit f4d62bb505
26 changed files with 127 additions and 126 deletions

View File

@ -7,7 +7,7 @@ Contributor Milad milad.aghamohamadnia@concordia.ca
import uuid
from typing import List, TypeVar
UsageZone = TypeVar('Node')
Node = TypeVar('Node')
class Edge:

View File

@ -8,7 +8,8 @@ Contributor Milad milad.aghamohamadnia@concordia.ca
import uuid
from typing import List, TypeVar
UsageZone = TypeVar('Edge')
Edge = TypeVar('Edge')
class Node:
"""

View File

@ -217,7 +217,7 @@ class Polyhedron:
return self._min_x
@property
def centroid(self) -> List[float]:
def centroid(self) -> Union[None, List[float]]:
"""
Get polyhedron centroid
:return: [x,y,z]

View File

@ -44,7 +44,7 @@ class Schedule:
Set schedule type
:param: str
"""
self._type = value
self._type = str(value)
@property
def values(self):
@ -77,7 +77,7 @@ class Schedule:
Set schedule data type
:param: str
"""
self._data_type = value
self._data_type = str(value)
@property
def time_step(self):
@ -94,7 +94,7 @@ class Schedule:
Set schedule time step
:param: str
"""
self._time_step = value
self._time_step = str(value)
@property
def time_range(self):
@ -111,7 +111,7 @@ class Schedule:
Set schedule time range
:param: str
"""
self._time_range = value
self._time_range = str(value)
@property
def day_types(self):
@ -129,4 +129,4 @@ class Schedule:
Set schedule day types
:param: [str]
"""
self._day_types = value
self._day_types = [str(i) for i in value]

View File

@ -137,7 +137,7 @@ class Building(CityObject):
Set if the city object attic is heated
:param value: Boolean
"""
self._attic_heated = value
self._attic_heated = bool(value)
@property
def basement_heated(self):
@ -153,7 +153,7 @@ class Building(CityObject):
Set if the city object basement is heated
:param value: Boolean
"""
self._basement_heated = value
self._basement_heated = bool(value)
@property
def name(self):
@ -204,7 +204,7 @@ class Building(CityObject):
Set building function
:param value: str
"""
self._function = value
self._function = str(value)
@property
def average_storey_height(self):
@ -220,7 +220,7 @@ class Building(CityObject):
Set building average storey height in meters
:param value: float
"""
self._average_storey_height = value
self._average_storey_height = float(value)
@property
def storeys_above_ground(self):
@ -236,7 +236,7 @@ class Building(CityObject):
Set building storeys number above ground
:param value: int
"""
self._storeys_above_ground = value
self._storeys_above_ground = int(value)
@staticmethod
def _tuple_to_point(xy_tuple):

View File

@ -30,7 +30,7 @@ class InternalGains:
Set internal gains average internal gain in W/m2
:param value: float
"""
self._average_internal_gain = value
self._average_internal_gain = float(value)
@property
def convective_fraction(self):
@ -46,7 +46,7 @@ class InternalGains:
Set internal gains convective fraction
:param value: float
"""
self._convective_fraction = value
self._convective_fraction = float(value)
@property
def radiative_fraction(self):
@ -62,7 +62,7 @@ class InternalGains:
Set internal gains convective fraction
:param value: float
"""
self._radiative_fraction = value
self._radiative_fraction = float(value)
@property
def latent_fraction(self):
@ -78,4 +78,4 @@ class InternalGains:
Set internal gains latent fraction
:param value: float
"""
self._latent_fraction = value
self._latent_fraction = float(value)

View File

@ -56,4 +56,4 @@ class Layer:
Get layer thickness in meters
:param value: float
"""
self._thickness = value
self._thickness = float(value)

View File

@ -34,7 +34,7 @@ class Material:
Set material name
:param value: string
"""
self._name = value
self._name = str(value)
@property
def conductivity(self):
@ -50,7 +50,7 @@ class Material:
Set material conductivity in W/mK
:param value: float
"""
self._conductivity = value
self._conductivity = float(value)
@property
def specific_heat(self):
@ -66,7 +66,7 @@ class Material:
Get material conductivity in J/kgK
:param value: float
"""
self._specific_heat = value
self._specific_heat = float(value)
@property
def density(self):
@ -82,7 +82,7 @@ class Material:
Set material density in kg/m3
:param value: float
"""
self._density = value
self._density = float(value)
@property
def solar_absorptance(self):
@ -98,7 +98,7 @@ class Material:
Set material solar absorptance
:param value: float
"""
self._solar_absorptance = value
self._solar_absorptance = float(value)
@property
def thermal_absorptance(self):
@ -114,7 +114,7 @@ class Material:
Set material thermal absorptance
:param value: float
"""
self._thermal_absorptance = value
self._thermal_absorptance = float(value)
@property
def visible_absorptance(self):
@ -130,7 +130,7 @@ class Material:
Set material visible absorptance
:param value: float
"""
self._visible_absorptance = value
self._visible_absorptance = float(value)
@property
def no_mass(self):
@ -146,7 +146,7 @@ class Material:
Set material no mass flag
:param value: Boolean
"""
self._no_mass = value
self._no_mass = bool(value)
@property
def thermal_resistance(self):
@ -162,4 +162,4 @@ class Material:
Set material thermal resistance in m2K/W
:param value: float
"""
self._thermal_resistance = value
self._thermal_resistance = float(value)

View File

@ -48,7 +48,7 @@ class Occupants:
Set heat dissipation of occupants in W/person
:param value: float
"""
self._heat_dissipation = value
self._heat_dissipation = float(value)
@property
def occupancy_rate(self):
@ -64,7 +64,7 @@ class Occupants:
Set rate of schedules
:param value: float
"""
self._occupancy_rate = value
self._occupancy_rate = float(value)
@property
def occupant_type(self):
@ -80,7 +80,7 @@ class Occupants:
Set type of schedules
:param value: float
"""
self._occupant_type = value
self._occupant_type = float(value)
@property
def usage_zone(self) -> UsageZone:
@ -104,7 +104,7 @@ class Occupants:
Set the schedules when an occupant is in a zone (24 values, 1 per hour of the day)
:param value: [float]
"""
self._occupant_schedule = value
self._occupant_schedule = [float(i) for i in value]
@property
def number_of_occupants(self):
@ -120,7 +120,7 @@ class Occupants:
Set the number of occupants
:param value: int
"""
self._number_of_occupants = value
self._number_of_occupants = int(value)
@property
def arrival_time(self):

View File

@ -75,7 +75,7 @@ class Surface:
Set the surface id
:param value: str
"""
self._id = value
self._id = str(value)
@property
def swr(self):
@ -91,7 +91,7 @@ class Surface:
Set surface short wave reflectance
:param value: float
"""
self._swr = value
self._swr = float(value)
def _max_coord(self, axis):
if axis == 'x':

View File

@ -142,8 +142,8 @@ class ThermalBoundary:
Set thermal boundary outside solar absorptance
:param value: float
"""
self._outside_solar_absorptance = value
self._shortwave_reflectance = 1.0 - float(value)
self._outside_solar_absorptance = float(value)
self._shortwave_reflectance = 1.0 - value
@property
def outside_thermal_absorptance(self):
@ -159,7 +159,7 @@ class ThermalBoundary:
Set thermal boundary outside thermal absorptance
:param value: float
"""
self._outside_thermal_absorptance = value
self._outside_thermal_absorptance = float(value)
@property
def outside_visible_absorptance(self):
@ -175,7 +175,7 @@ class ThermalBoundary:
Set thermal boundary outside visible absorptance
:param value: float
"""
self._outside_visible_absorptance = value
self._outside_visible_absorptance = float(value)
@property
def thermal_openings(self) -> List[ThermalOpening]:
@ -216,7 +216,7 @@ class ThermalBoundary:
Set construction name
:param value: str
"""
self._construction_name = value
self._construction_name = str(value)
@property
def layers(self) -> List[Layer]:
@ -256,7 +256,7 @@ class ThermalBoundary:
Set thermal boundary window ratio
:param value: float
"""
self._window_ratio = value
self._window_ratio = float(value)
@property
def u_value(self):
@ -286,7 +286,7 @@ class ThermalBoundary:
Set thermal boundary U-value in W/m2K
:param value: float
"""
self._u_value = value
self._u_value = float(value)
@property
def shortwave_reflectance(self):
@ -302,8 +302,8 @@ class ThermalBoundary:
Set thermal boundary shortwave reflectance
:param value: float
"""
self._shortwave_reflectance = value
self._outside_solar_absorptance = 1.0 - float(value)
self._shortwave_reflectance = float(value)
self._outside_solar_absorptance = 1.0 - value
@property
def hi(self):
@ -317,9 +317,9 @@ class ThermalBoundary:
def hi(self, value):
"""
Set internal convective heat transfer coefficient (W/m2K)
:param value: internal convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._hi = value
self._hi = float(value)
@property
def he(self):
@ -335,7 +335,7 @@ class ThermalBoundary:
Set external convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._he = value
self._he = float(value)
@property
def surface_geometry(self):
@ -369,7 +369,7 @@ class ThermalBoundary:
Set short wave emissivity factor of the thermal boundary's internal surface (-)
:param value: float
"""
self._inside_emissivity = value
self._inside_emissivity = float(value)
@property
def alpha_coefficient(self):
@ -385,7 +385,7 @@ class ThermalBoundary:
Set long wave emissivity factor of the thermal boundary's internal surface (-)
:param value: float
"""
self._alpha_coefficient = value
self._alpha_coefficient = float(value)
@property
def radiative_coefficient(self):
@ -401,4 +401,4 @@ class ThermalBoundary:
Set radiative coefficient of the thermal boundary's external surface (-)
:param value: float
"""
self._radiative_coefficient = value
self._radiative_coefficient = float(value)

View File

@ -56,7 +56,7 @@ class ThermalOpening:
Set thermal opening area in square meters
:param value: float
"""
self._area = value
self._area = float(value)
@property
def openable_ratio(self):
@ -88,7 +88,7 @@ class ThermalOpening:
"""
# The code to calculate overall_u_value is duplicated here and in thickness_m.
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
self._conductivity = value
self._conductivity = float(value)
if self._overall_u_value is None and self.thickness is not None:
h_i = self.hi
h_e = self.he
@ -109,7 +109,7 @@ class ThermalOpening:
Set thermal opening frame ratio
:param value: float
"""
self._frame_ratio = value
self._frame_ratio = float(value)
@property
def g_value(self):
@ -125,7 +125,7 @@ class ThermalOpening:
Set thermal opening g-value
:param value: float
"""
self._g_value = value
self._g_value = float(value)
@property
def thickness(self):
@ -143,7 +143,7 @@ class ThermalOpening:
"""
# The code to calculate overall_u_value is duplicated here and in conductivity.
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
self._thickness = value
self._thickness = float(value)
if self._overall_u_value is None and self.conductivity is not None:
h_i = self.hi
h_e = self.he
@ -164,7 +164,7 @@ class ThermalOpening:
Set thermal opening front side solar transmittance at normal incidence
:param value: float
"""
self._front_side_solar_transmittance_at_normal_incidence = value
self._front_side_solar_transmittance_at_normal_incidence = float(value)
@property
def back_side_solar_transmittance_at_normal_incidence(self):
@ -180,7 +180,7 @@ class ThermalOpening:
Set thermal opening back side solar transmittance at normal incidence
:param value: float
"""
self._back_side_solar_transmittance_at_normal_incidence = value
self._back_side_solar_transmittance_at_normal_incidence = float(value)
@property
def overall_u_value(self):
@ -196,7 +196,7 @@ class ThermalOpening:
Set thermal opening overall U-value in W/m2K
:param value: float
"""
self._overall_u_value = value
self._overall_u_value = float(value)
@property
def hi(self):
@ -212,7 +212,7 @@ class ThermalOpening:
Set internal convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._hi = value
self._hi = float(value)
@property
def he(self):
@ -228,7 +228,7 @@ class ThermalOpening:
Set external convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._he = value
self._he = float(value)
@property
def surface_geometry(self) -> Polygon:
@ -253,7 +253,7 @@ class ThermalOpening:
Set short wave emissivity factor of the thermal opening's internal surface (-)
:param value: float
"""
self._inside_emissivity = value
self._inside_emissivity = float(value)
@property
def alpha_coefficient(self):
@ -269,7 +269,7 @@ class ThermalOpening:
Set long wave emissivity factor of the thermal opening's internal surface (-)
:param value: float
"""
self._alpha_coefficient = value
self._alpha_coefficient = float(value)
@property
def radiative_coefficient(self):
@ -285,4 +285,4 @@ class ThermalOpening:
Set radiative coefficient of the thermal opening's external surface (-)
:param value: float
"""
self._radiative_coefficient = value
self._radiative_coefficient = float(value)

View File

@ -85,7 +85,7 @@ class ThermalZone:
Set thermal zone additional thermal bridge u value W/m2K
:param value: float
"""
self._additional_thermal_bridge_u_value = value
self._additional_thermal_bridge_u_value = float(value)
@property
def effective_thermal_capacity(self):
@ -101,7 +101,7 @@ class ThermalZone:
Set thermal zone effective thermal capacity in J/m2K
:param value: float
"""
self._effective_thermal_capacity = value
self._effective_thermal_capacity = float(value)
@property
def indirectly_heated_area_ratio(self):
@ -117,7 +117,7 @@ class ThermalZone:
Set thermal zone indirectly heated area ratio
:param value: float
"""
self._indirectly_heated_area_ratio = value
self._indirectly_heated_area_ratio = float(value)
@property
def infiltration_rate_system_on(self):
@ -133,7 +133,7 @@ class ThermalZone:
Set thermal zone infiltration rate system on in air changes per hour (ACH)
:param value: float
"""
self._infiltration_rate_system_on = value
self._infiltration_rate_system_on = float(value)
@property
def infiltration_rate_system_off(self):
@ -149,7 +149,7 @@ class ThermalZone:
Set thermal zone infiltration rate system on in air changes per hour (ACH)
:param value: float
"""
self._infiltration_rate_system_off = value
self._infiltration_rate_system_off = float(value)
@property
def usage_zones(self) -> List[UsageZone]:
@ -197,4 +197,4 @@ class ThermalZone:
Set a specific order of the zones to be called
:param value: int
"""
self._ordinate_number = value
self._ordinate_number = int(value)

View File

@ -77,7 +77,7 @@ class UsageZone:
Set usage zone heating set point in Celsius
:param value: float
"""
self._heating_setpoint = value
self._heating_setpoint = float(value)
@property
def heating_setback(self):
@ -93,7 +93,7 @@ class UsageZone:
Set usage zone heating setback in Celsius
:param value: float
"""
self._heating_setback = value
self._heating_setback = float(value)
@property
def cooling_setpoint(self):
@ -109,7 +109,7 @@ class UsageZone:
Set usage zone cooling setpoint in Celsius
:param value: float
"""
self._cooling_setpoint = value
self._cooling_setpoint = float(value)
@property
def hours_day(self):
@ -125,7 +125,7 @@ class UsageZone:
Set usage zone usage hours per day
:param value: float
"""
self._hours_day = value
self._hours_day = float(value)
@property
def days_year(self):
@ -141,7 +141,7 @@ class UsageZone:
Set usage zone usage days per year
:param value: float
"""
self._days_year = value
self._days_year = float(value)
@property
def mechanical_air_change(self):
@ -157,7 +157,7 @@ class UsageZone:
Set usage zone mechanical air change in air change per hour (ACH)
:param value: float
"""
self._mechanical_air_change = value
self._mechanical_air_change = float(value)
@property
def usage(self):
@ -173,7 +173,7 @@ class UsageZone:
Set usage zone usage
:param value: str
"""
self._usage = value
self._usage = str(value)
@property
def occupants(self) -> List[Occupants]:
@ -221,7 +221,7 @@ class UsageZone:
Set average DHW consumption in cubic meters per person per day
:param values: float
"""
self._dhw_average_volume_pers_day = values
self._dhw_average_volume_pers_day = float(values)
@property
def dhw_preparation_temperature(self):
@ -232,12 +232,12 @@ class UsageZone:
return self._dhw_preparation_temperature
@dhw_preparation_temperature.setter
def dhw_preparation_temperature(self, values):
def dhw_preparation_temperature(self, value):
"""
Set preparation temperature of the DHW in Celsius
:param values: float
:param value: float
"""
self._dhw_preparation_temperature = values
self._dhw_preparation_temperature = float(value)
@property
def electrical_app_average_consumption_sqm_year(self):
@ -248,12 +248,12 @@ class UsageZone:
return self._electrical_app_average_consumption_sqm_year
@electrical_app_average_consumption_sqm_year.setter
def electrical_app_average_consumption_sqm_year(self, values):
def electrical_app_average_consumption_sqm_year(self, value):
"""
Set average consumption of electrical appliances in Joules per square meter and year (J/m2yr)
:param values: float
:param value: float
"""
self._electrical_app_average_consumption_sqm_year = values
self._electrical_app_average_consumption_sqm_year = float(value)
@property
def volume_geometry(self) -> Polyhedron:
@ -277,7 +277,7 @@ class UsageZone:
Set volume in cubic meters
:param value: float
"""
self._volume = value
self._volume = float(value)
@property
def is_heated(self):
@ -293,7 +293,7 @@ class UsageZone:
Set thermal zone heated flag
:param value: Boolean
"""
self._is_heated = value
self._is_heated = bool(value)
@property
def is_cooled(self):
@ -309,4 +309,4 @@ class UsageZone:
Set thermal zone cooled flag
:param value: Boolean
"""
self._is_cooled = value
self._is_cooled = bool(value)

View File

@ -93,7 +93,7 @@ class City:
Set the name for the climatic information reference city
:param value: str
"""
self._climate_reference_city = value
self._climate_reference_city = str(value)
@property
def climate_file(self) -> Path:
@ -109,7 +109,7 @@ class City:
Set the climate file full path
:param value: Path
"""
self._climate_file = value
self._climate_file = Path(value)
@property
def city_objects(self) -> Union[List[CityObject], None]:
@ -224,7 +224,7 @@ class City:
Set city name
:param value:str
"""
self._name = value
self._name = str(value)
@staticmethod
def load(city_filename) -> City:
@ -280,7 +280,7 @@ class City:
Set city latitude in degrees
:parameter value: float
"""
self._latitude = value
self._latitude = float(value)
@property
def longitude(self):
@ -296,7 +296,7 @@ class City:
Set city longitude in degrees
:parameter value: float
"""
self._longitude = value
self._longitude = float(value)
@property
def time_zone(self):
@ -312,7 +312,7 @@ class City:
Set city time_zone
:parameter value: float
"""
self._time_zone = value
self._time_zone = float(value)
@property
def buildings_clusters(self) -> Union[List[BuildingsCluster], None]:

View File

@ -27,7 +27,7 @@ class HeatPump:
Set seasonal mean COP (-)
:param value: float
"""
self._seasonal_mean_cop = value
self._seasonal_mean_cop = float(value)
@property
def seasonal_mean_coverage_factor(self):
@ -43,4 +43,4 @@ class HeatPump:
Set percentage of demand covered by the hp (-)
:return: float
"""
self._seasonal_mean_coverage_factor = value
self._seasonal_mean_coverage_factor = float(value)

View File

@ -31,7 +31,7 @@ class PvSystem:
Set mean modules efficiency (-)
:param value: float
"""
self._modules_mean_seasonal_efficiency = value
self._modules_mean_seasonal_efficiency = float(value)
@property
def total_area(self):
@ -47,7 +47,7 @@ class PvSystem:
Set total modules area in square meters
:param value: float
"""
self._total_area = value
self._total_area = float(value)
@property
def module_area(self):
@ -63,7 +63,7 @@ class PvSystem:
Set module area in square meters
:param value: float
"""
self._module_area = value
self._module_area = float(value)
@property
def number_of_modules(self):
@ -79,7 +79,7 @@ class PvSystem:
Set number of modules
:param value: int
"""
self._number_of_modules = value
self._number_of_modules = int(value)
@property
def overall_system_performance_ratio(self):
@ -95,7 +95,7 @@ class PvSystem:
Set overall system performance ratio (-)
:param value: float
"""
self._overall_system_performance_ratio = value
self._overall_system_performance_ratio = float(value)
@property
def electricity_generation(self):
@ -111,4 +111,4 @@ class PvSystem:
Set electricity generation in J
:param value: float
"""
self._electricity_generation = value
self._electricity_generation = float(value)

View File

@ -31,7 +31,7 @@ class Sensor:
Set sensor name
:param value: str
"""
self._name = value
self._name = str(value)
@property
def type(self):

View File

@ -100,7 +100,7 @@ class Connection:
Set if the vehicles which pass this (lane to lane) connection will not wait
:param value: Boolean
"""
self._pass = value
self._pass = bool(value)
@property
def keep_clear(self):
@ -116,4 +116,4 @@ class Connection:
Set if vehicles which pass this (lane to lane) connection should keep the intersection clear
:param value: Boolean
"""
self._keep_clear = value
self._keep_clear = bool(value)

View File

@ -35,7 +35,7 @@ class Crossing(TrafficNode):
Set whether the pedestrians have priority over the vehicles
:param value: bool
"""
self._priority = value
self._priority = bool(value)
@property
def width(self):
@ -51,7 +51,7 @@ class Crossing(TrafficNode):
Set crossing width in meters
:param value: float
"""
self._width = value
self._width = float(value)
@property
def shape(self) -> List[List[float]]:
@ -67,4 +67,4 @@ class Crossing(TrafficNode):
Set the list of positions
:param value: [[x, y, (z)]]
"""
self._shape = value
self._shape = [[float(i) for i in value]]

View File

@ -38,7 +38,7 @@ class Lane:
The enumeration index of the lane (0 is the rightmost lane, <NUMBER_LANES>-1 is the leftmost one)
:param value: int
"""
self._index = value
self._index = int(value)
@property
def allow(self) -> List[str]:
@ -54,7 +54,7 @@ class Lane:
Set the list of allowed vehicle classes setter
:param value: [str]
"""
self._allow = value
self._allow = [str(i) for i in value]
@property
def disallow(self) -> List[str]:
@ -70,7 +70,7 @@ class Lane:
Get the list of not allowed vehicle classes setter
:param value: [str]
"""
self._disallow = value
self._disallow = [str(i) for i in value]
@property
def change_left(self) -> List[str]:
@ -86,7 +86,7 @@ class Lane:
Set the list of vehicle classes that may change left from this lane
:param value: [str]
"""
self._change_left = value
self._change_left = [str(i) for i in value]
@property
def change_right(self) -> List[str]:
@ -102,7 +102,7 @@ class Lane:
Set the list of vehicle classes that may change right from this lane
:param value: [str]
"""
self._change_right = value
self._change_right = [str(i) for i in value]
@property
def speed(self):
@ -118,7 +118,7 @@ class Lane:
Set the lane speed in m/s
:param value: float
"""
self._speed = value
self._speed = float(value)
@property
def width(self):
@ -134,4 +134,4 @@ class Lane:
Set the lane width in meters
:param value: float
"""
self._width = value
self._width = float(value)

View File

@ -35,7 +35,7 @@ class Phase:
Set phase duration in seconds
:param value: int
"""
self._duration = value
self._duration = int(value)
@property
def state(self):
@ -51,7 +51,7 @@ class Phase:
Set the list of signal states
:param value: [str]
"""
self._state = value
self._state = [str(i) for i in value]
@property
def min_duration(self):
@ -69,7 +69,7 @@ class Phase:
Set phase minimum duration in seconds
:param value: int
"""
self._min_duration = value
self._min_duration = int(value)
@property
def max_duration(self):
@ -87,7 +87,7 @@ class Phase:
Set phase maximum duration in seconds
:param value: int
"""
self._max_duration = value
self._max_duration = int(value)
@property
def name(self):
@ -103,7 +103,7 @@ class Phase:
Set phase name
:param value: str
"""
self._name = value
self._name = str(value)
@property
def next(self) -> List[int]:
@ -125,4 +125,4 @@ class Phase:
successor phases.
:param value: [int]
"""
self._next = value
self._next = [int(i) for i in value]

View File

@ -69,7 +69,7 @@ class TrafficEdge(Edge):
It starts with one; higher numbers represent more important roads.
:param value: int
"""
self._priority = value
self._priority = int(value)
@property
def speed(self):
@ -85,7 +85,7 @@ class TrafficEdge(Edge):
Set the speed limit in m/s
:param value: float
"""
self._speed = value
self._speed = float(value)
@property
def length(self):
@ -101,7 +101,7 @@ class TrafficEdge(Edge):
Set the lane length in meters
:param value: float
"""
self._length = value
self._length = float(value)
@property
def allows(self) -> List[str]:
@ -117,7 +117,7 @@ class TrafficEdge(Edge):
Set the list of allowed vehicle classes
:param value: [str]
"""
self._allows = value
self._allows = [str(i) for i in value]
@property
def disallows(self) -> List[str]:
@ -133,4 +133,4 @@ class TrafficEdge(Edge):
Set the list of not allowed vehicle classes
:param value: [str]
"""
self._disallows = value
self._disallows = [str(i) for i in value]

View File

@ -37,7 +37,7 @@ class TrafficLight(TrafficNode):
Get if is possible to turn right when the traffic light is red
:param value: Boolean
"""
self._right_on_red = value
self._right_on_red = bool(value)
@property
def offset(self):
@ -53,7 +53,7 @@ class TrafficLight(TrafficNode):
Set program initial time offset
:param value: int
"""
self._offset = value
self._offset = int(value)
@property
def phases(self) -> List[Phase]:

View File

@ -33,4 +33,4 @@ class WalkwayNode(TrafficNode):
Set the list of positions
:param value: [[x, y, (z)]]
"""
self._shape = value
self._shape = [[float(i) for i in value]]