Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ddb48674
Commit
ddb48674
authored
Sep 23, 2000
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conform more closely with the Python style guide.
parent
7be31158
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Lib/xml/sax/expatreader.py
Lib/xml/sax/expatreader.py
+11
-11
No files found.
Lib/xml/sax/expatreader.py
View file @
ddb48674
...
...
@@ -22,7 +22,7 @@ import xml.sax
# --- ExpatParser
class
ExpatParser
(
xmlreader
.
IncrementalParser
,
xmlreader
.
Locator
):
class
ExpatParser
(
xmlreader
.
IncrementalParser
,
xmlreader
.
Locator
):
"SAX driver for the Pyexpat C module."
def
__init__
(
self
,
namespaceHandling
=
0
,
bufsize
=
2
**
16
-
20
):
...
...
@@ -34,12 +34,12 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
# XMLReader methods
def
parse
(
self
,
stream_or_string
):
def
parse
(
self
,
stream_or_string
):
"Parse an XML document from a URL."
if
type
(
stream_or_string
)
==
type
(
""
):
stream
=
open
(
stream_or_string
)
if
type
(
stream_or_string
)
is
type
(
""
):
stream
=
open
(
stream_or_string
)
else
:
stream
=
stream_or_string
stream
=
stream_or_string
self
.
reset
()
self
.
_cont_handler
.
setDocumentLocator
(
self
)
...
...
@@ -78,7 +78,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
def
feed
(
self
,
data
):
if
not
self
.
_parsing
:
self
.
_parsing
=
1
self
.
_parsing
=
1
self
.
reset
()
self
.
_cont_handler
.
startDocument
()
# FIXME: error checking and endDocument()
...
...
@@ -87,7 +87,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
def
close
(
self
):
if
self
.
_parsing
:
self
.
_cont_handler
.
endDocument
()
self
.
_parsing
=
0
self
.
_parsing
=
0
self
.
_parser
.
Parse
(
""
,
1
)
def
reset
(
self
):
...
...
@@ -135,12 +135,12 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
xmlreader
.
AttributesImpl
(
attrs
,
attrs
))
def
end_element
(
self
,
name
):
self
.
_cont_handler
.
endElement
(
name
,
name
)
self
.
_cont_handler
.
endElement
(
name
,
name
)
def
start_element_ns
(
self
,
name
,
attrs
):
pair
=
name
.
split
()
if
len
(
pair
)
==
1
:
tup
=
(
None
,
name
)
tup
=
(
None
,
name
)
else
:
tup
=
pair
...
...
@@ -152,7 +152,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
if
len
(
pair
)
==
1
:
name
=
(
None
,
name
,
None
)
else
:
name
=
pair
+
[
None
]
# prefix is not implemented yet!
name
=
pair
+
[
None
]
# prefix is not implemented yet!
self
.
_cont_handler
.
endElement
(
name
,
None
)
...
...
@@ -187,7 +187,7 @@ class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
# ---
def
create_parser
(
*
args
,
**
kwargs
):
return
apply
(
ExpatParser
,
args
,
kwargs
)
return
apply
(
ExpatParser
,
args
,
kwargs
)
# ---
...
...
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