Closed
Description
Hello,
I have two distinct python classes where code climate tells me the code is duplicated.
As i already refactored a lot and they represent two distinct objects, i do not really want to make one object from these two :
from gardena.base_gardena_device_class import BaseGardenaDeviceClass
class WaterControl(BaseGardenaDeviceClass):
"""Class to communicate with a water control device"""
watering_valve_open = None
watering_manual_override = None
"""Used to map data between 'watering' ability fields and class fields"""
watering_outlet_ability_fields = {
"valve_open": "watering_valve_open",
"manual_override": "watering_manual_override",
}
water_control_ability_type_maps = {
"watering_outlet": watering_outlet_ability_fields
}
def get_device_specific_ability_type_maps(self):
return self.water_control_ability_type_maps
And
from gardena.base_gardena_device_class import BaseGardenaDeviceClass
class Gateway(BaseGardenaDeviceClass):
"""Class to hold informations about gateways"""
ip_address = None
timezone = None
"""Used to map data between 'gateway' ability fields and class fields"""
gateway_ability_fields = {"ip_address": "ip_address", "time_zone": "timezone"}
gateway_ability_type_maps = {"gateway": gateway_ability_fields}
def get_device_specific_ability_type_maps(self):
return self.gateway_ability_type_maps
Also, i have other classes here and here that follows the same principle but where no duplications are detected.
Is there something I could do about it ?
https://codeclimate.com/github/grm/py-smart-gardena/issues
Thanks a lot for your help,
Jérémie
Metadata
Metadata
Assignees
Labels
No labels