[pypy-svn] r28993 - pypy/dist/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Tue Jun 20 14:15:46 CEST 2006
Author: arigo
Date: Tue Jun 20 14:15:44 2006
New Revision: 28993
Modified:
pypy/dist/pypy/objspace/std/dicttype.py
pypy/dist/pypy/objspace/std/frozensettype.py
pypy/dist/pypy/objspace/std/listtype.py
pypy/dist/pypy/objspace/std/setobject.py
pypy/dist/pypy/objspace/std/settype.py
pypy/dist/pypy/objspace/std/slicetype.py
pypy/dist/pypy/objspace/std/stdtypedef.py
pypy/dist/pypy/objspace/std/stringtype.py
pypy/dist/pypy/objspace/std/unicodetype.py
Log:
Added docstrings to all (non-special) methods of built-in types
in the StdObjSpace.
Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py (original)
+++ pypy/dist/pypy/objspace/std/dicttype.py Tue Jun 20 14:15:44 2006
@@ -3,21 +3,46 @@
from pypy.objspace.std.register_all import register_all
from pypy.interpreter.error import OperationError
-dict_copy = StdObjSpaceMultiMethod('copy', 1)
-dict_items = StdObjSpaceMultiMethod('items', 1)
-dict_keys = StdObjSpaceMultiMethod('keys', 1)
-dict_values = StdObjSpaceMultiMethod('values', 1)
-dict_has_key = StdObjSpaceMultiMethod('has_key', 2)
-dict_clear = StdObjSpaceMultiMethod('clear', 1)
-dict_get = StdObjSpaceMultiMethod('get', 3, defaults=(None,))
-dict_pop = StdObjSpaceMultiMethod('pop', 2, w_varargs=True)
-dict_popitem = StdObjSpaceMultiMethod('popitem', 1)
-dict_setdefault = StdObjSpaceMultiMethod('setdefault', 3, defaults=(None,))
-dict_update = StdObjSpaceMultiMethod('update', 2, defaults=((),))
-dict_iteritems = StdObjSpaceMultiMethod('iteritems', 1)
-dict_iterkeys = StdObjSpaceMultiMethod('iterkeys', 1)
-dict_itervalues = StdObjSpaceMultiMethod('itervalues', 1)
-dict_reversed = StdObjSpaceMultiMethod('__reversed__', 1)
+dict_copy = SMM('copy', 1,
+ doc='D.copy() -> a shallow copy of D')
+dict_items = SMM('items', 1,
+ doc="D.items() -> list of D's (key, value) pairs, as"
+ ' 2-tuples')
+dict_keys = SMM('keys', 1,
+ doc="D.keys() -> list of D's keys")
+dict_values = SMM('values', 1,
+ doc="D.values() -> list of D's values")
+dict_has_key = SMM('has_key', 2,
+ doc='D.has_key(k) -> True if D has a key k, else False')
+dict_clear = SMM('clear', 1,
+ doc='D.clear() -> None. Remove all items from D.')
+dict_get = SMM('get', 3, defaults=(None,),
+ doc='D.get(k[,d]) -> D[k] if k in D, else d. d defaults'
+ ' to None.')
+dict_pop = SMM('pop', 2, w_varargs=True,
+ doc='D.pop(k[,d]) -> v, remove specified key and return'
+ ' the corresponding value\nIf key is not found, d is'
+ ' returned if given, otherwise KeyError is raised')
+dict_popitem = SMM('popitem', 1,
+ doc='D.popitem() -> (k, v), remove and return some (key,'
+ ' value) pair as a\n2-tuple; but raise KeyError if D'
+ ' is empty')
+dict_setdefault = SMM('setdefault', 3, defaults=(None,),
+ doc='D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d'
+ ' if k not in D')
+dict_update = SMM('update', 2, defaults=((),),
+ doc='D.update(E, **F) -> None. Update D from E and F:'
+ ' for k in E: D[k] = E[k]\n(if E has keys else: for'
+ ' (k, v) in E: D[k] = v) then: for k in F: D[k] ='
+ ' F[k]')
+dict_iteritems = SMM('iteritems', 1,
+ doc='D.iteritems() -> an iterator over the (key, value)'
+ ' items of D')
+dict_iterkeys = SMM('iterkeys', 1,
+ doc='D.iterkeys() -> an iterator over the keys of D')
+dict_itervalues = SMM('itervalues', 1,
+ doc='D.itervalues() -> an iterator over the values of D')
+dict_reversed = SMM('__reversed__', 1)
def dict_reversed__ANY(space, w_dict):
raise OperationError(space.w_TypeError, space.wrap('argument to reversed() must be a sequence'))
Modified: pypy/dist/pypy/objspace/std/frozensettype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/frozensettype.py (original)
+++ pypy/dist/pypy/objspace/std/frozensettype.py Tue Jun 20 14:15:44 2006
@@ -1,18 +1,39 @@
from pypy.interpreter.error import OperationError
from pypy.objspace.std.objspace import register_all
from pypy.objspace.std.stdtypedef import StdTypeDef, newmethod
-from pypy.objspace.std.stdtypedef import StdObjSpaceMultiMethod as SMM
+from pypy.objspace.std.stdtypedef import SMM
from pypy.interpreter.gateway import NoneNotWrapped
from pypy.interpreter import gateway
-frozenset_copy = SMM('copy', 1)
-frozenset_difference = SMM('difference', 2)
-frozenset_intersection = SMM('intersection', 2)
-frozenset_issubset = SMM('issubset', 2)
-frozenset_issuperset = SMM('issuperset', 2)
-frozenset_symmetric_difference = SMM('symmetric_difference', 2)
-frozenset_union = SMM('union', 2)
-frozenset_reduce = SMM('__reduce__',1)
+frozenset_copy = SMM('copy', 1,
+ doc='Return a shallow copy of a set.')
+frozenset_difference = SMM('difference', 2,
+ doc='Return the difference of two sets'
+ ' as a new set.\n\n(i.e. all'
+ ' elements that are in this set but'
+ ' not the other.)')
+frozenset_intersection = SMM('intersection', 2,
+ doc='Return the intersection of two sets'
+ ' as a new set.\n\n(i.e. all'
+ ' elements that are in both sets.)')
+frozenset_issubset = SMM('issubset', 2,
+ doc='Report whether another set contains'
+ ' this set.')
+frozenset_issuperset = SMM('issuperset', 2,
+ doc='Report whether this set contains'
+ ' another set.')
+frozenset_symmetric_difference = SMM('symmetric_difference', 2,
+ doc='Return the symmetric difference of'
+ ' two sets as a new set.\n\n(i.e.'
+ ' all elements that are in exactly'
+ ' one of the sets.)')
+frozenset_union = SMM('union', 2,
+ doc='Return the union of two sets as a'
+ ' new set.\n\n(i.e. all elements'
+ ' that are in either set.)')
+frozenset_reduce = SMM('__reduce__',1,
+ doc='Return state information for'
+ ' pickling.')
register_all(vars(), globals())
Modified: pypy/dist/pypy/objspace/std/listtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listtype.py (original)
+++ pypy/dist/pypy/objspace/std/listtype.py Tue Jun 20 14:15:44 2006
@@ -4,16 +4,32 @@
from pypy.objspace.std.register_all import register_all
from sys import maxint
-list_append = StdObjSpaceMultiMethod('append', 2)
-list_insert = StdObjSpaceMultiMethod('insert', 3)
-list_extend = StdObjSpaceMultiMethod('extend', 2)
-list_pop = StdObjSpaceMultiMethod('pop', 2, defaults=(-1,))
-list_remove = StdObjSpaceMultiMethod('remove', 2)
-list_index = StdObjSpaceMultiMethod('index', 4, defaults=(0,maxint))
-list_count = StdObjSpaceMultiMethod('count', 2)
-list_reverse = StdObjSpaceMultiMethod('reverse',1)
-list_sort = StdObjSpaceMultiMethod('sort', 4, defaults=(None, None, False), argnames=['cmp', 'key', 'reverse'])
-list_reversed = StdObjSpaceMultiMethod('__reversed__', 1)
+list_append = SMM('append', 2,
+ doc='L.append(object) -- append object to end')
+list_insert = SMM('insert', 3,
+ doc='L.insert(index, object) -- insert object before index')
+list_extend = SMM('extend', 2,
+ doc='L.extend(iterable) -- extend list by appending'
+ ' elements from the iterable')
+list_pop = SMM('pop', 2, defaults=(-1,),
+ doc='L.pop([index]) -> item -- remove and return item at'
+ ' index (default last)')
+list_remove = SMM('remove', 2,
+ doc='L.remove(value) -- remove first occurrence of value')
+list_index = SMM('index', 4, defaults=(0,maxint),
+ doc='L.index(value, [start, [stop]]) -> integer -- return'
+ ' first index of value')
+list_count = SMM('count', 2,
+ doc='L.count(value) -> integer -- return number of'
+ ' occurrences of value')
+list_reverse = SMM('reverse',1,
+ doc='L.reverse() -- reverse *IN PLACE*')
+list_sort = SMM('sort', 4, defaults=(None, None, False), argnames=['cmp', 'key', 'reverse'],
+ doc='L.sort(cmp=None, key=None, reverse=False) -- stable'
+ ' sort *IN PLACE*;\ncmp(x, y) -> -1, 0, 1')
+list_reversed = SMM('__reversed__', 1,
+ doc='L.__reversed__() -- return a reverse iterator over'
+ ' the list')
##
##list_reversed__ANY = gateway.applevel('''
## # NOT_RPYTHON -- uses yield
Modified: pypy/dist/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/setobject.py (original)
+++ pypy/dist/pypy/objspace/std/setobject.py Tue Jun 20 14:15:44 2006
@@ -1,6 +1,5 @@
from pypy.objspace.std.objspace import W_Object, OperationError
from pypy.objspace.std.objspace import registerimplementation, register_all
-from pypy.objspace.std.stdtypedef import StdObjSpaceMultiMethod
from pypy.rpython.objectmodel import r_dict
from pypy.rpython.rarithmetic import intmask, r_uint
from pypy.interpreter import gateway
Modified: pypy/dist/pypy/objspace/std/settype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/settype.py (original)
+++ pypy/dist/pypy/objspace/std/settype.py Tue Jun 20 14:15:44 2006
@@ -1,27 +1,69 @@
from pypy.interpreter.error import OperationError
from pypy.objspace.std.objspace import register_all
from pypy.objspace.std.stdtypedef import StdTypeDef, newmethod, no_hash_descr
-from pypy.objspace.std.stdtypedef import StdObjSpaceMultiMethod as SMM
+from pypy.objspace.std.stdtypedef import SMM
from pypy.interpreter.gateway import NoneNotWrapped
from pypy.interpreter import gateway
-set_add = SMM('add', 2)
-set_clear = SMM('clear', 1)
-set_copy = SMM('copy', 1)
-set_difference = SMM('difference', 2)
-set_difference_update = SMM('difference_update', 2)
-set_discard = SMM('discard', 2)
-set_intersection = SMM('intersection', 2)
-set_intersection_update = SMM('intersection_update', 2)
-set_issubset = SMM('issubset', 2)
-set_issuperset = SMM('issuperset', 2)
-set_pop = SMM('pop', 1)
-set_remove = SMM('remove', 2)
-set_symmetric_difference = SMM('symmetric_difference', 2)
-set_symmetric_difference_update = SMM('symmetric_difference_update', 2)
-set_union = SMM('union', 2)
-set_update = SMM('update', 2)
-set_reduce = SMM('__reduce__',1)
+set_add = SMM('add', 2,
+ doc='Add an element to a set.\n\nThis'
+ ' has no effect if the element is'
+ ' already present.')
+set_clear = SMM('clear', 1,
+ doc='Remove all elements from this set.')
+set_copy = SMM('copy', 1,
+ doc='Return a shallow copy of a set.')
+set_difference = SMM('difference', 2,
+ doc='Return the difference of two sets'
+ ' as a new set.\n\n(i.e. all'
+ ' elements that are in this set but'
+ ' not the other.)')
+set_difference_update = SMM('difference_update', 2,
+ doc='Remove all elements of another set'
+ ' from this set.')
+set_discard = SMM('discard', 2,
+ doc='Remove an element from a set if it'
+ ' is a member.\n\nIf the element is'
+ ' not a member, do nothing.')
+set_intersection = SMM('intersection', 2,
+ doc='Return the intersection of two sets'
+ ' as a new set.\n\n(i.e. all'
+ ' elements that are in both sets.)')
+set_intersection_update = SMM('intersection_update', 2,
+ doc='Update a set with the intersection'
+ ' of itself and another.')
+set_issubset = SMM('issubset', 2,
+ doc='Report whether another set contains'
+ ' this set.')
+set_issuperset = SMM('issuperset', 2,
+ doc='Report whether this set contains'
+ ' another set.')
+set_pop = SMM('pop', 1,
+ doc='Remove and return an arbitrary set'
+ ' element.')
+set_remove = SMM('remove', 2,
+ doc='Remove an element from a set; it'
+ ' must be a member.\n\nIf the'
+ ' element is not a member, raise a'
+ ' KeyError.')
+set_symmetric_difference = SMM('symmetric_difference', 2,
+ doc='Return the symmetric difference of'
+ ' two sets as a new set.\n\n(i.e.'
+ ' all elements that are in exactly'
+ ' one of the sets.)')
+set_symmetric_difference_update = SMM('symmetric_difference_update', 2,
+ doc='Update a set with the symmetric'
+ ' difference of itself and another.')
+set_union = SMM('union', 2,
+ doc='Return the union of two sets as a'
+ ' new set.\n\n(i.e. all elements'
+ ' that are in either set.)')
+set_update = SMM('update', 2,
+ doc='Update a set with the union of'
+ ' itself and another.')
+set_reduce = SMM('__reduce__',1,
+ doc='Return state information for'
+ ' pickling.')
register_all(vars(), globals())
Modified: pypy/dist/pypy/objspace/std/slicetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/slicetype.py (original)
+++ pypy/dist/pypy/objspace/std/slicetype.py Tue Jun 20 14:15:44 2006
@@ -5,7 +5,13 @@
from pypy.interpreter.error import OperationError
# indices multimehtod
-slice_indices = StdObjSpaceMultiMethod('indices', 2)
+slice_indices = SMM('indices', 2,
+ doc='S.indices(len) -> (start, stop, stride)\n\nAssuming a'
+ ' sequence of length len, calculate the start and'
+ ' stop\nindices, and the stride length of the extended'
+ ' slice described by\nS. Out of bounds indices are'
+ ' clipped in a manner consistent with the\nhandling of'
+ ' normal slices.')
# utility functions
def _Eval_SliceIndex(space, w_int):
Modified: pypy/dist/pypy/objspace/std/stdtypedef.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stdtypedef.py (original)
+++ pypy/dist/pypy/objspace/std/stdtypedef.py Tue Jun 20 14:15:44 2006
@@ -10,7 +10,9 @@
__all__ = ['StdTypeDef', 'newmethod', 'gateway',
'GetSetProperty', 'Member',
- 'StdObjSpaceMultiMethod', 'descr_get_dict', 'no_hash_descr']
+ 'SMM', 'descr_get_dict', 'no_hash_descr']
+
+SMM = StdObjSpaceMultiMethod
class StdTypeDef(TypeDef):
Modified: pypy/dist/pypy/objspace/std/stringtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringtype.py (original)
+++ pypy/dist/pypy/objspace/std/stringtype.py Tue Jun 20 14:15:44 2006
@@ -3,41 +3,195 @@
from sys import maxint
-str_join = StdObjSpaceMultiMethod('join', 2)
-str_split = StdObjSpaceMultiMethod('split', 3, defaults=(None,-1))
-str_rsplit = StdObjSpaceMultiMethod('rsplit', 3, defaults=(None,-1))
-str_isdigit = StdObjSpaceMultiMethod('isdigit', 1)
-str_isalpha = StdObjSpaceMultiMethod('isalpha', 1)
-str_isspace = StdObjSpaceMultiMethod('isspace', 1)
-str_isupper = StdObjSpaceMultiMethod('isupper', 1)
-str_islower = StdObjSpaceMultiMethod('islower', 1)
-str_istitle = StdObjSpaceMultiMethod('istitle', 1)
-str_isalnum = StdObjSpaceMultiMethod('isalnum', 1)
-str_ljust = StdObjSpaceMultiMethod('ljust', 3, defaults=(' ',))
-str_rjust = StdObjSpaceMultiMethod('rjust', 3, defaults=(' ',))
-str_upper = StdObjSpaceMultiMethod('upper', 1)
-str_lower = StdObjSpaceMultiMethod('lower', 1)
-str_swapcase = StdObjSpaceMultiMethod('swapcase', 1)
-str_capitalize = StdObjSpaceMultiMethod('capitalize', 1)
-str_title = StdObjSpaceMultiMethod('title', 1)
-str_find = StdObjSpaceMultiMethod('find', 4, defaults=(0, maxint))
-str_rfind = StdObjSpaceMultiMethod('rfind', 4, defaults=(0, maxint))
-str_index = StdObjSpaceMultiMethod('index', 4, defaults=(0, maxint))
-str_rindex = StdObjSpaceMultiMethod('rindex', 4, defaults=(0, maxint))
-str_replace = StdObjSpaceMultiMethod('replace', 4, defaults=(-1,))
-str_zfill = StdObjSpaceMultiMethod('zfill', 2)
-str_strip = StdObjSpaceMultiMethod('strip', 2, defaults=(None,))
-str_rstrip = StdObjSpaceMultiMethod('rstrip', 2, defaults=(None,))
-str_lstrip = StdObjSpaceMultiMethod('lstrip', 2, defaults=(None,))
-str_center = StdObjSpaceMultiMethod('center', 3, defaults=(' ',))
-str_count = StdObjSpaceMultiMethod('count', 4, defaults=(0, maxint))
-str_endswith = StdObjSpaceMultiMethod('endswith', 4, defaults=(0, maxint))
-str_expandtabs = StdObjSpaceMultiMethod('expandtabs', 2, defaults=(8,))
-str_splitlines = StdObjSpaceMultiMethod('splitlines', 2, defaults=(0,))
-str_startswith = StdObjSpaceMultiMethod('startswith', 4, defaults=(0, maxint))
-str_translate = StdObjSpaceMultiMethod('translate', 3, defaults=('',)) #unicode mimic not supported now
-str_decode = StdObjSpaceMultiMethod('decode', 3, defaults=(None, None))
-str_encode = StdObjSpaceMultiMethod('encode', 3, defaults=(None, None))
+str_join = SMM('join', 2,
+ doc='S.join(sequence) -> string\n\nReturn a string which is'
+ ' the concatenation of the strings in the\nsequence. '
+ ' The separator between elements is S.')
+str_split = SMM('split', 3, defaults=(None,-1),
+ doc='S.split([sep [,maxsplit]]) -> list of strings\n\nReturn'
+ ' a list of the words in the string S, using sep as'
+ ' the\ndelimiter string. If maxsplit is given, at most'
+ ' maxsplit\nsplits are done. If sep is not specified or'
+ ' is None, any\nwhitespace string is a separator.')
+str_rsplit = SMM('rsplit', 3, defaults=(None,-1),
+ doc='S.rsplit([sep [,maxsplit]]) -> list of'
+ ' strings\n\nReturn a list of the words in the string S,'
+ ' using sep as the\ndelimiter string, starting at the'
+ ' end of the string and working\nto the front. If'
+ ' maxsplit is given, at most maxsplit splits are\ndone.'
+ ' If sep is not specified or is None, any whitespace'
+ ' string\nis a separator.')
+str_isdigit = SMM('isdigit', 1,
+ doc='S.isdigit() -> bool\n\nReturn True if all characters'
+ ' in S are digits\nand there is at least one'
+ ' character in S, False otherwise.')
+str_isalpha = SMM('isalpha', 1,
+ doc='S.isalpha() -> bool\n\nReturn True if all characters'
+ ' in S are alphabetic\nand there is at least one'
+ ' character in S, False otherwise.')
+str_isspace = SMM('isspace', 1,
+ doc='S.isspace() -> bool\n\nReturn True if all characters'
+ ' in S are whitespace\nand there is at least one'
+ ' character in S, False otherwise.')
+str_isupper = SMM('isupper', 1,
+ doc='S.isupper() -> bool\n\nReturn True if all cased'
+ ' characters in S are uppercase and there is\nat'
+ ' least one cased character in S, False otherwise.')
+str_islower = SMM('islower', 1,
+ doc='S.islower() -> bool\n\nReturn True if all cased'
+ ' characters in S are lowercase and there is\nat'
+ ' least one cased character in S, False otherwise.')
+str_istitle = SMM('istitle', 1,
+ doc='S.istitle() -> bool\n\nReturn True if S is a'
+ ' titlecased string and there is at least'
+ ' one\ncharacter in S, i.e. uppercase characters may'
+ ' only follow uncased\ncharacters and lowercase'
+ ' characters only cased ones. Return'
+ ' False\notherwise.')
+str_isalnum = SMM('isalnum', 1,
+ doc='S.isalnum() -> bool\n\nReturn True if all characters'
+ ' in S are alphanumeric\nand there is at least one'
+ ' character in S, False otherwise.')
+str_ljust = SMM('ljust', 3, defaults=(' ',),
+ doc='S.ljust(width[, fillchar]) -> string\n\nReturn S'
+ ' left justified in a string of length width. Padding'
+ ' is\ndone using the specified fill character'
+ ' (default is a space).')
+str_rjust = SMM('rjust', 3, defaults=(' ',),
+ doc='S.rjust(width[, fillchar]) -> string\n\nReturn S'
+ ' right justified in a string of length width.'
+ ' Padding is\ndone using the specified fill character'
+ ' (default is a space)')
+str_upper = SMM('upper', 1,
+ doc='S.upper() -> string\n\nReturn a copy of the string S'
+ ' converted to uppercase.')
+str_lower = SMM('lower', 1,
+ doc='S.lower() -> string\n\nReturn a copy of the string S'
+ ' converted to lowercase.')
+str_swapcase = SMM('swapcase', 1,
+ doc='S.swapcase() -> string\n\nReturn a copy of the'
+ ' string S with uppercase characters\nconverted to'
+ ' lowercase and vice versa.')
+str_capitalize = SMM('capitalize', 1,
+ doc='S.capitalize() -> string\n\nReturn a copy of the'
+ ' string S with only its first'
+ ' character\ncapitalized.')
+str_title = SMM('title', 1,
+ doc='S.title() -> string\n\nReturn a titlecased version'
+ ' of S, i.e. words start with uppercase\ncharacters,'
+ ' all remaining cased characters have lowercase.')
+str_find = SMM('find', 4, defaults=(0, maxint),
+ doc='S.find(sub [,start [,end]]) -> int\n\nReturn the'
+ ' lowest index in S where substring sub is'
+ ' found,\nsuch that sub is contained within'
+ ' s[start,end]. Optional\narguments start and end'
+ ' are interpreted as in slice notation.\n\nReturn -1'
+ ' on failure.')
+str_rfind = SMM('rfind', 4, defaults=(0, maxint),
+ doc='S.rfind(sub [,start [,end]]) -> int\n\nReturn the'
+ ' highest index in S where substring sub is'
+ ' found,\nsuch that sub is contained within'
+ ' s[start,end]. Optional\narguments start and end'
+ ' are interpreted as in slice notation.\n\nReturn -1'
+ ' on failure.')
+str_index = SMM('index', 4, defaults=(0, maxint),
+ doc='S.index(sub [,start [,end]]) -> int\n\nLike S.find()'
+ ' but raise ValueError when the substring is not'
+ ' found.')
+str_rindex = SMM('rindex', 4, defaults=(0, maxint),
+ doc='S.rindex(sub [,start [,end]]) -> int\n\nLike'
+ ' S.rfind() but raise ValueError when the substring'
+ ' is not found.')
+str_replace = SMM('replace', 4, defaults=(-1,),
+ doc='S.replace (old, new[, count]) -> string\n\nReturn a'
+ ' copy of string S with all occurrences of'
+ ' substring\nold replaced by new. If the optional'
+ ' argument count is\ngiven, only the first count'
+ ' occurrences are replaced.')
+str_zfill = SMM('zfill', 2,
+ doc='S.zfill(width) -> string\n\nPad a numeric string S'
+ ' with zeros on the left, to fill a field\nof the'
+ ' specified width. The string S is never truncated.')
+str_strip = SMM('strip', 2, defaults=(None,),
+ doc='S.strip([chars]) -> string or unicode\n\nReturn a'
+ ' copy of the string S with leading and'
+ ' trailing\nwhitespace removed.\nIf chars is given'
+ ' and not None, remove characters in chars'
+ ' instead.\nIf chars is unicode, S will be converted'
+ ' to unicode before stripping')
+str_rstrip = SMM('rstrip', 2, defaults=(None,),
+ doc='S.rstrip([chars]) -> string or unicode\n\nReturn a'
+ ' copy of the string S with trailing whitespace'
+ ' removed.\nIf chars is given and not None, remove'
+ ' characters in chars instead.\nIf chars is unicode,'
+ ' S will be converted to unicode before stripping')
+str_lstrip = SMM('lstrip', 2, defaults=(None,),
+ doc='S.lstrip([chars]) -> string or unicode\n\nReturn a'
+ ' copy of the string S with leading whitespace'
+ ' removed.\nIf chars is given and not None, remove'
+ ' characters in chars instead.\nIf chars is unicode,'
+ ' S will be converted to unicode before stripping')
+str_center = SMM('center', 3, defaults=(' ',),
+ doc='S.center(width[, fillchar]) -> string\n\nReturn S'
+ ' centered in a string of length width. Padding'
+ ' is\ndone using the specified fill character'
+ ' (default is a space)')
+str_count = SMM('count', 4, defaults=(0, maxint),
+ doc='S.count(sub[, start[, end]]) -> int\n\nReturn the'
+ ' number of occurrences of substring sub in'
+ ' string\nS[start:end]. Optional arguments start and'
+ ' end are\ninterpreted as in slice notation.')
+str_endswith = SMM('endswith', 4, defaults=(0, maxint),
+ doc='S.endswith(suffix[, start[, end]]) -> bool\n\nReturn'
+ ' True if S ends with the specified suffix, False'
+ ' otherwise.\nWith optional start, test S beginning'
+ ' at that position.\nWith optional end, stop'
+ ' comparing S at that position.')
+str_expandtabs = SMM('expandtabs', 2, defaults=(8,),
+ doc='S.expandtabs([tabsize]) -> string\n\nReturn a copy'
+ ' of S where all tab characters are expanded using'
+ ' spaces.\nIf tabsize is not given, a tab size of 8'
+ ' characters is assumed.')
+str_splitlines = SMM('splitlines', 2, defaults=(0,),
+ doc='S.splitlines([keepends]) -> list of'
+ ' strings\n\nReturn a list of the lines in S,'
+ ' breaking at line boundaries.\nLine breaks are not'
+ ' included in the resulting list unless keepends\nis'
+ ' given and true.')
+str_startswith = SMM('startswith', 4, defaults=(0, maxint),
+ doc='S.startswith(prefix[, start[, end]]) ->'
+ ' bool\n\nReturn True if S starts with the specified'
+ ' prefix, False otherwise.\nWith optional start, test'
+ ' S beginning at that position.\nWith optional end,'
+ ' stop comparing S at that position.')
+str_translate = SMM('translate', 3, defaults=('',), #unicode mimic not supported now
+ doc='S.translate(table [,deletechars]) -> string\n\n'
+ 'Return a copy of the string S, where all characters'
+ ' occurring\nin the optional argument deletechars are'
+ ' removed, and the\nremaining characters have been'
+ ' mapped through the given\ntranslation table, which'
+ ' must be a string of length 256.')
+str_decode = SMM('decode', 3, defaults=(None, None),
+ doc='S.decode([encoding[,errors]]) -> object\n\nDecodes S'
+ ' using the codec registered for encoding. encoding'
+ ' defaults\nto the default encoding. errors may be'
+ ' given to set a different error\nhandling scheme.'
+ " Default is 'strict' meaning that encoding errors"
+ ' raise\na UnicodeDecodeError. Other possible values'
+ " are 'ignore' and 'replace'\nas well as any other"
+ ' name registerd with codecs.register_error that'
+ ' is\nable to handle UnicodeDecodeErrors.')
+str_encode = SMM('encode', 3, defaults=(None, None),
+ doc='S.encode([encoding[,errors]]) -> object\n\nEncodes S'
+ ' using the codec registered for encoding. encoding'
+ ' defaults\nto the default encoding. errors may be'
+ ' given to set a different error\nhandling scheme.'
+ " Default is 'strict' meaning that encoding errors"
+ ' raise\na UnicodeEncodeError. Other possible values'
+ " are 'ignore', 'replace' and\n'xmlcharrefreplace' as"
+ ' well as any other name registered'
+ ' with\ncodecs.register_error that is able to handle'
+ ' UnicodeEncodeErrors.')
# ____________________________________________________________
Modified: pypy/dist/pypy/objspace/std/unicodetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodetype.py (original)
+++ pypy/dist/pypy/objspace/std/unicodetype.py Tue Jun 20 14:15:44 2006
@@ -5,42 +5,208 @@
from sys import maxint
-unicode_capitalize = StdObjSpaceMultiMethod('capitalize', 1)
-unicode_center = StdObjSpaceMultiMethod('center', 3, defaults=(' ',))
-unicode_count = StdObjSpaceMultiMethod('count', 4, defaults=(0, maxint))
-unicode_encode = StdObjSpaceMultiMethod('encode', 3, defaults=(None, None))
-unicode_endswith = StdObjSpaceMultiMethod('endswith', 4, defaults=(0,maxint))
-unicode_expandtabs = StdObjSpaceMultiMethod('expandtabs', 2, defaults=(8,))
-unicode_find = StdObjSpaceMultiMethod('find', 4, defaults=(0, maxint))
-unicode_index = StdObjSpaceMultiMethod('index', 4, defaults=(0, maxint))
-unicode_isalnum = StdObjSpaceMultiMethod('isalnum', 1)
-unicode_isalpha = StdObjSpaceMultiMethod('isalpha', 1)
-unicode_isdecimal = StdObjSpaceMultiMethod('isdecimal', 1)
-unicode_isdigit = StdObjSpaceMultiMethod('isdigit', 1)
-unicode_islower = StdObjSpaceMultiMethod('islower', 1)
-unicode_isnumeric = StdObjSpaceMultiMethod('isnumeric', 1)
-unicode_isspace = StdObjSpaceMultiMethod('isspace', 1)
-unicode_istitle = StdObjSpaceMultiMethod('istitle', 1)
-unicode_isupper = StdObjSpaceMultiMethod('isupper', 1)
-unicode_join = StdObjSpaceMultiMethod('join', 2)
-unicode_ljust = StdObjSpaceMultiMethod('ljust', 3, defaults=(' ',))
-unicode_lower = StdObjSpaceMultiMethod('lower', 1)
-unicode_lstrip = StdObjSpaceMultiMethod('lstrip', 2, defaults=(None,))
-unicode_replace = StdObjSpaceMultiMethod('replace', 4, defaults=(-1,))
-unicode_rfind = StdObjSpaceMultiMethod('rfind', 4, defaults=(0, maxint))
-unicode_rindex = StdObjSpaceMultiMethod('rindex', 4, defaults=(0, maxint))
-unicode_rjust = StdObjSpaceMultiMethod('rjust', 3, defaults=(' ',))
-unicode_rstrip = StdObjSpaceMultiMethod('rstrip', 2, defaults=(None,))
-unicode_rsplit = StdObjSpaceMultiMethod('rsplit', 3, defaults=(None,-1))
-unicode_split = StdObjSpaceMultiMethod('split', 3, defaults=(None,-1))
-unicode_splitlines = StdObjSpaceMultiMethod('splitlines', 2, defaults=(0,))
-unicode_startswith = StdObjSpaceMultiMethod('startswith', 4, defaults=(0,maxint))
-unicode_strip = StdObjSpaceMultiMethod('strip', 2, defaults=(None,))
-unicode_swapcase = StdObjSpaceMultiMethod('swapcase', 1)
-unicode_title = StdObjSpaceMultiMethod('title', 1)
-unicode_translate = StdObjSpaceMultiMethod('translate', 2)
-unicode_upper = StdObjSpaceMultiMethod('upper', 1)
-unicode_zfill = StdObjSpaceMultiMethod('zfill', 2)
+unicode_capitalize = SMM('capitalize', 1,
+ doc='S.capitalize() -> unicode\n\nReturn a'
+ ' capitalized version of S, i.e. make the first'
+ ' character\nhave upper case.')
+unicode_center = SMM('center', 3, defaults=(' ',),
+ doc='S.center(width[, fillchar]) -> unicode\n\nReturn'
+ ' S centered in a Unicode string of length width.'
+ ' Padding is\ndone using the specified fill'
+ ' character (default is a space)')
+unicode_count = SMM('count', 4, defaults=(0, maxint),
+ doc='S.count(sub[, start[, end]]) -> int\n\nReturn'
+ ' the number of occurrences of substring sub in'
+ ' Unicode string\nS[start:end]. Optional'
+ ' arguments start and end are\ninterpreted as in'
+ ' slice notation.')
+unicode_encode = SMM('encode', 3, defaults=(None, None),
+ doc='S.encode([encoding[,errors]]) -> string or'
+ ' unicode\n\nEncodes S using the codec registered'
+ ' for encoding. encoding defaults\nto the default'
+ ' encoding. errors may be given to set a'
+ ' different error\nhandling scheme. Default is'
+ " 'strict' meaning that encoding errors raise\na"
+ ' UnicodeEncodeError. Other possible values are'
+ " 'ignore', 'replace' and\n'xmlcharrefreplace' as"
+ ' well as any other name registered'
+ ' with\ncodecs.register_error that can handle'
+ ' UnicodeEncodeErrors.')
+unicode_endswith = SMM('endswith', 4, defaults=(0,maxint),
+ doc='S.endswith(suffix[, start[, end]]) ->'
+ ' bool\n\nReturn True if S ends with the'
+ ' specified suffix, False otherwise.\nWith'
+ ' optional start, test S beginning at that'
+ ' position.\nWith optional end, stop comparing S'
+ ' at that position.')
+unicode_expandtabs = SMM('expandtabs', 2, defaults=(8,),
+ doc='S.expandtabs([tabsize]) -> unicode\n\nReturn a'
+ ' copy of S where all tab characters are expanded'
+ ' using spaces.\nIf tabsize is not given, a tab'
+ ' size of 8 characters is assumed.')
+unicode_find = SMM('find', 4, defaults=(0, maxint),
+ doc='S.find(sub [,start [,end]]) -> int\n\nReturn the'
+ ' lowest index in S where substring sub is'
+ ' found,\nsuch that sub is contained within'
+ ' s[start,end]. Optional\narguments start and'
+ ' end are interpreted as in slice'
+ ' notation.\n\nReturn -1 on failure.')
+unicode_index = SMM('index', 4, defaults=(0, maxint),
+ doc='S.index(sub [,start [,end]]) -> int\n\nLike'
+ ' S.find() but raise ValueError when the'
+ ' substring is not found.')
+unicode_isalnum = SMM('isalnum', 1,
+ doc='S.isalnum() -> bool\n\nReturn True if all'
+ ' characters in S are alphanumeric\nand there is'
+ ' at least one character in S, False otherwise.')
+unicode_isalpha = SMM('isalpha', 1,
+ doc='S.isalpha() -> bool\n\nReturn True if all'
+ ' characters in S are alphabetic\nand there is at'
+ ' least one character in S, False otherwise.')
+unicode_isdecimal = SMM('isdecimal', 1,
+ doc='S.isdecimal() -> bool\n\nReturn True if there'
+ ' are only decimal characters in S,\nFalse'
+ ' otherwise.')
+unicode_isdigit = SMM('isdigit', 1,
+ doc='S.isdigit() -> bool\n\nReturn True if all'
+ ' characters in S are digits\nand there is at'
+ ' least one character in S, False otherwise.')
+unicode_islower = SMM('islower', 1,
+ doc='S.islower() -> bool\n\nReturn True if all cased'
+ ' characters in S are lowercase and there is\nat'
+ ' least one cased character in S, False'
+ ' otherwise.')
+unicode_isnumeric = SMM('isnumeric', 1,
+ doc='S.isnumeric() -> bool\n\nReturn True if there'
+ ' are only numeric characters in S,\nFalse'
+ ' otherwise.')
+unicode_isspace = SMM('isspace', 1,
+ doc='S.isspace() -> bool\n\nReturn True if all'
+ ' characters in S are whitespace\nand there is at'
+ ' least one character in S, False otherwise.')
+unicode_istitle = SMM('istitle', 1,
+ doc='S.istitle() -> bool\n\nReturn True if S is a'
+ ' titlecased string and there is at least'
+ ' one\ncharacter in S, i.e. upper- and titlecase'
+ ' characters may only\nfollow uncased characters'
+ ' and lowercase characters only cased'
+ ' ones.\nReturn False otherwise.')
+unicode_isupper = SMM('isupper', 1,
+ doc='S.isupper() -> bool\n\nReturn True if all cased'
+ ' characters in S are uppercase and there is\nat'
+ ' least one cased character in S, False'
+ ' otherwise.')
+unicode_join = SMM('join', 2,
+ doc='S.join(sequence) -> unicode\n\nReturn a string'
+ ' which is the concatenation of the strings in'
+ ' the\nsequence. The separator between elements'
+ ' is S.')
+unicode_ljust = SMM('ljust', 3, defaults=(' ',),
+ doc='S.ljust(width[, fillchar]) -> int\n\nReturn S'
+ ' left justified in a Unicode string of length'
+ ' width. Padding is\ndone using the specified'
+ ' fill character (default is a space).')
+unicode_lower = SMM('lower', 1,
+ doc='S.lower() -> unicode\n\nReturn a copy of the'
+ ' string S converted to lowercase.')
+unicode_lstrip = SMM('lstrip', 2, defaults=(None,),
+ doc='S.lstrip([chars]) -> unicode\n\nReturn a copy of'
+ ' the string S with leading whitespace'
+ ' removed.\nIf chars is given and not None,'
+ ' remove characters in chars instead.\nIf chars'
+ ' is a str, it will be converted to unicode'
+ ' before stripping')
+unicode_replace = SMM('replace', 4, defaults=(-1,),
+ doc='S.replace (old, new[, maxsplit]) ->'
+ ' unicode\n\nReturn a copy of S with all'
+ ' occurrences of substring\nold replaced by new. '
+ ' If the optional argument maxsplit is\ngiven,'
+ ' only the first maxsplit occurrences are'
+ ' replaced.')
+unicode_rfind = SMM('rfind', 4, defaults=(0, maxint),
+ doc='S.rfind(sub [,start [,end]]) -> int\n\nReturn'
+ ' the highest index in S where substring sub is'
+ ' found,\nsuch that sub is contained within'
+ ' s[start,end]. Optional\narguments start and'
+ ' end are interpreted as in slice'
+ ' notation.\n\nReturn -1 on failure.')
+unicode_rindex = SMM('rindex', 4, defaults=(0, maxint),
+ doc='S.rindex(sub [,start [,end]]) -> int\n\nLike'
+ ' S.rfind() but raise ValueError when the'
+ ' substring is not found.')
+unicode_rjust = SMM('rjust', 3, defaults=(' ',),
+ doc='S.rjust(width[, fillchar]) -> unicode\n\nReturn'
+ ' S right justified in a Unicode string of length'
+ ' width. Padding is\ndone using the specified'
+ ' fill character (default is a space).')
+unicode_rstrip = SMM('rstrip', 2, defaults=(None,),
+ doc='S.rstrip([chars]) -> unicode\n\nReturn a copy of'
+ ' the string S with trailing whitespace'
+ ' removed.\nIf chars is given and not None,'
+ ' remove characters in chars instead.\nIf chars'
+ ' is a str, it will be converted to unicode'
+ ' before stripping')
+unicode_rsplit = SMM('rsplit', 3, defaults=(None,-1),
+ doc='S.rsplit([sep [,maxsplit]]) -> list of'
+ ' strings\n\nReturn a list of the words in S,'
+ ' using sep as the\ndelimiter string, starting at'
+ ' the end of the string and\nworking to the'
+ ' front. If maxsplit is given, at most'
+ ' maxsplit\nsplits are done. If sep is not'
+ ' specified, any whitespace string\nis a'
+ ' separator.')
+unicode_split = SMM('split', 3, defaults=(None,-1),
+ doc='S.split([sep [,maxsplit]]) -> list of'
+ ' strings\n\nReturn a list of the words in S,'
+ ' using sep as the\ndelimiter string. If'
+ ' maxsplit is given, at most maxsplit\nsplits are'
+ ' done. If sep is not specified or is None,\nany'
+ ' whitespace string is a separator.')
+unicode_splitlines = SMM('splitlines', 2, defaults=(0,),
+ doc='S.splitlines([keepends]]) -> list of'
+ ' strings\n\nReturn a list of the lines in S,'
+ ' breaking at line boundaries.\nLine breaks are'
+ ' not included in the resulting list unless'
+ ' keepends\nis given and true.')
+unicode_startswith = SMM('startswith', 4, defaults=(0,maxint),
+ doc='S.startswith(prefix[, start[, end]]) ->'
+ ' bool\n\nReturn True if S starts with the'
+ ' specified prefix, False otherwise.\nWith'
+ ' optional start, test S beginning at that'
+ ' position.\nWith optional end, stop comparing S'
+ ' at that position.')
+unicode_strip = SMM('strip', 2, defaults=(None,),
+ doc='S.strip([chars]) -> unicode\n\nReturn a copy of'
+ ' the string S with leading and'
+ ' trailing\nwhitespace removed.\nIf chars is'
+ ' given and not None, remove characters in chars'
+ ' instead.\nIf chars is a str, it will be'
+ ' converted to unicode before stripping')
+unicode_swapcase = SMM('swapcase', 1,
+ doc='S.swapcase() -> unicode\n\nReturn a copy of S'
+ ' with uppercase characters converted to'
+ ' lowercase\nand vice versa.')
+unicode_title = SMM('title', 1,
+ doc='S.title() -> unicode\n\nReturn a titlecased'
+ ' version of S, i.e. words start with title'
+ ' case\ncharacters, all remaining cased'
+ ' characters have lower case.')
+unicode_translate = SMM('translate', 2,
+ doc='S.translate(table) -> unicode\n\nReturn a copy'
+ ' of the string S, where all characters have been'
+ ' mapped\nthrough the given translation table,'
+ ' which must be a mapping of\nUnicode ordinals to'
+ ' Unicode ordinals, Unicode strings or'
+ ' None.\nUnmapped characters are left untouched.'
+ ' Characters mapped to None\nare deleted.')
+unicode_upper = SMM('upper', 1,
+ doc='S.upper() -> unicode\n\nReturn a copy of S'
+ ' converted to uppercase.')
+unicode_zfill = SMM('zfill', 2,
+ doc='S.zfill(width) -> unicode\n\nPad a numeric'
+ ' string x with zeros on the left, to fill a'
+ ' field\nof the specified width. The string x is'
+ ' never truncated.')
# ____________________________________________________________
More information about the Pypy-commit
mailing list