Skip to content

Commit 1ac1981

Browse files
shan7030peRFectBeliever
authored andcommitted
[mypy] Add/fix type annotations for electronics algorithms (TheAlgorithms#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
1 parent 4863405 commit 1ac1981

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: electronics/electric_power.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# https://en.m.wikipedia.org/wiki/Electric_power
22
from collections import namedtuple
3+
from typing import Tuple
34

45

5-
def electric_power(voltage: float, current: float, power: float) -> float:
6+
def electric_power(voltage: float, current: float, power: float) -> Tuple:
67
"""
78
This function can calculate any one of the three (voltage, current, power),
89
fundamental value of electrical system.

Diff for: electronics/ohms_law.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# https://en.wikipedia.org/wiki/Ohm%27s_law
2+
from typing import Dict
23

34

4-
def ohms_law(voltage: float, current: float, resistance: float) -> float:
5+
def ohms_law(voltage: float, current: float, resistance: float) -> Dict[str, float]:
56
"""
67
Apply Ohm's Law, on any two given electrical values, which can be voltage, current,
78
and resistance, and then in a Python dict return name/value pair of the zero value.

0 commit comments

Comments
 (0)