6b24f153d7
All of those patches are picked from upstream. xbps-src check python3-docutils works fine now!
47 lines
1.6 KiB
Diff
47 lines
1.6 KiB
Diff
From bf370651321ed721777fe0bb1c4bd4652eea354c Mon Sep 17 00:00:00 2001
|
|
From: Stephen Finucane <stephen@that.guru>
|
|
Date: Mon, 26 Aug 2019 23:13:04 +0000
|
|
Subject: [PATCH 16/26] Remove duplicate definition of
|
|
`nodes.Element.__contains__`.
|
|
|
|
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8363 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
|
|
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
|
|
---
|
|
docutils/nodes.py | 14 ++++++--------
|
|
1 file changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/docutils/nodes.py b/docutils/nodes.py
|
|
index 3d714a2..f8da02b 100644
|
|
--- a/docutils/nodes.py
|
|
+++ b/docutils/nodes.py
|
|
@@ -577,13 +577,6 @@ class Element(Node):
|
|
def __len__(self):
|
|
return len(self.children)
|
|
|
|
- def __contains__(self, key):
|
|
- # support both membership test for children and attributes
|
|
- # (has_key is translated to "in" by 2to3)
|
|
- if isinstance(key, basestring):
|
|
- return key in self.attributes
|
|
- return key in self.children
|
|
-
|
|
def __getitem__(self, key):
|
|
if isinstance(key, basestring):
|
|
return self.attributes[key]
|
|
@@ -668,7 +661,12 @@ class Element(Node):
|
|
has_key = hasattr
|
|
|
|
# support operator ``in``
|
|
- __contains__ = hasattr
|
|
+ def __contains__(self, key):
|
|
+ # support both membership test for children and attributes
|
|
+ # (has_key is translated to "in" by 2to3)
|
|
+ if isinstance(key, basestring):
|
|
+ return key in self.attributes
|
|
+ return key in self.children
|
|
|
|
def get_language_code(self, fallback=''):
|
|
"""Return node's language tag.
|
|
--
|
|
2.24.0.375.geb5ae68d41
|
|
|