-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more reverse macro edge validation logic.
- Loading branch information
1 parent
d52614a
commit 784d469
Showing
4 changed files
with
127 additions
and
59 deletions.
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
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,20 @@ | ||
from ...schema import INBOUND_EDGE_FIELD_PREFIX, OUTBOUND_EDGE_FIELD_PREFIX | ||
|
||
|
||
# ############ | ||
# Public API # | ||
# ############ | ||
|
||
def make_reverse_macro_edge_name(macro_edge_name): | ||
if macro_edge_name.startswith(INBOUND_EDGE_FIELD_PREFIX): | ||
raw_edge_name = macro_edge_name[len(INBOUND_EDGE_FIELD_PREFIX):] | ||
prefix = OUTBOUND_EDGE_FIELD_PREFIX | ||
elif macro_edge_name.startswith(OUTBOUND_EDGE_FIELD_PREFIX): | ||
raw_edge_name = macro_edge_name[len(OUTBOUND_EDGE_FIELD_PREFIX):] | ||
prefix = INBOUND_EDGE_FIELD_PREFIX | ||
else: | ||
raise AssertionError(u'Unreachable condition reached: {}'.format(macro_edge_name)) | ||
|
||
reversed_macro_edge_name = prefix + raw_edge_name | ||
|
||
return reversed_macro_edge_name |
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