Fix some issues pychecker caught.
This commit is contained in:
parent
ff1f2a6823
commit
5ecf0c26c5
6 changed files with 31 additions and 31 deletions
|
@ -34,7 +34,6 @@
|
|||
# !!! ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING !!!
|
||||
|
||||
import sys
|
||||
import os
|
||||
import getopt
|
||||
|
||||
def printUsage():
|
||||
|
|
|
@ -116,7 +116,7 @@ class wikiSide:
|
|||
self.updated_description = self.updated_description.replace('\n',self.ai[self.getCurrentAiNumber()].full_description + '\n',1)
|
||||
updateDescription(self.ai[0],sides)
|
||||
else:
|
||||
if self.scouts_setting == False:
|
||||
if not self.scouts_setting:
|
||||
space = re.compile('^( |\t)*').search(self.full_description).group()
|
||||
indent = getIndent(self.full_description,self.side)
|
||||
side_scout_text = AI_SCOUTS_TEXT.replace('\t',indent)
|
||||
|
@ -219,7 +219,7 @@ def parseAll (resourcesFile,dirName, fileList):
|
|||
basename_out = basename_out + suffix + ext_out
|
||||
f = file(basename_out,'w')
|
||||
f.write(updated_file)
|
||||
f.close
|
||||
f.close()
|
||||
|
||||
def printUsage():
|
||||
print "scoutDefault.py [-hRO] [-d directory] [-f file] [-x extension]"
|
||||
|
|
|
@ -292,7 +292,7 @@ class SVN:
|
|||
# If a directory exists in both, it needs to be scanned recursively.
|
||||
|
||||
for dir in src_dirs:
|
||||
if(os.path.isdir(dest + "/" + dir) == False):
|
||||
if not os.path.isdir(dest + "/" + dir):
|
||||
# src only
|
||||
self.__dir_add(src + "/" + dir, dest + "/" + dir, src_svn, exclude)
|
||||
else:
|
||||
|
@ -300,7 +300,7 @@ class SVN:
|
|||
self.__sync_dir(src + "/" + dir, dest + "/" + dir, src_svn, exclude)
|
||||
|
||||
for dir in dest_dirs:
|
||||
if(os.path.isdir(src + "/" + dir) == False):
|
||||
if not os.path.isdir(src + "/" + dir):
|
||||
# dest only
|
||||
self.__dir_remove(dest + "/" + dir, not(src_svn))
|
||||
|
||||
|
@ -312,7 +312,7 @@ class SVN:
|
|||
# If a file exists in both it needs to be copied.
|
||||
|
||||
for file in src_files:
|
||||
if(os.path.isfile(dest + "/" + file) == False):
|
||||
if not os.path.isfile(dest + "/" + file):
|
||||
# src only
|
||||
self.__file_add(src + "/" + file, dest + "/" + file, src_svn)
|
||||
else:
|
||||
|
@ -320,7 +320,7 @@ class SVN:
|
|||
self.__file_copy(src + "/" + file, dest + "/" + file)
|
||||
|
||||
for file in dest_files:
|
||||
if(os.path.isfile(src + "/" + file) == False):
|
||||
if not os.path.isfile(src + "/" + file):
|
||||
# dest only
|
||||
self.__file_remove(dest + "/" + file, not(src_svn))
|
||||
|
||||
|
@ -377,7 +377,7 @@ class SVN:
|
|||
|
||||
# add parent
|
||||
os.mkdir(dest)
|
||||
if(src_svn == False):
|
||||
if not src_svn:
|
||||
self.__svn_add(dest)
|
||||
|
||||
# get sub items
|
||||
|
@ -403,7 +403,7 @@ class SVN:
|
|||
|
||||
# Svn takes care of the cleaning up itself so only
|
||||
# need to remove the directory.
|
||||
if(is_svn):
|
||||
if is_svn:
|
||||
self.__svn_remove(dir)
|
||||
else:
|
||||
shutil.rmtree(dir)
|
||||
|
@ -424,7 +424,7 @@ class SVN:
|
|||
|
||||
shutil.copy(src, dest)
|
||||
|
||||
if(src_svn == False):
|
||||
if not src_svn:
|
||||
self.__svn_add(dest)
|
||||
|
||||
"""Copies a file.
|
||||
|
@ -449,7 +449,7 @@ class SVN:
|
|||
|
||||
logging.debug("__file_remove file = '%s' is_svn = '%s'", file, is_svn)
|
||||
|
||||
if(is_svn):
|
||||
if is_svn:
|
||||
self.__svn_remove(file)
|
||||
else:
|
||||
os.remove(file)
|
||||
|
|
|
@ -415,8 +415,7 @@ class DataSub(Data):
|
|||
self.insert(sub)
|
||||
return sub
|
||||
|
||||
def get_or_create_sub_with_attributes(*args, **kw):
|
||||
self, name = args
|
||||
def get_or_create_sub_with_attributes(self, name, **kw):
|
||||
"""For the uber lazy. Example:
|
||||
|
||||
event = scenario.get_or_create_sub_with_attribute("event", name = "prestart")
|
||||
|
|
|
@ -483,8 +483,9 @@ class Parser:
|
|||
rep = self.gettext(self.textdomain, rep[q + 1:qe])
|
||||
rep = '"' + rep + '"'
|
||||
if self.verbose:
|
||||
s = "Replacing {%s} with %s\n" % (macro.params[i], rep)
|
||||
#s = "Replacing {%s} with %s\n" % (macro.params[i], rep)
|
||||
##sys.stderr.write(s.encode("utf8"))
|
||||
pass
|
||||
text = text.replace("{%s}" % macro.params[i], rep)
|
||||
|
||||
if text:
|
||||
|
@ -530,7 +531,7 @@ class Parser:
|
|||
value = ""
|
||||
got_assign = False
|
||||
spaces = ""
|
||||
file = "(None)"
|
||||
filename = "(None)"
|
||||
line = -1
|
||||
while 1:
|
||||
if c == "{":
|
||||
|
@ -553,7 +554,7 @@ class Parser:
|
|||
variables += [variable.rstrip()]
|
||||
got_assign = True
|
||||
translatable = False
|
||||
file = self.filename
|
||||
filename = self.filename
|
||||
line = self.line
|
||||
self.skip_whitespace()
|
||||
else:
|
||||
|
@ -612,7 +613,7 @@ class Parser:
|
|||
for i in range(len(variables)):
|
||||
try:
|
||||
key = wmldata.DataText(variables[i], values[i], translatable)
|
||||
key.set_meta(file, line)
|
||||
key.set_meta(filename, line)
|
||||
data.append(key)
|
||||
except IndexError:
|
||||
raise Error(self, "Assignement does not match: %s = %s" % (
|
||||
|
@ -734,10 +735,11 @@ class Parser:
|
|||
self.textdomain = self.read_until("\n").strip()
|
||||
else: # comment
|
||||
line = self.read_until("\n")
|
||||
comment = c + line
|
||||
#comment = c + line
|
||||
if self.verbose:
|
||||
msg = "Comment removed: %s" % comment
|
||||
#msg = "Comment removed: %s" % comment
|
||||
##sys.stderr.write(msg.encode("utf8"))
|
||||
pass
|
||||
elif c == '[':
|
||||
name = self.read_until("]")[:-1]
|
||||
if name[0] == '/':
|
||||
|
|
|
@ -579,7 +579,7 @@ class CrossRef:
|
|||
key = None
|
||||
# If name is already in our resource list, it's easy.
|
||||
if name in self.fileref and self.visible_from(name, fn, n):
|
||||
self.fileref[trial].append(fn, n+1)
|
||||
self.fileref[name].append(fn, n+1)
|
||||
continue
|
||||
# If the name contains subtitutable parts, count
|
||||
# it as a reference to everything the substitutions
|
||||
|
@ -690,13 +690,13 @@ class Translation(dict):
|
|||
|
||||
gettext = f.read().decode("utf8")
|
||||
matches = re.compile("""(msgid|msgstr)((\s*".*?")+)""").findall(gettext)
|
||||
id = ""
|
||||
msgid = ""
|
||||
for match in matches:
|
||||
text = "".join(re.compile('"(.*?)"').findall(match[1]))
|
||||
if match[0] == "msgid":
|
||||
id = text.replace("\\n", "\n")
|
||||
msgid = text.replace("\\n", "\n")
|
||||
else:
|
||||
self.gettext[id] = text.replace("\\n", "\n")
|
||||
self.gettext[msgid] = text.replace("\\n", "\n")
|
||||
def get(self, key, dflt):
|
||||
if self.isocode == "C":
|
||||
if key:
|
||||
|
@ -803,16 +803,16 @@ vcdir = ".svn"
|
|||
|
||||
def vcmove(src, dst):
|
||||
"Move a file under version control. Only applied to unmodified files."
|
||||
(dir, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(dir, ".svn")):
|
||||
(path, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(path, ".svn")):
|
||||
return "svn mv %s %s" % (src, dst)
|
||||
else:
|
||||
return mv + " " + src + " " + dst
|
||||
|
||||
def vcunmove(src, dst):
|
||||
"Revert the result of a previous move (before commit)."
|
||||
(dir, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(dir, ".svn")):
|
||||
(path, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(path, ".svn")):
|
||||
return "svn revert %s" % dst # Revert the add at the destination
|
||||
return rm + " " + dst # Remove the moved copy
|
||||
return "svn revert %s" % src # Revert the deletion
|
||||
|
@ -821,16 +821,16 @@ def vcunmove(src, dst):
|
|||
|
||||
def vcdelete(src):
|
||||
"Delete a file under version control."
|
||||
(dir, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(dir, ".svn")):
|
||||
(path, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(path, ".svn")):
|
||||
return "svn rm %s" % src
|
||||
else:
|
||||
return rm + " " + src
|
||||
|
||||
def vcundelete(src):
|
||||
"Revert the result of a previous delete (before commit)."
|
||||
(dir, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(dir, ".svn")):
|
||||
(path, base) = os.path.split(src)
|
||||
if os.path.exists(os.path.join(path, ".svn")):
|
||||
return "svn revert %s" % src # Revert the deletion
|
||||
else:
|
||||
return "echo 'can't undelete %s, not under version control'" % src
|
||||
|
|
Loading…
Add table
Reference in a new issue