Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ include planarity/classic/cplanarity.pxd
include planarity/classic/planarity.c
include planarity/classic/planarity.pyx

include planarity/full/cappconst.pxd
include planarity/full/cg6IterationDefs.pxd
include planarity/full/cgraphLib.pxd
include planarity/full/graphLib.pxd
include planarity/full/graph.pxd
include planarity/full/graphLib.c
include planarity/full/graph.c
include planarity/full/g6IterationUtils.c
include planarity/full/graphLib.pyx
include planarity/full/graph.pyx
include planarity/full/g6IterationUtils.pyx

Expand Down
72 changes: 72 additions & 0 deletions examples/full/test_quiet_mode.py
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)
Comment thread
wbkboyer marked this conversation as resolved.
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)
Comment thread
wbkboyer marked this conversation as resolved.
except RuntimeError as e:
print('-'*25)
traceback.print_exception(e)
19 changes: 11 additions & 8 deletions planarity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
from .classic.planarity_functions import *
from .classic.planarity_networkx import *

from .full.g6IterationUtils import G6ReadIterator, G6WriteIterator
from .full.graph import (
gp_GetProjectVersionFull,
gp_GetLibPlanarityVersionFull,
Graph,
from .full.graphLib import (
OK,
AT_EDGE_CAPACITY_LIMIT,
NONEMBEDDABLE,
NOTOK,
NIL,
TRUE,
FALSE,
AT_EDGE_CAPACITY_LIMIT,
EMBEDFLAGS_PLANAR,
EMBEDFLAGS_DRAWPLANAR,
EMBEDFLAGS_OUTERPLANAR,
EMBEDFLAGS_SEARCHFORK23,
EMBEDFLAGS_SEARCHFORK33,
EMBEDFLAGS_SEARCHFORK4,
gp_GetQuietModeFlag,
gp_SetQuietModeFlag,
gp_GetProjectVersionFull,
gp_GetLibPlanarityVersionFull,
)
from .full.graph import Graph
from .full.g6IterationUtils import G6ReadIterator, G6WriteIterator

# NOTE: In the future, we could automatically generate the version number by
# configuring setuptools-scm, but presently this seems simpler.
__version__ = "0.7.13"
__version__ = "0.7.16"
36 changes: 16 additions & 20 deletions planarity/classic/planarity.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions planarity/full/cappconst.pxd

This file was deleted.

35 changes: 0 additions & 35 deletions planarity/full/cg6IterationDefs.pxd

This file was deleted.

Loading