[mypy] Add/fix type annotations for electronics algorithms (#4247)

* Fix mypy errors for scheduling/first_come_first_served

* Fix mypy errors for scheduling/round_robin.py

* Fix mypy errors for scheduling/shortest_job_first.py

* Fix isort errors

* Fix mypy errors for electronics/ohms_law.py

* Fix mypy errors for electronics/electric_power.py

* Fix black errors
This commit is contained in:
Shantanu Joshi 2021-03-18 13:09:53 +05:30 committed by GitHub
parent ced83bed2c
commit 4f6a929503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,8 +1,9 @@
# https://en.m.wikipedia.org/wiki/Electric_power
from collections import namedtuple
from typing import Tuple
def electric_power(voltage: float, current: float, power: float) -> float:
def electric_power(voltage: float, current: float, power: float) -> Tuple:
"""
This function can calculate any one of the three (voltage, current, power),
fundamental value of electrical system.

View File

@ -1,7 +1,8 @@
# https://en.wikipedia.org/wiki/Ohm%27s_law
from typing import Dict
def ohms_law(voltage: float, current: float, resistance: float) -> float:
def ohms_law(voltage: float, current: float, resistance: float) -> Dict[str, float]:
"""
Apply Ohm's Law, on any two given electrical values, which can be voltage, current,
and resistance, and then in a Python dict return name/value pair of the zero value.