Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Update stubs
Browse files Browse the repository at this point in the history
- Add dbus.exceptions stubs
- Add dbus.connection.SignalMatch
- Update stubs from manager project
  • Loading branch information
kalkin committed Jun 27, 2017
1 parent ce1035e commit 4c3fc37
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 6 deletions.
24 changes: 20 additions & 4 deletions stubs/dbus/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Stubs for dbus
from typing import Any, Optional, Union, Callable

import dbus._dbus
import dbus.mainloop
import dbus.proxies
import dbus._dbus
from typing import Optional, Union, Callable
import dbus.connection


class Interface(object):
def __init__(self, object: Union[dbus.proxies.ProxyObject, Interface], dbus_interface: str) -> None: ...
def get_dbus_method(self, member: str, dbus_interface: Optional[str]=...) -> Callable: ...
def get_dbus_method(self, member: str, dbus_interface: Optional[str]=...) -> Any: ...


class Bus(dbus.bus.BusConnection):
Expand All @@ -17,7 +18,22 @@ class Bus(dbus.bus.BusConnection):
mainloop: Optional[dbus.mainloop.NativeMainLoop]=...
) -> dbus.bus.BusConnection: ...

def SessionBus() -> dbus._dbus.SessionBus: ...
def add_signal_receiver(self, handler_function, signal_name: str=...,
dbus_interface:str=..., bus_name:str=...,
path:str=..., **keywords) -> dbus.connection.SignalMatch: ...

class SessionBus(Bus):
def __new__(cls,
private: Optional[bool]=...,
mainloop: Optional[dbus.mainloop.NativeMainLoop]=...
) -> Bus: ...

def remove_signal_receiver(self, handler_or_match ,
signal_name=Optional[str],
dbus_interface=Optional[str],
bus_name=Optional[str],
path=Optional[str],
**keywords) -> None: ...

class String(str): ...
class Boolean(int): ...
Expand Down
4 changes: 4 additions & 0 deletions stubs/dbus/connection.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
class Connection(object):
pass


class SignalMatch(object):
pass
21 changes: 21 additions & 0 deletions stubs/dbus/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

class DBusException(Exception):
def __init__(self, *args, **kwargs) -> None: ...

class MissingErrorHandlerException(DBusException):
def __init__(self) -> None: ...

class MissingReplyHandlerException(DBusException):
def __init__(self) -> None: ...

class ValidationException(DBusException):
def __init__(self, msg: str='') -> None: ...

class IntrospectionParserException(DBusException):
def __init__(self, msg: str='') -> None: ...

class UnknownMethodException(DBusException):
def __init__(self, method: str) -> None: ...

class NameExistsException(DBusException):
def __init__(self, name: str) -> None: ...
24 changes: 22 additions & 2 deletions stubs/dbus/proxies.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
# Stubs for dbus.proxies
from typing import Optional, Callable
import dbus

from typing import Any, Callable, Optional, Union

ObjectPath = Union[dbus.ObjectPath, str]


class ProxyObject(object):
def get_dbus_method(self, member: str=..., dbus_interface: Optional[str]=...) -> Callable: ...

bus_name = ... # type: str

def __init__(conn: dbus.Bus=..., bus_name: str=...,
object_path: ObjectPath=..., follow_name_owner_changes: bool=..., introspect: bool=..., **kwargs) -> None:
...

def get_dbus_method(self, member: str=..., dbus_interface: Optional[str]=...): ...

def connect_to_signal(self, signal_name: str=...,
handler_function: Any=...,
dbus_interface: Optional[str]=..., **keywords) -> None:
...

def Introspect(self) -> dbus.String:
...

# vim: ft=python tw=0 syntax=python
6 changes: 6 additions & 0 deletions stubs/dbus/service.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ from typing import Any, Optional, Tuple, Union


class Object(dbus.Interface):

def __init__(self, conn: Optional[Union[BusName,Connection]] = ...,
object_path: Optional[str] = ...,
bus_name: Optional[BusName] = ...) -> None: ...

@property
def _object_path(self) -> str: ...

def remove_from_connection(self, connection: Connection = None, path: str = None) -> None: ...

def method(
dbus_interface: str=...,
in_signature: Optional[str]=...,
Expand Down
2 changes: 2 additions & 0 deletions stubs/gi/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

def require_version(namespace:str, version:str) -> None: ...

0 comments on commit 4c3fc37

Please sign in to comment.