Skip to content
Open
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
23 changes: 16 additions & 7 deletions permuta/bisc/bisc.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def auto_bisc(prop):
print("Attempting to read perms from permsets")
good_entry = None
bad_entry = None
with os.scandir("../resources/bisc") as entries:
bisc_dir = os.path.join(os.path.dirname(__file__), "..", "resources", "bisc")
bisc_dir = os.path.abspath(bisc_dir)

with os.scandir(bisc_dir) as entries:
for i, entry in enumerate(entries):
en = entry.name[:-5]
spl = en.split("_")
Expand All @@ -125,8 +128,8 @@ def auto_bisc(prop):
if good_entry is not None and bad_entry is not None:
break
if good_entry is not None and bad_entry is not None:
A = read_bisc_file("../resources/bisc/" + good_entry)
B = read_bisc_file("../resources/bisc/" + bad_entry)
A = read_bisc_file(bisc_dir + "/" + good_entry)
B = read_bisc_file(bisc_dir + "/" + bad_entry)
else:
print("The required files do not exist")
return
Expand Down Expand Up @@ -235,7 +238,11 @@ def auto_bisc(prop):
print("Attempting to read perms from permsets")
good_entry = None
bad_entry = None
with os.scandir("../resources/bisc") as entries:
bisc_dir = os.path.join(
os.path.dirname(__file__), "..", "resources", "bisc"
)
bisc_dir = os.path.abspath(bisc_dir)
with os.scandir(bisc_dir) as entries:
for i, entry in enumerate(entries):
en = entry.name[:-5]
spl = en.split("_")
Expand All @@ -255,8 +262,8 @@ def auto_bisc(prop):
if good_entry is not None and bad_entry is not None:
break
if good_entry is not None and bad_entry is not None:
A = read_bisc_file("../resources/bisc/" + good_entry)
B = read_bisc_file("../resources/bisc/" + bad_entry)
A = read_bisc_file(bisc_dir + "/" + good_entry)
B = read_bisc_file(bisc_dir + "/" + bad_entry)
else:
print("The required files do not exist")
return
Expand Down Expand Up @@ -312,6 +319,8 @@ def read_bisc_file(path):
try:
with open(f"{path}.json", "r") as f:
return from_json(f.readline())
except (ValueError, TypeError, OSError):
except (ValueError, TypeError, OSError) as e:
print(f"File is invalid: {path}")
print(f"Error type: {type(e).__name__}")
print(f"Error message: {e}")
return {}
1 change: 1 addition & 0 deletions permuta/resources/bisc/meander_bad_len8.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions permuta/resources/bisc/meander_good_len8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0": [[]], "1": [[0]], "2": [[0, 1]], "3": [[0, 1, 2], [2, 1, 0]], "4": [[0, 1, 2, 3], [0, 3, 2, 1], [2, 1, 0, 3]], "5": [[0, 1, 2, 3, 4], [0, 1, 4, 3, 2], [0, 3, 2, 1, 4], [2, 1, 0, 3, 4], [2, 3, 4, 1, 0], [4, 1, 2, 3, 0], [4, 3, 0, 1, 2], [4, 3, 2, 1, 0]], "6": [[0, 1, 2, 3, 4, 5], [0, 1, 2, 5, 4, 3], [0, 1, 4, 3, 2, 5], [0, 3, 2, 1, 4, 5], [0, 3, 4, 5, 2, 1], [0, 5, 2, 3, 4, 1], [0, 5, 4, 1, 2, 3], [0, 5, 4, 3, 2, 1], [2, 1, 0, 3, 4, 5], [2, 1, 0, 5, 4, 3], [2, 3, 4, 1, 0, 5], [4, 1, 2, 3, 0, 5], [4, 3, 0, 1, 2, 5], [4, 3, 2, 1, 0, 5]], "7": [[0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 6, 5, 4], [0, 1, 2, 5, 4, 3, 6], [0, 1, 4, 3, 2, 5, 6], [0, 1, 4, 5, 6, 3, 2], [0, 1, 6, 3, 4, 5, 2], [0, 1, 6, 5, 2, 3, 4], [0, 1, 6, 5, 4, 3, 2], [0, 3, 2, 1, 4, 5, 6], [0, 3, 2, 1, 6, 5, 4], [0, 3, 4, 5, 2, 1, 6], [0, 5, 2, 3, 4, 1, 6], [0, 5, 4, 1, 2, 3, 6], [0, 5, 4, 3, 2, 1, 6], [2, 1, 0, 3, 4, 5, 6], [2, 1, 0, 3, 6, 5, 4], [2, 1,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