# Path: dbusmock/mockobject.py
# MOCK_IFACE = 'org.freedesktop.DBus.Mock'


import re
import dbus
from dbusmock import MOCK_IFACE
def ReleaseProximity(self, sender):
    unregister_owner(self.proximity_owners, sender)


@dbus.service.method(MAIN_IFACE, sender_keyword='sender')
def ClaimCompass(self, sender):
    register_owner(self, self.compass_owners, sender)


@dbus.service.method(MAIN_IFACE, sender_keyword='sender')
def ReleaseCompass(self, sender):
    unregister_owner(self.compass_owners, sender)


def sensor_to_attribute(sensor):
    if sensor == 'light':
        return 'ambient_light'
    return sensor


def is_valid_sensor_for_interface(sensor, interface):
    if interface == 'net.hadess.SensorProxy':
        return sensor in ['accelerometer', 'ambient_light', 'proximity']

    if interface == 'net.hadess.SensorProxy.Compass':
        return sensor == 'compass'

    return False



# Path: dbusmock/mockobject.py
# MOCK_IFACE = 'org.freedesktop.DBus.Mock'


# Path: dbusmock/templates/iio-sensors-proxy.py
import re
import dbus
from dbusmock import MOCK_IFACE

def ReleaseProximity(self, sender):
    unregister_owner(self.proximity_owners, sender)


@dbus.service.method(MAIN_IFACE, sender_keyword='sender')
def ClaimCompass(self, sender):
    register_owner(self, self.compass_owners, sender)


@dbus.service.method(MAIN_IFACE, sender_keyword='sender')
def ReleaseCompass(self, sender):
    unregister_owner(self.compass_owners, sender)


def sensor_to_attribute(sensor):
    if sensor == 'light':
        return 'ambient_light'
    return sensor


def is_valid_sensor_for_interface(sensor, interface):
    if interface == 'net.hadess.SensorProxy':
        return sensor in ['accelerometer', 'ambient_light', 'proximity']

    if interface == 'net.hadess.SensorProxy.Compass':
        return sensor == 'compass'

    return False



@dbus.service.method(MOCK_IFACE, in_signature='ssv')