home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 April / com_0405_1.iso / opensource / BTpp-0.5.4-bin.exe / $INSTDIR / BT++.exe / string.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2003-04-19  |  6.2 KB  |  168 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.2)
  3.  
  4. whitespace = ' \t\n\r\x0b\x0c'
  5. lowercase = 'abcdefghijklmnopqrstuvwxyz'
  6. uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  7. letters = lowercase + uppercase
  8. ascii_lowercase = lowercase
  9. ascii_uppercase = uppercase
  10. ascii_letters = ascii_lowercase + ascii_uppercase
  11. digits = '0123456789'
  12. hexdigits = digits + 'abcdef' + 'ABCDEF'
  13. octdigits = '01234567'
  14. punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
  15. printable = digits + letters + punctuation + whitespace
  16. _idmap = ''
  17. for i in range(256):
  18.     _idmap = _idmap + chr(i)
  19.  
  20. del i
  21. index_error = ValueError
  22. atoi_error = ValueError
  23. atof_error = ValueError
  24. atol_error = ValueError
  25.  
  26. def lower(s):
  27.     return s.lower()
  28.  
  29.  
  30. def upper(s):
  31.     return s.upper()
  32.  
  33.  
  34. def swapcase(s):
  35.     return s.swapcase()
  36.  
  37.  
  38. def strip(s):
  39.     return s.strip()
  40.  
  41.  
  42. def lstrip(s):
  43.     return s.lstrip()
  44.  
  45.  
  46. def rstrip(s):
  47.     return s.rstrip()
  48.  
  49.  
  50. def split(s, sep = None, maxsplit = -1):
  51.     return s.split(sep, maxsplit)
  52.  
  53. splitfields = split
  54.  
  55. def join(words, sep = ' '):
  56.     return sep.join(words)
  57.  
  58. joinfields = join
  59.  
  60. def index(s, *args):
  61.     return s.index(*args)
  62.  
  63.  
  64. def rindex(s, *args):
  65.     return s.rindex(*args)
  66.  
  67.  
  68. def count(s, *args):
  69.     return s.count(*args)
  70.  
  71.  
  72. def find(s, *args):
  73.     return s.find(*args)
  74.  
  75.  
  76. def rfind(s, *args):
  77.     return s.rfind(*args)
  78.  
  79. _float = float
  80. _int = int
  81. _long = long
  82.  
  83. try:
  84.     _StringTypes = (str, unicode)
  85. except NameError:
  86.     _StringTypes = (str,)
  87.  
  88.  
  89. def atof(s):
  90.     return _float(s)
  91.  
  92.  
  93. def atoi(s, base = 10):
  94.     return _int(s, base)
  95.  
  96.  
  97. def atol(s, base = 10):
  98.     return _long(s, base)
  99.  
  100.  
  101. def ljust(s, width):
  102.     return s.ljust(width)
  103.  
  104.  
  105. def rjust(s, width):
  106.     return s.rjust(width)
  107.  
  108.  
  109. def center(s, width):
  110.     return s.center(width)
  111.  
  112.  
  113. def zfill(x, width):
  114.     if not isinstance(x, _StringTypes):
  115.         x = repr(x)
  116.     
  117.     return x.zfill(width)
  118.  
  119.  
  120. def expandtabs(s, tabsize = 8):
  121.     return s.expandtabs(tabsize)
  122.  
  123.  
  124. def translate(s, table, deletions = ''):
  125.     if deletions:
  126.         return s.translate(table, deletions)
  127.     else:
  128.         return s.translate(table + s[:0])
  129.  
  130.  
  131. def capitalize(s):
  132.     return s.capitalize()
  133.  
  134.  
  135. def capwords(s, sep = None):
  136.     if not sep:
  137.         pass
  138.     return join(map(capitalize, s.split(sep)), ' ')
  139.  
  140. _idmapL = None
  141.  
  142. def maketrans(fromstr, tostr):
  143.     global _idmapL
  144.     if len(fromstr) != len(tostr):
  145.         raise ValueError, 'maketrans arguments must have same length'
  146.     
  147.     if not _idmapL:
  148.         _idmapL = map(None, _idmap)
  149.     
  150.     L = _idmapL[:]
  151.     fromstr = map(ord, fromstr)
  152.     for i in range(len(fromstr)):
  153.         L[fromstr[i]] = tostr[i]
  154.     
  155.     return join(L, '')
  156.  
  157.  
  158. def replace(s, old, new, maxsplit = -1):
  159.     return s.replace(old, new, maxsplit)
  160.  
  161.  
  162. try:
  163.     from strop import maketrans, lowercase, uppercase, whitespace
  164.     letters = lowercase + uppercase
  165. except ImportError:
  166.     pass
  167.  
  168.