Browse Source

performed some coding style adjustments

Helmut Pozimski 10 years ago
parent
commit
dca48e5aae
2 changed files with 12 additions and 9 deletions
  1. 9 7
      stdd
  2. 3 2
      stddlib/configuration.py

+ 9 - 7
stdd

@@ -39,10 +39,9 @@ parser.add_option("-c", "--config", dest="config", help="define an\
 	alternative path to the configuration file")
 (options, arguments) = parser.parse_args()
 
-
-
 """ define a sighandler to properly catch signals """
 
+
 def sighandler(signum, frame):
 	if signum == 2:
 		logger.info("received SIGINT, stopping daemon")
@@ -57,9 +56,9 @@ def sighandler(signum, frame):
 			sys.exit(0)
 		else:
 			logger.error("stopping daemon failed, PID file was not deleted!")
-			sys,exit(1)
+			sys.exit(1)
 	sys.exit(0)
-	
+
 """ create the configuration object according to the given parameters and
 read the file itself
 
@@ -94,7 +93,8 @@ elif config.syslog_facility == "daemon":
 		facility=logging.handlers.SysLogHandler.LOG_DAEMON)
 console_handler = logging.StreamHandler()
 
-formatter = logging.Formatter("%(name)s[" +str(os.getpid()) +  "]: %(message)s")
+formatter = logging.Formatter("%(name)s[" + str(os.getpid()) +
+		"]: %(message)s")
 
 syslog_handler.setFormatter(formatter)
 console_handler.setFormatter(formatter)
@@ -118,7 +118,7 @@ if options.daemon is True:
 	daemon.SetName("stdd", cmdline)
 	if options.user is not None and options.group is not None:
 		""" To determine the user and group id, use the passwd
-		 and group files
+		and group files
 
 		"""
 		passwd = open("/etc/passwd", "r")
@@ -151,6 +151,8 @@ else:
 	display.setBrightness(config.brightness_low)
 
 """Define the main loop"""
+
+
 def main():
 	while True:
 		date_now = datetime.datetime.now()
@@ -159,7 +161,7 @@ def main():
 		hour = date_now.hour
 		if config.blink_colon is True:
 			logger.debug("blinking middle colon")
-			display.setColon(date_now.second %2)
+			display.setColon(date_now.second % 2)
 		else:
 			display.setColon(True)
 		"""set the display brightness high or low when the point in time defined

+ 3 - 2
stddlib/configuration.py

@@ -6,6 +6,7 @@
 
 import datetime
 
+
 class Conf(object):
 	def __init__(self):
 		"""creates the object prepopulated with some reasonable default values"""
@@ -43,13 +44,13 @@ class Conf(object):
 					self.__tmpvalue = self.__line_stripped.split("=")
 					self.__values[self.__tmpvalue[0].lower()] = self.__tmpvalue[1]
 		self.__conffile.close()
-	
+
 	def Analyze(self):
 		"""takes the values from the list, converts them to the needed data types
 		and writes them into the prepared attributes
 
 		"""
-		self.hw_address = int(self.__values["hw_address"],16)
+		self.hw_address = int(self.__values["hw_address"], 16)
 		if self.__values["blink_colon"] == "1":
 			self.blink_colon = True
 		else: