mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Patch #568124: Add doc string macros.
This commit is contained in:
parent
654c11ee3a
commit
14f8b4cfcb
63 changed files with 1509 additions and 1625 deletions
|
|
@ -1,14 +1,14 @@
|
|||
/* strop module */
|
||||
|
||||
static char strop_module__doc__[] =
|
||||
#include "Python.h"
|
||||
#include <ctype.h>
|
||||
|
||||
PyDoc_STRVAR(strop_module__doc__,
|
||||
"Common string manipulations, optimized for speed.\n"
|
||||
"\n"
|
||||
"Always use \"import string\" rather than referencing\n"
|
||||
"this module directly.";
|
||||
"this module directly.");
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#include <ctype.h>
|
||||
/* XXX This file assumes that the <ctype.h> is*() functions
|
||||
XXX are defined for all 8-bit characters! */
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ split_whitespace(char *s, int len, int maxsplit)
|
|||
}
|
||||
|
||||
|
||||
static char splitfields__doc__[] =
|
||||
PyDoc_STRVAR(splitfields__doc__,
|
||||
"split(s [,sep [,maxsplit]]) -> list of strings\n"
|
||||
"splitfields(s [,sep [,maxsplit]]) -> list of strings\n"
|
||||
"\n"
|
||||
|
|
@ -89,7 +89,7 @@ static char splitfields__doc__[] =
|
|||
"maxsplit words. If sep is not specified, any whitespace string\n"
|
||||
"is a separator. Maxsplit defaults to 0.\n"
|
||||
"\n"
|
||||
"(split and splitfields are synonymous)";
|
||||
"(split and splitfields are synonymous)");
|
||||
|
||||
static PyObject *
|
||||
strop_splitfields(PyObject *self, PyObject *args)
|
||||
|
|
@ -151,7 +151,7 @@ strop_splitfields(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char joinfields__doc__[] =
|
||||
PyDoc_STRVAR(joinfields__doc__,
|
||||
"join(list [,sep]) -> string\n"
|
||||
"joinfields(list [,sep]) -> string\n"
|
||||
"\n"
|
||||
|
|
@ -159,7 +159,7 @@ static char joinfields__doc__[] =
|
|||
"intervening occurrences of sep. Sep defaults to a single\n"
|
||||
"space.\n"
|
||||
"\n"
|
||||
"(join and joinfields are synonymous)";
|
||||
"(join and joinfields are synonymous)");
|
||||
|
||||
static PyObject *
|
||||
strop_joinfields(PyObject *self, PyObject *args)
|
||||
|
|
@ -274,14 +274,14 @@ strop_joinfields(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char find__doc__[] =
|
||||
PyDoc_STRVAR(find__doc__,
|
||||
"find(s, sub [,start [,end]]) -> in\n"
|
||||
"\n"
|
||||
"Return the lowest index in s where substring sub is found,\n"
|
||||
"such that sub is contained within s[start,end]. Optional\n"
|
||||
"arguments start and end are interpreted as in slice notation.\n"
|
||||
"\n"
|
||||
"Return -1 on failure.";
|
||||
"Return -1 on failure.");
|
||||
|
||||
static PyObject *
|
||||
strop_find(PyObject *self, PyObject *args)
|
||||
|
|
@ -317,14 +317,14 @@ strop_find(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char rfind__doc__[] =
|
||||
PyDoc_STRVAR(rfind__doc__,
|
||||
"rfind(s, sub [,start [,end]]) -> int\n"
|
||||
"\n"
|
||||
"Return the highest index in s where substring sub is found,\n"
|
||||
"such that sub is contained within s[start,end]. Optional\n"
|
||||
"arguments start and end are interpreted as in slice notation.\n"
|
||||
"\n"
|
||||
"Return -1 on failure.";
|
||||
"Return -1 on failure.");
|
||||
|
||||
static PyObject *
|
||||
strop_rfind(PyObject *self, PyObject *args)
|
||||
|
|
@ -394,11 +394,11 @@ do_strip(PyObject *args, int striptype)
|
|||
}
|
||||
|
||||
|
||||
static char strip__doc__[] =
|
||||
PyDoc_STRVAR(strip__doc__,
|
||||
"strip(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s with leading and trailing\n"
|
||||
"whitespace removed.";
|
||||
"whitespace removed.");
|
||||
|
||||
static PyObject *
|
||||
strop_strip(PyObject *self, PyObject *args)
|
||||
|
|
@ -408,10 +408,10 @@ strop_strip(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char lstrip__doc__[] =
|
||||
PyDoc_STRVAR(lstrip__doc__,
|
||||
"lstrip(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s with leading whitespace removed.";
|
||||
"Return a copy of the string s with leading whitespace removed.");
|
||||
|
||||
static PyObject *
|
||||
strop_lstrip(PyObject *self, PyObject *args)
|
||||
|
|
@ -421,10 +421,10 @@ strop_lstrip(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char rstrip__doc__[] =
|
||||
PyDoc_STRVAR(rstrip__doc__,
|
||||
"rstrip(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s with trailing whitespace removed.";
|
||||
"Return a copy of the string s with trailing whitespace removed.");
|
||||
|
||||
static PyObject *
|
||||
strop_rstrip(PyObject *self, PyObject *args)
|
||||
|
|
@ -434,10 +434,10 @@ strop_rstrip(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char lower__doc__[] =
|
||||
PyDoc_STRVAR(lower__doc__,
|
||||
"lower(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s converted to lowercase.";
|
||||
"Return a copy of the string s converted to lowercase.");
|
||||
|
||||
static PyObject *
|
||||
strop_lower(PyObject *self, PyObject *args)
|
||||
|
|
@ -473,10 +473,10 @@ strop_lower(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char upper__doc__[] =
|
||||
PyDoc_STRVAR(upper__doc__,
|
||||
"upper(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s converted to uppercase.";
|
||||
"Return a copy of the string s converted to uppercase.");
|
||||
|
||||
static PyObject *
|
||||
strop_upper(PyObject *self, PyObject *args)
|
||||
|
|
@ -512,11 +512,11 @@ strop_upper(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char capitalize__doc__[] =
|
||||
PyDoc_STRVAR(capitalize__doc__,
|
||||
"capitalize(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s with only its first character\n"
|
||||
"capitalized.";
|
||||
"capitalized.");
|
||||
|
||||
static PyObject *
|
||||
strop_capitalize(PyObject *self, PyObject *args)
|
||||
|
|
@ -561,13 +561,13 @@ strop_capitalize(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char expandtabs__doc__[] =
|
||||
PyDoc_STRVAR(expandtabs__doc__,
|
||||
"expandtabs(string, [tabsize]) -> string\n"
|
||||
"\n"
|
||||
"Expand tabs in a string, i.e. replace them by one or more spaces,\n"
|
||||
"depending on the current column and the given tab size (default 8).\n"
|
||||
"The column number is reset to zero after each newline occurring in the\n"
|
||||
"string. This doesn't understand other non-printing characters.";
|
||||
"string. This doesn't understand other non-printing characters.");
|
||||
|
||||
static PyObject *
|
||||
strop_expandtabs(PyObject *self, PyObject *args)
|
||||
|
|
@ -633,12 +633,12 @@ strop_expandtabs(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char count__doc__[] =
|
||||
PyDoc_STRVAR(count__doc__,
|
||||
"count(s, sub[, start[, end]]) -> int\n"
|
||||
"\n"
|
||||
"Return the number of occurrences of substring sub in string\n"
|
||||
"s[start:end]. Optional arguments start and end are\n"
|
||||
"interpreted as in slice notation.";
|
||||
"interpreted as in slice notation.");
|
||||
|
||||
static PyObject *
|
||||
strop_count(PyObject *self, PyObject *args)
|
||||
|
|
@ -678,11 +678,11 @@ strop_count(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char swapcase__doc__[] =
|
||||
PyDoc_STRVAR(swapcase__doc__,
|
||||
"swapcase(s) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s with upper case characters\n"
|
||||
"converted to lowercase and vice versa.";
|
||||
"converted to lowercase and vice versa.");
|
||||
|
||||
static PyObject *
|
||||
strop_swapcase(PyObject *self, PyObject *args)
|
||||
|
|
@ -723,7 +723,7 @@ strop_swapcase(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char atoi__doc__[] =
|
||||
PyDoc_STRVAR(atoi__doc__,
|
||||
"atoi(s [,base]) -> int\n"
|
||||
"\n"
|
||||
"Return the integer represented by the string s in the given\n"
|
||||
|
|
@ -731,7 +731,7 @@ static char atoi__doc__[] =
|
|||
"or more digits, possibly preceded by a sign. If base is 0, it\n"
|
||||
"is chosen from the leading characters of s, 0 for octal, 0x or\n"
|
||||
"0X for hexadecimal. If base is 16, a preceding 0x or 0X is\n"
|
||||
"accepted.";
|
||||
"accepted.");
|
||||
|
||||
static PyObject *
|
||||
strop_atoi(PyObject *self, PyObject *args)
|
||||
|
|
@ -778,7 +778,7 @@ strop_atoi(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char atol__doc__[] =
|
||||
PyDoc_STRVAR(atol__doc__,
|
||||
"atol(s [,base]) -> long\n"
|
||||
"\n"
|
||||
"Return the long integer represented by the string s in the\n"
|
||||
|
|
@ -787,7 +787,7 @@ static char atol__doc__[] =
|
|||
"is 0, it is chosen from the leading characters of s, 0 for\n"
|
||||
"octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n"
|
||||
"0x or 0X is accepted. A trailing L or l is not accepted,\n"
|
||||
"unless base is 0.";
|
||||
"unless base is 0.");
|
||||
|
||||
static PyObject *
|
||||
strop_atol(PyObject *self, PyObject *args)
|
||||
|
|
@ -830,10 +830,10 @@ strop_atol(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char atof__doc__[] =
|
||||
PyDoc_STRVAR(atof__doc__,
|
||||
"atof(s) -> float\n"
|
||||
"\n"
|
||||
"Return the floating point number represented by the string s.";
|
||||
"Return the floating point number represented by the string s.");
|
||||
|
||||
static PyObject *
|
||||
strop_atof(PyObject *self, PyObject *args)
|
||||
|
|
@ -874,12 +874,12 @@ strop_atof(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char maketrans__doc__[] =
|
||||
PyDoc_STRVAR(maketrans__doc__,
|
||||
"maketrans(frm, to) -> string\n"
|
||||
"\n"
|
||||
"Return a translation table (a string of 256 bytes long)\n"
|
||||
"suitable for use in string.translate. The strings frm and to\n"
|
||||
"must be of the same length.";
|
||||
"must be of the same length.");
|
||||
|
||||
static PyObject *
|
||||
strop_maketrans(PyObject *self, PyObject *args)
|
||||
|
|
@ -910,13 +910,13 @@ strop_maketrans(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
|
||||
static char translate__doc__[] =
|
||||
PyDoc_STRVAR(translate__doc__,
|
||||
"translate(s,table [,deletechars]) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of the string s, where all characters occurring\n"
|
||||
"in the optional argument deletechars are removed, and the\n"
|
||||
"remaining characters have been mapped through the given\n"
|
||||
"translation table, which must be a string of length 256.";
|
||||
"translation table, which must be a string of length 256.");
|
||||
|
||||
static PyObject *
|
||||
strop_translate(PyObject *self, PyObject *args)
|
||||
|
|
@ -1126,12 +1126,12 @@ mymemreplace(const char *str, int len, /* input string */
|
|||
}
|
||||
|
||||
|
||||
static char replace__doc__[] =
|
||||
PyDoc_STRVAR(replace__doc__,
|
||||
"replace (str, old, new[, maxsplit]) -> string\n"
|
||||
"\n"
|
||||
"Return a copy of string str with all occurrences of substring\n"
|
||||
"old replaced by new. If the optional argument maxsplit is\n"
|
||||
"given, only the first maxsplit occurrences are replaced.";
|
||||
"given, only the first maxsplit occurrences are replaced.");
|
||||
|
||||
static PyObject *
|
||||
strop_replace(PyObject *self, PyObject *args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue