-
Notifications
You must be signed in to change notification settings - Fork 11
Issue #47 - Allow Python application developers to disable quiet mode of graphLib
#50
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf03fec
Allow Python application developers to disable quiet mode of graphLib…
wbkboyer 6c74183
Added line of trailing whitespace so gitHub doesn't complain
wbkboyer 888a65c
Holy guacamole, this was a heck of a refactor. Now, we have the graph…
wbkboyer 6df19c9
Forgot to update `Manifest.in` file to reflect changes to architectur…
wbkboyer df33cea
Added newline at end of file for `cgraphLib.pxd` and `test_quiet_mode…
wbkboyer 32dd802
Addressing PR comments
wbkboyer 926ea60
Exposing gp_LowerBoundEdges() in the `Graph` class of `graph.pyx`
wbkboyer 557f3ed
Reordering gp_ExtendWithXXX() methods in Graph class to match order i…
wbkboyer 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
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,72 @@ | ||
| """Script to check whether setting quiet mode is successful | ||
|
|
||
| NOTE: For this test to be meaningful, the filename supplied must not correspond | ||
| to an existing file so that the first time we try to initialize the G6ReadIterator, | ||
| no gp_ErrorMessage() are displayed, but then after setting the quietMode flag to | ||
| 0 via gp_SetQuietModeFlag(), the gp_ErrorMessage()s reporting the failure are | ||
| output to stderr. | ||
|
|
||
| """ | ||
|
|
||
| #!/usr/bin/env python | ||
|
|
||
| import sys, traceback | ||
|
|
||
| from planarity import ( | ||
| TRUE, | ||
| FALSE, | ||
| gp_GetQuietModeFlag, | ||
| gp_SetQuietModeFlag, | ||
| G6ReadIterator, | ||
| Graph, | ||
| ) | ||
|
|
||
|
|
||
| def _get_quiet_mode_str() -> str: | ||
| return ( | ||
| 'FALSE' | ||
| if gp_GetQuietModeFlag() == FALSE | ||
| else ( | ||
| 'TRUE' | ||
| if gp_GetQuietModeFlag() == TRUE | ||
| else 'UNKNOWN' | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| filename = 'DOES_NOT_EXIST.g6' if (len(sys.argv) < 2) else sys.argv[1] | ||
| if (gp_GetQuietModeFlag() != TRUE): | ||
| raise RuntimeError( | ||
| "graphLib default quietModeFlag expected to be TRUE.") | ||
|
|
||
| graph = Graph() | ||
| reader = G6ReadIterator(graph) | ||
| try: | ||
| print( | ||
| f"Trying to init reader with nonexistent file '{filename}'.\n" | ||
| "\tgp_ErroMessage() MUST NOT appear before stacktrace, as " | ||
| f"quietModeFlag is {_get_quiet_mode_str()}:" | ||
| ) | ||
| print('-'*25) | ||
| reader.g6_InitReaderWithFileName(filename) | ||
| except RuntimeError as e: | ||
| print('-'*25) | ||
| traceback.print_exception(e) | ||
| print() | ||
| print('='*50) | ||
| print() | ||
|
|
||
| gp_SetQuietModeFlag(FALSE) | ||
|
|
||
| try: | ||
| print( | ||
| f"Trying to init reader with nonexistent file '{filename}'.\n" | ||
| "\tgp_ErroMessage() MUST appear before stacktrace, as quietModeFlag " | ||
| f"is {_get_quiet_mode_str()}:" | ||
| ) | ||
| print('-'*25) | ||
| reader.g6_InitReaderWithFileName(filename) | ||
|
wbkboyer marked this conversation as resolved.
|
||
| except RuntimeError as e: | ||
| print('-'*25) | ||
| traceback.print_exception(e) | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.