Overview
Comment: | [build] code clarification (Python f-strings) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | build |
Files: | files | file ages | folders |
SHA3-256: |
d1aa895785ad5cff898123f620db1f8e |
User & Date: | olr on 2020-04-22 14:29:00 |
Other Links: | manifest | tags |
Context
2020-04-22
| ||
14:59 | [build] make data more readable check-in: e17a78cf83 user: olr tags: trunk, build | |
14:29 | [build] code clarification (Python f-strings) check-in: d1aa895785 user: olr tags: trunk, build | |
13:59 | [build] make data more readable check-in: 448cd58d39 user: olr tags: trunk, build | |
Changes
Modified compile_rules_js_convert.py from [f8702476c1] to [37ece1a88a].
︙ | ︙ | |||
133 134 135 136 137 138 139 | def writeRulesToJSArray (lRules): "create rules as a string of arrays (to be bundled in a JSON string)" sArray = "[\n" for sOption, aRuleGroup in lRules: if sOption != "@@@@": | > | < | < < < | | | > | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | def writeRulesToJSArray (lRules): "create rules as a string of arrays (to be bundled in a JSON string)" sArray = "[\n" for sOption, aRuleGroup in lRules: if sOption != "@@@@": sOption = "false" if not sOption else f'"{sOption}"' sArray += f' [{sOption}, [\n' for sRegex, bCaseInsensitive, sLineId, sRuleId, nPriority, lActions, aGroups, aNegLookBehindRegex in aRuleGroup: sCaseSensitive = "true" if bCaseInsensitive else "false" sActions = json.dumps(lActions, ensure_ascii=False) sGroups = json.dumps(aGroups, ensure_ascii=False) sNLBRegex = json.dumps(aNegLookBehindRegex, ensure_ascii=False) sArray += f' [{sRegex}, {sCaseSensitive}, "{sLineId}", "{sRuleId}", {nPriority}, {sActions}, {sGroups}, {sNLBRegex}],\n' sArray += " ]],\n" else: sArray += f' ["{sOption}", [\n' for sGraphName, sLineId in aRuleGroup: sArray += f' ["{sGraphName}", "{sLineId}"],\n' sArray += " ]],\n" sArray += "]" return sArray def groupsPositioningCodeToList (sGroupsPositioningCode): "convert <sGroupsPositioningCode> to a list of codes (numbers or strings)" |
︙ | ︙ |