mirror of https://github.com/python/cpython
Fix all return types for str/bytes/bytearray docstrings and make the wording more consistent.
This commit is contained in:
parent
29e4f631ac
commit
17cb8a85d4
|
@ -1081,7 +1081,7 @@ bytes_find_internal(PyByteArrayObject *self, PyObject *args, int dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(find__doc__,
|
PyDoc_STRVAR(find__doc__,
|
||||||
"B.find(sub [,start [,end]]) -> int\n\
|
"B.find(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the lowest index in B where subsection sub is found,\n\
|
Return the lowest index in B where subsection sub is found,\n\
|
||||||
such that sub is contained within s[start,end]. Optional\n\
|
such that sub is contained within s[start,end]. Optional\n\
|
||||||
|
@ -1099,7 +1099,7 @@ bytes_find(PyByteArrayObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(count__doc__,
|
PyDoc_STRVAR(count__doc__,
|
||||||
"B.count(sub [,start [,end]]) -> int\n\
|
"B.count(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the number of non-overlapping occurrences of subsection sub in\n\
|
Return the number of non-overlapping occurrences of subsection sub in\n\
|
||||||
bytes B[start:end]. Optional arguments start and end are interpreted\n\
|
bytes B[start:end]. Optional arguments start and end are interpreted\n\
|
||||||
|
@ -1132,7 +1132,7 @@ bytes_count(PyByteArrayObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(index__doc__,
|
PyDoc_STRVAR(index__doc__,
|
||||||
"B.index(sub [,start [,end]]) -> int\n\
|
"B.index(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like B.find() but raise ValueError when the subsection is not found.");
|
Like B.find() but raise ValueError when the subsection is not found.");
|
||||||
|
|
||||||
|
@ -1152,7 +1152,7 @@ bytes_index(PyByteArrayObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(rfind__doc__,
|
PyDoc_STRVAR(rfind__doc__,
|
||||||
"B.rfind(sub [,start [,end]]) -> int\n\
|
"B.rfind(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the highest index in B where subsection sub is found,\n\
|
Return the highest index in B where subsection sub is found,\n\
|
||||||
such that sub is contained within s[start,end]. Optional\n\
|
such that sub is contained within s[start,end]. Optional\n\
|
||||||
|
@ -1171,7 +1171,7 @@ bytes_rfind(PyByteArrayObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(rindex__doc__,
|
PyDoc_STRVAR(rindex__doc__,
|
||||||
"B.rindex(sub [,start [,end]]) -> int\n\
|
"B.rindex(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like B.rfind() but raise ValueError when the subsection is not found.");
|
Like B.rfind() but raise ValueError when the subsection is not found.");
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ done:
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(startswith__doc__,
|
PyDoc_STRVAR(startswith__doc__,
|
||||||
"B.startswith(prefix [,start [,end]]) -> bool\n\
|
"B.startswith(prefix[, start[, end]]) -> bool\n\
|
||||||
\n\
|
\n\
|
||||||
Return True if B starts with the specified prefix, False otherwise.\n\
|
Return True if B starts with the specified prefix, False otherwise.\n\
|
||||||
With optional start, test B beginning at that position.\n\
|
With optional start, test B beginning at that position.\n\
|
||||||
|
@ -1298,7 +1298,7 @@ bytes_startswith(PyByteArrayObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(endswith__doc__,
|
PyDoc_STRVAR(endswith__doc__,
|
||||||
"B.endswith(suffix [,start [,end]]) -> bool\n\
|
"B.endswith(suffix[, start[, end]]) -> bool\n\
|
||||||
\n\
|
\n\
|
||||||
Return True if B ends with the specified suffix, False otherwise.\n\
|
Return True if B ends with the specified suffix, False otherwise.\n\
|
||||||
With optional start, test B beginning at that position.\n\
|
With optional start, test B beginning at that position.\n\
|
||||||
|
@ -2001,7 +2001,7 @@ replace(PyByteArrayObject *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_len == 0) {
|
if (to_len == 0) {
|
||||||
/* delete all occurances of 'from' bytes */
|
/* delete all occurrences of 'from' bytes */
|
||||||
if (from_len == 1) {
|
if (from_len == 1) {
|
||||||
return replace_delete_single_character(
|
return replace_delete_single_character(
|
||||||
self, from_s[0], maxcount);
|
self, from_s[0], maxcount);
|
||||||
|
@ -2037,7 +2037,7 @@ replace(PyByteArrayObject *self,
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(replace__doc__,
|
PyDoc_STRVAR(replace__doc__,
|
||||||
"B.replace(old, new[, count]) -> bytes\n\
|
"B.replace(old, new[, count]) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of B with all occurrences of subsection\n\
|
Return a copy of B with all occurrences of subsection\n\
|
||||||
old replaced by new. If the optional argument count is\n\
|
old replaced by new. If the optional argument count is\n\
|
||||||
|
@ -2187,7 +2187,7 @@ split_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(split__doc__,
|
PyDoc_STRVAR(split__doc__,
|
||||||
"B.split([sep[, maxsplit]]) -> list of bytearray\n\
|
"B.split([sep[, maxsplit]]) -> list of bytearrays\n\
|
||||||
\n\
|
\n\
|
||||||
Return a list of the sections in B, using sep as the delimiter.\n\
|
Return a list of the sections in B, using sep as the delimiter.\n\
|
||||||
If sep is not given, B is split on ASCII whitespace characters\n\
|
If sep is not given, B is split on ASCII whitespace characters\n\
|
||||||
|
@ -2294,7 +2294,7 @@ make_nullbytes_unique(PyObject *result)
|
||||||
PyDoc_STRVAR(partition__doc__,
|
PyDoc_STRVAR(partition__doc__,
|
||||||
"B.partition(sep) -> (head, sep, tail)\n\
|
"B.partition(sep) -> (head, sep, tail)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in B, and returns the part before it,\n\
|
Search for the separator sep in B, and return the part before it,\n\
|
||||||
the separator itself, and the part after it. If the separator is not\n\
|
the separator itself, and the part after it. If the separator is not\n\
|
||||||
found, returns B and two empty bytearray objects.");
|
found, returns B and two empty bytearray objects.");
|
||||||
|
|
||||||
|
@ -2321,8 +2321,8 @@ bytes_partition(PyByteArrayObject *self, PyObject *sep_obj)
|
||||||
PyDoc_STRVAR(rpartition__doc__,
|
PyDoc_STRVAR(rpartition__doc__,
|
||||||
"B.rpartition(sep) -> (tail, sep, head)\n\
|
"B.rpartition(sep) -> (tail, sep, head)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in B, starting at the end of B,\n\
|
Search for the separator sep in B, starting at the end of B,\n\
|
||||||
and returns the part before it, the separator itself, and the\n\
|
and return the part before it, the separator itself, and the\n\
|
||||||
part after it. If the separator is not found, returns two empty\n\
|
part after it. If the separator is not found, returns two empty\n\
|
||||||
bytearray objects and B.");
|
bytearray objects and B.");
|
||||||
|
|
||||||
|
@ -2421,7 +2421,7 @@ rsplit_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(rsplit__doc__,
|
PyDoc_STRVAR(rsplit__doc__,
|
||||||
"B.rsplit(sep[, maxsplit]) -> list of bytearray\n\
|
"B.rsplit(sep[, maxsplit]) -> list of bytearrays\n\
|
||||||
\n\
|
\n\
|
||||||
Return a list of the sections in B, using sep as the delimiter,\n\
|
Return a list of the sections in B, using sep as the delimiter,\n\
|
||||||
starting at the end of B and working to the front.\n\
|
starting at the end of B and working to the front.\n\
|
||||||
|
@ -2578,7 +2578,7 @@ bytes_append(PyByteArrayObject *self, PyObject *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(extend__doc__,
|
PyDoc_STRVAR(extend__doc__,
|
||||||
"B.extend(iterable int) -> None\n\
|
"B.extend(iterable_of_ints) -> None\n\
|
||||||
\n\
|
\n\
|
||||||
Append all the elements from the iterator or sequence to the\n\
|
Append all the elements from the iterator or sequence to the\n\
|
||||||
end of B.");
|
end of B.");
|
||||||
|
@ -2684,7 +2684,7 @@ bytes_pop(PyByteArrayObject *self, PyObject *args)
|
||||||
PyDoc_STRVAR(remove__doc__,
|
PyDoc_STRVAR(remove__doc__,
|
||||||
"B.remove(int) -> None\n\
|
"B.remove(int) -> None\n\
|
||||||
\n\
|
\n\
|
||||||
Remove the first occurance of a value in B.");
|
Remove the first occurrence of a value in B.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_remove(PyByteArrayObject *self, PyObject *arg)
|
bytes_remove(PyByteArrayObject *self, PyObject *arg)
|
||||||
{
|
{
|
||||||
|
@ -2735,7 +2735,8 @@ rstrip_helper(unsigned char *myptr, Py_ssize_t mysize,
|
||||||
PyDoc_STRVAR(strip__doc__,
|
PyDoc_STRVAR(strip__doc__,
|
||||||
"B.strip([bytes]) -> bytearray\n\
|
"B.strip([bytes]) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Strip leading and trailing bytes contained in the argument.\n\
|
Strip leading and trailing bytes contained in the argument\n\
|
||||||
|
and return the result as a new bytearray.\n\
|
||||||
If the argument is omitted, strip ASCII whitespace.");
|
If the argument is omitted, strip ASCII whitespace.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_strip(PyByteArrayObject *self, PyObject *args)
|
bytes_strip(PyByteArrayObject *self, PyObject *args)
|
||||||
|
@ -2771,7 +2772,8 @@ bytes_strip(PyByteArrayObject *self, PyObject *args)
|
||||||
PyDoc_STRVAR(lstrip__doc__,
|
PyDoc_STRVAR(lstrip__doc__,
|
||||||
"B.lstrip([bytes]) -> bytearray\n\
|
"B.lstrip([bytes]) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Strip leading bytes contained in the argument.\n\
|
Strip leading bytes contained in the argument\n\
|
||||||
|
and return the result as a new bytearray.\n\
|
||||||
If the argument is omitted, strip leading ASCII whitespace.");
|
If the argument is omitted, strip leading ASCII whitespace.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_lstrip(PyByteArrayObject *self, PyObject *args)
|
bytes_lstrip(PyByteArrayObject *self, PyObject *args)
|
||||||
|
@ -2804,7 +2806,8 @@ bytes_lstrip(PyByteArrayObject *self, PyObject *args)
|
||||||
PyDoc_STRVAR(rstrip__doc__,
|
PyDoc_STRVAR(rstrip__doc__,
|
||||||
"B.rstrip([bytes]) -> bytearray\n\
|
"B.rstrip([bytes]) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Strip trailing bytes contained in the argument.\n\
|
Strip trailing bytes contained in the argument\n\
|
||||||
|
and return the result as a new bytearray.\n\
|
||||||
If the argument is omitted, strip trailing ASCII whitespace.");
|
If the argument is omitted, strip trailing ASCII whitespace.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_rstrip(PyByteArrayObject *self, PyObject *args)
|
bytes_rstrip(PyByteArrayObject *self, PyObject *args)
|
||||||
|
@ -2835,9 +2838,9 @@ bytes_rstrip(PyByteArrayObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(decode_doc,
|
PyDoc_STRVAR(decode_doc,
|
||||||
"B.decode([encoding[, errors]]) -> unicode object.\n\
|
"B.decode([encoding[, errors]]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Decodes B using the codec registered for encoding. encoding defaults\n\
|
Decode B using the codec registered for encoding. encoding defaults\n\
|
||||||
to the default encoding. errors may be given to set a different error\n\
|
to the default encoding. errors may be given to set a different error\n\
|
||||||
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
||||||
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
|
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
|
||||||
|
@ -2860,7 +2863,7 @@ bytes_decode(PyObject *self, PyObject *args)
|
||||||
PyDoc_STRVAR(alloc_doc,
|
PyDoc_STRVAR(alloc_doc,
|
||||||
"B.__alloc__() -> int\n\
|
"B.__alloc__() -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Returns the number of bytes actually allocated.");
|
Return the number of bytes actually allocated.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_alloc(PyByteArrayObject *self)
|
bytes_alloc(PyByteArrayObject *self)
|
||||||
|
@ -2869,9 +2872,10 @@ bytes_alloc(PyByteArrayObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(join_doc,
|
PyDoc_STRVAR(join_doc,
|
||||||
"B.join(iterable_of_bytes) -> bytes\n\
|
"B.join(iterable_of_bytes) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Concatenates any number of bytearray objects, with B in between each pair.");
|
Concatenate any number of bytes/bytearray objects, with B\n\
|
||||||
|
in between each pair, and return the result as a new bytearray.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_join(PyByteArrayObject *self, PyObject *it)
|
bytes_join(PyByteArrayObject *self, PyObject *it)
|
||||||
|
@ -2944,7 +2948,7 @@ bytes_join(PyByteArrayObject *self, PyObject *it)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(fromhex_doc,
|
PyDoc_STRVAR(fromhex_doc,
|
||||||
"bytearray.fromhex(string) -> bytearray\n\
|
"bytearray.fromhex(string) -> bytearray (static method)\n\
|
||||||
\n\
|
\n\
|
||||||
Create a bytearray object from a string of hexadecimal numbers.\n\
|
Create a bytearray object from a string of hexadecimal numbers.\n\
|
||||||
Spaces between two numbers are accepted.\n\
|
Spaces between two numbers are accepted.\n\
|
||||||
|
@ -3121,10 +3125,10 @@ bytes_methods[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
PyDoc_STRVAR(bytes_doc,
|
PyDoc_STRVAR(bytes_doc,
|
||||||
"bytearray(iterable_of_ints) -> bytearray.\n\
|
"bytearray(iterable_of_ints) -> bytearray\n\
|
||||||
bytearray(string, encoding[, errors]) -> bytearray.\n\
|
bytearray(string, encoding[, errors]) -> bytearray\n\
|
||||||
bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray.\n\
|
bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray\n\
|
||||||
bytearray(memory_view) -> bytearray.\n\
|
bytearray(memory_view) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Construct an mutable bytearray object from:\n\
|
Construct an mutable bytearray object from:\n\
|
||||||
- an iterable yielding integers in range(256)\n\
|
- an iterable yielding integers in range(256)\n\
|
||||||
|
@ -3132,7 +3136,7 @@ Construct an mutable bytearray object from:\n\
|
||||||
- a bytes or a bytearray object\n\
|
- a bytes or a bytearray object\n\
|
||||||
- any object implementing the buffer API.\n\
|
- any object implementing the buffer API.\n\
|
||||||
\n\
|
\n\
|
||||||
bytearray(int) -> bytearray.\n\
|
bytearray(int) -> bytearray\n\
|
||||||
\n\
|
\n\
|
||||||
Construct a zero-initialized bytearray of the given length.");
|
Construct a zero-initialized bytearray of the given length.");
|
||||||
|
|
||||||
|
|
|
@ -1208,7 +1208,7 @@ string_split(PyBytesObject *self, PyObject *args)
|
||||||
PyDoc_STRVAR(partition__doc__,
|
PyDoc_STRVAR(partition__doc__,
|
||||||
"B.partition(sep) -> (head, sep, tail)\n\
|
"B.partition(sep) -> (head, sep, tail)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in B, and returns the part before it,\n\
|
Search for the separator sep in B, and return the part before it,\n\
|
||||||
the separator itself, and the part after it. If the separator is not\n\
|
the separator itself, and the part after it. If the separator is not\n\
|
||||||
found, returns B and two empty bytes objects.");
|
found, returns B and two empty bytes objects.");
|
||||||
|
|
||||||
|
@ -1235,8 +1235,8 @@ string_partition(PyBytesObject *self, PyObject *sep_obj)
|
||||||
PyDoc_STRVAR(rpartition__doc__,
|
PyDoc_STRVAR(rpartition__doc__,
|
||||||
"B.rpartition(sep) -> (tail, sep, head)\n\
|
"B.rpartition(sep) -> (tail, sep, head)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in B, starting at the end of B,\n\
|
Search for the separator sep in B, starting at the end of B,\n\
|
||||||
and returns the part before it, the separator itself, and the\n\
|
and return the part before it, the separator itself, and the\n\
|
||||||
part after it. If the separator is not found, returns two empty\n\
|
part after it. If the separator is not found, returns two empty\n\
|
||||||
bytes objects and B.");
|
bytes objects and B.");
|
||||||
|
|
||||||
|
@ -1423,7 +1423,7 @@ onError:
|
||||||
PyDoc_STRVAR(join__doc__,
|
PyDoc_STRVAR(join__doc__,
|
||||||
"B.join(iterable_of_bytes) -> bytes\n\
|
"B.join(iterable_of_bytes) -> bytes\n\
|
||||||
\n\
|
\n\
|
||||||
Concatenates any number of bytes objects, with B in between each pair.\n\
|
Concatenate any number of bytes objects, with B in between each pair.\n\
|
||||||
Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.");
|
Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1583,7 +1583,7 @@ string_find_internal(PyBytesObject *self, PyObject *args, int dir)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(find__doc__,
|
PyDoc_STRVAR(find__doc__,
|
||||||
"B.find(sub [,start [,end]]) -> int\n\
|
"B.find(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the lowest index in S where substring sub is found,\n\
|
Return the lowest index in S where substring sub is found,\n\
|
||||||
such that sub is contained within s[start:end]. Optional\n\
|
such that sub is contained within s[start:end]. Optional\n\
|
||||||
|
@ -1602,7 +1602,7 @@ string_find(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(index__doc__,
|
PyDoc_STRVAR(index__doc__,
|
||||||
"B.index(sub [,start [,end]]) -> int\n\
|
"B.index(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like B.find() but raise ValueError when the substring is not found.");
|
Like B.find() but raise ValueError when the substring is not found.");
|
||||||
|
|
||||||
|
@ -1622,7 +1622,7 @@ string_index(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(rfind__doc__,
|
PyDoc_STRVAR(rfind__doc__,
|
||||||
"B.rfind(sub [,start [,end]]) -> int\n\
|
"B.rfind(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the highest index in B where substring sub is found,\n\
|
Return the highest index in B where substring sub is found,\n\
|
||||||
such that sub is contained within s[start:end]. Optional\n\
|
such that sub is contained within s[start:end]. Optional\n\
|
||||||
|
@ -1641,7 +1641,7 @@ string_rfind(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(rindex__doc__,
|
PyDoc_STRVAR(rindex__doc__,
|
||||||
"B.rindex(sub [,start [,end]]) -> int\n\
|
"B.rindex(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like B.rfind() but raise ValueError when the substring is not found.");
|
Like B.rfind() but raise ValueError when the substring is not found.");
|
||||||
|
|
||||||
|
@ -1792,7 +1792,7 @@ string_rstrip(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(count__doc__,
|
PyDoc_STRVAR(count__doc__,
|
||||||
"B.count(sub [,start [,end]]) -> int\n\
|
"B.count(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the number of non-overlapping occurrences of substring sub in\n\
|
Return the number of non-overlapping occurrences of substring sub in\n\
|
||||||
string S[start:end]. Optional arguments start and end are interpreted\n\
|
string S[start:end]. Optional arguments start and end are interpreted\n\
|
||||||
|
@ -2494,7 +2494,7 @@ replace(PyBytesObject *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_len == 0) {
|
if (to_len == 0) {
|
||||||
/* delete all occurances of 'from' string */
|
/* delete all occurrences of 'from' string */
|
||||||
if (from_len == 1) {
|
if (from_len == 1) {
|
||||||
return replace_delete_single_character(
|
return replace_delete_single_character(
|
||||||
self, from_s[0], maxcount);
|
self, from_s[0], maxcount);
|
||||||
|
@ -2612,7 +2612,7 @@ _string_tailmatch(PyBytesObject *self, PyObject *substr, Py_ssize_t start,
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(startswith__doc__,
|
PyDoc_STRVAR(startswith__doc__,
|
||||||
"B.startswith(prefix [,start [,end]]) -> bool\n\
|
"B.startswith(prefix[, start[, end]]) -> bool\n\
|
||||||
\n\
|
\n\
|
||||||
Return True if B starts with the specified prefix, False otherwise.\n\
|
Return True if B starts with the specified prefix, False otherwise.\n\
|
||||||
With optional start, test B beginning at that position.\n\
|
With optional start, test B beginning at that position.\n\
|
||||||
|
@ -2653,7 +2653,7 @@ string_startswith(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(endswith__doc__,
|
PyDoc_STRVAR(endswith__doc__,
|
||||||
"B.endswith(suffix [,start [,end]]) -> bool\n\
|
"B.endswith(suffix[, start[, end]]) -> bool\n\
|
||||||
\n\
|
\n\
|
||||||
Return True if B ends with the specified suffix, False otherwise.\n\
|
Return True if B ends with the specified suffix, False otherwise.\n\
|
||||||
With optional start, test B beginning at that position.\n\
|
With optional start, test B beginning at that position.\n\
|
||||||
|
@ -2694,9 +2694,9 @@ string_endswith(PyBytesObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(decode__doc__,
|
PyDoc_STRVAR(decode__doc__,
|
||||||
"B.decode([encoding[, errors]]) -> object\n\
|
"B.decode([encoding[, errors]]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Decodes S using the codec registered for encoding. encoding defaults\n\
|
Decode S using the codec registered for encoding. encoding defaults\n\
|
||||||
to the default encoding. errors may be given to set a different error\n\
|
to the default encoding. errors may be given to set a different error\n\
|
||||||
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
||||||
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
|
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\
|
||||||
|
@ -3027,10 +3027,10 @@ str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(string_doc,
|
PyDoc_STRVAR(string_doc,
|
||||||
"bytes(iterable_of_ints) -> bytes.\n\
|
"bytes(iterable_of_ints) -> bytes\n\
|
||||||
bytes(string, encoding[, errors]) -> bytes\n\
|
bytes(string, encoding[, errors]) -> bytes\n\
|
||||||
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer.\n\
|
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\n\
|
||||||
bytes(memory_view) -> bytes.\n\
|
bytes(memory_view) -> bytes\n\
|
||||||
\n\
|
\n\
|
||||||
Construct an immutable array of bytes from:\n\
|
Construct an immutable array of bytes from:\n\
|
||||||
- an iterable yielding integers in range(256)\n\
|
- an iterable yielding integers in range(256)\n\
|
||||||
|
|
|
@ -6167,7 +6167,7 @@ nothing:
|
||||||
/* --- Unicode Object Methods --------------------------------------------- */
|
/* --- Unicode Object Methods --------------------------------------------- */
|
||||||
|
|
||||||
PyDoc_STRVAR(title__doc__,
|
PyDoc_STRVAR(title__doc__,
|
||||||
"S.title() -> unicode\n\
|
"S.title() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a titlecased version of S, i.e. words start with title case\n\
|
Return a titlecased version of S, i.e. words start with title case\n\
|
||||||
characters, all remaining cased characters have lower case.");
|
characters, all remaining cased characters have lower case.");
|
||||||
|
@ -6179,7 +6179,7 @@ unicode_title(PyUnicodeObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(capitalize__doc__,
|
PyDoc_STRVAR(capitalize__doc__,
|
||||||
"S.capitalize() -> unicode\n\
|
"S.capitalize() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a capitalized version of S, i.e. make the first character\n\
|
Return a capitalized version of S, i.e. make the first character\n\
|
||||||
have upper case.");
|
have upper case.");
|
||||||
|
@ -6192,7 +6192,7 @@ unicode_capitalize(PyUnicodeObject *self)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
PyDoc_STRVAR(capwords__doc__,
|
PyDoc_STRVAR(capwords__doc__,
|
||||||
"S.capwords() -> unicode\n\
|
"S.capwords() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Apply .capitalize() to all words in S and return the result with\n\
|
Apply .capitalize() to all words in S and return the result with\n\
|
||||||
normalized whitespace (all whitespace strings are replaced by ' ').");
|
normalized whitespace (all whitespace strings are replaced by ' ').");
|
||||||
|
@ -6256,7 +6256,7 @@ convert_uc(PyObject *obj, void *addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(center__doc__,
|
PyDoc_STRVAR(center__doc__,
|
||||||
"S.center(width[, fillchar]) -> unicode\n\
|
"S.center(width[, fillchar]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return S centered in a Unicode string of length width. Padding is\n\
|
Return S centered in a Unicode string of length width. Padding is\n\
|
||||||
done using the specified fill character (default is a space)");
|
done using the specified fill character (default is a space)");
|
||||||
|
@ -6601,9 +6601,9 @@ unicode_count(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(encode__doc__,
|
PyDoc_STRVAR(encode__doc__,
|
||||||
"S.encode([encoding[,errors]]) -> string or unicode\n\
|
"S.encode([encoding[, errors]]) -> bytes\n\
|
||||||
\n\
|
\n\
|
||||||
Encodes S using the codec registered for encoding. encoding defaults\n\
|
Encode S using the codec registered for encoding. encoding defaults\n\
|
||||||
to the default encoding. errors may be given to set a different error\n\
|
to the default encoding. errors may be given to set a different error\n\
|
||||||
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
handling scheme. Default is 'strict' meaning that encoding errors raise\n\
|
||||||
a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\
|
a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\
|
||||||
|
@ -6637,7 +6637,7 @@ unicode_encode(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(expandtabs__doc__,
|
PyDoc_STRVAR(expandtabs__doc__,
|
||||||
"S.expandtabs([tabsize]) -> unicode\n\
|
"S.expandtabs([tabsize]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of S where all tab characters are expanded using spaces.\n\
|
Return a copy of S where all tab characters are expanded using spaces.\n\
|
||||||
If tabsize is not given, a tab size of 8 characters is assumed.");
|
If tabsize is not given, a tab size of 8 characters is assumed.");
|
||||||
|
@ -6724,7 +6724,7 @@ unicode_expandtabs(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(find__doc__,
|
PyDoc_STRVAR(find__doc__,
|
||||||
"S.find(sub [,start [,end]]) -> int\n\
|
"S.find(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the lowest index in S where substring sub is found,\n\
|
Return the lowest index in S where substring sub is found,\n\
|
||||||
such that sub is contained within s[start:end]. Optional\n\
|
such that sub is contained within s[start:end]. Optional\n\
|
||||||
|
@ -6789,7 +6789,7 @@ unicode_hash(PyUnicodeObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(index__doc__,
|
PyDoc_STRVAR(index__doc__,
|
||||||
"S.index(sub [,start [,end]]) -> int\n\
|
"S.index(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like S.find() but raise ValueError when the substring is not found.");
|
Like S.find() but raise ValueError when the substring is not found.");
|
||||||
|
|
||||||
|
@ -7152,7 +7152,7 @@ unicode_isidentifier(PyObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(join__doc__,
|
PyDoc_STRVAR(join__doc__,
|
||||||
"S.join(sequence) -> unicode\n\
|
"S.join(sequence) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a string which is the concatenation of the strings in the\n\
|
Return a string which is the concatenation of the strings in the\n\
|
||||||
sequence. The separator between elements is S.");
|
sequence. The separator between elements is S.");
|
||||||
|
@ -7170,7 +7170,7 @@ unicode_length(PyUnicodeObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(ljust__doc__,
|
PyDoc_STRVAR(ljust__doc__,
|
||||||
"S.ljust(width[, fillchar]) -> int\n\
|
"S.ljust(width[, fillchar]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return S left justified in a Unicode string of length width. Padding is\n\
|
Return S left justified in a Unicode string of length width. Padding is\n\
|
||||||
done using the specified fill character (default is a space).");
|
done using the specified fill character (default is a space).");
|
||||||
|
@ -7193,7 +7193,7 @@ unicode_ljust(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(lower__doc__,
|
PyDoc_STRVAR(lower__doc__,
|
||||||
"S.lower() -> unicode\n\
|
"S.lower() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of the string S converted to lowercase.");
|
Return a copy of the string S converted to lowercase.");
|
||||||
|
|
||||||
|
@ -7302,7 +7302,7 @@ do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(strip__doc__,
|
PyDoc_STRVAR(strip__doc__,
|
||||||
"S.strip([chars]) -> unicode\n\
|
"S.strip([chars]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of the string S with leading and trailing\n\
|
Return a copy of the string S with leading and trailing\n\
|
||||||
whitespace removed.\n\
|
whitespace removed.\n\
|
||||||
|
@ -7320,7 +7320,7 @@ unicode_strip(PyUnicodeObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(lstrip__doc__,
|
PyDoc_STRVAR(lstrip__doc__,
|
||||||
"S.lstrip([chars]) -> unicode\n\
|
"S.lstrip([chars]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of the string S with leading whitespace removed.\n\
|
Return a copy of the string S with leading whitespace removed.\n\
|
||||||
If chars is given and not None, remove characters in chars instead.\n\
|
If chars is given and not None, remove characters in chars instead.\n\
|
||||||
|
@ -7337,7 +7337,7 @@ unicode_lstrip(PyUnicodeObject *self, PyObject *args)
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(rstrip__doc__,
|
PyDoc_STRVAR(rstrip__doc__,
|
||||||
"S.rstrip([chars]) -> unicode\n\
|
"S.rstrip([chars]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of the string S with trailing whitespace removed.\n\
|
Return a copy of the string S with trailing whitespace removed.\n\
|
||||||
If chars is given and not None, remove characters in chars instead.\n\
|
If chars is given and not None, remove characters in chars instead.\n\
|
||||||
|
@ -7444,7 +7444,7 @@ PyObject *PyUnicode_Replace(PyObject *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(replace__doc__,
|
PyDoc_STRVAR(replace__doc__,
|
||||||
"S.replace (old, new[, maxsplit]) -> unicode\n\
|
"S.replace (old, new[, maxsplit]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of S with all occurrences of substring\n\
|
Return a copy of S with all occurrences of substring\n\
|
||||||
old replaced by new. If the optional argument maxsplit is\n\
|
old replaced by new. If the optional argument maxsplit is\n\
|
||||||
|
@ -7616,7 +7616,7 @@ PyObject *unicode_repr(PyObject *unicode)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(rfind__doc__,
|
PyDoc_STRVAR(rfind__doc__,
|
||||||
"S.rfind(sub [,start [,end]]) -> int\n\
|
"S.rfind(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Return the highest index in S where substring sub is found,\n\
|
Return the highest index in S where substring sub is found,\n\
|
||||||
such that sub is contained within s[start:end]. Optional\n\
|
such that sub is contained within s[start:end]. Optional\n\
|
||||||
|
@ -7647,7 +7647,7 @@ unicode_rfind(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(rindex__doc__,
|
PyDoc_STRVAR(rindex__doc__,
|
||||||
"S.rindex(sub [,start [,end]]) -> int\n\
|
"S.rindex(sub[, start[, end]]) -> int\n\
|
||||||
\n\
|
\n\
|
||||||
Like S.rfind() but raise ValueError when the substring is not found.");
|
Like S.rfind() but raise ValueError when the substring is not found.");
|
||||||
|
|
||||||
|
@ -7678,7 +7678,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(rjust__doc__,
|
PyDoc_STRVAR(rjust__doc__,
|
||||||
"S.rjust(width[, fillchar]) -> unicode\n\
|
"S.rjust(width[, fillchar]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return S right justified in a Unicode string of length width. Padding is\n\
|
Return S right justified in a Unicode string of length width. Padding is\n\
|
||||||
done using the specified fill character (default is a space).");
|
done using the specified fill character (default is a space).");
|
||||||
|
@ -7725,7 +7725,7 @@ PyObject *PyUnicode_Split(PyObject *s,
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(split__doc__,
|
PyDoc_STRVAR(split__doc__,
|
||||||
"S.split([sep [,maxsplit]]) -> list of strings\n\
|
"S.split([sep[, maxsplit]]) -> list of strings\n\
|
||||||
\n\
|
\n\
|
||||||
Return a list of the words in S, using sep as the\n\
|
Return a list of the words in S, using sep as the\n\
|
||||||
delimiter string. If maxsplit is given, at most maxsplit\n\
|
delimiter string. If maxsplit is given, at most maxsplit\n\
|
||||||
|
@ -7808,7 +7808,7 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
|
||||||
PyDoc_STRVAR(partition__doc__,
|
PyDoc_STRVAR(partition__doc__,
|
||||||
"S.partition(sep) -> (head, sep, tail)\n\
|
"S.partition(sep) -> (head, sep, tail)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in S, and returns the part before it,\n\
|
Search for the separator sep in S, and return the part before it,\n\
|
||||||
the separator itself, and the part after it. If the separator is not\n\
|
the separator itself, and the part after it. If the separator is not\n\
|
||||||
found, returns S and two empty strings.");
|
found, returns S and two empty strings.");
|
||||||
|
|
||||||
|
@ -7821,7 +7821,7 @@ unicode_partition(PyUnicodeObject *self, PyObject *separator)
|
||||||
PyDoc_STRVAR(rpartition__doc__,
|
PyDoc_STRVAR(rpartition__doc__,
|
||||||
"S.rpartition(sep) -> (tail, sep, head)\n\
|
"S.rpartition(sep) -> (tail, sep, head)\n\
|
||||||
\n\
|
\n\
|
||||||
Searches for the separator sep in S, starting at the end of S, and returns\n\
|
Search for the separator sep in S, starting at the end of S, and return\n\
|
||||||
the part before it, the separator itself, and the part after it. If the\n\
|
the part before it, the separator itself, and the part after it. If the\n\
|
||||||
separator is not found, returns two empty strings and S.");
|
separator is not found, returns two empty strings and S.");
|
||||||
|
|
||||||
|
@ -7856,7 +7856,7 @@ PyObject *PyUnicode_RSplit(PyObject *s,
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(rsplit__doc__,
|
PyDoc_STRVAR(rsplit__doc__,
|
||||||
"S.rsplit([sep [,maxsplit]]) -> list of strings\n\
|
"S.rsplit([sep[, maxsplit]]) -> list of strings\n\
|
||||||
\n\
|
\n\
|
||||||
Return a list of the words in S, using sep as the\n\
|
Return a list of the words in S, using sep as the\n\
|
||||||
delimiter string, starting at the end of the string and\n\
|
delimiter string, starting at the end of the string and\n\
|
||||||
|
@ -7912,7 +7912,7 @@ PyObject *unicode_str(PyObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(swapcase__doc__,
|
PyDoc_STRVAR(swapcase__doc__,
|
||||||
"S.swapcase() -> unicode\n\
|
"S.swapcase() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of S with uppercase characters converted to lowercase\n\
|
Return a copy of S with uppercase characters converted to lowercase\n\
|
||||||
and vice versa.");
|
and vice versa.");
|
||||||
|
@ -8027,7 +8027,7 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(translate__doc__,
|
PyDoc_STRVAR(translate__doc__,
|
||||||
"S.translate(table) -> unicode\n\
|
"S.translate(table) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of the string S, where all characters have been mapped\n\
|
Return a copy of the string S, where all characters have been mapped\n\
|
||||||
through the given translation table, which must be a mapping of\n\
|
through the given translation table, which must be a mapping of\n\
|
||||||
|
@ -8042,7 +8042,7 @@ unicode_translate(PyUnicodeObject *self, PyObject *table)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(upper__doc__,
|
PyDoc_STRVAR(upper__doc__,
|
||||||
"S.upper() -> unicode\n\
|
"S.upper() -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Return a copy of S converted to uppercase.");
|
Return a copy of S converted to uppercase.");
|
||||||
|
|
||||||
|
@ -8053,7 +8053,7 @@ unicode_upper(PyUnicodeObject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(zfill__doc__,
|
PyDoc_STRVAR(zfill__doc__,
|
||||||
"S.zfill(width) -> unicode\n\
|
"S.zfill(width) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Pad a numeric string x with zeros on the left, to fill a field\n\
|
Pad a numeric string x with zeros on the left, to fill a field\n\
|
||||||
of the specified width. The string x is never truncated.");
|
of the specified width. The string x is never truncated.");
|
||||||
|
@ -8198,12 +8198,12 @@ unicode_endswith(PyUnicodeObject *self,
|
||||||
#include "stringlib/string_format.h"
|
#include "stringlib/string_format.h"
|
||||||
|
|
||||||
PyDoc_STRVAR(format__doc__,
|
PyDoc_STRVAR(format__doc__,
|
||||||
"S.format(*args, **kwargs) -> unicode\n\
|
"S.format(*args, **kwargs) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
");
|
");
|
||||||
|
|
||||||
PyDoc_STRVAR(p_format__doc__,
|
PyDoc_STRVAR(p_format__doc__,
|
||||||
"S.__format__(format_spec) -> unicode\n\
|
"S.__format__(format_spec) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
");
|
");
|
||||||
|
|
||||||
|
@ -9108,7 +9108,7 @@ unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(unicode_doc,
|
PyDoc_STRVAR(unicode_doc,
|
||||||
"str(string [, encoding[, errors]]) -> object\n\
|
"str(string[, encoding[, errors]]) -> str\n\
|
||||||
\n\
|
\n\
|
||||||
Create a new string object from the given encoded string.\n\
|
Create a new string object from the given encoded string.\n\
|
||||||
encoding defaults to the current default string encoding.\n\
|
encoding defaults to the current default string encoding.\n\
|
||||||
|
|
Loading…
Reference in New Issue