1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-25 15:36:30 +01:00
Files
core/homeassistant/util/temperature.py
T
Fabian Heredia Montiel d4f78e8552 Type Hints - Core/Utils/Helpers Part 1 (#2592)
* Fix deprecated(moved) import

* Add util/dt typing

* Green on mypy util/dt

* Fix some errors

* First part of yping util/yaml

* Add more typing to util/yaml
2016-07-23 11:07:08 -07:00

30 lines
966 B
Python

"""Temperature util functions."""
import logging
def fahrenheit_to_celcius(fahrenheit: float) -> float:
"""**DEPRECATED** Convert a Fahrenheit temperature to Celsius."""
logging.getLogger(__name__).warning(
'fahrenheit_to_celcius is now fahrenheit_to_celsius '
'correcting a spelling mistake')
return fahrenheit_to_celsius(fahrenheit)
def fahrenheit_to_celsius(fahrenheit: float) -> float:
"""Convert a Fahrenheit temperature to Celsius."""
return (fahrenheit - 32.0) / 1.8
def celcius_to_fahrenheit(celcius: float) -> float:
"""**DEPRECATED** Convert a Celsius temperature to Fahrenheit."""
logging.getLogger(__name__).warning(
'celcius_to_fahrenheit is now celsius_to_fahrenheit correcting '
'a spelling mistake')
return celsius_to_fahrenheit(celcius)
def celsius_to_fahrenheit(celsius: float) -> float:
"""Convert a Celsius temperature to Fahrenheit."""
return celsius * 1.8 + 32.0