Skip to content

Commit bc7474c

Browse files
committed
Improve typing
1 parent 7e5409f commit bc7474c

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

Lima/Server/EnvHelper.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# along with this program; if not, see <http://www.gnu.org/licenses/>.
2222
############################################################################
2323

24+
from __future__ import annotations
25+
2426
import sys
2527
import os
2628
import re
@@ -428,8 +430,10 @@ def _import(name):
428430
return sys.modules[name]
429431

430432

431-
def get_entry_point(group, name):
432-
# try to find an extension using setuptools entry points
433+
def get_entry_point(group: str, name: str):
434+
"""
435+
Try to find an extension using entry points.
436+
"""
433437
if pkg_resources is None:
434438
return None
435439
entry_points = tuple(pkg_resources.iter_entry_points(group, name))
@@ -440,7 +444,7 @@ def get_entry_point(group, name):
440444
return entry_points[0]
441445

442446

443-
def get_camera_module(name):
447+
def get_camera_module(name: str):
444448
"""Returns the python module for the given camera type"""
445449
entry_point = get_entry_point("Lima_tango_camera", name)
446450
if entry_point is None:
@@ -450,7 +454,7 @@ def get_camera_module(name):
450454
return entry_point.load()
451455

452456

453-
def get_plugin_module(name):
457+
def get_plugin_module(name: str):
454458
"""Returns the python module for the given plugin type"""
455459
entry_point = get_entry_point("Lima_tango_plugin", name)
456460
if entry_point is None:

Lima/Server/plugins/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
# along with this program; if not, see <http://www.gnu.org/licenses/>.
2222
############################################################################
2323

24+
from __future__ import annotations
2425

25-
def _init_module():
26+
27+
def _init_module() -> list[str]:
2628
import os
2729

28-
plugins = []
30+
plugins: list[str] = []
2931
for root, dirs, files in os.walk(__path__[0], followlinks=True):
3032
for file_name in files:
3133
if file_name.startswith("__"):

0 commit comments

Comments
 (0)