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

Skip to content

Commit 163d7f0

Browse files
committed
Cosmetic fixes
1 parent f4b8e60 commit 163d7f0

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

Modules/_elementtree.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,9 @@ subelement(PyObject *self, PyObject *args, PyObject *kwds)
567567
PyObject* attrib = NULL;
568568
if (!PyArg_ParseTuple(args, "O!O|O!:SubElement",
569569
&Element_Type, &parent, &tag,
570-
&PyDict_Type, &attrib))
570+
&PyDict_Type, &attrib)) {
571571
return NULL;
572+
}
572573

573574
if (attrib) {
574575
/* attrib passed as positional arg */
@@ -652,7 +653,6 @@ element_dealloc(ElementObject* self)
652653
}
653654

654655
/* -------------------------------------------------------------------- */
655-
/* methods (in alphabetical order) */
656656

657657
static PyObject*
658658
element_append(ElementObject* self, PyObject* args)
@@ -696,8 +696,7 @@ element_copy(ElementObject* self, PyObject* args)
696696
return NULL;
697697

698698
element = (ElementObject*) create_new_element(
699-
self->tag, (self->extra) ? self->extra->attrib : Py_None
700-
);
699+
self->tag, (self->extra) ? self->extra->attrib : Py_None);
701700
if (!element)
702701
return NULL;
703702

@@ -710,7 +709,6 @@ element_copy(ElementObject* self, PyObject* args)
710709
Py_INCREF(JOIN_OBJ(element->tail));
711710

712711
if (self->extra) {
713-
714712
if (element_resize(element, self->extra->length) < 0) {
715713
Py_DECREF(element);
716714
return NULL;
@@ -722,7 +720,6 @@ element_copy(ElementObject* self, PyObject* args)
722720
}
723721

724722
element->extra->length = self->extra->length;
725-
726723
}
727724

728725
return (PyObject*) element;
@@ -779,7 +776,6 @@ element_deepcopy(ElementObject* self, PyObject* args)
779776
element->tail = JOIN_SET(tail, JOIN_GET(self->tail));
780777

781778
if (self->extra) {
782-
783779
if (element_resize(element, self->extra->length) < 0)
784780
goto error;
785781

@@ -793,7 +789,6 @@ element_deepcopy(ElementObject* self, PyObject* args)
793789
}
794790

795791
element->extra->length = self->extra->length;
796-
797792
}
798793

799794
/* add object to memo dictionary (so deepcopy won't visit it again) */
@@ -1141,8 +1136,8 @@ element_findtext(ElementObject *self, PyObject *args, PyObject *kwds)
11411136

11421137
for (i = 0; i < self->extra->length; i++) {
11431138
ElementObject* item = (ElementObject*) self->extra->children[i];
1144-
if (Element_CheckExact(item) && (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) {
1145-
1139+
if (Element_CheckExact(item) &&
1140+
(PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) {
11461141
PyObject* text = element_get_text(item);
11471142
if (text == Py_None)
11481143
return PyUnicode_New(0, 0);
@@ -1207,12 +1202,12 @@ element_iterfind(ElementObject *self, PyObject *args, PyObject *kwds)
12071202
elementtreestate *st = ET_STATE_GLOBAL;
12081203

12091204
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:iterfind", kwlist,
1210-
&tag, &namespaces))
1205+
&tag, &namespaces)) {
12111206
return NULL;
1207+
}
12121208

12131209
return _PyObject_CallMethodId(
1214-
st->elementpath_obj, &PyId_iterfind, "OOO", self, tag, namespaces
1215-
);
1210+
st->elementpath_obj, &PyId_iterfind, "OOO", self, tag, namespaces);
12161211
}
12171212

12181213
static PyObject*

0 commit comments

Comments
 (0)