Browse code

* S3/Progress.py: Restructured import Utils to avoid import conflicts.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@288 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/12/13 22:00:01
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+2008-12-14  Michal Ludvig  <michal@logix.cz>
2
+
3
+	* S3/Progress.py: Restructured import Utils to avoid import
4
+	  conflicts.
5
+
1 6
 2008-12-12  Michal Ludvig  <michal@logix.cz>
2 7
 
3 8
 	* s3cmd: Better Exception output. Print sys.path on ImportError,
... ...
@@ -5,7 +5,7 @@
5 5
 
6 6
 import sys
7 7
 import datetime
8
-from Utils import formatSize
8
+import Utils
9 9
 
10 10
 class Progress(object):
11 11
 	_stdout = sys.stdout
... ...
@@ -59,11 +59,11 @@ class Progress(object):
59 59
 			return
60 60
 
61 61
 		if self.current_position == self.total_size:
62
-			print_size = formatSize(self.current_position, True)
62
+			print_size = Utils.formatSize(self.current_position, True)
63 63
 			if print_size[1] != "": print_size[1] += "B"
64 64
 			timedelta = self.time_current - self.time_start
65 65
 			sec_elapsed = timedelta.days * 86400 + timedelta.seconds + float(timedelta.microseconds)/1000000.0
66
-			print_speed = formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
66
+			print_speed = Utils.formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
67 67
 			self._stdout.write("100%%  %s%s in %.2fs (%.2f %sB/s)\n" % 
68 68
 				(print_size[0], print_size[1], sec_elapsed, print_speed[0], print_speed[1]))
69 69
 			self._stdout.flush()
... ...
@@ -100,7 +100,7 @@ class ProgressANSI(Progress):
100 100
 		timedelta = self.time_current - self.time_start
101 101
 		sec_elapsed = timedelta.days * 86400 + timedelta.seconds + float(timedelta.microseconds)/1000000.0
102 102
 		if (sec_elapsed > 0):
103
-			print_speed = formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
103
+			print_speed = Utils.formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
104 104
 		else:
105 105
 			print_speed = (0, "")
106 106
 		self._stdout.write(self.ANSI_restore_cursor_pos)
... ...
@@ -134,7 +134,7 @@ class ProgressCR(Progress):
134 134
 		timedelta = self.time_current - self.time_start
135 135
 		sec_elapsed = timedelta.days * 86400 + timedelta.seconds + float(timedelta.microseconds)/1000000.0
136 136
 		if (sec_elapsed > 0):
137
-			print_speed = formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
137
+			print_speed = Utils.formatSize((self.current_position - self.initial_position) / sec_elapsed, True, True)
138 138
 		else:
139 139
 			print_speed = (0, "")
140 140
 		self._stdout.write(self.CR_char)