-
-
Notifications
You must be signed in to change notification settings - Fork 222
Make codebase work with basic mypy usage #1084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # coding=utf-8 | ||
| from gettext import gettext as _ | ||
| import logging | ||
|
|
||
| service_cls = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # coding=utf-8 | ||
| from gettext import gettext as _ | ||
| import logging | ||
|
|
||
| import blueman.bluez as bluez | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ class NMConnectionError(Exception): | |
|
|
||
|
|
||
| class NMConnectionBase(object): | ||
| conntype = None | ||
| conntype: str | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| def __init__(self, service, reply_handler=None, error_handler=None): | ||
| if self.conntype not in ('dun', 'panu'): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,48 @@ | ||
| # coding=utf-8 | ||
| import logging | ||
| import weakref | ||
| from typing import List, TYPE_CHECKING, Type, Dict, Tuple, Any | ||
|
|
||
| from blueman.main.Config import Config | ||
|
|
||
|
|
||
| class MethodAlreadyExists(Exception): | ||
| pass | ||
|
|
||
|
|
||
| if TYPE_CHECKING: | ||
| from mypy_extensions import TypedDict | ||
|
|
||
| class OptionBase(TypedDict): | ||
| type: Type | ||
| default: Any | ||
|
|
||
| class Option(OptionBase, total=False): | ||
| name: str | ||
| desc: str | ||
| range: Tuple[int, int] | ||
|
|
||
| class GSettings(TypedDict): | ||
| schema: str | ||
| path: None | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| class BasePlugin(object): | ||
| __depends__ = [] | ||
| __conflicts__ = [] | ||
| __depends__: List[str] = [] | ||
| __conflicts__: List[str] = [] | ||
| __priority__ = 0 | ||
|
|
||
| __description__ = None | ||
| __author__ = None | ||
| __description__: str | ||
| __author__: str | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| __unloadable__ = True | ||
| __autoload__ = True | ||
|
|
||
| __instance__ = None | ||
|
|
||
| __gsettings__ = None | ||
| __gsettings__: "GSettings" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| __options__ = {} | ||
| __options__: Dict[str, "Option"] = {} | ||
|
|
||
| def __init__(self, parent): | ||
| self.parent = parent | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| # coding=utf-8 | ||
| from typing import List, Tuple | ||
|
|
||
|
|
||
| class ServicePlugin(object): | ||
| instances = [] | ||
| __plugin_info__ = None | ||
| instances: List["ServicePlugin"] = [] | ||
| __plugin_info__: Tuple[str, str] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| def __init__(self, parent): | ||
| ServicePlugin.instances.append(self) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # coding=utf-8 | ||
| from gettext import gettext as _ | ||
| import logging | ||
|
|
||
| import blueman.bluez as bluez | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional[str] = None