Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DerivativePair(
"label",
"ANNUALIZED_WEATHER_NORMAL",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
Derivative("1", 10, 3, 3, 5,
OrderedDict([('2011-01-01T00:00:00+00:00', 32.0)])),
Derivative("2", 10, 6, 6, 5, None),
),
DerivativePair(
"label",
"GROSS_PREDICTED",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
None,
Derivative("2", 10, 8, 8, 5, None),
),
def derivative_pairs():
return [
DerivativePair(
"label",
"ANNUALIZED_WEATHER_NORMAL",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
Derivative("1", 10, 3, 3, 5,
OrderedDict([('2011-01-01T00:00:00+00:00', 32.0)])),
Derivative("2", 10, 6, 6, 5, None),
),
DerivativePair(
"label",
"GROSS_PREDICTED",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
Derivative("1", None, None, None, None, None),
Derivative("2", 10, 8, 8, 5, None),
),
def derivative_pairs_badly_formed():
return [
DerivativePair(
"label",
"ANNUALIZED_WEATHER_NORMAL",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
Derivative("1", 10, 3, 3, 5,
OrderedDict([('2011-01-01T00:00:00+00:00', 32.0)])),
Derivative("2", 10, 6, 6, 5, None),
),
DerivativePair(
"label",
"GROSS_PREDICTED",
"ELECTRICITY_CONSUMPTION_SUPPLIED",
"KWH",
None,
Derivative("2", 10, 8, 8, 5, None),
),
def _deserialize_derivative_pairs(derivatives):
# check for "derivative_interpretation" key
derivative_pairs, error = _get_key_or_error(
derivatives, "derivative_pairs", "DERIVATIVE_PAIRS")
if derivative_pairs is None:
return error
try:
return [
DerivativePair(
pair["label"],
pair["derivative_interpretation"],
pair["trace_interpretation"],
pair["unit"],
Derivative(
None,
pair["baseline_value"],
pair["baseline_lower"],
pair["baseline_upper"],
pair["baseline_n"],
None
),
Derivative(
None,
pair["reporting_value"],
pair["reporting_lower"],
pair["reporting_upper"],
pair["reporting_n"],
None
),
) for pair in derivative_pairs
try:
return [
DerivativePair(
pair["label"],
pair["derivative_interpretation"],
pair["trace_interpretation"],
pair["unit"],
Derivative(
None,
pair["baseline_value"],
pair["baseline_lower"],
pair["baseline_upper"],
pair["baseline_n"],
None
),
Derivative(
None,
pair["reporting_value"],
pair["reporting_lower"],
pair["reporting_upper"],
pair["reporting_n"],
None
),
) for pair in derivative_pairs
]
except KeyError:
return {
"error": "Missing key in derivative_pair serialization."
}
def _deserialize_simple_default(default_value):
try:
return Derivative(
None,
default_value["value"],
default_value["lower"],
default_value["upper"],
default_value["n"],
None
)
except:
return {
"error": "Missing key in default_value serialization."
}