codekingpro/portable-devtools
114k
1"""2 flask_security.quart_compat3 ~~~~~~~~~~~~~~~~~~~~4 5 Flask-Security quart compatibility modiles6 7 :copyright: (c) 2019 by Shinon.8 :license: MIT, see LICENSE for more details.9 10 This modules tests whether we are using quart or not11 we can test if the name of the imported flask is: quart.flask_patch12"""13 14import flask15 16if "quart." in flask.__name__ or hasattr(flask, "_quart_patched"): # pragma: no cover17 is_quart = True18else:19 is_quart = False20 21 22@property # type: ignore23def best(self): # pragma: no cover24 options = sorted(25 self.options,26 key=lambda option: (option.value != "*", option.quality, option.value),27 reverse=True,28 )29 return options[0].value30 31 32def get_quart_status():33 """34 Tests if we are using Quart Patched Flask or Vanilla Flask.35 :return: boolean value determining if it is quart patched flask or not36 """37 return is_quart38 