Skip to content

Commit a9fbbdf

Browse files
committed
Make mypy -p blueman --ignore-missing-imports work
1 parent 8b46e44 commit a9fbbdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+112
-48
lines changed

apps/blueman-assistant.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import os
44
import sys
55
import signal
66
import logging
7-
from locale import bind_textdomain_codeset
7+
from gettext import bind_textdomain_codeset
88

99
import gi
1010
gi.require_version("Gtk", "3.0")

blueman/Constants.py.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ RFCOMM_WATCHER_PATH = "@LIBEXECDIR@/blueman-rfcomm-watcher"
1818

1919
import os
2020
import gettext
21-
import builtins
2221

2322
translation = gettext.translation(GETTEXT_PACKAGE, LOCALEDIR, fallback=True)
2423
translation.install()
25-
builtins.ngettext = translation.ngettext
2624

2725
if 'BLUEMAN_SOURCE' in os.environ:
2826
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

blueman/DeviceClass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# coding=utf-8
2+
from gettext import gettext as _
23
import logging
34

45
service_cls = [

blueman/Sdp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# coding=utf-8
22
import gettext
3+
from gettext import gettext as _
34
from uuid import UUID
45

56
from blueman.Constants import GETTEXT_PACKAGE, LOCALEDIR
67

78
translation = gettext.translation(GETTEXT_PACKAGE, LOCALEDIR, fallback=True)
8-
try:
9-
translation.install(unicode=True)
10-
except TypeError:
11-
translation.install()
9+
translation.install()
1210

1311
# https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
1412
# http://git.kernel.org/cgit/bluetooth/bluez.git/tree/lib/sdp.h

blueman/Service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44

55
class Service(object):
6-
__group__ = None
7-
__svclass_id__ = None
6+
__group__: str
7+
__svclass_id__: int
88
__description__ = None
9-
__icon__ = None
10-
__priority__ = None
9+
__icon__: str
10+
__priority__: int
1111

1212
def __init__(self, device, uuid):
1313
self.__device = device

blueman/bluez/Base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# coding=utf-8
2+
from typing import Dict, Any, Tuple
3+
24
from gi.repository import Gio, GLib, GObject
35
from gi.types import GObjectMeta
46
from blueman.bluez.errors import parse_dbus_error
@@ -47,7 +49,7 @@ class Base(Gio.DBusProxy, metaclass=BaseMeta):
4749
__name = 'org.bluez'
4850
__bus_type = Gio.BusType.SYSTEM
4951

50-
__gsignals__ = {
52+
__gsignals__: Dict[str, Tuple[Any, GObject.SignalFlags, Tuple]] = {
5153
'property-changed': (GObject.SignalFlags.NO_HOOKS, None,
5254
(GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT))
5355
}

blueman/gui/DeviceSelectorDialog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# coding=utf-8
2+
from gettext import gettext as _
3+
24
from blueman.gui.DeviceSelectorWidget import DeviceSelectorWidget
35

46
import gi

blueman/gui/GsmSettings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
from locale import bind_textdomain_codeset
2+
from gettext import bind_textdomain_codeset
33

44
from blueman.main.Config import Config
55
from blueman.Constants import *

blueman/gui/applet/PluginDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding=utf-8
22
import weakref
33
import logging
4-
from locale import bind_textdomain_codeset
4+
from gettext import bind_textdomain_codeset
55

66
from blueman.Constants import *
77
from blueman.gui.GenericList import GenericList

blueman/gui/manager/ManagerDeviceMenu.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# coding=utf-8
22
import logging
3-
from locale import bind_textdomain_codeset
3+
from gettext import bind_textdomain_codeset
44
from operator import itemgetter
5+
from typing import Dict, List
6+
57
from blueman.Constants import UI_PATH
68
from blueman.Functions import create_menuitem, e_
79
from blueman.bluez.Network import AnyNetwork
@@ -27,8 +29,8 @@
2729

2830

2931
class ManagerDeviceMenu(Gtk.Menu):
30-
__ops__ = {}
31-
__instances__ = []
32+
__ops__: Dict[str, str] = {}
33+
__instances__: List["ManagerDeviceMenu"] = []
3234

3335
def __init__(self, blueman):
3436
super().__init__()

0 commit comments

Comments
 (0)