Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
25ab7e2a
Commit
25ab7e2a
authored
Oct 19, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed several problems identified by pychecker
parent
41ec2d75
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
37 deletions
+30
-37
lib/python/StructuredText/DocumentClass.py
lib/python/StructuredText/DocumentClass.py
+6
-4
lib/python/StructuredText/ST.py
lib/python/StructuredText/ST.py
+7
-4
lib/python/StructuredText/STDOM.py
lib/python/StructuredText/STDOM.py
+16
-28
lib/python/StructuredText/StructuredText.py
lib/python/StructuredText/StructuredText.py
+1
-1
No files found.
lib/python/StructuredText/DocumentClass.py
View file @
25ab7e2a
...
...
@@ -149,8 +149,8 @@ class StructuredTextTable(ST.StructuredTextParagraph):
def
_getColorizableTexts
(
self
):
return
self
.
getColorizableTexts
()
def
_setColorizableTexts
(
self
):
return
self
.
setColorizableTexts
()
def
_setColorizableTexts
(
self
,
texts
):
return
self
.
setColorizableTexts
(
texts
)
# StructuredTextRow holds StructuredTextColumns
class
StructuredTextRow
(
ST
.
StructuredTextParagraph
):
...
...
@@ -238,9 +238,9 @@ class StructuredTextMarkup(STDOM.Element):
self
.
_attributes
=
kw
.
keys
()
for
k
,
v
in
kw
.
items
():
setattr
(
self
,
k
,
v
)
def
getChildren
(
self
,
type
=
type
,
lt
=
type
([])
):
def
getChildren
(
self
):
v
=
self
.
_value
if
type
(
v
)
is
not
lt
:
v
=
[
v
]
if
not
isinstance
(
v
,
ListType
)
:
v
=
[
v
]
return
v
def
getColorizableTexts
(
self
):
return
self
.
_value
,
...
...
@@ -934,6 +934,8 @@ class DocumentClass:
start,end = r.span()
text = s[start:end]
return (StructuredTextSGML(text),start,end)
else:
return None
def doc_xref(self, s,
...
...
lib/python/StructuredText/ST.py
View file @
25ab7e2a
...
...
@@ -12,6 +12,7 @@
##############################################################################
import
re
,
STDOM
from
types
import
ListType
#####################################################################
# Updated functions #
...
...
@@ -187,9 +188,9 @@ class StructuredTextParagraph(STDOM.Element):
self._attributes=kw.keys()
for k, v in kw.items(): setattr(self, k, v)
def getChildren(self
, type=type, lt=type([])
):
def getChildren(self):
src=self._src
if
type(src) is not lt
: src=[src]
if
not isinstance(src, ListType)
: src=[src]
return src+self._subs
def getAttribute(self, name):
...
...
@@ -198,6 +199,8 @@ class StructuredTextParagraph(STDOM.Element):
def getAttributeNode(self, name):
if hasattr(self, name):
return STDOM.Attr(name, getattr(self, name))
else:
return None
def getAttributes(self):
d={}
...
...
@@ -231,8 +234,8 @@ class StructuredTextParagraph(STDOM.Element):
create aliases for all above functions in the pythony way.
"""
def _get_Children(self
, type=type, lt=type([])
):
return self.getChildren(
type,lt
)
def _get_Children(self):
return self.getChildren()
def _get_Attribute(self, name):
return self.getAttribute(name)
...
...
lib/python/StructuredText/STDOM.py
View file @
25ab7e2a
...
...
@@ -121,7 +121,7 @@ class ParentNode:
"""
children
=
self
.
getChildren
()
if
not
children
:
return
None
n
=
chidren
[
-
1
]
n
=
chi
l
dren
[
-
1
]
if
type
(
n
)
in
sts
:
n
=
TextNode
(
n
)
return
n
.
__of__
(
self
)
...
...
@@ -168,11 +168,7 @@ class NodeWrapper(ParentNode):
i
=
i
+
1
return
None
def
getPreviousSibling
(
self
,
type
=
type
,
sts
=
StringTypes
,
getattr
=
getattr
):
def
getPreviousSibling
(
self
):
"""
The node immediately preceding this node. If
there is no such node, this returns None.
...
...
@@ -192,13 +188,13 @@ class NodeWrapper(ParentNode):
try
:
n
=
children
[
index
]
except
IndexError
:
return
None
else
:
if
type
(
n
)
in
st
s
:
if
type
(
n
)
in
StringType
s
:
n
=
TextNode
(
n
)
n
.
_DOMIndex
=
index
return
n
.
__of__
(
self
)
def
getNextSibling
(
self
,
type
=
type
,
sts
=
StringTypes
):
def
getNextSibling
(
self
):
"""
The node immediately preceding this node. If
there is no such node, this returns None.
...
...
@@ -218,7 +214,7 @@ class NodeWrapper(ParentNode):
except
IndexError
:
return
None
else
:
if
type
(
n
)
in
st
s
:
if
type
(
n
)
in
StringType
s
:
n
=
TextNode
(
n
)
n
.
_DOMIndex
=
index
return
n
.
__of__
(
self
)
...
...
@@ -239,15 +235,11 @@ class NodeWrapper(ParentNode):
def
_get_DOMIndex
(
self
,
children
,
getattr
=
getattr
):
return
self
.
_getDOMIndex
(
children
,
getattr
)
def
_get_PreviousSibling
(
self
,
type
=
type
,
sts
=
StringTypes
,
getattr
=
getattr
):
return
self
.
getPreviousSibling
(
type
,
sts
,
getattr
,
None
)
def
_get_PreviousSibling
(
self
):
return
self
.
getPreviousSibling
()
def
_get_NextSibling
(
self
,
type
=
type
,
sts
=
StringTypes
):
return
self
.
getNextSibling
(
type
,
sts
)
def
_get_NextSibling
(
self
):
return
self
.
getNextSibling
()
def
_get_OwnerDocument
(
self
):
return
self
.
getOwnerDocument
()
...
...
@@ -340,14 +332,10 @@ class Node(ParentNode):
def
_get_Children
(
self
):
return
self
.
getChildren
()
def
_get_PreviousSibling
(
self
,
type
=
type
,
sts
=
StringTypes
,
getattr
=
getattr
):
return
self
.
getPreviousSibling
(
type
,
sts
,
getattr
,
None
)
def
_get_PreviousSibling
(
self
):
return
self
.
getPreviousSibling
()
def
_get_NextSibling
(
self
,
type
=
type
,
sts
=
StringTypes
):
def
_get_NextSibling
(
self
):
return
self
.
getNextSibling
()
def
_get_Attributes
(
self
):
...
...
@@ -406,10 +394,10 @@ class Element(Node):
"""A code representing the type of the node."""
return
ELEMENT_NODE
def
getNodeValue
(
self
,
type
=
type
,
sts
=
StringTypes
):
def
getNodeValue
(
self
):
r
=
[]
for
c
in
self
.
getChildren
():
if
type
(
c
)
not
in
st
s
:
if
type
(
c
)
not
in
StringType
s
:
c
=
c
.
getNodeValue
()
r
.
append
(
c
)
return
''
.
join
(
r
)
...
...
@@ -479,8 +467,8 @@ class Element(Node):
def
_get_NodeType
(
self
):
return
self
.
getNodeType
()
def
_get_NodeValue
(
self
,
type
=
type
,
sts
=
StringTypes
):
return
self
.
getNodeValue
(
type
,
sts
)
def
_get_NodeValue
(
self
):
return
self
.
getNodeValue
()
def
_get_ParentNode
(
self
):
return
self
.
getParentNode
()
...
...
lib/python/StructuredText/StructuredText.py
View file @
25ab7e2a
...
...
@@ -15,7 +15,7 @@
use of StructuredTextNG """
import
HTMLClass
,
DocumentClass
,
ClassicDocumentClass
import
HTMLClass
,
DocumentClass
import
DocumentWithImages
,
HTMLWithImages
from
ST
import
Basic
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment