Use the print function everywhere
python modernize.py --no-six -f libmodernize.fixes.fix_print -w With manual fixes as the import was put always on top.
This commit is contained in:
parent
d22656308a
commit
74a4ef6723
73 changed files with 499 additions and 442 deletions
|
|
@ -17,6 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from weboob.capabilities.housing import CapHousing, Query
|
||||
from weboob.tools.application.repl import ReplApplication, defaultcount
|
||||
|
|
@ -104,7 +105,7 @@ class Flatboob(ReplApplication):
|
|||
query.cities = []
|
||||
while pattern:
|
||||
if len(query.cities) > 0:
|
||||
print '\n%sSelected cities:%s %s' % (self.BOLD, self.NC, ', '.join([c.name for c in query.cities]))
|
||||
print('\n%sSelected cities:%s %s' % (self.BOLD, self.NC, ', '.join([c.name for c in query.cities])))
|
||||
pattern = self.ask('Enter a city pattern (or empty to stop)', default='')
|
||||
if not pattern:
|
||||
break
|
||||
|
|
@ -114,7 +115,7 @@ class Flatboob(ReplApplication):
|
|||
cities.append(city)
|
||||
|
||||
if len(cities) == 0:
|
||||
print ' Not found!'
|
||||
print(' Not found!')
|
||||
continue
|
||||
if len(cities) == 1:
|
||||
if city in query.cities:
|
||||
|
|
@ -126,7 +127,7 @@ class Flatboob(ReplApplication):
|
|||
r = 'notempty'
|
||||
while r != '':
|
||||
for i, city in enumerate(cities):
|
||||
print ' %s%2d)%s [%s] %s' % (self.BOLD, i+1, self.NC, 'x' if city in query.cities else ' ', city.name)
|
||||
print(' %s%2d)%s [%s] %s' % (self.BOLD, i+1, self.NC, 'x' if city in query.cities else ' ', city.name))
|
||||
r = self.ask(' Select cities (or empty to stop)', regexp='(\d+|)', default='')
|
||||
if not r.isdigit():
|
||||
continue
|
||||
|
|
@ -142,10 +143,10 @@ class Flatboob(ReplApplication):
|
|||
r = 'notempty'
|
||||
while r != '':
|
||||
for good in Query.HOUSE_TYPES.values:
|
||||
print ' %s%2d)%s [%s] %s' % (self.BOLD,
|
||||
print(' %s%2d)%s [%s] %s' % (self.BOLD,
|
||||
Query.HOUSE_TYPES.index[good] + 1,
|
||||
self.NC,
|
||||
'x' if good in query.house_types else ' ', good)
|
||||
'x' if good in query.house_types else ' ', good))
|
||||
r = self.ask(' Select type of house (or empty to stop)', regexp='(\d+|)', default='')
|
||||
if not r.isdigit():
|
||||
continue
|
||||
|
|
@ -160,14 +161,14 @@ class Flatboob(ReplApplication):
|
|||
|
||||
_type = None
|
||||
while _type not in [query.TYPE_RENT, query.TYPE_SALE]:
|
||||
print ' %s%2d)%s %s' % (self.BOLD,
|
||||
print(' %s%2d)%s %s' % (self.BOLD,
|
||||
query.TYPE_RENT,
|
||||
self.NC,
|
||||
"Rent")
|
||||
print ' %s%2d)%s %s' % (self.BOLD,
|
||||
"Rent"))
|
||||
print(' %s%2d)%s %s' % (self.BOLD,
|
||||
query.TYPE_SALE,
|
||||
self.NC,
|
||||
"Sale")
|
||||
"Sale"))
|
||||
_type = self.ask_int('Type of query')
|
||||
|
||||
query.type = _type
|
||||
|
|
@ -207,20 +208,20 @@ class Flatboob(ReplApplication):
|
|||
"""
|
||||
queries = self.config.get('queries')
|
||||
if not queries:
|
||||
print >>self.stderr, 'There is no saved queries'
|
||||
print('There is no saved queries', file=self.stderr)
|
||||
return 2
|
||||
|
||||
if not query_name:
|
||||
for name in queries.keys():
|
||||
print ' %s* %s %s' % (self.BOLD,
|
||||
print(' %s* %s %s' % (self.BOLD,
|
||||
self.NC,
|
||||
name)
|
||||
name))
|
||||
query_name = self.ask('Which one')
|
||||
|
||||
if query_name in queries:
|
||||
self.complete_search(queries.get(query_name))
|
||||
else:
|
||||
print >>self.stderr, 'Unknown query'
|
||||
print('Unknown query', file=self.stderr)
|
||||
return 2
|
||||
|
||||
def complete_info(self, text, line, *ignored):
|
||||
|
|
@ -235,12 +236,12 @@ class Flatboob(ReplApplication):
|
|||
Get information about a housing.
|
||||
"""
|
||||
if not _id:
|
||||
print >>self.stderr, 'This command takes an argument: %s' % self.get_command_help('info', short=True)
|
||||
print('This command takes an argument: %s' % self.get_command_help('info', short=True), file=self.stderr)
|
||||
return 2
|
||||
|
||||
housing = self.get_object(_id, 'get_housing')
|
||||
if not housing:
|
||||
print >>self.stderr, 'Housing not found: %s' % _id
|
||||
print('Housing not found: %s' % _id, file=self.stderr)
|
||||
return 3
|
||||
|
||||
self.start_format()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue