From 0965bd880d156bf96f0d0c44e2a249bd37ca5eba Mon Sep 17 00:00:00 2001 From: uvchik Date: Mon, 24 Feb 2020 17:12:07 +0100 Subject: [PATCH 1/2] Add needed attributes to WindTurbineGroup --- windpowerlib/wind_turbine.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index 6ab1c52a..1e4b8d8f 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -317,12 +317,7 @@ def to_group(self, number_turbines=None, total_capacity=None): # This is working for Python >= 3.5. # There a cleaner solutions for Python >= 3.6, once the support of 3.5 is # dropped: https://stackoverflow.com/a/50038614 -class WindTurbineGroup( - NamedTuple( - "WindTurbineGroup", - [("wind_turbine", WindTurbine), ("number_of_turbines", float)], - ) -): +class WindTurbineGroup: """ A simple data container to define more than one turbine of the same type. Use the :func:`~windpowerlib.wind_turbine.WindTurbine.to_group` method to @@ -337,15 +332,22 @@ class WindTurbineGroup( The number of turbines. The number is not restricted to integer values. """ - __slots__ = () + # __slots__ = () + + def __init__(self, wind_turbine, number_of_turbines): + self.wind_turbine = wind_turbine + self.number_of_turbines = number_of_turbines + self.hub_height = self.wind_turbine.hub_height + self.nominal_power = (self.wind_turbine.nominal_power * + self.number_of_turbines) -WindTurbineGroup.wind_turbine.__doc__ = ( - "A :class:`~windpowerlib.wind_farm.WindTurbine` object." -) -WindTurbineGroup.number_of_turbines.__doc__ = ( - "Number of turbines of type WindTurbine" -) +# WindTurbineGroup.wind_turbine.__doc__ = ( +# "A :class:`~windpowerlib.wind_farm.WindTurbine` object." +# ) +# WindTurbineGroup.number_of_turbines.__doc__ = ( +# "Number of turbines of type WindTurbine" +# ) def get_turbine_data_from_file(turbine_type, path): From ac9a6de0d9d25448d4d8271aa03100b38e97ad6d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 7 Apr 2020 08:06:30 +0000 Subject: [PATCH 2/2] Fixing style errors. --- windpowerlib/wind_turbine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/windpowerlib/wind_turbine.py b/windpowerlib/wind_turbine.py index d0fc7027..4432f53c 100644 --- a/windpowerlib/wind_turbine.py +++ b/windpowerlib/wind_turbine.py @@ -338,8 +338,9 @@ def __init__(self, wind_turbine, number_of_turbines): self.wind_turbine = wind_turbine self.number_of_turbines = number_of_turbines self.hub_height = self.wind_turbine.hub_height - self.nominal_power = (self.wind_turbine.nominal_power * - self.number_of_turbines) + self.nominal_power = ( + self.wind_turbine.nominal_power * self.number_of_turbines + ) # WindTurbineGroup.wind_turbine.__doc__ = (