Skip to content

Commit 072155f

Browse files
committed
flask appcliation items for this lab
1 parent b16eb1f commit 072155f

File tree

4,040 files changed

+1085040
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,040 files changed

+1085040
-0
lines changed

dnn_tensorflow_estimator.ipynb

+952
Large diffs are not rendered by default.

flask-app/.env/.Python

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Python

flask-app/.env/bin/activate

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This file must be used with "source bin/activate" *from bash*
2+
# you cannot run it directly
3+
4+
deactivate () {
5+
unset -f pydoc >/dev/null 2>&1
6+
7+
# reset old environment variables
8+
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
9+
if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
10+
PATH="$_OLD_VIRTUAL_PATH"
11+
export PATH
12+
unset _OLD_VIRTUAL_PATH
13+
fi
14+
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
15+
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
16+
export PYTHONHOME
17+
unset _OLD_VIRTUAL_PYTHONHOME
18+
fi
19+
20+
# This should detect bash and zsh, which have a hash command that must
21+
# be called to get it to forget past commands. Without forgetting
22+
# past commands the $PATH changes we made may not be respected
23+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
24+
hash -r 2>/dev/null
25+
fi
26+
27+
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
28+
PS1="$_OLD_VIRTUAL_PS1"
29+
export PS1
30+
unset _OLD_VIRTUAL_PS1
31+
fi
32+
33+
unset VIRTUAL_ENV
34+
if [ ! "${1-}" = "nondestructive" ] ; then
35+
# Self destruct!
36+
unset -f deactivate
37+
fi
38+
}
39+
40+
# unset irrelevant variables
41+
deactivate nondestructive
42+
43+
VIRTUAL_ENV="/Users/jonathan/flask-app/.env"
44+
export VIRTUAL_ENV
45+
46+
_OLD_VIRTUAL_PATH="$PATH"
47+
PATH="$VIRTUAL_ENV/bin:$PATH"
48+
export PATH
49+
50+
# unset PYTHONHOME if set
51+
if ! [ -z "${PYTHONHOME+_}" ] ; then
52+
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
53+
unset PYTHONHOME
54+
fi
55+
56+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
57+
_OLD_VIRTUAL_PS1="$PS1"
58+
if [ "x" != x ] ; then
59+
PS1="$PS1"
60+
else
61+
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
62+
fi
63+
export PS1
64+
fi
65+
66+
# Make sure to unalias pydoc if it's already there
67+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc
68+
69+
pydoc () {
70+
python -m pydoc "$@"
71+
}
72+
73+
# This should detect bash and zsh, which have a hash command that must
74+
# be called to get it to forget past commands. Without forgetting
75+
# past commands the $PATH changes we made may not be respected
76+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
77+
hash -r 2>/dev/null
78+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/Users/jonathan/flask-app/.env/bin/python2.7
2+
# PYTHON_ARGCOMPLETE_OK
3+
4+
# Copyright 2012-2013, Andrey Kislyuk and argcomplete contributors.
5+
# Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info.
6+
7+
'''
8+
Activate the generic bash-completion script for the argcomplete module.
9+
'''
10+
11+
import os, sys, argparse, argcomplete, shutil, fileinput
12+
13+
parser = argparse.ArgumentParser(description=__doc__,
14+
formatter_class=argparse.RawDescriptionHelpFormatter)
15+
16+
dest_opt = parser.add_argument("--dest", default="/etc/bash_completion.d",
17+
help="Specify the bash completion modules directory to install into")
18+
parser.add_argument("--user", help="Install into user directory (~/.bash_completion.d/)", action='store_true')
19+
parser.add_argument("--no-defaults", dest="use_defaults", action="store_false", default=True,
20+
help="When no matches are generated, do not fallback to readline\'s default completion")
21+
parser.add_argument("--complete-arguments", nargs=argparse.REMAINDER,
22+
help="arguments to call complete with; use of this option discards default options")
23+
argcomplete.autocomplete(parser)
24+
args = parser.parse_args()
25+
26+
if args.user:
27+
args.dest = os.path.expanduser("~/.bash_completion.d/")
28+
if not os.path.exists(args.dest):
29+
try:
30+
os.mkdir(args.dest)
31+
except Exception as e:
32+
parser.error("Path {d} does not exist and could not be created: {e}".format(d=args.dest, e=e))
33+
elif not os.path.exists(args.dest) and args.dest != '-':
34+
if sys.platform == 'darwin' and args.dest == dest_opt.default and os.path.exists("/usr/local" + dest_opt.default):
35+
args.dest = "/usr/local" + dest_opt.default
36+
else:
37+
parser.error("Path {d} does not exist".format(d=args.dest))
38+
39+
activator = os.path.join(os.path.dirname(argcomplete.__file__), 'bash_completion.d', 'python-argcomplete.sh')
40+
41+
if args.complete_arguments is None:
42+
complete_options = '-o default -o bashdefault' if args.use_defaults else '-o bashdefault'
43+
else:
44+
complete_options = " ".join(args.complete_arguments)
45+
complete_call = "complete{} -D -F _python_argcomplete_global".format(" " + complete_options if complete_options else "")
46+
def replaceCompleteCall(line):
47+
if line.startswith("complete") and "_python_argcomplete_global" in line:
48+
return complete_call + ('\n' if line.endswith('\n') else '')
49+
else:
50+
return line
51+
52+
if args.dest == '-':
53+
for l in open(activator):
54+
sys.stdout.write(replaceCompleteCall(l))
55+
else:
56+
dest = os.path.join(args.dest, "python-argcomplete.sh")
57+
58+
sys.stdout.write("Installing bash completion script " + dest)
59+
if not args.use_defaults:
60+
sys.stdout.write(" without -o default")
61+
elif args.complete_arguments:
62+
sys.stdout.write(" with options: " + complete_options)
63+
sys.stdout.write("\n")
64+
65+
try:
66+
shutil.copy(activator, dest)
67+
if not args.complete_arguments is None or not args.use_defaults:
68+
for l in fileinput.input(dest, inplace=True):
69+
# fileinput with inplace=True redirects stdout to the edited file
70+
sys.stdout.write(replaceCompleteCall(l))
71+
except Exception as e:
72+
err = str(e)
73+
if args.dest == dest_opt.default:
74+
err += "\nPlease try --user to install into a user directory, or --dest to specify the bash completion modules directory"
75+
parser.error(err)

flask-app/.env/bin/activate.csh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This file must be used with "source bin/activate.csh" *from csh*.
2+
# You cannot run it directly.
3+
# Created by Davide Di Blasi <[email protected]>.
4+
5+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
6+
7+
# Unset irrelevant variables.
8+
deactivate nondestructive
9+
10+
setenv VIRTUAL_ENV "/Users/jonathan/flask-app/.env"
11+
12+
set _OLD_VIRTUAL_PATH="$PATH"
13+
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
14+
15+
16+
17+
if ("" != "") then
18+
set env_name = ""
19+
else
20+
set env_name = `basename "$VIRTUAL_ENV"`
21+
endif
22+
23+
# Could be in a non-interactive environment,
24+
# in which case, $prompt is undefined and we wouldn't
25+
# care about the prompt anyway.
26+
if ( $?prompt ) then
27+
set _OLD_VIRTUAL_PROMPT="$prompt"
28+
set prompt = "[$env_name] $prompt"
29+
endif
30+
31+
unset env_name
32+
33+
alias pydoc python -m pydoc
34+
35+
rehash
36+

flask-app/.env/bin/activate.fish

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This file must be used using `. bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2+
# Do not run it directly.
3+
4+
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
5+
# reset old environment variables
6+
if test -n "$_OLD_VIRTUAL_PATH"
7+
set -gx PATH $_OLD_VIRTUAL_PATH
8+
set -e _OLD_VIRTUAL_PATH
9+
end
10+
11+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
12+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
13+
set -e _OLD_VIRTUAL_PYTHONHOME
14+
end
15+
16+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
17+
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
18+
set -l fish_function_path
19+
20+
# Erase virtualenv's `fish_prompt` and restore the original.
21+
functions -e fish_prompt
22+
functions -c _old_fish_prompt fish_prompt
23+
functions -e _old_fish_prompt
24+
set -e _OLD_FISH_PROMPT_OVERRIDE
25+
end
26+
27+
set -e VIRTUAL_ENV
28+
29+
if test "$argv[1]" != 'nondestructive'
30+
# Self-destruct!
31+
functions -e pydoc
32+
functions -e deactivate
33+
end
34+
end
35+
36+
# Unset irrelevant variables.
37+
deactivate nondestructive
38+
39+
set -gx VIRTUAL_ENV "/Users/jonathan/flask-app/.env"
40+
41+
set -gx _OLD_VIRTUAL_PATH $PATH
42+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
43+
44+
# Unset `$PYTHONHOME` if set.
45+
if set -q PYTHONHOME
46+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
47+
set -e PYTHONHOME
48+
end
49+
50+
function pydoc
51+
python -m pydoc $argv
52+
end
53+
54+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
55+
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
56+
functions -c fish_prompt _old_fish_prompt
57+
58+
function fish_prompt
59+
# Save the current $status, for fish_prompts that display it.
60+
set -l old_status $status
61+
62+
# Prompt override provided?
63+
# If not, just prepend the environment name.
64+
if test -n ""
65+
printf '%s%s' "" (set_color normal)
66+
else
67+
printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
68+
end
69+
70+
# Restore the original $status
71+
echo "exit $old_status" | source
72+
_old_fish_prompt
73+
end
74+
75+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
76+
end

flask-app/.env/bin/activate_this.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""By using execfile(this_file, dict(__file__=this_file)) you will
2+
activate this virtualenv environment.
3+
4+
This can be used when you must use an existing Python interpreter, not
5+
the virtualenv bin/python
6+
"""
7+
8+
try:
9+
__file__
10+
except NameError:
11+
raise AssertionError(
12+
"You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))")
13+
import sys
14+
import os
15+
16+
old_os_path = os.environ.get('PATH', '')
17+
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path
18+
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19+
if sys.platform == 'win32':
20+
site_packages = os.path.join(base, 'Lib', 'site-packages')
21+
else:
22+
site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
23+
prev_sys_path = list(sys.path)
24+
import site
25+
site.addsitedir(site_packages)
26+
sys.real_prefix = sys.prefix
27+
sys.prefix = base
28+
# Move the added items to the front of the path:
29+
new_sys_path = []
30+
for item in list(sys.path):
31+
if item not in prev_sys_path:
32+
new_sys_path.append(item)
33+
sys.path.remove(item)
34+
sys.path[:0] = new_sys_path

flask-app/.env/bin/base58

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/Users/jonathan/flask-app/.env/bin/python2.7
2+
3+
# -*- coding: utf-8 -*-
4+
import re
5+
import sys
6+
7+
from base58 import main
8+
9+
if __name__ == '__main__':
10+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
11+
sys.exit(main())

0 commit comments

Comments
 (0)