6060 'U16' , # Some files use UTF-16 though
6161 'cp1252' , # Western Europe
6262 'cp500' , # Western Europe
63- 'cp932' , # Japanese SJIS-win
63+ 'cp932' , # Japanese SJIS-win
6464 'mbcs' , # Multi-byte character set (depends on the Windows locale)
6565 )
6666NumEncodings = len (UnicodeEncodings )
@@ -72,7 +72,7 @@ def Unicode(name,tryFirstEncoding=False):
7272 if tryFirstEncoding :
7373 try :
7474 return unicode (name ,tryFirstEncoding )
75- except UnicodeDecodeError :
75+ except UnicodeDecodeError :
7676 deprint ("Unable to decode '%s' in %s." % (name , tryFirstEncoding ))
7777 pass
7878 for i in range (NumEncodings ):
@@ -90,7 +90,7 @@ def Encode(name,tryFirstEncoding=False):
9090 if tryFirstEncoding :
9191 try :
9292 return name .encode (tryFirstEncoding )
93- except UnicodeEncodeError :
93+ except UnicodeEncodeError :
9494 deprint ("Unable to encode '%s' in %s." % (name , tryFirstEncoding ))
9595 pass
9696 for i in range (NumEncodings ):
@@ -766,7 +766,7 @@ def __init__(self,message=_('Action skipped by user.')):
766766
767767#------------------------------------------------------------------------------
768768class PermissionError (BoltError ):
769- """Wrye Bash doesn't have permission to access the specified file/directory."""
769+ """Wrye Flash doesn't have permission to access the specified file/directory."""
770770 def __init__ (self ,message = None ):
771771 message = message or _ ('Access is denied.' )
772772 BoltError .__init__ (self ,message )
@@ -777,9 +777,12 @@ class LString(object):
777777 __slots__ = ('_s' ,'_cs' )
778778
779779 def __init__ (self ,s ):
780- if isinstance (s ,LString ): s = s ._s
781- self ._s = s
782- self ._cs = s .lower ()
780+ if isinstance (s ,LString ):
781+ self ._s = s ._s
782+ self ._cs = s ._cs
783+ else :
784+ self ._s = s
785+ self ._cs = s .lower ()
783786
784787 def __getstate__ (self ):
785788 """Used by pickler. _cs is redundant,so don't include."""
@@ -963,53 +966,53 @@ def __str__(self):
963966 #--String/unicode versions.
964967 @property
965968 def s (self ):
966- "Path as string."
969+ """ Path as string."" "
967970 return self ._s
968971 @property
969972 def cs (self ):
970- "Path as string in normalized case."
973+ """ Path as string in normalized case."" "
971974 return self ._cs
972975 @property
973976 def csroot (self ):
974- "Root as string."
977+ """ Root as string."" "
975978 return self ._csroot
976979 @property
977980 def sroot (self ):
978- "Root as string."
981+ """ Root as string."" "
979982 return self ._sroot
980983 @property
981984 def shead (self ):
982- "Head as string."
985+ """ Head as string."" "
983986 return self ._shead
984987 @property
985988 def stail (self ):
986- "Tail as string."
989+ """ Tail as string."" "
987990 return self ._stail
988991 @property
989992 def sbody (self ):
990- "For alpha\b eta.gamma returns beta as string."
993+ """ For alpha\b eta.gamma returns beta as string."" "
991994 return self ._sbody
992995 @property
993996 def csbody (self ):
994- "For alpha\b eta.gamma returns beta as string in normalized case."
997+ """ For alpha\b eta.gamma returns beta as string in normalized case."" "
995998 return self ._csbody
996999
9971000 #--Head, tail
9981001 @property
9991002 def headTail (self ):
1000- "For alpha\b eta.gamma returns (alpha,beta.gamma)"
1003+ """ For alpha\b eta.gamma returns (alpha,beta.gamma)"" "
10011004 return map (GPath ,(self ._shead ,self ._stail ))
10021005 @property
10031006 def head (self ):
1004- "For alpha\b eta.gamma, returns alpha."
1007+ """ For alpha\b eta.gamma, returns alpha."" "
10051008 return GPath (self ._shead )
10061009 @property
10071010 def tail (self ):
1008- "For alpha\b eta.gamma, returns beta.gamma."
1011+ """ For alpha\b eta.gamma, returns beta.gamma."" "
10091012 return GPath (self ._stail )
10101013 @property
10111014 def body (self ):
1012- "For alpha\b eta.gamma, returns beta."
1015+ """ For alpha\b eta.gamma, returns beta."" "
10131016 return GPath (self ._sbody )
10141017
10151018 #--Root, ext
@@ -1018,29 +1021,29 @@ def rootExt(self):
10181021 return (GPath (self ._sroot ),self ._ext )
10191022 @property
10201023 def root (self ):
1021- "For alpha\b eta.gamma returns alpha\b eta"
1024+ """ For alpha\b eta.gamma returns alpha\b eta"" "
10221025 return GPath (self ._sroot )
10231026 @property
10241027 def ext (self ):
1025- "Extension (including leading period, e.g. '.txt')."
1028+ """ Extension (including leading period, e.g. '.txt')."" "
10261029 return self ._ext
10271030 @property
10281031 def cext (self ):
1029- "Extension in normalized case."
1032+ """ Extension in normalized case."" "
10301033 return self ._cext
10311034 @property
10321035 def temp (self ):
10331036 "Temp file path.."
10341037 return self + '.tmp'
10351038 @property
10361039 def backup (self ):
1037- "Backup file path."
1040+ """ Backup file path."" "
10381041 return self + '.bak'
10391042
10401043 #--size, atime, ctime
10411044 @property
10421045 def size (self ):
1043- "Size of file or directory."
1046+ """ Size of file or directory."" "
10441047 if self .isdir ():
10451048 join = os .path .join
10461049 getSize = os .path .getsize
@@ -1085,7 +1088,7 @@ def getmtime(self,maxMTime=False):
10851088 return max (c )
10861089 except ValueError :
10871090 return 0
1088- try :
1091+ try :
10891092 mtime = int (os .path .getmtime (self ._s ))
10901093 except WindowsError , werr :
10911094 if werr .winerror != 123 : raise
@@ -1311,7 +1314,7 @@ def __cmp__(self, other):
13111314 try :
13121315 return cmp (Encode (self ._cs ), Encode (other ._cs ))
13131316 except UnicodeError :
1314- deprint ("Wrye Bash Unicode mode is currently %s" % (['off.' ,'on.' ][bUseUnicode ]))
1317+ deprint ("Wrye Flash Unicode mode is currently %s" % (['off.' ,'on.' ][bUseUnicode ]))
13151318 deprint ("unrecovered Unicode error when dealing with %s - presuming non equal." % (self ._cs ))
13161319 return False
13171320 else :
@@ -1321,7 +1324,7 @@ def __cmp__(self, other):
13211324 try :
13221325 return cmp (Encode (self ._cs ), Encode (Path .getCase (other )))
13231326 except UnicodeError :
1324- deprint ("Wrye Bash Unicode mode is currently %s." % (['off' ,'on' ][bUseUnicode ]))
1327+ deprint ("Wrye Flash Unicode mode is currently %s." % (['off' ,'on' ][bUseUnicode ]))
13251328 deprint ("unrecovered Unicode error when dealing with %s - presuming non equal.'" % (self ._cs ))
13261329 return False
13271330
@@ -1481,6 +1484,7 @@ class DataDict:
14811484 def __contains__ (self ,key ):
14821485 return key in self .data
14831486 def __getitem__ (self ,key ):
1487+ """Return value for key or modinfo (?) of the game master file."""
14841488 if self .data .has_key (key ):
14851489 return self .data [key ]
14861490 else :
@@ -1493,7 +1497,8 @@ def __delitem__(self,key):
14931497 def __len__ (self ):
14941498 return len (self .data )
14951499 def setdefault (self ,key ,default ):
1496- return self .data .setdefault (key ,value )
1500+ # return self.data.setdefault(key,value)
1501+ return self .data .setdefault (key ,default )
14971502 def keys (self ):
14981503 return self .data .keys ()
14991504 def values (self ):
@@ -2343,8 +2348,8 @@ def getMatch(reMatch,group=0):
23432348
23442349def intArg (arg ,default = None ):
23452350 """Returns argument as an integer. If argument is a string, then it converts it using int(arg,0)."""
2346- if arg == None : return default
2347- elif isinstance (arg ,StringType ): return int (arg ,0 )
2351+ if arg is None : return default
2352+ elif isinstance (arg ,types . StringTypes ): return int (arg ,0 )
23482353 else : return int (arg )
23492354
23502355def invertDict (indict ):
@@ -2679,7 +2684,7 @@ def subBoldItalic(match):
26792684 reHttp = re .compile (r' (http://[_~a-zA-Z0-9\./%-]+)' )
26802685 reWww = re .compile (r' (www\.[_~a-zA-Z0-9\./%-]+)' )
26812686 #reWd = re.compile(r'(<[^>]+>|\[[^\]]+\]|\W+)') # \[[^\]]+\] doesn't match.
2682- reWd = re .compile (r'(<[^>]+>|\[\[[^\]]+\]\]|\s+|[%s]+)' % re .escape (string .punctuation .replace ('_' ,'' )))
2687+ reWd = re .compile (r'(<[^>]+>|\[\[[^\]]+\]\]|\s+|[%s]+)' % re .escape (string .punctuation .replace ('_' ,'' )))
26832688 rePar = re .compile (r'^(\s*[a-zA-Z(;]|\*\*|~~|__|\s*<i|\s*<a)' )
26842689 reFullLink = re .compile (r'(:|#|\.[a-zA-Z0-9]{2,4}$)' )
26852690 reColor = re .compile (r'\[\s*color\s*=[\s\"\']*(.+?)[\s\"\']*\](.*?)\[\s*/\s*color\s*\]' ,re .I )
@@ -2904,7 +2909,7 @@ def toutf8(line):
29042909 def genHtml (* args ,** keywords ):
29052910 """Wtxt to html. Just pass through to WryeText.genHtml."""
29062911 if not len (args ):
2907- args = ["Wrye Bash .txt" ]
2912+ args = ["Wrye Flash .txt" ]
29082913 WryeText .genHtml (* args ,** keywords )
29092914
29102915 #--Command Handler --------------------------------------------------------
0 commit comments