Package: python-progressbar / 2.3-4

10_python3.3_compat.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From 548a9e1e94498e0a42826cf6ed21239f1b8aeb17 Mon Sep 17 00:00:00 2001
From: Nilton Volpato <Nilton Volpato>
Date: Thu, 8 Oct 2015 12:42:57 -0700
Subject: Remove format as a slot attribute, as that is not compatible with
 python 3.3

Origin: upstream
Bug: https://code.google.com/p/python-progressbar/issues/detail?id=23
Applied-Upstream: https://code.google.com/p/python-progressbar/source/detail?spec=svn3c94a3a1ebe1325c7c605cc8f11126dcc632b04d&r=3c94a3a1ebe1325c7c605cc8f11126dcc632b04d
Last-Update: 2013-10-22
Patch-Name: 10_python3.3_compat.patch
---
 progressbar/widgets.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/progressbar/widgets.py b/progressbar/widgets.py
index f5ecf61..a765bde 100644
--- a/progressbar/widgets.py
+++ b/progressbar/widgets.py
@@ -81,11 +81,11 @@ class WidgetHFill(Widget):
 class Timer(Widget):
     'Widget which displays the elapsed seconds.'
 
-    __slots__ = ('format',)
+    __slots__ = ('format_string',)
     TIME_SENSITIVE = True
 
     def __init__(self, format='Elapsed Time: %s'):
-        self.format = format
+        self.format_string = format
 
     @staticmethod
     def format_time(seconds):
@@ -97,7 +97,7 @@ class Timer(Widget):
     def update(self, pbar):
         'Updates the widget to show the elapsed time.'
 
-        return self.format % self.format_time(pbar.seconds_elapsed)
+        return self.format_string % self.format_time(pbar.seconds_elapsed)
 
 
 class ETA(Timer):
@@ -121,9 +121,9 @@ class ETA(Timer):
 class FileTransferSpeed(Widget):
     'Widget for showing the transfer speed (useful for file transfers).'
 
-    format = '%6.2f %s%s/s'
-    prefixes = ' kMGTPEZY'
-    __slots__ = ('unit', 'format')
+    FORMAT = '%6.2f %s%s/s'
+    PREFIXES = ' kMGTPEZY'
+    __slots__ = ('unit',)
 
     def __init__(self, unit='B'):
         self.unit = unit
@@ -138,7 +138,7 @@ class FileTransferSpeed(Widget):
             power = int(math.log(speed, 1000))
             scaled = speed / 1000.**power
 
-        return self.format % (scaled, self.prefixes[power], self.unit)
+        return self.FORMAT % (scaled, self.PREFIXES[power], self.unit)
 
 
 class AnimatedMarker(Widget):
@@ -168,13 +168,13 @@ RotatingMarker = AnimatedMarker
 class Counter(Widget):
     'Displays the current count'
 
-    __slots__ = ('format',)
+    __slots__ = ('format_string',)
 
     def __init__(self, format='%d'):
-        self.format = format
+        self.format_string = format
 
     def update(self, pbar):
-        return self.format % pbar.currval
+        return self.format_string % pbar.currval
 
 
 class Percentage(Widget):
@@ -197,9 +197,9 @@ class FormatLabel(Timer):
         'value': ('currval', None)
     }
 
-    __slots__ = ('format',)
+    __slots__ = ('format_string',)
     def __init__(self, format):
-        self.format = format
+        self.format_string = format
 
     def update(self, pbar):
         context = {}
@@ -213,7 +213,7 @@ class FormatLabel(Timer):
                    context[name] = transform(value)
             except: pass
 
-        return self.format % context
+        return self.format_string % context
 
 
 class SimpleProgress(Widget):