Determine why the `\u200e\u200f\...` artifacts may occasionally occur at `.xml`.
a-t-0 opened this issue · 0 comments
a-t-0 commented
See:
@typechecked
def dict_contains_other_dict(sub: Dict, main: Dict) -> bool:
"""Returns true if the sub dict is a subset of the main dict."""
for sub_key, sub_val in sub.items():
if sub_key not in main.keys():
return False
# An artifact like:
# "@text": "VPN Mode \u200e\u200f\u200e\u200e\u200e\u200e\u200e\u200f
# \u200e\u200f\u200f\u200f\u200e\u200e\u200e\u200e\u200e\u200e\u200f\
# u200e\u200e\u200f\u200e\u200e\u200e\u200e\u200f\u200f\u200f\u200f\
# u200f\u200e\u200e\u200f\u200f\u200e\u200e\u200e\u200f\u200e\u200e\
# u200f\u200e\u200e\u200e\u200e\u200e\u200e\u200f\u200e\u200f\u200f\
# u200f\u200e\u200e\u200e\u200e\u200e\u200e\u200f\u200e\u200f\u200e\
# u200e\u200e\u200e\u200e\u200e\u200e\u200f\u200e\u200e\u200e\u200e\
# u200f\u200e\u200e\u200e\u200f\u200f\u200f\u200f\u200f\u200e\u200e\
# u200f\u200f\u200e\u200f\u200f\u200e\u200e\u200e\u200eON\u200e\u200f
# \u200e\u200e\u200f\u200e",
# may occur at random. Therefore, the "in" option is included.
# TODO: determine why these artifacts may occur and/or remove them.
if sub_val != main[sub_key] and sub_val not in main[sub_key]:
return False
return True
Either filter the artifact out, or prevent it from occurring, than you can do exact matches on requirement_object
instead of i frequirement_object in screen_dict
.