Commits

Nathan Durnan  committed 35d0fba

Refactor TimeStamp_dict object to be global.
No longer need additional list object.
See issue 9 @bitbucket

  • Participants
  • Parent commits 1194fa0
  • Branches development

Comments (0)

Files changed (1)

File TimestampMod.py

 #------------------------------------------------------------------------------
 import os	#required for filesystem access methods.
 import time	#required for time functions.
-
 #_ end of imported modules_____________________________________________________
 
+#==============================================================================
+# Global Objects
+#------------------------------------------------------------------------------
+TimeStamp_dict = dict()
+#_ end of global objects ______________________________________________________
 
 #==============================================================================
 # timestamp_mod 
 	#====================
 	# Initialize data objects.
 	#--------------------
-	TimeStamp_dict = dict()
-	TimeStamp_list = list()
-	#NOTE: keep list as duplicate of dict.keys so items can be safely deleted from dictionary later.
+	TimeStamp_dict.clear()
 	
 	#====================
 	#Retrieve Repository file list contents.
 			ui.debug('    (skipped):  ' + s_fileName + '\n')
 		else:
 			TimeStamp_dict[s_fileName] = -1	#initialize dictionary entry
-			TimeStamp_list.append(s_fileName)	#create list entry
 			ui.debug('Tracking:  ' + s_fileName + '\n')
 		#end of check for internal files.
 	#end of loop through repo files.
 		#no options, just display data in output status
 		#--------------------
 		ui.note('______\nDisplaying timestamps...\n------\n')
-		for s_fileName in TimeStamp_list:
-			#retrieve recorded time and make sure it is a floating point datatype
-			f_fileModTime = float(TimeStamp_dict[s_fileName])
+		for s_fileName, f_fileModTime in TimeStamp_dict.items():
 			#check for valid timestamp
 			if (f_fileModTime>0):
 				#valid timestamp detected!