Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed4a1c5

Browse files
committed
Argument Clinic: rename "self" to "module" for module-level functions.
1 parent fd32fff commit ed4a1c5

10 files changed

Lines changed: 88 additions & 79 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo)
551551

552552
/*[clinic]
553553
module curses
554-
555554
class curses.window
556555
557556
curses.window.addch

Modules/_datetimemodule.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,9 +4141,10 @@ datetime_best_possible(PyObject *cls, TM_FUNC f, PyObject *tzinfo)
41414141

41424142
/*[clinic]
41434143
module datetime
4144+
class datetime.datetime
41444145
41454146
@classmethod
4146-
datetime.now
4147+
datetime.datetime.now
41474148
41484149
tz: object = None
41494150
Timezone object.
@@ -4153,23 +4154,23 @@ Returns new datetime object representing current time local to tz.
41534154
If no tz is specified, uses local timezone.
41544155
[clinic]*/
41554156

4156-
PyDoc_STRVAR(datetime_now__doc__,
4157+
PyDoc_STRVAR(datetime_datetime_now__doc__,
41574158
"Returns new datetime object representing current time local to tz.\n"
41584159
"\n"
4159-
"datetime.now(tz=None)\n"
4160+
"datetime.datetime.now(tz=None)\n"
41604161
" tz\n"
41614162
" Timezone object.\n"
41624163
"\n"
41634164
"If no tz is specified, uses local timezone.");
41644165

4165-
#define DATETIME_NOW_METHODDEF \
4166-
{"now", (PyCFunction)datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_now__doc__},
4166+
#define DATETIME_DATETIME_NOW_METHODDEF \
4167+
{"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
41674168

41684169
static PyObject *
4169-
datetime_now_impl(PyObject *cls, PyObject *tz);
4170+
datetime_datetime_now_impl(PyObject *cls, PyObject *tz);
41704171

41714172
static PyObject *
4172-
datetime_now(PyObject *cls, PyObject *args, PyObject *kwargs)
4173+
datetime_datetime_now(PyObject *cls, PyObject *args, PyObject *kwargs)
41734174
{
41744175
PyObject *return_value = NULL;
41754176
static char *_keywords[] = {"tz", NULL};
@@ -4179,15 +4180,15 @@ datetime_now(PyObject *cls, PyObject *args, PyObject *kwargs)
41794180
"|O:now", _keywords,
41804181
&tz))
41814182
goto exit;
4182-
return_value = datetime_now_impl(cls, tz);
4183+
return_value = datetime_datetime_now_impl(cls, tz);
41834184

41844185
exit:
41854186
return return_value;
41864187
}
41874188

41884189
static PyObject *
4189-
datetime_now_impl(PyObject *cls, PyObject *tz)
4190-
/*[clinic checksum: 328b54387f4c2f8cb534997e1bd55f8cb38c4992]*/
4190+
datetime_datetime_now_impl(PyObject *cls, PyObject *tz)
4191+
/*[clinic checksum: cde1daca68c9b7dca6df51759db2de1d43a39774]*/
41914192
{
41924193
PyObject *self;
41934194

@@ -5037,7 +5038,7 @@ static PyMethodDef datetime_methods[] = {
50375038

50385039
/* Class methods: */
50395040

5040-
DATETIME_NOW_METHODDEF
5041+
DATETIME_DATETIME_NOW_METHODDEF
50415042

50425043
{"utcnow", (PyCFunction)datetime_utcnow,
50435044
METH_NOARGS | METH_CLASS,

Modules/_dbmmodule.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ PyDoc_STRVAR(dbmopen__doc__,
415415
{"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
416416

417417
static PyObject *
418-
dbmopen_impl(PyObject *self, const char *filename, const char *flags, int mode);
418+
dbmopen_impl(PyObject *module, const char *filename, const char *flags, int mode);
419419

420420
static PyObject *
421-
dbmopen(PyObject *self, PyObject *args)
421+
dbmopen(PyObject *module, PyObject *args)
422422
{
423423
PyObject *return_value = NULL;
424424
const char *filename;
@@ -429,15 +429,15 @@ dbmopen(PyObject *self, PyObject *args)
429429
"s|si:open",
430430
&filename, &flags, &mode))
431431
goto exit;
432-
return_value = dbmopen_impl(self, filename, flags, mode);
432+
return_value = dbmopen_impl(module, filename, flags, mode);
433433

434434
exit:
435435
return return_value;
436436
}
437437

438438
static PyObject *
439-
dbmopen_impl(PyObject *self, const char *filename, const char *flags, int mode)
440-
/*[clinic checksum: 61007c796d38af85c8035afa769fb4bb453429ee]*/
439+
dbmopen_impl(PyObject *module, const char *filename, const char *flags, int mode)
440+
/*[clinic checksum: 2b0ec9e3c6ecd19e06d16c9f0ba33848245cb1ab]*/
441441
{
442442
int iflags;
443443

Modules/_weakref.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
2525
{"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
2626

2727
static Py_ssize_t
28-
_weakref_getweakrefcount_impl(PyObject *self, PyObject *object);
28+
_weakref_getweakrefcount_impl(PyObject *module, PyObject *object);
2929

3030
static PyObject *
31-
_weakref_getweakrefcount(PyObject *self, PyObject *object)
31+
_weakref_getweakrefcount(PyObject *module, PyObject *object)
3232
{
3333
PyObject *return_value = NULL;
3434
Py_ssize_t _return_value;
35-
_return_value = _weakref_getweakrefcount_impl(self, object);
35+
_return_value = _weakref_getweakrefcount_impl(module, object);
3636
if ((_return_value == -1) && PyErr_Occurred())
3737
goto exit;
3838
return_value = PyLong_FromSsize_t(_return_value);
@@ -42,8 +42,8 @@ _weakref_getweakrefcount(PyObject *self, PyObject *object)
4242
}
4343

4444
static Py_ssize_t
45-
_weakref_getweakrefcount_impl(PyObject *self, PyObject *object)
46-
/*[clinic checksum: 0b7e7ddd87d483719ebac0fba364fff0ed0182d9]*/
45+
_weakref_getweakrefcount_impl(PyObject *module, PyObject *object)
46+
/*[clinic checksum: 05cffbc3a4b193a0b7e645da81be281748704f69]*/
4747
{
4848
PyWeakReference **list;
4949

Modules/posixmodule.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,10 +2460,10 @@ PyDoc_STRVAR(os_stat__doc__,
24602460
{"stat", (PyCFunction)os_stat, METH_VARARGS|METH_KEYWORDS, os_stat__doc__},
24612461

24622462
static PyObject *
2463-
os_stat_impl(PyObject *self, path_t *path, int dir_fd, int follow_symlinks);
2463+
os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks);
24642464

24652465
static PyObject *
2466-
os_stat(PyObject *self, PyObject *args, PyObject *kwargs)
2466+
os_stat(PyObject *module, PyObject *args, PyObject *kwargs)
24672467
{
24682468
PyObject *return_value = NULL;
24692469
static char *_keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
@@ -2475,7 +2475,7 @@ os_stat(PyObject *self, PyObject *args, PyObject *kwargs)
24752475
"O&|$O&p:stat", _keywords,
24762476
path_converter, &path, OS_STAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
24772477
goto exit;
2478-
return_value = os_stat_impl(self, &path, dir_fd, follow_symlinks);
2478+
return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks);
24792479

24802480
exit:
24812481
/* Cleanup for path */
@@ -2485,8 +2485,8 @@ os_stat(PyObject *self, PyObject *args, PyObject *kwargs)
24852485
}
24862486

24872487
static PyObject *
2488-
os_stat_impl(PyObject *self, path_t *path, int dir_fd, int follow_symlinks)
2489-
/*[clinic checksum: 9d9af08e8cfafd12f94e73ea3065eb3056f99515]*/
2488+
os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks)
2489+
/*[clinic checksum: 89390f78327e3f045a81974d758d3996e2a71f68]*/
24902490
{
24912491
return posix_do_stat("stat", path, dir_fd, follow_symlinks);
24922492
}
@@ -2600,10 +2600,10 @@ PyDoc_STRVAR(os_access__doc__,
26002600
{"access", (PyCFunction)os_access, METH_VARARGS|METH_KEYWORDS, os_access__doc__},
26012601

26022602
static PyObject *
2603-
os_access_impl(PyObject *self, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks);
2603+
os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks);
26042604

26052605
static PyObject *
2606-
os_access(PyObject *self, PyObject *args, PyObject *kwargs)
2606+
os_access(PyObject *module, PyObject *args, PyObject *kwargs)
26072607
{
26082608
PyObject *return_value = NULL;
26092609
static char *_keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL};
@@ -2617,7 +2617,7 @@ os_access(PyObject *self, PyObject *args, PyObject *kwargs)
26172617
"O&i|$O&pp:access", _keywords,
26182618
path_converter, &path, &mode, OS_STAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks))
26192619
goto exit;
2620-
return_value = os_access_impl(self, &path, mode, dir_fd, effective_ids, follow_symlinks);
2620+
return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks);
26212621

26222622
exit:
26232623
/* Cleanup for path */
@@ -2627,8 +2627,8 @@ os_access(PyObject *self, PyObject *args, PyObject *kwargs)
26272627
}
26282628

26292629
static PyObject *
2630-
os_access_impl(PyObject *self, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
2631-
/*[clinic checksum: 0147557eb43243df57ba616cc7c35f232c69bc6a]*/
2630+
os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
2631+
/*[clinic checksum: aa3e145816a748172e62df8e44af74169c7e1247]*/
26322632
{
26332633
PyObject *return_value = NULL;
26342634

@@ -2734,10 +2734,10 @@ PyDoc_STRVAR(os_ttyname__doc__,
27342734
{"ttyname", (PyCFunction)os_ttyname, METH_VARARGS, os_ttyname__doc__},
27352735

27362736
static char *
2737-
os_ttyname_impl(PyObject *self, int fd);
2737+
os_ttyname_impl(PyObject *module, int fd);
27382738

27392739
static PyObject *
2740-
os_ttyname(PyObject *self, PyObject *args)
2740+
os_ttyname(PyObject *module, PyObject *args)
27412741
{
27422742
PyObject *return_value = NULL;
27432743
int fd;
@@ -2747,7 +2747,7 @@ os_ttyname(PyObject *self, PyObject *args)
27472747
"i:ttyname",
27482748
&fd))
27492749
goto exit;
2750-
_return_value = os_ttyname_impl(self, fd);
2750+
_return_value = os_ttyname_impl(module, fd);
27512751
if (_return_value == NULL)
27522752
goto exit;
27532753
return_value = PyUnicode_DecodeFSDefault(_return_value);
@@ -2757,8 +2757,8 @@ os_ttyname(PyObject *self, PyObject *args)
27572757
}
27582758

27592759
static char *
2760-
os_ttyname_impl(PyObject *self, int fd)
2761-
/*[clinic checksum: ea680155d87bb733f542d67653eca732dd0981a8]*/
2760+
os_ttyname_impl(PyObject *module, int fd)
2761+
/*[clinic checksum: c742dd621ec98d0f81d37d264e1d3c89c7a5fb1a]*/
27622762
{
27632763
char *ret;
27642764

Modules/unicodedata.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ static Py_UCS4 getuchar(PyUnicodeObject *obj)
109109

110110
/*[clinic]
111111
module unicodedata
112-
unicodedata.decimal
112+
class unicodedata.UCD
113+
unicodedata.UCD.decimal
113114
114115
unichr: object(type='str')
115116
default: object=NULL
@@ -122,23 +123,23 @@ as integer. If no such value is defined, default is returned, or, if
122123
not given, ValueError is raised.
123124
[clinic]*/
124125

125-
PyDoc_STRVAR(unicodedata_decimal__doc__,
126+
PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
126127
"Converts a Unicode character into its equivalent decimal value.\n"
127128
"\n"
128-
"unicodedata.decimal(unichr, default=None)\n"
129+
"unicodedata.UCD.decimal(unichr, default=None)\n"
129130
"\n"
130131
"Returns the decimal value assigned to the Unicode character unichr\n"
131132
"as integer. If no such value is defined, default is returned, or, if\n"
132133
"not given, ValueError is raised.");
133134

134-
#define UNICODEDATA_DECIMAL_METHODDEF \
135-
{"decimal", (PyCFunction)unicodedata_decimal, METH_VARARGS, unicodedata_decimal__doc__},
135+
#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
136+
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
136137

137138
static PyObject *
138-
unicodedata_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value);
139+
unicodedata_UCD_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value);
139140

140141
static PyObject *
141-
unicodedata_decimal(PyObject *self, PyObject *args)
142+
unicodedata_UCD_decimal(PyObject *self, PyObject *args)
142143
{
143144
PyObject *return_value = NULL;
144145
PyObject *unichr;
@@ -148,15 +149,15 @@ unicodedata_decimal(PyObject *self, PyObject *args)
148149
"O!|O:decimal",
149150
&PyUnicode_Type, &unichr, &default_value))
150151
goto exit;
151-
return_value = unicodedata_decimal_impl(self, unichr, default_value);
152+
return_value = unicodedata_UCD_decimal_impl(self, unichr, default_value);
152153

153154
exit:
154155
return return_value;
155156
}
156157

157158
static PyObject *
158-
unicodedata_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value)
159-
/*[clinic checksum: 76c8d1c3dbee495d4cfd86ca6829543a3129344a]*/
159+
unicodedata_UCD_decimal_impl(PyObject *self, PyObject *unichr, PyObject *default_value)
160+
/*[clinic checksum: a0980c387387287e2ac230c37d95b26f6903e0d2]*/
160161
{
161162
PyUnicodeObject *v = (PyUnicodeObject *)unichr;
162163
int have_old = 0;
@@ -1288,7 +1289,7 @@ unicodedata_lookup(PyObject* self, PyObject* args)
12881289
/* XXX Add doc strings. */
12891290

12901291
static PyMethodDef unicodedata_functions[] = {
1291-
UNICODEDATA_DECIMAL_METHODDEF
1292+
UNICODEDATA_UCD_DECIMAL_METHODDEF
12921293
{"digit", unicodedata_digit, METH_VARARGS, unicodedata_digit__doc__},
12931294
{"numeric", unicodedata_numeric, METH_VARARGS, unicodedata_numeric__doc__},
12941295
{"category", unicodedata_category, METH_VARARGS,

0 commit comments

Comments
 (0)