Change tabs to 4 spaces in python files

This commit is contained in:
Ondrej Mikle 2017-10-22 17:27:44 +02:00
parent 5d41737f80
commit 2482462a73
6 changed files with 420 additions and 420 deletions

View file

@ -2,55 +2,55 @@ import time
import wiringpi2 as wiringpi
class Unlocker(object):
"""Abstract class/interface for Unlocker object.
Unlocker useful for simulation, but does not actually unlock any lock.
"""
def __init__(self, config):
"""
Creates unlocked instance from config, where section named after
the class is supposed to exist.
@param config: BrmdoorConfig instance
"""
self.config = config.config
self.lockOpenedSecs = config.lockOpenedSecs
self.unlockerName = type(self).__name__
def unlock(self):
"""Unlock lock for given self.lockOpenedSecs.
In this class case, it's only simulated
"""
time.sleep(self.lockOpenedSecs)
"""Abstract class/interface for Unlocker object.
Unlocker useful for simulation, but does not actually unlock any lock.
"""
def __init__(self, config):
"""
Creates unlocked instance from config, where section named after
the class is supposed to exist.
@param config: BrmdoorConfig instance
"""
self.config = config.config
self.lockOpenedSecs = config.lockOpenedSecs
self.unlockerName = type(self).__name__
def unlock(self):
"""Unlock lock for given self.lockOpenedSecs.
In this class case, it's only simulated
"""
time.sleep(self.lockOpenedSecs)
def lock(self):
"""
Lock the lock back. Meant to be used when program is shut down
so that lock is not left disengaged.
"""
pass
def lock(self):
"""
Lock the lock back. Meant to be used when program is shut down
so that lock is not left disengaged.
"""
pass
class UnlockerWiringPi(Unlocker):
"""Uses configured pings via WiringPi to open lock.
"""
"""Uses configured pings via WiringPi to open lock.
"""
def __init__(self, config):
Unlocker.__init__(self, config)
def __init__(self, config):
Unlocker.__init__(self, config)
wiringpi.wiringPiSetupGpio() # pin numbers follow P1 GPIO header
self.lockPin = self.config.getint("UnlockerWiringPi", "lock_pin")
wiringpi.pinMode(self.lockPin, 1) #output
def unlock(self):
"""Unlocks lock at configured pin by pulling it high.
"""
wiringpi.digitalWrite(self.lockPin, 1)
time.sleep(self.lockOpenedSecs)
wiringpi.digitalWrite(self.lockPin, 0)
self.lockPin = self.config.getint("UnlockerWiringPi", "lock_pin")
wiringpi.pinMode(self.lockPin, 1) #output
def unlock(self):
"""Unlocks lock at configured pin by pulling it high.
"""
wiringpi.digitalWrite(self.lockPin, 1)
time.sleep(self.lockOpenedSecs)
wiringpi.digitalWrite(self.lockPin, 0)
def lock(self):
"""
Lock the lock back. Meant to be used when program is shut down
so that lock is not left disengaged.
"""
wiringpi.digitalWrite(self.lockPin, 0)
def lock(self):
"""
Lock the lock back. Meant to be used when program is shut down
so that lock is not left disengaged.
"""
wiringpi.digitalWrite(self.lockPin, 0)