-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Repeated option and port re to regex module. #38
Open
gachteme
wants to merge
19
commits into
google:master
Choose a base branch
from
gachteme: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
19 commits
Select commit
Hold shift + click to select a range
aac2d61
changed re to regex module
gachteme d9aa5e5
fixed overly greedy replacements that were made in last commit
gachteme ff984db
finished porting over to regex from re. Runs.
gachteme 1c5bdf7
First commit with basic functionality.
gachteme c5d17dd
Fix to bug where repeateddata without a match returned an empty strin…
gachteme 2f92cfd
Added basic test case for Repeated option. Changed invalid regex test…
gachteme fd1d4dc
Update to requirements.
gachteme 80ef2dd
Cleanup.
gachteme 51b825a
merged in google/textfsm
gachteme 81a043a
Allowed fallback to re if regex module cannot be imported. Tested for…
gachteme 33149e9
removed regex module where unnecessary. Passes regression in python 3…
gachteme 2f61b2a
Made repeated keyword tests not fail when falling back on re module. …
gachteme 0707470
Allowed use of Repeated and List together. Added tests for correct be…
gachteme 5aa7071
Allowed use of Repeated and Fillup or Filldown together. Added tests …
gachteme 19a922e
Changes to ensure python 2.7 compatibility. Tests pass with and witho…
gachteme a34e64e
merge in google/textfsm. Breaks python 2.7 regression
gachteme 1b5f21a
moved Repeated tests to assertListEqual. Bugfix for new dependencies.…
gachteme 4745254
moved clitable_test back to re where regex is not needed.
gachteme 46eae78
Merge branch 'master' into master
gachteme 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 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,7 @@ | ||
This is an example to demonstrate the usage of the 'repeated' keyword, which enables one variable to have multiple captures on one line. | ||
|
||
|
||
normaldata1.1 normaldata1.2 key1.1:data1.1, key1.2:data1.2, key1.3:data1.3, normaldata1.3 normaldata1.3 | ||
normaldata2.1 normaldata2.2 key2.1:data2.1, key2.2:data2.2, normaldata2.3 normaldata2.4 | ||
normaldata3.1 normaldata3.2 normaldata3.3 normaldata3.4 | ||
normaldata4.1 normaldata4.2 key4.1:data4.1, key4.2:data4.2, key4.3:data4.3, normaldata4.3 normaldata4.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Value normaldata1 (\S+) | ||
Value normaldata2 (\S+) | ||
Value normaldata3 (\S+) | ||
Value normaldata4 (\S+) | ||
Value Repeated keything (\S+) | ||
Value Repeated valuedata (\S+) | ||
Value Repeated unusedRepeated (\S+) | ||
Value List unused (\S+) | ||
|
||
|
||
Start | ||
^${normaldata1}\s+${normaldata2} (${keything}:${valuedata},? )*${normaldata3}\s+${normaldata4} -> Record |
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
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
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
Oops, something went wrong.
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.
I'm conflicted here ... we want to opportunistically install regex but not necessarily require it, as only newer templates would need it. Unfortunately I see no provision in setup.py for a install_desires=... stanza, so I guess this will have to do?
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.
Its the templates that drive the dependency. i.e. only if there are templates with the Repeated keyword, do we need the regexp module installed (plus the relevant unittests). It could be a declared as required as part of a template package install rather than here .. but that is perhaps asking to much of the template maintainers.