Browse Source

Cache return values to avoid repeated function calls.

pull/2962/head
garenchan 6 years ago
parent
commit
9bc87d09c6
  1. 5
      flask/cli.py

5
flask/cli.py

@ -206,8 +206,9 @@ def prepare_import(path):
""" """
path = os.path.realpath(path) path = os.path.realpath(path)
if os.path.splitext(path)[1] == '.py': fname, ext = os.path.splitext(path)
path = os.path.splitext(path)[0] if ext == '.py':
path = fname
if os.path.basename(path) == '__init__': if os.path.basename(path) == '__init__':
path = os.path.dirname(path) path = os.path.dirname(path)

Loading…
Cancel
Save