10000 Rearrange everything to be in the same order · python/cpython@434bc8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 434bc8b

Browse files
committed
Rearrange everything to be in the same order
1 parent db66076 commit 434bc8b

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

Lib/operator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ def truth(a):
5858
"Return True if a is true, False otherwise."
5959
return True if a else False
6060

61-
def is_none(a):
62-
"Same as a is None."
63-
return a is None
64-
6561
def is_(a, b):
6662
"Same as a is b."
6763
return a is b
@@ -70,6 +66,10 @@ def is_not(a, b):
7066
"Same as a is not b."
7167
return a is not b
7268

69+
def is_none(a):
70+
"Same as a is None."
71+
return a is None
72+
7373
# Mathematical/Bitwise Operations *********************************************#
7474

7575
def abs(a):

Lib/test/test_operator.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,6 @@ def test_bitwise_xor(self):
328328
self.assertRaises(TypeError, operator.xor, None, None)
329329
self.assertEqual(operator.xor(0xb, 0xc), 0x7)
330330

331-
def test_is_none(self):
332-
operator = self.module
333-
a = 'xyzpdq'
334-
b = ''
335-
c = None
336-
self.assertRaises(TypeError, operator.is_none)
337-
self.assertFalse(operator.is_none(a))
338-
self.assertFalse(operator.is_none(b))
339-
self.assertTrue(operator.is_none(c))
340-
341331
def test_is(self):
342332
operator = self.module
343333
a = b = 'xyzpdq'
@@ -354,6 +344,16 @@ def test_is_not(self):
354344
self.assertFalse(operator.is_not(a, b))
355345
self.assertTrue(operator.is_not(a,c))
356346

347+
def test_is_none(self):
348+
operator = self.module
349+
a = 'xyzpdq'
350+
b = ''
351+
c = None
352+
self.assertRaises(TypeError, operator.is_none)
353+
self.assertFalse(operator.is_none(a))
354+
self.assertFalse(operator.is_none(b))
355+
self.assertTrue(operator.is_none(c))
356+
357357
def test_attrgetter(self):
358358
operator = self.module
359359
class A:

Modules/_operator.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,6 @@ _operator_index(PyObject *module, PyObject *a)
698698
return PyNumber_Index(a);
699699
}
700700

701-
/*[clinic input]
702-
_operator.is_none = _operator.neg
703-
704-
Same as a is None.
705-
[clinic start generated code]*/
706-
707-
static PyObject *
708-
_operator_is_none(PyObject *module, PyObject *a)
709-
/*[clinic end generated code: output=07159cc102261dec input=0448b38af7b8533d]*/
710-
{
711-
PyObject *result = Py_IsNone(a) ? Py_True : Py_False;
712-
return Py_NewRef(result);
713-
}
714-
715701
/*[clinic input]
716702
_operator.is_ = _operator.add
717703
@@ -741,6 +727,20 @@ _operator_is_not_impl(PyObject *module, PyObject *a, PyObject *b)
741727
return Py_NewRef(result);
742728
}
743729

730+
/*[clinic input]
731+
_operator.is_none = _operator.neg
732+
733+
Same as a is None.
734+
[clinic start generated code]*/
735+
736+
static PyObject *
737+
_operator_is_none(PyObject *module, PyObject *a)
738+
/*[clinic end generated code: output=07159cc102261dec input=0448b38af7b8533d]*/
739+
{
740+
PyObject *result = Py_IsNone(a) ? Py_True : Py_False;
741+
return Py_NewRef(result);
742+
}
743+
744744
/* compare_digest **********************************************************/
745745

746746
/*
@@ -927,9 +927,9 @@ static struct PyMethodDef operator_methods[] = {
927927
_OPERATOR_CONTAINS_METHODDEF
928928
_OPERATOR_INDEXOF_METHODDEF
929929
_OPERATOR_COUNTOF_METHODDEF
930-
_OPERATOR_IS_NONE_METHODDEF
931930
_OPERATOR_IS__METHODDEF
932931
_OPERATOR_IS_NOT_METHODDEF
932+
_OPERATOR_IS_NONE_METHODDEF
933933
_OPERATOR_INDEX_METHODDEF
934934
_OPERATOR_ADD_METHODDEF
935935
_OPERATOR_SUB_METHODDEF

Modules/clinic/_operator.c.h

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0