1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-22 03:04:09 -04:00

flake8 - up to m.

This commit is contained in:
Shlomi Fish 2017-04-17 00:03:24 +03:00
parent 9cc258de85
commit 70982a1355
6 changed files with 187 additions and 131 deletions

View file

@ -25,3 +25,6 @@ import memory
import pegged import pegged
import poker import poker
import tarock import tarock
def no_use():
pass

View file

@ -1,41 +1,44 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*- # -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
## #
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh # Copyright (C) 2005-2009 Skomoroh
## #
## This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version. # (at your option) any later version.
## #
## This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details. # GNU General Public License for more details.
## #
## You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
## #
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
# imports # imports
import sys, os import os
import sys
import traceback import traceback
import getopt import getopt
# PySol imports # PySol imports
from pysollib.mygettext import _, n_ from pysollib.mygettext import _
from pysollib.util import DataLoader from pysollib.util import DataLoader
from pysollib.mfxutil import print_err from pysollib.mfxutil import print_err
from pysollib.resource import Tile from pysollib.resource import Tile
from pysollib.app import Application from pysollib.app import Application
from pysollib.gamedb import GAME_DB from pysollib.gamedb import GAME_DB
from pysollib.pysolaudio import AbstractAudioClient, PysolSoundServerModuleClient from pysollib.pysolaudio import AbstractAudioClient, \
from pysollib.pysolaudio import Win32AudioClient, OSSAudioClient, PyGameAudioClient PysolSoundServerModuleClient
from pysollib.pysolaudio import Win32AudioClient, OSSAudioClient, \
PyGameAudioClient
from pysollib.settings import TITLE, SOUND_MOD from pysollib.settings import TITLE, SOUND_MOD
from pysollib.winsystems import init_root_window from pysollib.winsystems import init_root_window
@ -52,7 +55,7 @@ from pysollib.pysoltk import PysolProgressBar
def fatal_no_cardsets(app): def fatal_no_cardsets(app):
app.wm_withdraw() app.wm_withdraw()
d = MfxMessageDialog(app.top, title=_("%s installation error") % TITLE, MfxMessageDialog(app.top, title=_("%s installation error") % TITLE,
text=_('''No cardsets were found !!! text=_('''No cardsets were found !!!
Main data directory is: Main data directory is:
@ -77,7 +80,7 @@ def parse_option(argv):
"nosound", "nosound",
"sound-mod=", "sound-mod=",
"help"]) "help"])
except getopt.GetoptError, err: except getopt.GetoptError as err:
print_err(_("%s\ntry %s --help for more information") % print_err(_("%s\ntry %s --help for more information") %
(err, prog_name), 0) (err, prog_name), 0)
return None return None
@ -107,7 +110,7 @@ def parse_option(argv):
opts["sound-mod"] = i[1] opts["sound-mod"] = i[1]
if opts["help"]: if opts["help"]:
print _("""Usage: %s [OPTIONS] [FILE] print(_("""Usage: %s [OPTIONS] [FILE]
-g --game=GAMENAME start game GAMENAME -g --game=GAMENAME start game GAMENAME
-i --gameid=GAMEID -i --gameid=GAMEID
--french-only --french-only
@ -118,7 +121,7 @@ def parse_option(argv):
FILE - file name of a saved game FILE - file name of a saved game
MOD - one of following: pss(default), pygame, oss, win MOD - one of following: pss(default), pygame, oss, win
""") % prog_name """) % prog_name)
return None return None
if len(args) > 1: if len(args) > 1:
@ -138,6 +141,7 @@ def parse_option(argv):
# * # *
# ************************************************************************ # ************************************************************************
def pysol_init(app, args): def pysol_init(app, args):
# init commandline options (undocumented) # init commandline options (undocumented)
@ -160,7 +164,7 @@ def pysol_init(app, args):
app.dn.config, app.dn.config,
app.dn.savegames, app.dn.savegames,
os.path.join(app.dn.config, "music"), os.path.join(app.dn.config, "music"),
##os.path.join(app.dn.config, "screenshots"), # os.path.join(app.dn.config, "screenshots"),
os.path.join(app.dn.config, "tiles"), os.path.join(app.dn.config, "tiles"),
os.path.join(app.dn.config, "tiles", "stretch"), os.path.join(app.dn.config, "tiles", "stretch"),
os.path.join(app.dn.config, "tiles", "save-aspect"), os.path.join(app.dn.config, "tiles", "save-aspect"),
@ -168,7 +172,8 @@ def pysol_init(app, args):
os.path.join(app.dn.config, "plugins"), os.path.join(app.dn.config, "plugins"),
): ):
if not os.path.exists(d): if not os.path.exists(d):
try: os.makedirs(d) try:
os.makedirs(d)
except: except:
traceback.print_exc() traceback.print_exc()
pass pass
@ -218,6 +223,7 @@ def pysol_init(app, args):
import pysollib.games.ultra import pysollib.games.ultra
import pysollib.games.mahjongg import pysollib.games.mahjongg
import pysollib.games.special import pysollib.games.special
pysollib.games.special.no_use()
# try to load plugins # try to load plugins
if not opts["noplugins"]: if not opts["noplugins"]:
@ -305,7 +311,7 @@ Please check your %s installation.
tile.filename = None tile.filename = None
manager.register(tile) manager.register(tile)
app.initTiles() app.initTiles()
if app.opt.tabletile_name: ### and top.winfo_screendepth() > 8: if app.opt.tabletile_name: # and top.winfo_screendepth() > 8:
for tile in manager.getAll(): for tile in manager.getAll():
if app.opt.tabletile_name == tile.basename: if app.opt.tabletile_name == tile.basename:
app.tabletile_index = tile.index app.tabletile_index = tile.index

View file

@ -1,31 +1,47 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*- # -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
## #
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh # Copyright (C) 2005-2009 Skomoroh
## #
## This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version. # (at your option) any later version.
## #
## This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details. # GNU General Public License for more details.
## #
## You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
## #
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
__all__ = [
'BmpImagePlugin',
'GifImagePlugin',
'Image',
'ImageOps',
'ImageTk',
'JpegImagePlugin',
'PngImagePlugin',
'PpmImagePlugin',
'UnpicklingError',
]
# imports # imports
import sys, os, time, types, locale import sys
import os
import time
import types
import locale
import webbrowser import webbrowser
try: try:
from cPickle import Pickler, Unpickler, UnpicklingError from cPickle import Pickler, Unpickler, UnpicklingError
except ImportError: except ImportError:
@ -36,7 +52,7 @@ try:
except: except:
thread = None thread = None
from pysollib.settings import PACKAGE, TOOLKIT, USE_TILE from pysollib.settings import PACKAGE, TOOLKIT
Image = ImageTk = ImageOps = None Image = ImageTk = ImageOps = None
if TOOLKIT == 'tk': if TOOLKIT == 'tk':
@ -58,6 +74,8 @@ USE_PIL = False
if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7': if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
USE_PIL = True USE_PIL = True
if sys.version_info > (3,):
unicode = str
# debug # debug
# Image = None # Image = None
# USE_PIL = False # USE_PIL = False
@ -66,6 +84,7 @@ if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
# * exceptions # * exceptions
# ************************************************************************ # ************************************************************************
class SubclassResponsibility(Exception): class SubclassResponsibility(Exception):
pass pass
@ -78,7 +97,7 @@ class SubclassResponsibility(Exception):
def latin1_to_ascii(n): def latin1_to_ascii(n):
# return n # return n
n = n.encode('iso8859-1', 'replace') n = n.encode('iso8859-1', 'replace')
## FIXME: rewrite this for better speed # FIXME: rewrite this for better speed
n = (n.replace("\xc4", "Ae") n = (n.replace("\xc4", "Ae")
.replace("\xd6", "Oe") .replace("\xd6", "Oe")
.replace("\xdc", "Ue") .replace("\xdc", "Ue")
@ -89,9 +108,11 @@ def latin1_to_ascii(n):
def format_time(t): def format_time(t):
##print 'format_time:', t # print 'format_time:', t
if t <= 0: return "0:00" if t <= 0:
if t < 3600: return "%d:%02d" % (t / 60, t % 60) return "0:00"
if t < 3600:
return "%d:%02d" % (t / 60, t % 60)
return "%d:%02d:%02d" % (t / 3600, (t % 3600) / 60, t % 60) return "%d:%02d:%02d" % (t / 3600, (t % 3600) / 60, t % 60)
@ -138,6 +159,7 @@ if os.name == "posix":
# * MSWin util # * MSWin util
# ************************************************************************ # ************************************************************************
def win32_getusername(): def win32_getusername():
user = os.environ.get('USERNAME', '').strip() user = os.environ.get('USERNAME', '').strip()
try: try:
@ -146,6 +168,7 @@ def win32_getusername():
user = '' user = ''
return user return user
def win32_getprefdir(package): def win32_getprefdir(package):
portprefdir = 'config' # portable varsion portprefdir = 'config' # portable varsion
if os.path.isdir(portprefdir): if os.path.isdir(portprefdir):
@ -171,7 +194,7 @@ def destruct(obj):
assert isinstance(obj, types.InstanceType) assert isinstance(obj, types.InstanceType)
for k in obj.__dict__.keys(): for k in obj.__dict__.keys():
obj.__dict__[k] = None obj.__dict__[k] = None
##del obj.__dict__[k] # del obj.__dict__[k]
# ************************************************************************ # ************************************************************************
@ -268,10 +291,12 @@ def pickle(obj, filename, protocol=0):
f = open(filename, "wb") f = open(filename, "wb")
p = Pickler(f, protocol) p = Pickler(f, protocol)
p.dump(obj) p.dump(obj)
f.close(); f = None f.close()
##print "Pickled", filename f = None
# print "Pickled", filename
finally: finally:
if f: f.close() if f:
f.close()
def unpickle(filename): def unpickle(filename):
@ -280,11 +305,13 @@ def unpickle(filename):
f = open(filename, "rb") f = open(filename, "rb")
p = Unpickler(f) p = Unpickler(f)
x = p.load() x = p.load()
f.close(); f = None f.close()
f = None
obj = x obj = x
##print "Unpickled", filename # print "Unpickled", filename
finally: finally:
if f: f.close() if f:
f.close()
return obj return obj
@ -300,4 +327,3 @@ def openURL(url):
except: except:
return 0 return 0
return 1 return 1

View file

@ -1,26 +1,31 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*- # -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
## #
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh # Copyright (C) 2005-2009 Skomoroh
## #
## This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version. # (at your option) any later version.
## #
## This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details. # GNU General Public License for more details.
## #
## You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
## #
##---------------------------------------------------------------------------## # ---------------------------------------------------------------------------##
import sys
if sys.version_info > (3,):
def cmp(a, b):
return ((b > a)-(a > b))
# imports # imports
@ -29,14 +34,14 @@
# * moves (undo / redo) # * moves (undo / redo)
# ************************************************************************ # ************************************************************************
## Currently we have the following atomic moves: # Currently we have the following atomic moves:
## - move the top cards from one stack on the top of another # - move the top cards from one stack on the top of another
## - flip the top card of a stack # - flip the top card of a stack
## - turn a whole stack onto another stack # - turn a whole stack onto another stack
## - update the model or complete view a stack # - update the model or complete view a stack
## - increase the round (the number of redeals) # - increase the round (the number of redeals)
## - save the seed of game.random # - save the seed of game.random
## - shuffle a stack # - shuffle a stack
class AtomicMove: class AtomicMove:
@ -45,6 +50,7 @@ class AtomicMove:
def __repr__(self): def __repr__(self):
return str(self.__dict__) return str(self.__dict__)
def __str__(self): def __str__(self):
return str(self.__dict__) return str(self.__dict__)
@ -69,7 +75,8 @@ class AMoveMove(AtomicMove):
# do the actual move # do the actual move
def _doMove(self, game, ncards, from_stack, to_stack): def _doMove(self, game, ncards, from_stack, to_stack):
if game.moves.state == game.S_PLAY: if game.moves.state == game.S_PLAY:
assert to_stack.acceptsCards(from_stack, from_stack.cards[-ncards:]) assert to_stack.acceptsCards(
from_stack, from_stack.cards[-ncards:])
frames = self.frames frames = self.frames
if frames == -2 and game.moves.state not in (game.S_UNDO, game.S_REDO): if frames == -2 and game.moves.state not in (game.S_UNDO, game.S_REDO):
# don't use animation for drag-move # don't use animation for drag-move
@ -112,7 +119,7 @@ class AFlipMove(AtomicMove):
# do the actual move # do the actual move
def _doMove(self, game, stack): def _doMove(self, game, stack):
card = stack.cards[-1] card = stack.cards[-1]
##game.animatedFlip(stack) # game.animatedFlip(stack)
if card.face_up: if card.face_up:
card.showBack() card.showBack()
else: else:
@ -127,6 +134,7 @@ class AFlipMove(AtomicMove):
def cmpForRedo(self, other): def cmpForRedo(self, other):
return cmp(self.stack_id, other.stack_id) return cmp(self.stack_id, other.stack_id)
# flip with animation # flip with animation
class ASingleFlipMove(AFlipMove): class ASingleFlipMove(AFlipMove):
def _doMove(self, game, stack): def _doMove(self, game, stack):
@ -137,6 +145,7 @@ class ASingleFlipMove(AFlipMove):
else: else:
card.showFace() card.showFace()
# flip and move one card # flip and move one card
class AFlipAndMoveMove(AtomicMove): class AFlipAndMoveMove(AtomicMove):
@ -228,15 +237,15 @@ class ATurnStackMove(AtomicMove):
assert len(to_stack.cards) == 0 assert len(to_stack.cards) == 0
l = len(from_stack.cards) l = len(from_stack.cards)
for i in range(l): for i in range(l):
##unhide = (i >= l - 2) # unhide = (i >= l - 2)
unhide = 1 unhide = 1
##print 1, unhide, from_stack.getCard().__dict__ # print 1, unhide, from_stack.getCard().__dict__
card = from_stack.removeCard(unhide=unhide, update=0) card = from_stack.removeCard(unhide=unhide, update=0)
##print 2, unhide, card.__dict__ # print 2, unhide, card.__dict__
assert card.face_up assert card.face_up
to_stack.addCard(card, unhide=unhide, update=0) to_stack.addCard(card, unhide=unhide, update=0)
card.showBack(unhide=unhide) card.showBack(unhide=unhide)
##print 3, unhide, to_stack.getCard().__dict__ # print 3, unhide, to_stack.getCard().__dict__
from_stack.updateText() from_stack.updateText()
to_stack.updateText() to_stack.updateText()
@ -247,7 +256,7 @@ class ATurnStackMove(AtomicMove):
assert len(to_stack.cards) == 0 assert len(to_stack.cards) == 0
l = len(from_stack.cards) l = len(from_stack.cards)
for i in range(l): for i in range(l):
##unhide = (i >= l - 2) # unhide = (i >= l - 2)
unhide = 1 unhide = 1
card = from_stack.removeCard(unhide=unhide, update=0) card = from_stack.removeCard(unhide=unhide, update=0)
assert not card.face_up assert not card.face_up
@ -299,7 +308,8 @@ class NEW_ATurnStackMove(AtomicMove):
to_stack = game.allstacks[self.to_stack_id] to_stack = game.allstacks[self.to_stack_id]
if self.update_flags & 1: if self.update_flags & 1:
assert to_stack is game.s.talon assert to_stack is game.s.talon
assert to_stack.round < to_stack.max_rounds or to_stack.max_rounds < 0 assert to_stack.round < to_stack.max_rounds or \
to_stack.max_rounds < 0
to_stack.round = to_stack.round + 1 to_stack.round = to_stack.round + 1
self._doMove(from_stack, to_stack, 0) self._doMove(from_stack, to_stack, 0)
@ -349,7 +359,8 @@ class AUpdateStackMove(AtomicMove):
self._doMove(game, game.allstacks[self.stack_id], 1) self._doMove(game, game.allstacks[self.stack_id], 1)
def cmpForRedo(self, other): def cmpForRedo(self, other):
return cmp(self.stack_id, other.stack_id) or cmp(self.flags, other.flags) return cmp(self.stack_id, other.stack_id) or \
cmp(self.flags, other.flags)
AUpdateStackModelMove = AUpdateStackMove AUpdateStackModelMove = AUpdateStackMove
@ -484,7 +495,8 @@ class ASingleCardMove(AtomicMove):
to_stack = game.allstacks[self.to_stack_id] to_stack = game.allstacks[self.to_stack_id]
from_pos = self.from_pos from_pos = self.from_pos
if game.moves.state == game.S_PLAY: if game.moves.state == game.S_PLAY:
assert to_stack.acceptsCards(from_stack, [from_stack.cards[from_pos]]) assert to_stack.acceptsCards(
from_stack, [from_stack.cards[from_pos]])
card = from_stack.cards[from_pos] card = from_stack.cards[from_pos]
card = from_stack.removeCard(card, update_positions=1) card = from_stack.removeCard(card, update_positions=1)
if self.frames != 0: if self.frames != 0:
@ -492,19 +504,19 @@ class ASingleCardMove(AtomicMove):
game.animatedMoveTo(from_stack, to_stack, [card], x, y, game.animatedMoveTo(from_stack, to_stack, [card], x, y,
frames=self.frames, shadow=self.shadow) frames=self.frames, shadow=self.shadow)
to_stack.addCard(card) to_stack.addCard(card)
##to_stack.refreshView() # to_stack.refreshView()
def undo(self, game): def undo(self, game):
from_stack = game.allstacks[self.from_stack_id] from_stack = game.allstacks[self.from_stack_id]
to_stack = game.allstacks[self.to_stack_id] to_stack = game.allstacks[self.to_stack_id]
from_pos = self.from_pos from_pos = self.from_pos
card = to_stack.removeCard() card = to_stack.removeCard()
## if self.frames != 0: # if self.frames != 0:
## x, y = to_stack.getPositionFor(card) # x, y = to_stack.getPositionFor(card)
## game.animatedMoveTo(from_stack, to_stack, [card], x, y, # game.animatedMoveTo(from_stack, to_stack, [card], x, y,
## frames=self.frames, shadow=self.shadow) # frames=self.frames, shadow=self.shadow)
from_stack.insertCard(card, from_pos) from_stack.insertCard(card, from_pos)
##to_stack.refreshView() # to_stack.refreshView()
def cmpForRedo(self, other): def cmpForRedo(self, other):
return cmp((self.from_stack_id, self.to_stack_id, self.from_pos), return cmp((self.from_stack_id, self.to_stack_id, self.from_pos),
@ -522,12 +534,13 @@ class AInnerMove(AtomicMove):
self.from_pos, self.to_pos = from_pos, to_pos self.from_pos, self.to_pos = from_pos, to_pos
def redo(self, game): def redo(self, game):
stack = game.allstacks[self.stack_id] # stack = game.allstacks[self.stack_id]
pass
def undo(self, game): def undo(self, game):
stack = game.allstacks[self.stack_id] # stack = game.allstacks[self.stack_id]
pass
def cmpForRedo(self, other): def cmpForRedo(self, other):
return cmp((self.stack_id, self.from_pos, self.to_pos), return cmp((self.stack_id, self.from_pos, self.to_pos),
(other.stack_id, other.from_pos, other.to_pos)) (other.stack_id, other.from_pos, other.to_pos))

View file

@ -2,10 +2,16 @@
# -*- mode: python; coding: utf-8; -*- # -*- mode: python; coding: utf-8; -*-
import gettext import gettext
import sys
if sys.version_info > (3,):
unicode = str
def n_(x): def n_(x):
return x return x
def fix_gettext(): def fix_gettext():
def ugettext(message): def ugettext(message):
# unicoded gettext # unicoded gettext
@ -19,6 +25,7 @@ def fix_gettext():
return message return message
return t.ugettext(message) return t.ugettext(message)
gettext.ugettext = ugettext gettext.ugettext = ugettext
def ungettext(msgid1, msgid2, n): def ungettext(msgid1, msgid2, n):
# unicoded ngettext # unicoded ngettext
if not isinstance(msgid1, unicode): if not isinstance(msgid1, unicode):
@ -37,5 +44,6 @@ def fix_gettext():
return t.ungettext(msgid1, msgid2, n) return t.ungettext(msgid1, msgid2, n)
gettext.ungettext = ungettext gettext.ungettext = ungettext
fix_gettext() fix_gettext()
_ = gettext.ugettext _ = gettext.ugettext

View file

@ -9,7 +9,7 @@ use Test::Differences qw( eq_or_diff );
use String::ShellQuote qw/ shell_quote /; use String::ShellQuote qw/ shell_quote /;
# my $cmd = shell_quote( 'flake8', '.' ); # my $cmd = shell_quote( 'flake8', '.' );
my $cmd = shell_quote( 'flake8', glob('./pysollib/[a-l]*.py') ); my $cmd = shell_quote( 'flake8', glob('./pysollib/[a-m]*.py') );
# TEST # TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." ); eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );