This repository was archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Library works from Python 2.7+ (Compatible with all 3.x versions) #9
Open
dslapelis
wants to merge
8
commits into
IBM:master
Choose a base branch
from
dslapelis:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b5ad930
Python 3 modifications
dslapelis 3f6a0c2
Merge pull request #1 from wegotthekeys/python3
dslapelis fc872dc
Travis
dslapelis 51b4c04
Travis command fix
dslapelis f310ad4
travis tests fix
dslapelis b816cc2
remove 2.6 from travis
dslapelis 5e25f05
python 2 break fixes
dslapelis afee5cb
Cleaning up tests and removing commented code.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| language: python | ||
| dist: xenial | ||
| python: | ||
| - "2.7" | ||
| - "3.4" | ||
| - "3.5" | ||
| - "3.6" | ||
| - "3.7" | ||
| sudo: true | ||
| install: | ||
| - pip install -r test-requirements.txt | ||
| - pip install -r requirements.txt | ||
| script: | ||
| - nosetests -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,11 @@ | |
| from contextlib import contextmanager | ||
| from xml.parsers.expat import ExpatError | ||
|
|
||
| try: | ||
| basestring | ||
| except NameError: | ||
| basestring = str | ||
|
|
||
| Element = cet.Element | ||
| tostring = cet.tostring | ||
|
|
||
|
|
@@ -189,7 +194,7 @@ class TerminationDetectingXMLParser(object): | |
|
|
||
| def __init__(self): | ||
| self.tree_builder = _TerminationDetectingTreeBuilder() | ||
| self.xml_tree_builder = et.XMLTreeBuilder(target=self.tree_builder) | ||
| self.xml_tree_builder = et.XMLParser(target=self.tree_builder) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. XMLParser will also require extensive testing. I know that TreeBuilder is old, but what's the benefit?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. XMLTreeBuilder did not appear to exist in Python 3. XMLParser should be used instead; I can add the backwards compatibility try/except stated in the documentation http://effbot.org/elementtree/elementtree-xmlparser.htm |
||
|
|
||
| def feed(self, chunk): | ||
| with _translateExceptions(chunk): | ||
|
|
@@ -202,4 +207,4 @@ def close(self): | |
|
|
||
| @property | ||
| def root_element_closed(self): | ||
| return self.tree_builder.root_element_closed | ||
| return self.tree_builder.root_element_closed | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| bunch | ||
| munch |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Munch?
A Replacement like this requires extensive testing.
What's the benefit of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe that Bunch is still supported, and it is incompatible with Python 3.x. All of my tests failed with Bunch in Python 3. It appears that Infinidat forked Bunch and created Munch.
https://github.com/Infinidat/munch