| 49 | return elem.get(name) is not None and elem.get(name) == "true" |
| 50 | |
| 51 | def externSyncGet(elem): |
| 52 | value = elem.get('externsync') |
| 53 | if value is None: |
| 54 | return (ExternSync.NONE, None) |
| 55 | if value == 'true': |
| 56 | return (ExternSync.ALWAYS, None) |
| 57 | if value == 'maybe': |
| 58 | return (ExternSync.MAYBE, None) |
| 59 | |
| 60 | # There are no cases where multiple members of the param are marked as |
| 61 | # externsync. Supporting that with maybe: requires more than |
| 62 | # ExternSync.SUBTYPE_MAYBE (which is only one bit of information), which is |
| 63 | # not currently done as there are no users. |
| 64 | # |
| 65 | # If this assert is hit, please consider simplifying the design such that |
| 66 | # externsync can move to the struct itself and so external synchronization |
| 67 | # requirements do not depend on the context. |
| 68 | assert ',' not in value |
| 69 | |
| 70 | if value.startswith('maybe:'): |
| 71 | return (ExternSync.SUBTYPE_MAYBE, value.removeprefix('maybe:')) |
| 72 | return (ExternSync.SUBTYPE, value) |
| 73 | |
| 74 | # Shared object used by Sync elements that do not have ones |
| 75 | maxSyncSupport = SyncSupport(None, None, True) |