From a9e313225f37572614f4669ce1f271720613bfaf Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Thu, 6 Aug 2020 14:43:55 -0700 Subject: [PATCH] Add import demo source --- sources/importdemo.py | 20 ++++++++++++++++++++ sources/importdemohelper.py | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 sources/importdemo.py create mode 100644 sources/importdemohelper.py diff --git a/sources/importdemo.py b/sources/importdemo.py new file mode 100644 index 0000000..08eeb2d --- /dev/null +++ b/sources/importdemo.py @@ -0,0 +1,20 @@ +""" +Demonstrates the behavior of imports in sources. +""" +# Standard library imports +from datetime import datetime +import random + +# Environment import +import flask + +# Local import +from importdemohelper import secret + +def fetch_new(state): + return [{ + 'source': 'importdemo', + 'id': '{:x}'.format(random.getrandbits(16 * 4)), + 'title': f'The secret is "{secret}"', + 'body': f'And flask\'s name is "{flask.__name__}"', + }] diff --git a/sources/importdemohelper.py b/sources/importdemohelper.py new file mode 100644 index 0000000..7e68e7f --- /dev/null +++ b/sources/importdemohelper.py @@ -0,0 +1,6 @@ +""" +Demonstrates the behavior of imports in sources. +This python file is not a source and will not +""" + +secret = f'This string is from {__file__}'