Skip to content

Commit

Permalink
Revert "pythongh-100989: Fix regression in docstrings of collections.…
Browse files Browse the repository at this point in the history
…deque"

This reverts commit 317f39b.
  • Loading branch information
timobrembeck committed Mar 23, 2023
1 parent e59aed5 commit 104a686
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ deque_rotate(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
}

PyDoc_STRVAR(rotate_doc,
"rotate(n)\n"
"rotate(n)\n\n"
"Rotate the deque *n* steps to the right (default ``n=1``). "
"If *n* is negative, rotates left.");

Expand Down Expand Up @@ -953,7 +953,7 @@ deque_reverse(dequeobject *deque, PyObject *unused)
}

PyDoc_STRVAR(reverse_doc,
"reverse()\n"
"reverse()\n\n"
"Reverse the elements of the deque *IN PLACE*.");

static PyObject *
Expand Down Expand Up @@ -993,7 +993,7 @@ deque_count(dequeobject *deque, PyObject *v)
}

PyDoc_STRVAR(count_doc,
"count(x) -> int\n"
"count(x) -> int\n\n"
"Count the number of deque elements equal to *x*.");

static int
Expand Down Expand Up @@ -1102,9 +1102,10 @@ deque_index(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
}

PyDoc_STRVAR(index_doc,
"index(x, [start, [stop]]) -> int\n"
"Return first index of *x*. "
"Raises ValueError if *x* is not present.");
"index(x, [start, [stop]]) -> int\n\n"
"Return the position of *x* in the deque "
"(at or after index *start* and before index *stop*). "
"Returns the first match or raises a ValueError if not found.");

/* insert(), remove(), and delitem() are implemented in terms of
rotate() for simplicity and reasonable performance near the end
Expand Down Expand Up @@ -1149,11 +1150,11 @@ deque_insert(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
}

PyDoc_STRVAR(insert_doc,
"insert(i, x)\n"
"insert(i, x)\n\n"
"Insert *x* into the deque at position *i*.");

PyDoc_STRVAR(remove_doc,
"remove(x)\n"
"remove(x)\n\n"
"Remove the first occurrence of *x*."
"If not found, raises a ValueError.");

Expand Down Expand Up @@ -1526,7 +1527,7 @@ deque_sizeof(dequeobject *deque, void *unused)
}

PyDoc_STRVAR(sizeof_doc,
"__sizeof__() -> int\n"
"__sizeof__() -> int\n\n"
"Size of the deque in memory, in bytes.");

static PyObject *
Expand Down Expand Up @@ -1562,7 +1563,7 @@ static PySequenceMethods deque_as_sequence = {
static PyObject *deque_iter(dequeobject *deque);
static PyObject *deque_reviter(dequeobject *deque, PyObject *Py_UNUSED(ignored));
PyDoc_STRVAR(reversed_doc,
"__reversed__()\n"
"__reversed__()\n\n"
"Return a reverse iterator over the deque.");

static PyMethodDef deque_methods[] = {
Expand Down Expand Up @@ -1608,7 +1609,7 @@ static PyMethodDef deque_methods[] = {
};

PyDoc_STRVAR(deque_doc,
"deque([iterable[, maxlen]]) -> collections.deque\n"
"deque([iterable[, maxlen]]) -> collections.deque\n\n"
"A list-like sequence optimized for data accesses near its endpoints.");

static PyTypeObject deque_type = {
Expand Down Expand Up @@ -1988,7 +1989,7 @@ new_defdict(defdictobject *dd, PyObject *arg)
dd->default_factory ? dd->default_factory : Py_None, arg, NULL);
}

PyDoc_STRVAR(defdict_copy_doc, "copy() -> collections.deque\n"
PyDoc_STRVAR(defdict_copy_doc, "copy() -> collections.deque\n\n"
"A shallow copy of the deque.");

static PyObject *
Expand Down

0 comments on commit 104a686

Please sign in to comment.