Clean some pylint errors and obsolete TODOs.

This commit is contained in:
Eratosthenes 2010-02-19 20:14:34 -05:00
parent c33575911d
commit a9ec972ba5

View File

@ -443,8 +443,8 @@ or None if we fail to get the info """
def guessMaxSeats(self, hand): def guessMaxSeats(self, hand):
"""Return a guess at maxseats when not specified in HH.""" """Return a guess at maxseats when not specified in HH."""
# if some other code prior to this has already set it, return it # if some other code prior to this has already set it, return it
if maxseats > 1 and maxseats < 11: if self.maxseats > 1 and self.maxseats < 11:
return maxseats return self.maxseats
mo = self.maxOccSeat(hand) mo = self.maxOccSeat(hand)
if mo == 10: return 10 #that was easy if mo == 10: return 10 #that was easy
@ -517,23 +517,18 @@ def get_out_fh(out_path, parameters):
if out_path == '-': if out_path == '-':
return(sys.stdout) return(sys.stdout)
elif parameters['saveStarsHH']: elif parameters['saveStarsHH']:
# TODO: out_path should be sanity checked. out_dir = os.path.dirname(out_path)
out_dir = os.path.dirname(self.out_path)
if not os.path.isdir(out_dir) and out_dir != '': if not os.path.isdir(out_dir) and out_dir != '':
try: try:
os.makedirs(out_dir) os.makedirs(out_dir)
except: # we get a WindowsError here in Windows.. pretty sure something else for Linux :D except: # we get a WindowsError here in Windows.. pretty sure something else for Linux :D
log.error("Unable to create output directory %s for HHC!" % out_dir) log.error("Unable to create output directory %s for HHC!" % out_dir)
print "*** ERROR: UNABLE TO CREATE OUTPUT DIRECTORY", out_dir print "*** ERROR: UNABLE TO CREATE OUTPUT DIRECTORY", out_dir
# TODO: pop up a box to allow person to choose output directory?
# TODO: shouldn't that be done when we startup, actually?
else: else:
log.info("Created directory '%s'" % out_dir) log.info("Created directory '%s'" % out_dir)
try: try:
return(codecs.open(self.out_path, 'w', 'utf8')) return(codecs.open(out_path, 'w', 'utf8'))
except: except:
log.error("out_path %s couldn't be opened" % (self.out_path)) log.error("out_path %s couldn't be opened" % (out_path))
else:
log.debug("out_path %s opened as %s" % (self.out_path, self.out_fh))
else: else:
return(sys.stdout) return(sys.stdout)