Gentoo Archives: gentoo-commits

From: Devan Franchini <twitch153@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/webapp-config:experimental commit in: WebappConfig/
Date: Tue, 23 Sep 2014 17:09:13
Message-Id: 1411489530.a05f1ed3659699ac75d5c489049babe4b8e3fef0.twitch153@gentoo
1 commit: a05f1ed3659699ac75d5c489049babe4b8e3fef0
2 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 23 16:25:30 2014 +0000
4 Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 23 16:25:30 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=a05f1ed3
7
8 {config, debug}.py: Removes deprecated use of __dict__ invocation
9
10 ---
11 WebappConfig/config.py | 36 ++++++++++++++++++------------------
12 WebappConfig/debug.py | 38 +++++++++++++++++++-------------------
13 2 files changed, 37 insertions(+), 37 deletions(-)
14
15 diff --git a/WebappConfig/config.py b/WebappConfig/config.py
16 index 597dc18..5a04fb5 100644
17 --- a/WebappConfig/config.py
18 +++ b/WebappConfig/config.py
19 @@ -846,18 +846,18 @@ class Config:
20 # Handle -E
21 envmap = []
22
23 - if ('envall' in options.__dict__ and
24 - options.__dict__['envall']):
25 + if ('envall' in options and
26 + options['envall']):
27 envmap = 'all'
28
29 - elif ('envvar' in options.__dict__ and
30 - options.__dict__['envvar']):
31 - envmap = [x.lower() for x in options.__dict__['envvar']]
32 + elif ('envvar' in options and
33 + options['envvar']):
34 + envmap = [x.lower() for x in options['envvar']]
35
36 OUT.debug('Trying to import environment variables', 7)
37
38 if envmap:
39 - for (key, value) in list(os.environ.items()):
40 + for (key, value) in os.environ.items():
41
42 if envmap == 'all' or key.lower() in envmap:
43
44 @@ -867,16 +867,16 @@ class Config:
45 key.lower(),
46 value)
47
48 - if ('define' in options.__dict__ and
49 - options.__dict__['define']):
50 - for i in options.__dict__['define']:
51 + if ('define' in options and
52 + options['define']):
53 + for i in options['define']:
54 if '=' in i:
55 self.config.set('USER',
56 i.split('=')[0].lower(),
57 i.split('=')[1])
58
59 # Indicate that --dir was found
60 - if 'dir' in options.__dict__:
61 + if 'dir' in options:
62 self.flag_dir = True
63
64 # Map command line options into the configuration
65 @@ -894,14 +894,14 @@ class Config:
66 'verbose' : 'g_verbose',
67 'bug_report' : 'g_bugreport'}
68
69 - for i in list(option_to_config.keys()):
70 - if i in options.__dict__ and options.__dict__[i]:
71 + for i in option_to_config.keys():
72 + if i in options and options[i]:
73 self.config.set('USER', option_to_config[i],
74 - str(options.__dict__[i]))
75 + str(options[i]))
76
77 # handle verbosity
78 - if ('pretend' in options.__dict__
79 - and options.__dict__['pretend']):
80 + if ('pretend' in options
81 + and options['pretend']):
82
83 self.config.set('USER', 'g_verbose', 'True')
84
85 @@ -944,12 +944,12 @@ class Config:
86 'show_postupgrade', 'check_config', 'query']
87
88 for i in work:
89 - if options.__dict__.get(i):
90 + if options.get(i):
91 self.work = i
92 break
93
94 - if options.__dict__.get('prune_database'):
95 - self.prune_action = options.__dict__.get('prune_database')
96 + if options.get('prune_database'):
97 + self.prune_action = options.get('prune_database')
98
99 OUT.debug('Checking command line arguments', 1)
100
101
102 diff --git a/WebappConfig/debug.py b/WebappConfig/debug.py
103 index 1e6bd2c..3ced649 100644
104 --- a/WebappConfig/debug.py
105 +++ b/WebappConfig/debug.py
106 @@ -169,37 +169,37 @@ class Message:
107
108 def cli_handle(self, options):
109
110 - if ('debug' in options.__dict__
111 - and options.__dict__['debug']):
112 + if ('debug' in options
113 + and options['debug']):
114 self.debug_on()
115 else:
116 self.debug_off()
117 return
118
119 - if ('debug_class_vars' in options.__dict__
120 - and options.__dict__['debug_class_vars']):
121 + if ('debug_class_vars' in options
122 + and options['debug_class_vars']):
123 self.class_variables_on()
124 else:
125 self.class_variables_off()
126
127 - if ('debug_nocolor' in options.__dict__
128 - and options.__dict__['debug_nocolor']):
129 + if ('debug_nocolor' in options
130 + and options['debug_nocolor']):
131 self.color_off()
132 else:
133 self.color_on()
134
135 - if ('debug_level' in options.__dict__ and
136 - options.__dict__['debug_level']):
137 - dbglvl = int(options.__dict__['debug_level'])
138 + if ('debug_level' in options and
139 + options['debug_level']):
140 + dbglvl = int(options['debug_level'])
141 if dbglvl < 0:
142 dbglvl = 0
143 if dbglvl > 10:
144 dbglvl = 10
145 self.set_debug_level(dbglvl)
146
147 - if ('debug_verbose' in options.__dict__ and
148 - options.__dict__['debug_verbose']):
149 - dbgvrb = int(options.__dict__['debug_verbose'])
150 + if ('debug_verbose' in options and
151 + options['debug_verbose']):
152 + dbgvrb = int(options['debug_verbose'])
153 if dbgvrb < 1:
154 dbgvrb = 1
155 if dbgvrb > 3:
156 @@ -210,9 +210,9 @@ class Message:
157 ('debug_classes', self.set_debug_classes),
158 ('debug_variables', self.set_debug_variables),]:
159
160 - if (i[0] in options.__dict__ and
161 - options.__dict__[i[0]]):
162 - i[1](options.__dict__[i[0]])
163 + if (i[0] in options and
164 + options[i[0]]):
165 + i[1](options[i[0]])
166
167
168 #############################################################################
169 @@ -395,7 +395,7 @@ class Message:
170 callerlocals = inspect.getargvalues(caller[0])[3]
171
172 ## Is the caller an obejct? If so he provides 'self'
173 - if 'self' in list(callerlocals.keys()):
174 + if 'self' in callerlocals.keys():
175 callerobject = callerlocals['self']
176 del callerlocals['self']
177 if self.show_class_variables:
178 @@ -407,7 +407,7 @@ class Message:
179
180 # Remove variables not requested
181 if not '*' in self.debug_var:
182 - callerlocals = dict([i for i in list(callerlocals.items())
183 + callerlocals = dict([i for i in callerlocals.items()
184 if i[0] in self.debug_var])
185
186 ## Is the object among the list of objects to debug?
187 @@ -445,7 +445,7 @@ class Message:
188 print('// ' + c, file=self.debug_out)
189 # Selected variables follow
190 if callerlocals:
191 - for i,j in list(callerlocals.items()):
192 + for i,j in callerlocals.items():
193 print('// ' \
194 + self.maybe_color('turquoise', str(i)) + ':' + str(j), file=self.debug_out)
195 # Finally the message
196 @@ -480,7 +480,7 @@ class Message:
197 if self.debug_vrb == 3:
198 print(ls + '//', file=self.debug_out)
199 print(ls + '// VALUES ', file=self.debug_out)
200 - for i,j in list(callerlocals.items()):
201 + for i,j in callerlocals.items():
202 print(ls + '// ------------------> ' \
203 + self.maybe_color('turquoise', str(i)) + ':', file=self.debug_out)
204 breaklines(str(j))