Code Duplication    Length = 16-16 lines in 2 locations

src/oemof/solph/_options.py 2 locations

@@ 268-283 (lines=16) @@
265
        custom_properties=None,
266
    ):
267
        # --- BEGIN: The following code can be removed for versions >= v0.7 ---
268
        if custom_attributes is not None:
269
            msg = (
270
                "For backward compatibility,"
271
                + " the option custom_attributes overwrites the option"
272
                + " custom_properties."
273
                + " Both options cannot be set at the same time."
274
            )
275
            if custom_properties is not None:
276
                raise AttributeError(msg)
277
            else:
278
                warn(msg, FutureWarning)
279
            for attribute in custom_attributes.keys():
280
                value = custom_attributes.get(attribute)
281
                setattr(self, attribute, value)
282
283
            custom_properties = custom_attributes
284
        # --- END ---
285
        self.custom_properties = custom_properties
286
@@ 104-119 (lines=16) @@
101
        custom_properties=None,
102
    ):
103
        # --- BEGIN: The following code can be removed for versions >= v0.7 ---
104
        if custom_attributes is not None:
105
            msg = (
106
                "For backward compatibility,"
107
                + " the option custom_attributes overwrites the option"
108
                + " custom_properties."
109
                + " Both options cannot be set at the same time."
110
            )
111
            if custom_properties is not None:
112
                raise AttributeError(msg)
113
            else:
114
                warn(msg, FutureWarning)
115
            for attribute in custom_attributes.keys():
116
                value = custom_attributes.get(attribute)
117
                setattr(self, attribute, value)
118
119
            custom_properties = custom_attributes
120
        # --- END ---
121
        self.custom_properties = custom_properties
122
        self.maximum = sequence(maximum)