This repository has been archived by the owner on May 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
XMLParser is now a specialization of JSONParser #72
Merged
Conversation
This file contains 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
I like the base idea! However, it always kinda bugged me that JSONParser really operated internally on Python Dicts, and not the JSON -- maybe for clarity, have a parent class StructuredParser that operates on dicts, and then a JSON and XML sub-class that overrides init_native to translate JSON and XML into dictionaries? |
As a matter of fact it works on both like the XMLParser:
|
matejv
added a commit
to ArnesSI/napalm-yang
that referenced
this pull request
Jul 11, 2017
matejv
added a commit
to ArnesSI/napalm-yang
that referenced
this pull request
Jul 18, 2017
matejv
added a commit
to ArnesSI/napalm-yang
that referenced
this pull request
Jul 24, 2017
matejv
added a commit
to ArnesSI/napalm-yang
that referenced
this pull request
Jul 30, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Instead of having two different parsers for XML and JSON now the XMLParser instead is a subclass of JSONParser. The XMLParser will just initialize the native data, which means that it will convert XML into a dict and implement only what's needed piggybacking from the JSONParser.
When accessing native data instead of
interfaces.0
you have to access native data withroot_interfaces.0
. The reason to prependroot_
is that under some circumstances native data would be masked. For example, this would work:But this would mask the native data:
As now
interfaces
would actually what was captured by the action.napalm_yang.helpers.config_logging
to simplify configuring logging parameters.@bewing thoughts?