You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following function doesn't properly ask the handlers if they can "detect" and instead utilizes the key of the dictionary which is assigned to handler.FM_BOUNDARY.
# global handlers
handlers = {
Handler.FM_BOUNDARY: Handler()
for Handler in [YAMLHandler, JSONHandler, TOMLHandler]
if Handler is not None
}
def detect_format(text, handlers):
"""
Figure out which handler to use, based on metadata.
Returns a handler instance or None.
``text`` should be unicode text about to be parsed.
``handlers`` is a dictionary where keys are opening delimiters
and values are handler instances.
"""
for pattern, handler in handlers.items():
if pattern.match(text):
return handler
# nothing matched, give nothing back
return None
The text was updated successfully, but these errors were encountered:
The following function doesn't properly ask the handlers if they can "detect" and instead utilizes the key of the dictionary which is assigned to
handler.FM_BOUNDARY
.The text was updated successfully, but these errors were encountered: